3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

storage: Expose get_network_file_path in the header

This commit is contained in:
Andrew Zaborowski 2018-08-09 16:33:43 +02:00 committed by Denis Kenzior
parent 549021b5dd
commit 5f79acfd8d
2 changed files with 7 additions and 6 deletions

View File

@ -169,7 +169,7 @@ error_create_dirs:
return r; return r;
} }
static char *get_network_file_path(enum security type, const char *ssid) char *storage_get_network_file_path(enum security type, const char *ssid)
{ {
char *path; char *path;
const char *c; const char *c;
@ -260,7 +260,7 @@ struct l_settings *storage_network_open(enum security type, const char *ssid)
if (ssid == NULL) if (ssid == NULL)
return NULL; return NULL;
path = get_network_file_path(type, ssid); path = storage_get_network_file_path(type, ssid);
settings = l_settings_new(); settings = l_settings_new();
if (!l_settings_load_from_file(settings, path)) { if (!l_settings_load_from_file(settings, path)) {
@ -280,7 +280,7 @@ int storage_network_touch(enum security type, const char *ssid)
if (ssid == NULL) if (ssid == NULL)
return -EINVAL; return -EINVAL;
path = get_network_file_path(type, ssid); path = storage_get_network_file_path(type, ssid);
ret = utimensat(0, path, NULL, 0); ret = utimensat(0, path, NULL, 0);
l_free(path); l_free(path);
@ -300,7 +300,7 @@ int storage_network_get_mtime(enum security type, const char *ssid,
if (ssid == NULL) if (ssid == NULL)
return -EINVAL; return -EINVAL;
path = get_network_file_path(type, ssid); path = storage_get_network_file_path(type, ssid);
ret = stat(path, &sb); ret = stat(path, &sb);
l_free(path); l_free(path);
@ -323,7 +323,7 @@ void storage_network_sync(enum security type, const char *ssid,
size_t length = 0; size_t length = 0;
char *path; char *path;
path = get_network_file_path(type, ssid); path = storage_get_network_file_path(type, ssid);
data = l_settings_to_data(settings, &length); data = l_settings_to_data(settings, &length);
write_file(data, length, "%s", path); write_file(data, length, "%s", path);
l_free(data); l_free(data);
@ -335,7 +335,7 @@ int storage_network_remove(enum security type, const char *ssid)
char *path; char *path;
int ret; int ret;
path = get_network_file_path(type, ssid); path = storage_get_network_file_path(type, ssid);
ret = unlink(path); ret = unlink(path);
l_free(path); l_free(path);

View File

@ -33,6 +33,7 @@ ssize_t write_file(const void *buffer, size_t len, const char *path_fmt, ...)
const char *storage_network_ssid_from_path(const char *path, const char *storage_network_ssid_from_path(const char *path,
enum security *type); enum security *type);
char *storage_get_network_file_path(enum security type, const char *ssid);
struct l_settings *storage_network_open(enum security type, const char *ssid); struct l_settings *storage_network_open(enum security type, const char *ssid);
int storage_network_touch(enum security type, const char *ssid); int storage_network_touch(enum security type, const char *ssid);