2 * Copyright (c) 2007 The DragonFly Project. All rights reserved.
4 * This code is derived from software contributed to The DragonFly Project
5 * by Matthew Dillon <dillon@backplane.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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
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>
40 #include <sys/lockf.h>
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
;
66 RB_PROTOTYPE2(userfs_ino_rb_tree
, user_inode
, rb_node
,
67 userfs_ino_rb_compare
, ino_t
);
70 struct sldesc
*sldesc
; /* syslink communications descriptor */
71 struct vnode
*rootvp
; /* root vnode for filesystem */
73 RB_HEAD(userfs_ino_rb_tree
, user_inode
) rb_root
;
77 RB_ENTRY(user_inode
) rb_node
;
78 struct user_mount
*ump
;
80 off_t filesize
; /* current file size */
81 void *uptr
; /* userland supplied pointer */
82 ino_t inum
; /* inode number */
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
,
108 int user_elm_parse_vattr(struct syslink_elm
*par
, struct vattr
*vat
);