Removing VFS_UTIMENS_* field macros.

Change-Id: I3be1acfbb77b6e229d784d8dbc3ceec1b26abf90
This commit is contained in:
Lionel Sambuc 2013-11-28 19:33:53 +01:00
parent 94c9376df5
commit b33edbfe7a
8 changed files with 66 additions and 66 deletions

View file

@ -288,16 +288,6 @@
#define VFS_MAPDRIVER_LABELLEN m1_i2 /* size_t */ #define VFS_MAPDRIVER_LABELLEN m1_i2 /* size_t */
#define VFS_MAPDRIVER_LABEL m1_p1 /* char * */ #define VFS_MAPDRIVER_LABEL m1_p1 /* char * */
/* Field names for the utimens(2) call. */
#define VFS_UTIMENS_FD m2_i1 /* int */
#define VFS_UTIMENS_NAME m2_p1 /* const char * */
#define VFS_UTIMENS_LEN m2_i1 /* size_t */
#define VFS_UTIMENS_ATIME m2_l1 /* time_t */
#define VFS_UTIMENS_ANSEC m2_i2 /* long */
#define VFS_UTIMENS_MTIME m2_l2 /* time_t */
#define VFS_UTIMENS_MNSEC m2_i3 /* long */
#define VFS_UTIMENS_FLAGS m2_s1 /* int */
/* Field names for the fsync(2) call. */ /* Field names for the fsync(2) call. */
#define VFS_FSYNC_FD m1_i1 /* int */ #define VFS_FSYNC_FD m1_i1 /* int */

View file

@ -134,6 +134,19 @@ typedef struct {
} mess_sigcalls; } mess_sigcalls;
_ASSERT_MSG_SIZE(mess_sigcalls); _ASSERT_MSG_SIZE(mess_sigcalls);
typedef struct {
time_t atime;
time_t mtime;
long ansec;
long mnsec;
size_t len;
char *name;
int fd;
int flags;
uint8_t padding[16];
} mess_vfs_utimens;
_ASSERT_MSG_SIZE(mess_vfs_utimens);
typedef struct { typedef struct {
off_t offset; off_t offset;
dev_t dev; dev_t dev;
@ -186,6 +199,7 @@ typedef struct {
mess_mmap m_mmap; mess_mmap m_mmap;
mess_notify m_notify; mess_notify m_notify;
mess_sigcalls m_sigcalls; mess_sigcalls m_sigcalls;
mess_vfs_utimens m_vfs_utimens;
mess_vm_vfs_mmap m_vm_vfs_mmap; mess_vm_vfs_mmap m_vm_vfs_mmap;
mess_vmmcp m_vmmcp; mess_vmmcp m_vmmcp;
mess_vmmcp_reply m_vmmcp_reply; mess_vmmcp_reply m_vmmcp_reply;

View file

@ -13,14 +13,13 @@ int futimens(int fd, const struct timespec tv[2])
if (tv == NULL) tv = now; if (tv == NULL) tv = now;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = fd; m.m_vfs_utimens.fd = fd;
/* For now just truncate to 32bit time_t values. */ m.m_vfs_utimens.atime = tv[0].tv_sec;
m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; m.m_vfs_utimens.mtime = tv[1].tv_sec;
m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; m.m_vfs_utimens.ansec = tv[0].tv_nsec;
m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec; m.m_vfs_utimens.mnsec = tv[1].tv_nsec;
m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec; m.m_vfs_utimens.name = NULL;
m.VFS_UTIMENS_NAME = NULL; m.m_vfs_utimens.flags = 0;
m.VFS_UTIMENS_FLAGS = 0;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
} }

View file

@ -15,19 +15,19 @@ int futimes(int fd, const struct timeval tv[2])
message m; message m;
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = fd; m.m_vfs_utimens.fd = fd;
if (tv == NULL) { if (tv == NULL) {
m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW;
} }
else { else {
m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; m.m_vfs_utimens.atime = tv[0].tv_sec;
m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; m.m_vfs_utimens.mtime = tv[1].tv_sec;
m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000;
m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000; m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000;
} }
m.VFS_UTIMENS_NAME = NULL; m.m_vfs_utimens.name = NULL;
m.VFS_UTIMENS_FLAGS = 0; m.m_vfs_utimens.flags = 0;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
} }

View file

@ -25,20 +25,19 @@ int lutimes(const char *name, const struct timeval tv[2])
return -1; return -1;
} }
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_FD = strlen(name) + 1; m.m_vfs_utimens.len = strlen(name) + 1;
m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); m.m_vfs_utimens.name = (char *) __UNCONST(name);
if (tv == NULL) { if (tv == NULL) {
m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW;
} }
else { else {
/* For now just truncate time_t values to 32bits. */ m.m_vfs_utimens.atime = tv[0].tv_sec;
m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; m.m_vfs_utimens.mtime = tv[1].tv_sec;
m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000;
m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000;
m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000;
} }
m.VFS_UTIMENS_FLAGS = AT_SYMLINK_NOFOLLOW; m.m_vfs_utimens.flags = AT_SYMLINK_NOFOLLOW;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
} }

View file

@ -44,14 +44,13 @@ int utimensat(int fd, const char *name, const struct timespec tv[2],
} }
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_LEN = strlen(name) + 1; m.m_vfs_utimens.len = strlen(name) + 1;
m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); m.m_vfs_utimens.name = __UNCONST(name);
/* For now just truncate time_t values to 32bits. */ m.m_vfs_utimens.atime = tv[0].tv_sec;
m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; m.m_vfs_utimens.mtime = tv[1].tv_sec;
m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; m.m_vfs_utimens.ansec = tv[0].tv_nsec;
m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec; m.m_vfs_utimens.mnsec = tv[1].tv_nsec;
m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec; m.m_vfs_utimens.flags = flags;
m.VFS_UTIMENS_FLAGS = flags;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
} }

View file

@ -24,20 +24,19 @@ int utimes(const char *name, const struct timeval tv[2])
return -1; return -1;
} }
memset(&m, 0, sizeof(m)); memset(&m, 0, sizeof(m));
m.VFS_UTIMENS_LEN = strlen(name) + 1; m.m_vfs_utimens.len = strlen(name) + 1;
m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); m.m_vfs_utimens.name = __UNCONST(name);
if (tv == NULL) { if (tv == NULL) {
m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0;
m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW;
} }
else { else {
/* For now just truncate time_t values to 32bits. */ m.m_vfs_utimens.atime = tv[0].tv_sec;
m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; m.m_vfs_utimens.mtime = tv[1].tv_sec;
m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000;
m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000;
m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000;
} }
m.VFS_UTIMENS_FLAGS = 0; m.m_vfs_utimens.flags = 0;
return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m));
} }

View file

@ -51,19 +51,19 @@ int do_utimens(void)
memset(&now, 0, sizeof(now)); memset(&now, 0, sizeof(now));
/* The case times==NULL is handled by the caller, replaced with UTIME_NOW */ /* The case times==NULL is handled by the caller, replaced with UTIME_NOW */
actim.tv_sec = job_m_in.VFS_UTIMENS_ATIME; actim.tv_sec = job_m_in.m_vfs_utimens.atime;
actim.tv_nsec = job_m_in.VFS_UTIMENS_ANSEC; actim.tv_nsec = job_m_in.m_vfs_utimens.ansec;
modtim.tv_sec = job_m_in.VFS_UTIMENS_MTIME; modtim.tv_sec = job_m_in.m_vfs_utimens.mtime;
modtim.tv_nsec = job_m_in.VFS_UTIMENS_MNSEC; modtim.tv_nsec = job_m_in.m_vfs_utimens.mnsec;
if (job_m_in.VFS_UTIMENS_NAME != NULL) { if (job_m_in.m_vfs_utimens.name != NULL) {
kind = UTIMENS_STYLE; kind = UTIMENS_STYLE;
if (job_m_in.VFS_UTIMENS_FLAGS & ~AT_SYMLINK_NOFOLLOW) if (job_m_in.m_vfs_utimens.flags & ~AT_SYMLINK_NOFOLLOW)
return EINVAL; /* unknown flag */ return EINVAL; /* unknown flag */
/* Temporarily open the file */ /* Temporarily open the file */
vname = (vir_bytes) job_m_in.VFS_UTIMENS_NAME; vname = (vir_bytes) job_m_in.m_vfs_utimens.name;
vname_length = (size_t) job_m_in.VFS_UTIMENS_LEN; vname_length = (size_t) job_m_in.m_vfs_utimens.len;
if (job_m_in.VFS_UTIMENS_FLAGS & AT_SYMLINK_NOFOLLOW) if (job_m_in.m_vfs_utimens.flags & AT_SYMLINK_NOFOLLOW)
lookup_flags = PATH_RET_SYMLINK; lookup_flags = PATH_RET_SYMLINK;
else else
lookup_flags = PATH_NOFLAGS; lookup_flags = PATH_NOFLAGS;
@ -77,9 +77,9 @@ int do_utimens(void)
else { else {
kind = FUTIMENS_STYLE; kind = FUTIMENS_STYLE;
/* Change timestamps on already-opened fd. Is it valid? */ /* Change timestamps on already-opened fd. Is it valid? */
if (job_m_in.VFS_UTIMENS_FLAGS != 0) if (job_m_in.m_vfs_utimens.flags != 0)
return EINVAL; /* unknown flag */ return EINVAL; /* unknown flag */
if ((filp = get_filp(job_m_in.VFS_UTIMENS_FD, VNODE_READ)) == NULL) if ((filp = get_filp(job_m_in.m_vfs_utimens.fd, VNODE_READ)) == NULL)
return err_code; return err_code;
vp = filp->filp_vno; vp = filp->filp_vno;
} }