perfused.h revision 1.11 1 /* $NetBSD: perfused.h,v 1.11 2021/12/04 06:42:39 pho Exp $ */
2
3 /*-
4 * Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28 #ifndef _PERFUSED_H_
29 #define _PERFUSED_H_
30
31 #include <puffs.h>
32 #include "../../lib/libperfuse/perfuse_if.h"
33
34 #define PERFUSE_MSG_T struct puffs_framebuf
35
36 #define _PATH_VAR_RUN_PERFUSE_TRACE "/var/run/perfused%s.trace"
37
38 __BEGIN_DECLS
39
40 #ifdef PERFUSE_DEBUG
41 void perfused_hexdump(const char *, size_t);
42 const char *perfused_opname(int);
43 extern int perfused_diagflags;
44 #endif /* PERFUSE_DEBUG */
45
46 int perfused_open_sock(void);
47 void *perfused_recv_early(int, struct sockcred *, size_t);
48 int perfused_readframe(struct puffs_usermount *,
49 struct puffs_framebuf *, int, int *);
50 int perfused_writeframe(struct puffs_usermount *,
51 struct puffs_framebuf *, int, int *);
52 int perfused_cmpframe(struct puffs_usermount *,
53 struct puffs_framebuf *, struct puffs_framebuf *, int *);
54 void perfused_gotframe(struct puffs_usermount *, struct puffs_framebuf *);
55 void perfused_fdnotify(struct puffs_usermount *, int, int) __dead;
56
57 struct fuse_out_header *perfused_get_outhdr(perfuse_msg_t *);
58 struct fuse_in_header *perfused_get_inhdr(perfuse_msg_t *);
59 char *perfused_get_inpayload(perfuse_msg_t *);
60 char *perfused_get_outpayload(perfuse_msg_t *);
61 void perfused_umount(struct puffs_usermount *);
62
63 perfuse_msg_t *perfused_new_pb(struct puffs_usermount *,
64 puffs_cookie_t, int, size_t, const struct puffs_cred *);
65 int perfused_xchg_pb(struct puffs_usermount *, perfuse_msg_t *, size_t,
66 enum perfuse_xchg_pb_reply);
67
68 void perfused_panic(void) __dead;
69
70 __END_DECLS
71
72 #endif /* _PERFUSED_H_ */
73