mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
storage: add storage_network_get_mtime
This commit is contained in:
parent
e153d94989
commit
cbff1372e8
@ -203,6 +203,32 @@ int storage_network_touch(const char *type, const char *ssid)
|
||||
return -errno;
|
||||
}
|
||||
|
||||
int storage_network_get_mtime(const char *type, const char *ssid,
|
||||
struct timespec *mtim)
|
||||
{
|
||||
char *path;
|
||||
int ret;
|
||||
struct stat sb;
|
||||
|
||||
if (ssid == NULL || type == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
path = l_strdup_printf(STORAGEDIR "/%s.%s", ssid, type);
|
||||
ret = stat(path, &sb);
|
||||
l_free(path);
|
||||
|
||||
if (ret < 0)
|
||||
return -errno;
|
||||
|
||||
if (!S_ISREG(sb.st_mode))
|
||||
return -EINVAL;
|
||||
|
||||
if (mtim)
|
||||
memcpy(mtim, &sb.st_mtim, sizeof(struct timespec));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void storage_network_sync(const char *type, const char *ssid,
|
||||
struct l_settings *settings)
|
||||
{
|
||||
|
@ -32,5 +32,7 @@ ssize_t write_file(const void *buffer, size_t len, const char *path_fmt, ...)
|
||||
|
||||
struct l_settings *storage_network_open(const char *type, const char *ssid);
|
||||
int storage_network_touch(const char *type, const char *ssid);
|
||||
int storage_network_get_mtime(const char *type, const char *ssid,
|
||||
struct timespec *mtim);
|
||||
void storage_network_sync(const char *type, const char *ssid,
|
||||
struct l_settings *settings);
|
||||
|
Loading…
Reference in New Issue
Block a user