perfused.h revision 1.6 1 /* $NetBSD: perfused.h,v 1.6 2011/12/28 17:33:53 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 #define _PATH_VAR_RUN_PERFUSE_TRACE "/var/run/perfuse.trace"
38
39 __BEGIN_DECLS
40
41 #ifdef PERFUSE_DEBUG
42 void perfuse_hexdump(const char *, size_t);
43 const char *perfuse_opname(int);
44 extern int perfuse_diagflags;
45 #endif /* PERFUSE_DEBUG */
46
47 int perfuse_open_sock(void);
48 void *perfuse_recv_early(int, struct sockcred *, size_t);
49 int perfuse_readframe(struct puffs_usermount *,
50 struct puffs_framebuf *, int, int *);
51 int perfuse_writeframe(struct puffs_usermount *,
52 struct puffs_framebuf *, int, int *);
53 int perfuse_cmpframe(struct puffs_usermount *,
54 struct puffs_framebuf *, struct puffs_framebuf *, int *);
55 void perfuse_gotframe(struct puffs_usermount *, struct puffs_framebuf *);
56 void perfuse_fdnotify(struct puffs_usermount *, int, int) __dead;
57
58 struct fuse_out_header *perfuse_get_outhdr(perfuse_msg_t *);
59 struct fuse_in_header *perfuse_get_inhdr(perfuse_msg_t *);
60 char *perfuse_get_inpayload(perfuse_msg_t *);
61 char *perfuse_get_outpayload(perfuse_msg_t *);
62 void perfuse_umount(struct puffs_usermount *);
63
64 perfuse_msg_t *perfuse_new_pb(struct puffs_usermount *,
65 puffs_cookie_t, int, size_t, const struct puffs_cred *);
66 int perfuse_xchg_pb(struct puffs_usermount *, perfuse_msg_t *, size_t,
67 enum perfuse_xchg_pb_reply);
68
69 __END_DECLS
70
71 #endif /* _PERFUSED_H_ */
72