Note: This is taken from the Chicken Wiki, where a more recent version could be available.

filesystem

Description

filesystem uses

Requirements

Requires the statvfs egg.

Author

Ozzi Lee

Download

filesystem.egg

Documentation

<procedure>(filesystem
block-size PATH)</procedure> : Returns the size of a block on the filesystem at PATH.
<procedure>(filesystem
blocks-total PATH)</procedure> : Returns the total number of blocks on the filesystem at PATH.
<procedure>(filesystem
blocks-free PATH)</procedure> : Returns the number of free blocks on the filesystem at PATH.
<procedure>(filesystem
blocks-available PATH)</procedure> : Returns the number of blocks available to non-root users on the filesystem at PATH.
<procedure>(filesystem
blocks→bytes BLOCKSIZE BLOCKS UNITS)</procedure> : Converts blocks to bytes, given the size of a block, the number of blocks, and a number representing the unit size, i.e. 1000 for kilobytes, 1024 for kibibytes.
<procedure>(filesystem
blocks→kilobytes BLOCKSIZE BLOCKS EXPONENT)</procedure> : Converts blocks to (kilo/mega/giga)bytes given the size of a block, the number of blocks, and an exponent representing the exponent on the unit size, i.e 1 for kilobytes, 2 for megabytes, 3 for gigabtyes, etc.
<procedure>(filesystem
blocks→kibibytes BLOCKSIZE BLOCKS EXPONENT)</procedure> : Converts blocks to (kibi/mebi/gibi)bytes, given the size of a block, the number of blocks, and an exponent representing the exponent on the unit size, i.e. 1 for kibibytes, 2 for mebibytes, 3 for gibigytes, etc.

Example

The following would return the (rounded) number for gigabytes available on "/".

 (filesystem:blocks->kilobytes (filesystem:block-size "/") (filesystem:blocks-available "/") 3)

Changelog

License

 ;; Copyright (c) 2008 Ozzi Lee
 
 ;; Permission is hereby granted, free of charge, to any person
 ;; obtaining a copy of this software and associated documentation
 ;; files (the "Software"), to deal in the Software without
 ;; restriction, including without limitation the rights to use,
 ;; copy, modify, merge, publish, distribute, sublicense, and/or sell
 ;; copies of the Software, and to permit persons to whom the
 ;; Software is furnished to do so, subject to the following
 ;; conditions:
 
 ;; The above copyright notice and this permission notice shall be
 ;; included in all copies or substantial portions of the Software.
 
 ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 ;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 ;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 ;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 ;; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 ;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 ;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 ;; OTHER DEALINGS IN THE SOFTWARE.