summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2013-03-22 16:59:27 +0100
committerPino Toscano <toscano.pino@tiscali.it>2013-03-22 16:59:27 +0100
commitb1f475196174db8bc750b545f23449dd5859d965 (patch)
treed62e67349927b0512a6849508d36ca4ad6512005
parent70bf9589f3718ee6162eb7f0320f44a743b80b6d (diff)
Remove examples for compatibility < 25
* configure.ac (AC_CONFIG_FILES): Remove example/Makefile, example-22/Makefile, example-23/Makefile, example-24/Makefile. * example/.gitignore: Remove. * example/Makefile.am: Likewise. * example/fusexmp.c: Likewise. * example/fusexmp.c.patch: Likewise. * example/hello.c: Likewise. * example/null.c: Likewise. * example-22/.gitignore: Likewise. * example-22/Makefile.am: Likewise. * example-22/fusexmp.c: Likewise. * example-22/fusexmp.c.patch: Likewise. * example-22/hello.c: Likewise. * example-22/null.c: Likewise. * example-23/.gitignore: Likewise. * example-23/Makefile.am: Likewise. * example-23/fusexmp.c: Likewise. * example-23/fusexmp.c.patch: Likewise. * example-23/fusexmp_fh.c: Likewise. * example-23/fusexmp_fh.c.patch: Likewise. * example-23/hello.c: Likewise. * example-23/null.c: Likewise. * example-24/.gitignore: Likewise. * example-24/Makefile.am: Likewise. * example-24/fusexmp.c: Likewise. * example-24/fusexmp.c.patch: Likewise. * example-24/fusexmp_fh.c: Likewise. * example-24/fusexmp_fh.c.patch: Likewise. * example-24/hello.c: Likewise. * example-24/hello_ll.c: Likewise. * example-24/null.c: Likewise.
-rw-r--r--configure.ac6
-rw-r--r--example-22/.gitignore3
-rw-r--r--example-22/Makefile.am10
-rw-r--r--example-22/fusexmp.c351
-rw-r--r--example-22/fusexmp.c.patch16
-rw-r--r--example-22/hello.c90
-rw-r--r--example-22/null.c78
-rw-r--r--example-23/.gitignore4
-rw-r--r--example-23/Makefile.am11
-rw-r--r--example-23/fusexmp.c357
-rw-r--r--example-23/fusexmp.c.patch16
-rw-r--r--example-23/fusexmp_fh.c360
-rw-r--r--example-23/fusexmp_fh.c.patch25
-rw-r--r--example-23/hello.c94
-rw-r--r--example-23/null.c78
-rw-r--r--example-24/.gitignore4
-rw-r--r--example-24/Makefile.am12
-rw-r--r--example-24/fusexmp.c358
-rw-r--r--example-24/fusexmp.c.patch16
-rw-r--r--example-24/fusexmp_fh.c358
-rw-r--r--example-24/fusexmp_fh.c.patch25
-rw-r--r--example-24/hello.c94
-rw-r--r--example-24/hello_ll.c177
-rw-r--r--example-24/null.c88
-rw-r--r--example/.gitignore3
-rw-r--r--example/Makefile.am10
-rw-r--r--example/fusexmp.c347
-rw-r--r--example/fusexmp.c.patch16
-rw-r--r--example/hello.c89
-rw-r--r--example/null.c79
30 files changed, 1 insertions, 3174 deletions
diff --git a/configure.ac b/configure.ac
index 86ddab6b5..fc670fa1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,9 +41,5 @@ CFLAGS="$CFLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -ggdb"
AC_CONFIG_FILES([fuse.pc Makefile]
[include/Makefile src/Makefile]
- [example/Makefile
- example-22/Makefile
- example-23/Makefile
- example-24/Makefile
- example-25/Makefile])
+ [example-25/Makefile])
AC_OUTPUT
diff --git a/example-22/.gitignore b/example-22/.gitignore
deleted file mode 100644
index 0c424667b..000000000
--- a/example-22/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-fusexmp
-hello
-null
diff --git a/example-22/Makefile.am b/example-22/Makefile.am
deleted file mode 100644
index 902910dca..000000000
--- a/example-22/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp null hello
-
-fusexmp_SOURCES = fusexmp.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
diff --git a/example-22/fusexmp.c b/example-22/fusexmp.c
deleted file mode 100644
index 90f3018b4..000000000
--- a/example-22/fusexmp.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- DIR *dp;
- struct dirent *de;
- int res = 0;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- res = filler(h, de->d_name, de->d_type, de->d_ino);
- if(res != 0)
- break;
- }
-
- closedir(dp);
- return res;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .getdir = xmp_getdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
diff --git a/example-22/fusexmp.c.patch b/example-22/fusexmp.c.patch
deleted file mode 100644
index be5586e88..000000000
--- a/example-22/fusexmp.c.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- ../../fuse-0-branch-2.2/example/fusexmp.c 2005-11-17 16:29:01.000000000 +0100
-+++ fusexmp.c 2005-03-27 15:48:53.000000000 +0200
-@@ -73,7 +73,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example-22/hello.c b/example-22/hello.c
deleted file mode 100644
index 9e4099b33..000000000
--- a/example-22/hello.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#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)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(h, ".", 0, 0);
- filler(h, "..", 0, 0);
- filler(h, hello_path + 1, 0, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .getdir = hello_getdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
diff --git a/example-22/null.c b/example-22/null.c
deleted file mode 100644
index d58feabb2..000000000
--- a/example-22/null.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
diff --git a/example-23/.gitignore b/example-23/.gitignore
deleted file mode 100644
index 929ddf159..000000000
--- a/example-23/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-fusexmp
-fusexmp_fh
-hello
-null
diff --git a/example-23/Makefile.am b/example-23/Makefile.am
deleted file mode 100644
index 849cebd6e..000000000
--- a/example-23/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp fusexmp_fh null hello
-
-fusexmp_SOURCES = fusexmp.c
-fusexmp_fh_SOURCES = fusexmp_fh.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
diff --git a/example-23/fusexmp.c b/example-23/fusexmp.c
deleted file mode 100644
index f98c0a99c..000000000
--- a/example-23/fusexmp.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp;
- struct dirent *de;
-
- (void) offset;
- (void) fi;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, 0))
- break;
- }
-
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .readdir = xmp_readdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
diff --git a/example-23/fusexmp.c.patch b/example-23/fusexmp.c.patch
deleted file mode 100644
index 2d0054b1f..000000000
--- a/example-23/fusexmp.c.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- fusexmp.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp.c 2005-12-02 01:51:26.000000000 +0100
-@@ -79,7 +79,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example-23/fusexmp_fh.c b/example-23/fusexmp_fh.c
deleted file mode 100644
index 6538d271f..000000000
--- a/example-23/fusexmp_fh.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-static int xmp_opendir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- fi->fh = (unsigned long) dp;
- return 0;
-}
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- struct dirent *de;
-
- (void) path;
- seekdir(dp, offset);
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
- return 0;
-}
-
-static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- (void) path;
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- fi->fh = res;
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pread(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pwrite(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- (void) path;
- close(fi->fh);
-
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- int res;
- (void) path;
-
- if (isdatasync)
- res = fdatasync(fi->fh);
- else
- res = fsync(fi->fh);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .opendir = xmp_opendir,
- .readdir = xmp_readdir,
- .releasedir = xmp_releasedir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &xmp_oper);
-}
diff --git a/example-23/fusexmp_fh.c.patch b/example-23/fusexmp_fh.c.patch
deleted file mode 100644
index c45ece0c6..000000000
--- a/example-23/fusexmp_fh.c.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- fusexmp_fh.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp_fh.c 2005-12-02 01:58:16.000000000 +0100
-@@ -71,7 +71,7 @@
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
-- if (filler(buf, de->d_name, &st, de->d_off))
-+ if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
-@@ -90,7 +90,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example-23/hello.c b/example-23/hello.c
deleted file mode 100644
index b71bcd645..000000000
--- a/example-23/hello.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#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)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- filler(buf, hello_path + 1, NULL, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .readdir = hello_readdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
diff --git a/example-23/null.c b/example-23/null.c
deleted file mode 100644
index d58feabb2..000000000
--- a/example-23/null.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset), struct fuse_file_info *UNUSED(fi))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
diff --git a/example-24/.gitignore b/example-24/.gitignore
deleted file mode 100644
index 929ddf159..000000000
--- a/example-24/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-fusexmp
-fusexmp_fh
-hello
-null
diff --git a/example-24/Makefile.am b/example-24/Makefile.am
deleted file mode 100644
index 15284f816..000000000
--- a/example-24/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp fusexmp_fh null hello
-# low-level api not supported: hello_ll
-
-fusexmp_SOURCES = fusexmp.c
-fusexmp_fh_SOURCES = fusexmp_fh.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -DFUSE_USE_VERSION=22 -I$(top_srcdir) -I$(top_srcdir)/include
diff --git a/example-24/fusexmp.c b/example-24/fusexmp.c
deleted file mode 100644
index efc64e635..000000000
--- a/example-24/fusexmp.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp;
- struct dirent *de;
-
- (void) offset;
- (void) fi;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, 0))
- break;
- }
-
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int res;
-
- res = open(path, fi->flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int fd;
- int res;
-
- (void) fi;
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) fi;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- (void) fi;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .readdir = xmp_readdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
diff --git a/example-24/fusexmp.c.patch b/example-24/fusexmp.c.patch
deleted file mode 100644
index 2d0054b1f..000000000
--- a/example-24/fusexmp.c.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- fusexmp.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp.c 2005-12-02 01:51:26.000000000 +0100
-@@ -79,7 +79,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example-24/fusexmp_fh.c b/example-24/fusexmp_fh.c
deleted file mode 100644
index 9755f66f3..000000000
--- a/example-24/fusexmp_fh.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#define _GNU_SOURCE
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-static int xmp_opendir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = opendir(path);
- if (dp == NULL)
- return -errno;
-
- fi->fh = (unsigned long) dp;
- return 0;
-}
-
-static int xmp_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- struct dirent *de;
-
- (void) path;
- seekdir(dp, offset);
- while ((de = readdir(dp)) != NULL) {
- struct stat st;
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
- if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
- return 0;
-}
-
-static int xmp_releasedir(const char *path, struct fuse_file_info *fi)
-{
- DIR *dp = (DIR *) fi->fh;
- (void) path;
- closedir(dp);
- return 0;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, struct fuse_file_info *fi)
-{
- int fd;
-
- fd = open(path, fi->flags);
- if(fd == -1)
- return -errno;
-
- fi->fh = fd;
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pread(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- int res;
-
- (void) path;
- res = pwrite(fi->fh, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, struct fuse_file_info *fi)
-{
- (void) path;
- close(fi->fh);
-
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync,
- struct fuse_file_info *fi)
-{
- int res;
- (void) path;
-
- if (isdatasync)
- res = fdatasync(fi->fh);
- else
- res = fsync(fi->fh);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .opendir = xmp_opendir,
- .readdir = xmp_readdir,
- .releasedir = xmp_releasedir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- umask(0);
- return fuse_main(argc, argv, &xmp_oper);
-}
diff --git a/example-24/fusexmp_fh.c.patch b/example-24/fusexmp_fh.c.patch
deleted file mode 100644
index c45ece0c6..000000000
--- a/example-24/fusexmp_fh.c.patch
+++ /dev/null
@@ -1,25 +0,0 @@
---- fusexmp_fh.c.orig 2005-12-02 01:47:51.000000000 +0100
-+++ fusexmp_fh.c 2005-12-02 01:58:16.000000000 +0100
-@@ -71,7 +71,7 @@
- memset(&st, 0, sizeof(st));
- st.st_ino = de->d_ino;
- st.st_mode = de->d_type << 12;
-- if (filler(buf, de->d_name, &st, de->d_off))
-+ if (filler(buf, de->d_name, &st, telldir(dp)))
- break;
- }
-
-@@ -90,7 +90,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example-24/hello.c b/example-24/hello.c
deleted file mode 100644
index b71bcd645..000000000
--- a/example-24/hello.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#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)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(buf, ".", NULL, 0);
- filler(buf, "..", NULL, 0);
- filler(buf, hello_path + 1, NULL, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, struct fuse_file_info *fi)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((fi->flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset,
- struct fuse_file_info *fi)
-{
- size_t len;
- (void) fi;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .readdir = hello_readdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &hello_oper);
-}
diff --git a/example-24/hello_ll.c b/example-24/hello_ll.c
deleted file mode 100644
index d365771e1..000000000
--- a/example-24/hello_ll.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse_lowlevel.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <assert.h>
-
-static const char *hello_str = "Hello World!\n";
-static const char *hello_name = "hello";
-
-static int hello_stat(fuse_ino_t ino, struct stat *stbuf)
-{
- stbuf->st_ino = ino;
- switch (ino) {
- case 1:
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- break;
-
- case 2:
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- break;
-
- default:
- return -1;
- }
- return 0;
-}
-
-static void hello_ll_getattr(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- struct stat stbuf;
-
- (void) fi;
-
- memset(&stbuf, 0, sizeof(stbuf));
- if (hello_stat(ino, &stbuf) == -1)
- fuse_reply_err(req, ENOENT);
- else
- fuse_reply_attr(req, &stbuf, 1.0);
-}
-
-static void hello_ll_lookup(fuse_req_t req, fuse_ino_t parent, const char *name)
-{
- struct fuse_entry_param e;
-
- if (parent != 1 || strcmp(name, hello_name) != 0)
- fuse_reply_err(req, ENOENT);
- else {
- memset(&e, 0, sizeof(e));
- e.ino = 2;
- e.attr_timeout = 1.0;
- e.entry_timeout = 1.0;
- hello_stat(e.ino, &e.attr);
-
- fuse_reply_entry(req, &e);
- }
-}
-
-struct dirbuf {
- char *p;
- size_t size;
-};
-
-static void dirbuf_add(struct dirbuf *b, const char *name, fuse_ino_t ino)
-{
- struct stat stbuf;
- size_t oldsize = b->size;
- b->size += fuse_dirent_size(strlen(name));
- b->p = (char *) realloc(b->p, b->size);
- memset(&stbuf, 0, sizeof(stbuf));
- stbuf.st_ino = ino;
- fuse_add_dirent(b->p + oldsize, name, &stbuf, b->size);
-}
-
-#define min(x, y) ((x) < (y) ? (x) : (y))
-
-static int reply_buf_limited(fuse_req_t req, const char *buf, size_t bufsize,
- off_t off, size_t maxsize)
-{
- if (off < bufsize)
- return fuse_reply_buf(req, buf + off, min(bufsize - off, maxsize));
- else
- return fuse_reply_buf(req, NULL, 0);
-}
-
-static void hello_ll_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if (ino != 1)
- fuse_reply_err(req, ENOTDIR);
- else {
- struct dirbuf b;
-
- memset(&b, 0, sizeof(b));
- dirbuf_add(&b, ".", 1);
- dirbuf_add(&b, "..", 1);
- dirbuf_add(&b, hello_name, 2);
- reply_buf_limited(req, b.p, b.size, off, size);
- free(b.p);
- }
-}
-
-static void hello_ll_open(fuse_req_t req, fuse_ino_t ino,
- struct fuse_file_info *fi)
-{
- if (ino != 2)
- fuse_reply_err(req, EISDIR);
- else if ((fi->flags & 3) != O_RDONLY)
- fuse_reply_err(req, EACCES);
- else
- fuse_reply_open(req, fi);
-}
-
-static void hello_ll_read(fuse_req_t req, fuse_ino_t ino, size_t size,
- off_t off, struct fuse_file_info *fi)
-{
- (void) fi;
-
- assert(ino == 2);
- reply_buf_limited(req, hello_str, strlen(hello_str), off, size);
-}
-
-static struct fuse_lowlevel_ops hello_ll_oper = {
- .lookup = hello_ll_lookup,
- .getattr = hello_ll_getattr,
- .readdir = hello_ll_readdir,
- .open = hello_ll_open,
- .read = hello_ll_read,
-};
-
-int main(int argc, char *argv[])
-{
- const char *mountpoint;
- int err = -1;
- int fd;
-
- if (argc != 2) {
- fprintf(stderr, "usage: %s mountpoint\n", argv[0]);
- return 1;
- }
- mountpoint = argv[1];
- fd = fuse_mount(mountpoint, NULL);
- if (fd != -1) {
- struct fuse_session *se;
-
- se = fuse_lowlevel_new("debug", &hello_ll_oper, sizeof(hello_ll_oper),
- NULL);
- if (se != NULL) {
- struct fuse_chan *ch = fuse_kern_chan_new(fd);
- if (ch != NULL) {
- fuse_session_add_chan(se, ch);
- err = fuse_session_loop(se);
- }
- fuse_session_destroy(se);
- }
- close(fd);
- }
- fuse_unmount(mountpoint);
-
- return err ? 1 : 0;
-}
diff --git a/example-24/null.c b/example-24/null.c
deleted file mode 100644
index d9539ab1f..000000000
--- a/example-24/null.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t size)
-{
- (void) size;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, struct fuse_file_info *fi)
-{
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *buf, size_t size,
- off_t offset, struct fuse_file_info *fi)
-{
- (void) buf;
- (void) offset;
- (void) fi;
-
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- return fuse_main(argc, argv, &null_oper);
-}
diff --git a/example/.gitignore b/example/.gitignore
deleted file mode 100644
index 0c424667b..000000000
--- a/example/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-fusexmp
-hello
-null
diff --git a/example/Makefile.am b/example/Makefile.am
deleted file mode 100644
index d303344d9..000000000
--- a/example/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-noinst_PROGRAMS = fusexmp null hello
-
-fusexmp_SOURCES = fusexmp.c
-null_SOURCES = null.c
-hello_SOURCES = hello.c
-
-LDADD = ../src/libfuse.la
-AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include
diff --git a/example/fusexmp.c b/example/fusexmp.c
deleted file mode 100644
index bf176e3e4..000000000
--- a/example/fusexmp.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <config.h>
-
-#ifdef linux
-/* For pread()/pwrite() */
-#define _XOPEN_SOURCE 500
-#endif
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <errno.h>
-#include <sys/statfs.h>
-#ifdef HAVE_SETXATTR
-#include <sys/xattr.h>
-#endif
-
-static int xmp_getattr(const char *path, struct stat *stbuf)
-{
- int res;
-
- res = lstat(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_readlink(const char *path, char *buf, size_t size)
-{
- int res;
-
- res = readlink(path, buf, size - 1);
- if(res == -1)
- return -errno;
-
- buf[res] = '\0';
- return 0;
-}
-
-
-static int xmp_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- DIR *dp;
- struct dirent *de;
- int res = 0;
-
- dp = opendir(path);
- if(dp == NULL)
- return -errno;
-
- while((de = readdir(dp)) != NULL) {
- res = filler(h, de->d_name, de->d_type);
- if(res != 0)
- break;
- }
-
- closedir(dp);
- return res;
-}
-
-static int xmp_mknod(const char *path, mode_t mode, dev_t rdev)
-{
- int res;
-
- /* On the Hurd we must not use mknod() to create files, but creat() */
- if(mode & S_IFREG)
- res = creat(path, mode & ALLPERMS);
- else
- res = mknod(path, mode, rdev);
-
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_mkdir(const char *path, mode_t mode)
-{
- int res;
-
- res = mkdir(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_unlink(const char *path)
-{
- int res;
-
- res = unlink(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rmdir(const char *path)
-{
- int res;
-
- res = rmdir(path);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_symlink(const char *from, const char *to)
-{
- int res;
-
- res = symlink(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_rename(const char *from, const char *to)
-{
- int res;
-
- res = rename(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_link(const char *from, const char *to)
-{
- int res;
-
- res = link(from, to);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chmod(const char *path, mode_t mode)
-{
- int res;
-
- res = chmod(path, mode);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_chown(const char *path, uid_t uid, gid_t gid)
-{
- int res;
-
- res = lchown(path, uid, gid);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_truncate(const char *path, off_t size)
-{
- int res;
-
- res = truncate(path, size);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_utime(const char *path, struct utimbuf *buf)
-{
- int res;
-
- res = utime(path, buf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-
-static int xmp_open(const char *path, int flags)
-{
- int res;
-
- res = open(path, flags);
- if(res == -1)
- return -errno;
-
- close(res);
- return 0;
-}
-
-static int xmp_read(const char *path, char *buf, size_t size, off_t offset)
-{
- int fd;
- int res;
-
- fd = open(path, O_RDONLY);
- if(fd == -1)
- return -errno;
-
- res = pread(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_write(const char *path, const char *buf, size_t size,
- off_t offset)
-{
- int fd;
- int res;
-
- fd = open(path, O_WRONLY);
- if(fd == -1)
- return -errno;
-
- res = pwrite(fd, buf, size, offset);
- if(res == -1)
- res = -errno;
-
- close(fd);
- return res;
-}
-
-static int xmp_statfs(const char *path, struct statfs *stbuf)
-{
- int res;
-
- res = statfs(path, stbuf);
- if(res == -1)
- return -errno;
-
- return 0;
-}
-
-static int xmp_release(const char *path, int flags)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) flags;
- return 0;
-}
-
-static int xmp_fsync(const char *path, int isdatasync)
-{
- /* Just a stub. This method is optional and can safely be left
- unimplemented */
-
- (void) path;
- (void) isdatasync;
- return 0;
-}
-
-#ifdef HAVE_SETXATTR
-/* xattr operations are optional and can safely be left unimplemented */
-static int xmp_setxattr(const char *path, const char *name, const char *value,
- size_t size, int flags)
-{
- int res = lsetxattr(path, name, value, size, flags);
- if(res == -1)
- return -errno;
- return 0;
-}
-
-static int xmp_getxattr(const char *path, const char *name, char *value,
- size_t size)
-{
- int res = lgetxattr(path, name, value, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_listxattr(const char *path, char *list, size_t size)
-{
- int res = llistxattr(path, list, size);
- if(res == -1)
- return -errno;
- return res;
-}
-
-static int xmp_removexattr(const char *path, const char *name)
-{
- int res = lremovexattr(path, name);
- if(res == -1)
- return -errno;
- return 0;
-}
-#endif /* HAVE_SETXATTR */
-
-static struct fuse_operations xmp_oper = {
- .getattr = xmp_getattr,
- .readlink = xmp_readlink,
- .getdir = xmp_getdir,
- .mknod = xmp_mknod,
- .mkdir = xmp_mkdir,
- .symlink = xmp_symlink,
- .unlink = xmp_unlink,
- .rmdir = xmp_rmdir,
- .rename = xmp_rename,
- .link = xmp_link,
- .chmod = xmp_chmod,
- .chown = xmp_chown,
- .truncate = xmp_truncate,
- .utime = xmp_utime,
- .open = xmp_open,
- .read = xmp_read,
- .write = xmp_write,
- .statfs = xmp_statfs,
- .release = xmp_release,
- .fsync = xmp_fsync,
-#ifdef HAVE_SETXATTR
- .setxattr = xmp_setxattr,
- .getxattr = xmp_getxattr,
- .listxattr = xmp_listxattr,
- .removexattr= xmp_removexattr,
-#endif
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &xmp_oper);
- return 0;
-}
diff --git a/example/fusexmp.c.patch b/example/fusexmp.c.patch
deleted file mode 100644
index 3f01915d0..000000000
--- a/example/fusexmp.c.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- ../../fuse-0-branch-2.2/example/fusexmp.c 2005-11-17 16:17:35.000000000 +0100
-+++ fusexmp.c 2005-03-20 20:56:35.000000000 +0100
-@@ -73,7 +73,12 @@
- {
- int res;
-
-- res = mknod(path, mode, rdev);
-+ /* On the Hurd we must not use mknod() to create files, but creat() */
-+ if(mode & S_IFREG)
-+ res = creat(path, mode & ALLPERMS);
-+ else
-+ res = mknod(path, mode, rdev);
-+
- if(res == -1)
- return -errno;
-
diff --git a/example/hello.c b/example/hello.c
deleted file mode 100644
index 040c835ce..000000000
--- a/example/hello.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#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)
-{
- int res = 0;
-
- memset(stbuf, 0, sizeof(struct stat));
- if(strcmp(path, "/") == 0) {
- stbuf->st_mode = S_IFDIR | 0755;
- stbuf->st_nlink = 2;
- }
- else if(strcmp(path, hello_path) == 0) {
- stbuf->st_mode = S_IFREG | 0444;
- stbuf->st_nlink = 1;
- stbuf->st_size = strlen(hello_str);
- }
- else
- res = -ENOENT;
-
- return res;
-}
-
-static int hello_getdir(const char *path, fuse_dirh_t h, fuse_dirfil_t filler)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- filler(h, ".", 0);
- filler(h, "..", 0);
- filler(h, hello_path + 1, 0);
-
- return 0;
-}
-
-static int hello_open(const char *path, int flags)
-{
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- if((flags & 3) != O_RDONLY)
- return -EACCES;
-
- return 0;
-}
-
-static int hello_read(const char *path, char *buf, size_t size, off_t offset)
-{
- size_t len;
- if(strcmp(path, hello_path) != 0)
- return -ENOENT;
-
- len = strlen(hello_str);
- if (offset < len) {
- if (offset + size > len)
- size = len - offset;
- memcpy(buf, hello_str + offset, size);
- } else
- size = 0;
-
- return size;
-}
-
-static struct fuse_operations hello_oper = {
- .getattr = hello_getattr,
- .getdir = hello_getdir,
- .open = hello_open,
- .read = hello_read,
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &hello_oper);
- return 0;
-}
diff --git a/example/null.c b/example/null.c
deleted file mode 100644
index 2eb5c8e3c..000000000
--- a/example/null.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- FUSE: Filesystem in Userspace
- Copyright (C) 2001-2004 Miklos Szeredi <miklos@szeredi.hu>
-
- This program can be distributed under the terms of the GNU GPL.
- See the file COPYING.
-*/
-
-#include <fuse.h>
-#include <string.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-
-#define UNUSED(x) x __attribute__((unused))
-
-static int null_getattr(const char *path, struct stat *stbuf)
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- stbuf->st_mode = S_IFREG | 0644;
- stbuf->st_nlink = 1;
- stbuf->st_uid = getuid();
- stbuf->st_gid = getgid();
- stbuf->st_size = (1ULL << 32); /* 4G */
- stbuf->st_blocks = 0;
- stbuf->st_atime = stbuf->st_mtime = stbuf->st_ctime = time(NULL);
-
- return 0;
-}
-
-static int null_truncate(const char *path, off_t UNUSED(size))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_open(const char *path, int UNUSED(flags))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return 0;
-}
-
-static int null_read(const char *path, char *UNUSED(buf), size_t size,
- off_t UNUSED(offset))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static int null_write(const char *path, const char *UNUSED(buf), size_t size,
- off_t UNUSED(offset))
-{
- if(strcmp(path, "/") != 0)
- return -ENOENT;
-
- return size;
-}
-
-static struct fuse_operations null_oper = {
- .getattr = null_getattr,
- .truncate = null_truncate,
- .open = null_open,
- .read = null_read,
- .write = null_write,
-};
-
-int main(int argc, char *argv[])
-{
- fuse_main(argc, argv, &null_oper);
- return 0;
-}