예제 #1
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_utime(const char *path, struct utimbuf *ut)
{
    debug_enter(__FUNCTION__,path);
    int ret;
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    } else {
        ret = logicalfs->utime(path, ut);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #2
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_chmod(const char *path, mode_t mode)
{
    int ret = 0;
    debug_enter(__FUNCTION__,path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->chmod(path, mode);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #3
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_create(const char *path, mode_t mode, int flags, pid_t pid)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{   
        ret = logicalfs->create(path, mode, flags, pid);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #4
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_statvfs(const char *path, struct statvfs *stbuf)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->statvfs(path, stbuf);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #5
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_rmdir(const char *path)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->rmdir(path);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #6
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_readlink(const char *path, char *buf, size_t bufsize)
{
    debug_enter(__FUNCTION__,path); 
    int ret = 0;
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->readlink(path, buf, bufsize);
    }
    debug_exit(__FUNCTION__,path,ret); 
    return ret;
}
예제 #7
0
//This function should be used to determine if a path points
//points to a valid plfs location without checking it's existence or
//doing a stat. It's up to the application developer to then
//use the path with the plfs api to determine the type of file, etc.
//returns True (1) or False (0)
int
is_plfs_path(const char *path){
    debug_enter(__FUNCTION__,path);
    int ret = 0;

    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL){
        ret = 0;
    }else{
        ret = 1;
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #8
0
int
plfs_utime(const char *path, struct utimbuf *ut)
{
    debug_enter(__FUNCTION__,path);
    int ret;
    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    } else {
        ret = logicalfs->utime(stripped_path, ut);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #9
0
int
plfs_readlink(const char *path, char *buf, size_t bufsize)
{
    debug_enter(__FUNCTION__,path); 
    int ret = 0;
    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->readlink(stripped_path, buf, bufsize);
    }
    debug_exit(__FUNCTION__,path,ret); 
    return ret;
}
예제 #10
0
int
plfs_readdir(const char *path, void *buf)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->readdir(stripped_path, (set<string>*)buf);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #11
0
int
plfs_mkdir(const char *path, mode_t mode)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->mkdir(stripped_path, mode);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #12
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_symlink(const char *from, const char *to)
{
    int ret = 0;
    ostringstream oss;
    oss << from << " -> " << to;
    debug_enter(__FUNCTION__,oss.str());
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(to);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->symlink(from, to);
    }
    debug_exit(__FUNCTION__,oss.str(),ret);
    return ret;
}
예제 #13
0
int
plfs_chown(const char *path, uid_t u, gid_t g)
{
    int ret = 0;
    debug_enter(__FUNCTION__,path);
    char stripped_path[PATH_MAX];
    stripPrefixPath(path, stripped_path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_path);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->chown(stripped_path, u, g);
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;

}
예제 #14
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_access(const char *path, int mask)
{
    int ret = 0;
    debug_enter(__FUNCTION__,path);
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
    if (logicalfs == NULL) {
        if (plfs_is_mnt_ancestor(path) == true){
            ret = 0;
        }
        else{
            ret = -EINVAL;
        }
    }else { 
        ret = logicalfs->access(path, mask);
    }   
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}
예제 #15
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_trunc(Plfs_fd *fd, const char *path, off_t offset, int open_file)
{
    debug_enter(__FUNCTION__,fd ? fd->getPath():path);
    int ret;
    if (fd) {
        ret = fd->trunc(path, offset);
    }
    else{
        LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
        if (logicalfs == NULL) {
            ret = -EINVAL;
        } else {
            ret = logicalfs->trunc(path, offset, open_file);
        }
    }
    debug_exit(__FUNCTION__,fd ? fd->getPath():path,ret);
    return ret;
}
예제 #16
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_open(Plfs_fd **pfd, const char *path, int flags, pid_t pid, mode_t m,
          Plfs_open_opt *open_opt)
{
    assert( *pfd || path );
    int ret = 0;
    debug_enter(__FUNCTION__,(*pfd) ? (*pfd)->getPath(): path);
    if (*pfd) {
        ret = (*pfd)->open(path, flags, pid, m, open_opt);
    } else {
        LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
        if (logicalfs == NULL) {
            ret = -EINVAL;
        } else {
            ret = logicalfs->open(pfd, path, flags, pid, m, open_opt);
        }
    }
    debug_exit(__FUNCTION__,(*pfd) ? (*pfd)->getPath(): path,ret);
    return ret;
}
예제 #17
0
int
plfs_rename(const char *from, const char *to)
{
    int ret = 0;
    ostringstream oss;
    oss << from << " -> " << to;
    char stripped_from[PATH_MAX];
    stripPrefixPath(from, stripped_from);
    char stripped_to[PATH_MAX];
    stripPrefixPath(to, stripped_to);

    debug_enter(__FUNCTION__,oss.str());
    LogicalFileSystem *logicalfs = plfs_get_logical_fs(stripped_from);
    if (logicalfs == NULL) {
        ret = -EINVAL;
    }else{
        ret = logicalfs->rename(stripped_from, stripped_to);
    }
    debug_exit(__FUNCTION__,oss.str(),ret);
    return ret;
}
예제 #18
0
파일: plfs.cpp 프로젝트: bergwolf/plfs-core
int
plfs_getattr(Plfs_fd *fd, const char *path, struct stat *st, int size_only)
{
    debug_enter(__FUNCTION__,path);
    int ret = 0;
    if (fd) {
        ret = plfs_sync(fd);   // sync before attr
        if (ret == 0) {
            ret = fd->getattr(path, st, size_only);
        }
    } else {
        LogicalFileSystem *logicalfs = plfs_get_logical_fs(path);
        if (logicalfs == NULL) {
            ret =  -EINVAL;
        }else{
            ret = logicalfs->getattr(path, st, size_only);
        }
    }
    debug_exit(__FUNCTION__,path,ret);
    return ret;
}