diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2001-12-21 09:28:33 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2001-12-21 09:28:33 +0000 |
commit | ba8ec88e0e194f2dc5928b043ee8a5a2d338afe9 (patch) | |
tree | deb10f6a9324f035e050c41d8778afdb6301b309 /example/hello.c | |
parent | fe25def3344095825738deba119e1400b8e2315f (diff) |
minor fixes
Diffstat (limited to 'example/hello.c')
-rw-r--r-- | example/hello.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/example/hello.c b/example/hello.c index 5cf75f4..e0010cd 100644 --- a/example/hello.c +++ b/example/hello.c @@ -12,6 +12,7 @@ #include <fcntl.h> static const char *hello_str = "Hello World!\n"; +static const char *hello_path = "/hello"; static int hello_getattr(const char *path, struct stat *stbuf) { @@ -22,8 +23,8 @@ static int hello_getattr(const char *path, struct stat *stbuf) stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; } - else if(strcmp(path, "/hello") == 0) { - stbuf->st_mode = S_IFREG | 0644; + else if(strcmp(path, hello_path) == 0) { + stbuf->st_mode = S_IFREG | 0444; stbuf->st_nlink = 1; stbuf->st_size = strlen(hello_str); } @@ -40,14 +41,14 @@ static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler) filler(h, ".", 0); filler(h, "..", 0); - filler(h, "hello", 0); + filler(h, hello_path + 1, 0); return 0; } static int hello_open(const char *path, int flags) { - if(strcmp(path, "/hello") != 0) + if(strcmp(path, hello_path) != 0) return -ENOENT; if((flags & 3) != O_RDONLY) @@ -58,14 +59,14 @@ static int hello_open(const char *path, int flags) static int hello_read(const char *path, char *buf, size_t size, off_t offset) { - if(strcmp(path, "/hello") != 0) + if(strcmp(path, hello_path) != 0) return -ENOENT; memcpy(buf, hello_str + offset, size); return size; } -static struct fuse_operations null_oper = { +static struct fuse_operations hello_oper = { getattr: hello_getattr, readlink: NULL, getdir: hello_getdir, @@ -87,6 +88,6 @@ static struct fuse_operations null_oper = { int main(int argc, char *argv[]) { - fuse_main(argc, argv, &null_oper); + fuse_main(argc, argv, &hello_oper); return 0; } |