You are looking at historical revision 21865 of this page. It may differ significantly from its current revision.

## filesystem

### Description

filesystem uses

### Requirements

Requires the statvfs egg.

### Author

### Download

### Documentation

*[procedure]*

`(filesystem:block-size PATH)`

Returns the size of a block on the filesystem at PATH.

*[procedure]*

`(filesystem:blocks-total PATH)`

Returns the total number of blocks on the filesystem at PATH.

*[procedure]*

`(filesystem:blocks-free PATH)`

Returns the number of free blocks on the filesystem at PATH.

*[procedure]*

`(filesystem:blocks-available PATH)`

Returns the number of blocks available to non-root users on the filesystem at PATH.

*[procedure]*

`(filesystem:blocks->bytes BLOCKSIZE BLOCKS UNITS)`

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)`

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)`

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

- 1.0.1 - Dealing with bugfix in statvfs
- 1.0

### 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.