1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien 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 alien.data
8 specialized-arrays io.files.info.unix ;
9 SPECIALIZED-ARRAY: statvfs
10 IN: io.files.info.unix.netbsd
12 TUPLE: netbsd-file-system-info < unix-file-system-info
13 blocks-reserved files-reserved
14 owner io-size sync-reads sync-writes async-reads async-writes
17 M: netbsd new-file-system-info netbsd-file-system-info new ;
19 M: netbsd file-system-statvfs
20 \ statvfs <struct> [ statvfs io-error ] keep ;
22 M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
25 [ f_bsize>> >>block-size ]
26 [ f_frsize>> >>preferred-block-size ]
27 [ f_iosize>> >>io-size ]
28 [ f_blocks>> >>blocks ]
29 [ f_bfree>> >>blocks-free ]
30 [ f_bavail>> >>blocks-available ]
31 [ f_bresvd>> >>blocks-reserved ]
33 [ f_ffree>> >>files-free ]
34 [ f_favail>> >>files-available ]
35 [ f_fresvd>> >>files-reserved ]
36 [ f_syncreads>> >>sync-reads ]
37 [ f_syncwrites>> >>sync-writes ]
38 [ f_asyncreads>> >>async-reads ]
39 [ f_asyncwrites>> >>async-writes ]
42 [ f_namemax>> >>name-max ]
44 [ f_fstypename>> utf8 alien>string >>type ]
45 [ f_mntonname>> utf8 alien>string >>mount-point ]
46 [ f_mntfromname>> utf8 alien>string >>device-name ]
49 M: netbsd file-systems ( -- array )
50 f 0 0 getvfsstat dup io-error
52 [ dup byte-length 0 getvfsstat io-error ]
53 [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;