xref: /netbsd-src/sys/fs/sysvbfs/sysvbfs.h (revision b7ae68fde0d8ef1c03714e8bbb1ee7c6118ea93b)
1 /*	$NetBSD: sysvbfs.h,v 1.3 2006/07/13 12:00:25 martin Exp $	*/
2 
3 /*-
4  * Copyright (c) 2004 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by UCHIYAMA Yasushi.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _FS_SYSVBFS_SYSVBFS_H_
40 #define	_FS_SYSVBFS_SYSVBFS_H_
41 
42 struct bfs;
43 struct buf;
44 
45 #include <miscfs/genfs/genfs.h>
46 #include <miscfs/genfs/genfs_node.h>
47 #include <miscfs/specfs/specdev.h>
48 
49 struct sysvbfs_args {
50 	char	*fspec;		/* blocks special holding the fs to mount */
51 };
52 
53 #ifdef _KERNEL
54 struct sysvbfs_node {
55 	struct genfs_node gnode;
56 	struct vnode *vnode;
57 	struct bfs_inode *inode;
58 	struct sysvbfs_mount *bmp;
59 	struct lockf *lockf;	/* advlock */
60 	daddr_t data_block;
61 	size_t size;
62 	int update_ctime;
63 	int update_atime;
64 	int update_mtime;
65 
66 	LIST_ENTRY(sysvbfs_node) link;
67 };
68 
69 struct sysvbfs_mount {
70 	struct mount *mountp;
71 	struct vnode *devvp;		/* block device mounted vnode */
72 	struct bfs *bfs;
73 	LIST_HEAD(, sysvbfs_node) bnode_head;
74 };
75 
76 /* v-node ops. */
77 int sysvbfs_lookup(void *);
78 int sysvbfs_create(void *);
79 int sysvbfs_open(void *);
80 int sysvbfs_close(void *);
81 int sysvbfs_access(void *);
82 int sysvbfs_getattr(void *);
83 int sysvbfs_setattr(void *);
84 int sysvbfs_read(void *);
85 int sysvbfs_write(void *);
86 int sysvbfs_fsync(void *);
87 int sysvbfs_remove(void *);
88 int sysvbfs_rename(void *);
89 int sysvbfs_readdir(void *);
90 int sysvbfs_inactive(void *);
91 int sysvbfs_reclaim(void *);
92 int sysvbfs_bmap(void *);
93 int sysvbfs_strategy(void *);
94 int sysvbfs_print(void *);
95 int sysvbfs_advlock(void *);
96 int sysvbfs_pathconf(void *);
97 
98 /* vfs ops. */
99 int sysvbfs_mount(struct mount *, const char *, void *, struct nameidata *,
100     struct lwp *);
101 int sysvbfs_start(struct mount *, int, struct lwp *);
102 int sysvbfs_unmount(struct mount *, int, struct lwp *);
103 int sysvbfs_root(struct mount *, struct vnode **);
104 int sysvbfs_quotactl(struct mount *, int, uid_t, void *, struct lwp *);
105 int sysvbfs_statvfs(struct mount *, struct statvfs *, struct lwp *);
106 int sysvbfs_sync(struct mount *, int, kauth_cred_t, struct lwp *);
107 int sysvbfs_vget(struct mount *, ino_t, struct vnode **);
108 int sysvbfs_fhtovp(struct mount *, struct fid *, struct vnode **);
109 int sysvbfs_vptofh(struct vnode *, struct fid *, size_t *);
110 void sysvbfs_init(void);
111 void sysvbfs_reinit(void);
112 void sysvbfs_done(void);
113 
114 extern int (**sysvbfs_vnodeop_p)(void *);
115 
116 /* genfs ops */
117 int sysvbfs_gop_alloc(struct vnode *, off_t, off_t, int, kauth_cred_t);
118 extern const struct genfs_ops sysvbfs_genfsops;
119 
120 /* internal service */
121 int sysvbfs_update(struct vnode *, const struct timespec *,
122     const struct timespec *, int);
123 
124 #endif /* _KERNEL */
125 #endif /* _FS_SYSVBFS_SYSVBFS_H_ */
126