]> gitweb.factorcode.org Git - factor.git/commitdiff
redo most of statfs and statvfs
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Dec 2008 20:04:31 +0000 (14:04 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 1 Dec 2008 20:04:31 +0000 (14:04 -0600)
37 files changed:
basis/unix/statfs/freebsd/freebsd.factor
basis/unix/statfs/linux/32/32.factor [deleted file]
basis/unix/statfs/linux/32/authors.txt [deleted file]
basis/unix/statfs/linux/32/tags.txt [deleted file]
basis/unix/statfs/linux/64/64.factor [deleted file]
basis/unix/statfs/linux/64/authors.txt [deleted file]
basis/unix/statfs/linux/64/tags.txt [deleted file]
basis/unix/statfs/linux/linux.factor
basis/unix/statfs/macosx/macosx.factor
basis/unix/statfs/netbsd/netbsd.factor
basis/unix/statfs/openbsd/32/32.factor [deleted file]
basis/unix/statfs/openbsd/32/authors.txt [deleted file]
basis/unix/statfs/openbsd/32/tags.txt [deleted file]
basis/unix/statfs/openbsd/64/64.factor [deleted file]
basis/unix/statfs/openbsd/64/authors.txt [deleted file]
basis/unix/statfs/openbsd/64/tags.txt [deleted file]
basis/unix/statfs/openbsd/authors.txt [deleted file]
basis/unix/statfs/openbsd/openbsd.factor [deleted file]
basis/unix/statfs/openbsd/tags.txt [deleted file]
basis/unix/statfs/statfs.factor
basis/unix/statvfs/authors.txt [new file with mode: 0644]
basis/unix/statvfs/freebsd/authors.txt [new file with mode: 0644]
basis/unix/statvfs/freebsd/freebsd.factor [new file with mode: 0644]
basis/unix/statvfs/linux/authors.txt [new file with mode: 0644]
basis/unix/statvfs/linux/linux.factor [new file with mode: 0644]
basis/unix/statvfs/linux/tags.txt [new file with mode: 0644]
basis/unix/statvfs/macosx/authors.txt [new file with mode: 0644]
basis/unix/statvfs/macosx/macosx.factor [new file with mode: 0644]
basis/unix/statvfs/macosx/tags.txt [new file with mode: 0644]
basis/unix/statvfs/netbsd/authors.txt [new file with mode: 0644]
basis/unix/statvfs/netbsd/netbsd.factor [new file with mode: 0644]
basis/unix/statvfs/netbsd/tags.txt [new file with mode: 0644]
basis/unix/statvfs/openbsd/authors.txt [new file with mode: 0644]
basis/unix/statvfs/openbsd/openbsd.factor [new file with mode: 0644]
basis/unix/statvfs/openbsd/tags.txt [new file with mode: 0644]
basis/unix/statvfs/statvfs.factor [new file with mode: 0644]
basis/unix/statvfs/tags.txt [new file with mode: 0644]

index b6179a4ad717c92fb93126f24859011b011197e8..5496bbe1ba7228cb597af46b4d591b75c5726ea1 100644 (file)
@@ -22,32 +22,3 @@ C-STRUCT: statvfs
     { "ulong" "f_namemax" } ;
 
 FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
-
-TUPLE: freebsd-file-system-info < file-system-info
-bavail bfree blocks favail ffree files
-bsize flag frsize fsid namemax ;
-
-M: freebsd >file-system-info ( struct -- statfs )
-    [ \ freebsd-file-system-info new ] dip
-    {
-        [
-            [ statvfs-f_bsize ]
-            [ statvfs-f_bavail ] bi * >>free-space
-        ]
-        [ statvfs-f_bavail >>bavail ]
-        [ statvfs-f_bfree >>bfree ]
-        [ statvfs-f_blocks >>blocks ]
-        [ statvfs-f_favail >>favail ]
-        [ statvfs-f_ffree >>ffree ]
-        [ statvfs-f_files >>files ]
-        [ statvfs-f_bsize >>bsize ]
-        [ statvfs-f_flag >>flag ]
-        [ statvfs-f_frsize >>frsize ]
-        [ statvfs-f_fsid >>fsid ]
-        [ statvfs-f_namemax >>namemax ]
-    } cleave ;
-
-M: freebsd file-system-info ( path -- byte-array )
-    normalize-path
-    "statvfs" <c-object> tuck statvfs io-error
-    >file-system-info ;
diff --git a/basis/unix/statfs/linux/32/32.factor b/basis/unix/statfs/linux/32/32.factor
deleted file mode 100644 (file)
index fb8c6b5..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types combinators kernel unix.stat
-math accessors system unix io.backend layouts vocabs.loader
-alien.syntax unix.statfs io.files ;
-IN: unix.statfs.linux
-
-C-STRUCT: statfs
-    { "long"    "f_type" }
-    { "long"    "f_bsize" }
-    { "long"    "f_blocks" }
-    { "long"    "f_bfree" }
-    { "long"    "f_bavail" }
-    { "long"    "f_files" }
-    { "long"    "f_ffree" }
-    { "fsid_t"  "f_fsid" }
-    { "long"    "f_namelen" } ;
-
-FUNCTION: int statfs ( char* path, statfs* buf ) ;
-
-TUPLE: linux32-file-system-info < file-system-info
-bsize blocks bfree bavail files ffree fsid namelen
-frsize spare ;
-
-M: linux >file-system-info ( struct -- statfs )
-    [ \ linux32-file-system-info new ] dip
-    {
-        [
-            [ statfs-f_bsize ]
-            [ statfs-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 ;
diff --git a/basis/unix/statfs/linux/32/authors.txt b/basis/unix/statfs/linux/32/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/linux/32/tags.txt b/basis/unix/statfs/linux/32/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/basis/unix/statfs/linux/64/64.factor b/basis/unix/statfs/linux/64/64.factor
deleted file mode 100644 (file)
index e9cd557..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.c-types combinators kernel unix.stat
-math accessors system unix io.backend layouts vocabs.loader
-alien.syntax unix.statfs io.files ;
-IN: unix.statfs.linux
-
-C-STRUCT: statfs64
-    { "__SWORD_TYPE" "f_type" }
-    { "__SWORD_TYPE" "f_bsize" }
-    { "__fsblkcnt64_t" "f_blocks" }
-    { "__fsblkcnt64_t" "f_bfree" }
-    { "__fsblkcnt64_t" "f_bavail" }
-    { "__fsfilcnt64_t" "f_files" }
-    { "__fsfilcnt64_t" "f_ffree" }
-    { "__fsid_t" "f_fsid" }
-    { "__SWORD_TYPE" "f_namelen" }
-    { "__SWORD_TYPE" "f_frsize" }
-    { { "__SWORD_TYPE" 5 } "f_spare" } ;
-
-FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
-
-TUPLE: linux64-file-system-info < file-system-info
-bsize blocks bfree bavail files ffree fsid namelen
-frsize spare ;
-
-M: linux >file-system-info ( struct -- statfs )
-    [ \ linux64-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 ;
diff --git a/basis/unix/statfs/linux/64/authors.txt b/basis/unix/statfs/linux/64/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/linux/64/tags.txt b/basis/unix/statfs/linux/64/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
index 43d5a99cd157d6ff5bd3c4edc8f852b110860e95..eb587e32864a1105a183bf5f59029fdbbb8cf5db 100644 (file)
@@ -6,38 +6,17 @@ sequences csv io.streams.string io.encodings.utf8 namespaces
 unix.statfs io.files ;
 IN: unix.statfs.linux
 
-cell-bits {
-    { 32 [ "unix.statfs.linux.32" require ] }
-    { 64 [ "unix.statfs.linux.64" require ] }
-} case
+C-STRUCT: statfs64
+    { "__SWORD_TYPE" "f_type" }
+    { "__SWORD_TYPE" "f_bsize" }
+    { "__fsblkcnt64_t" "f_blocks" }
+    { "__fsblkcnt64_t" "f_bfree" }
+    { "__fsblkcnt64_t" "f_bavail" }
+    { "__fsfilcnt64_t" "f_files" }
+    { "__fsfilcnt64_t" "f_ffree" }
+    { "__fsid_t" "f_fsid" }
+    { "__SWORD_TYPE" "f_namelen" }
+    { "__SWORD_TYPE" "f_frsize" }
+    { { "__SWORD_TYPE" 5 } "f_spare" } ;
 
-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 file-systems
-    parse-mtab [
-        [ mount-point>> file-system-info ] keep
-        {
-            [ file-system-name>> >>device-name ]
-            [ mount-point>> >>mount-point ]
-            [ type>> >>type ]
-        } cleave
-    ] map ;
+FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
index 7c30c4b9d417994812a8741536dad4e9312bf80d..fcdbb1ee87154f27ab5e9bea14509dee34fd249d 100644 (file)
@@ -3,7 +3,7 @@
 USING: alien.c-types io.encodings.utf8 io.encodings.string
 kernel sequences unix.stat accessors unix combinators math
 grouping system unix.statfs io.files io.backend alien.strings
-math.bitwise alien.syntax ;
+math.bitwise alien.syntax io.unix.files ;
 IN: unix.statfs.macosx
 
 : MNT_RDONLY  HEX: 00000001 ; inline
@@ -116,50 +116,3 @@ C-STRUCT: statfs64
 
 FUNCTION: int statfs64 ( char* path, statfs64* buf ) ;
 FUNCTION: int getmntinfo64 ( statfs64** mntbufp, int flags ) ;
-
-
-TUPLE: macosx-file-system-info < file-system-info
-block-size io-size blocks blocks-free blocks-available files
-files-free file-system-id owner type-id flags filesystem-subtype ;
-
-M: macosx file-systems ( -- array )
-    f <void*> dup 0 getmntinfo64 dup io-error
-    [ *void* ] dip
-    "statfs64" heap-size [ * memory>byte-array ] keep group
-    [ >file-system-info ] map ;
-
-M: macosx >file-system-info ( byte-array -- file-system-info )
-    [ \ macosx-file-system-info new ] dip
-    {
-        [
-            [ statfs64-f_bavail ] [ statfs64-f_bsize ] bi *
-            >>free-space
-        ]
-        [ statfs64-f_mntonname utf8 alien>string >>mount-point ]
-        [ statfs64-f_bsize >>block-size ]
-
-        [ statfs64-f_iosize >>io-size ]
-        [ statfs64-f_blocks >>blocks ]
-        [ statfs64-f_bfree >>blocks-free ]
-        [ statfs64-f_bavail >>blocks-available ]
-        [ statfs64-f_files >>files ]
-        [ statfs64-f_ffree >>files-free ]
-        [ statfs64-f_fsid >>file-system-id ]
-        [ statfs64-f_owner >>owner ]
-        [ statfs64-f_type >>type-id ]
-        [ statfs64-f_flags >>flags ]
-        [ statfs64-f_fssubtype >>filesystem-subtype ]
-        [
-            statfs64-f_fstypename utf8 alien>string
-            >>type
-        ]
-        [
-            statfs64-f_mntfromname
-            utf8 alien>string >>device-name
-        ]
-    } cleave ;
-
-M: macosx file-system-info ( path -- file-system-info )
-    normalize-path
-    "statfs64" <c-object> tuck statfs64 io-error
-    >file-system-info ;
index ad7c161713dae151ac5e309be9e3079335e21cb9..30f258ca8d33323abc2d51dd9e5ba11534e8891a 100644 (file)
@@ -5,74 +5,4 @@ combinators system io.backend accessors alien.c-types
 io.encodings.utf8 alien.strings unix.types unix.statfs io.files ;
 IN: unix.statfs.netbsd
 
-: _VFS_NAMELEN    32   ; inline
-: _VFS_MNAMELEN   1024 ; inline
 
-C-STRUCT: statvfs
-    { "ulong"   "f_flag" }   
-    { "ulong"   "f_bsize" }
-    { "ulong"   "f_frsize" }  
-    { "ulong"   "f_iosize" }  
-    { "fsblkcnt_t" "f_blocks" }       
-    { "fsblkcnt_t" "f_bfree" } 
-    { "fsblkcnt_t" "f_bavail" }       
-    { "fsblkcnt_t" "f_bresvd" }       
-    { "fsfilcnt_t" "f_files" }
-    { "fsfilcnt_t" "f_ffree" }
-    { "fsfilcnt_t" "f_favail" }       
-    { "fsfilcnt_t" "f_fresvd" }       
-    { "uint64_t"   "f_syncreads" }    
-    { "uint64_t"   "f_syncwrites" }   
-    { "uint64_t"   "f_asyncreads" }   
-    { "uint64_t"   "f_asyncwrites" }  
-    { "fsid_t"    "f_fsidx" }
-    { "ulong"   "f_fsid" }
-    { "ulong"   "f_namemax" }      
-    { "uid_t"   "f_owner" }
-    { { "uint32_t" 4 } "f_spare" }     
-    { { "char" _VFS_NAMELEN } "f_fstypename" }
-    { { "char" _VFS_MNAMELEN } "f_mntonname" }
-    { { "char" _VFS_MNAMELEN } "f_mntfromname" } ;
-
-FUNCTION: int statvfs ( char* path, statvfs *buf ) ;
-
-TUPLE: netbsd-file-system-info < file-system-info
-flag bsize frsize io-size
-blocks blocks-free blocks-available blocks-reserved
-files ffree sync-reads sync-writes async-reads async-writes
-fsidx fsid namemax owner spare fstype mnotonname mntfromname
-file-system-type-name mount-from ;
-
-M: netbsd >file-system-info ( byte-array -- netbsd-file-system-info )
-    [ \ netbsd-file-system-info new ] dip
-    {
-        [
-            [ statvfs-f_bsize ]
-            [ statvfs-f_bavail ] bi * >>free-space
-        ]
-        [ statvfs-f_flag >>flag ]
-        [ statvfs-f_bsize >>bsize ]
-        [ statvfs-f_frsize >>frsize ]
-        [ statvfs-f_iosize >>io-size ]
-        [ statvfs-f_blocks >>blocks ]
-        [ statvfs-f_bfree >>blocks-free ]
-        [ statvfs-f_favail >>blocks-available ]
-        [ statvfs-f_fresvd >>blocks-reserved ]
-        [ statvfs-f_files >>files ]
-        [ statvfs-f_ffree >>ffree ]
-        [ statvfs-f_syncreads >>sync-reads ]
-        [ statvfs-f_syncwrites >>sync-writes ]
-        [ statvfs-f_asyncreads >>async-reads ]
-        [ statvfs-f_asyncwrites >>async-writes ]
-        [ statvfs-f_fsidx >>fsidx ]
-        [ statvfs-f_namemax >>namemax ]
-        [ statvfs-f_owner >>owner ]
-        [ statvfs-f_spare >>spare ]
-        [ statvfs-f_fstypename utf8 alien>string >>file-system-type-name ]
-        [ statvfs-f_mntonname utf8 alien>string >>mount-point ]
-        [ statvfs-f_mntfromname utf8 alien>string >>mount-from ]
-    } cleave ;
-
-M: netbsd file-system-info
-    normalize-path "statvfs" <c-object> tuck statvfs io-error 
-    >file-system-info ;
diff --git a/basis/unix/statfs/openbsd/32/32.factor b/basis/unix/statfs/openbsd/32/32.factor
deleted file mode 100644 (file)
index aa1e842..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax kernel unix ; 
-IN: unix.statfs.openbsd.32
-
-: MFSNAMELEN 16 ; inline
-: MNAMELEN 90 ; inline
-
-C-STRUCT: statfs
-    { "u_int32_t"  "f_flags" }
-    { "int32_t"    "f_bsize" }
-    { "u_int32_t"  "f_iosize" }
-    { "u_int32_t"  "f_blocks" }
-    { "u_int32_t"  "f_bfree" }
-    { "int32_t"    "f_bavail" }
-    { "u_int32_t"  "f_files" }
-    { "u_int32_t"  "f_ffree" }
-    { "fsid_t"     "f_fsid" }
-    { "uid_t"      "f_owner" }
-    { "u_int32_t"  "f_syncwrites" }
-    { "u_int32_t"  "f_asyncwrites" }
-    { "u_int32_t"  "f_ctime" }
-    { { "u_int32_t" 3 }  "f_spare" }
-    { { "char" MFSNAMELEN } "f_fstypename" }
-    { { "char" MNAMELEN }   "f_mntonname" }  
-    { { "char" MNAMELEN }   "f_mntfromname" } ;
diff --git a/basis/unix/statfs/openbsd/32/authors.txt b/basis/unix/statfs/openbsd/32/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/openbsd/32/tags.txt b/basis/unix/statfs/openbsd/32/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/basis/unix/statfs/openbsd/64/64.factor b/basis/unix/statfs/openbsd/64/64.factor
deleted file mode 100644 (file)
index fd40fba..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix ;
-IN: unix.statfs.openbsd.64
-
-: MFSNAMELEN 16 ; inline
-: MNAMELEN 90 ; inline
-
-C-STRUCT: statfss
-    { "u_int32_t"      "f_flags" }
-    { "u_int32_t"      "f_bsize" }
-    { "u_int32_t"      "f_iosize" }
-    { "u_int64_t"      "f_blocks" }
-    { "u_int64_t"      "f_bfree" }
-    { "int64_t"        "f_bavail" }
-    { "u_int64_t"      "f_files" }
-    { "u_int64_t"      "f_ffree" }
-    { "int64_t"        "f_favail" }
-    { "u_int64_t"      "f_syncwrites" }
-    { "u_int64_t"      "f_syncreads" }
-    { "u_int64_t"      "f_asyncwrites" }
-    { "u_int64_t"      "f_asyncreads" }
-    { "fsid_t"         "f_fsid" }
-    { "u_int32_t"      "f_namemax" }
-    { "uid_t"          "f_owner" }
-    { "u_int32_t"      "f_ctime" }
-    { { "u_int32_t" 3 } " f_spare" }
-    { { "char" MFSNAMELEN } "f_fstypename" }
-    { { "char" MNAMELEN } "f_mntonname" }
-    { { "char" MNAMELEN } "f_mntfromname" }
-    { { "char" 512 } "mount_info" } ;
-    ! { "mount_info" "mount_info" } ;                                        
diff --git a/basis/unix/statfs/openbsd/64/authors.txt b/basis/unix/statfs/openbsd/64/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/openbsd/64/tags.txt b/basis/unix/statfs/openbsd/64/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/basis/unix/statfs/openbsd/authors.txt b/basis/unix/statfs/openbsd/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/statfs/openbsd/openbsd.factor b/basis/unix/statfs/openbsd/openbsd.factor
deleted file mode 100644 (file)
index fa86ef2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax accessors combinators kernel
-unix.types math system io.backend alien.c-types unix
-unix.statfs io.files ;
-IN: unix.statfs.openbsd
-
-C-STRUCT: statvfs
-    { "ulong" "f_bsize" }
-    { "ulong" "f_frsize" }
-    { "fsblkcnt_t" "f_blocks" }
-    { "fsblkcnt_t" "f_bfree" }
-    { "fsblkcnt_t" "f_bavail" }
-    { "fsfilcnt_t" "f_files" }
-    { "fsfilcnt_t" "f_ffree" }
-    { "fsfilcnt_t" "f_favail" }
-    { "ulong" "f_fsid" }
-    { "ulong" "f_flag" }
-    { "ulong" "f_namemax" } ;
-
-: ST_RDONLY       1 ; inline
-: ST_NOSUID       2 ; inline
-
-FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
-
-TUPLE: openbsd-file-system-info < file-system-info
-bsize frsize blocks bfree bavail files ffree favail
-fsid flag namemax ;
-
-M: openbsd >file-system-info ( struct -- statfs )
-    [ \ openbsd-file-system-info new ] dip
-    {
-        [
-            [ statvfs-f_bsize ]
-            [ statvfs-f_bavail ] bi * >>free-space
-        ]
-        [ statvfs-f_bsize >>bsize ]
-        [ statvfs-f_frsize >>frsize ]
-        [ statvfs-f_blocks >>blocks ]
-        [ statvfs-f_bfree >>bfree ]
-        [ statvfs-f_bavail >>bavail ]
-        [ statvfs-f_files >>files ]
-        [ statvfs-f_ffree >>ffree ]
-        [ statvfs-f_favail >>favail ]
-        [ statvfs-f_fsid >>fsid ]
-        [ statvfs-f_flag >>flag ]
-        [ statvfs-f_namemax >>namemax ]
-    } cleave ;
-
-M: openbsd file-system-info ( path -- byte-array )
-    normalize-path
-    "statvfs" <c-object> tuck statvfs io-error
-    >file-system-info ;
diff --git a/basis/unix/statfs/openbsd/tags.txt b/basis/unix/statfs/openbsd/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
index 0397507fcebc28a960675e04db2b3640ceab3439..bc7b1997058e775d749e97ebf6f2c9ef834d1117 100644 (file)
@@ -4,8 +4,6 @@ USING: sequences system vocabs.loader combinators accessors
 kernel math.order sorting ;
 IN: unix.statfs
 
-HOOK: >file-system-info os ( struct -- statfs )
-
 os {
     { linux   [ "unix.statfs.linux"   require ] }
     { macosx  [ "unix.statfs.macosx"  require ] }
diff --git a/basis/unix/statvfs/authors.txt b/basis/unix/statvfs/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/freebsd/authors.txt b/basis/unix/statvfs/freebsd/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/freebsd/freebsd.factor b/basis/unix/statvfs/freebsd/freebsd.factor
new file mode 100644 (file)
index 0000000..7d1a6af
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.statvfs.freebsd
+
+C-STRUCT: statvfs
+    { "fsblkcnt_t"  "f_bavail" }
+    { "fsblkcnt_t"  "f_bfree" }
+    { "fsblkcnt_t"  "f_blocks" }
+    { "fsfilcnt_t"  "f_favail" }
+    { "fsfilcnt_t"  "f_ffree" }
+    { "fsfilcnt_t"  "f_files" }
+    { "ulong"   "f_bsize" }
+    { "ulong"   "f_flag" }
+    { "ulong"   "f_frsize" }
+    { "ulong"   "f_fsid" }
+    { "ulong"   "f_namemax" } ;
+
+! Flags
+: ST_RDONLY   HEX: 1 ; inline ! Read-only file system
+: ST_NOSUID   HEX: 2 ; inline ! Does not honor setuid/setgid
+
+FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
diff --git a/basis/unix/statvfs/linux/authors.txt b/basis/unix/statvfs/linux/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/linux/linux.factor b/basis/unix/statvfs/linux/linux.factor
new file mode 100644 (file)
index 0000000..008692a
--- /dev/null
@@ -0,0 +1,31 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.statvfs.linux
+
+C-STRUCT: statvfs64
+    { "ulong" "f_bsize" }
+    { "ulong" "f_frsize" }
+    { "__fsblkcnt64_t" "f_blocks" }
+    { "__fsblkcnt64_t" "f_bfree" }
+    { "__fsblkcnt64_t" "f_bavail" }
+    { "__fsfilcnt64_t" "f_files" }
+    { "__fsfilcnt64_t" "f_ffree" }
+    { "__fsfilcnt64_t" "f_favail" }
+    { "ulong" "f_fsid" }
+    { "ulong" "f_flag" }
+    { "ulong" f_namemax" }
+    { { "int" 6 } "__f_spare" } ;
+
+FUNCTION: int statvfs64 ( char* path, statvfs64* buf ) ;
+
+: ST_RDONLY 1 ; inline        ! Mount read-only.
+: ST_NOSUID 2 ; inline        ! Ignore suid and sgid bits.
+: ST_NODEV 4 ; inline         ! Disallow access to device special files.
+: ST_NOEXEC 8 ; inline        ! Disallow program execution.
+: ST_SYNCHRONOUS 16 ; inline  ! Writes are synced at once.
+: ST_MANDLOCK 64 ; inline     ! Allow mandatory locks on an FS.
+: ST_WRITE 128 ; inline       ! Write on file/directory/symlink.
+: ST_APPEND 256 ; inline      ! Append-only file.
+: ST_IMMUTABLE 512 ; inline   ! Immutable file.
+: ST_NOATIME 1024 ; inline    ! Do not update access times.
diff --git a/basis/unix/statvfs/linux/tags.txt b/basis/unix/statvfs/linux/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/unix/statvfs/macosx/authors.txt b/basis/unix/statvfs/macosx/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/macosx/macosx.factor b/basis/unix/statvfs/macosx/macosx.factor
new file mode 100644 (file)
index 0000000..7078ff9
--- /dev/null
@@ -0,0 +1,23 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.statvfs.macosx
+
+C-STRUCT: statvfs
+    { "ulong"   "f_bsize" }
+    { "ulong"   "f_frsize" }
+    { "fsblkcnt_t"  "f_blocks" }
+    { "fsblkcnt_t"  "f_bfree" }
+    { "fsblkcnt_t"  "f_bavail" }
+    { "fsfilcnt_t"  "f_files" }
+    { "fsfilcnt_t"  "f_ffree" }
+    { "fsfilcnt_t"  "f_favail" }
+    { "ulong"   "f_fsid" }
+    { "ulong"   "f_flag" }
+    { "ulong"   "f_namemax" } ;
+
+! Flags
+: ST_RDONLY   HEX: 1 ; inline ! Read-only file system
+: ST_NOSUID   HEX: 2 ; inline ! Does not honor setuid/setgid
+
+FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
diff --git a/basis/unix/statvfs/macosx/tags.txt b/basis/unix/statvfs/macosx/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/unix/statvfs/netbsd/authors.txt b/basis/unix/statvfs/netbsd/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/netbsd/netbsd.factor b/basis/unix/statvfs/netbsd/netbsd.factor
new file mode 100644 (file)
index 0000000..e67a74d
--- /dev/null
@@ -0,0 +1,35 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.statvfs.netbsd
+
+: _VFS_NAMELEN    32   ; inline
+: _VFS_MNAMELEN   1024 ; inline
+
+C-STRUCT: statvfs
+    { "ulong"   "f_flag" }   
+    { "ulong"   "f_bsize" }
+    { "ulong"   "f_frsize" }  
+    { "ulong"   "f_iosize" }  
+    { "fsblkcnt_t" "f_blocks" }       
+    { "fsblkcnt_t" "f_bfree" } 
+    { "fsblkcnt_t" "f_bavail" }       
+    { "fsblkcnt_t" "f_bresvd" }       
+    { "fsfilcnt_t" "f_files" }
+    { "fsfilcnt_t" "f_ffree" }
+    { "fsfilcnt_t" "f_favail" }       
+    { "fsfilcnt_t" "f_fresvd" }       
+    { "uint64_t"   "f_syncreads" }    
+    { "uint64_t"   "f_syncwrites" }   
+    { "uint64_t"   "f_asyncreads" }   
+    { "uint64_t"   "f_asyncwrites" }  
+    { "fsid_t"    "f_fsidx" }
+    { "ulong"   "f_fsid" }
+    { "ulong"   "f_namemax" }      
+    { "uid_t"   "f_owner" }
+    { { "uint32_t" 4 } "f_spare" }     
+    { { "char" _VFS_NAMELEN } "f_fstypename" }
+    { { "char" _VFS_MNAMELEN } "f_mntonname" }
+    { { "char" _VFS_MNAMELEN } "f_mntfromname" } ;
+
+FUNCTION: int statvfs ( char* path, statvfs *buf ) ;
diff --git a/basis/unix/statvfs/netbsd/tags.txt b/basis/unix/statvfs/netbsd/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/unix/statvfs/openbsd/authors.txt b/basis/unix/statvfs/openbsd/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/basis/unix/statvfs/openbsd/openbsd.factor b/basis/unix/statvfs/openbsd/openbsd.factor
new file mode 100644 (file)
index 0000000..3f9353f
--- /dev/null
@@ -0,0 +1,22 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien.syntax ;
+IN: unix.statvfs.openbsd
+
+C-STRUCT: statvfs
+    { "ulong" "f_bsize" }
+    { "ulong" "f_frsize" }
+    { "fsblkcnt_t" "f_blocks" }
+    { "fsblkcnt_t" "f_bfree" }
+    { "fsblkcnt_t" "f_bavail" }
+    { "fsfilcnt_t" "f_files" }
+    { "fsfilcnt_t" "f_ffree" }
+    { "fsfilcnt_t" "f_favail" }
+    { "ulong" "f_fsid" }
+    { "ulong" "f_flag" }
+    { "ulong" "f_namemax" } ;
+
+: ST_RDONLY       1 ; inline
+: ST_NOSUID       2 ; inline
+
+FUNCTION: int statvfs ( char* path, statvfs* buf ) ;
diff --git a/basis/unix/statvfs/openbsd/tags.txt b/basis/unix/statvfs/openbsd/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/basis/unix/statvfs/statvfs.factor b/basis/unix/statvfs/statvfs.factor
new file mode 100644 (file)
index 0000000..e610140
--- /dev/null
@@ -0,0 +1,12 @@
+! Copyright (C) 2008 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators system vocabs.loader ;
+IN: unix.statvfs
+
+os {
+    { linux   [ "unix.statvfs.linux"   require ] }
+    { macosx  [ "unix.statvfs.macosx"  require ] }
+    { freebsd [ "unix.statvfs.freebsd" require ] }
+    { netbsd  [ "unix.statvfs.netbsd"  require ] }
+    { openbsd [ "unix.statvfs.openbsd" require ] }
+} case
diff --git a/basis/unix/statvfs/tags.txt b/basis/unix/statvfs/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable