implement mounted on linux

db4
Doug Coleman 2008-10-22 19:01:45 -05:00
parent 371b1f8f20
commit f9b90d035b
3 changed files with 25 additions and 4 deletions

View File

@ -8,3 +8,27 @@ cell-bits {
{ 32 [ "unix.statfs.linux.32" require ] }
{ 64 [ "unix.statfs.linux.64" require ] }
} case
TUPLE: mtab-entry file-system-name mount-point type options
frequency pass-number ;
: mtab-csv>mtab-entry ( csv -- mtab-entry )
[ mtab-entry new ] dip
{
[ first >>file-system-name ]
[ second >>mount-point ]
[ third >>type ]
[ fourth <string-reader> csv first >>options ]
[ 4 swap nth >>frequency ]
[ 5 swap nth >>pass-number ]
} cleave ;
: parse-mtab ( -- array )
[
"/etc/mtab" utf8 <file-reader>
CHAR: \s delimiter set csv
] with-scope
[ mtab-csv>mtab-entry ] map ;
M: linux mounted*
parse-mtab [ mount-point>> >file-system-info ] map ;

View File

@ -128,9 +128,6 @@ M: macosx mounted* ( -- array )
[ *void* ] dip
"statfs64" heap-size [ * memory>byte-array ] keep group ;
M: macosx >mounted
>file-system-info ;
M: macosx >file-system-info ( byte-array -- file-system-info )
[ \ macosx-file-system-info new ] dip
{

View File

@ -16,7 +16,7 @@ TUPLE: file-system-info root-directory total-free-size total-size ;
HOOK: >file-system-info os ( struct -- statfs )
: mounted ( -- array ) mounted* [ >mounted ] map ;
: mounted ( -- array ) mounted* [ >file-system-info ] map ;
: mounted-drive ( path -- mounted/f )
mounted