diff options
author | Tom Gundersen <teg@jklm.no> | 2013-10-29 15:15:53 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-10-29 16:12:11 +0100 |
commit | 97f2d76d4f4dfab8b0629c09926a05a1e5621125 (patch) | |
tree | 3b6042e8487f4b02bc7dc74233dd9f65b5bd1801 /src/udev/net/link-config.c | |
parent | dabfa9d1efd0d1a7e0507d69f9789bc6404ff786 (diff) |
path_check_timestamp: only keep the most recent timestamp
There is no point in keeping one timestamp for each directory, as we only
ever care about the most recent one.
Diffstat (limited to 'src/udev/net/link-config.c')
-rw-r--r-- | src/udev/net/link-config.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c index 0b5916be4c..598f93e384 100644 --- a/src/udev/net/link-config.c +++ b/src/udev/net/link-config.c @@ -46,7 +46,7 @@ struct link_config_ctx { sd_rtnl *rtnl; char **link_dirs; - usec_t *link_dirs_ts_usec; + usec_t link_dirs_ts_usec; }; int link_config_ctx_new(link_config_ctx **ret) { @@ -89,12 +89,6 @@ int link_config_ctx_new(link_config_ctx **ret) { return -ENOMEM; } - ctx->link_dirs_ts_usec = calloc(strv_length(ctx->link_dirs), sizeof(usec_t)); - if(!ctx->link_dirs_ts_usec) { - link_config_ctx_free(ctx); - return -ENOMEM; - } - *ret = ctx; return 0; } @@ -126,7 +120,6 @@ void link_config_ctx_free(link_config_ctx *ctx) { sd_rtnl_unref(ctx->rtnl); strv_free(ctx->link_dirs); - free(ctx->link_dirs_ts_usec); link_configs_free(ctx); free(ctx); @@ -183,8 +176,8 @@ int link_config_load(link_config_ctx *ctx) { link_configs_free(ctx); - /* update timestamps */ - paths_check_timestamp(ctx->link_dirs, ctx->link_dirs_ts_usec, true); + /* update timestamp */ + paths_check_timestamp(ctx->link_dirs, &ctx->link_dirs_ts_usec, true); r = conf_files_list_strv(&files, ".link", NULL, (const char **)ctx->link_dirs); if (r < 0) { @@ -202,7 +195,7 @@ int link_config_load(link_config_ctx *ctx) { } bool link_config_should_reload(link_config_ctx *ctx) { - return paths_check_timestamp(ctx->link_dirs, ctx->link_dirs_ts_usec, false); + return paths_check_timestamp(ctx->link_dirs, &ctx->link_dirs_ts_usec, false); } static bool match_config(link_config *match, struct udev_device *device) { |