Commit 69c83d9d authored by Marc Vef's avatar Marc Vef
Browse files

Proper initializer lists

parent 2c06782a
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -9,25 +9,8 @@ using namespace std;

std::shared_ptr<Metadata> md;

//TODO Implement all stat functions so that getattr works as expected
//bb_getattr(path="/", statbuf=0x8b9a8c60)
//bb_fullpath:  rootdir = "/home/draze/ownCloud/Promotion/gogs_git/ada-fs/bbfs/playground/mountdir", path = "/", fpath = "/home/draze/ownCloud/Promotion/gogs_git/ada-fs/bbfs/playground/mountdir/"
//lstat returned 0
//si:
//        st_dev = 45
//st_ino = 4328661
//st_mode = 040755
//st_nlink = 2
//st_uid = 1000
//st_gid = 1000
//st_rdev = 0
//st_size = 4096
//st_blksize = 4096
//st_blocks = 8
//st_atime = 0x58b1ffb8
//st_mtime = 0x58b6cfc9
//st_ctime = 0x58b6cfc9
int adafs_getattr(const char *path, struct stat *attr){

    if (strcmp(path, "/") == 0) {
        attr->st_ino = md->getInode_no();
        attr->st_mode = md->getMode();
@@ -41,11 +24,6 @@ int adafs_getattr(const char *path, struct stat *attr){
        attr->st_mtim.tv_sec = md->getMtime_();
        attr->st_ctim.tv_sec = md->getCtime_();
        return 0;



//        attr->st_mode = S_IFDIR | 0755;
//        attr->st_nlink = 2;
    }

    if (strcmp(path, "/file") == 0) {
+15 −11
Original line number Diff line number Diff line
@@ -87,20 +87,24 @@ uint32_t Metadata::getBlocks() const {
void Metadata::setBlocks(uint32_t blocks) {
    Metadata::blocks_ = blocks;
}
//--------------------------------------------
Metadata::Metadata() {

}

Metadata::Metadata(mode_t mode) { //TODO add initializer list
//--------------------------------------------
// By default create a simple file
Metadata::Metadata() : Metadata(S_IFREG | 0755) {}

Metadata::Metadata(mode_t mode) :
        atime_(),
        mtime_(),
        ctime_(),
        uid_(fuse_get_context()->uid),
        gid_(fuse_get_context()->gid),
        mode_(mode),
        inode_no_(),
        link_count_(0),
        size_(0),
        blocks_(0) {
    init_ACMtime();
    uid_ = fuse_get_context()->uid;
    gid_ = fuse_get_context()->gid;
    mode_ = mode;
    inode_no_ = util::generate_inode_no();
    link_count_ = 0;
    size_ = 0;
    blocks_ = 0;
}

void Metadata::init_ACMtime(void) {
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ private:

public:
    Metadata();

    Metadata(mode_t mode);

    //Getter and Setter