aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/fuse.h18
-rw-r--r--include/fuse_common.h36
-rw-r--r--include/fuse_compat.h4
-rw-r--r--include/fuse_lowlevel.h39
-rw-r--r--include/fuse_lowlevel_compat.h6
-rw-r--r--include/fuse_opt.h53
6 files changed, 103 insertions, 53 deletions
diff --git a/include/fuse.h b/include/fuse.h
index 1cf727c..2eac635 100644
--- a/include/fuse.h
+++ b/include/fuse.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+ Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPL.
See the file COPYING.LIB.
@@ -420,12 +420,12 @@ int fuse_main(int argc, char *argv[], const struct fuse_operations *op);
* Create a new FUSE filesystem.
*
* @param fd the control file descriptor
- * @param opts mount options to be used by the library
+ * @param args argument vector
* @param op the operations
* @param op_size the size of the fuse_operations structure
* @return the created FUSE handle
*/
-struct fuse *fuse_new(int fd, const char *opts,
+struct fuse *fuse_new(int fd, struct fuse_args *args,
const struct fuse_operations *op, size_t op_size);
/**
@@ -488,13 +488,7 @@ struct fuse_context *fuse_get_context(void);
*/
int fuse_invalidate(struct fuse *f, const char *path);
-/**
- * Check whether a mount option should be passed to the kernel or the
- * library
- *
- * @param opt the option to check
- * @return 1 if it is a library option, 0 otherwise
- */
+/* Deprecated, don't use */
int fuse_is_lib_option(const char *opt);
/**
@@ -513,9 +507,9 @@ int fuse_main_real(int argc, char *argv[], const struct fuse_operations *op,
typedef void (*fuse_processor_t)(struct fuse *, struct fuse_cmd *, void *);
/** This is the part of fuse_main() before the event loop */
-struct fuse *fuse_setup(int argc, char *argv[],
+struct fuse *fuse_setup(struct fuse_args *args,
const struct fuse_operations *op, size_t op_size,
- char **mountpoint, int *multithreaded, int *fd);
+ char **mountpoint, int *multithreaded, int *fd);
/** This is the part of fuse_main() after the event loop */
void fuse_teardown(struct fuse *fuse, int fd, char *mountpoint);
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 979c092..0f35ea6 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+ Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPL.
See the file COPYING.LIB.
@@ -13,6 +13,7 @@
#ifndef _FUSE_COMMON_H_
#define _FUSE_COMMON_H_
+#include "fuse_opt.h"
#include <stdint.h>
/** Major version of FUSE library interface */
@@ -65,25 +66,50 @@ struct fuse_file_info {
uint64_t fh;
};
-/*
+/**
* Create a FUSE mountpoint
*
* Returns a control file descriptor suitable for passing to
* fuse_new()
*
* @param mountpoint the mount point path
- * @param opts a comma separated list of mount options. Can be NULL.
+ * @param args argument vector
* @return the control file descriptor on success, -1 on failure
*/
-int fuse_mount(const char *mountpoint, const char *opts);
+int fuse_mount(const char *mountpoint, struct fuse_args *args);
-/*
+/**
* Umount a FUSE mountpoint
*
* @param mountpoint the mount point path
*/
void fuse_unmount(const char *mountpoint);
+/**
+ * Parse common options
+ *
+ * The following options are parsed:
+ *
+ * '-f' foreground
+ * '-d' '-odebug' foreground, but keep the debug option
+ * '-s' single threaded
+ * '-h' '--help' help
+ * '-ho' help without header
+ * '-ofsname=..' file system name, if not present, then set to the program
+ * name
+ *
+ * All parameters may be NULL
+ *
+ * @param args argument vector
+ * @param mountpoint the returned mountpoint, should be freed after use
+ * @param multithreaded set to 1 unless the '-s' option is present
+ * @param foreground set to 1 if one of the relevant options is present
+ * @return 0 on success, -1 on failure
+ */
+int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint,
+ int *multithreaded, int *foreground);
+
+
#ifdef __cplusplus
}
#endif
diff --git a/include/fuse_compat.h b/include/fuse_compat.h
index 1fe68ec..220ef07 100644
--- a/include/fuse_compat.h
+++ b/include/fuse_compat.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+ Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPL.
See the file COPYING.LIB.
@@ -69,6 +69,8 @@ int fuse_main_real_compat22(int argc, char *argv[],
const struct fuse_operations_compat22 *op,
size_t op_size);
+int fuse_mount_compat22(const char *mountpoint, const char *opts);
+
typedef int (*fuse_dirfil_t_compat) (fuse_dirh_t h, const char *name, int type);
struct fuse_operations_compat2 {
int (*getattr) (const char *, struct stat *);
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 74c483c..e45968c 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+ Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPL.
See the file COPYING.LIB.
@@ -928,25 +928,19 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req);
* Filesystem setup *
* ----------------------------------------------------------- */
-/**
- * Check whether a mount option is claimed by the low level library or
- * not
- *
- * @param opt the option to check
- * @return 1 if it is a low level library option, 0 otherwise
- */
+/* Deprecated, don't use */
int fuse_lowlevel_is_lib_option(const char *opt);
/**
* Create a low level session
*
- * @param opts the comma separated list of options
+ * @param args argument vector
* @param op the low level filesystem operations
* @param op_size sizeof(struct fuse_lowlevel_ops)
* @param userdata user data
* @return the created session object, or NULL on failure
*/
-struct fuse_session *fuse_lowlevel_new(const char *opts,
+struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
const struct fuse_lowlevel_ops *op,
size_t op_size, void *userdata);
@@ -1213,6 +1207,31 @@ int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[],
void fuse_chan_destroy(struct fuse_chan *ch);
/* ----------------------------------------------------------- *
+ * Signal handling *
+ * ----------------------------------------------------------- */
+
+/**
+ * Exit session on HUP, TERM and INT signals and ignore PIPE signal
+ *
+ * Stores session in a global variable. May only be called once per
+ * process until fuse_remove_signal_handlers() is called.
+ *
+ * @param se the session to exit
+ * @return 0 on success, -1 on failure
+ */
+int fuse_set_signal_handlers(struct fuse_session *se);
+
+/**
+ * Restore default signal handlers
+ *
+ * Resets global session. After this fuse_set_signal_handlers() may
+ * be called again.
+ *
+ * @param se the same session as given in fuse_set_signal_handlers()
+ */
+void fuse_remove_signal_handlers(struct fuse_session *se);
+
+/* ----------------------------------------------------------- *
* Compatibility stuff *
* ----------------------------------------------------------- */
diff --git a/include/fuse_lowlevel_compat.h b/include/fuse_lowlevel_compat.h
index c2bd3c1..ccb7d01 100644
--- a/include/fuse_lowlevel_compat.h
+++ b/include/fuse_lowlevel_compat.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2001-2005 Miklos Szeredi <miklos@szeredi.hu>
+ Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu>
This program can be distributed under the terms of the GNU LGPL.
See the file COPYING.LIB.
@@ -23,3 +23,7 @@ int fuse_reply_statfs_compat(fuse_req_t req, const struct statfs *stbuf);
int fuse_reply_open_compat(fuse_req_t req,
const struct fuse_file_info_compat *fi);
+
+struct fuse_session *fuse_lowlevel_new_compat(const char *opts,
+ const struct fuse_lowlevel_ops *op,
+ size_t op_size, void *userdata);
diff --git a/include/fuse_opt.h b/include/fuse_opt.h
index f3a06dd..ceec864 100644
--- a/include/fuse_opt.h
+++ b/include/fuse_opt.h
@@ -1,6 +1,6 @@
/*
FUSE: Filesystem in Userspace
- Copyright (C) 2005 Miklos Szeredi <miklos@szeredi.hu>
+ 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.
@@ -16,12 +16,6 @@ extern "C" {
#endif
/**
- * Special 'offset' value. In case of a match, the processing
- * function will be called with 'value' as the key
- */
-#define FUSE_OPT_OFFSET_KEY -1U
-
-/**
* Option description
*
* This structure describes a single option, and and action associated
@@ -44,7 +38,7 @@ extern "C" {
*
* - 'offsetof(struct foo, member)' actions i) and iii)
*
- * - FUSE_OPT_OFFSET_KEY action ii)
+ * - -1 action ii)
*
* The 'offsetof()' macro is defined in the <stddef.h> header.
*
@@ -82,7 +76,7 @@ struct fuse_opt {
/**
* Offset of variable within 'data' parameter of fuse_opt_parse()
- * or FUSE_OPT_OFFSET_KEY
+ * or -1
*/
unsigned long offset;
@@ -94,22 +88,35 @@ struct fuse_opt {
};
/**
+ * Key option. In case of a match, the processing function will be
+ * called with the specified key.
+ */
+#define FUSE_OPT_KEY(template, key) { template, -1U, key }
+
+/**
+ * Last option. An array of 'struct fuse_opt' must end with a NULL
+ * template value
+ */
+#define FUSE_OPT_END { .template = NULL }
+
+/**
* Argument list
*/
struct fuse_args {
/** Argument count */
int argc;
- /* Argument vector. NULL terminated */
+ /** Argument vector. NULL terminated */
char **argv;
+
+ /** Is 'argv' allocated? */
+ int allocated;
};
/**
- * Last option. An array of 'struct fuse_opt' must end with a NULL
- * template value
+ * Initializer for 'struct fuse_args'
*/
-#define FUSE_OPT_END { .template = NULL }
-
+#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
/**
* Key value passed to the processing function if an option did not
@@ -131,7 +138,7 @@ struct fuse_args {
* This function is called if
* - option did not match any 'struct fuse_opt'
* - argument is a non-option
- * - option did match and offset was set to FUSE_OPT_OFFSET_KEY
+ * - option did match and offset was set to -1
*
* The 'arg' parameter will always contain the whole argument or
* option including the parameter if exists. A two-argument option
@@ -156,7 +163,10 @@ typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
/**
* Option parsing function
*
- * If 'argv' is NULL, the contents of 'outargs' will be used as input
+ * If 'args' was returned from a previous call to fuse_opt_parse() or
+ * it was constructed from
+ *
+ * A NULL 'args' is equivalent to an empty argument vector
*
* A NULL 'opts' is equivalent to an 'opts' array containing a single
* end marker
@@ -164,19 +174,14 @@ typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key,
* A NULL 'proc' is equivalent to a processing function always
* returning '1'
*
- * If outargs is NULL, then any output arguments are discarded
- *
- * @param argc is the input argument count
- * @param argv is the input argument vector
+ * @param args is the input and output argument list
* @param data is the user data
* @param opts is the option description array
* @param proc is the processing function
- * @param outargs is the output argument list
* @return -1 on error, 0 on success
*/
-int fuse_opt_parse(int argc, char *argv[], void *data,
- const struct fuse_opt opts[], fuse_opt_proc_t proc,
- struct fuse_args *outargs);
+int fuse_opt_parse(struct fuse_args *args, void *data,
+ const struct fuse_opt opts[], fuse_opt_proc_t proc);
/**
* Add an option to a comma separated option list