]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: constify struct clock_opts
authorThomas Weißschuh <thomas@t-8ch.de>
Tue, 4 Apr 2023 14:42:32 +0000 (14:42 +0000)
committerThomas Weißschuh <thomas@t-8ch.de>
Tue, 4 Apr 2023 16:36:20 +0000 (16:36 +0000)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
sys-utils/hwclock-cmos.c
sys-utils/hwclock-rtc.c
sys-utils/hwclock.c
sys-utils/hwclock.h

index 56ee624736260caf519c4113f415f65b403a6866..d3173fe9f5be786dd20f836ebfb72a5c30ef96de 100644 (file)
@@ -369,7 +369,7 @@ static const char *get_device_path(void)
        return NULL;
 }
 
-static struct clock_ops cmos_interface = {
+static const struct clock_ops cmos_interface = {
        N_("Using direct ISA access to the clock"),
        get_permissions_cmos,
        read_hardware_clock_cmos,
@@ -381,7 +381,7 @@ static struct clock_ops cmos_interface = {
 /*
  * return &cmos if cmos clock present, NULL otherwise.
  */
-struct clock_ops *probe_for_cmos_clock(void)
+const struct clock_ops *probe_for_cmos_clock(void)
 {
        return &cmos_interface;
 }
index 70c3a2fe7a984766fc5466b4410e4dc469614f79..b647c00bf34a18064da3714cf18e2d08a8608616 100644 (file)
@@ -142,7 +142,7 @@ static void close_rtc(void)
 
 static int open_rtc(const struct hwclock_control *ctl)
 {
-       static const char *fls[] = {
+       static const char * const fls[] = {
 #ifdef __ia64__
                "/dev/efirtc",
                "/dev/misc/efirtc",
@@ -406,7 +406,7 @@ static const char *get_device_path(void)
        return rtc_dev_name;
 }
 
-static struct clock_ops rtc_interface = {
+static const struct clock_ops rtc_interface = {
        N_("Using the rtc interface to the clock."),
        get_permissions_rtc,
        read_hardware_clock_rtc,
@@ -416,7 +416,7 @@ static struct clock_ops rtc_interface = {
 };
 
 /* return &rtc if /dev/rtc can be opened, NULL otherwise */
-struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl)
+const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl)
 {
        const int rtc_fd = open_rtc(ctl);
 
index ad1eb688e49600e497a385b52f9d26576e2d2e4a..0dfe7f0841b7a6c8bd0b6812de6f295e16a18408 100644 (file)
@@ -99,7 +99,7 @@ UL_DEBUG_DEFINE_MASK(hwclock);
 UL_DEBUG_DEFINE_MASKNAMES(hwclock) = UL_DEBUG_EMPTY_MASKNAMES;
 
 /* The struct that holds our hardware access routines */
-static struct clock_ops *ur;
+static const struct clock_ops *ur;
 
 /* Maximal clock adjustment in seconds per day.
    (adjtime() glibc call has 2145 seconds limit on i386, so it is good enough for us as well,
index 951857c2230f5f1e292f115eb8cd264ae7f633e6..b5b72d45d71080df105b18187ee8a7f2aab4ebcf 100644 (file)
@@ -65,8 +65,8 @@ struct clock_ops {
        const char *(*get_device_path) (void);
 };
 
-extern struct clock_ops *probe_for_cmos_clock(void);
-extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
+extern const struct clock_ops *probe_for_cmos_clock(void);
+extern const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
 
 /* hwclock.c */
 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);