]> Zhao Yanbai Git Server - minix.git/commitdiff
custom message type for VM_GETREF
authorBen Gras <ben@minix3.org>
Sat, 26 Jul 2014 11:53:46 +0000 (13:53 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:06:17 +0000 (17:06 +0200)
include/minix/com.h
include/minix/ipc.h
lib/libc/sys-minix/mmap.c
servers/vm/mmap.c

index e091a4d33be327f05e565fc0030bcbf5f631d95c..bce17cc6c1a4825dfd861241b17077ebdf0d287c 100644 (file)
 #define VM_GETPHYS             (VM_RQ_BASE+35)
 
 #define VM_GETREF              (VM_RQ_BASE+36)
-#      define VMREFCNT_ENDPT           m2_i1
-#      define VMREFCNT_ADDR            m2_l1
-#      define VMREFCNT_RETC            m2_i2
 
 #define VM_RS_SET_PRIV         (VM_RQ_BASE+37)
 #      define VM_RS_NR                 m2_i1
index 7401eb53ce3f3888e99c5f111ec70e7ca5f49e5c..a5616fc276bc69ae4874bb5af175fe4079bae86e 100644 (file)
@@ -1726,6 +1726,14 @@ typedef struct {
 } mess_lc_vm_getphys;
 _ASSERT_MSG_SIZE(mess_lc_vm_getphys);
 
+typedef struct {
+       endpoint_t      endpt;
+       void            *addr;
+       int             retc;
+       uint8_t         padding[44];
+} mess_lsys_vm_getref;
+_ASSERT_MSG_SIZE(mess_lsys_vm_getref);
+
 typedef struct {
        endpoint_t m_source;            /* who sent the message */
        int m_type;                     /* what kind of message is it */
@@ -1945,6 +1953,7 @@ typedef struct {
                mess_vfs_lc_lseek       m_vfs_lc_lseek;
 
                mess_lsys_vm_vmremap    m_lsys_vm_vmremap;
+               mess_lsys_vm_getref     m_lsys_vm_getref;
                mess_lc_vm_getphys      m_lc_vm_getphys;
                mess_lc_vm_shm_unmap    m_lc_vm_shm_unmap;
 
index 334cc7782f0d13014d10238355ebecb2a06c902a..d9edeaf3639bfbcd56134d2007730451f4a57b11 100644 (file)
@@ -161,12 +161,12 @@ u8_t vm_getrefcount(endpoint_t endpt, void *addr)
        int r;
 
        memset(&m, 0, sizeof(m));
-       m.VMREFCNT_ENDPT = endpt;
-       m.VMREFCNT_ADDR = (long) addr;
+       m.m_lsys_vm_getref.endpt = endpt;
+       m.m_lsys_vm_getref.addr  = addr;
 
        r = _syscall(VM_PROC_NR, VM_GETREF, &m);
        if (r != OK)
                return (u8_t) -1;
-       return (u8_t) m.VMREFCNT_RETC;
+       return (u8_t) m.m_lsys_vm_getref.retc;
 }
 
index d838df47f3aa904e071c2fd6cf3af214480029b8..c87f9e48425335df1662aa59a53703122379c090 100644 (file)
@@ -471,8 +471,8 @@ int do_get_refcount(message *m)
        u8_t cnt;
        vir_bytes addr;
 
-       target = m->VMREFCNT_ENDPT;
-       addr = m->VMREFCNT_ADDR;
+       target = m->m_lsys_vm_getref.endpt;
+       addr = (vir_bytes) m->m_lsys_vm_getref.addr;
 
        if ((r = vm_isokendpt(target, &n)) != OK)
                return EINVAL;
@@ -481,7 +481,7 @@ int do_get_refcount(message *m)
 
        r = map_get_ref(vmp, addr, &cnt);
 
-       m->VMREFCNT_RETC = cnt;
+       m->m_lsys_vm_getref.retc = cnt;
        return r;
 }