nidas
v1.2-1520
|
Filesystem mounter/unmounter. More...
#include <FsMount.h>
Public Member Functions | |
FsMount () | |
FsMount (const FsMount &x) | |
Copy. More... | |
~FsMount () | |
FsMount & | operator= (const FsMount &rhs) |
Assignment. More... | |
void | setDir (const std::string &val) |
Set the mount point directory. More... | |
const std::string & | getDir () const |
const std::string & | getDirExpanded () const |
Get the mount point directory, with environment variables expanded. More... | |
void | setDevice (const std::string &val) |
const std::string & | getDevice () const |
const std::string & | getDeviceExpanded () const |
void | setType (const std::string &val) |
const std::string & | getType () const |
void | setOptions (const std::string &val) |
const std::string & | getOptions () const |
bool | isMounted () |
Reads /proc/mount to see if getDir() is mounted. More... | |
void | mount () throw (nidas::util::IOException) |
Synchronous mount request (on return the file system is mounted). More... | |
void | autoMount () throw (nidas::util::IOException) |
Just issue a "mount /dir" command. More... | |
void | mount (FileSet *) throw (nidas::util::IOException) |
Asynchronous mount request. More... | |
void | unmount () throw (nidas::util::IOException) |
void | cancel () |
void | finished () |
void | fromDOMElement (const xercesc::DOMElement *node) throw (nidas::util::InvalidParameterException) |
Initialize myself from a xercesc::DOMElement. More... | |
virtual xercesc::DOMElement * | toDOMParent (xercesc::DOMElement *parent, bool complete) const throw (xercesc::DOMException) |
Create a DOMElement and append it to the parent. More... | |
virtual xercesc::DOMElement * | toDOMElement (xercesc::DOMElement *node, bool complete) const throw (xercesc::DOMException) |
Add my content into a DOMElement. More... | |
Static Public Member Functions | |
static const XMLCh * | getNamespaceURI () |
Protected Attributes | |
std::string | _dir |
std::string | _dirExpanded |
std::string | _dirMsg |
std::string | _device |
std::string | _deviceExpanded |
std::string | _deviceMsg |
std::string | _type |
std::string | _options |
FileSet * | _fileset |
FsMountWorkerThread * | _worker |
nidas::util::Mutex | _workerLock |
nidas::util::Process | _mountProcess |
nidas::util::Process | _umountProcess |
Filesystem mounter/unmounter.
FsMount::FsMount | ( | ) |
FsMount::FsMount | ( | const FsMount & | x | ) |
Copy.
|
inline |
void FsMount::autoMount | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
Just issue a "mount /dir" command.
If /dir is automounted then it may work, whereas "mount /dev/sdXn -o blahblah /dir" may fail for the user on a server.
References _dirMsg, _mountProcess, getDirExpanded(), ILOG, isMounted(), nidas::util::Process::outStream(), nidas::util::Process::spawn(), nidas::util::trimString(), and nidas::util::Process::wait().
Referenced by nidas::core::FsMountWorkerThread::run().
void FsMount::cancel | ( | ) |
References _mountProcess, _umountProcess, _worker, _workerLock, DLOG, getDevice(), nidas::util::Process::getPid(), nidas::util::Thread::isJoined(), nidas::util::Thread::isRunning(), nidas::util::Process::kill(), nidas::util::Thread::kill(), PLOG, USECS_PER_SEC, nidas::util::Process::wait(), and nidas::util::Exception::what().
Referenced by nidas::core::FileSet::close().
void FsMount::finished | ( | ) |
References _fileset, _worker, _workerLock, nidas::util::Mutex::lock(), nidas::core::FileSet::mounted(), and nidas::util::Mutex::unlock().
Referenced by nidas::core::FsMountWorkerThread::run().
|
virtual |
Initialize myself from a xercesc::DOMElement.
Implements nidas::core::DOMable.
References nidas::core::XDOMAttr::getName().
|
inline |
Referenced by cancel(), and operator=().
|
inline |
Referenced by mount().
|
inline |
Referenced by operator=().
|
inline |
Get the mount point directory, with environment variables expanded.
Referenced by autoMount(), isMounted(), mount(), and unmount().
|
inlinestaticinherited |
References nidas::core::DOMable::namespaceURI.
Referenced by nidas::dynld::UDPSampleOutput::getProjectDOM(), nidas::core::Dataset::toDOMElement(), nidas::core::ProjectConfig::toDOMElement(), nidas::core::Dataset::toDOMParent(), nidas::core::ProjectConfig::toDOMParent(), nidas::core::Datasets::toDOMParent(), nidas::core::ProjectConfigs::toDOMParent(), nidas::core::DSMConfig::toDOMParent(), nidas::core::Project::toDOMParent(), nidas::core::Site::toDOMParent(), nidas::core::SampleTag::toDOMParent(), nidas::core::ServerSocket::toDOMParent(), nidas::core::Variable::toDOMParent(), nidas::core::DSMSensor::toDOMParent(), nidas::core::Datasets::writeXML(), and nidas::core::ProjectConfigs::writeXML().
|
inline |
Referenced by mount().
|
inline |
Referenced by mount().
bool FsMount::isMounted | ( | ) |
Reads /proc/mount to see if getDir() is mounted.
References getDirExpanded().
Referenced by autoMount(), mount(), nidas::core::FileSet::mounted(), and unmount().
void FsMount::mount | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
Synchronous mount request (on return the file system is mounted).
References _deviceMsg, _dirMsg, _mountProcess, nidas::util::FileSet::createDirectory(), getDeviceExpanded(), getDirExpanded(), getOptions(), getType(), ILOG, isMounted(), nidas::util::Process::outStream(), nidas::util::Process::spawn(), nidas::util::trimString(), and nidas::util::Process::wait().
Referenced by nidas::core::FileSet::connect(), and nidas::core::FsMountWorkerThread::run().
void FsMount::mount | ( | FileSet * | fset | ) | |
throw | ( | nidas::util::IOException | |||
) |
Asynchronous mount request.
finished() method will be called when mount is done. Does not own the FileSet pointer.
References nidas::util::Exception::what().
Assignment.
References _fileset, _options, _type, _worker, getDevice(), getDir(), setDevice(), and setDir().
void FsMount::setDevice | ( | const std::string & | val | ) |
References _device, _deviceExpanded, _deviceMsg, and nidas::util::Process::expandEnvVars().
Referenced by operator=().
void FsMount::setDir | ( | const std::string & | val | ) |
Set the mount point directory.
It may contain environment variables, e.g.: $DATA, or ${DATA}.
References _dir, _dirExpanded, _dirMsg, and nidas::util::Process::expandEnvVars().
Referenced by operator=().
|
inline |
|
inline |
|
virtualinherited |
Add my content into a DOMElement.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
Referenced by nidas::core::ServerSocket::toDOMParent().
|
virtualinherited |
Create a DOMElement and append it to the parent.
Reimplemented in nidas::core::DSMSensor, nidas::core::Variable, nidas::core::ServerSocket, nidas::core::SampleTag, nidas::core::Site, nidas::core::Project, and nidas::core::DSMConfig.
void FsMount::unmount | ( | ) | ||
throw | ( | nidas::util::IOException | ||
) |
References _dirMsg, _umountProcess, getDirExpanded(), isMounted(), nidas::util::Process::outStream(), nidas::util::Process::spawn(), and nidas::util::Process::wait().
Referenced by nidas::core::FileSet::close().
|
protected |
Referenced by setDevice().
|
protected |
Referenced by setDevice().
|
protected |
Referenced by mount(), and setDevice().
|
protected |
Referenced by setDir().
|
protected |
Referenced by setDir().
|
protected |
Referenced by autoMount(), mount(), setDir(), and unmount().
|
protected |
Referenced by finished(), and operator=().
|
protected |
Referenced by autoMount(), cancel(), and mount().
|
protected |
Referenced by operator=().
|
protected |
Referenced by operator=().
|
protected |
|
protected |
Referenced by cancel(), finished(), and operator=().
|
protected |
Referenced by cancel(), and finished().