Message type for VFS_READLINK

Change-Id: I5da187cd22147448daa5a82568f0bd8bdcc2906f
This commit is contained in:
Lionel Sambuc 2014-05-12 14:05:17 +02:00
parent 1db8ecf0e4
commit c5b1fc6f0d
4 changed files with 19 additions and 14 deletions

View file

@ -232,12 +232,6 @@
#define NR_VFS_CALLS 49 /* highest number from base plus one */
/* Field names for the readlink(2) call. */
#define VFS_READLINK_NAME m1_p1 /* const char * */
#define VFS_READLINK_NAMELEN m1_i1 /* size_t */
#define VFS_READLINK_BUF m1_p2 /* char * */
#define VFS_READLINK_BUFSIZE m1_i2 /* size_t */
/* 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 */

View file

@ -222,6 +222,16 @@ typedef struct {
} mess_lc_vfs_pipe2;
_ASSERT_MSG_SIZE(mess_lc_vfs_pipe2);
typedef struct {
vir_bytes name; /* const char * */
size_t namelen;
vir_bytes buf;
size_t bufsize;
uint8_t padding[40];
} mess_lc_vfs_readlink;
_ASSERT_MSG_SIZE(mess_lc_vfs_readlink);
typedef struct {
uint32_t nfds;
fd_set *readfds;
@ -757,6 +767,7 @@ typedef struct {
mess_lc_vfs_lseek m_lc_vfs_lseek;
mess_lc_vfs_mount m_lc_vfs_mount;
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_statvfs1 m_lc_vfs_statvfs1;
mess_lc_vfs_truncate m_lc_vfs_truncate;

View file

@ -14,10 +14,10 @@ ssize_t readlink(const char *name, char *buffer, size_t bufsiz)
message m;
memset(&m, 0, sizeof(m));
m.VFS_READLINK_NAMELEN = strlen(name) + 1;
m.VFS_READLINK_BUFSIZE = bufsiz;
m.VFS_READLINK_NAME = (char *) __UNCONST(name);
m.VFS_READLINK_BUF = (char *) buffer;
m.m_lc_vfs_readlink.namelen = strlen(name) + 1;
m.m_lc_vfs_readlink.bufsize = bufsiz;
m.m_lc_vfs_readlink.name = (vir_bytes)name;
m.m_lc_vfs_readlink.buf = (vir_bytes)buffer;
return(_syscall(VFS_PROC_NR, VFS_READLINK, &m));
}

View file

@ -480,10 +480,10 @@ int do_rdlink(void)
size_t vname_length, buf_size;
vir_bytes buf;
vname = (vir_bytes) job_m_in.VFS_READLINK_NAME;
vname_length = job_m_in.VFS_READLINK_NAMELEN;
buf = (vir_bytes) job_m_in.VFS_READLINK_BUF;
buf_size = (size_t) job_m_in.VFS_READLINK_BUFSIZE;
vname = job_m_in.m_lc_vfs_readlink.name;
vname_length = job_m_in.m_lc_vfs_readlink.namelen;
buf = job_m_in.m_lc_vfs_readlink.buf;
buf_size = job_m_in.m_lc_vfs_readlink.bufsize;
if (buf_size > SSIZE_MAX) return(EINVAL);
lookup_init(&resolve, fullpath, PATH_RET_SYMLINK, &vmp, &vp);