Message type for VFS_{LINK,SYMLINK,RENAME}

Change-Id: If4569bac4584e053b7c4816fe47338327175fd44
This commit is contained in:
Lionel Sambuc 2014-05-12 13:47:18 +02:00
parent 74b01e0c2c
commit 1db8ecf0e4
6 changed files with 35 additions and 30 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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));
}

View file

@ -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));
}

View file

@ -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));
}

View file

@ -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);