split up linux statfs
parent
69aad251c1
commit
09c1f8cc01
|
@ -1,6 +1,8 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax unix.types ;
|
||||
USING: alien.c-types combinators kernel io.files unix.stat
|
||||
math accessors system unix io.backend layouts vocabs.loader
|
||||
alien.syntax ;
|
||||
IN: unix.statfs.linux
|
||||
|
||||
C-STRUCT: statfs
|
||||
|
@ -13,3 +15,32 @@ C-STRUCT: statfs
|
|||
{ "long" "f_ffree" }
|
||||
{ "fsid_t" "f_fsid" }
|
||||
{ "long" "f_namelen" } ;
|
||||
|
||||
FUNCTION: int statfs ( char* path, statfs64* buf ) ;
|
||||
|
||||
TUPLE: linux-file-system-info < file-system-info
|
||||
type bsize blocks bfree bavail files ffree fsid
|
||||
namelen frsize spare ;
|
||||
|
||||
M: linux >file-system-info ( struct -- statfs )
|
||||
[ \ linux-file-system-info new ] dip
|
||||
{
|
||||
[
|
||||
[ statfs64-f_bsize ]
|
||||
[ statfs64-f_bavail ] bi * >>free-space
|
||||
]
|
||||
[ statfs-f_type >>type ]
|
||||
[ statfs-f_bsize >>bsize ]
|
||||
[ statfs-f_blocks >>blocks ]
|
||||
[ statfs-f_bfree >>bfree ]
|
||||
[ statfs-f_bavail >>bavail ]
|
||||
[ statfs-f_files >>files ]
|
||||
[ statfs-f_ffree >>ffree ]
|
||||
[ statfs-f_fsid >>fsid ]
|
||||
[ statfs-f_namelen >>namelen ]
|
||||
} cleave ;
|
||||
|
||||
M: linux file-system-info ( path -- byte-array )
|
||||
normalize-path
|
||||
"statfs" <c-object> tuck statfs io-error
|
||||
>file-system-info ;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
! Copyright (C) 2008 Doug Coleman.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: alien.syntax unix.types ;
|
||||
USING: alien.c-types combinators kernel io.files unix.stat
|
||||
math accessors system unix io.backend layouts vocabs.loader
|
||||
alien.syntax ;
|
||||
IN: unix.statfs.linux
|
||||
|
||||
C-STRUCT: statfs64
|
||||
|
@ -17,3 +19,32 @@ C-STRUCT: statfs64
|
|||
{ { "__SWORD_TYPE" 5 } "f_spare" } ;
|
||||
|
||||
FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
|
||||
|
||||
TUPLE: linux-file-system-info < file-system-info
|
||||
type bsize blocks bfree bavail files ffree fsid
|
||||
namelen frsize spare ;
|
||||
|
||||
M: linux >file-system-info ( struct -- statfs )
|
||||
[ \ linux-file-system-info new ] dip
|
||||
{
|
||||
[
|
||||
[ statfs64-f_bsize ]
|
||||
[ statfs64-f_bavail ] bi * >>free-space
|
||||
]
|
||||
[ statfs64-f_type >>type ]
|
||||
[ statfs64-f_bsize >>bsize ]
|
||||
[ statfs64-f_blocks >>blocks ]
|
||||
[ statfs64-f_bfree >>bfree ]
|
||||
[ statfs64-f_bavail >>bavail ]
|
||||
[ statfs64-f_files >>files ]
|
||||
[ statfs64-f_ffree >>ffree ]
|
||||
[ statfs64-f_fsid >>fsid ]
|
||||
[ statfs64-f_namelen >>namelen ]
|
||||
[ statfs64-f_frsize >>frsize ]
|
||||
[ statfs64-f_spare >>spare ]
|
||||
} cleave ;
|
||||
|
||||
M: linux file-system-info ( path -- byte-array )
|
||||
normalize-path
|
||||
"statfs64" <c-object> tuck statfs64 io-error
|
||||
>file-system-info ;
|
||||
|
|
|
@ -4,36 +4,7 @@ USING: alien.c-types combinators kernel io.files unix.stat
|
|||
math accessors system unix io.backend layouts vocabs.loader ;
|
||||
IN: unix.statfs.linux
|
||||
|
||||
<< cell-bits {
|
||||
cell-bits {
|
||||
{ 32 [ "unix.statfs.linux.32" require ] }
|
||||
{ 64 [ "unix.statfs.linux.64" require ] }
|
||||
} case >>
|
||||
|
||||
TUPLE: linux-file-system-info < file-system-info
|
||||
type bsize blocks bfree bavail files ffree fsid
|
||||
namelen frsize spare ;
|
||||
|
||||
M: linux >file-system-info ( struct -- statfs )
|
||||
[ \ linux-file-system-info new ] dip
|
||||
{
|
||||
[
|
||||
[ statfs64-f_bsize ]
|
||||
[ statfs64-f_bavail ] bi * >>free-space
|
||||
]
|
||||
[ statfs64-f_type >>type ]
|
||||
[ statfs64-f_bsize >>bsize ]
|
||||
[ statfs64-f_blocks >>blocks ]
|
||||
[ statfs64-f_bfree >>bfree ]
|
||||
[ statfs64-f_bavail >>bavail ]
|
||||
[ statfs64-f_files >>files ]
|
||||
[ statfs64-f_ffree >>ffree ]
|
||||
[ statfs64-f_fsid >>fsid ]
|
||||
[ statfs64-f_namelen >>namelen ]
|
||||
! [ statfs64-f_frsize >>frsize ]
|
||||
! [ statfs64-f_spare >>spare ]
|
||||
} cleave ;
|
||||
|
||||
M: linux file-system-info ( path -- byte-array )
|
||||
normalize-path
|
||||
"statfs64" <c-object> tuck statfs64 io-error
|
||||
>file-system-info ;
|
||||
} case
|
||||
|
|
Loading…
Reference in New Issue