From cd0fd5e72550e5ae5b4413a8f5debe18e67e4152 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Mon, 12 May 2014 14:12:18 +0200 Subject: [PATCH] Message type for VFS_{,L}STAT Change-Id: I61db8484c14f0371214a0495774dc0b1d97f2099 --- include/minix/callnr.h | 5 ----- include/minix/ipc.h | 10 ++++++++++ lib/libc/sys-minix/stat.c | 12 ++++++------ servers/vfs/stadir.c | 12 ++++++------ 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/minix/callnr.h b/include/minix/callnr.h index 395ea7979..c4915d08e 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -232,11 +232,6 @@ #define NR_VFS_CALLS 49 /* highest number from base plus one */ -/* Field names for the stat(2) and lstat(2) calls. */ -#define VFS_STAT_NAME m1_p1 /* const char * */ -#define VFS_STAT_LEN m1_i1 /* size_t */ -#define VFS_STAT_BUF m1_p2 /* struct stat * */ - /* Field names for the fstat(2) call. */ #define VFS_FSTAT_FD m1_i1 /* int */ #define VFS_FSTAT_BUF m1_p1 /* struct stat * */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c7cf01e98..42bea3f58 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -243,6 +243,15 @@ typedef struct { } mess_lc_vfs_select; _ASSERT_MSG_SIZE(mess_lc_vfs_select); +typedef struct { + size_t len; + vir_bytes name; /* const char * */ + vir_bytes buf; /* struct stat * */ + + uint8_t padding[44]; +} mess_lc_vfs_stat; +_ASSERT_MSG_SIZE(mess_lc_vfs_stat); + typedef struct { int fd; int flags; @@ -769,6 +778,7 @@ typedef struct { mess_lc_vfs_pipe2 m_lc_vfs_pipe2; mess_lc_vfs_readlink m_lc_vfs_readlink; mess_lc_vfs_select m_lc_vfs_select; + mess_lc_vfs_stat m_lc_vfs_stat; mess_lc_vfs_statvfs1 m_lc_vfs_statvfs1; mess_lc_vfs_truncate m_lc_vfs_truncate; mess_lc_vfs_umask m_lc_vfs_umask; diff --git a/lib/libc/sys-minix/stat.c b/lib/libc/sys-minix/stat.c index bc86bc1b0..371de65a8 100644 --- a/lib/libc/sys-minix/stat.c +++ b/lib/libc/sys-minix/stat.c @@ -20,9 +20,9 @@ int stat(const char *name, struct stat *buffer) message m; memset(&m, 0, sizeof(m)); - m.VFS_STAT_LEN = strlen(name) + 1; - m.VFS_STAT_NAME = (char *) __UNCONST(name); - m.VFS_STAT_BUF = (char *) buffer; + m.m_lc_vfs_stat.len = strlen(name) + 1; + m.m_lc_vfs_stat.name = (vir_bytes)name; + m.m_lc_vfs_stat.buf = (vir_bytes)buffer; return _syscall(VFS_PROC_NR, VFS_STAT, &m); } @@ -43,9 +43,9 @@ int lstat(const char *name, struct stat *buffer) message m; memset(&m, 0, sizeof(m)); - m.VFS_STAT_LEN = strlen(name) + 1; - m.VFS_STAT_NAME = (char *) __UNCONST(name); - m.VFS_STAT_BUF = (char *) buffer; + m.m_lc_vfs_stat.len = strlen(name) + 1; + m.m_lc_vfs_stat.name = (vir_bytes)name; + m.m_lc_vfs_stat.buf = (vir_bytes)buffer; return _syscall(VFS_PROC_NR, VFS_LSTAT, &m); } diff --git a/servers/vfs/stadir.c b/servers/vfs/stadir.c index 1993826f2..e85be0075 100644 --- a/servers/vfs/stadir.c +++ b/servers/vfs/stadir.c @@ -148,9 +148,9 @@ int do_stat(void) vir_bytes vname1, statbuf; size_t vname1_length; - vname1 = (vir_bytes) job_m_in.VFS_STAT_NAME; - vname1_length = (size_t) job_m_in.VFS_STAT_LEN; - statbuf = (vir_bytes) job_m_in.VFS_STAT_BUF; + vname1 = job_m_in.m_lc_vfs_stat.name; + vname1_length = job_m_in.m_lc_vfs_stat.len; + statbuf = job_m_in.m_lc_vfs_stat.buf; lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp); resolve.l_vmnt_lock = VMNT_READ; @@ -426,9 +426,9 @@ int do_lstat(void) vir_bytes vname1, statbuf; size_t vname1_length; - vname1 = (vir_bytes) job_m_in.VFS_STAT_NAME; - vname1_length = (size_t) job_m_in.VFS_STAT_LEN; - statbuf = (vir_bytes) job_m_in.VFS_STAT_BUF; + vname1 = job_m_in.m_lc_vfs_stat.name; + vname1_length = job_m_in.m_lc_vfs_stat.len; + statbuf = job_m_in.m_lc_vfs_stat.buf; lookup_init(&resolve, fullpath, PATH_RET_SYMLINK, &vmp, &vp); resolve.l_vmnt_lock = VMNT_READ; -- 2.44.0