Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2006 14:18:42 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 104690 for review
Message-ID:  <200608211418.k7LEIgBE097767@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=104690

Change 104690 by rdivacky@rdivacky_witten on 2006/08/21 14:18:34

	Add statfs64 syscall (untested).

Affected files ...

.. //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_stats.c#2 edit
.. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_dummy.c#11 edit

Differences ...

==== //depot/projects/soc2006/rdivacky_linuxolator/compat/linux/linux_stats.c#2 (text+ko) ====

@@ -312,6 +312,19 @@
 	l_int		f_spare[6];
 };
 
+struct l_statfs64 {
+	l_int		f_type;
+	l_int		f_bsize;
+	uint64_t	f_blocks;
+	uint64_t	f_bfree;
+	uint64_t	f_bavail;
+	uint64_t	f_files;
+	uint64_t	f_ffree;
+	l_fsid_t	f_fsid;
+	l_int		f_namelen;
+	l_int		f_spare[6];
+};
+
 #define	LINUX_CODA_SUPER_MAGIC	0x73757245L
 #define	LINUX_EXT2_SUPER_MAGIC	0xEF53L
 #define	LINUX_HPFS_SUPER_MAGIC	0xf995e849L
@@ -387,6 +400,44 @@
 	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
 }
 
+static void
+bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
+{
+
+	linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
+	linux_statfs->f_bsize = bsd_statfs->f_bsize;
+	linux_statfs->f_blocks = bsd_statfs->f_blocks;
+	linux_statfs->f_bfree = bsd_statfs->f_bfree;
+	linux_statfs->f_bavail = bsd_statfs->f_bavail;
+	linux_statfs->f_ffree = bsd_statfs->f_ffree;
+	linux_statfs->f_files = bsd_statfs->f_files;
+	linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
+	linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
+	linux_statfs->f_namelen = MAXNAMLEN;
+}
+
+int
+linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
+{
+	struct l_statfs64 linux_statfs;
+	struct statfs bsd_statfs;
+	char *path;
+	int error;
+
+	LCONVPATHEXIST(td, args->path, &path);
+
+#ifdef DEBUG
+	if (ldebug(statfs))
+		printf(ARGS(statfs, "%s, *"), path);
+#endif
+	error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
+	LFREEPATH(path);
+	if (error)
+		return (error);
+	bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
+	return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
+}
+
 int
 linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
 {

==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_dummy.c#11 (text+ko) ====

@@ -73,7 +73,6 @@
 DUMMY(epoll_ctl);
 DUMMY(epoll_wait);
 DUMMY(remap_file_pages);
-DUMMY(statfs64);
 DUMMY(fstatfs64);
 DUMMY(utimes);
 DUMMY(fadvise64_64);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608211418.k7LEIgBE097767>