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
8 specialized-arrays.direct.uint io.files.info.unix ;
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" <c-object> [ statvfs io-error ] keep ;
21 M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
23 [ statvfs-f_flag >>flags ]
24 [ statvfs-f_bsize >>block-size ]
25 [ statvfs-f_frsize >>preferred-block-size ]
26 [ statvfs-f_iosize >>io-size ]
27 [ statvfs-f_blocks >>blocks ]
28 [ statvfs-f_bfree >>blocks-free ]
29 [ statvfs-f_bavail >>blocks-available ]
30 [ statvfs-f_bresvd >>blocks-reserved ]
31 [ statvfs-f_files >>files ]
32 [ statvfs-f_ffree >>files-free ]
33 [ statvfs-f_favail >>files-available ]
34 [ statvfs-f_fresvd >>files-reserved ]
35 [ statvfs-f_syncreads >>sync-reads ]
36 [ statvfs-f_syncwrites >>sync-writes ]
37 [ statvfs-f_asyncreads >>async-reads ]
38 [ statvfs-f_asyncwrites >>async-writes ]
39 [ statvfs-f_fsidx 2 <direct-uint-array> >array >>idx ]
40 [ statvfs-f_fsid >>id ]
41 [ statvfs-f_namemax >>name-max ]
42 [ statvfs-f_owner >>owner ]
43 ! [ statvfs-f_spare >>spare ]
44 [ statvfs-f_fstypename utf8 alien>string >>type ]
45 [ statvfs-f_mntonname utf8 alien>string >>mount-point ]
46 [ statvfs-f_mntfromname utf8 alien>string >>device-name ]
49 M: netbsd file-systems ( -- array )
50 f 0 0 getvfsstat dup io-error
51 "statvfs" <c-array> dup dup length 0 getvfsstat io-error
52 "statvfs" heap-size group
53 [ statvfs-f_mntonname utf8 alien>string file-system-info ] map ;