added: mount points are read from db: /etc/fstab

changed: mount points parser allows empty lines (with some white characters)


git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@518 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-11-15 23:55:11 +00:00
parent 378cfc0c3d
commit 9129f1b82a
13 changed files with 132 additions and 22 deletions

View File

@@ -12,23 +12,15 @@
#include "request.h"
#include "log.h"
#include "mountparser.h"
#include "db.h"
void Mounts::ReadMounts()
// reading from 'mounts'
void Mounts::ReadMounts(const std::string & mounts)
{
MountParser mp;
// !! tymczasowo - bedzie odczyt z bazy z /etc/fstab
std::string temp =
"cms / withheader, withinfo \n"
"thread /news desc, withheader, thread_with_header, thread_with_info, restrictcreatethread(-1) \n"
"thread /forum asc, withheader, withinfo, thread_with_info, restrictcreatethread(3), only_root_can_remove, can_use_emacs_on(4), can_use_mkdir_on(3)";
Error err = mp.Parse(temp, mount_table);
Error err = mp.Parse(mounts, mount_table);
if( err != Error::ok )
{
@@ -39,6 +31,39 @@ void Mounts::ReadMounts()
// reading from /etc/fstab
void Mounts::ReadMounts()
{
static std::string file = "fstab";
Item * etc = data.dirs.GetEtcDir();
if( !etc )
{
log << log1 << "M: there is no /etc directory" << logend;
return;
}
Item fstab;
Error err = db.GetItem(etc->id, file, fstab);
if( err == Error::db_no_item )
{
log << log1 << "M: there is no /etc/fstab file" << logend;
return;
}
if( err != Error::ok )
{
log << log1 << "M: cannot read /etc/fstab" << logend;
return;
}
ReadMounts(fstab.content);
}
/*