]> gitweb.factorcode.org Git - factor.git/blob - basis/io/files/info/unix/netbsd/netbsd.factor
Merge branch 'master' of git://factorcode.org/git/factor into struct-updates
[factor.git] / basis / io / files / info / unix / netbsd / netbsd.factor
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
8 io.files.info.unix ;
9 IN: io.files.info.unix.netbsd
10
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
14 idx mount-from ;
15
16 M: netbsd new-file-system-info netbsd-file-system-info new ;
17
18 M: netbsd file-system-statvfs
19     \ statvfs <struct> [ statvfs io-error ] keep ;
20
21 M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' )
22     {
23         [ f_flag>> >>flags ]
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 ]
31         [ f_files>> >>files ]
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 ]
39         [ f_fsidx>> >>idx ]
40         [ f_fsid>> >>id ]
41         [ f_namemax>> >>name-max ]
42         [ f_owner>> >>owner ]
43         [ f_fstypename>> utf8 alien>string >>type ]
44         [ f_mntonname>> utf8 alien>string >>mount-point ]
45         [ f_mntfromname>> utf8 alien>string >>device-name ]
46     } cleave ;
47
48 M: netbsd file-systems ( -- array )
49     f 0 0 getvfsstat dup io-error
50     \ statvfs <struct-array>
51     [ dup length 0 getvfsstat io-error ]
52     [ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ;