2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2007-2009 Google Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following disclaimer
15 * in the documentation and/or other materials provided with the
17 * * Neither the name of Google Inc. nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Copyright (C) 2005 Csaba Henk.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
45 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
46 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 #include "fuse_kernel.h"
62 #define FUSE_DEFAULT_DAEMON_TIMEOUT 60 /* s */
63 #define FUSE_MIN_DAEMON_TIMEOUT 0 /* s */
64 #define FUSE_MAX_DAEMON_TIMEOUT 600 /* s */
66 #ifndef FUSE_FREEBSD_VERSION
67 #define FUSE_FREEBSD_VERSION "0.4.4"
70 /* Mapping versions to features */
72 #define FUSE_KERNELABI_GEQ(maj, min) \
73 (FUSE_KERNEL_VERSION > (maj) || (FUSE_KERNEL_VERSION == (maj) && FUSE_KERNEL_MINOR_VERSION >= (min)))
76 * Appearance of new FUSE operations is not always in par with version
77 * numbering... At least, 7.3 is a sufficient condition for having
78 * FUSE_{ACCESS,CREATE}.
80 #if FUSE_KERNELABI_GEQ(7, 3)
81 #ifndef FUSE_HAS_ACCESS
82 #define FUSE_HAS_ACCESS 1
84 #ifndef FUSE_HAS_CREATE
85 #define FUSE_HAS_CREATE 1
87 #else /* FUSE_KERNELABI_GEQ(7, 3) */
88 #ifndef FUSE_HAS_ACCESS
89 #define FUSE_HAS_ACCESS 0
91 #ifndef FUSE_HAS_CREATE
92 #define FUSE_HAS_CREATE 0
96 #if FUSE_KERNELABI_GEQ(7, 7)
97 #ifndef FUSE_HAS_GETLK
98 #define FUSE_HAS_GETLK 1
100 #ifndef FUSE_HAS_SETLK
101 #define FUSE_HAS_SETLK 1
103 #ifndef FUSE_HAS_SETLKW
104 #define FUSE_HAS_SETLKW 1
106 #ifndef FUSE_HAS_INTERRUPT
107 #define FUSE_HAS_INTERRUPT 1
109 #else /* FUSE_KERNELABI_GEQ(7, 7) */
110 #ifndef FUSE_HAS_GETLK
111 #define FUSE_HAS_GETLK 0
113 #ifndef FUSE_HAS_SETLK
114 #define FUSE_HAS_SETLK 0
116 #ifndef FUSE_HAS_SETLKW
117 #define FUSE_HAS_SETLKW 0
119 #ifndef FUSE_HAS_INTERRUPT
120 #define FUSE_HAS_INTERRUPT 0
124 #if FUSE_KERNELABI_GEQ(7, 8)
125 #ifndef FUSE_HAS_FLUSH_RELEASE
126 #define FUSE_HAS_FLUSH_RELEASE 1
128 * "DESTROY" came in the middle of the 7.8 era,
129 * so this is not completely exact...
131 #ifndef FUSE_HAS_DESTROY
132 #define FUSE_HAS_DESTROY 1
135 #else /* FUSE_KERNELABI_GEQ(7, 8) */
136 #ifndef FUSE_HAS_FLUSH_RELEASE
137 #define FUSE_HAS_FLUSH_RELEASE 0
138 #ifndef FUSE_HAS_DESTROY
139 #define FUSE_HAS_DESTROY 0
146 SYSCTL_DECL(_vfs_fusefs);
150 extern struct mtx fuse_mtx;
151 #define FUSE_LOCK() fuse_lck_mtx_lock(fuse_mtx)
152 #define FUSE_UNLOCK() fuse_lck_mtx_unlock(fuse_mtx)
154 #define RECTIFY_TDCR(td, cred) \
159 (cred) = (td)->td_ucred; \
162 #define fuse_lck_mtx_lock(mtx) mtx_lock(&(mtx))
163 #define fuse_lck_mtx_unlock(mtx) mtx_unlock(&(mtx))
165 void fuse_ipc_init(void);
166 void fuse_ipc_destroy(void);
168 int fuse_device_init(void);
169 void fuse_device_destroy(void);