Message type for VFS_CREAT

Change-Id: Ica111f1b2005a6ff42dc3bb59ac3158a2e12678c
This commit is contained in:
Lionel Sambuc 2014-05-12 16:42:43 +02:00
parent cef3ce969a
commit c869546226
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 creat(2) call. */
#define VFS_CREAT_NAME m1_p1 /* const char * */
#define VFS_CREAT_LEN m1_i1 /* size_t */
#define VFS_CREAT_FLAGS m1_i2 /* int */
#define VFS_CREAT_MODE m1_i3 /* mode_t */
/* Field names for the chown(2) and fchown(2) calls. */
#define VFS_CHOWN_NAME m1_p1 /* const char * */
#define VFS_CHOWN_LEN m1_i1 /* size_t */

View file

@ -145,6 +145,16 @@ typedef struct {
} mess_sigcalls;
_ASSERT_MSG_SIZE(mess_sigcalls);
typedef struct {
vir_bytes name;
size_t len;
int flags;
mode_t mode;
uint8_t padding[40];
} mess_lc_vfs_creat;
_ASSERT_MSG_SIZE(mess_lc_vfs_creat);
typedef struct {
int fd;
int cmd;
@ -806,6 +816,7 @@ typedef struct {
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
mess_fs_vfs_readwrite m_fs_vfs_readwrite;
mess_lc_vfs_creat m_lc_vfs_creat;
mess_lc_vfs_fcntl m_lc_vfs_fcntl;
mess_lc_vfs_fstat m_lc_vfs_fstat;
mess_lc_vfs_fsync m_lc_vfs_fsync;

View file

@ -18,10 +18,10 @@ int open(const char *name, int flags, ...)
* and therefore a different call number as well.
*/
if (flags & O_CREAT) {
m.VFS_CREAT_LEN = strlen(name) + 1;
m.VFS_CREAT_FLAGS = flags;
m.VFS_CREAT_MODE = va_arg(argp, int);
m.VFS_CREAT_NAME = (char *) __UNCONST(name);
m.m_lc_vfs_creat.len = strlen(name) + 1;
m.m_lc_vfs_creat.flags = flags;
m.m_lc_vfs_creat.mode = va_arg(argp, mode_t);
m.m_lc_vfs_creat.name = (vir_bytes)name;
call = VFS_CREAT;
} else {
_loadname(name, &m);

View file

@ -64,10 +64,10 @@ int do_creat(void)
vir_bytes vname;
size_t vname_length;
vname = (vir_bytes) job_m_in.VFS_CREAT_NAME;
vname_length = (size_t) job_m_in.VFS_CREAT_LEN;
open_flags = job_m_in.VFS_CREAT_FLAGS;
create_mode = job_m_in.VFS_CREAT_MODE;
vname = job_m_in.m_lc_vfs_creat.name;
vname_length = job_m_in.m_lc_vfs_creat.len;
open_flags = job_m_in.m_lc_vfs_creat.flags;
create_mode = job_m_in.m_lc_vfs_creat.mode;
if (!(open_flags & O_CREAT))
return(EINVAL);