PERFORCE change 50536 for review

Peter Wemm peter at FreeBSD.org
Tue Apr 6 16:24:02 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=50536

Change 50536 by peter at peter_daintree on 2004/04/06 16:22:22

	finish off fstatfs changes.  This is enough to get yahoo messenger
	(both 4.x and 5.x versions) to run.

Affected files ...

.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32.h#4 edit
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#11 edit
.. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#15 edit
.. //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#17 edit

Differences ...

==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32.h#4 (text+ko) ====

@@ -75,9 +75,10 @@
 	int32_t	ru_nivcsw;
 };
 
-#define FREEBSD4_FREEBSD32_MNAMELEN        (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
+#define FREEBSD4_MNAMELEN        (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
 
-struct freebsd4_statfs32 {
+/* 4.x version */
+struct statfs32 {
 	int32_t	f_spare2;
 	int32_t	f_bsize;
 	int32_t	f_iosize;
@@ -93,11 +94,11 @@
 	int32_t	f_syncwrites;
 	int32_t	f_asyncwrites;
 	char	f_fstypename[MFSNAMELEN];
-	char	f_mntonname[FREEBSD4_FREEBSD32_MNAMELEN];
+	char	f_mntonname[FREEBSD4_MNAMELEN];
 	int32_t	f_syncreads;
 	int32_t	f_asyncreads;
 	int16_t	f_spares1;
-	char	f_mntfromname[FREEBSD4_FREEBSD32_MNAMELEN];
+	char	f_mntfromname[FREEBSD4_MNAMELEN];
 	int16_t	f_spares2 __packed;
 	int32_t f_spare[2];
 };

==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#11 (text+ko) ====

@@ -140,15 +140,15 @@
 	bcopy(in->f_fstypename,
 	      out->f_fstypename, MFSNAMELEN);
 	bcopy(in->f_mntonname,
-	      out->f_mntonname, MNAMELEN);
+	      out->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN));
 	CP(*in, *out, f_syncreads);
 	CP(*in, *out, f_asyncreads);
 	bcopy(in->f_mntfromname,
-	      out->f_mntfromname, MNAMELEN);
+	      out->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN));
 }
 
 int
-freebsd32_getfsstat(struct thread *td, struct freebsd32_getfsstat_args *uap)
+freebsd4_freebsd32_getfsstat(struct thread *td, struct freebsd4_freebsd32_getfsstat_args *uap)
 {
 	int error;
 	caddr_t sg;
@@ -870,7 +870,7 @@
 }
 
 int
-freebsd32_statfs(struct thread *td, struct freebsd32_statfs_args *uap)
+freebsd4_freebsd32_statfs(struct thread *td, struct freebsd4_freebsd32_statfs_args *uap)
 {
 	int error;
 	caddr_t sg;
@@ -897,7 +897,7 @@
 }
 
 int
-freebsd32_fstatfs(struct thread *td, struct freebsd32_fstatfs_args *uap)
+freebsd4_freebsd32_fstatfs(struct thread *td, struct freebsd4_freebsd32_fstatfs_args *uap)
 {
 	int error;
 	caddr_t sg;
@@ -924,6 +924,33 @@
 }
 
 int
+freebsd4_freebsd32_fhstatfs(struct thread *td, struct freebsd4_freebsd32_fhstatfs_args *uap)
+{
+	int error;
+	caddr_t sg;
+	struct statfs32 *p32, s32;
+	struct statfs *p = NULL, s;
+
+	p32 = uap->buf;
+	if (p32) {
+		sg = stackgap_init();
+		p = stackgap_alloc(&sg, sizeof(struct statfs));
+		uap->buf = (struct statfs32 *)p;
+	}
+	error = fhstatfs(td, (struct fhstatfs_args *) uap);
+	if (error)
+		return (error);
+	if (p32) {
+		error = copyin(p, &s, sizeof(s));
+		if (error)
+			return (error);
+		copy_statfs(&s, &s32);
+		error = copyout(&s32, p32, sizeof(s32));
+	}
+	return (error);
+}
+
+int
 freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap)
 {
 	/*

==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#15 (text+ko) ====

@@ -245,21 +245,21 @@
 #ifdef COMPAT_FREEBSD4
 
 struct freebsd4_freebsd32_getfsstat_args {
-	char buf_l_[PADL_(struct freebsd4_statfs32 *)]; struct freebsd4_statfs32 * buf; char buf_r_[PADR_(struct freebsd4_statfs32 *)];
+	char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
 	char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];
 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
 };
 struct freebsd4_freebsd32_statfs_args {
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
-	char buf_l_[PADL_(struct freebsd4_statfs32 *)]; struct freebsd4_statfs32 * buf; char buf_r_[PADR_(struct freebsd4_statfs32 *)];
+	char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
 };
 struct freebsd4_freebsd32_fstatfs_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
-	char buf_l_[PADL_(struct freebsd4_statfs32 *)]; struct freebsd4_statfs32 * buf; char buf_r_[PADR_(struct freebsd4_statfs32 *)];
+	char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
 };
 struct freebsd4_freebsd32_fhstatfs_args {
 	char u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)];
-	char buf_l_[PADL_(struct freebsd4_statfs *)]; struct freebsd4_statfs * buf; char buf_r_[PADR_(struct freebsd4_statfs *)];
+	char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
 };
 struct freebsd4_freebsd32_sendfile_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];

==== //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#17 (text+ko) ====

@@ -64,7 +64,7 @@
 15	NOPROTO	{ int chmod(char *path, int mode); }
 16	NOPROTO	{ int chown(char *path, int uid, int gid); }
 17	MNOPROTO { int obreak(char *nsize); } break obreak_args int
-18	COMPAT4	{ int freebsd32_getfsstat(struct freebsd4_statfs32 *buf, \
+18	COMPAT4	{ int freebsd32_getfsstat(struct statfs32 *buf, \
 		    long bufsize, int flags); }
 19	OBSOL	olseek
 20	MNOPROTO { pid_t getpid(void); }
@@ -233,8 +233,8 @@
 155	UNIMPL	nfssvc
 156	OBSOL	ogetdirentries
 157	COMPAT4	{ int freebsd32_statfs(char *path, \
-		    struct freebsd4_statfs32 *buf); }
-158	COMPAT4	{ int freebsd32_fstatfs(int fd, struct freebsd4_statfs32 *buf);}
+		    struct statfs32 *buf); }
+158	COMPAT4	{ int freebsd32_fstatfs(int fd, struct statfs32 *buf);}
 159	UNIMPL	nosys
 160	UNIMPL	nosys
 161	NOPROTO	{ int getfh(char *fname, struct fhandle *fhp); }
@@ -416,7 +416,7 @@
 296	UNIMPL	nosys
 ; XXX 297 is 300 in NetBSD 
 297	COMPAT4	{ int freebsd32_fhstatfs(const struct fhandle *u_fhp, \
-		    struct freebsd4_statfs *buf); }
+		    struct statfs32 *buf); }
 298	NOPROTO	{ int fhopen(const struct fhandle *u_fhp, int flags); }
 299	NOPROTO	{ int fhstat(const struct fhandle *u_fhp, struct stat *sb); }
 ; syscall numbers for FreeBSD


More information about the p4-projects mailing list