diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-04-23 02:31:51 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-04-23 02:31:51 -0400 |
commit | 4e32e8c303f541e2e10e7675c5027419bc1baeaf (patch) | |
tree | 1c27477cf07d472f648e295622f42c49bea44b56 | |
parent | 0f905a875db0136b01a6ac444e06d1f24cecb647 (diff) | |
download | dbfs-4e32e8c303f541e2e10e7675c5027419bc1baeaf.tar.gz |
Rearrange code, remove stock header.
-rw-r--r-- | dbfs.c | 47 |
1 files changed, 20 insertions, 27 deletions
@@ -1,10 +1,3 @@ -/* - FUSE: Filesystem in Userspace - Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> - - This program can be distributed under the terms of the GNU GPL. - See the file COPYING. -*/ #define FUSE_USE_VERSION 25 @@ -115,25 +108,19 @@ out: return rc; } -static int dfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, - off_t offset, struct fuse_file_info *fi) +static int dfs_read(const char *path, char *buf, size_t size, off_t offset, + struct fuse_file_info *fi) { struct ndb_val *val = NULL; char *nspath; - int rc; + int rc = 0; - nspath = pprefix("/dir", path); - rc = ndb_lookup(nspath, &val); - if (rc) { - if (rc == -ENOENT) - rc = -ENOTDIR; + nspath = pprefix("/data", path); + rc = ndb_lookup(path, &val); + if (rc) goto out; - } - filler(buf, ".", NULL, 0); - filler(buf, "..", NULL, 0); - - rc = dfs_fill_dir(filler, val); + rc = dfs_fill_data(buf, size, offset, val); ndb_free(val); @@ -142,19 +129,25 @@ out: return rc; } -static int dfs_read(const char *path, char *buf, size_t size, off_t offset, - struct fuse_file_info *fi) +static int dfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, + off_t offset, struct fuse_file_info *fi) { struct ndb_val *val = NULL; char *nspath; - int rc = 0; + int rc; - nspath = pprefix("/data", path); - rc = ndb_lookup(path, &val); - if (rc) + nspath = pprefix("/dir", path); + rc = ndb_lookup(nspath, &val); + if (rc) { + if (rc == -ENOENT) + rc = -ENOTDIR; goto out; + } - rc = dfs_fill_data(buf, size, offset, val); + filler(buf, ".", NULL, 0); + filler(buf, "..", NULL, 0); + + rc = dfs_fill_dir(filler, val); ndb_free(val); |