Author: kpvdr
Date: 2007-09-08 12:06:25 -0400 (Sat, 08 Sep 2007)
New Revision: 914
Modified:
store/trunk/cpp/lib/jrnl/jdir.cpp
store/trunk/cpp/lib/jrnl/jdir.hpp
store/trunk/cpp/lib/jrnl/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/tests/jrnl/Makefile.rtest
Log:
Added recursive abilities to rhm::journal::jdir directory create and delte methods; made
most methods static.
Modified: store/trunk/cpp/lib/jrnl/jdir.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.cpp 2007-09-08 00:22:36 UTC (rev 913)
+++ store/trunk/cpp/lib/jrnl/jdir.cpp 2007-09-08 16:06:25 UTC (rev 914)
@@ -39,7 +39,7 @@
#include <sstream>
#include <sys/stat.h>
#include <jrnl/jerrno.hpp>
-
+#include <iostream>// debug only
namespace rhm
{
namespace journal
@@ -51,69 +51,99 @@
{
}
+// === create_dir ===
+
void
jdir::create_dir() throw (jexception)
{
- if (::mkdir(_dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
+ create_dir(_dirname);
+}
+
+
+void
+jdir::create_dir(const char* dirname) throw (jexception)
+{
+ create_dir(std::string(dirname));
+}
+
+
+void
+jdir::create_dir(const std::string& dirname) throw (jexception)
+{
+ size_t fdp = dirname.find_last_of('/');
+ if (fdp != std::string::npos)
{
- std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str(), "jdir",
"create_dir");
+ std::string parent_dir = dirname.substr(0, fdp);
+ if (!exists(parent_dir))
+ create_dir(parent_dir);
}
+ if (!exists(dirname))
+ {
+ if (::mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH))
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str(), "jdir",
"create_dir");
+ }
+ }
}
-void
-jdir::delete_dir() throw (jexception)
+
+// === clear_dir ===
+
+void
+jdir::clear_dir(const bool create_flag) throw (jexception)
{
+ clear_dir(_dirname, _base_filename, create_flag);
+}
- clear_dir(false); // cct hack -- TODO kpvdr to do the real deal...
+void
+jdir::clear_dir(const char* dirname, const char* base_filename, const bool create_flag)
+ throw (jexception)
+{
+ clear_dir(std::string(dirname), std::string(base_filename), create_flag);
}
void
-jdir::clear_dir(const bool create_flag) throw (jexception)
+jdir::clear_dir(const std::string& dirname, const std::string& base_filename,
+ const bool create_flag) throw (jexception)
{
- DIR* dir = opendir(_dirname.c_str());
+ DIR* dir = ::opendir(dirname.c_str());
if (!dir)
{
- if (errno == 2 && !create_flag) // ENOENT (No such file or dir)
+ if (errno == 2 && create_flag) // ENOENT (No such file or dir)
{
- std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_DIROPEN, ss.str(), "jdir",
"clear_dir");
+ create_dir(dirname);
+ return;
}
- create_dir();
- dir = opendir(_dirname.c_str());
- if (!dir)
- {
- std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_CDIROPEN, ss.str(), "jdir",
"clear_dir");
- }
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir",
"clear_dir");
}
#ifndef RHM_JOWRITE
struct dirent* entry;
bool found = false;
std::string bak_dir;
- while ((entry = readdir(dir)) != NULL)
+ while ((entry = ::readdir(dir)) != NULL)
{
// Ignore . and ..
if (strcmp(entry->d_name, ".") != 0 &&
strcmp(entry->d_name, "..") != 0)
{
- if (strlen(entry->d_name) > _base_filename.size())
+ if (strlen(entry->d_name) > base_filename.size())
{
- if (strncmp(entry->d_name, _base_filename.c_str(),
_base_filename.size()) == 0)
+ if (strncmp(entry->d_name, base_filename.c_str(),
base_filename.size()) == 0)
{
if (!found)
{
- create_bak_dir(bak_dir);
+ bak_dir = create_bak_dir(dirname, base_filename);
found = true;
}
std::stringstream oldname;
- oldname << _dirname << "/" <<
entry->d_name;
+ oldname << dirname << "/" <<
entry->d_name;
std::stringstream newname;
newname << bak_dir << "/" <<
entry->d_name;
- if (rename(oldname.str().c_str(), newname.str().c_str()))
+ if (::rename(oldname.str().c_str(), newname.str().c_str()))
{
std::stringstream ss;
ss << "file=\"" << oldname.str()
<< "\" dest=\"" <<
@@ -124,77 +154,208 @@
}
}
}
+ if (errno)
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ ::closedir(dir); // Try to close, it makes no sense to trap errors here...
+ throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir",
"clear_dir");
+ }
#endif
- if (closedir(dir))
+ if (::closedir(dir))
{
std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_DIRCLOSE, ss.str(), "jdir",
"clear_dir");
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir",
"clear_dir");
}
}
-std::string&
-jdir::create_bak_dir(std::string& str) throw (jexception)
+
+// === delete_dir ===
+
+void
+jdir::delete_dir() throw (jexception)
{
- DIR* dir = opendir(_dirname.c_str());
+ delete_dir(_dirname);
+}
+
+void
+jdir::delete_dir(const char* dirname) throw (jexception)
+{
+ delete_dir(std::string(dirname));
+}
+
+void
+jdir::delete_dir(const std::string& dirname) throw (jexception)
+{
+ struct dirent* entry;
+ struct stat s;
+ DIR* dir = ::opendir(dirname.c_str());
+ if (!dir)
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir",
"delete_dir");
+ }
+ else
+ {
+ while ((entry = ::readdir(dir)) != NULL)
+ {
+ // Ignore . and ..
+ if (::strcmp(entry->d_name, ".") != 0 &&
::strcmp(entry->d_name, "..") != 0)
+ {
+ std::string full_name(dirname + "/" + entry->d_name);
+ if (::stat(full_name.c_str(), &s))
+ {
+ std::stringstream ss;
+ ss << "stat: file=\"" << full_name
<< "\" errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir",
"delete_dir");
+ }
+ // FIXME: This fn does not handle symbolic links correctly and throws up
+ // For some reason, S_ISLNK() fails to identify links correctly.
+ if (S_ISREG(s.st_mode) || S_ISLNK(s.st_mode)) // This is a file or slink
+ {
+ if(::unlink(full_name.c_str()))
+ {
+ std::stringstream ss;
+ ss << "unlink: file=\"" <<
entry->d_name << "\" errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_UNLINK, ss.str(),
"jdir", "delete_dir");
+ }
+ }
+ else if (S_ISDIR(s.st_mode)) // This is a dir
+ {
+ delete_dir(full_name);
+ }
+ else // all other types, throw up!
+ {
+ std::stringstream ss;
+ ss << "file=\"" << entry->d_name
<< "\" is not a dir, file or slink.";
+ ss << " (mode=0x" << std::hex <<
s.st_mode << std::dec << ")";
+ throw jexception(jerrno::JERR_JDIR_BADFTYPE, ss.str(),
"jdir", "delete_dir");
+ }
+ }
+ }
+ if (errno)
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ ::closedir(dir); // Try to close, it makes no sense to trap errors here...
+ throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir",
"delete_dir");
+ }
+ }
+ // Now dir is empty, close and delete it
+ if (::closedir(dir))
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir",
"delete_dir");
+ }
+ if (::rmdir(dirname.c_str()))
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_RMDIR, ss.str(), "jdir",
"delete_dir");
+ }
+}
+
+
+std::string
+jdir::create_bak_dir(const std::string& dirname, const std::string&
base_filename)
+ throw (jexception)
+{
+ DIR* dir = ::opendir(dirname.c_str());
long dir_num = 0L;
if (!dir)
{
std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_DIROPEN, ss.str(), "jdir",
"create_bak_dir");
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_OPENDIR, ss.str(), "jdir",
"create_bak_dir");
}
struct dirent* entry;
- while ((entry = readdir(dir)) != NULL)
+ while ((entry = ::readdir(dir)) != NULL)
{
// Ignore . and ..
if (strcmp(entry->d_name, ".") != 0 &&
strcmp(entry->d_name, "..") != 0)
{
- if (strlen(entry->d_name) == _base_filename.size() + 10) // Format:
_basename.bak.XXXX
+ if (strlen(entry->d_name) == base_filename.size() + 10) // Format:
basename.bak.XXXX
{
std::stringstream ss;
- ss << "_" << _base_filename <<
".bak.";
- if (strncmp(entry->d_name, ss.str().c_str(), _base_filename.size() +
6) == 0)
+ ss << "_" << base_filename <<
".bak.";
+ if (strncmp(entry->d_name, ss.str().c_str(), base_filename.size() + 6)
== 0)
{
- long this_dir_num = strtol(entry->d_name + _base_filename.size() +
6, NULL, 16);
+ long this_dir_num = strtol(entry->d_name + base_filename.size() +
6, NULL, 16);
if (this_dir_num > dir_num)
dir_num = this_dir_num;
}
}
}
}
- if (closedir(dir))
+ if (errno)
{
std::stringstream ss;
- ss << "dir=\"" << _dirname << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_DIRCLOSE, ss.str(), "jdir",
"create_bak_dir");
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ ::closedir(dir); // Try to close, it makes no sense to trap errors here...
+ throw jexception(jerrno::JERR_JDIR_READDIR, ss.str(), "jdir",
"clear_dir");
}
+ if (::closedir(dir))
+ {
+ std::stringstream ss;
+ ss << "dir=\"" << dirname << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_CLOSEDIR, ss.str(), "jdir",
"create_bak_dir");
+ }
std::stringstream dn;
- dn << _dirname << "/_" << _base_filename <<
".bak." << std::hex << std::setw(4) <<
+ dn << dirname << "/_" << base_filename <<
".bak." << std::hex << std::setw(4) <<
std::setfill('0') << ++dir_num;
- if (mkdir(dn.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH))
+ if (::mkdir(dn.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH))
{
std::stringstream ss;
ss << "dir=\"" << dn.str() << "\"
errno=" << errno;
throw jexception(jerrno::JERR_JDIR_MKDIR, ss.str(), "jdir",
"create_bak_dir");
}
- str.assign(dn.str());
- return str;
+ return std::string(dn.str());
}
const bool
+jdir::is_dir(const char* name) throw (jexception)
+{
+ struct stat s;
+ if (::stat(name, &s))
+ {
+ std::stringstream ss;
+ ss << "file=\"" << name << "\"
errno=" << errno;
+ throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir",
"is_dir");
+ }
+ return S_ISDIR(s.st_mode);
+}
+
+const bool
jdir::is_dir(const std::string& name) throw (jexception)
{
+ return is_dir(name.c_str());
+}
+
+const bool
+jdir::exists(const char* name) throw (jexception)
+{
struct stat s;
- if (::stat(name.c_str(), &s))
+ if (::stat(name, &s))
{
+ if (errno == ENOENT) // No such dir or file
+ return false;
+ // Throw for any other condition
std::stringstream ss;
ss << "file=\"" << name << "\"
errno=" << errno;
- throw jexception(jerrno::JERR_JDIR_FSTAT, ss.str(), "jdir",
"is_dir");
+ throw jexception(jerrno::JERR_JDIR_STAT, ss.str(), "jdir",
"is_dir");
}
- return s.st_mode == S_IFDIR;
+ return true;
}
+const bool
+jdir::exists(const std::string& name) throw (jexception)
+{
+ return exists(name.c_str());
+}
+
std::ostream&
operator<<(std::ostream& os, const jdir& jdir)
{
Modified: store/trunk/cpp/lib/jrnl/jdir.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jdir.hpp 2007-09-08 00:22:36 UTC (rev 913)
+++ store/trunk/cpp/lib/jrnl/jdir.hpp 2007-09-08 16:06:25 UTC (rev 914)
@@ -69,17 +69,42 @@
*/
jdir(const std::string& dirname, const std::string& base_filename);
+
/**
- * \brief Create jouirnal directory.
+ * \brief Create journal directory as set in the dirname parameter of the
constructor.
+ * Recursive creation is supported.
+ *
+ * \expeption ??
*/
void create_dir() throw (jexception);
/**
+ * \brief Static function to create a directory. Recursive creation is supported.
+ *
+ * \param dirname C-string containing name of directory.
+ *
+ * \expeption ??
+ */
+ static void create_dir(const char* dirname) throw (jexception);
+
+ /**
+ * \brief Static function to create a directory. Recursive creation is supported.
+ *
+ * \param dirname String containing name of directory.
+ *
+ * \expeption ??
+ */
+ static void create_dir(const std::string& dirname) throw (jexception);
+
+
+ /**
* \brief Clear the journal directory of files matching the base filename
- * by moving them into a subdirectory.
+ * by moving them into a subdirectory. This fn uses the dirname and
base_filename
+ * that were set on construction.
*
- * \param create_flag If set, create directory if it is non-existent,
- * throw exception otherwise.
+ * \param create_flag If set, create dirname if it is non-existent, otherwise
throw
+ * exception.
+ *
* \exception The journal directory could not be opened.
* \exception The move of files from the journal directory to the created backup
* directory failed.
@@ -88,37 +113,114 @@
void clear_dir(const bool create_flag = true) throw (jexception);
/**
- * \brief Delete the journal directory of files matching the base filename
+ * \brief Clear the directory dirname of journal files matching base_filename
* by moving them into a subdirectory.
*
+ * \param dirname C-string containing name of journal directory.
+ * \param base_filename C-string containing base filename of journal files to be
matched
+ * for moving into subdirectory.
+ * \param create_flag If set, create dirname if it is non-existent, otherwise
throw
+ * exception
+ *
* \exception The journal directory could not be opened.
* \exception The move of files from the journal directory to the created backup
* directory failed.
* \exception The directory handle could not be closed.
*/
+ static void clear_dir(const char* dirname, const char* base_filename,
+ const bool create_flag = true) throw (jexception);
+
+ /**
+ * \brief Clear the directory dirname of journal files matching base_filename
+ * by moving them into a subdirectory.
+ *
+ * \param dirname String containing name of journal directory.
+ * \param base_filename String containing base filename of journal files to be
matched
+ * for moving into subdirectory.
+ * \param create_flag If set, create dirname if it is non-existent, otherwise
throw
+ * exception
+ *
+ * \exception The journal directory could not be opened.
+ * \exception The move of files from the journal directory to the created backup
+ * directory failed.
+ * \exception The directory handle could not be closed.
+ */
+ static void clear_dir(const std::string& dirname, const std::string&
base_filename,
+ const bool create_flag = true) throw (jexception);
+
+ /**
+ * \brief Delete the journal directory and all files and sub--directories that it
may
+ * contain. This is equivilent of rm -rf.
+ *
+ * FIXME: links are not handled correctly.
+ *
+ * \exception The journal directory could not be opened.
+ * \exception The move of files from the journal directory to the created backup
+ * directory failed.
+ * \exception The directory handle could not be closed.
+ */
void delete_dir() throw (jexception);
/**
- * \brief Create bakup directory that is next in sequence.
+ * \brief Delete the journal directory and all files and sub--directories that it
may
+ * contain. This is equivilent of rm -rf.
*
- * Search for directory using pattern "_basename.bak.XXXX" where XXXX is
a hexadecimal
- * sequence, and create next directory based on highest number found.
+ * FIXME: links are not handled correctly.
*
- * \param str The new directory name will be placed in this string instance,
which
- * is also returned by this function.
- * \return New directory name, the same instance as was passed in as paramter
'str'.
+ * \param dirname C-string containing name of directory to be deleted.
+ *
* \exception The journal directory could not be opened.
- * \exception The creation of the new backup directory failed.
+ * \exception The move of files from the journal directory to the created backup
+ * directory failed.
* \exception The directory handle could not be closed.
*/
- std::string& create_bak_dir(std::string& str) throw (jexception);
+ static void delete_dir(const char* dirname) throw (jexception);
/**
+ * \brief Delete the journal directory and all files and sub--directories that it
may
+ * contain. This is equivilent of rm -rf.
+ *
+ * FIXME: links are not handled correctly.
+ *
+ * \param dirname String containing name of directory to be deleted.
+ *
+ * \exception The journal directory could not be opened.
+ * \exception The move of files from the journal directory to the created backup
+ * directory failed.
+ * \exception The directory handle could not be closed.
+ */
+ static void delete_dir(const std::string& dirname) throw (jexception);
+
+ /**
+ * \brief Create bakup directory that is next in sequence and move all journal
files
+ * matching base_filename into it.
+ *
+ * In directory dirname, search for existing backup directory using pattern
+ * "_basename.bak.XXXX" where XXXX is a hexadecimal sequence, and create
next directory
+ * based on highest number found. Move all journal files which match the
base_fileaname
+ * parameter into this new backup directory.
+ *
+ * \param dirname String containing name of journal directory.
+ * \param base_filename String containing base filename of journal files to be
matched
+ * for moving into subdirectory.
+ *
+ * \exception ??
+ *
+ */
+ static std::string create_bak_dir(const std::string& dirname,
+ const std::string& base_filename) throw (jexception);
+
+ /**
* \brief Return the directory name as a string.
*/
inline const std::string& dirname() const { return _dirname; }
/**
+ * \brief Return the journal base filename name as a string.
+ */
+ inline const std::string& base_filename() const { return _base_filename; }
+
+ /**
* \brief Test whether the named file is a directory.
*
* \param name Name of file to be tested.
@@ -126,9 +228,55 @@
* otherwise.
* \exception The stat() operation failed on the named file.
*/
+ const static bool is_dir(const char* name) throw (jexception);
+
+ /**
+ * \brief Test whether the named file is a directory.
+ *
+ * \param name Name of file to be tested.
+ * \return <b><i>true</i></b> if the named file is a
directory; <b><i>false</i></b>
+ * otherwise.
+ * \exception The stat() operation failed on the named file.
+ */
const static bool is_dir(const std::string& name) throw (jexception);
+
+ /**
+ * \brief Test whether the named entity exists on the filesystem.
+ *
+ * If stat() fails with error ENOENT, then this will return
<b><i>false</i></b>. If
+ * stat() succeeds, then <b><i>true</i></b> is returned,
irrespective of the file type.
+ * If stat() fails with any other error, an exception is thrown.
+ *
+ * \param name Name of entity to be tested.
+ * \return <b><i>true</i></b> if the named entity exists;
<b><i>false</i></b>
+ * otherwise.
+ * \exception The stat() operation failed on the named entity.
+ */
+ const static bool exists(const char* name) throw (jexception);
+
+ /**
+ * \brief Test whether the named entity exists on the filesystem.
+ *
+ * If stat() fails with error ENOENT, then this will return
<b><i>false</i></b>. If
+ * stat() succeeds, then <b><i>true</i></b> is returned,
irrespective of the file type.
+ * If stat() fails with any other error, an exception is thrown.
+ *
+ * \param name Name of entity to be tested.
+ * \return <b><i>true</i></b> if the named entity exists;
<b><i>false</i></b>
+ * otherwise.
+ * \exception The stat() operation failed on the named entity.
+ */
+ const static bool exists(const std::string& name) throw (jexception);
+
+ /**
+ * \brief Stream operator
+ */
friend std::ostream& operator<<(std::ostream& os, const jdir&
jdir);
+
+ /**
+ * \brief Stream operator
+ */
friend std::ostream& operator<<(std::ostream& os, const jdir*
jdirPtr);
};
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-09-08 00:22:36 UTC (rev 913)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-09-08 16:06:25 UTC (rev 914)
@@ -56,11 +56,14 @@
// class jdir
const u_int32_t jerrno::JERR_JDIR_MKDIR = 0x0300;
-const u_int32_t jerrno::JERR_JDIR_DIROPEN = 0x0301;
-const u_int32_t jerrno::JERR_JDIR_CDIROPEN = 0x0302;
-const u_int32_t jerrno::JERR_JDIR_DIRCLOSE = 0x0303;
-const u_int32_t jerrno::JERR_JDIR_FMOVE = 0x0304;
-const u_int32_t jerrno::JERR_JDIR_FSTAT = 0x0305;
+const u_int32_t jerrno::JERR_JDIR_OPENDIR = 0x0301;
+const u_int32_t jerrno::JERR_JDIR_READDIR = 0x0302;
+const u_int32_t jerrno::JERR_JDIR_CLOSEDIR = 0x0303;
+const u_int32_t jerrno::JERR_JDIR_RMDIR = 0x0304;
+const u_int32_t jerrno::JERR_JDIR_FMOVE = 0x0305;
+const u_int32_t jerrno::JERR_JDIR_STAT = 0x0306;
+const u_int32_t jerrno::JERR_JDIR_UNLINK = 0x0307;
+const u_int32_t jerrno::JERR_JDIR_BADFTYPE = 0x0308;
// class nlfh
const u_int32_t jerrno::JERR_NLFH_OPENRD = 0x0400;
@@ -113,12 +116,15 @@
// class jdir
_err_map[JERR_JDIR_MKDIR] = std::string("JERR_JDIR_MKDIR: Directory creation
failed.");
- _err_map[JERR_JDIR_DIROPEN] = std::string("JERR_JDIR_DIROPEN: Directory open
failed.");
- _err_map[JERR_JDIR_CDIROPEN] = std::string("JERR_JDIR_CDIROPEN: "
- "Open of newly created directory failed.");
- _err_map[JERR_JDIR_DIRCLOSE] = std::string("JERR_JDIR_DIRCLOSE: Directory close
failed.");
+ _err_map[JERR_JDIR_OPENDIR] = std::string("JERR_JDIR_OPENDIR: Directory open
failed.");
+ _err_map[JERR_JDIR_READDIR] = std::string("JERR_JDIR_READDIR: Directory read
failed.");
+ _err_map[JERR_JDIR_CLOSEDIR] = std::string("JERR_JDIR_CLOSEDIR: Directory close
failed.");
+ _err_map[JERR_JDIR_RMDIR] = std::string("JERR_JDIR_RMDIR: Directory delete
failed.");
_err_map[JERR_JDIR_FMOVE] = std::string("JERR_JDIR_FMOVE: File move
failed.");
- _err_map[JERR_JDIR_FSTAT] = std::string("JERR_JDIR_FSTAT: File stat
failed.");
+ _err_map[JERR_JDIR_STAT] = std::string("JERR_JDIR_STAT: File stat
failed.");
+ _err_map[JERR_JDIR_UNLINK] = std::string("JERR_JDIR_UNLINK: File delete
failed.");
+ _err_map[JERR_JDIR_BADFTYPE] = std::string("JERR_JDIR_BADFTYPE: "
+ "Bad or unknown file type (stat mode).");
// class nlfh
_err_map[JERR_NLFH_OPENRD] = std::string("JERR_JNLFH_OPENRD: Unable to open file
for read.");
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-09-08 00:22:36 UTC (rev 913)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-09-08 16:06:25 UTC (rev 914)
@@ -73,11 +73,14 @@
// class jdir
static const u_int32_t JERR_JDIR_MKDIR; ///< Directory creation
failed
- static const u_int32_t JERR_JDIR_DIROPEN; ///< Directory open failed
- static const u_int32_t JERR_JDIR_CDIROPEN; ///< Open of newly created
directory failed
- static const u_int32_t JERR_JDIR_DIRCLOSE; ///< Directory close failed
+ static const u_int32_t JERR_JDIR_OPENDIR; ///< Directory open failed
+ static const u_int32_t JERR_JDIR_READDIR; ///< Directory read failed
+ static const u_int32_t JERR_JDIR_CLOSEDIR; ///< Directory close failed
+ static const u_int32_t JERR_JDIR_RMDIR; ///< Directory delete failed
static const u_int32_t JERR_JDIR_FMOVE; ///< File move failed
- static const u_int32_t JERR_JDIR_FSTAT; ///< File stat failed
+ static const u_int32_t JERR_JDIR_STAT; ///< File stat failed
+ static const u_int32_t JERR_JDIR_UNLINK; ///< File delete failed
+ static const u_int32_t JERR_JDIR_BADFTYPE; ///< Bad or unknown file type
(stat mode)
// class nlfh
static const u_int32_t JERR_NLFH_OPENRD; ///< Unable to open file for
read
Modified: store/trunk/cpp/tests/jrnl/Makefile.rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-09-08 00:22:36 UTC (rev 913)
+++ store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-09-08 16:06:25 UTC (rev 914)
@@ -71,7 +71,7 @@
JTEST_FILES = jtest
CXX = g++
-CXXINCLUDES = -I. -I../../lib
+CXXINCLUDES = -I. -I../../lib -I../../../../qpid/cpp/src -I../../../../qpid/cpp/src/gen
CXXFLAGS = $(RHM_DEFINES) -Wall -Wextra -Werror -Wno-shadow -Wpointer-arith -Wcast-qual
-Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch -Wno-system-headers
-pedantic -ggdb -O0 -pthread $(CXXINCLUDES)
LDFLAGS = -lpthread -laio -lrt