ui-utilcpp  1.8.5
Data Structures | Public Types | Public Member Functions | Static Public Member Functions
UI::Util::QuotaInfo Class Reference

Quota information abstraction. More...

#include <QuotaInfo.hpp>

Inheritance diagram for UI::Util::QuotaInfo:
Inheritance graph
Collaboration diagram for UI::Util::QuotaInfo:
Collaboration graph

Data Structures

class  Exception
 QuotaInfo exceptions. More...
 
class  FS
 Helper class to hold the device string and (optional) the fs type (to be able to do better selection on the quota method to use). More...
 

Public Types

enum  Type { Usr_, Grp_ }
 Type of quota information.
 

Public Member Functions

 QuotaInfo (FS const &fs, int const id=Sys::geteuid(), Type const type=Usr_, std::string const &strPath="")
 
std::string getMethod () const
 Get method string of utilized method.
 
unsigned long getBlockHL () const
 Hard limit of disk blocks.
 
unsigned long getBlockSL () const
 Soft limit of disk blocks.
 
unsigned long getBlocks () const
 Current block usage.
 
unsigned long getINodeHL () const
 Hard limit of inodes.
 
unsigned long getINodeSL () const
 Soft limit of inodes.
 
unsigned long getINodes () const
 Current inode usage.
 
time_t getBlockTL () const
 Block timer limit.
 
time_t getINodeTL () const
 Inodes timer limit.
 
bool getFree (unsigned long const limit, unsigned long const blocks, unsigned long &free) const
 Helper for getFree* methods.
 
bool getFreeBlocksHL (unsigned long &free) const
 Get free blocks from hard limit. False, if there is no hard limit.
 
bool getFreeBlocksSL (unsigned long &free) const
 Get free blocks from soft limit. False, if there is no soft limit.
 
bool getFreeINodesHL (unsigned long &free) const
 Get free indoes from hard limit. False, if there is no hard limit.
 
bool getFreeInodesSL (unsigned long &free) const
 Get free inodes from soft limit. False, if there is no soft limit.
 

Static Public Member Functions

static FS file2fs (std::string const &fName, std::string const &tab="/proc/mounts")
 Get FS information from any file in that fs. More...
 

Detailed Description

Quota information abstraction.

May be extended easily be adding new methods:

Todo:
: The interface is focused on linux "standard" quota interface. Interface should rather be most powerful, with lesser implementations falling back to sane defaults.
Todo:
: Nicer way to find out what interface to use rather then testing on by one (check "quota" source).

Constructor & Destructor Documentation

UI::Util::QuotaInfo::QuotaInfo ( FS const &  fs,
int const  id = Sys::geteuid(),
Type const  type = Usr_,
std::string const &  strPath = "" 
)
Parameters
fsDevice name (std::string - implicit) or file system (FS).
idID as in quotactl(2), normally a user or group ID.
typeType (user or group) of quota info to retrieve.
strPathExtra parameter for windows "quota".

References UI_THROW.

Member Function Documentation

QuotaInfo::FS UI::Util::QuotaInfo::file2fs ( std::string const &  fName,
std::string const &  tab = "/proc/mounts" 
)
static

Get FS information from any file in that fs.

Note
: This method is potentially NOT thread-safe (uses getmntent under linux).

References UI_THROW.


The documentation for this class was generated from the following files: