2008-12-01 15:04:55 -05:00
|
|
|
! Copyright (C) 2008 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-12-02 16:59:01 -05:00
|
|
|
USING: accessors alien.c-types alien.strings alien.syntax
|
2008-12-15 03:18:59 -05:00
|
|
|
combinators io.backend io.files io.files.info io.files.unix kernel math
|
2008-12-02 16:59:01 -05:00
|
|
|
sequences system unix unix.getfsstat.openbsd grouping
|
2008-12-10 15:28:22 -05:00
|
|
|
unix.statfs.openbsd unix.statvfs.openbsd unix.types
|
2009-08-31 13:35:47 -04:00
|
|
|
arrays io.files.info.unix classes.struct struct-arrays
|
|
|
|
io.encodings.utf8 ;
|
2008-12-14 21:03:00 -05:00
|
|
|
IN: io.files.unix.openbsd
|
2008-12-01 15:04:55 -05:00
|
|
|
|
2009-09-01 15:18:29 -04:00
|
|
|
TUPLE: openbsd-file-system-info < unix-file-system-info
|
2008-12-02 16:59:01 -05:00
|
|
|
io-size sync-writes sync-reads async-writes async-reads
|
|
|
|
owner ;
|
|
|
|
|
2009-09-01 15:18:29 -04:00
|
|
|
M: openbsd new-file-system-info openbsd-file-system-info new ;
|
2008-12-02 16:59:01 -05:00
|
|
|
|
2008-12-02 18:43:07 -05:00
|
|
|
M: openbsd file-system-statfs
|
2009-08-30 05:06:41 -04:00
|
|
|
\ statfs <struct> [ statfs io-error ] keep ;
|
2008-12-02 18:43:07 -05:00
|
|
|
|
|
|
|
M: openbsd statfs>file-system-info ( file-system-info statfs -- file-system-info' )
|
|
|
|
{
|
2009-08-30 05:06:41 -04:00
|
|
|
[ f_flags>> >>flags ]
|
|
|
|
[ f_bsize>> >>block-size ]
|
|
|
|
[ f_iosize>> >>io-size ]
|
|
|
|
[ f_blocks>> >>blocks ]
|
|
|
|
[ f_bfree>> >>blocks-free ]
|
|
|
|
[ f_bavail>> >>blocks-available ]
|
|
|
|
[ f_files>> >>files ]
|
|
|
|
[ f_ffree>> >>files-free ]
|
|
|
|
[ f_favail>> >>files-available ]
|
|
|
|
[ f_syncwrites>> >>sync-writes ]
|
|
|
|
[ f_syncreads>> >>sync-reads ]
|
|
|
|
[ f_asyncwrites>> >>async-writes ]
|
|
|
|
[ f_asyncreads>> >>async-reads ]
|
2009-08-30 12:58:30 -04:00
|
|
|
[ f_fsid>> >>id ]
|
2009-08-30 05:06:41 -04:00
|
|
|
[ f_namemax>> >>name-max ]
|
|
|
|
[ f_owner>> >>owner ]
|
2009-08-31 13:20:56 -04:00
|
|
|
[ f_fstypename>> utf8 alien>string >>type ]
|
|
|
|
[ f_mntonname>> utf8 alien>string >>mount-point ]
|
|
|
|
[ f_mntfromname>> utf8 alien>string >>device-name ]
|
2008-12-02 18:43:07 -05:00
|
|
|
} cleave ;
|
|
|
|
|
2008-12-01 21:30:52 -05:00
|
|
|
M: openbsd file-system-statvfs ( normalized-path -- statvfs )
|
2009-08-30 05:06:41 -04:00
|
|
|
\ statvfs <struct> [ statvfs io-error ] keep ;
|
2008-12-01 21:30:52 -05:00
|
|
|
|
|
|
|
M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
|
2009-08-30 05:06:41 -04:00
|
|
|
f_frsize>> >>preferred-block-size ;
|
2008-12-02 16:59:01 -05:00
|
|
|
|
|
|
|
M: openbsd file-systems ( -- seq )
|
|
|
|
f 0 0 getfsstat dup io-error
|
2009-08-31 13:35:47 -04:00
|
|
|
\ statfs <struct-array>
|
2009-09-01 14:16:37 -04:00
|
|
|
[ dup byte-length 0 getfsstat io-error ]
|
|
|
|
[ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
|