Skip to content

dvdplm/ruby-filesystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-filesystem

  • FIX (url)

DESCRIPTION:

DESCRIPTION

This is a Ruby extension for file-system information,
using the 'statvfs' and 'getmntent' system calls.
Tested on Linux and Solaris
Version 0.5

FEATURES/PROBLEMS:

  • FIX (list of features or problems)

SYNOPSIS:

module FileSystem

FileSystem.stat( path )

Struct FileSystemStat
s.path		directory path provided
s.block_size	optimal transfer block size
s.blocks	total number of data blocks in file system
s.blocks_free	number of free blocks in file system
s.blocks_avail	number of free blocks available to non-super-user
s.files		total number of file nodes in file system
s.files_free	number of free file nodes in file system
s.files_avail	number of free file nodes available to non-super-user
s.flags		file system flags
s.maxnamelen	maximum file name length

FileSystem.mounts( optional file name )
FileSystem.mounts( optional file name ) { |mt| optional block }

The default mount-table filename is "/etc/mtab" on Linux,
and "/etc/mnttab" on Solaris.  On Linux, this can be used
to scan "/etc/fstab" also.

Struct FileSystemMount
m.device	file system (i.e. partition device) name
m.mount		mount point directory
m.fstype	file system type
m.options	mount options
m.time		time the filesystem was mounted (Solaris)
m.dump_interval dump frequency in days (Linux/BSD)
m.check_pass	pass number of file system check (Linux/BSD)

Constants for FileSystem.stat 'flags'

Solaris:	RDONLY NOSUID NOTRUNC
Linux:		RDONLY NOSUID 
GNU:		RDONLY NOSUID NODEV NOEXE SYNC MANDLOCK
WRITE APPEND IMMUTABLE NOATIME NODIRATIME

REQUIREMENTS:

  • FIX (list of requirements)

INSTALL:

ruby extconf.rb
make
ruby Test.rb	(optional directories)
make install

TODO

Move this "documentation" into the source.
Convert st.flags from a number to an array of strings.
Solicit patches for other UNIXen.

ACKNOWLEDGEMENTS

Daniel Berger for testing on Solaris, and motivation.
comp.lang.ruby for suggesting better names.
Dmitry Borodaenko for finding a bug (by testing on IA64 Debian)

AUTHOR

Mike Hall
mghall@enteract.com
www.enteract.com/~mghall
2003-09-04

LICENSE:

(The MIT License)

Copyright © 2009 FIXME full name

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.

About

A wrapper around the statvfs syscall. An attempt to resuscitate an old extension by Mike Hall (mghall at enteract dot com)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published