diff --git a/basis/io/unix/files/openbsd/openbsd.factor b/basis/io/unix/files/openbsd/openbsd.factor index 68f2e62f40..463cbde675 100644 --- a/basis/io/unix/files/openbsd/openbsd.factor +++ b/basis/io/unix/files/openbsd/openbsd.factor @@ -5,20 +5,37 @@ unix.types math system io.backend alien.c-types unix io.files io.unix.files unix.statvfs.openbsd ; IN: io.unix.files.openbsd +M: openbsd file-system-statfs + "statfs" tuck statfs io-error ; + +M: openbsd statfs>file-system-info ( file-system-info statfs -- file-system-info' ) + { + [ statfs-f_flag >>flags ] + [ statfs-f_bsize >>block-size ] + [ statfs-f_iosize >>io-size ] + [ statfs-f_blocks >>blocks ] + [ statfs-f_bfree >>blocks-free ] + [ statfs-f_bavail >>blocks-available ] + [ statfs-f_files >>files ] + [ statfs-f_ffree >>files-free ] + [ statfs-f_favail >>files-available ] + [ statfs-f_syncwrites >>sync-writes ] + [ statfs-f_syncreads >>sync-reads ] + [ statfs-f_asyncwrites >>async-writes ] + [ statfs-f_asyncreads >>async-reads ] + [ statfs-f_fsid >>id ] + [ statfs-f_namemax >>name-max ] + [ statfs-f_owner >>owner ] + [ statfs-f_spare >>spare ] + [ statfs-f_fstypename alien>native-string >>type ] + [ statfs-f_mntonname alien>native-string >>mount-point ] + [ statfs-f_mntfromname alien>native-string >>device-name ] + } cleave ; + M: openbsd file-system-statvfs ( normalized-path -- statvfs ) "statvfs" tuck statvfs io-error ; M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-info' ) { - [ statvfs-f_bsize >>block-size ] [ statvfs-f_frsize >>preferred-block-size ] - [ statvfs-f_blocks >>blocks ] - [ statvfs-f_bfree >>blocks-free ] - [ statvfs-f_bavail >>blocks-available ] - [ statvfs-f_files >>files ] - [ statvfs-f_ffree >>files-free ] - [ statvfs-f_favail >>files-available ] - [ statvfs-f_fsid >>id ] - [ statvfs-f_flag >>flags ] - [ statvfs-f_namemax >>name-max ] } cleave ; diff --git a/basis/unix/statfs/freebsd/freebsd.factor b/basis/unix/statfs/freebsd/freebsd.factor index 5496bbe1ba..f6fcff5c7c 100644 --- a/basis/unix/statfs/freebsd/freebsd.factor +++ b/basis/unix/statfs/freebsd/freebsd.factor @@ -1,24 +1,4 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax kernel unix math accessors -combinators system io.backend alien.c-types unix.statfs -io.files ; +USING: alien.syntax ; IN: unix.statfs.freebsd - -: ST_RDONLY 1 ; inline -: ST_NOSUID 2 ; inline - -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" } ; - -FUNCTION: int statvfs ( char* path, statvfs* buf ) ; diff --git a/basis/unix/statfs/openbsd/openbsd.factor b/basis/unix/statfs/openbsd/openbsd.factor new file mode 100644 index 0000000000..98bf140af7 --- /dev/null +++ b/basis/unix/statfs/openbsd/openbsd.factor @@ -0,0 +1,33 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: alien.syntax ; +IN: unix.statfs.openbsd + +: MFSNAMELEN 16 ; inline +: MNAMELEN 90 ; inline + +C-STRUCT: statfs + { "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" } ; + ! { "mount_info" "mount_info" } ; + +FUNCTION: int statfs ( char* path, statvfs* buf ) ; diff --git a/basis/unix/statfs/openbsd/tags.txt b/basis/unix/statfs/openbsd/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/unix/statfs/openbsd/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/unix/statfs/statfs.factor b/basis/unix/statfs/statfs.factor index 9a636b795f..7d1bebc72d 100644 --- a/basis/unix/statfs/statfs.factor +++ b/basis/unix/statfs/statfs.factor @@ -8,6 +8,6 @@ os { { linux [ "unix.statfs.linux" require ] } { macosx [ "unix.statfs.macosx" require ] } { freebsd [ "unix.statfs.freebsd" require ] } + { openbsd [ "unix.statfs.openbsd" require ] } { netbsd [ ] } - { openbsd [ ] } } case