acpi: restructure genwakecode.sh
[dragonfly.git] / sys / vfs / userfs / userfs.h
blobd90f2eed3723b1480f054bb223813c7f59b6f929
1 /*
2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
3 *
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * 3. Neither the name of The DragonFly Project nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific, prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
34 * $DragonFly: src/sys/vfs/userfs/userfs.h,v 1.2 2007/09/07 21:42:59 dillon Exp $
37 #include <sys/syslink_msg.h>
38 #include <sys/tree.h>
39 #ifdef _KERNEL
40 #include <sys/lockf.h>
41 #endif
43 #include <sys/syslink_msg2.h>
46 * userfs mount information structure, passed to mount(2). The userfs
47 * will return a syslink messaging descriptor representing the user<->kernel
48 * fs interface. The user filesystem usually creates multiple LWPs to
49 * be able to handle requests in parallel.
51 struct userfs_mount_info {
52 int cfd; /* returned syslink descriptor */
53 void *mmbase; /* FUTURE - memory mapped BIO interface */
54 size_t mmsize; /* FUTURE - memory mapped BIO interface */
55 ino_t root_ino; /* root inode information */
56 void *root_uptr; /* root inode information */
59 #define USERFS_BSIZE 16384 /* used to break uio's into bufs */
60 #define USERFS_BMASK (USERFS_BSIZE-1)
62 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
64 struct userfs_ino_rb_tree;
65 struct user_inode;
66 RB_PROTOTYPE2(userfs_ino_rb_tree, user_inode, rb_node,
67 userfs_ino_rb_compare, ino_t);
69 struct user_mount {
70 struct sldesc *sldesc; /* syslink communications descriptor */
71 struct vnode *rootvp; /* root vnode for filesystem */
72 struct mount *mp;
73 RB_HEAD(userfs_ino_rb_tree, user_inode) rb_root;
76 struct user_inode {
77 RB_ENTRY(user_inode) rb_node;
78 struct user_mount *ump;
79 struct vnode *vp;
80 off_t filesize; /* current file size */
81 void *uptr; /* userland supplied pointer */
82 ino_t inum; /* inode number */
83 struct lockf lockf;
86 #endif
88 #if defined(_KERNEL)
90 extern struct vop_ops userfs_vnode_vops;
91 int user_vop_inactive(struct vop_inactive_args *);
92 int user_vop_reclaim(struct vop_reclaim_args *);
93 int user_vfs_vget(struct mount *mp, struct vnode *dvp,
94 ino_t ino, struct vnode **vpp);
96 void user_elm_push_vnode(syslink_elm_t par, struct vnode *vp);
97 void user_elm_push_offset(syslink_elm_t par, off_t offset);
98 void user_elm_push_bio(syslink_elm_t par, int cmd, int bcount);
99 void user_elm_push_mode(struct syslink_elm *par, mode_t mode);
100 void user_elm_push_cred(struct syslink_elm *par, struct ucred *cred);
101 void user_elm_push_vattr(struct syslink_elm *par, struct vattr *vattr);
102 void user_elm_push_nch(struct syslink_elm *par, struct nchandle *nch);
105 int user_getnewvnode(struct mount *mp, struct vnode **vpp, ino_t ino,
106 enum vtype vtype);
108 int user_elm_parse_vattr(struct syslink_elm *par, struct vattr *vat);
110 #endif