From: Kay Sievers Date: Thu, 22 May 2014 12:21:38 +0000 (+0900) Subject: shared: rename hwclock.[ch] to clock-util.[ch] X-Git-Tag: v213~31 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=24efb112451413c1013d5f7fe27d7e2cd407647a shared: rename hwclock.[ch] to clock-util.[ch] --- diff --git a/Makefile.am b/Makefile.am index cd7b6a300..f517f19df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -758,8 +758,8 @@ libsystemd_shared_la_SOURCES = \ src/shared/replace-var.h \ src/shared/spawn-polkit-agent.c \ src/shared/spawn-polkit-agent.h \ - src/shared/hwclock.c \ - src/shared/hwclock.h \ + src/shared/clock-util.c \ + src/shared/clock-util.h \ src/shared/time-dst.c \ src/shared/time-dst.h \ src/shared/calendarspec.c \ diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index d5fab0a22..333c1d46e 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -28,7 +28,7 @@ #include "install.h" #include "selinux-access.h" #include "watchdog.h" -#include "hwclock.h" +#include "clock-util.h" #include "path-util.h" #include "virt.h" #include "architecture.h" @@ -130,7 +130,7 @@ static int property_get_tainted( if (access("/proc/cgroups", F_OK) < 0) e = stpcpy(e, "cgroups-missing:"); - if (hwclock_is_localtime() > 0) + if (clock_is_localtime() > 0) e = stpcpy(e, "local-hwclock:"); /* remove the last ':' */ diff --git a/src/core/main.c b/src/core/main.c index 74c50f51b..77cc2fbbd 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -61,7 +61,7 @@ #include "capability.h" #include "killall.h" #include "env-util.h" -#include "hwclock.h" +#include "clock-util.h" #include "fileio.h" #include "dbus-manager.h" #include "bus-error.h" @@ -1352,11 +1352,11 @@ int main(int argc, char *argv[]) { goto finish; if (!skip_setup) { - if (hwclock_is_localtime() > 0) { + if (clock_is_localtime() > 0) { int min; /* The first-time call to settimeofday() does a time warp in the kernel */ - r = hwclock_set_timezone(&min); + r = clock_set_timezone(&min); if (r < 0) log_error("Failed to apply local time delta, ignoring: %s", strerror(-r)); else @@ -1370,10 +1370,10 @@ int main(int argc, char *argv[]) { * that way. In such case, we need to delay the time-warp or the sealing * until we reach the real system. */ - hwclock_reset_timezone(); + clock_reset_timezone(); /* Tell the kernel our timezone */ - r = hwclock_set_timezone(NULL); + r = clock_set_timezone(NULL); if (r < 0) log_error("Failed to set the kernel's timezone, ignoring: %s", strerror(-r)); } diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index 70049d31f..267cd7401 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -35,7 +35,7 @@ #include "util.h" #include "spawn-polkit-agent.h" #include "build.h" -#include "hwclock.h" +#include "clock-util.h" #include "strv.h" #include "sd-id128.h" #include "virt.h" diff --git a/src/shared/hwclock.c b/src/shared/clock-util.c similarity index 94% rename from src/shared/hwclock.c rename to src/shared/clock-util.c index 7059d9c75..15535732f 100644 --- a/src/shared/hwclock.c +++ b/src/shared/clock-util.c @@ -40,10 +40,10 @@ #include "util.h" #include "log.h" #include "strv.h" -#include "hwclock.h" +#include "clock-util.h" #include "fileio.h" -int hwclock_get_time(struct tm *tm) { +int clock_get_time(struct tm *tm) { _cleanup_close_ int fd = -1; assert(tm); @@ -64,7 +64,7 @@ int hwclock_get_time(struct tm *tm) { return 0; } -int hwclock_set_time(const struct tm *tm) { +int clock_set_time(const struct tm *tm) { _cleanup_close_ int fd = -1; assert(tm); @@ -79,7 +79,7 @@ int hwclock_set_time(const struct tm *tm) { return 0; } -int hwclock_is_localtime(void) { +int clock_is_localtime(void) { _cleanup_fclose_ FILE *f; /* @@ -109,7 +109,7 @@ int hwclock_is_localtime(void) { return 0; } -int hwclock_set_timezone(int *min) { +int clock_set_timezone(int *min) { const struct timeval *tv_null = NULL; struct timespec ts; struct tm *tm; @@ -135,7 +135,7 @@ int hwclock_set_timezone(int *min) { return 0; } -int hwclock_reset_timezone(void) { +int clock_reset_timezone(void) { const struct timeval *tv_null = NULL; struct timezone tz; diff --git a/src/shared/hwclock.h b/src/shared/clock-util.h similarity index 81% rename from src/shared/hwclock.h rename to src/shared/clock-util.h index 4330b8ea8..63d96fca6 100644 --- a/src/shared/hwclock.h +++ b/src/shared/clock-util.h @@ -21,8 +21,8 @@ along with systemd; If not, see . ***/ -int hwclock_is_localtime(void); -int hwclock_set_timezone(int *min); -int hwclock_reset_timezone(void); -int hwclock_get_time(struct tm *tm); -int hwclock_set_time(const struct tm *tm); +int clock_is_localtime(void); +int clock_set_timezone(int *min); +int clock_reset_timezone(void); +int clock_get_time(struct tm *tm); +int clock_set_time(const struct tm *tm); diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c index 3e0f70cfd..95255def2 100644 --- a/src/timedate/timedated.c +++ b/src/timedate/timedated.c @@ -31,7 +31,7 @@ #include "util.h" #include "strv.h" #include "def.h" -#include "hwclock.h" +#include "clock-util.h" #include "conf-files.h" #include "path-util.h" #include "fileio-label.h" @@ -153,7 +153,7 @@ have_timezone: c->zone = NULL; } - c->local_rtc = hwclock_is_localtime() > 0; + c->local_rtc = clock_is_localtime() > 0; return 0; } @@ -465,7 +465,7 @@ static int property_get_rtc_time( int r; zero(tm); - r = hwclock_get_time(&tm); + r = clock_get_time(&tm); if (r == -EBUSY) { log_warning("/dev/rtc is busy. Is somebody keeping it open continuously? That's not a good idea... Returning a bogus RTC timestamp."); t = 0; @@ -546,7 +546,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s } /* 2. Tell the kernel our timezone */ - hwclock_set_timezone(NULL); + clock_set_timezone(NULL); if (c->local_rtc) { struct timespec ts; @@ -555,7 +555,7 @@ static int method_set_timezone(sd_bus *bus, sd_bus_message *m, void *userdata, s /* 3. Sync RTC from system clock, with the new delta */ assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0); assert_se(tm = localtime(&ts.tv_sec)); - hwclock_set_time(tm); + clock_set_time(tm); } log_struct(LOG_INFO, @@ -602,7 +602,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, } /* 2. Tell the kernel our timezone */ - hwclock_set_timezone(NULL); + clock_set_timezone(NULL); /* 3. Synchronize clocks */ assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0); @@ -621,7 +621,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, /* Override the main fields of * struct tm, but not the timezone * fields */ - if (hwclock_get_time(&tm) >= 0) { + if (clock_get_time(&tm) >= 0) { /* And set the system clock * with this */ @@ -642,7 +642,7 @@ static int method_set_local_rtc(sd_bus *bus, sd_bus_message *m, void *userdata, else tm = gmtime(&ts.tv_sec); - hwclock_set_time(tm); + clock_set_time(tm); } log_info("RTC configured to %s time.", c->local_rtc ? "local" : "UTC"); @@ -706,7 +706,7 @@ static int method_set_time(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu else tm = gmtime(&ts.tv_sec); - hwclock_set_time(tm); + clock_set_time(tm); log_struct(LOG_INFO, MESSAGE_ID(SD_MESSAGE_TIME_CHANGE),