From owner-freebsd-emulation Fri Jul 6 12:38:21 2001 Delivered-To: freebsd-emulation@freebsd.org Received: from peorth.iteration.net (peorth.iteration.net [208.190.180.178]) by hub.freebsd.org (Postfix) with ESMTP id 674FE37B403 for ; Fri, 6 Jul 2001 12:38:12 -0700 (PDT) (envelope-from keichii@iteration.net) Received: by peorth.iteration.net (Postfix, from userid 1001) id CD9FB59229; Fri, 6 Jul 2001 14:38:11 -0500 (CDT) Date: Fri, 6 Jul 2001 14:38:11 -0500 From: "Michael C . Wu" To: emulation@freebsd.org Subject: Reviews please:linux *stat64 functions Message-ID: <20010706143811.A14859@peorth.iteration.net> Reply-To: "Michael C . Wu" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline User-Agent: Mutt/1.2.5i X-PGP-Fingerprint: 5025 F691 F943 8128 48A8 5025 77CE 29C5 8FA1 2E20 X-PGP-Key-ID: 0x8FA12E20 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I've merged someone's patches for linux_*stat*. Could people please test this? I will commit this in 4 days if no one objects. Thanks, -- Michael C. Wu +1-512-7757700 keichii@{iteration.net|freebsd.org} --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="linux_stats.patch" ? linux_stats.patch ? usr.sbin/config/y.tab.h ? usr.sbin/config/y.tab.c ? usr.sbin/config/config.c ? usr.sbin/config/lang.c ? usr.sbin/config/config ? usr.sbin/config/config.8.gz Index: sys/compat/linux/linux_file.c =================================================================== RCS file: /home/ncvs/src/sys/compat/linux/linux_file.c,v retrieving revision 1.53 diff -u -r1.53 linux_file.c --- sys/compat/linux/linux_file.c 2001/05/01 08:11:51 1.53 +++ sys/compat/linux/linux_file.c 2001/07/06 19:27:00 @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -898,6 +899,97 @@ bsd.offset = uap->offset; return pwrite(p, &bsd); } + +int +linux_stat64(p, uap) + struct proc *p; + struct linux_stat64_args *uap; +{ + struct stat_args bsd; + struct stat st; + int error; + + bsd.path = uap->path; + bsd.ub = &st; + error = stat(p, &bsd); + if (!error) { + uap->up->st_dev = st.st_dev; + uap->up->st_mode = st.st_mode; + uap->up->st_nlink = st.st_nlink; + uap->up->st_uid = st.st_uid; + uap->up->st_gid = st.st_gid; + uap->up->st_rdev = st.st_rdev; + uap->up->st_size = st.st_size; + uap->up->st_blksize = st.st_blksize; + uap->up->st_blocks = st.st_blocks; + uap->up->st_latime = st.st_atime; + uap->up->st_lmtime = st.st_mtime; + uap->up->st_lctime = st.st_ctime; + uap->up->st_ino = st.st_ino; + } + return (error); +} + +int +linux_lstat64(p, uap) + struct proc *p; + struct linux_lstat64_args *uap; +{ + struct lstat_args bsd; + struct stat st; + int error; + + bsd.path = uap->path; + bsd.ub = &st; + error = lstat(p, &bsd); + if (!error) { + uap->up->st_dev = st.st_dev; + uap->up->st_mode = st.st_mode; + uap->up->st_nlink = st.st_nlink; + uap->up->st_uid = st.st_uid; + uap->up->st_gid = st.st_gid; + uap->up->st_rdev = st.st_rdev; + uap->up->st_size = st.st_size; + uap->up->st_blksize = st.st_blksize; + uap->up->st_blocks = st.st_blocks; + uap->up->st_latime = st.st_atime; + uap->up->st_lmtime = st.st_mtime; + uap->up->st_lctime = st.st_ctime; + uap->up->st_ino = st.st_ino; + } + return (error); +} + +int +linux_fstat64(p, uap) + struct proc *p; + struct linux_fstat64_args *uap; +{ + struct fstat_args bsd; + struct stat st; + int error; + + bsd.fd = uap->fd; + bsd.sb = &st; + error = fstat(p, &bsd); + if (!error) { + uap->up->st_dev = st.st_dev; + uap->up->st_mode = st.st_mode; + uap->up->st_nlink = st.st_nlink; + uap->up->st_uid = st.st_uid; + uap->up->st_gid = st.st_gid; + uap->up->st_rdev = st.st_rdev; + uap->up->st_size = st.st_size; + uap->up->st_blksize = st.st_blksize; + uap->up->st_blocks = st.st_blocks; + uap->up->st_latime = st.st_atime; + uap->up->st_lmtime = st.st_mtime; + uap->up->st_lctime = st.st_ctime; + uap->up->st_ino = st.st_ino; + } + return (error); +} + int linux_mount(struct proc *p, struct linux_mount_args *args) Index: sys/i386/linux/linux.h =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux.h,v retrieving revision 1.54 diff -u -r1.54 linux.h --- sys/i386/linux/linux.h 2001/06/13 10:58:35 1.54 +++ sys/i386/linux/linux.h 2001/07/06 19:27:18 @@ -557,4 +557,30 @@ #define ifr_name ifr_ifrn.ifrn_name /* interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ +struct linux_stat64 { + linux_dev_t st_dev; + u_char __pad0[10]; + linux_ino_t __st_ino; + u_int st_mode; + u_int st_nlink; + + u_long st_uid; + u_long st_gid; + + linux_dev_t st_rdev; + u_char __pad3[10]; + int64_t st_size; + u_long st_blksize; + u_long st_blocks; + u_long __pad4; + + linux_time_t st_latime; + u_long __pad5; + linux_time_t st_lmtime; + u_long __pad6; + linux_time_t st_lctime; + u_long __pad7; + u_int64_t st_ino; +}; + #endif /* !_I386_LINUX_LINUX_H_ */ Index: sys/i386/linux/linux_dummy.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_dummy.c,v retrieving revision 1.28 diff -u -r1.28 linux_dummy.c --- sys/i386/linux/linux_dummy.c 2001/02/16 14:46:14 1.28 +++ sys/i386/linux/linux_dummy.c 2001/07/06 19:27:18 @@ -103,6 +103,3 @@ DUMMY(mmap2); DUMMY(truncate64); DUMMY(ftruncate64); -DUMMY(stat64); -DUMMY(lstat64); -DUMMY(fstat64); Index: sys/i386/linux/linux_proto.h =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_proto.h,v retrieving revision 1.42 diff -u -r1.42 linux_proto.h --- sys/i386/linux/linux_proto.h 2001/04/01 06:43:09 1.42 +++ sys/i386/linux/linux_proto.h 2001/07/06 19:27:18 @@ -551,13 +551,16 @@ register_t dummy; }; struct linux_stat64_args { - register_t dummy; + char * path; char path_[PAD_(char *)]; + struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)]; }; struct linux_lstat64_args { - register_t dummy; + char * path; char path_[PAD_(char *)]; + struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)]; }; struct linux_fstat64_args { - register_t dummy; + int fd; char fd_[PAD_(int)]; + struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)]; }; int linux_setup __P((struct proc *, struct linux_setup_args *)); int linux_fork __P((struct proc *, struct linux_fork_args *)); Index: sys/i386/linux/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/syscalls.master,v retrieving revision 1.40 diff -u -r1.40 syscalls.master --- sys/i386/linux/syscalls.master 2001/04/01 06:37:40 1.40 +++ sys/i386/linux/syscalls.master 2001/07/06 19:27:18 @@ -286,6 +286,6 @@ 192 STD LINUX { int linux_mmap2(void); } 193 STD LINUX { int linux_truncate64(void); } 194 STD LINUX { int linux_ftruncate64(void); } -195 STD LINUX { int linux_stat64(void); } -196 STD LINUX { int linux_lstat64(void); } -197 STD LINUX { int linux_fstat64(void); } +195 STD LINUX { int linux_stat64(char *path, struct linux_stat64 *up); } +196 STD LINUX { int linux_lstat64(char *path, struct linux_stat64 *up); } +197 STD LINUX { int linux_fstat64(int fd, struct linux_stat64 *up); } --HcAYCG3uE/tztfnV-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message