#ifndef __Explain_h_ #define __Explain_h_ #include // This seems like it should be shared. I hate to throw it into our // ../shared library right now because you need to install the // libexplain-devel package which isn't on all of our machines yet. It // probably should be going forward. namespace Explain { // This is a wrapper around explain_message_creat(). The original uses // C style strings but this version uses std::string. std::string explainCreat(std::string const &fileName, int permissions); // Wrapper around explain_message_mkdir(). std::string explainMkdir(std::string const &pathname, mode_t mode); std::string explainWrite(int fildes, const void *data, long data_size); inline std::string explainWrite(int fildes, std::string const &data) { return explainWrite(fildes, data.c_str(), data.size()); } std::string explainUnlink(char const *fileName); inline std::string explainUnlink(std::string const &fileName) { return explainUnlink(fileName.c_str()); } std::string explainRename(char const *oldpath, char const *newpath); inline std::string explainRename(std::string const &oldpath, std::string const &newpath) { return explainRename(oldpath.c_str(), newpath.c_str()); } std::string explainOpen(const char *pathname, int flags, int mode = 0); // Wrapper around explain_message_stat(). std::string explainStat(const char *pathname, struct stat *buf); inline std::string explainStat(std::string const &pathname, struct stat *buf) { return explainStat(pathname.c_str(), buf); } // Useful for decoding the mode field from a successful call to stat(). std::string dumpProtectionAndMode(mode_t mode); // Useful for decodeing the output from a successful call to stat(). std::string dumpStat(struct stat const &fileStatus); } #endif