2009-04-20 00:13:21 +02:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2009-04-20 00:13:21 +02:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-09-13 01:33:27 +02:00
|
|
|
* Copyright (c) 2009-2010, Tomasz Sowa
|
2009-04-20 00:13:21 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#ifndef headerfilecmslucorecoremounts
|
|
|
|
#define headerfilecmslucorecoremounts
|
2009-04-20 00:13:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
#include <map>
|
2009-11-16 00:55:11 +01:00
|
|
|
#include <string>
|
2010-09-13 01:33:27 +02:00
|
|
|
#include <vector>
|
2009-04-20 00:13:21 +02:00
|
|
|
#include "mount.h"
|
2010-01-25 05:52:17 +01:00
|
|
|
#include "error.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "dirs.h"
|
2010-09-18 02:51:12 +02:00
|
|
|
#include "db/db.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "request.h"
|
2010-09-13 01:33:27 +02:00
|
|
|
#include "mountparser.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
|
2009-04-20 00:13:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Mounts
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2010-09-13 01:33:27 +02:00
|
|
|
/*
|
|
|
|
mount point's types
|
|
|
|
*/
|
|
|
|
int AddMountType(const char * type);
|
|
|
|
int AddMountType(const std::string & type);
|
|
|
|
const std::string & GetMountType(int id);
|
|
|
|
|
|
|
|
// id of a specific mount type (the id is always valid)
|
|
|
|
int MountTypeCms() { return mount_type_cms; }
|
|
|
|
int MountTypeThread() { return mount_type_thread; }
|
|
|
|
int MountTypeTicket() { return mount_type_ticket; }
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
file systems
|
|
|
|
*/
|
|
|
|
int AddMountFs(const char * fs);
|
|
|
|
int AddMountFs(const std::string & fs);
|
|
|
|
const std::string & GetMountFs(int id);
|
|
|
|
|
|
|
|
// id of a specific file system (the id is always valid)
|
|
|
|
int MountFsSimplefs() { return mount_fs_simplefs; }
|
|
|
|
int MountFsHashfs() { return mount_fs_hashfs; }
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
mount point's parameters
|
|
|
|
*/
|
|
|
|
int AddMountPar(const char * par);
|
|
|
|
int AddMountPar(const std::string & par);
|
|
|
|
const std::string & GetMountPar(int id);
|
|
|
|
|
|
|
|
int MountParPage() { return mount_par_page; }
|
|
|
|
int MountParThread() { return mount_par_thread; }
|
|
|
|
int MountParTicket() { return mount_par_ticket; }
|
|
|
|
int MountParTicketType() { return mount_par_ticket_type; }
|
|
|
|
int MountParTicketTypeDefault() { return mount_par_ticket_type_default; }
|
|
|
|
int MountParTicketStatus() { return mount_par_ticket_status; }
|
|
|
|
int MountParTicketStatusDefault() { return mount_par_ticket_status_default; }
|
|
|
|
int MountParTicketPriority() { return mount_par_ticket_priority; }
|
|
|
|
int MountParTicketPriorityDefault() { return mount_par_ticket_priority_default; }
|
|
|
|
int MountParTicketCategory() { return mount_par_ticket_category; }
|
|
|
|
int MountParTicketCategoryDefault() { return mount_par_ticket_category_default; }
|
|
|
|
int MountParTicketExpected() { return mount_par_ticket_expected; }
|
|
|
|
int MountParTicketExpectedDefault() { return mount_par_ticket_expected_default; }
|
|
|
|
int MountParCreatethreadOn() { return mount_par_createthread_on; }
|
|
|
|
int MountParCreateticketOn() { return mount_par_createticket_on; }
|
|
|
|
int MountParOnlyRootRemove() { return mount_par_only_root_remove; }
|
|
|
|
int MountParEmacsOn() { return mount_par_emacs_on; }
|
|
|
|
int MountParMkdirOn() { return mount_par_mkdir_on; }
|
|
|
|
int MountParApp() { return mount_par_app; }
|
|
|
|
int MountParHtmlTemplate() { return mount_par_html_template; }
|
|
|
|
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
void SetDirs(Dirs * pdirs);
|
|
|
|
void SetDb(Db * pdb);
|
|
|
|
void SetRequest(Request * prequest);
|
|
|
|
|
2010-06-22 01:53:19 +02:00
|
|
|
// dir_id, mount_point
|
|
|
|
typedef std::map<long, Mount> MountTab;
|
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
Mounts();
|
2010-09-13 01:33:27 +02:00
|
|
|
void CreateMounts();
|
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
Error ReadMounts(const std::string & mounts);
|
|
|
|
Error ReadMounts();
|
|
|
|
|
|
|
|
void CalcCurMount();
|
2010-03-15 02:47:26 +01:00
|
|
|
Mount * CalcMount(long dir_id);
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
// current mount point
|
|
|
|
// will not be null after calling CalcCurMount() or ReadMounts([...])
|
|
|
|
Mount * pmount;
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-06-22 01:53:19 +02:00
|
|
|
|
|
|
|
const MountTab * GetMountTab();
|
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
private:
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
Dirs * dirs;
|
|
|
|
Db * db;
|
|
|
|
Request * request;
|
|
|
|
|
2010-09-13 01:33:27 +02:00
|
|
|
const std::string empty_str;
|
|
|
|
|
|
|
|
MountParser mount_parser;
|
|
|
|
|
|
|
|
// cms
|
|
|
|
// thread
|
|
|
|
// ticket
|
|
|
|
std::vector<std::string> mount_type_tab;
|
|
|
|
|
|
|
|
int mount_type_cms;
|
|
|
|
int mount_type_thread;
|
|
|
|
int mount_type_ticket;
|
|
|
|
|
|
|
|
// simplefs
|
|
|
|
// hashfs
|
|
|
|
std::vector<std::string> mount_fs_tab;
|
|
|
|
|
|
|
|
int mount_fs_simplefs;
|
|
|
|
int mount_fs_hashfs;
|
|
|
|
|
|
|
|
// page
|
|
|
|
// thread
|
|
|
|
// ticket
|
|
|
|
// ticket_type
|
|
|
|
// ticket_type_default
|
|
|
|
// ...
|
|
|
|
std::vector<std::string> mount_par_tab;
|
|
|
|
|
|
|
|
int mount_par_page;
|
|
|
|
int mount_par_thread;
|
|
|
|
int mount_par_ticket;
|
|
|
|
int mount_par_ticket_type;
|
|
|
|
int mount_par_ticket_type_default;
|
|
|
|
int mount_par_ticket_status;
|
|
|
|
int mount_par_ticket_status_default;
|
|
|
|
int mount_par_ticket_priority;
|
|
|
|
int mount_par_ticket_priority_default;
|
|
|
|
int mount_par_ticket_category;
|
|
|
|
int mount_par_ticket_category_default;
|
|
|
|
int mount_par_ticket_expected;
|
|
|
|
int mount_par_ticket_expected_default;
|
|
|
|
int mount_par_createthread_on;
|
|
|
|
int mount_par_createticket_on;
|
|
|
|
int mount_par_only_root_remove;
|
|
|
|
int mount_par_emacs_on;
|
|
|
|
int mount_par_mkdir_on;
|
|
|
|
int mount_par_app;
|
|
|
|
int mount_par_html_template;
|
|
|
|
|
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
MountTab mount_tab;
|
2009-04-20 00:13:21 +02:00
|
|
|
|
2010-09-13 01:33:27 +02:00
|
|
|
void CreateMountType();
|
|
|
|
void CreateMountFs();
|
|
|
|
void CreateMountPar();
|
|
|
|
|
2010-01-25 05:52:17 +01:00
|
|
|
void MountCmsForRoot();
|
2009-04-20 00:13:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|