コード例 #1
0
ファイル: open.c プロジェクト: netconstructor/dropletfs-fuse
static int
open_creat(const char * const path,
           tpath_entry *pe,
           int flags)
{
        int ret;
        int fd;
        char *local = NULL;

        local = build_cache_tree(path);

        if (! local) {
                LOG(LOG_ERR, "can't create a cache local path (%s)", path);
                ret = -1;
                goto err;
        }

        LOG(LOG_INFO, "opening cache file '%s'", local);

        fd = open(local, flags, 0644);
        if (-1 == fd) {
                LOG(LOG_ERR, "%s: %s", local, strerror(errno));
                ret = -1;
                goto err;
        }
        pe->fd = fd;
        pe->flag = FLAG_DIRTY;

        ret = 0;
  err:
        return ret;
}
コード例 #2
0
static int
open_existing(const char * const path,
              pentry_t *pe,
              int flags)
{
        int ret;
        int fd;

        /* get the fd of the file we want to read */
        fd = pentry_get_fd(pe);

        /* negative fd? then we don't have any cache file, get it! */
        if (fd < 0) {
                (void)build_cache_tree(path);
                fd = dfs_get_local_copy(pe, path, flags);
                if (-1 == fd) {
                        ret = -1;
                        goto err;
                }
                pentry_set_fd(pe, fd);
        }

        ret = 0;
  err:
        return ret;
}
コード例 #3
0
ファイル: open.c プロジェクト: netconstructor/dropletfs-fuse
static int
open_existing(const char * const path,
              tpath_entry *pe,
              int flags)
{
        int ret;

        /* negative fd? then we don't have any cache file, get it! */
        if (pe->fd < 0) {
                (void) build_cache_tree(path);
                pe->fd = dfs_get_local_copy(pe, path, flags);
                if (-1 == pe->fd) {
                        ret = -1;
                        goto err;
                }
        }

        ret = 0;
  err:
        return ret;
}