diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-01-29 22:08:46 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2009-01-29 22:08:46 +0000 |
commit | e88d3c0037882f7ae687f760110203fd81083421 (patch) | |
tree | a943c19b7e193a3bcc50dab644519dc3a9bfceb0 | |
parent | 32cf7735bdfdf1d426921ec6fd3a2dde493d74f9 (diff) |
Switch struct stat's timespec members to the names standardized in
POSIX 1003.1-2008, with compatibility macros for the names used in
previous version of OpenBSD. Update all the references in the
kernel to use the new, standard member names.
ok'ed by miod@, otto@; ports build test by naddy@
-rw-r--r-- | sys/compat/common/vfs_syscalls_35.c | 8 | ||||
-rw-r--r-- | sys/compat/svr4/svr4_stat.c | 20 | ||||
-rw-r--r-- | sys/kern/sys_pipe.c | 8 | ||||
-rw-r--r-- | sys/kern/uipc_usrreq.c | 8 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 8 | ||||
-rw-r--r-- | sys/sys/stat.h | 50 |
6 files changed, 55 insertions, 47 deletions
diff --git a/sys/compat/common/vfs_syscalls_35.c b/sys/compat/common/vfs_syscalls_35.c index 80c900ac7fb..10d8acc3d0a 100644 --- a/sys/compat/common/vfs_syscalls_35.c +++ b/sys/compat/common/vfs_syscalls_35.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls_35.c,v 1.3 2004/07/14 18:57:57 millert Exp $ */ +/* $OpenBSD: vfs_syscalls_35.c,v 1.4 2009/01/29 22:08:45 guenther Exp $ */ /* * Copyright (c) 1989, 1993 @@ -68,9 +68,9 @@ cvtstat(struct stat *st, struct stat35 *ost) ost->st_uid = st->st_uid; ost->st_gid = st->st_gid; ost->st_rdev = st->st_rdev; - ost->st_atimespec = st->st_atimespec; - ost->st_mtimespec = st->st_mtimespec; - ost->st_ctimespec = st->st_ctimespec; + ost->st_atim = st->st_atim; + ost->st_mtim = st->st_mtim; + ost->st_ctim = st->st_ctim; ost->st_size = st->st_size; ost->st_blocks = st->st_blocks; ost->st_blksize = st->st_blksize; diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c index 946e86f0996..01ca3dca93c 100644 --- a/sys/compat/svr4/svr4_stat.c +++ b/sys/compat/svr4/svr4_stat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_stat.c,v 1.27 2005/08/07 00:18:33 deraadt Exp $ */ +/* $OpenBSD: svr4_stat.c,v 1.28 2009/01/29 22:08:45 guenther Exp $ */ /* $NetBSD: svr4_stat.c,v 1.21 1996/04/22 01:16:07 christos Exp $ */ /* @@ -97,9 +97,9 @@ bsd_to_svr4_stat(st, st4) st4->st_gid = st->st_gid; st4->st_rdev = bsd_to_svr4_odev_t(st->st_rdev); st4->st_size = st->st_size; - st4->st_atim = st->st_atimespec.tv_sec; - st4->st_mtim = st->st_mtimespec.tv_sec; - st4->st_ctim = st->st_ctimespec.tv_sec; + st4->st_atim = st->st_atime; + st4->st_mtim = st->st_mtime; + st4->st_ctim = st->st_ctime; } #endif @@ -118,9 +118,9 @@ bsd_to_svr4_xstat(st, st4) st4->st_gid = st->st_gid; st4->st_rdev = bsd_to_svr4_dev_t(st->st_rdev); st4->st_size = st->st_size; - st4->st_atim = st->st_atimespec; - st4->st_mtim = st->st_mtimespec; - st4->st_ctim = st->st_ctimespec; + st4->st_atim = st->st_atim; + st4->st_mtim = st->st_mtim; + st4->st_ctim = st->st_ctim; st4->st_blksize = st->st_blksize; st4->st_blocks = st->st_blocks; strlcpy(st4->st_fstype, "unknown", sizeof st4->st_fstype); @@ -140,9 +140,9 @@ bsd_to_svr4_stat64(st, st4) st4->st_gid = st->st_gid; st4->st_rdev = bsd_to_svr4_dev_t(st->st_rdev); st4->st_size = st->st_size; - st4->st_atim = st->st_atimespec; - st4->st_mtim = st->st_mtimespec; - st4->st_ctim = st->st_ctimespec; + st4->st_atim = st->st_atim; + st4->st_mtim = st->st_mtim; + st4->st_ctim = st->st_ctim; st4->st_blksize = st->st_blksize; st4->st_blocks = st->st_blocks; strlcpy(st4->st_fstype, "unknown", sizeof st4->st_fstype); diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index ffd6cf150b6..b704e181f58 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.54 2008/07/11 14:12:57 blambert Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.55 2009/01/29 22:08:45 guenther Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -683,9 +683,9 @@ pipe_stat(struct file *fp, struct stat *ub, struct proc *p) ub->st_blksize = pipe->pipe_buffer.size; ub->st_size = pipe->pipe_buffer.cnt; ub->st_blocks = (ub->st_size + ub->st_blksize - 1) / ub->st_blksize; - ub->st_atimespec = pipe->pipe_atime; - ub->st_mtimespec = pipe->pipe_mtime; - ub->st_ctimespec = pipe->pipe_ctime; + ub->st_atim = pipe->pipe_atime; + ub->st_mtim = pipe->pipe_mtime; + ub->st_ctim = pipe->pipe_ctime; ub->st_uid = fp->f_cred->cr_uid; ub->st_gid = fp->f_cred->cr_gid; /* diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index f8792708406..6e5f1c6c4d4 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_usrreq.c,v 1.43 2008/05/23 15:51:12 thib Exp $ */ +/* $OpenBSD: uipc_usrreq.c,v 1.44 2009/01/29 22:08:45 guenther Exp $ */ /* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */ /* @@ -257,9 +257,9 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, ((struct stat *) m)->st_dev = NODEV; if (unp->unp_ino == 0) unp->unp_ino = unp_ino++; - ((struct stat *) m)->st_atimespec = - ((struct stat *) m)->st_mtimespec = - ((struct stat *) m)->st_ctimespec = unp->unp_ctime; + ((struct stat *) m)->st_atim = + ((struct stat *) m)->st_mtim = + ((struct stat *) m)->st_ctim = unp->unp_ctime; ((struct stat *) m)->st_ino = unp->unp_ino; return (0); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c8fe70db9b1..39492c2d547 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.61 2009/01/24 23:25:17 thib Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.62 2009/01/29 22:08:45 guenther Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -393,9 +393,9 @@ vn_stat(struct vnode *vp, struct stat *sb, struct proc *p) sb->st_gid = va.va_gid; sb->st_rdev = va.va_rdev; sb->st_size = va.va_size; - sb->st_atimespec = va.va_atime; - sb->st_mtimespec = va.va_mtime; - sb->st_ctimespec = va.va_ctime; + sb->st_atim = va.va_atime; + sb->st_mtim = va.va_mtime; + sb->st_ctim = va.va_ctime; sb->st_blksize = va.va_blocksize; sb->st_flags = va.va_flags; sb->st_gen = va.va_gen; diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 6edbf971feb..edcb43f8e05 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stat.h,v 1.16 2005/12/13 00:35:23 millert Exp $ */ +/* $OpenBSD: stat.h,v 1.17 2009/01/29 22:08:45 guenther Exp $ */ /* $NetBSD: stat.h,v 1.20 1996/05/16 22:17:49 cgd Exp $ */ /*- @@ -53,9 +53,9 @@ struct stat43 { u_int16_t st_gid; /* group ID of the file's group */ u_int16_t st_rdev; /* device type */ int32_t st_size; /* file size, in bytes */ - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ + struct timespec st_atim; /* time of last access */ + struct timespec st_mtim; /* time of last data modification */ + struct timespec st_ctim; /* time of last file status change */ int32_t st_blksize; /* optimal blocksize for I/O */ int32_t st_blocks; /* blocks allocated for file */ u_int32_t st_flags; /* user defined flags for file */ @@ -70,9 +70,9 @@ struct stat35 { uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ dev_t st_rdev; /* device type */ - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ + struct timespec st_atim; /* time of last access */ + struct timespec st_mtim; /* time of last data modification */ + struct timespec st_ctim; /* time of last file status change */ off_t st_size; /* file size, in bytes */ int64_t st_blocks; /* blocks allocated for file */ u_int32_t st_blksize; /* optimal blocksize for I/O */ @@ -92,10 +92,10 @@ struct stat { gid_t st_gid; /* group ID of the file's group */ dev_t st_rdev; /* device type */ int32_t st_lspare0; -#if __BSD_VISIBLE - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE + struct timespec st_atim; /* time of last access */ + struct timespec st_mtim; /* time of last data modification */ + struct timespec st_ctim; /* time of last file status change */ #else time_t st_atime; /* time of last access */ long st_atimensec; /* nsec of last access */ @@ -103,28 +103,36 @@ struct stat { long st_mtimensec; /* nsec of last data modification */ time_t st_ctime; /* time of last file status change */ long st_ctimensec; /* nsec of last file status change */ -#endif /* __BSD_VISIBLE */ +#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ off_t st_size; /* file size, in bytes */ int64_t st_blocks; /* blocks allocated for file */ u_int32_t st_blksize; /* optimal blocksize for I/O */ u_int32_t st_flags; /* user defined flags for file */ u_int32_t st_gen; /* file generation number */ int32_t st_lspare1; -#if __BSD_VISIBLE - struct timespec __st_birthtimespec; /* time of file creation */ +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE + struct timespec __st_birthtim; /* time of file creation */ #else time_t __st_birthtime; /* time of file creation */ long __st_birthtimensec; /* nsec of file creation */ -#endif +#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ int64_t st_qspare[2]; }; +#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE +#define st_atime st_atim.tv_sec +#define st_mtime st_mtim.tv_sec +#define st_ctime st_ctim.tv_sec +#define __st_birthtime __st_birthtim.tv_sec +#endif #if __BSD_VISIBLE -#define st_atime st_atimespec.tv_sec -#define st_atimensec st_atimespec.tv_nsec -#define st_mtime st_mtimespec.tv_sec -#define st_mtimensec st_mtimespec.tv_nsec -#define st_ctime st_ctimespec.tv_sec -#define st_ctimensec st_ctimespec.tv_nsec +#define st_atimespec st_atim +#define st_atimensec st_atim.tv_nsec +#define st_mtimespec st_mtim +#define st_mtimensec st_mtim.tv_nsec +#define st_ctimespec st_ctim +#define st_ctimensec st_ctim.tv_nsec +#define __st_birthtimespec __st_birthtim +#define __st_birthtimensec __st_birthtim.tv_nsec #endif #define S_ISUID 0004000 /* set user id on execution */ |