1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien.syntax kernel unix.stat math unix
4 combinators system io.backend accessors alien.c-types
5 io.encodings.utf8 alien.strings unix.types io.files.unix
6 io.files io.files.info unix.statvfs.netbsd unix.getfsstat.netbsd arrays
7 grouping sequences io.encodings.utf8 classes.struct struct-arrays
9 IN: io.files.info.unix.netbsd
11 TUPLE: netbsd-file-system-info < unix-file-system-info
12 blocks-reserved files-reserved
13 owner io-size sync-reads sync-writes async-reads async-writes
16 M: netbsd new-file-system-info netbsd-file-system-info new ;
18 M: netbsd file-system-statvfs
19 \ statvfs <struct> [ statvfs io-error ] keep ;
21 M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
24 [ f_bsize>> >>block-size ]
25 [ f_frsize>> >>preferred-block-size ]
26 [ f_iosize>> >>io-size ]
27 [ f_blocks>> >>blocks ]
28 [ f_bfree>> >>blocks-free ]
29 [ f_bavail>> >>blocks-available ]
30 [ f_bresvd>> >>blocks-reserved ]
32 [ f_ffree>> >>files-free ]
33 [ f_favail>> >>files-available ]
34 [ f_fresvd>> >>files-reserved ]
35 [ f_syncreads>> >>sync-reads ]
36 [ f_syncwrites>> >>sync-writes ]
37 [ f_asyncreads>> >>async-reads ]
38 [ f_asyncwrites>> >>async-writes ]
41 [ f_namemax>> >>name-max ]
43 [ f_fstypename>> utf8 alien>string >>type ]
44 [ f_mntonname>> utf8 alien>string >>mount-point ]
45 [ f_mntfromname>> utf8 alien>string >>device-name ]
48 M: netbsd file-systems ( -- array )
49 f 0 0 getvfsstat dup io-error
50 \ statvfs <struct-array>
51 [ dup byte-length 0 getvfsstat io-error ]
52 [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;