filecore_vfsops.c revision 1.1 1 /* $NetBSD: filecore_vfsops.c,v 1.1 2002/12/23 17:30:41 jdolecek Exp $ */
2
3 /*-
4 * Copyright (c) 1998 Andrew McMurry
5 * Copyright (c) 1994 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * 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 the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * filecore_vfsops.c 1.1 1998/6/26
37 */
38
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: filecore_vfsops.c,v 1.1 2002/12/23 17:30:41 jdolecek Exp $");
41
42 #if defined(_KERNEL_OPT)
43 #include "opt_compat_netbsd.h"
44 #endif
45
46 #include <sys/param.h>
47 #include <sys/systm.h>
48 #include <sys/namei.h>
49 #include <sys/proc.h>
50 #include <sys/vnode.h>
51 #include <miscfs/specfs/specdev.h>
52 #include <sys/mount.h>
53 #include <sys/buf.h>
54 #include <sys/file.h>
55 #include <sys/device.h>
56 #include <sys/errno.h>
57 #include <sys/malloc.h>
58 #include <sys/pool.h>
59 #include <sys/conf.h>
60
61 #include <fs/filecorefs/filecore.h>
62 #include <fs/filecorefs/filecore_extern.h>
63 #include <fs/filecorefs/filecore_node.h>
64 #include <fs/filecorefs/filecore_mount.h>
65
66 extern const struct vnodeopv_desc filecore_vnodeop_opv_desc;
67
68 const struct vnodeopv_desc * const filecore_vnodeopv_descs[] = {
69 &filecore_vnodeop_opv_desc,
70 NULL,
71 };
72
73 struct vfsops filecore_vfsops = {
74 MOUNT_FILECORE,
75 filecore_mount,
76 filecore_start,
77 filecore_unmount,
78 filecore_root,
79 filecore_quotactl,
80 filecore_statfs,
81 filecore_sync,
82 filecore_vget,
83 filecore_fhtovp,
84 filecore_vptofh,
85 filecore_init,
86 filecore_reinit,
87 filecore_done,
88 filecore_sysctl,
89 NULL, /* filecore_mountroot */
90 filecore_checkexp,
91 filecore_vnodeopv_descs,
92 };
93
94 struct genfs_ops filecore_genfsops = {
95 genfs_size,
96 };
97
98 /*
99 * Called by vfs_mountroot when iso is going to be mounted as root.
100 *
101 * Name is updated by mount(8) after booting.
102 */
103
104 static int filecore_mountfs __P((struct vnode *devvp, struct mount *mp,
105 struct proc *p, struct filecore_args *argp));
106
107 #if 0
108 int
109 filecore_mountroot()
110 {
111 struct mount *mp;
112 extern struct vnode *rootvp;
113 struct proc *p = curproc; /* XXX */
114 int error;
115 struct filecore_args args;
116
117 if (root_device->dv_class != DV_DISK)
118 return (ENODEV);
119
120 /*
121 * Get vnodes for swapdev and rootdev.
122 */
123 if (bdevvp(rootdev, &rootvp))
124 panic("filecore_mountroot: can't setup rootvp");
125
126 if ((error = vfs_rootmountalloc(MOUNT_FILECORE, "root_device", &mp)) != 0)
127 return (error);
128
129 args.flags = FILECOREMNT_ROOT;
130 if ((error = filecore_mountfs(rootvp, mp, p, &args)) != 0) {
131 mp->mnt_op->vfs_refcount--;
132 vfs_unbusy(mp);
133 free(mp, M_MOUNT);
134 return (error);
135 }
136 simple_lock(&mountlist_slock);
137 CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
138 simple_unlock(&mountlist_slock);
139 (void)filecore_statfs(mp, &mp->mnt_stat, p);
140 vfs_unbusy(mp);
141 return (0);
142 }
143 #endif
144
145 /*
146 * VFS Operations.
147 *
148 * mount system call
149 */
150 int
151 filecore_mount(mp, path, data, ndp, p)
152 struct mount *mp;
153 const char *path;
154 void *data;
155 struct nameidata *ndp;
156 struct proc *p;
157 {
158 struct vnode *devvp;
159 struct filecore_args args;
160 size_t size;
161 int error;
162 struct filecore_mnt *fcmp = NULL;
163
164 if (mp->mnt_flag & MNT_GETARGS) {
165 fcmp = VFSTOFILECORE(mp);
166 if (fcmp == NULL)
167 return EIO;
168 args.flags = fcmp->fc_mntflags;
169 args.uid = fcmp->fc_uid;
170 args.gid = fcmp->fc_gid;
171 args.fspec = NULL;
172 vfs_showexport(mp, &args.export, &fcmp->fc_export);
173 return copyout(&args, data, sizeof(args));
174 }
175 error = copyin(data, (caddr_t)&args, sizeof (struct filecore_args));
176 if (error)
177 return (error);
178
179 if ((mp->mnt_flag & MNT_RDONLY) == 0)
180 return (EROFS);
181
182 /*
183 * If updating, check whether changing from read-only to
184 * read/write; if there is no device name, that's all we do.
185 */
186 if (mp->mnt_flag & MNT_UPDATE) {
187 fcmp = VFSTOFILECORE(mp);
188 if (args.fspec == 0)
189 return (vfs_export(mp, &fcmp->fc_export, &args.export));
190 }
191 /*
192 * Not an update, or updating the name: look up the name
193 * and verify that it refers to a sensible block device.
194 */
195 NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
196 if ((error = namei(ndp)) != 0)
197 return (error);
198 devvp = ndp->ni_vp;
199
200 if (devvp->v_type != VBLK) {
201 vrele(devvp);
202 return ENOTBLK;
203 }
204 if (bdevsw_lookup(devvp->v_rdev) == NULL) {
205 vrele(devvp);
206 return ENXIO;
207 }
208 /*
209 * If mount by non-root, then verify that user has necessary
210 * permissions on the device.
211 */
212 if (p->p_ucred->cr_uid != 0) {
213 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
214 error = VOP_ACCESS(devvp, VREAD, p->p_ucred, p);
215 VOP_UNLOCK(devvp, 0);
216 if (error) {
217 vrele(devvp);
218 return (error);
219 }
220 }
221 if ((mp->mnt_flag & MNT_UPDATE) == 0)
222 error = filecore_mountfs(devvp, mp, p, &args);
223 else {
224 if (devvp != fcmp->fc_devvp)
225 error = EINVAL; /* needs translation */
226 else
227 vrele(devvp);
228 }
229 if (error) {
230 vrele(devvp);
231 return error;
232 }
233 fcmp = VFSTOFILECORE(mp);
234 (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
235 memset(mp->mnt_stat.f_mntonname + size, 0, MNAMELEN - size);
236 (void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
237 &size);
238 memset(mp->mnt_stat.f_mntfromname + size, 0, MNAMELEN - size);
239 return 0;
240 }
241
242 /*
243 * Common code for mount and mountroot
244 */
245 static int
246 filecore_mountfs(devvp, mp, p, argp)
247 struct vnode *devvp;
248 struct mount *mp;
249 struct proc *p;
250 struct filecore_args *argp;
251 {
252 struct filecore_mnt *fcmp = (struct filecore_mnt *)0;
253 struct buf *bp = NULL;
254 dev_t dev = devvp->v_rdev;
255 int error = EINVAL;
256 int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
257 extern struct vnode *rootvp;
258 struct filecore_disc_record *fcdr;
259 unsigned map;
260 unsigned log2secsize;
261
262 if (!ronly)
263 return EROFS;
264
265 /*
266 * Disallow multiple mounts of the same device.
267 * Disallow mounting of a device that is currently in use
268 * (except for root, which might share swap device for miniroot).
269 * Flush out any old buffers remaining from a previous use.
270 */
271 if ((error = vfs_mountedon(devvp)) != 0)
272 return error;
273 if (vcount(devvp) > 1 && devvp != rootvp)
274 return EBUSY;
275 if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
276 return (error);
277
278 error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
279 if (error)
280 return error;
281
282 /* Read the filecore boot block to check FS validity and to find the map */
283 error = bread(devvp, FILECORE_BOOTBLOCK_BLKN,
284 FILECORE_BOOTBLOCK_SIZE, NOCRED, &bp);
285 #ifdef FILECORE_DEBUG_BR
286 printf("bread(%p, %x, %d, CRED, %p)=%d\n", devvp,
287 FILECORE_BOOTBLOCK_BLKN, FILECORE_BOOTBLOCK_SIZE,
288 bp, error);
289 #endif
290 if (error != 0)
291 goto out;
292 if (filecore_bbchecksum(bp->b_data) != 0) {
293 error = EINVAL;
294 goto out;
295 }
296 fcdr = (struct filecore_disc_record *)(bp->b_data+FILECORE_BB_DISCREC);
297 map = ((((8 << fcdr->log2secsize) - fcdr->zone_spare)
298 * (fcdr->nzones / 2) - 8 * FILECORE_DISCREC_SIZE)
299 << fcdr->log2bpmb) >> fcdr->log2secsize;
300 log2secsize = fcdr->log2secsize;
301 bp->b_flags |= B_AGE;
302 #ifdef FILECORE_DEBUG_BR
303 printf("brelse(%p) vf1\n", bp);
304 #endif
305 brelse(bp);
306 bp = NULL;
307
308 /* Read the bootblock in the map */
309 error = bread(devvp, map, 1 << log2secsize, NOCRED, &bp);
310 #ifdef FILECORE_DEBUG_BR
311 printf("bread(%p, %x, %d, CRED, %p)=%d\n", devvp,
312 map, 1 << log2secsize, bp, error);
313 #endif
314 if (error != 0)
315 goto out;
316 fcdr = (struct filecore_disc_record *)(bp->b_data + 4);
317 fcmp = malloc(sizeof *fcmp, M_FILECOREMNT, M_WAITOK);
318 memset((caddr_t)fcmp, 0, sizeof *fcmp);
319 if (fcdr->log2bpmb > fcdr->log2secsize)
320 fcmp->log2bsize = fcdr->log2bpmb;
321 else fcmp->log2bsize = fcdr->log2secsize;
322 fcmp->blksize = 1 << fcmp->log2bsize;
323 memcpy((caddr_t)&fcmp->drec, (caddr_t)fcdr, sizeof(*fcdr));
324 fcmp->map = map;
325 fcmp->idspz = ((8 << fcdr->log2secsize) - fcdr->zone_spare)
326 / (fcdr->idlen + 1);
327 fcmp->mask = (1 << fcdr->idlen) - 1;
328 if (fcdr->big_flag & 1) {
329 fcmp->nblks = ((((u_int64_t)fcdr->disc_size_2) << 32)
330 + fcdr->disc_size) / fcmp->blksize;
331 } else {
332 fcmp->nblks=fcdr->disc_size / fcmp->blksize;
333 }
334
335 bp->b_flags |= B_AGE;
336 #ifdef FILECORE_DEBUG_BR
337 printf("brelse(%p) vf2\n", bp);
338 #endif
339 brelse(bp);
340 bp = NULL;
341
342 mp->mnt_data = fcmp;
343 mp->mnt_stat.f_fsid.val[0] = (long)dev;
344 mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_FILECORE);
345 mp->mnt_maxsymlinklen = 0;
346 mp->mnt_flag |= MNT_LOCAL;
347 mp->mnt_dev_bshift = fcdr->log2secsize;
348 mp->mnt_fs_bshift = fcmp->log2bsize;
349
350 fcmp->fc_mountp = mp;
351 fcmp->fc_dev = dev;
352 fcmp->fc_devvp = devvp;
353 fcmp->fc_mntflags = argp->flags;
354 if (argp->flags & FILECOREMNT_USEUID) {
355 fcmp->fc_uid = p->p_cred->p_ruid;
356 fcmp->fc_gid = p->p_cred->p_rgid;
357 } else {
358 fcmp->fc_uid = argp->uid;
359 fcmp->fc_gid = argp->gid;
360 }
361
362 return 0;
363 out:
364 if (bp) {
365 #ifdef FILECORE_DEBUG_BR
366 printf("brelse(%p) vf3\n", bp);
367 #endif
368 brelse(bp);
369 }
370 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
371 (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
372 VOP_UNLOCK(devvp, 0);
373 if (fcmp) {
374 free((caddr_t)fcmp, M_FILECOREMNT);
375 mp->mnt_data = NULL;
376 }
377 return error;
378 }
379
380 /*
381 * Make a filesystem operational.
382 * Nothing to do at the moment.
383 */
384 /* ARGSUSED */
385 int
386 filecore_start(mp, flags, p)
387 struct mount *mp;
388 int flags;
389 struct proc *p;
390 {
391 return 0;
392 }
393
394 /*
395 * unmount system call
396 */
397 int
398 filecore_unmount(mp, mntflags, p)
399 struct mount *mp;
400 int mntflags;
401 struct proc *p;
402 {
403 struct filecore_mnt *fcmp;
404 int error, flags = 0;
405
406 if (mntflags & MNT_FORCE)
407 flags |= FORCECLOSE;
408 #if 0
409 mntflushbuf(mp, 0);
410 if (mntinvalbuf(mp))
411 return EBUSY;
412 #endif
413 if ((error = vflush(mp, NULLVP, flags)) != 0)
414 return (error);
415
416 fcmp = VFSTOFILECORE(mp);
417
418 if (fcmp->fc_devvp->v_type != VBAD)
419 fcmp->fc_devvp->v_specmountpoint = NULL;
420 vn_lock(fcmp->fc_devvp, LK_EXCLUSIVE | LK_RETRY);
421 error = VOP_CLOSE(fcmp->fc_devvp, FREAD, NOCRED, p);
422 vput(fcmp->fc_devvp);
423 free((caddr_t)fcmp, M_FILECOREMNT);
424 mp->mnt_data = NULL;
425 mp->mnt_flag &= ~MNT_LOCAL;
426 return (error);
427 }
428
429 /*
430 * Return root of a filesystem
431 */
432 int
433 filecore_root(mp, vpp)
434 struct mount *mp;
435 struct vnode **vpp;
436 {
437 struct vnode *nvp;
438 int error;
439
440 if ((error = VFS_VGET(mp, FILECORE_ROOTINO, &nvp)) != 0)
441 return (error);
442 *vpp = nvp;
443 return (0);
444 }
445
446 /*
447 * Do operations associated with quotas, not supported
448 */
449 /* ARGSUSED */
450 int
451 filecore_quotactl(mp, cmd, uid, arg, p)
452 struct mount *mp;
453 int cmd;
454 uid_t uid;
455 caddr_t arg;
456 struct proc *p;
457 {
458
459 return (EOPNOTSUPP);
460 }
461
462 /*
463 * Get file system statistics.
464 */
465 int
466 filecore_statfs(mp, sbp, p)
467 struct mount *mp;
468 struct statfs *sbp;
469 struct proc *p;
470 {
471 struct filecore_mnt *fcmp = VFSTOFILECORE(mp);
472
473 #ifdef COMPAT_09
474 sbp->f_type = 255;
475 #else
476 sbp->f_type = 0;
477 #endif
478 sbp->f_bsize = fcmp->blksize;
479 sbp->f_iosize = sbp->f_bsize; /* XXX */
480 sbp->f_blocks = fcmp->nblks;
481 sbp->f_bfree = 0; /* total free blocks */
482 sbp->f_bavail = 0; /* blocks free for non superuser */
483 sbp->f_files = 0; /* total files */
484 sbp->f_ffree = 0; /* free file nodes */
485 if (sbp != &mp->mnt_stat) {
486 memcpy(sbp->f_mntonname, mp->mnt_stat.f_mntonname, MNAMELEN);
487 memcpy(sbp->f_mntfromname, mp->mnt_stat.f_mntfromname, MNAMELEN);
488 }
489 strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name, MFSNAMELEN);
490 return 0;
491 }
492
493 /* ARGSUSED */
494 int
495 filecore_sync(mp, waitfor, cred, p)
496 struct mount *mp;
497 int waitfor;
498 struct ucred *cred;
499 struct proc *p;
500 {
501 return (0);
502 }
503
504 /*
505 * File handle to vnode
506 *
507 * Have to be really careful about stale file handles:
508 * - check that the inode number is in range
509 * - call iget() to get the locked inode
510 * - check for an unallocated inode (i_mode == 0)
511 * - check that the generation number matches
512 */
513
514 struct ifid {
515 ushort ifid_len;
516 ushort ifid_pad;
517 u_int32_t ifid_ino;
518 };
519
520 /* ARGSUSED */
521 int
522 filecore_fhtovp(mp, fhp, vpp)
523 struct mount *mp;
524 struct fid *fhp;
525 struct vnode **vpp;
526 {
527 struct ifid *ifhp = (struct ifid *)fhp;
528 struct vnode *nvp;
529 struct filecore_node *ip;
530 int error;
531
532 if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) {
533 *vpp = NULLVP;
534 return (error);
535 }
536 ip = VTOI(nvp);
537 if (filecore_staleinode(ip)) {
538 vput(nvp);
539 *vpp = NULLVP;
540 return (ESTALE);
541 }
542 *vpp = nvp;
543 return (0);
544 }
545
546 /* ARGSUSED */
547 int
548 filecore_checkexp(mp, nam, exflagsp, credanonp)
549 struct mount *mp;
550 struct mbuf *nam;
551 int *exflagsp;
552 struct ucred **credanonp;
553 {
554 struct filecore_mnt *fcmp = VFSTOFILECORE(mp);
555 struct netcred *np;
556
557 /*
558 * Get the export permission structure for this <mp, client> tuple.
559 */
560 np = vfs_export_lookup(mp, &fcmp->fc_export, nam);
561 if (np == NULL)
562 return (EACCES);
563
564 *exflagsp = np->netc_exflags;
565 *credanonp = &np->netc_anon;
566 return (0);
567 }
568
569 /* This looks complicated. Look at other vgets as well as the iso9660 one.
570 *
571 * The filecore inode number is made up of 1 byte directory entry index and
572 * 3 bytes of the internal disc address of the directory. On a read-only
573 * filesystem this is unique. For a read-write version we may not be able to
574 * do vget, see msdosfs.
575 */
576
577 int
578 filecore_vget(mp, ino, vpp)
579 struct mount *mp;
580 ino_t ino;
581 struct vnode **vpp;
582 {
583 struct filecore_mnt *fcmp;
584 struct filecore_node *ip;
585 struct buf *bp;
586 struct vnode *vp;
587 dev_t dev;
588 int error;
589
590 fcmp = VFSTOFILECORE(mp);
591 dev = fcmp->fc_dev;
592 if ((*vpp = filecore_ihashget(dev, ino)) != NULLVP)
593 return (0);
594
595 /* Allocate a new vnode/filecore_node. */
596 if ((error = getnewvnode(VT_FILECORE, mp, filecore_vnodeop_p, &vp))
597 != 0) {
598 *vpp = NULLVP;
599 return (error);
600 }
601 ip = pool_get(&filecore_node_pool, PR_WAITOK);
602 memset(ip, 0, sizeof(struct filecore_node));
603 vp->v_data = ip;
604 ip->i_vnode = vp;
605 ip->i_dev = dev;
606 ip->i_number = ino;
607 ip->i_block = -1;
608 ip->i_parent = -2;
609
610 /*
611 * Put it onto its hash chain and lock it so that other requests for
612 * this inode will block if they arrive while we are sleeping waiting
613 * for old data structures to be purged or for the contents of the
614 * disk portion of this inode to be read.
615 */
616 filecore_ihashins(ip);
617
618 if (ino == FILECORE_ROOTINO) {
619 /* Here we need to construct a root directory inode */
620 memcpy((caddr_t)ip->i_dirent.name, (caddr_t)"root", 4);
621 ip->i_dirent.load = 0;
622 ip->i_dirent.exec = 0;
623 ip->i_dirent.len = FILECORE_DIR_SIZE;
624 ip->i_dirent.addr = fcmp->drec.root;
625 ip->i_dirent.attr = FILECORE_ATTR_DIR | FILECORE_ATTR_READ;
626
627 } else {
628 /* Read in Data from Directory Entry */
629 if ((error = filecore_bread(fcmp, ino & FILECORE_INO_MASK,
630 FILECORE_DIR_SIZE, NOCRED, &bp)) != 0) {
631 vput(vp);
632 #ifdef FILECORE_DEBUG_BR
633 printf("brelse(%p) vf4\n", bp);
634 #endif
635 brelse(bp);
636 *vpp = NULL;
637 return (error);
638 }
639
640 memcpy((caddr_t)&ip->i_dirent,
641 (caddr_t)fcdirentry(bp->b_data, ino >> FILECORE_INO_INDEX),
642 sizeof(struct filecore_direntry));
643 #ifdef FILECORE_DEBUG_BR
644 printf("brelse(%p) vf5\n", bp);
645 #endif
646 brelse(bp);
647 }
648
649 ip->i_mnt = fcmp;
650 ip->i_devvp = fcmp->fc_devvp;
651 ip->i_diroff = 0;
652 VREF(ip->i_devvp);
653
654 /*
655 * Setup type
656 */
657 vp->v_type = VREG;
658 if (ip->i_dirent.attr & FILECORE_ATTR_DIR)
659 vp->v_type = VDIR;
660
661 /*
662 * Initialize the associated vnode
663 */
664 switch (vp->v_type) {
665 case VFIFO:
666 case VCHR:
667 case VBLK:
668 /*
669 * Devices not supported.
670 */
671 vput(vp);
672 return (EOPNOTSUPP);
673 case VLNK:
674 case VNON:
675 case VSOCK:
676 case VDIR:
677 case VBAD:
678 case VREG:
679 break;
680 }
681
682 if (ino == FILECORE_ROOTINO)
683 vp->v_flag |= VROOT;
684
685 /*
686 * XXX need generation number?
687 */
688
689 genfs_node_init(vp, &filecore_genfsops);
690 vp->v_size = ip->i_size;
691 *vpp = vp;
692 return (0);
693 }
694
695 /*
696 * Vnode pointer to File handle
697 */
698 /* ARGSUSED */
699 int
700 filecore_vptofh(vp, fhp)
701 struct vnode *vp;
702 struct fid *fhp;
703 {
704 struct filecore_node *ip = VTOI(vp);
705 struct ifid *ifhp;
706
707 ifhp = (struct ifid *)fhp;
708 ifhp->ifid_len = sizeof(struct ifid);
709 ifhp->ifid_ino = ip->i_number;
710 return 0;
711 }
712
713 int
714 filecore_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
715 int *name;
716 u_int namelen;
717 void *oldp;
718 size_t *oldlenp;
719 void *newp;
720 size_t newlen;
721 struct proc *p;
722 {
723 return (EOPNOTSUPP);
724 }
725