xref: /netbsd/lib/librefuse/refuse/v21.h (revision 0183fe03)
1*0183fe03Spho /* $NetBSD: v21.h,v 1.1 2022/01/22 08:09:40 pho Exp $ */
2*0183fe03Spho 
3*0183fe03Spho /*
4*0183fe03Spho  * Copyright (c) 2021 The NetBSD Foundation, Inc.
5*0183fe03Spho  * All rights reserved.
6*0183fe03Spho  *
7*0183fe03Spho  * Redistribution and use in source and binary forms, with or without
8*0183fe03Spho  * modification, are permitted provided that the following conditions
9*0183fe03Spho  * are met:
10*0183fe03Spho  * 1. Redistributions of source code must retain the above copyright
11*0183fe03Spho  *    notice, this list of conditions and the following disclaimer.
12*0183fe03Spho  * 2. Redistributions in binary form must reproduce the above copyright
13*0183fe03Spho  *    notice, this list of conditions and the following disclaimer in the
14*0183fe03Spho  *    documentation and/or other materials provided with the distribution.
15*0183fe03Spho  * 3. The name of the author may not be used to endorse or promote
16*0183fe03Spho  *    products derived from this software without specific prior written
17*0183fe03Spho  *    permission.
18*0183fe03Spho  *
19*0183fe03Spho  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20*0183fe03Spho  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21*0183fe03Spho  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*0183fe03Spho  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23*0183fe03Spho  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*0183fe03Spho  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25*0183fe03Spho  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*0183fe03Spho  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*0183fe03Spho  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28*0183fe03Spho  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29*0183fe03Spho  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30*0183fe03Spho  */
31*0183fe03Spho #if !defined(_FUSE_V21_H_)
32*0183fe03Spho #define _FUSE_V21_H_
33*0183fe03Spho 
34*0183fe03Spho /* Compatibility header with FUSE 2.1 API. Only declarations that have
35*0183fe03Spho  * differences between versions should be listed here. */
36*0183fe03Spho 
37*0183fe03Spho #if !defined(FUSE_H_)
38*0183fe03Spho #  error Do not include this header directly. Include <fuse.h> instead.
39*0183fe03Spho #endif
40*0183fe03Spho 
41*0183fe03Spho #ifdef __cplusplus
42*0183fe03Spho extern "C" {
43*0183fe03Spho #endif
44*0183fe03Spho 
45*0183fe03Spho /* The table of file system operations in FUSE 2.1. */
46*0183fe03Spho struct fuse_operations_v21 {
47*0183fe03Spho 	int	(*getattr)		(const char *, struct stat *);
48*0183fe03Spho 	int	(*readlink)		(const char *, char *, size_t);
49*0183fe03Spho 	int	(*getdir)		(const char *, fuse_dirh_t, fuse_dirfil_t_v11);
50*0183fe03Spho 	int	(*mknod)		(const char *, mode_t, dev_t);
51*0183fe03Spho 	int	(*mkdir)		(const char *, mode_t);
52*0183fe03Spho 	int	(*unlink)		(const char *);
53*0183fe03Spho 	int	(*rmdir)		(const char *);
54*0183fe03Spho 	int	(*symlink)		(const char *, const char *);
55*0183fe03Spho 	int	(*rename)		(const char *, const char *);
56*0183fe03Spho 	int	(*link)			(const char *, const char *);
57*0183fe03Spho 	int	(*chmod)		(const char *, mode_t);
58*0183fe03Spho 	int	(*chown)		(const char *, uid_t, gid_t);
59*0183fe03Spho 	int	(*truncate)		(const char *, off_t);
60*0183fe03Spho 	int	(*utime)		(const char *, struct utimbuf *);
61*0183fe03Spho 	int	(*open)			(const char *, int);
62*0183fe03Spho 	int	(*read)			(const char *, char *, size_t, off_t);
63*0183fe03Spho 	int	(*write)		(const char *, const char *, size_t, off_t);
64*0183fe03Spho 	int	(*statfs)		(const char *, struct statfs *);
65*0183fe03Spho 	int	(*flush)		(const char *);
66*0183fe03Spho 	int	(*release)		(const char *, int);
67*0183fe03Spho 	int	(*fsync)		(const char *, int);
68*0183fe03Spho 	int	(*setxattr)		(const char *, const char *, const char *, size_t, int);
69*0183fe03Spho 	int	(*getxattr)		(const char *, const char *, char *, size_t);
70*0183fe03Spho 	int	(*listxattr)	(const char *, char *, size_t);
71*0183fe03Spho 	int	(*removexattr)	(const char *, const char *);
72*0183fe03Spho };
73*0183fe03Spho 
74*0183fe03Spho /* Mount a FUSE >= 2.1 && < 2.5 filesystem. */
75*0183fe03Spho int fuse_mount_v21(const char *mountpoint, const char *opts);
76*0183fe03Spho 
77*0183fe03Spho /* Create a FUSE 2.1 filesystem. The prototype of fuse_new() has
78*0183fe03Spho  * changed over and over. */
79*0183fe03Spho struct fuse *fuse_new_v21(int fd, const char *opts, const void *op,
80*0183fe03Spho 			  int op_version, void *user_data);
81*0183fe03Spho 
82*0183fe03Spho #ifdef __cplusplus
83*0183fe03Spho }
84*0183fe03Spho #endif
85*0183fe03Spho 
86*0183fe03Spho #endif
87