file-systems on openbsd

db4
sheeple 2008-12-02 15:59:01 -06:00
parent 9ac3f13b2a
commit f887d71965
10 changed files with 34 additions and 28 deletions

View File

@ -2,7 +2,7 @@
! 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 )

View File

@ -2,8 +2,8 @@
! 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

View File

@ -1,16 +1,23 @@
! 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 ]
@ -26,7 +33,7 @@ M: openbsd statfs>file-system-info ( file-system-info statfs -- file-system-info
[ 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 ]
@ -39,3 +46,9 @@ M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-in
{
[ 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 ;

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,10 @@
! 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 ) ;

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -27,7 +27,7 @@ C-STRUCT: statfs
{ { "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 ) ;

View File

@ -1,4 +0,0 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test unix.statfs ;
IN: unix.statfs.tests

View File

@ -1,13 +0,0 @@
! 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