xref: /netbsd/usr.sbin/perfused/perfused.h (revision 6550d01e)
1 /*  $NetBSD: perfused.h,v 1.3 2010/09/15 01:51:44 manu 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 __BEGIN_DECLS
38 
39 #ifdef PERFUSE_DEBUG
40 void perfuse_hexdump(char *, size_t);
41 const char *perfuse_opname(int);
42 extern int perfuse_diagflags;
43 #endif /* PERFUSE_DEBUG */
44 
45 int perfuse_open_sock(void);
46 void *perfuse_recv_early(int, struct sockcred *, size_t);
47 int perfuse_readframe(struct puffs_usermount *,
48      struct puffs_framebuf *, int, int *);
49 int perfuse_writeframe(struct puffs_usermount *,
50      struct puffs_framebuf *, int, int *);
51 int perfuse_cmpframe(struct puffs_usermount *,
52      struct puffs_framebuf *, struct puffs_framebuf *, int *);
53 void perfuse_gotframe(struct puffs_usermount *, struct puffs_framebuf *);
54 void perfuse_fdnotify(struct puffs_usermount *, int, int);
55 
56 struct fuse_out_header *perfuse_get_outhdr(perfuse_msg_t *);
57 struct fuse_in_header *perfuse_get_inhdr(perfuse_msg_t *);
58 char *perfuse_get_inpayload(perfuse_msg_t *);
59 char *perfuse_get_outpayload(perfuse_msg_t *);
60 
61 perfuse_msg_t *perfuse_new_pb(struct puffs_usermount *,
62     puffs_cookie_t, int, size_t, const struct puffs_cred *);
63 int perfuse_xchg_pb(struct puffs_usermount *, perfuse_msg_t *, size_t,
64     enum perfuse_xchg_pb_reply);
65 
66 __END_DECLS
67 
68 #endif /* _PERFUSED_H_ */
69