]> Zhao Yanbai Git Server - minix.git/commitdiff
Message type for RTCDEV_*
authorLionel Sambuc <lionel@minix3.org>
Mon, 19 May 2014 07:19:01 +0000 (09:19 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:44 +0000 (17:05 +0200)
Change-Id: Ie4257e745e1d8b6a151934949f10c7fdb1ac4778

commands/readclock/readclock.c
drivers/readclock/forward.c
drivers/readclock/readclock.c
drivers/tps65950/tps65950.c
include/minix/com.h
include/minix/ipc.h

index 07741e3c8063c40e0593edf51350e4ceaf4800e7..9b1c254db298f99e573ad691f1b7bfc2f9887d7a 100644 (file)
@@ -148,11 +148,11 @@ readclock(int type, struct tm *t, int flags)
        }
 
        memset(&m, 0, sizeof(m));
-       m.RTCDEV_TM = (char *) t;
-       m.RTCDEV_FLAGS = flags;
+       m.m_lc_readclock_rtcdev.tm = (vir_bytes)t;
+       m.m_lc_readclock_rtcdev.flags = flags;
 
        r = _syscall(ep, type, &m);
-       if (r != RTCDEV_REPLY || m.RTCDEV_STATUS != 0) {
+       if (r != RTCDEV_REPLY || m.m_readclock_lc_rtcdev.status != 0) {
                if (!quiet) errmsg("Call to readclock.drv failed\n");
                exit(1);
        }
index 69b73f3dd7d30c265766413e9f16120f2fb71de9..77eb77057cca55572b953a19f726c40884436a25 100644 (file)
@@ -82,12 +82,12 @@ fwd_msg(int type, struct tm *t, int t_access, int flags)
                return -1;
        }
 
-       m.RTCDEV_GRANT = gid;
-       m.RTCDEV_FLAGS = flags;
+       m.m_lc_readclock_rtcdev.grant = gid;
+       m.m_lc_readclock_rtcdev.flags = flags;
 
        r = _syscall(ep, type, &m);
        cpf_revoke(gid);
-       if (r != RTCDEV_REPLY || m.RTCDEV_STATUS != 0) {
+       if (r != RTCDEV_REPLY || m.m_readclock_lc_rtcdev.status != 0) {
                log_warn(&log, "Call to '%s' failed.\n", target_label);
                return -1;
        }
index fba2adba01f625270a8e9d74541df732950daaf0..335f4ffac421347cc09d8924d8b771bf75703b3e 100644 (file)
@@ -71,14 +71,14 @@ main(int argc, char **argv)
                switch (m.m_type) {
                case RTCDEV_GET_TIME:
                        /* Any user can read the time */
-                       reply_status = rtc.get_time(&t, m.RTCDEV_FLAGS);
+                       reply_status = rtc.get_time(&t, m.m_lc_readclock_rtcdev.flags);
                        if (reply_status != OK) {
                                break;
                        }
 
                        /* write results back to calling process */
                        reply_status =
-                           store_t(caller, (vir_bytes) m.RTCDEV_TM, &t);
+                           store_t(caller, m.m_lc_readclock_rtcdev.tm, &t);
                        break;
 
                case RTCDEV_SET_TIME:
@@ -86,14 +86,14 @@ main(int argc, char **argv)
                        if (getnuid(caller) == SUPER_USER) {
                                /* read time from calling process */
                                reply_status =
-                                   fetch_t(caller, (vir_bytes) m.RTCDEV_TM,
+                                   fetch_t(caller, m.m_lc_readclock_rtcdev.tm,
                                    &t);
                                if (reply_status != OK) {
                                        break;
                                }
 
                                reply_status =
-                                   rtc.set_time(&t, m.RTCDEV_FLAGS);
+                                   rtc.set_time(&t, m.m_lc_readclock_rtcdev.flags);
                        } else {
                                reply_status = EPERM;
                        }
@@ -116,7 +116,7 @@ main(int argc, char **argv)
 
                /* Send Reply */
                m.m_type = RTCDEV_REPLY;
-               m.RTCDEV_STATUS = reply_status;
+               m.m_readclock_lc_rtcdev.status = reply_status;
 
                log_debug(&log, "Sending Reply");
 
index 12c0662946c557f16fa8d2a8bca9312a4c11c56a..e1dd0814bdfb2e34ea21b2f66794c0fb5e6805f4 100644 (file)
@@ -302,15 +302,14 @@ main(int argc, char *argv[])
                switch (m.m_type) {
                case RTCDEV_GET_TIME_G:
                        /* Any user can read the time */
-                       reply_status = rtc_get_time(&t, m.RTCDEV_FLAGS);
+                       reply_status = rtc_get_time(&t, m.m_lc_readclock_rtcdev.flags);
                        if (reply_status != OK) {
                                break;
                        }
 
                        /* write results back to calling process */
                        reply_status =
-                           store_t(caller, (cp_grant_id_t) m.RTCDEV_GRANT,
-                           &t);
+                           store_t(caller, m.m_lc_readclock_rtcdev.grant, &t);
                        break;
 
                case RTCDEV_SET_TIME_G:
@@ -319,13 +318,14 @@ main(int argc, char *argv[])
                                /* read time from calling process */
                                reply_status =
                                    fetch_t(caller,
-                                   (cp_grant_id_t) m.RTCDEV_GRANT, &t);
+                                           m.m_lc_readclock_rtcdev.grant, &t);
                                if (reply_status != OK) {
                                        break;
                                }
 
                                reply_status =
-                                   rtc_set_time(&t, m.RTCDEV_FLAGS);
+                                   rtc_set_time(&t,
+                                           m.m_lc_readclock_rtcdev.flags);
                        } else {
                                reply_status = EPERM;
                        }
@@ -343,7 +343,7 @@ main(int argc, char *argv[])
 
                /* Send Reply */
                m.m_type = RTCDEV_REPLY;
-               m.RTCDEV_STATUS = reply_status;
+               m.m_readclock_lc_rtcdev.status = reply_status;
 
                log_debug(&log, "Sending Reply");
 
index bd26da18ff4336c3acf5836e9465416ad6ac50b3..84e5816b912c096c697490bc737beb46ae5165bb 100644 (file)
 /* Message types for real time clock responses. */
 #define RTCDEV_REPLY   (RTCDEV_RS_BASE + 0)    /* general reply code */
 
-/* Field names for real time clock messages */
-#define RTCDEV_TM      m2_p1   /* pointer to struct tm */
-#define RTCDEV_FLAGS   m2_s1   /* clock flags flags */
-#define RTCDEV_STATUS  m2_i2   /* OK or error code */
-#define RTCDEV_GRANT   m2_i3   /* grant containing struct tm */
-
-/* Bits in 'RTCDEV_FLAGS' field of real time clock requests. */
+/* Bits in 'lc_readclock_rtcdev.flags' field of real time clock requests. */
 #define RTCDEV_NOFLAGS 0x00    /* no flags are set */
 #define RTCDEV_Y2KBUG  0x01    /* Interpret 1980 as 2000 for RTC w/Y2K bug */
 #define RTCDEV_CMOSREG 0x02    /* Also set the CMOS clock register bits. */
index e0fbfa8f0f6a4587f4f1fb6af340aadc8e467ea9..12bc0f460f2b2e232b0fe22694ef213ac95569c0 100644 (file)
@@ -313,6 +313,22 @@ typedef struct {
 } mess_lc_pm_time;
 _ASSERT_MSG_SIZE(mess_lc_pm_time);
 
+typedef struct {
+       cp_grant_id_t grant;
+       vir_bytes tm;                   /* struct tm * */
+       int flags;
+
+       uint8_t padding[44];
+} mess_lc_readclock_rtcdev;
+_ASSERT_MSG_SIZE(mess_lc_readclock_rtcdev);
+
+typedef struct {
+       int status;
+
+       uint8_t padding[52];
+} mess_readclock_lc_rtcdev;
+_ASSERT_MSG_SIZE(mess_readclock_lc_rtcdev);
+
 typedef struct {
        time_t sec;
 
@@ -1249,6 +1265,7 @@ typedef struct {
                mess_lc_pm_sysuname     m_lc_pm_sysuname;
                mess_lc_pm_time         m_lc_pm_time;
                mess_lc_pm_waitpid      m_lc_pm_waitpid;
+               mess_lc_readclock_rtcdev m_lc_readclock_rtcdev;
 
                mess_lc_vfs_chown       m_lc_vfs_chown;
                mess_lc_vfs_close       m_lc_vfs_close;
@@ -1313,6 +1330,8 @@ typedef struct {
 
                mess_pm_sched_scheduling_set_nice m_pm_sched_scheduling_set_nice;
 
+               mess_readclock_lc_rtcdev m_readclock_lc_rtcdev;
+
                mess_rs_pm_exec_restart m_rs_pm_exec_restart;
                mess_rs_pm_srv_kill     m_rs_pm_srv_kill;