! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.syntax combinators
io.backend io.files io.unix.files kernel math system unix
-unix.statfs unix.statvfs.freebsd ;
+unix.statvfs.freebsd ;
IN: io.unix.files.freebsd
M: freebsd file-system-statvfs ( path -- byte-array )
! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel unix.stat math unix
combinators system io.backend accessors alien.c-types
-io.encodings.utf8 alien.strings unix.types unix.statfs
-io.unix.files io.files unix.statvfs.netbsd ;
+io.encodings.utf8 alien.strings unix.types io.unix.files
+io.files unix.statvfs.netbsd ;
IN: io.unix.files.netbsd
TUPLE: netbsd-file-system-info < unix-file-system-info
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax accessors combinators kernel
-unix.types math system io.backend alien.c-types unix
-io.files io.unix.files unix.statvfs.openbsd ;
+USING: accessors alien.c-types alien.strings alien.syntax
+combinators io.backend io.files io.unix.files kernel math
+sequences system unix unix.getfsstat.openbsd grouping
+unix.statfs.openbsd unix.statvfs.openbsd unix.types ;
IN: io.unix.files.openbsd
+TUPLE: freebsd-file-system-info < unix-file-system-info
+io-size sync-writes sync-reads async-writes async-reads
+owner ;
+
+M: openbsd new-file-system-info freebsd-file-system-info new ;
+
M: openbsd file-system-statfs
"statfs" <c-object> tuck statfs io-error ;
M: openbsd statfs>file-system-info ( file-system-info statfs -- file-system-info' )
{
- [ statfs-f_flag >>flags ]
+ [ statfs-f_flags >>flags ]
[ statfs-f_bsize >>block-size ]
[ statfs-f_iosize >>io-size ]
[ statfs-f_blocks >>blocks ]
[ statfs-f_fsid >>id ]
[ statfs-f_namemax >>name-max ]
[ statfs-f_owner >>owner ]
- [ statfs-f_spare >>spare ]
+ ! [ statfs-f_spare >>spare ]
[ statfs-f_fstypename alien>native-string >>type ]
[ statfs-f_mntonname alien>native-string >>mount-point ]
[ statfs-f_mntfromname alien>native-string >>device-name ]
{
[ statvfs-f_frsize >>preferred-block-size ]
} cleave ;
+
+M: openbsd file-systems ( -- seq )
+ f 0 0 getfsstat dup io-error
+ "statfs" <c-array> dup dup length 0 getfsstat io-error
+ "statfs" heap-size group
+ [ statfs-f_mntonname alien>native-string file-system-info ] map ;
--- /dev/null
+Doug Coleman
--- /dev/null
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.getfsstat.openbsd
+
+: MNT_WAIT 1 ; ! synchronously wait for I/O to complete
+: MNT_NOWAIT 2 ; ! start all I/O, but do not wait for it
+: MNT_LAZY 3 ; ! push data not written by filesystem syncer
+
+FUNCTION: int getfsstat ( statfs* buf, int bufsize, int flags ) ;
--- /dev/null
+unportable
+++ /dev/null
-Doug Coleman
\ No newline at end of file
{ { "u_int32_t" 3 } "f_spare" }
{ { "char" MFSNAMELEN } "f_fstypename" }
{ { "char" MNAMELEN } "f_mntonname" }
- { { "char" MNAMELEN } "f_mntfromname" } ;
- ! { "mount_info" "mount_info" } ;
+ { { "char" MNAMELEN } "f_mntfromname" }
+ { { "char" 160 } "mount_info" } ;
FUNCTION: int statfs ( char* path, statvfs* buf ) ;
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test unix.statfs ;
-IN: unix.statfs.tests
+++ /dev/null
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: sequences system vocabs.loader combinators accessors
-kernel math.order sorting ;
-IN: unix.statfs
-
-os {
- { linux [ "unix.statfs.linux" require ] }
- { macosx [ "unix.statfs.macosx" require ] }
- { freebsd [ "unix.statfs.freebsd" require ] }
- { openbsd [ "unix.statfs.openbsd" require ] }
- { netbsd [ ] }
-} case
+++ /dev/null
-unportable