1 /* $OpenBSD: fuse_opt.h,v 1.5 2018/04/08 20:57:28 jca Exp $ */ 2 /* 3 * Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #ifndef _FUSE_OPT_H_ 19 #define _FUSE_OPT_H_ 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 struct fuse_args { 26 int argc; 27 char **argv; 28 int allocated; 29 }; 30 31 struct fuse_opt { 32 const char *templ; 33 unsigned long off; 34 int val; 35 }; 36 37 typedef int (*fuse_opt_proc_t)(void *, const char *, int, struct fuse_args *); 38 int fuse_opt_add_arg(struct fuse_args *, const char *); 39 int fuse_opt_insert_arg(struct fuse_args *, int, const char *); 40 void fuse_opt_free_args(struct fuse_args *); 41 int fuse_opt_add_opt(char **, const char *); 42 int fuse_opt_add_opt_escaped(char **, const char *); 43 int fuse_opt_match(const struct fuse_opt *, const char *); 44 int fuse_opt_parse(struct fuse_args *, void *, const struct fuse_opt *, 45 fuse_opt_proc_t); 46 47 #define FUSE_ARGS_INIT(ac, av) { ac, av, 0 } 48 49 #define FUSE_OPT_IS_OPT_KEY(t) (t->off == (unsigned long)-1) 50 51 #define FUSE_OPT_KEY(t, k) { t, (unsigned long)-1, k } 52 #define FUSE_OPT_END { NULL, 0, 0 } 53 #define FUSE_OPT_KEY_OPT -1 54 #define FUSE_OPT_KEY_NONOPT -2 55 #define FUSE_OPT_KEY_KEEP -3 56 #define FUSE_OPT_KEY_DISCARD -4 57 58 #ifdef __cplusplus 59 } 60 #endif 61 62 #endif /* _FUSE_OPT_H_ */ 63