xref: /f-stack/lib/ff_vfs_ops.c (revision 22ce4aff)
1 /*
2  * Copyright (c) 2011 Kip Macy. All rights reserved.
3  * Copyright (C) 2017 THL A29 Limited, a Tencent company.
4  * 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 are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice, this
10  *   list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright notice,
12  *   this list of conditions and the following disclaimer in the documentation
13  *   and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * Derived in part from libplebnet's pn_vfs_ops.c.
27  */
28 
29 #include <sys/cdefs.h>
30 #include <sys/param.h>
31 #include <sys/types.h>
32 #include <sys/limits.h>
33 #include <sys/malloc.h>
34 #include <sys/namei.h>
35 #include <sys/refcount.h>
36 #include <sys/resourcevar.h>
37 #include <sys/systm.h>
38 #include <sys/proc.h>
39 #include <sys/priv.h>
40 #include <sys/time.h>
41 #include <sys/ucred.h>
42 #include <sys/vnode.h>
43 #include <sys/uio.h>
44 #include <sys/file.h>
45 #include <sys/capsicum.h>
46 
47 __read_frequently smr_t vfs_smr;
48 
49 void
50 NDFREE(struct nameidata *ndp, const u_int flags)
51 {
52 
53 }
54 
55 int
56 vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp)
57 {
58     panic("vn_open not implemented");
59 
60     return (0);
61 }
62 
63 
64 int
65 vn_close(struct vnode *vp,
66         int flags, struct ucred *file_cred, struct thread *td)
67 {
68     panic("vn_close not implemented");
69 
70     return (0);
71 }
72 
73 
74 int
75 vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base,
76         int len, off_t offset, enum uio_seg segflg, int ioflg,
77         struct ucred *active_cred, struct ucred *file_cred, ssize_t *aresid,
78         struct thread *td)
79 {
80     panic("vn_rdwr not implemented");
81 
82     return (0);
83 }
84 
85 int
86 vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif)
87 {
88     panic("vn_fill_kinfo_vnode not implemented");
89 
90     return (0);
91 }
92 
93 #if 0
94 void
95 NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg,
96     const char *namep, int dirfd, struct vnode *startdir, cap_rights_t *rightsp,
97     struct thread *td)
98 {
99 
100     ndp->ni_cnd.cn_nameiop = op;
101     ndp->ni_cnd.cn_flags = flags;
102     ndp->ni_segflg = segflg;
103     ndp->ni_dirp = namep;
104     ndp->ni_dirfd = dirfd;
105     ndp->ni_startdir = startdir;
106     ndp->ni_strictrelative = 0;
107     if (rightsp != NULL)
108         ndp->ni_rightsneeded = *rightsp;
109     else
110         cap_rights_init(&ndp->ni_rightsneeded);
111     filecaps_init(&ndp->ni_filecaps);
112     ndp->ni_cnd.cn_thread = td;
113 }
114 #endif
115 
116