Rudiments
Public Member Functions | Static Public Member Functions
filesystem Class Reference

List of all members.

Public Member Functions

 filesystem ()
 filesystem (const filesystem &f)
filesystemoperator= (const filesystem &f)
virtual ~filesystem ()
bool initialize (const char *path)
bool initialize (int32_t fd)
int64_t getType () const
int64_t getBlockSize () const
int64_t getOptimumTransferBlockSize () const
int64_t getTotalBlocks () const
int64_t getFreeBlocks () const
int64_t getAvailableBlocks () const
int64_t getTotalFileNodes () const
int64_t getFreeFileNodes () const
int64_t getAvailableFileNodes () const
int64_t getFileSystemId () const
int64_t getMaximumFileNameLength () const
uid_t getOwner () const
int64_t getSyncWrites () const
int64_t getAsyncWrites () const
const char * getTypeName () const
const char * getMountPoint () const
int64_t getSyncReads () const
int64_t getAsyncReads () const
const char * getDeviceName () const
const char * getFilesystemSpecificString () const
bool getCurrentProperties ()
void * getInternalFilesystemStatisticsStructure ()

Static Public Member Functions

static bool getType (const char *path, int64_t *type)
static bool getType (int32_t fd, int64_t *type)
static bool getBlockSize (const char *path, int64_t *size)
static bool getBlockSize (int32_t fd, int64_t *size)
static bool getOptimumTransferBlockSize (const char *path, int64_t *size)
static bool getOptimumTransferBlockSize (int32_t fd, int64_t *size)
static bool getTotalBlocks (const char *path, int64_t *blocks)
static bool getTotalBlocks (int32_t fd, int64_t *blocks)
static bool getFreeBlocks (const char *path, int64_t *blocks)
static bool getFreeBlocks (int32_t fd, int64_t *blocks)
static bool getAvailableBlocks (const char *path, int64_t *blocks)
static bool getAvailableBlocks (int32_t fd, int64_t *blocks)
static bool getTotalFileNodes (const char *path, int64_t *nodes)
static bool getTotalFileNodes (int32_t fd, int64_t *nodes)
static bool getFreeFileNodes (const char *path, int64_t *nodes)
static bool getFreeFileNodes (int32_t fd, int64_t *nodes)
static bool getAvailableFileNodes (const char *path, int64_t *nodes)
static bool getAvailableFileNodes (int32_t fd, int64_t *nodes)
static bool getFileSystemId (const char *path, int64_t *id)
static bool getFileSystemId (int32_t fd, int64_t *id)
static bool getMaximumFileNameLength (const char *path, int64_t *length)
static bool getMaximumFileNameLength (int32_t fd, int64_t *length)
static bool getOwner (const char *path, uid_t *owner)
static bool getOwner (int32_t fd, uid_t *owner)
static bool getSyncWrites (const char *path, int64_t *swrites)
static bool getSyncWrites (int32_t fd, int64_t *swrites)
static bool getAsyncWrites (const char *path, int64_t *aswrites)
static bool getAsyncWrites (int32_t fd, int64_t *aswrites)
static bool getTypeName (const char *path, const char **name)
static bool getTypeName (int32_t fd, const char **name)
static bool getMountPoint (const char *path, const char **mtpt)
static bool getMountPoint (int32_t fd, const char **mtpt)
static bool getSyncReads (const char *path, int64_t *sreads)
static bool getSyncReads (int32_t fd, int64_t *sreads)
static bool getAsyncReads (const char *path, int64_t *asreads)
static bool getAsyncReads (int32_t fd, int64_t *asreads)
static bool getDeviceName (const char *path, const char **devname)
static bool getDeviceName (int32_t fd, const char **devname)
static bool getFilesystemSpecificString (const char *path, const char **str)
static bool getFilesystemSpecificString (int32_t fd, const char **str)

Detailed Description

The filesystem class provides methods for discovering the properties associated with a filesystem such as type, total and free blocks, total and free inodes, etc.

The native methods for accessing filesystem data vary greatly between platforms and many of these methods only work at all on certain platforms. For those methods, the platforms that they are known to work on are listed.

Use the static methods in this class if you need to get a a single property.

If you need to get more that one property, create an instance of the class, call initialize(), then use the non-static methods to access the properties that you need.


Constructor & Destructor Documentation

filesystem::filesystem ( )

Creates an instance of the filesystem class.

filesystem::filesystem ( const filesystem f)

Creates an instance of the filesystem class that is a copy of "f".

virtual filesystem::~filesystem ( ) [virtual]

Deletes this instance of the filesystem class.


Member Function Documentation

int64_t filesystem::getAsyncReads ( ) const

Returns the number of asynchronous reads that have occurred since the filesytem was mounted. (works on FreeBSD)

static bool filesystem::getAsyncReads ( const char *  path,
int64_t *  asreads 
) [static]

Sets "asreads" to the number of asynchronous reads that have occurred since the filesytem containing "path" was mounted. (works on FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getAsyncReads ( int32_t  fd,
int64_t *  asreads 
) [static]

Sets "asreads" to the number of asynchronous reads that have occurred since the filesytem containing the file represented by the file descriptor "fd" was mounted. (works on FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getAsyncWrites ( const char *  path,
int64_t *  aswrites 
) [static]

Sets "aswrites" to the number of asynchronous writes that have occurred since the filesytem containing "path" was mounted. (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getAsyncWrites ( int32_t  fd,
int64_t *  aswrites 
) [static]

Sets "aswrites" to the number of asynchronous writes that have occurred since the filesytem containing the file represented by the file descriptor "fd" was mounted. (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

int64_t filesystem::getAsyncWrites ( ) const

Returns the number of asynchronous writes that have occurred since the filesytem was mounted. (works on Net/Open/FreeBSD)

static bool filesystem::getAvailableBlocks ( int32_t  fd,
int64_t *  blocks 
) [static]

Sets "blocks" to the number of blocks available to non-superuser accounts on the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getAvailableBlocks ( ) const

Returns the number of blocks available to non-superuser accounts on the filesystem. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

static bool filesystem::getAvailableBlocks ( const char *  path,
int64_t *  blocks 
) [static]

Sets "blocks" to the number of blocks available to non-superuser accounts on the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getAvailableFileNodes ( ) const

Returns the number of file nodes available to non-superuser accounts. (works on SCO OSR5, Solaris)

static bool filesystem::getAvailableFileNodes ( const char *  path,
int64_t *  nodes 
) [static]

Sets "nodes" to the number of file nodes available to non-superuser accounts on the filesystem containing "path". (works on SCO OSR5, Solaris)

static bool filesystem::getBlockSize ( const char *  path,
int64_t *  size 
) [static]

Sets "size" to the fundamental block size of the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getBlockSize ( int32_t  fd,
int64_t *  size 
) [static]

Sets "size" to the fundamental block size of the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getBlockSize ( ) const

Returns the fundamental block size of the filesystem. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

bool filesystem::getCurrentProperties ( )

Refreshes the current filesystem properties as returned by the various methods of this class. Returns true on success and false on failure.

const char* filesystem::getDeviceName ( ) const

Returns the name of the device file for the filesystem. (works on Net/OpenBSD)

static bool filesystem::getDeviceName ( const char *  path,
const char **  devname 
) [static]

Sets "devname" to the name of the device file for the filesystem containing "path". (works on Net/OpenBSD)

Returns true on success and false otherwise.

static bool filesystem::getDeviceName ( int32_t  fd,
const char **  devname 
) [static]

Sets "devname" to the name of the device file for the filesystem containing the file represented by the file descriptor "fd". (works on Net/OpenBSD)

Returns true on success and false otherwise.

static bool filesystem::getFileSystemId ( const char *  path,
int64_t *  id 
) [static]

Sets "id" to the file system id of the filesystem containing "path". (works on SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getFileSystemId ( int32_t  fd,
int64_t *  id 
) [static]

Sets "id" to the file system id of the filesystem containing the file represented by the file descriptor "fd". (works on SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getFileSystemId ( ) const

Returns the file system id. (works on SCO OSR5, Solaris)

static bool filesystem::getFilesystemSpecificString ( int32_t  fd,
const char **  str 
) [static]

Sets "str" to the filesystem-specific string for the filesystem containing the file represented by the file descriptor "fd". (works on SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getFilesystemSpecificString ( const char *  path,
const char **  str 
) [static]

Sets "str" to the filesystem-specific string for the filesystem containing "path". (works on SCO OSR5, Solaris)

Returns true on success and false otherwise.

const char* filesystem::getFilesystemSpecificString ( ) const

Returns the filesystem-specific string. (works on SCO OSR5, Solaris)

int64_t filesystem::getFreeBlocks ( ) const

Returns the number of free blocks in the filesystem. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

static bool filesystem::getFreeBlocks ( const char *  path,
int64_t *  blocks 
) [static]

Sets "blocks" to the number of free blocks in the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getFreeBlocks ( int32_t  fd,
int64_t *  blocks 
) [static]

Sets "blocks" to the number of free blocks in the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getFreeFileNodes ( const char *  path,
int64_t *  nodes 
) [static]

Sets "nodes" to the number of free file nodes on the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getFreeFileNodes ( int32_t  fd,
int64_t *  nodes 
) [static]

Sets "nodes" to the number of free file nodes on the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getFreeFileNodes ( ) const

Returns the number of free file nodes. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

void* filesystem::getInternalFilesystemStatisticsStructure ( )

Returns a pointer to the filesystem stats structure used internally. (This is VERY system-specific and could be struct statfs *, struct statvfs * or something else.)

int64_t filesystem::getMaximumFileNameLength ( ) const

Returns the maximum length of filenames on the filesystem. (works on Linux, SCO OSR5, Solaris)

static bool filesystem::getMaximumFileNameLength ( const char *  path,
int64_t *  length 
) [static]

Sets "length" to the maximum length of filenames on the filesystem containing "path". (works on Linux, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getMaximumFileNameLength ( int32_t  fd,
int64_t *  length 
) [static]

Sets "length" to the maximum length of filenames on the filesystem containing the file represented by the file descriptor "fd". (works on Linux, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getMountPoint ( int32_t  fd,
const char **  mtpt 
) [static]

Sets "mtpt" to the mount point of the filesystem containing the file represented by the file descriptor "fd". (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

const char* filesystem::getMountPoint ( ) const

Returns the mount point of the filesystem. (works on Net/Open/FreeBSD)

static bool filesystem::getMountPoint ( const char *  path,
const char **  mtpt 
) [static]

Sets "mtpt" to the mount point of the filesystem containing "path". (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

int64_t filesystem::getOptimumTransferBlockSize ( ) const

Returns the optimum transfer block size. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

static bool filesystem::getOptimumTransferBlockSize ( const char *  path,
int64_t *  size 
) [static]

Sets "path" to the optimum transfer block size for the filesystem contianing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getOptimumTransferBlockSize ( int32_t  fd,
int64_t *  size 
) [static]

Sets "path" to the optimum transfer block size for the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getOwner ( int32_t  fd,
uid_t *  owner 
) [static]

Sets "owner" to the id of the user that mounted the filesystem containing the file represented by the file descriptor "fd". (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

uid_t filesystem::getOwner ( ) const

Returns the id of the user that mounted the filesystem. (works on Net/Open/FreeBSD)

static bool filesystem::getOwner ( const char *  path,
uid_t *  owner 
) [static]

Sets "owner" to the id of the user that mounted the filesystem containing "path". (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getSyncReads ( int32_t  fd,
int64_t *  sreads 
) [static]

Sets "sreads" to the number of synchronous reads that have occurred since the filesytem containing the file represented by the file descriptor "fd" was mounted. (works on FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getSyncReads ( const char *  path,
int64_t *  sreads 
) [static]

Sets "sreads" to the number of synchronous reads that have occurred since the filesytem containing "path" was mounted. (works on FreeBSD)

Returns true on success and false otherwise.

int64_t filesystem::getSyncReads ( ) const

Returns the number of synchronous reads that have occurred since the filesytem was mounted. (works on FreeBSD)

int64_t filesystem::getSyncWrites ( ) const

Returns the number of synchronous writes that have occurred since the filesytem was mounted. (works on Net/Open/FreeBSD)

static bool filesystem::getSyncWrites ( int32_t  fd,
int64_t *  swrites 
) [static]

Sets "swrites" to the number of synchronous writes that have occurred since the filesytem containing the file represented by the file descriptor "fd" was mounted. (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getSyncWrites ( const char *  path,
int64_t *  swrites 
) [static]

Sets "swrites" to the number of synchronous writes that have occurred since the filesytem containing "path" was mounted. (works on Net/Open/FreeBSD)

Returns true on success and false otherwise.

static bool filesystem::getTotalBlocks ( int32_t  fd,
int64_t *  blocks 
) [static]

Sets "blocks" to the total number of blocks allocated for the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getTotalBlocks ( ) const

Returns the total number of blocks allocated for the filesystem. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

static bool filesystem::getTotalBlocks ( const char *  path,
int64_t *  blocks 
) [static]

Sets "blocks" to the total number of blocks allocated for the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getTotalFileNodes ( const char *  path,
int64_t *  nodes 
) [static]

Sets "nodes" to the number of file nodes on the filesystem containing "path". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getTotalFileNodes ( int32_t  fd,
int64_t *  nodes 
) [static]

Sets "nodes" to the number of file nodes on the filesystem containing the file represented by the file descriptor "fd". (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

int64_t filesystem::getTotalFileNodes ( ) const

Returns the number of file nodes on the filesystem. (works on Linux, Net/Open/FreeBSD, SCO OSR5, Solaris)

int64_t filesystem::getType ( ) const

Returns a number representing the filesystem type. (works on Linux and Net/Open/FreeBSD).

static bool filesystem::getType ( int32_t  fd,
int64_t *  type 
) [static]

Sets "type" to a number representing the type of the filesystem containing the file represented by file descriptor "fd". (works on Linux and Net/Open/FreeBSD).

Returns true on success and false otherwise.

static bool filesystem::getType ( const char *  path,
int64_t *  type 
) [static]

Sets "type" to a number representing the type of the filesystem containing "path". (works on Linux and Net/Open/FreeBSD).

Returns true on success and false otherwise.

static bool filesystem::getTypeName ( const char *  path,
const char **  name 
) [static]

Sets "name" to the name of the filesystem type of the filesystem containing "path". (works on Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

static bool filesystem::getTypeName ( int32_t  fd,
const char **  name 
) [static]

Sets "name" to the name of the filesystem type of the filesystem containing the file represented by the file descriptor "fd". (works on Net/Open/FreeBSD, SCO OSR5, Solaris)

Returns true on success and false otherwise.

const char* filesystem::getTypeName ( ) const

Returns the name of the filesystem type. (works on Net/Open/FreeBSD, SCO OSR5, Solaris)

bool filesystem::initialize ( const char *  path)

Initializes the instance to use the filesystem containing "path".

Returns true on success and false on failure.

bool filesystem::initialize ( int32_t  fd)

Initializes the instance to use already open file descriptor "fd".

Returns true on success and false on failure.

filesystem& filesystem::operator= ( const filesystem f)

Makes this instance of the filesystem class identical to "f".