xref: /netbsd-src/usr.sbin/perfused/perfused.h (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1 /*  $NetBSD: perfused.h,v 1.10 2012/02/04 18:36:30 joerg 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 #include "fuse.h"
34 
35 #define PERFUSE_MSG_T struct puffs_framebuf
36 
37 #define _PATH_VAR_RUN_PERFUSE_TRACE "/var/run/perfused%s.trace"
38 
39 __BEGIN_DECLS
40 
41 #ifdef PERFUSE_DEBUG
42 void perfused_hexdump(const char *, size_t);
43 const char *perfused_opname(int);
44 extern int perfused_diagflags;
45 #endif /* PERFUSE_DEBUG */
46 
47 int perfused_open_sock(void);
48 void *perfused_recv_early(int, struct sockcred *, size_t);
49 int perfused_readframe(struct puffs_usermount *,
50      struct puffs_framebuf *, int, int *);
51 int perfused_writeframe(struct puffs_usermount *,
52      struct puffs_framebuf *, int, int *);
53 int perfused_cmpframe(struct puffs_usermount *,
54      struct puffs_framebuf *, struct puffs_framebuf *, int *);
55 void perfused_gotframe(struct puffs_usermount *, struct puffs_framebuf *);
56 void perfused_fdnotify(struct puffs_usermount *, int, int) __dead;
57 
58 struct fuse_out_header *perfused_get_outhdr(perfuse_msg_t *);
59 struct fuse_in_header *perfused_get_inhdr(perfuse_msg_t *);
60 char *perfused_get_inpayload(perfuse_msg_t *);
61 char *perfused_get_outpayload(perfuse_msg_t *);
62 void perfused_umount(struct puffs_usermount *);
63 
64 perfuse_msg_t *perfused_new_pb(struct puffs_usermount *,
65     puffs_cookie_t, int, size_t, const struct puffs_cred *);
66 int perfused_xchg_pb(struct puffs_usermount *, perfuse_msg_t *, size_t,
67     enum perfuse_xchg_pb_reply);
68 
69 void perfused_panic(void) __dead;
70 
71 __END_DECLS
72 
73 #endif /* _PERFUSED_H_ */
74