From ec130c9b4b59c12f5194c27a99cd5a924a02f5a7 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 19 May 2014 11:37:26 +0200 Subject: [PATCH] Message type for {PM,VFS,RS,DS}_GETSYSINFO Change-Id: I64d89f8a1c4704d0d0f420eb1e434cc96fd6351a --- include/minix/com.h | 9 --------- include/minix/ipc.h | 11 +++++++++++ lib/libsys/getsysinfo.c | 6 +++--- servers/ds/store.c | 6 +++--- servers/pm/misc.c | 6 +++--- servers/rs/request.c | 6 +++--- servers/vfs/misc.c | 6 +++--- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/include/minix/com.h b/include/minix/com.h index 9e8b37b25..7736cb0c3 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -1226,15 +1226,6 @@ #define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */ #define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */ -/*===========================================================================* - * Field names shared across several call codes * - *===========================================================================*/ - -/* Field names for the getsysinfo(2) call. */ -#define SI_WHAT m1_i1 /* int */ -#define SI_WHERE m1_p1 /* void */ -#define SI_SIZE m1_i2 /* size_t */ - /*===========================================================================* * Internal codes used by several services * *===========================================================================*/ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 2e8311be4..9e362a91d 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -680,6 +680,15 @@ typedef struct { } mess_linputdriver_input_event; _ASSERT_MSG_SIZE(mess_linputdriver_input_event); +typedef struct { + int what; + vir_bytes where; + size_t size; + + uint8_t padding[44]; +} mess_lsys_getsysinfo; +_ASSERT_MSG_SIZE(mess_lsys_getsysinfo); + typedef struct { uint32_t flags; endpoint_t endpoint; @@ -1364,6 +1373,8 @@ typedef struct { mess_linputdriver_input_event m_linputdriver_input_event; + mess_lsys_getsysinfo m_lsys_getsysinfo; + mess_lsys_krn_schedctl m_lsys_krn_schedctl; mess_lsys_krn_schedule m_lsys_krn_schedule; diff --git a/lib/libsys/getsysinfo.c b/lib/libsys/getsysinfo.c index a5a4fbc7d..7154b5852 100644 --- a/lib/libsys/getsysinfo.c +++ b/lib/libsys/getsysinfo.c @@ -25,8 +25,8 @@ int getsysinfo( } memset(&m, 0, sizeof(m)); - m.SI_WHAT = what; - m.SI_WHERE = where; - m.SI_SIZE = size; + m.m_lsys_getsysinfo.what = what; + m.m_lsys_getsysinfo.where = where; + m.m_lsys_getsysinfo.size = size; return _taskcall(who, call_nr, &m); } diff --git a/servers/ds/store.c b/servers/ds/store.c index 93a9f6a63..3e1309e52 100644 --- a/servers/ds/store.c +++ b/servers/ds/store.c @@ -634,7 +634,7 @@ int do_getsysinfo(const message *m_ptr) size_t length; int s; - switch(m_ptr->SI_WHAT) { + switch(m_ptr->m_lsys_getsysinfo.what) { case SI_DATA_STORE: src_addr = (vir_bytes)ds_store; length = sizeof(struct data_store) * NR_DS_KEYS; @@ -643,11 +643,11 @@ int do_getsysinfo(const message *m_ptr) return EINVAL; } - if (length != m_ptr->SI_SIZE) + if (length != m_ptr->m_lsys_getsysinfo.size) return EINVAL; if (OK != (s=sys_datacopy(SELF, src_addr, - m_ptr->m_source, (vir_bytes)m_ptr->SI_WHERE, length))) { + m_ptr->m_source, m_ptr->m_lsys_getsysinfo.where, length))) { printf("DS: copy failed: %d\n", s); return s; } diff --git a/servers/pm/misc.c b/servers/pm/misc.c index f7781d791..74076f219 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -139,7 +139,7 @@ int do_getsysinfo() return EPERM; } - switch(m_in.SI_WHAT) { + switch(m_in.m_lsys_getsysinfo.what) { case SI_PROC_TAB: /* copy entire process table */ src_addr = (vir_bytes) mproc; len = sizeof(struct mproc) * NR_PROCS; @@ -154,10 +154,10 @@ int do_getsysinfo() return(EINVAL); } - if (len != m_in.SI_SIZE) + if (len != m_in.m_lsys_getsysinfo.size) return(EINVAL); - dst_addr = (vir_bytes) m_in.SI_WHERE; + dst_addr = m_in.m_lsys_getsysinfo.where; return sys_datacopy(SELF, src_addr, who_e, dst_addr, len); } diff --git a/servers/rs/request.c b/servers/rs/request.c index 9212998e4..5345e9c98 100755 --- a/servers/rs/request.c +++ b/servers/rs/request.c @@ -874,7 +874,7 @@ message *m_ptr; if((s = check_call_permission(m_ptr->m_source, 0, NULL)) != OK) return s; - switch(m_ptr->SI_WHAT) { + switch(m_ptr->m_lsys_getsysinfo.what) { case SI_PROC_TAB: src_addr = (vir_bytes) rproc; len = sizeof(struct rproc) * NR_SYS_PROCS; @@ -887,11 +887,11 @@ message *m_ptr; return(EINVAL); } - if (len != m_ptr->SI_SIZE) + if (len != m_ptr->m_lsys_getsysinfo.size) return(EINVAL); dst_proc = m_ptr->m_source; - dst_addr = (vir_bytes) m_ptr->SI_WHERE; + dst_addr = m_ptr->m_lsys_getsysinfo.where; return sys_datacopy(SELF, src_addr, dst_proc, dst_addr, len); } diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index e35dc323c..65617d2a3 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -56,9 +56,9 @@ int do_getsysinfo(void) size_t len, buf_size; int what; - what = job_m_in.SI_WHAT; - dst_addr = (vir_bytes) job_m_in.SI_WHERE; - buf_size = (size_t) job_m_in.SI_SIZE; + what = job_m_in.m_lsys_getsysinfo.what; + dst_addr = job_m_in.m_lsys_getsysinfo.where; + buf_size = job_m_in.m_lsys_getsysinfo.size; /* Only su may call do_getsysinfo. This call may leak information (and is not * stable enough to be part of the API/ABI). In the future, requests from