From d1655ce25dbda83b7bbf8874d48654beaa9b9000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Fri, 15 Aug 2008 14:35:16 +0200 Subject: - Added vnops needed for writing .config --- src/mfs_vnops.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mfs_vnops.c b/src/mfs_vnops.c index de5146a..6e9e0b7 100755 --- a/src/mfs_vnops.c +++ b/src/mfs_vnops.c @@ -184,8 +184,9 @@ static int mfs_read (const char *path, char *buf, size_t size, off_t offset, int len; size_t bytes; + DEBUG("read: path(%s) offset(%d) size(%d)\n", path, (int)offset, (int)size); if (strcmp(path, "/.config") == 0) { - DEBUG("read from paths, offset(%d), size(%d)\n", offset, size); + DEBUG("read from config, offset(%d), size(%d)\n", (int)offset, (int)size); len = strlen(paths_info); if (size > (len - offset)) size = len - offset; @@ -213,11 +214,38 @@ static int mfs_read (const char *path, char *buf, size_t size, off_t offset, */ } +static int mfs_write(const char *path, const char *buf, size_t size, + off_t off, struct fuse_file_info *fi) +{ + DEBUG("writing to %s, size(%d), offset(%d)\n\t%s\n", + path, size, (int)off, buf); + return (size); +} + +static int mfs_mknod(const char *path, mode_t mode, dev_t rdev) +{ + DEBUG("mknod %s\n", path); + return (-1); +} + +static int mfs_truncate(const char *path, off_t size) +{ + DEBUG("truncating %s\n", path); + + if (strcmp(path, "/.config") == 0) + return (0); + + return (-1); +} + static struct fuse_operations mfs_ops = { .getattr = mfs_getattr, .readdir = mfs_readdir, .open = mfs_open, .read = mfs_read, + .write = mfs_write, + .mknod = mfs_mknod, + .truncate = mfs_truncate, }; static int musicfs_opt_proc (void *data, const char *arg, int key, -- cgit v1.2.3