diff options
author | Sami Kerola | 2016-07-16 17:45:07 +0200 |
---|---|---|
committer | Sami Kerola | 2017-02-05 00:39:37 +0100 |
commit | 336f7c5f684be96b4908cd3f02226964ed302e63 (patch) | |
tree | d1de0ec622de82419f6092f6badfdbc9bf8d35e0 /sys-utils/hwclock.h | |
parent | hwclock: remove unnecessary type casts (diff) | |
download | kernel-qcow2-util-linux-336f7c5f684be96b4908cd3f02226964ed302e63.tar.gz kernel-qcow2-util-linux-336f7c5f684be96b4908cd3f02226964ed302e63.tar.xz kernel-qcow2-util-linux-336f7c5f684be96b4908cd3f02226964ed302e63.zip |
hwclock: move command-line options to control structure
The control structure is read-only everywhere else but in main(). Almost
all changes are about how variables are referred, with one exception. Calls
to read_adjtime() from manipulate_clock() and compare_clock() are moved to
main(). This way it is possible to keep variable that tells if hwclock is
using UTC-0 be part of control structure.
Changes within #ifdef __alpha__ segments were tested by flipping the
preprocessor directivive otherway around and getting good compilaton all the
way to the point where linking on none-alpha system failed.
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/hwclock.h')
-rw-r--r-- | sys-utils/hwclock.h | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h index d58ebbc6f..c76068c88 100644 --- a/sys-utils/hwclock.h +++ b/sys-utils/hwclock.h @@ -9,16 +9,57 @@ #include "c.h" +struct hwclock_control { + char *date_opt; + unsigned long epoch_option; + char *adj_file_name; +#ifdef __linux__ + char *rtc_dev_name; +#endif + unsigned int debug; + unsigned int +#ifdef HAVE_LIBAUDIT + hwaudit_on:1, +#endif + adjust:1, + compare:1, + show:1, + hctosys:1, + utc:1, + systohc:1, +#ifdef __alpha__ + ARCconsole:1, + Jensen:1, + SRM:1, + funky_toy:1, +#endif +#ifdef __linux__ + getepoch:1, + setepoch:1, +#endif + noadjfile:1, + local_opt:1, + badyear:1, + directisa:1, + testing:1, + systz:1, + predict:1, + get:1, + set:1, + update:1, + universal:1; /* will store hw_clock_is_utc() return value */ +}; + struct clock_ops { char *interface_name; int (*get_permissions) (void); - int (*read_hardware_clock) (struct tm * tm); - int (*set_hardware_clock) (const struct tm * tm); - int (*synchronize_to_clock_tick) (void); + int (*read_hardware_clock) (const struct hwclock_control *ctl, struct tm * tm); + int (*set_hardware_clock) (const struct hwclock_control *ctl, const struct tm * tm); + int (*synchronize_to_clock_tick) (const struct hwclock_control *ctl); }; extern struct clock_ops *probe_for_cmos_clock(void); -extern struct clock_ops *probe_for_rtc_clock(void); +extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl); typedef int bool; @@ -27,14 +68,13 @@ extern int debug; extern unsigned long epoch_option; extern double time_diff(struct timeval subtrahend, struct timeval subtractor); /* cmos.c */ -extern void set_cmos_epoch(int ARCconsole, int SRM); -extern void set_cmos_access(int Jensen, int funky_toy); +extern void set_cmos_epoch(const struct hwclock_control *ctl); +extern void set_cmos_access(const struct hwclock_control *ctl); /* rtc.c */ -extern int get_epoch_rtc(unsigned long *epoch, int silent); -extern int set_epoch_rtc(unsigned long epoch); -extern char *rtc_dev_name; +extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch, int silent); +extern int set_epoch_rtc(const struct hwclock_control *ctl); -extern void hwclock_exit(int status); +extern void hwclock_exit(const struct hwclock_control *ctl, int status); #endif /* HWCLOCK_CLOCK_H */ |