From: Lionel Sambuc Date: Mon, 19 May 2014 07:19:01 +0000 (+0200) Subject: Message type for RTCDEV_* X-Git-Tag: v3.3.0~242 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.host.html?a=commitdiff_plain;h=d6626d05750c64048ccf7a5ffaea029ab981a6e0;p=minix.git Message type for RTCDEV_* Change-Id: Ie4257e745e1d8b6a151934949f10c7fdb1ac4778 --- diff --git a/commands/readclock/readclock.c b/commands/readclock/readclock.c index 07741e3c8..9b1c254db 100644 --- a/commands/readclock/readclock.c +++ b/commands/readclock/readclock.c @@ -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); } diff --git a/drivers/readclock/forward.c b/drivers/readclock/forward.c index 69b73f3dd..77eb77057 100644 --- a/drivers/readclock/forward.c +++ b/drivers/readclock/forward.c @@ -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; } diff --git a/drivers/readclock/readclock.c b/drivers/readclock/readclock.c index fba2adba0..335f4ffac 100644 --- a/drivers/readclock/readclock.c +++ b/drivers/readclock/readclock.c @@ -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"); diff --git a/drivers/tps65950/tps65950.c b/drivers/tps65950/tps65950.c index 12c066294..e1dd0814b 100644 --- a/drivers/tps65950/tps65950.c +++ b/drivers/tps65950/tps65950.c @@ -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"); diff --git a/include/minix/com.h b/include/minix/com.h index bd26da18f..84e5816b9 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1230,13 +1230,7 @@ /* 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. */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index e0fbfa8f0..12bc0f460 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -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;