From owner-p4-projects@FreeBSD.ORG Mon Aug 21 14:18:55 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9675116A4E7; Mon, 21 Aug 2006 14:18:55 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 591E616A4DD for ; Mon, 21 Aug 2006 14:18:55 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 85C5043D5C for ; Mon, 21 Aug 2006 14:18:42 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7LEIgK0097770 for ; Mon, 21 Aug 2006 14:18:42 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7LEIgBE097767 for perforce@freebsd.org; Mon, 21 Aug 2006 14:18:42 GMT (envelope-from rdivacky@FreeBSD.org) Date: Mon, 21 Aug 2006 14:18:42 GMT Message-Id: <200608211418.k7LEIgBE097767@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 104690 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2006 14:18:55 -0000 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);