xref: /minix3/lib/librefuse/fuse_opt.h (revision 490e0de5481bce02ba3d268b472a024f76d2416b)
1 /*	$NetBSD: fuse_opt.h,v 1.5 2009/04/19 22:25:29 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 2007 Alistair Crooks.  All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote
15  *    products derived from this software without specific prior written
16  *    permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef _FUSE_OPT_H_
32 #define _FUSE_OPT_H_
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 enum {
39 	FUSE_OPT_KEY_OPT = -1,
40 	FUSE_OPT_KEY_NONOPT = -2,
41 	FUSE_OPT_KEY_KEEP = -3,
42 	FUSE_OPT_KEY_DISCARD = -4
43 };
44 
45 struct fuse_opt {
46 	const char	*templ;
47 	int32_t		offset;
48 	int32_t		value;
49 };
50 
51 #define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
52 #define FUSE_OPT_END { .templ = NULL }
53 
54 typedef int (*fuse_opt_proc_t)(void *, const char *, int, struct fuse_args *);
55 
56 
57 int fuse_opt_add_arg(struct fuse_args *, const char *);
58 struct fuse_args *fuse_opt_deep_copy_args(int, char **);
59 void fuse_opt_free_args(struct fuse_args *);
60 int fuse_opt_insert_arg(struct fuse_args *, int, const char *);
61 int fuse_opt_add_opt(char **, const char *);
62 int fuse_opt_parse(struct fuse_args *, void *,
63 		   const struct fuse_opt *, fuse_opt_proc_t);
64 int fuse_opt_match(const struct fuse_opt *, const char *);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif /* _FUSE_OPT_H_ */
71