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