From: Lionel Sambuc Date: Thu, 28 Nov 2013 18:33:53 +0000 (+0100) Subject: Removing VFS_UTIMENS_* field macros. X-Git-Tag: v3.3.0~487 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/jquery.js?a=commitdiff_plain;h=b33edbfe7a171f25d26155466477b3403eb410cb;p=minix.git Removing VFS_UTIMENS_* field macros. Change-Id: I3be1acfbb77b6e229d784d8dbc3ceec1b26abf90 --- diff --git a/include/minix/callnr.h b/include/minix/callnr.h index d6910d954..9d4f98006 100644 --- a/include/minix/callnr.h +++ b/include/minix/callnr.h @@ -288,16 +288,6 @@ #define VFS_MAPDRIVER_LABELLEN m1_i2 /* size_t */ #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. */ #define VFS_FSYNC_FD m1_i1 /* int */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 6eae8bfa4..2eaaed8b2 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -134,6 +134,19 @@ typedef struct { } 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 { off_t offset; dev_t dev; @@ -186,6 +199,7 @@ typedef struct { mess_mmap m_mmap; mess_notify m_notify; mess_sigcalls m_sigcalls; + mess_vfs_utimens m_vfs_utimens; mess_vm_vfs_mmap m_vm_vfs_mmap; mess_vmmcp m_vmmcp; mess_vmmcp_reply m_vmmcp_reply; diff --git a/lib/libc/sys-minix/futimens.c b/lib/libc/sys-minix/futimens.c index 7621e0bd8..73b3315a9 100644 --- a/lib/libc/sys-minix/futimens.c +++ b/lib/libc/sys-minix/futimens.c @@ -13,14 +13,13 @@ int futimens(int fd, const struct timespec tv[2]) if (tv == NULL) tv = now; memset(&m, 0, sizeof(m)); - m.VFS_UTIMENS_FD = fd; - /* For now just truncate to 32bit time_t values. */ - m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; - m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; - m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec; - m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec; - m.VFS_UTIMENS_NAME = NULL; - m.VFS_UTIMENS_FLAGS = 0; + m.m_vfs_utimens.fd = fd; + m.m_vfs_utimens.atime = tv[0].tv_sec; + m.m_vfs_utimens.mtime = tv[1].tv_sec; + m.m_vfs_utimens.ansec = tv[0].tv_nsec; + m.m_vfs_utimens.mnsec = tv[1].tv_nsec; + m.m_vfs_utimens.name = NULL; + m.m_vfs_utimens.flags = 0; return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); } diff --git a/lib/libc/sys-minix/futimes.c b/lib/libc/sys-minix/futimes.c index 1b4dce6a2..df8774ac3 100644 --- a/lib/libc/sys-minix/futimes.c +++ b/lib/libc/sys-minix/futimes.c @@ -15,19 +15,19 @@ int futimes(int fd, const struct timeval tv[2]) message m; memset(&m, 0, sizeof(m)); - m.VFS_UTIMENS_FD = fd; + m.m_vfs_utimens.fd = fd; if (tv == NULL) { - m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; - m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; + m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0; + m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW; } else { - m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; - m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; - m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; - m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000; + m.m_vfs_utimens.atime = tv[0].tv_sec; + m.m_vfs_utimens.mtime = tv[1].tv_sec; + m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000; + m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000; } - m.VFS_UTIMENS_NAME = NULL; - m.VFS_UTIMENS_FLAGS = 0; + m.m_vfs_utimens.name = NULL; + m.m_vfs_utimens.flags = 0; return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); } diff --git a/lib/libc/sys-minix/lutimes.c b/lib/libc/sys-minix/lutimes.c index 7fed0ee7c..9fcf0857d 100644 --- a/lib/libc/sys-minix/lutimes.c +++ b/lib/libc/sys-minix/lutimes.c @@ -25,20 +25,19 @@ int lutimes(const char *name, const struct timeval tv[2]) return -1; } memset(&m, 0, sizeof(m)); - m.VFS_UTIMENS_FD = strlen(name) + 1; - m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); + m.m_vfs_utimens.len = strlen(name) + 1; + m.m_vfs_utimens.name = (char *) __UNCONST(name); if (tv == NULL) { - m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; - m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; + m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0; + m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW; } else { - /* For now just truncate time_t values to 32bits. */ - m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; - m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; - m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; - m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000; + m.m_vfs_utimens.atime = tv[0].tv_sec; + m.m_vfs_utimens.mtime = tv[1].tv_sec; + m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000; + m.m_vfs_utimens.mnsec = 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)); } diff --git a/lib/libc/sys-minix/utimensat.c b/lib/libc/sys-minix/utimensat.c index c6409b424..c298ec60c 100644 --- a/lib/libc/sys-minix/utimensat.c +++ b/lib/libc/sys-minix/utimensat.c @@ -44,14 +44,13 @@ int utimensat(int fd, const char *name, const struct timespec tv[2], } memset(&m, 0, sizeof(m)); - m.VFS_UTIMENS_LEN = strlen(name) + 1; - m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); - /* For now just truncate time_t values to 32bits. */ - m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; - m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; - m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_nsec; - m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_nsec; - m.VFS_UTIMENS_FLAGS = flags; + m.m_vfs_utimens.len = strlen(name) + 1; + m.m_vfs_utimens.name = __UNCONST(name); + m.m_vfs_utimens.atime = tv[0].tv_sec; + m.m_vfs_utimens.mtime = tv[1].tv_sec; + m.m_vfs_utimens.ansec = tv[0].tv_nsec; + m.m_vfs_utimens.mnsec = tv[1].tv_nsec; + m.m_vfs_utimens.flags = flags; return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); } diff --git a/lib/libc/sys-minix/utimes.c b/lib/libc/sys-minix/utimes.c index 6da24aec0..d3251178f 100644 --- a/lib/libc/sys-minix/utimes.c +++ b/lib/libc/sys-minix/utimes.c @@ -24,20 +24,19 @@ int utimes(const char *name, const struct timeval tv[2]) return -1; } memset(&m, 0, sizeof(m)); - m.VFS_UTIMENS_LEN = strlen(name) + 1; - m.VFS_UTIMENS_NAME = (char *) __UNCONST(name); + m.m_vfs_utimens.len = strlen(name) + 1; + m.m_vfs_utimens.name = __UNCONST(name); if (tv == NULL) { - m.VFS_UTIMENS_ATIME = m.VFS_UTIMENS_MTIME = 0; - m.VFS_UTIMENS_ANSEC = m.VFS_UTIMENS_MNSEC = UTIME_NOW; + m.m_vfs_utimens.atime = m.m_vfs_utimens.mtime = 0; + m.m_vfs_utimens.ansec = m.m_vfs_utimens.mnsec = UTIME_NOW; } else { - /* For now just truncate time_t values to 32bits. */ - m.VFS_UTIMENS_ATIME = (int32_t)tv[0].tv_sec; - m.VFS_UTIMENS_MTIME = (int32_t)tv[1].tv_sec; - m.VFS_UTIMENS_ANSEC = (int32_t)tv[0].tv_usec * 1000; - m.VFS_UTIMENS_MNSEC = (int32_t)tv[1].tv_usec * 1000; + m.m_vfs_utimens.atime = tv[0].tv_sec; + m.m_vfs_utimens.mtime = tv[1].tv_sec; + m.m_vfs_utimens.ansec = tv[0].tv_usec * 1000; + m.m_vfs_utimens.mnsec = tv[1].tv_usec * 1000; } - m.VFS_UTIMENS_FLAGS = 0; + m.m_vfs_utimens.flags = 0; return(_syscall(VFS_PROC_NR, VFS_UTIMENS, &m)); } diff --git a/servers/vfs/time.c b/servers/vfs/time.c index 01952760b..1f890d213 100644 --- a/servers/vfs/time.c +++ b/servers/vfs/time.c @@ -51,19 +51,19 @@ int do_utimens(void) memset(&now, 0, sizeof(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_nsec = job_m_in.VFS_UTIMENS_ANSEC; - modtim.tv_sec = job_m_in.VFS_UTIMENS_MTIME; - modtim.tv_nsec = job_m_in.VFS_UTIMENS_MNSEC; + actim.tv_sec = job_m_in.m_vfs_utimens.atime; + actim.tv_nsec = job_m_in.m_vfs_utimens.ansec; + modtim.tv_sec = job_m_in.m_vfs_utimens.mtime; + 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; - 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 */ /* Temporarily open the file */ - vname = (vir_bytes) job_m_in.VFS_UTIMENS_NAME; - vname_length = (size_t) job_m_in.VFS_UTIMENS_LEN; - if (job_m_in.VFS_UTIMENS_FLAGS & AT_SYMLINK_NOFOLLOW) + vname = (vir_bytes) job_m_in.m_vfs_utimens.name; + vname_length = (size_t) job_m_in.m_vfs_utimens.len; + if (job_m_in.m_vfs_utimens.flags & AT_SYMLINK_NOFOLLOW) lookup_flags = PATH_RET_SYMLINK; else lookup_flags = PATH_NOFLAGS; @@ -77,9 +77,9 @@ int do_utimens(void) else { kind = FUTIMENS_STYLE; /* 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 */ - 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; vp = filp->filp_vno; }