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