xref: /netbsd/lib/librefuse/refuse/legacy.h (revision d15edff8)
1 /* $NetBSD: legacy.h,v 1.1 2022/01/22 07:57:30 pho Exp $ */
2 
3 /*
4  * Copyright (c) 2021 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote
16  *    products derived from this software without specific prior written
17  *    permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
20  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 #if !defined(_FUSE_LEGACY_H_)
32 #define _FUSE_LEGACY_H_
33 
34 #include <sys/fstypes.h>
35 
36 /* Legacy data types and functions that had once existed but have been
37  * removed from the FUSE API. */
38 
39 #if !defined(FUSE_H_)
40 #  error Do not include this header directly. Include <fuse.h> instead.
41 #endif
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /* statfs structure used by FUSE < 1.9. On 2.1 it's been replaced with
48  * "struct statfs" and later replaced again with struct statvfs on
49  * 2.5. */
50 struct fuse_statfs {
51 	long block_size;
52 	long blocks;
53 	long blocks_free;
54 	long files;
55 	long files_free;
56 	long namelen;
57 };
58 
59 /* Linux-specific struct statfs; used by FUSE >= 2.1 && < 2.5. */
60 struct statfs {
61 	long		f_type;
62 	long		f_bsize;
63 	fsblkcnt_t	f_blocks;
64 	fsblkcnt_t	f_bfree;
65 	fsblkcnt_t	f_bavail;
66 	fsfilcnt_t	f_files;
67 	fsfilcnt_t	f_ffree;
68 	fsid_t		f_fsid;
69 	long		f_namelen;
70 	long		f_frsize;
71 	long		f_flags;
72 };
73 
74 /* Handle for a getdir() operation. Removed as of FUSE 3.0. */
75 typedef void *fuse_dirh_t;
76 
77 /* Enable debugging output. Removed on FUSE 3.0. */
78 #define FUSE_DEBUG	(1 << 1)
79 
80 /* Invalidate cached data of a file. Added on FUSE 1.9 and removed on
81  * FUSE 3.0. Not to be confused with fuse_invalidate_path() appeared
82  * on FUSE 3.2. */
83 int fuse_invalidate(struct fuse *f, const char *path);
84 
85 /* Check whether a mount option should be passed to the kernel or the
86  * library. Added on FUSE 1.9 and removed on FUSE 3.0. */
87 int fuse_is_lib_option(const char *opt);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif
94