puffs_priv.h revision 1.3 1 1.3 pooka /* $NetBSD: puffs_priv.h,v 1.3 2007/01/06 18:22:09 pooka Exp $ */
2 1.1 pooka
3 1.1 pooka /*
4 1.1 pooka * Copyright (c) 2006 Antti Kantee. All Rights Reserved.
5 1.1 pooka *
6 1.1 pooka * Redistribution and use in source and binary forms, with or without
7 1.1 pooka * modification, are permitted provided that the following conditions
8 1.1 pooka * are met:
9 1.1 pooka * 1. Redistributions of source code must retain the above copyright
10 1.1 pooka * notice, this list of conditions and the following disclaimer.
11 1.1 pooka * 2. Redistributions in binary form must reproduce the above copyright
12 1.1 pooka * notice, this list of conditions and the following disclaimer in the
13 1.1 pooka * documentation and/or other materials provided with the distribution.
14 1.1 pooka * 3. The name of the company nor the name of the author may be used to
15 1.1 pooka * endorse or promote products derived from this software without specific
16 1.1 pooka * prior written permission.
17 1.1 pooka *
18 1.1 pooka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
19 1.1 pooka * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 1.1 pooka * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 1.1 pooka * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 1.1 pooka * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 1.1 pooka * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 1.1 pooka * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 1.1 pooka * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 1.1 pooka * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 1.1 pooka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 1.1 pooka * SUCH DAMAGE.
29 1.1 pooka */
30 1.1 pooka
31 1.1 pooka #ifndef _PUFFS_PRIVATE_H_
32 1.1 pooka #define _PUFFS_PRIVATE_H_
33 1.1 pooka
34 1.1 pooka #include <sys/types.h>
35 1.1 pooka #include <fs/puffs/puffs_msgif.h>
36 1.1 pooka
37 1.1 pooka #include <puffs.h>
38 1.2 pooka #include <ucontext.h>
39 1.2 pooka
40 1.2 pooka /* call context */
41 1.2 pooka
42 1.2 pooka struct puffs_cc {
43 1.2 pooka struct puffs_usermount *pcc_pu;
44 1.2 pooka struct puffs_req *pcc_preq;
45 1.2 pooka
46 1.2 pooka ucontext_t pcc_uc; /* "continue" */
47 1.2 pooka ucontext_t pcc_uc_ret; /* "yield" */
48 1.2 pooka void *pcc_stack;
49 1.2 pooka
50 1.2 pooka int pcc_flags;
51 1.2 pooka
52 1.2 pooka /* these are for threading information to the implementation */
53 1.2 pooka void *pcc_priv;
54 1.2 pooka int pcc_rv;
55 1.2 pooka
56 1.2 pooka TAILQ_ENTRY(puffs_cc) entries;
57 1.2 pooka };
58 1.2 pooka #define PCC_ONCE 0x01
59 1.2 pooka #define PCC_REALCC 0x02
60 1.2 pooka #define PCC_FREEPRIV 0x04
61 1.2 pooka #define PCC_PREQ_NOCOPY 0x08
62 1.2 pooka #define PCC_DONE 0x10
63 1.2 pooka
64 1.2 pooka #define PCC_CALL_NONE 0x10000
65 1.2 pooka #define PCC_CALL_IN 0x20000
66 1.2 pooka #define PCC_CALL_OUT 0x40000
67 1.2 pooka #define PCC_CALL_MASK 0x70000
68 1.2 pooka
69 1.2 pooka #define pcc_callstat(a) (a->pcc_flags & PCC_CALL_MASK)
70 1.2 pooka #define pcc_callset(a, b) (a->pcc_flags = (a->pcc_flags & ~PCC_CALL_MASK) | b)
71 1.2 pooka
72 1.2 pooka #define pcc_init_local(ap) \
73 1.2 pooka do { \
74 1.2 pooka memset(ap, 0, sizeof(*ap)); \
75 1.2 pooka (ap)->pcc_flags = PCC_ONCE; \
76 1.2 pooka } while (/*CONSTCOND*/0)
77 1.2 pooka
78 1.2 pooka /*
79 1.2 pooka * Reqs
80 1.2 pooka */
81 1.1 pooka
82 1.1 pooka struct puffs_getreq {
83 1.1 pooka struct puffs_usermount *pgr_pu;
84 1.1 pooka
85 1.1 pooka struct puffs_reqh_get pgr_phg;
86 1.2 pooka struct puffs_reqh_get pgr_phg_orig;
87 1.2 pooka
88 1.1 pooka struct puffs_req *pgr_nextpreq;
89 1.1 pooka size_t pgr_advance;
90 1.2 pooka
91 1.2 pooka /* diagnostics */
92 1.2 pooka int pgr_nppr;
93 1.1 pooka };
94 1.1 pooka
95 1.1 pooka struct puffs_putreq {
96 1.1 pooka struct puffs_usermount *ppr_pu;
97 1.1 pooka
98 1.1 pooka struct puffs_reqh_put ppr_php;
99 1.1 pooka
100 1.1 pooka /* to adjust next request info */
101 1.2 pooka void **ppr_buf;
102 1.2 pooka size_t *ppr_buflen;
103 1.2 pooka uint64_t *ppr_id;
104 1.2 pooka
105 1.2 pooka /* for delayed action freeing of preq's */
106 1.2 pooka TAILQ_HEAD(, puffs_cc) ppr_pccq;
107 1.2 pooka
108 1.2 pooka /* diagnostics */
109 1.2 pooka struct puffs_getreq *ppr_pgr;
110 1.1 pooka };
111 1.1 pooka
112 1.2 pooka __BEGIN_DECLS
113 1.2 pooka
114 1.3 pooka void puffs_calldispatcher(struct puffs_cc *);
115 1.3 pooka
116 1.2 pooka __END_DECLS
117 1.2 pooka
118 1.1 pooka #endif /* _PUFFS_PRIVATE_H_ */
119