From: Lionel Sambuc Date: Mon, 12 May 2014 11:47:18 +0000 (+0200) Subject: Message type for VFS_{LINK,SYMLINK,RENAME} X-Git-Tag: v3.3.0~310 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/mdoc.3.txt?a=commitdiff_plain;h=1db8ecf0e49cb592fb23f6a8eae89f8cdefd0c85;p=minix.git Message type for VFS_{LINK,SYMLINK,RENAME} Change-Id: If4569bac4584e053b7c4816fe47338327175fd44 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index ad6c92af6..500465c46 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -232,12 +232,6 @@ #define NR_VFS_CALLS 49 /* highest number from base plus one */ -/* Field names for the link(2), symlink(2), and rename(2) call. */ -#define VFS_LINK_NAME1 m1_p1 /* const char * */ -#define VFS_LINK_LEN1 m1_i1 /* size_t */ -#define VFS_LINK_NAME2 m1_p2 /* const char * */ -#define VFS_LINK_LEN2 m1_i2 /* size_t */ - /* Field names for the readlink(2) call. */ #define VFS_READLINK_NAME m1_p1 /* const char * */ #define VFS_READLINK_NAMELEN m1_i1 /* size_t */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 2228bf79e..55bdf2396 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -171,6 +171,16 @@ typedef struct { } mess_lc_vfs_ioctl; _ASSERT_MSG_SIZE(mess_lc_vfs_ioctl); +typedef struct { + vir_bytes name1; + vir_bytes name2; + size_t len1; + size_t len2; + + uint8_t padding[40]; +} mess_lc_vfs_link; +_ASSERT_MSG_SIZE(mess_lc_vfs_link); + typedef struct { off_t offset; @@ -743,6 +753,7 @@ typedef struct { mess_lc_vfs_fsync m_lc_vfs_fsync; mess_lc_vfs_getvfsstat m_lc_vfs_getvfsstat; mess_lc_vfs_ioctl m_lc_vfs_ioctl; + mess_lc_vfs_link m_lc_vfs_link; mess_lc_vfs_lseek m_lc_vfs_lseek; mess_lc_vfs_mount m_lc_vfs_mount; mess_lc_vfs_pipe2 m_lc_vfs_pipe2; diff --git a/lib/libc/sys-minix/link.c b/lib/libc/sys-minix/link.c index f9a29cd7b..c66b1a63a 100644 --- a/lib/libc/sys-minix/link.c +++ b/lib/libc/sys-minix/link.c @@ -10,9 +10,9 @@ int link(const char *name, const char *name2) message m; memset(&m, 0, sizeof(m)); - m.VFS_LINK_LEN1 = strlen(name) + 1; - m.VFS_LINK_LEN2 = strlen(name2) + 1; - m.VFS_LINK_NAME1 = (char *) __UNCONST(name); - m.VFS_LINK_NAME2 = (char *) __UNCONST(name2); + m.m_lc_vfs_link.len1 = strlen(name) + 1; + m.m_lc_vfs_link.len2 = strlen(name2) + 1; + m.m_lc_vfs_link.name1 = (vir_bytes)name; + m.m_lc_vfs_link.name2 = (vir_bytes)name2; return(_syscall(VFS_PROC_NR, VFS_LINK, &m)); } diff --git a/lib/libc/sys-minix/rename.c b/lib/libc/sys-minix/rename.c index 49847684c..d0438b915 100644 --- a/lib/libc/sys-minix/rename.c +++ b/lib/libc/sys-minix/rename.c @@ -14,9 +14,9 @@ int rename(const char *name, const char *name2) message m; memset(&m, 0, sizeof(m)); - m.VFS_LINK_LEN1 = strlen(name) + 1; - m.VFS_LINK_LEN2 = strlen(name2) + 1; - m.VFS_LINK_NAME1 = (char *) __UNCONST(name); - m.VFS_LINK_NAME2 = (char *) __UNCONST(name2); + m.m_lc_vfs_link.len1 = strlen(name) + 1; + m.m_lc_vfs_link.len2 = strlen(name2) + 1; + m.m_lc_vfs_link.name1 = (vir_bytes)name; + m.m_lc_vfs_link.name2 = (vir_bytes)name2; return(_syscall(VFS_PROC_NR, VFS_RENAME, &m)); } diff --git a/lib/libc/sys-minix/symlink.c b/lib/libc/sys-minix/symlink.c index 021084e29..3a471a166 100644 --- a/lib/libc/sys-minix/symlink.c +++ b/lib/libc/sys-minix/symlink.c @@ -10,9 +10,9 @@ int symlink(const char *name, const char *name2) message m; memset(&m, 0, sizeof(m)); - m.VFS_LINK_LEN1 = strlen(name) + 1; - m.VFS_LINK_LEN2 = strlen(name2) + 1; - m.VFS_LINK_NAME1 = (char *) __UNCONST(name); - m.VFS_LINK_NAME2 = (char *) __UNCONST(name2); + m.m_lc_vfs_link.len1 = strlen(name) + 1; + m.m_lc_vfs_link.len2 = strlen(name2) + 1; + m.m_lc_vfs_link.name1 = (vir_bytes)name; + m.m_lc_vfs_link.name2 = (vir_bytes)name2; return(_syscall(VFS_PROC_NR, VFS_SYMLINK, &m)); } diff --git a/servers/vfs/link.c b/servers/vfs/link.c index c69a67a5c..63f6a9b99 100644 --- a/servers/vfs/link.c +++ b/servers/vfs/link.c @@ -38,10 +38,10 @@ int do_link(void) vir_bytes vname1, vname2; size_t vname1_length, vname2_length; - vname1 = (vir_bytes) job_m_in.VFS_LINK_NAME1; - vname1_length = job_m_in.VFS_LINK_LEN1; - vname2 = (vir_bytes) job_m_in.VFS_LINK_NAME2; - vname2_length = job_m_in.VFS_LINK_LEN2; + vname1 = job_m_in.m_lc_vfs_link.name1; + vname1_length = job_m_in.m_lc_vfs_link.len1; + vname2 = job_m_in.m_lc_vfs_link.name2; + vname2_length = job_m_in.m_lc_vfs_link.len2; lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp1, &vp); resolve.l_vmnt_lock = VMNT_WRITE; @@ -179,10 +179,10 @@ int do_rename(void) vir_bytes vname1, vname2; size_t vname1_length, vname2_length; - vname1 = (vir_bytes) job_m_in.VFS_LINK_NAME1; - vname1_length = job_m_in.VFS_LINK_LEN1; - vname2 = (vir_bytes) job_m_in.VFS_LINK_NAME2; - vname2_length = job_m_in.VFS_LINK_LEN2; + vname1 = job_m_in.m_lc_vfs_link.name1; + vname1_length = job_m_in.m_lc_vfs_link.len1; + vname2 = job_m_in.m_lc_vfs_link.name2; + vname2_length = job_m_in.m_lc_vfs_link.len2; lookup_init(&resolve, fullpath, PATH_RET_SYMLINK, &oldvmp, &old_dirp); /* Do not yet request exclusive lock on vmnt to prevent deadlocks later on */ @@ -401,10 +401,10 @@ int do_slink(void) resolve.l_vmnt_lock = VMNT_WRITE; resolve.l_vnode_lock = VNODE_WRITE; - vname1 = (vir_bytes) job_m_in.VFS_LINK_NAME1; - vname1_length = job_m_in.VFS_LINK_LEN1; - vname2 = (vir_bytes) job_m_in.VFS_LINK_NAME2; - vname2_length = job_m_in.VFS_LINK_LEN2; + vname1 = job_m_in.m_lc_vfs_link.name1; + vname1_length = job_m_in.m_lc_vfs_link.len1; + vname2 = job_m_in.m_lc_vfs_link.name2; + vname2_length = job_m_in.m_lc_vfs_link.len2; if (vname1_length <= 1) return(ENOENT); if (vname1_length >= _POSIX_SYMLINK_MAX) return(ENAMETOOLONG);