diff --git a/sys/compat/cloudabi/cloudabi_file.c b/sys/compat/cloudabi/cloudabi_file.c index 6b9225b93414..e84b48cdf18c 100644 --- a/sys/compat/cloudabi/cloudabi_file.c +++ b/sys/compat/cloudabi/cloudabi_file.c @@ -536,7 +536,7 @@ cloudabi_sys_file_rename(struct thread *td, /* Converts a FreeBSD stat structure to a CloudABI stat structure. */ static void -convert_stat(const struct stat *sb, cloudabi_filestat_t *csb) +convert_stat(const struct kernel_stat *sb, cloudabi_filestat_t *csb) { cloudabi_filestat_t res = { .st_dev = sb->st_dev, @@ -555,7 +555,7 @@ int cloudabi_sys_file_stat_fget(struct thread *td, struct cloudabi_sys_file_stat_fget_args *uap) { - struct stat sb; + struct kernel_stat sb; cloudabi_filestat_t csb; struct file *fp; cloudabi_filetype_t filetype; @@ -645,7 +645,7 @@ int cloudabi_sys_file_stat_get(struct thread *td, struct cloudabi_sys_file_stat_get_args *uap) { - struct stat sb; + struct kernel_stat sb; cloudabi_filestat_t csb; char *path; int error; diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 39c8f30b527f..5fd268d93e8c 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -1905,7 +1905,7 @@ freebsd32_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap) } static void -copy_stat(struct stat *in, struct stat32 *out) +copy_stat(struct kernel_stat *in, struct stat32 *out) { CP(*in, *out, st_dev); @@ -1937,7 +1937,7 @@ copy_stat(struct stat *in, struct stat32 *out) #ifdef COMPAT_43 static void -copy_ostat(struct stat *in, struct ostat32 *out) +copy_ostat(struct kernel_stat *in, struct ostat32 *out) { bzero(out, sizeof(*out)); @@ -1963,7 +1963,7 @@ copy_ostat(struct stat *in, struct ostat32 *out) int ofreebsd32_stat(struct thread *td, struct ofreebsd32_stat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct ostat32 sb32; int error; @@ -1980,7 +1980,7 @@ ofreebsd32_stat(struct thread *td, struct ofreebsd32_stat_args *uap) int freebsd32_fstat(struct thread *td, struct freebsd32_fstat_args *uap) { - struct stat ub; + struct kernel_stat ub; struct stat32 ub32; int error; @@ -1996,7 +1996,7 @@ freebsd32_fstat(struct thread *td, struct freebsd32_fstat_args *uap) int ofreebsd32_fstat(struct thread *td, struct ofreebsd32_fstat_args *uap) { - struct stat ub; + struct kernel_stat ub; struct ostat32 ub32; int error; @@ -2012,7 +2012,7 @@ ofreebsd32_fstat(struct thread *td, struct ofreebsd32_fstat_args *uap) int freebsd32_fstatat(struct thread *td, struct freebsd32_fstatat_args *uap) { - struct stat ub; + struct kernel_stat ub; struct stat32 ub32; int error; @@ -2029,7 +2029,7 @@ freebsd32_fstatat(struct thread *td, struct freebsd32_fstatat_args *uap) int ofreebsd32_lstat(struct thread *td, struct ofreebsd32_lstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct ostat32 sb32; int error; @@ -2046,7 +2046,7 @@ ofreebsd32_lstat(struct thread *td, struct ofreebsd32_lstat_args *uap) int freebsd32_fhstat(struct thread *td, struct freebsd32_fhstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct stat32 sb32; struct fhandle fh; int error; @@ -2066,7 +2066,7 @@ freebsd32_fhstat(struct thread *td, struct freebsd32_fhstat_args *uap) extern int ino64_trunc_error; static int -freebsd11_cvtstat32(struct stat *in, struct freebsd11_stat32 *out) +freebsd11_cvtstat32(struct kernel_stat *in, struct freebsd11_stat32 *out) { CP(*in, *out, st_ino); @@ -2136,7 +2136,7 @@ int freebsd11_freebsd32_stat(struct thread *td, struct freebsd11_freebsd32_stat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat32 sb32; int error; @@ -2154,7 +2154,7 @@ int freebsd11_freebsd32_fstat(struct thread *td, struct freebsd11_freebsd32_fstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat32 sb32; int error; @@ -2171,7 +2171,7 @@ int freebsd11_freebsd32_fstatat(struct thread *td, struct freebsd11_freebsd32_fstatat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat32 sb32; int error; @@ -2189,7 +2189,7 @@ int freebsd11_freebsd32_lstat(struct thread *td, struct freebsd11_freebsd32_lstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat32 sb32; int error; @@ -2207,7 +2207,7 @@ int freebsd11_freebsd32_fhstat(struct thread *td, struct freebsd11_freebsd32_fhstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat32 sb32; struct fhandle fh; int error; diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 11299c36c788..4c84bc82238d 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -971,7 +971,7 @@ eventfd_ioctl(struct file *fp, u_long cmd, void *data, /*ARGSUSED*/ static int -eventfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred, +eventfd_stat(struct file *fp, struct kernel_stat *st, struct ucred *active_cred, struct thread *td) { @@ -1164,7 +1164,7 @@ filt_timerfdread(struct knote *kn, long hint) /*ARGSUSED*/ static int -timerfd_stat(struct file *fp, struct stat *st, struct ucred *active_cred, +timerfd_stat(struct file *fp, struct kernel_stat *st, struct ucred *active_cred, struct thread *td) { diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index eed8814634ef..7f77fa66bb4f 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -538,7 +538,7 @@ linux_unlink(struct thread *td, struct linux_unlink_args *args) { char *path; int error; - struct stat st; + struct kernel_stat st; LCONVPATHEXIST(td, args->path, &path); @@ -561,7 +561,7 @@ linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args) { char *path; int error, dfd; - struct stat st; + struct kernel_stat st; if (args->flag & ~LINUX_AT_REMOVEDIR) return (EINVAL); diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index f733a1ed7473..6950b962e902 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); static void -translate_vnhook_major_minor(struct vnode *vp, struct stat *sb) +translate_vnhook_major_minor(struct vnode *vp, struct kernel_stat *sb) { int major, minor; @@ -79,7 +79,7 @@ translate_vnhook_major_minor(struct vnode *vp, struct stat *sb) static int linux_kern_statat(struct thread *td, int flag, int fd, char *path, - enum uio_seg pathseg, struct stat *sbp) + enum uio_seg pathseg, struct kernel_stat *sbp) { return (kern_statat(td, flag, fd, path, pathseg, sbp, @@ -89,7 +89,7 @@ linux_kern_statat(struct thread *td, int flag, int fd, char *path, #ifdef LINUX_LEGACY_SYSCALLS static int linux_kern_stat(struct thread *td, char *path, enum uio_seg pathseg, - struct stat *sbp) + struct kernel_stat *sbp) { return (linux_kern_statat(td, 0, AT_FDCWD, path, pathseg, sbp)); @@ -97,7 +97,7 @@ linux_kern_stat(struct thread *td, char *path, enum uio_seg pathseg, static int linux_kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, - struct stat *sbp) + struct kernel_stat *sbp) { return (linux_kern_statat(td, AT_SYMLINK_NOFOLLOW, AT_FDCWD, path, @@ -106,7 +106,7 @@ linux_kern_lstat(struct thread *td, char *path, enum uio_seg pathseg, #endif static void -translate_fd_major_minor(struct thread *td, int fd, struct stat *buf) +translate_fd_major_minor(struct thread *td, int fd, struct kernel_stat *buf) { struct file *fp; struct vnode *vp; @@ -159,7 +159,7 @@ translate_fd_major_minor(struct thread *td, int fd, struct stat *buf) #define dev_to_ldev(d) ((uint16_t)(d)) static int -newstat_copyout(struct stat *buf, void *ubuf) +newstat_copyout(struct kernel_stat *buf, void *ubuf) { struct l_newstat tbuf; @@ -188,7 +188,7 @@ newstat_copyout(struct stat *buf, void *ubuf) int linux_newstat(struct thread *td, struct linux_newstat_args *args) { - struct stat buf; + struct kernel_stat buf; char *path; int error; @@ -204,7 +204,7 @@ linux_newstat(struct thread *td, struct linux_newstat_args *args) int linux_newlstat(struct thread *td, struct linux_newlstat_args *args) { - struct stat sb; + struct kernel_stat sb; char *path; int error; @@ -221,7 +221,7 @@ linux_newlstat(struct thread *td, struct linux_newlstat_args *args) int linux_newfstat(struct thread *td, struct linux_newfstat_args *args) { - struct stat buf; + struct kernel_stat buf; int error; error = kern_fstat(td, args->fd, &buf); @@ -234,7 +234,7 @@ linux_newfstat(struct thread *td, struct linux_newfstat_args *args) #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) static int -stat_copyout(struct stat *buf, void *ubuf) +stat_copyout(struct kernel_stat *buf, void *ubuf) { struct l_stat lbuf; @@ -264,7 +264,7 @@ stat_copyout(struct stat *buf, void *ubuf) int linux_stat(struct thread *td, struct linux_stat_args *args) { - struct stat buf; + struct kernel_stat buf; char *path; int error; @@ -282,7 +282,7 @@ linux_stat(struct thread *td, struct linux_stat_args *args) int linux_lstat(struct thread *td, struct linux_lstat_args *args) { - struct stat buf; + struct kernel_stat buf; char *path; int error; @@ -510,7 +510,7 @@ linux_ustat(struct thread *td, struct linux_ustat_args *args) #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) static int -stat64_copyout(struct stat *buf, void *ubuf) +stat64_copyout(struct kernel_stat *buf, void *ubuf) { struct l_stat64 lbuf; @@ -546,7 +546,7 @@ stat64_copyout(struct stat *buf, void *ubuf) int linux_stat64(struct thread *td, struct linux_stat64_args *args) { - struct stat buf; + struct kernel_stat buf; char *filename; int error; @@ -562,7 +562,7 @@ linux_stat64(struct thread *td, struct linux_stat64_args *args) int linux_lstat64(struct thread *td, struct linux_lstat64_args *args) { - struct stat sb; + struct kernel_stat sb; char *filename; int error; @@ -578,7 +578,7 @@ linux_lstat64(struct thread *td, struct linux_lstat64_args *args) int linux_fstat64(struct thread *td, struct linux_fstat64_args *args) { - struct stat buf; + struct kernel_stat buf; int error; error = kern_fstat(td, args->fd, &buf); @@ -594,7 +594,7 @@ linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args) { char *path; int error, dfd, flag; - struct stat buf; + struct kernel_stat buf; if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW) return (EINVAL); @@ -619,7 +619,7 @@ linux_newfstatat(struct thread *td, struct linux_newfstatat_args *args) { char *path; int error, dfd, flag; - struct stat buf; + struct kernel_stat buf; if (args->flag & ~LINUX_AT_SYMLINK_NOFOLLOW) return (EINVAL); diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 5dd60d3a772a..33102e00d74f 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1670,7 +1670,7 @@ linux_file_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size } static int -linux_file_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +linux_file_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct linux_file *filp; diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 862eb9a1f089..aa450bc4eac1 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1704,7 +1704,7 @@ devfs_setlabel(struct vop_setlabel_args *ap) #endif static int -devfs_stat_f(struct file *fp, struct stat *sb, struct ucred *cred, struct thread *td) +devfs_stat_f(struct file *fp, struct kernel_stat *sb, struct ucred *cred, struct thread *td) { return (vnops.fo_stat(fp, sb, cred, td)); diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 52d58c8ca186..b99f84284b80 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1376,7 +1376,7 @@ int ofstat(struct thread *td, struct ofstat_args *uap) { struct ostat oub; - struct stat ub; + struct kernel_stat ub; int error; error = kern_fstat(td, uap->fd, &ub); @@ -1392,7 +1392,7 @@ ofstat(struct thread *td, struct ofstat_args *uap) int freebsd11_fstat(struct thread *td, struct freebsd11_fstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat osb; int error; @@ -1419,17 +1419,17 @@ struct fstat_args { int sys_fstat(struct thread *td, struct fstat_args *uap) { - struct stat ub; + struct kernel_stat sb; int error; - error = kern_fstat(td, uap->fd, &ub); + error = kern_fstat(td, uap->fd, &sb); if (error == 0) - error = copyout(&ub, uap->sb, sizeof(ub)); + error = copyout_kernel_stat(&sb, uap->sb); return (error); } int -kern_fstat(struct thread *td, int fd, struct stat *sbp) +kern_fstat(struct thread *td, int fd, struct kernel_stat *sbp) { struct file *fp; int error; @@ -1474,7 +1474,7 @@ int freebsd11_nfstat(struct thread *td, struct freebsd11_nfstat_args *uap) { struct nstat nub; - struct stat ub; + struct kernel_stat ub; int error; error = kern_fstat(td, uap->fd, &ub); @@ -4149,7 +4149,7 @@ badfo_kqfilter(struct file *fp, struct knote *kn) } static int -badfo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +badfo_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 28d43b2a34e5..4f902d3d2560 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -2062,7 +2062,7 @@ kqueue_poll(struct file *fp, int events, struct ucred *active_cred, /*ARGSUSED*/ static int -kqueue_stat(struct file *fp, struct stat *st, struct ucred *active_cred, +kqueue_stat(struct file *fp, struct kernel_stat *st, struct ucred *active_cred, struct thread *td) { diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 10b1ca2395da..214f35be2912 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1449,7 +1449,7 @@ pipe_poll(struct file *fp, int events, struct ucred *active_cred, * be a natural race. */ static int -pipe_stat(struct file *fp, struct stat *ub, struct ucred *active_cred, +pipe_stat(struct file *fp, struct kernel_stat *ub, struct ucred *active_cred, struct thread *td) { struct pipe *pipe; diff --git a/sys/kern/sys_procdesc.c b/sys/kern/sys_procdesc.c index 8b18638d76b3..f44468fe4872 100644 --- a/sys/kern/sys_procdesc.c +++ b/sys/kern/sys_procdesc.c @@ -524,7 +524,7 @@ procdesc_kqfilter(struct file *fp, struct knote *kn) } static int -procdesc_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +procdesc_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct procdesc *pd; diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index b0f6f99ce448..a2ffa9c98f69 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -283,7 +283,7 @@ soo_poll(struct file *fp, int events, struct ucred *active_cred, } static int -soo_stat(struct file *fp, struct stat *ub, struct ucred *active_cred, +soo_stat(struct file *fp, struct kernel_stat *ub, struct ucred *active_cred, struct thread *td) { struct socket *so = fp->f_data; diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c index dbbf35cf1a12..341350e22f4e 100644 --- a/sys/kern/tty_pts.c +++ b/sys/kern/tty_pts.c @@ -535,7 +535,7 @@ ptsdev_kqfilter(struct file *fp, struct knote *kn) } static int -ptsdev_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +ptsdev_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct tty *tp = fp->f_data; diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c index 073467018576..b733350c295e 100644 --- a/sys/kern/uipc_mqueue.c +++ b/sys/kern/uipc_mqueue.c @@ -2537,7 +2537,7 @@ mqf_close(struct file *fp, struct thread *td) } static int -mqf_stat(struct file *fp, struct stat *st, struct ucred *active_cred, +mqf_stat(struct file *fp, struct kernel_stat *st, struct ucred *active_cred, struct thread *td) { struct mqfs_node *pn = fp->f_data; diff --git a/sys/kern/uipc_sem.c b/sys/kern/uipc_sem.c index 27f586119c77..d6ca0fe5f322 100644 --- a/sys/kern/uipc_sem.c +++ b/sys/kern/uipc_sem.c @@ -161,7 +161,7 @@ static struct fileops ksem_ops = { FEATURE(posix_sem, "POSIX semaphores"); static int -ksem_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +ksem_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct ksem *ks; diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 755c5f56744c..1e1903d8a81f 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -370,7 +370,7 @@ shm_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred, } static int -shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +shm_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct shmfd *shmfd; diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 72c9b16f4476..9514f36910ab 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -3588,7 +3588,7 @@ pru_ready_notsupp(struct socket *so, struct mbuf *m, int count) * doesn't do anything destructive. */ int -pru_sense_null(struct socket *so, struct stat *sb) +pru_sense_null(struct socket *so, struct kernel_stat *sb) { sb->st_blksize = so->so_snd.sb_hiwat; diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 400857ecc0d5..264f5b22aa8d 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1293,7 +1293,7 @@ uipc_ready(struct socket *so, struct mbuf *m, int count) } static int -uipc_sense(struct socket *so, struct stat *sb) +uipc_sense(struct socket *so, struct kernel_stat *sb) { struct unpcb *unp; diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c index 481b8de3d0fc..9e9a6319d6f2 100644 --- a/sys/kern/vfs_mountroot.c +++ b/sys/kern/vfs_mountroot.c @@ -580,7 +580,7 @@ parse_dir_ask(char **conf) static int parse_dir_md(char **conf) { - struct stat sb; + struct kernel_stat sb; struct thread *td; struct md_ioctl *mdio; char *path, *tok; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 20ed0dc8f39d..9003c9f828e8 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1801,7 +1801,7 @@ kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, struct file *fp; struct vnode *vp; struct nameidata nd; - struct stat sb; + struct kernel_stat sb; int error; fp = NULL; @@ -2085,7 +2085,7 @@ struct ostat_args { int ostat(struct thread *td, struct ostat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct ostat osb; int error; @@ -2109,7 +2109,7 @@ struct olstat_args { int olstat(struct thread *td, struct olstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct ostat osb; int error; @@ -2126,7 +2126,7 @@ olstat(struct thread *td, struct olstat_args *uap) * XXX: many values are blindly truncated. */ void -cvtstat(struct stat *st, struct ostat *ost) +cvtstat(struct kernel_stat *st, struct ostat *ost) { bzero(ost, sizeof(*ost)); @@ -2155,7 +2155,7 @@ SYSCTL_INT(_vfs, OID_AUTO, ino64_trunc_error, CTLFLAG_RW, "Error on truncation of device, file or inode number, or link count"); int -freebsd11_cvtstat(struct stat *st, struct freebsd11_stat *ost) +freebsd11_cvtstat(struct kernel_stat *st, struct freebsd11_stat *ost) { ost->st_dev = st->st_dev; @@ -2228,7 +2228,7 @@ freebsd11_cvtstat(struct stat *st, struct freebsd11_stat *ost) int freebsd11_stat(struct thread *td, struct freebsd11_stat_args* uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat osb; int error; @@ -2245,7 +2245,7 @@ freebsd11_stat(struct thread *td, struct freebsd11_stat_args* uap) int freebsd11_lstat(struct thread *td, struct freebsd11_lstat_args* uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat osb; int error; @@ -2263,7 +2263,7 @@ int freebsd11_fhstat(struct thread *td, struct freebsd11_fhstat_args* uap) { struct fhandle fh; - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat osb; int error; @@ -2282,7 +2282,7 @@ freebsd11_fhstat(struct thread *td, struct freebsd11_fhstat_args* uap) int freebsd11_fstatat(struct thread *td, struct freebsd11_fstatat_args* uap) { - struct stat sb; + struct kernel_stat sb; struct freebsd11_stat osb; int error; @@ -2311,20 +2311,20 @@ struct fstatat_args { int sys_fstatat(struct thread *td, struct fstatat_args *uap) { - struct stat sb; + struct kernel_stat sb; int error; error = kern_statat(td, uap->flag, uap->fd, uap->path, UIO_USERSPACE, &sb, NULL); if (error == 0) - error = copyout(&sb, uap->buf, sizeof (sb)); + error = copyout_kernel_stat(&sb, uap->buf); return (error); } int kern_statat(struct thread *td, int flag, int fd, const char *path, - enum uio_seg pathseg, struct stat *sbp, - void (*hook)(struct vnode *vp, struct stat *sbp)) + enum uio_seg pathseg, struct kernel_stat *sbp, + void (*hook)(struct vnode *vp, struct kernel_stat *sbp)) { struct nameidata nd; int error; @@ -2364,12 +2364,24 @@ kern_statat(struct thread *td, int flag, int fd, const char *path, return (0); } +/* + * Userspace struct stat is kernel_stat + spares array at the end. + * There is nothing to convert, we only have to copy what we got and not + * touch the spare area. + */ +int +copyout_kernel_stat(struct kernel_stat *sbp, struct stat *usbp) +{ + + return (copyout(sbp, usbp, sizeof(*sbp))); +} + #if defined(COMPAT_FREEBSD11) /* * Implementation of the NetBSD [l]stat() functions. */ void -freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb) +freebsd11_cvtnstat(struct kernel_stat *sb, struct nstat *nsb) { bzero(nsb, sizeof(*nsb)); @@ -2400,7 +2412,7 @@ struct freebsd11_nstat_args { int freebsd11_nstat(struct thread *td, struct freebsd11_nstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct nstat nsb; int error; @@ -2424,7 +2436,7 @@ struct freebsd11_nlstat_args { int freebsd11_nlstat(struct thread *td, struct freebsd11_nlstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct nstat nsb; int error; @@ -4467,13 +4479,13 @@ sys_fhopen(struct thread *td, struct fhopen_args *uap) #ifndef _SYS_SYSPROTO_H_ struct fhstat_args { struct fhandle *u_fhp; - struct stat *sb; + struct kernel_stat *sb; }; #endif int sys_fhstat(struct thread *td, struct fhstat_args *uap) { - struct stat sb; + struct kernel_stat sb; struct fhandle fh; int error; @@ -4487,7 +4499,7 @@ sys_fhstat(struct thread *td, struct fhstat_args *uap) } int -kern_fhstat(struct thread *td, struct fhandle fh, struct stat *sb) +kern_fhstat(struct thread *td, struct fhandle fh, struct kernel_stat *sb) { struct mount *mp; struct vnode *vp; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 963550b9e1eb..2694c937a5d5 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1362,7 +1362,7 @@ vn_truncate_locked(struct vnode *vp, off_t length, bool sync, * File table vnode stat routine. */ static int -vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred, +vn_statfile(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { struct vnode *vp = fp->f_vnode; @@ -1379,7 +1379,7 @@ vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred, * Stat a vnode; implementation for the stat syscall */ int -vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, +vn_stat(struct vnode *vp, struct kernel_stat *sb, struct ucred *active_cred, struct ucred *file_cred, struct thread *td) { struct vattr vattr; diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index e43f1a9dff43..6a9c6cb9636b 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -303,7 +303,7 @@ SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, cryptodev_warn_interval, CTLFLAG_RW, static int cryptof_ioctl(struct file *, u_long, void *, struct ucred *, struct thread *); -static int cryptof_stat(struct file *, struct stat *, +static int cryptof_stat(struct file *, struct kernel_stat *, struct ucred *, struct thread *); static int cryptof_close(struct file *, struct thread *); static int cryptof_fill_kinfo(struct file *, struct kinfo_file *, @@ -1358,7 +1358,7 @@ cryptodev_find(struct crypt_find_op *find) static int cryptof_stat( struct file *fp, - struct stat *sb, + struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { diff --git a/sys/sys/file.h b/sys/sys/file.h index 6d6d2754e097..6cb4ad08fd31 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -47,7 +47,7 @@ #include struct filedesc; -struct stat; +struct kernel_stat; struct thread; struct uio; struct knote; @@ -105,7 +105,7 @@ typedef int fo_ioctl_t(struct file *fp, u_long com, void *data, typedef int fo_poll_t(struct file *fp, int events, struct ucred *active_cred, struct thread *td); typedef int fo_kqfilter_t(struct file *fp, struct knote *kn); -typedef int fo_stat_t(struct file *fp, struct stat *sb, +typedef int fo_stat_t(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td); typedef int fo_close_t(struct file *fp, struct thread *td); typedef int fo_chmod_t(struct file *fp, mode_t mode, @@ -351,7 +351,7 @@ fo_poll(struct file *fp, int events, struct ucred *active_cred, } static __inline int -fo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, +fo_stat(struct file *fp, struct kernel_stat *sb, struct ucred *active_cred, struct thread *td) { diff --git a/sys/sys/ktrace.h b/sys/sys/ktrace.h index 97fe82730315..66cad6db6f4c 100644 --- a/sys/sys/ktrace.h +++ b/sys/sys/ktrace.h @@ -164,7 +164,7 @@ struct ktr_csw { * struct contents */ struct sockaddr; -struct stat; +struct kernel_stat; struct sysentvec; /* @@ -290,7 +290,7 @@ void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *, #define ktrsockaddr(s) \ ktrstruct("sockaddr", (s), ((struct sockaddr *)(s))->sa_len) #define ktrstat(s) \ - ktrstruct("stat", (s), sizeof(struct stat)) + ktrstruct("stat", (s), sizeof(struct kernel_stat)) extern u_int ktr_geniosize; #else diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 35b2aaf6ffb6..131fc3a5e1e8 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -174,7 +174,7 @@ const char *prurequests[] = { #ifdef _KERNEL /* users shouldn't see this decl */ struct ifnet; -struct stat; +struct kernel_stat; struct ucred; struct uio; @@ -211,7 +211,7 @@ struct pr_usrreqs { #define PRUS_MORETOCOME 0x4 #define PRUS_NOTREADY 0x8 int (*pru_ready)(struct socket *so, struct mbuf *m, int count); - int (*pru_sense)(struct socket *so, struct stat *sb); + int (*pru_sense)(struct socket *so, struct kernel_stat *sb); int (*pru_shutdown)(struct socket *so); int (*pru_flush)(struct socket *so, int direction); int (*pru_sockaddr)(struct socket *so, struct sockaddr **nam); @@ -257,7 +257,7 @@ int pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags); int pru_send_notsupp(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td); int pru_ready_notsupp(struct socket *so, struct mbuf *m, int count); -int pru_sense_null(struct socket *so, struct stat *sb); +int pru_sense_null(struct socket *so, struct kernel_stat *sb); int pru_shutdown_notsupp(struct socket *so); int pru_sockaddr_notsupp(struct socket *so, struct sockaddr **nam); int pru_sosend_notsupp(struct socket *so, struct sockaddr *addr, diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 03040f74eba4..bc10889416e1 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -142,7 +142,7 @@ struct freebsd11_stat { struct timespec st_birthtim; /* time of file creation */ /* * Explicitly pad st_birthtim to 16 bytes so that the size of - * struct stat is backwards compatible. We use bitfields instead + * struct kernel_stat is backwards compatible. We use bitfields instead * of an array of chars so that this doesn't require a C99 compiler * to compile if the size of the padding is 0. We use 2 bitfields * to cover up to 64 bits on 32-bit machines. We assume that @@ -157,7 +157,11 @@ struct freebsd11_stat { #define __STAT_TIME_T_EXT 1 #endif +#ifdef _KERNEL +struct kernel_stat { +#else struct stat { +#endif dev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ nlink_t st_nlink; /* number of hard links */ @@ -188,7 +192,9 @@ struct stat { blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint64_t st_gen; /* file generation number */ +#ifndef _KERNEL __uint64_t st_spare[10]; +#endif }; #ifdef _KERNEL diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 7724e8437b6c..8245595bb8dc 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -59,7 +59,7 @@ struct rusage; struct sched_param; union semun; struct sockaddr; -struct stat; +struct kernel_stat; struct thr_param; struct uio; @@ -122,10 +122,10 @@ int kern_fchownat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, int uid, int gid, int flag); int kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg); int kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg); -int kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); +int kern_fhstat(struct thread *td, fhandle_t fh, struct kernel_stat *buf); int kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); int kern_fpathconf(struct thread *td, int fd, int name, long *valuep); -int kern_fstat(struct thread *td, int fd, struct stat *sbp); +int kern_fstat(struct thread *td, int fd, struct kernel_stat *sbp); int kern_fstatfs(struct thread *td, int fd, struct statfs *buf); int kern_fsync(struct thread *td, int fd, bool fullsync); int kern_ftruncate(struct thread *td, int fd, off_t length); @@ -280,8 +280,8 @@ int kern_sigqueue(struct thread *td, pid_t pid, int signum, union sigval *value); int kern_socket(struct thread *td, int domain, int type, int protocol); int kern_statat(struct thread *td, int flag, int fd, const char *path, - enum uio_seg pathseg, struct stat *sbp, - void (*hook)(struct vnode *vp, struct stat *sbp)); + enum uio_seg pathseg, struct kernel_stat *sbp, + void (*hook)(struct vnode *vp, struct kernel_stat *sbp)); int kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg, struct statfs *buf); int kern_symlinkat(struct thread *td, const char *path1, int fd, diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 08c596c1e5a8..45e17aa6bdf7 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -593,6 +593,7 @@ struct ostat; struct freebsd11_stat; struct thread; struct proc; +struct kernel_stat; struct stat; struct nstat; struct ucred; @@ -618,9 +619,10 @@ void cache_purge(struct vnode *vp); void cache_purge_negative(struct vnode *vp); void cache_purgevfs(struct mount *mp, bool force); int change_dir(struct vnode *vp, struct thread *td); -void cvtstat(struct stat *st, struct ostat *ost); -void freebsd11_cvtnstat(struct stat *sb, struct nstat *nsb); -int freebsd11_cvtstat(struct stat *st, struct freebsd11_stat *ost); +void cvtstat(struct kernel_stat *st, struct ostat *ost); +int copyout_kernel_stat(struct kernel_stat *sb, struct stat *usb); +void freebsd11_cvtnstat(struct kernel_stat *sb, struct nstat *nsb); +int freebsd11_cvtstat(struct kernel_stat *st, struct freebsd11_stat *ost); int getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops, struct vnode **vpp); void getnewvnode_reserve(void); @@ -708,7 +710,7 @@ int vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base, struct thread *td); int vn_rlimit_fsize(const struct vnode *vn, const struct uio *uio, struct thread *td); -int vn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred, +int vn_stat(struct vnode *vp, struct kernel_stat *sb, struct ucred *active_cred, struct ucred *file_cred, struct thread *td); int vn_start_write(struct vnode *vp, struct mount **mpp, int flags); int vn_start_secondary_write(struct vnode *vp, struct mount **mpp,