adbncfs  0.9.1
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
MountInfo Class Reference

A class to manage informations obtained from the output of the busybox applet mount command. More...

#include <mountInfo.h>

Classes

class  Entry
 A class to manage a line obtained from the output of the busybox applet mount command. More...
 

Public Member Functions

 MountInfo (const deque< string > &mountInfo)
 Initializes this object with output from the busybox mount command. More...
 
virtual ~MountInfo ()
 
const EntrymountPoint (const char *pcPath) const
 Returns the mount point of a given path. More...
 
bool isMountedRo (const char *pcPath) const
 Test if the given path is located on a mount point that is mounted read only. More...
 
bool isMountedNoexec (const char *pcPath) const
 Test if the given path is located on a mount point that is mounted with the noexec option. More...
 

Private Member Functions

 MountInfo ()
 
const EntryfindMountPointEntry (const string &strPath) const
 Lookup if there is a mount point entry with the given path. More...
 

Static Private Member Functions

static const string parent (const string &strPath)
 Returns the parent pathname string of the given strPath. More...
 

Private Attributes

map< string, Entrym_Entries
 

Detailed Description

A class to manage informations obtained from the output of the busybox applet mount command.

External resources

busybox

Definition at line 41 of file mountInfo.h.

Constructor & Destructor Documentation

MountInfo::MountInfo ( )
private
MountInfo::MountInfo ( const deque< string > &  mountInfo)

Initializes this object with output from the busybox mount command.

The accepted format for the mount info parameter is one that the busybox applet mount returns. Each output line of the mount command is stored as a queue entry

Example:
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)

is stored in a queue with 7 entries

Parameters
mountInfoa queue of strings each element containing one mount output line as described above.

Definition at line 163 of file mountInfo.cpp.

virtual MountInfo::~MountInfo ( )
inlinevirtual

Definition at line 107 of file mountInfo.h.

Member Function Documentation

const MountInfo::Entry * MountInfo::findMountPointEntry ( const string &  strPath) const
private

Lookup if there is a mount point entry with the given path.

Parameters
strPaththe path to lookup.
Returns
a pointer to the entry found or NULL if there is no entry with a mount point of the given path.

Definition at line 233 of file mountInfo.cpp.

Here is the caller graph for this function:

bool MountInfo::isMountedNoexec ( const char *  pcPath) const

Test if the given path is located on a mount point that is mounted with the noexec option.

Parameters
pcPaththe path to test for may be null.
Returns
false if the path is not located on a device mounted withe the noexec option or if pcPath argument is null, true otherwise.

Definition at line 218 of file mountInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool MountInfo::isMountedRo ( const char *  pcPath) const

Test if the given path is located on a mount point that is mounted read only.

Parameters
pcPaththe path to test for may be null.
Returns
false if the path is not located on a read only mounted device or if pcPath argument is null, true otherwise.

Definition at line 203 of file mountInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const MountInfo::Entry * MountInfo::mountPoint ( const char *  pcPath) const

Returns the mount point of a given path.

Parameters
pcPaththe path for that the mount point is to retrieve.
Returns
a pointer to the mount point entry to which pcPath is mounted or NULL if there is no mount point entry for the given path.

Definition at line 180 of file mountInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const string MountInfo::parent ( const string &  strPath)
staticprivate

Returns the parent pathname string of the given strPath.

The parent of strPath consists of the pathname's prefix, if any, and each name in the strPath name sequence except for the last.

Parameters
strPaththe pathname thats parent to retrieve.
Returns
The pathname string of the parent directory named by strPath

strip last slash if there is one

Definition at line 256 of file mountInfo.cpp.

Here is the caller graph for this function:

Member Data Documentation

map<string, Entry> MountInfo::m_Entries
private

Definition at line 104 of file mountInfo.h.


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