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