socsvn commit: r255075 - soc2013/oleksandr/ports/emulators/virtualbox-ose-additions/files
oleksandr at FreeBSD.org
oleksandr at FreeBSD.org
Tue Jul 23 17:36:27 UTC 2013
Author: oleksandr
Date: Tue Jul 23 17:36:27 2013
New Revision: 255075
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255075
Log:
Add vboxvfs_proc functionality from Solaris port of virtualbox guest additions
Added:
soc2013/oleksandr/ports/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-freebsd.kmk
Deleted:
soc2013/oleksandr/ports/emulators/virtualbox-ose-additions/files/patch-src-Vbox-Additions-freebsd.kmk
Added: soc2013/oleksandr/ports/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-freebsd.kmk
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ soc2013/oleksandr/ports/emulators/virtualbox-ose-additions/files/patch-src-VBox-Additions-freebsd.kmk Tue Jul 23 17:36:27 2013 (r255075)
@@ -0,0 +1,2584 @@
+Index: src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c
+===================================================================
+--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c (revision 4)
++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vnops.c (working copy)
+@@ -14,8 +14,7 @@
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+-
+-#include "vboxvfs.h"
++#if 0
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/namei.h>
+@@ -33,7 +32,28 @@
+
+ #include <vm/vm.h>
+ #include <vm/vm_extern.h>
++#endif
++#include <sys/param.h>
++#include <sys/systm.h>
++#include <sys/namei.h>
++#include <sys/kernel.h>
++#include <sys/malloc.h>
++#include <sys/stat.h>
++#include <sys/bio.h>
++#include <sys/conf.h>
++#include <sys/buf.h>
++#include <sys/iconv.h>
++#include <sys/mount.h>
++#include <sys/vnode.h>
++#include <sys/dirent.h>
++#include <sys/queue.h>
++#include <sys/unistd.h>
++#include <sys/endian.h>
+
++#include <vm/uma.h>
++
++#include "vboxvfs.h"
++
+ /*
+ * Prototypes for VBOXVFS vnode operations
+ */
+@@ -56,6 +76,7 @@
+ static vop_symlink_t vboxvfs_symlink;
+ static vop_readdir_t vboxvfs_readdir;
+ static vop_strategy_t vboxvfs_strategy;
++static vop_bmap_t vboxvfs_bmap;
+ static vop_print_t vboxvfs_print;
+ static vop_pathconf_t vboxvfs_pathconf;
+ static vop_advlock_t vboxvfs_advlock;
+@@ -65,177 +86,633 @@
+ static vop_inactive_t vboxvfs_inactive;
+ static vop_putpages_t vboxvfs_putpages;
+ static vop_reclaim_t vboxvfs_reclaim;
++static vop_vptofh_t vboxvfs_vptofh;
+
+ struct vop_vector vboxvfs_vnodeops = {
+- .vop_default = &default_vnodeops,
++ .vop_default = &default_vnodeops,
+
+- .vop_access = vboxvfs_access,
+- .vop_advlock = vboxvfs_advlock,
+- .vop_close = vboxvfs_close,
+- .vop_create = vboxvfs_create,
+- .vop_fsync = vboxvfs_fsync,
+- .vop_getattr = vboxvfs_getattr,
+- .vop_getextattr = vboxvfs_getextattr,
+- .vop_getpages = vboxvfs_getpages,
+- .vop_inactive = vboxvfs_inactive,
+- .vop_ioctl = vboxvfs_ioctl,
+- .vop_link = vboxvfs_link,
+- .vop_lookup = vboxvfs_lookup,
+- .vop_mkdir = vboxvfs_mkdir,
+- .vop_mknod = vboxvfs_mknod,
+- .vop_open = vboxvfs_open,
+- .vop_pathconf = vboxvfs_pathconf,
+- .vop_print = vboxvfs_print,
+- .vop_putpages = vboxvfs_putpages,
+- .vop_read = vboxvfs_read,
+- .vop_readdir = vboxvfs_readdir,
+- .vop_reclaim = vboxvfs_reclaim,
+- .vop_remove = vboxvfs_remove,
+- .vop_rename = vboxvfs_rename,
+- .vop_rmdir = vboxvfs_rmdir,
+- .vop_setattr = vboxvfs_setattr,
+- .vop_strategy = vboxvfs_strategy,
+- .vop_symlink = vboxvfs_symlink,
+- .vop_write = vboxvfs_write,
++ .vop_access = vboxvfs_access,
++ .vop_bmap = vboxvfs_bmap,
++ .vop_advlock = vboxvfs_advlock,
++ .vop_close = vboxvfs_close,
++ .vop_create = vboxvfs_create,
++ .vop_fsync = vboxvfs_fsync,
++ .vop_getattr = vboxvfs_getattr,
++ .vop_getextattr = vboxvfs_getextattr,
++ .vop_getpages = vboxvfs_getpages,
++ .vop_inactive = vboxvfs_inactive,
++ .vop_ioctl = vboxvfs_ioctl,
++ .vop_link = vboxvfs_link,
++ .vop_lookup = vboxvfs_lookup,
++ .vop_mkdir = vboxvfs_mkdir,
++ .vop_mknod = vboxvfs_mknod,
++ .vop_open = vboxvfs_open,
++ .vop_pathconf = vboxvfs_pathconf,
++ .vop_print = vboxvfs_print,
++ .vop_putpages = vboxvfs_putpages,
++ .vop_read = vboxvfs_read,
++ .vop_readdir = vboxvfs_readdir,
++ .vop_reclaim = vboxvfs_reclaim,
++ .vop_remove = vboxvfs_remove,
++ .vop_rename = vboxvfs_rename,
++ .vop_rmdir = vboxvfs_rmdir,
++ .vop_setattr = vboxvfs_setattr,
++ .vop_strategy = vboxvfs_strategy,
++ .vop_vptofh = vboxvfs_vptofh,
++ .vop_symlink = vboxvfs_symlink,
++ .vop_write = vboxvfs_write,
+ };
+
+ static int vboxvfs_access(struct vop_access_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp;
++ accmode_t accmode;
++
++ vp = ap->a_vp;
++ accmode = ap->a_accmode;
++
++ if (accmode & VWRITE) {
++ switch (vp->v_type) {
++ case VDIR:
++ case VLNK:
++ case VREG:
++ return (EROFS);
++ /* NOT REACHED */
++ default:
++ break;
++ }
++ }
++
++ return (vaccess(vp->v_type, 0444, 0, 0,
++ accmode, ap->a_cred, NULL));
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_open(struct vop_open_args *ap)
+ {
+- return 0;
++#if 0
++ struct vboxvfs_node *np = VTON(ap->a_vp);
++ off_t fsize;
++
++ fsize = np->vboxvfsmp->size;
++ vnode_create_vobject(ap->a_vp, fsize, ap->a_td);
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_close(struct vop_close_args *ap)
+ {
+- return 0;
++#if 0
++ int rc;
++
++ rc = vboxCallClose(&vbox_client, &fp->map, fp->handle);
++ kmem_free(fp, sizeof(sfp_file_t));
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_getattr(struct vop_getattr_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp;
++ struct vboxvfs_node *node;
++ struct vattr *vap;
++ struct timespec ts;
++
++ ts.tv_sec = 0;
++
++ vp = ap->a_vp;
++ vap = ap->a_vap;
++ node = VTON(vp);
++
++ vap->va_fsid = dev2udev(nodevgmp->im_dev);
++ vap->va_fileid = node->hash_id;
++ vap->va_uid = 0;
++ vap->va_gid = 0;
++ vap->va_atime.tv_sec = VNOVAL;
++ vap->va_atime.tv_nsec = VNOVAL;
++ vap->va_mtime.tv_sec = VNOVAL;
++ vap->va_mtime.tv_nsec = VNOVAL;
++ vap->va_ctime.tv_sec = VNOVAL;
++ vap->va_ctime.tv_nsec = VNOVAL;
++ vap->va_rdev = NODEV;
++ if (vp->v_type & VDIR) {
++ vap->va_size = 40; /*XXX*/
++ vap->va_nlink = 2;
++ vap->va_mode = 0555;
++ } else {
++ vap->va_size = node->vboxvfsmp->size;
++ vap->va_nlink = 1;
++ vap->va_mode = 0444;
++ }
++ vap->va_flags = 0;
++ vap->va_gen = 1;
++ vap->va_blocksize = node->vboxvfsmp->bsize;
++ vap->va_bytes = vap->va_size;
++ vap->va_type = vp->v_type;
++ vap->va_filerev = 0;
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_setattr(struct vop_setattr_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp;
++ struct vattr *vap;
++
++ vp = ap->a_vp;
++ vap = ap->a_vap;
++ if (vap->va_flags != (u_long)VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
++ vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
++ vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL)
++ return (EROFS);
++ if (vap->va_size != (u_quad_t)VNOVAL) {
++ switch (vp->v_type) {
++ case VDIR:
++ return (EISDIR);
++ case VLNK:
++ case VREG:
++ return (EROFS);
++ case VCHR:
++ case VBLK:
++ case VSOCK:
++ case VFIFO:
++ case VNON:
++ case VBAD:
++ case VMARKER:
++ return (0);
++ }
++ }
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_read(struct vop_read_args *ap)
+ {
+- return 0;
++#if 0
++ static const int clustersize = MAXBSIZE;
++
++ struct vnode *vp = ap->a_vp;
++ struct uio *uio = ap->a_uio;
++ struct vboxvfs_node *node = VTON(vp);
++ struct vboxvfs_mnt *vboxvfsmp;
++ struct buf *bp;
++ daddr_t lbn;
++ off_t diff, fsize;
++ int error = 0;
++ long size, n, on;
++
++ if (uio->uio_resid == 0)
++ return (0);
++ if (uio->uio_offset < 0)
++ return (EINVAL);
++
++ if (vp->v_type == VCHR || vp->v_type == VBLK)
++ return (EOPNOTSUPP);
++ if (vp->v_type != VREG)
++ return (EINVAL);
++
++ vboxvfsmp = node->vboxvfsmp;
++ fsize = vboxvfsmp->size;
++
++ do {
++ lbn = lblkno(vboxvfsmp, uio->uio_offset);
++ on = blkoff(vboxvfsmp, uio->uio_offset);
++ n = min((u_int)(clustersize - on), uio->uio_resid);
++ diff = fsize - uio->uio_offset;
++ if (diff <= 0)
++ return (0);
++ if (diff < n)
++ n = diff;
++
++ size = (n + vboxvfsmp->bmask) & ~vboxvfsmp->bmask;
++ if (vboxvfsmp->use_devvp)
++ error = bread(vboxvfsmp->im_devvp,
++ lbn << (vboxvfsmp->bshift - DEV_BSHIFT),
++ size, NOCRED, &bp);
++ else
++ error = bread(vp, lbn, size, NOCRED, &bp);
++
++ n = min(n, size - bp->b_resid);
++ if (error) {
++ brelse(bp);
++ return (error);
++ }
++ error = uiomove(bp->b_data + on, (int)n, uio);
++ brelse(bp);
++ } while (error == 0 && uio->uio_resid > 0 && n != 0);
++ return (error);
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_write(struct vop_write_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_create(struct vop_create_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_remove(struct vop_remove_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_rename(struct vop_rename_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_link(struct vop_link_args *ap)
+ {
+- return EOPNOTSUPP;
++ return (EOPNOTSUPP);
+ }
+
+ static int vboxvfs_symlink(struct vop_symlink_args *ap)
+ {
+- return EOPNOTSUPP;
++ return (EOPNOTSUPP);
+ }
+
+ static int vboxvfs_mknod(struct vop_mknod_args *ap)
+ {
+- return EOPNOTSUPP;
++ return (EOPNOTSUPP);
+ }
+
+ static int vboxvfs_mkdir(struct vop_mkdir_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_rmdir(struct vop_rmdir_args *ap)
+ {
+- return 0;
++ return (0);
+ }
++#if 0
++struct vboxvfs_uiodir {
++ struct dirent *dirent;
++ u_long *cookies;
++ int ncookies;
++ int acookies;
++ int eofflag;
++};
+
++static int
++vboxvfs_uiodir(struct vboxvfs_uiodir *uiodir, int de_size, struct uio *uio, long cookie)
++{
++ if (uiodir->cookies != NULL) {
++ if (++uiodir->acookies > uiodir->ncookies) {
++ uiodir->eofflag = 0;
++ return (-1);
++ }
++ *uiodir->cookies++ = cookie;
++ }
++
++ if (uio->uio_resid < de_size) {
++ uiodir->eofflag = 0;
++ return (-1);
++ }
++
++ return (uiomove(uiodir->dirent, de_size, uio));
++}
++#endif
+ static int vboxvfs_readdir(struct vop_readdir_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp;
++ struct uio *uio;
++ struct dirent dir;
++ struct vboxvfs_node *node;
++ struct vboxvfs_mnt *vboxvfsmp;
++ struct vboxvfs_uiodir uiodir;
++ u_long *cookies = NULL;
++ int ncookies;
++ int error = 0;
++
++ vp = ap->a_vp;
++ uio = ap->a_uio;
++ node = VTON(vp);
++ vboxvfsmp = node->vboxvfsmp;
++ uiodir.eofflag = 1;
++
++ if (a->a_ncookies != NULL) {
++ /*
++ * Guess how many entries are needed. If we run out, this
++ * function will be called again and thing will pick up were
++ * it left off.
++ */
++ ncookies = uio->uio_resid / 8;
++ cookies = malloc(sizeof(u_long) * ncookies,
++ M_TEMP, M_WAITOK);
++ if (cookies == NULL)
++ return (ENOMEM);
++ uiodir.ncookies = ncookies;
++ uiodir.cookies = cookies;
++ uiodir.acookies = 0;
++ } else {
++ uiodir.cookies = NULL;
++ }
++
++ /* Do up the '.' and '..' entries. Dummy values are
++ * used for the cookies since the offset here is
++ * usually zero, and NFS doesn't like that value
++ */
++ if (uio->uio_offset == 0) {
++ dir.d_fileno = node->hash_id; /* AVG_ROOTDIR_INO */
++ dir.d_type = DT_DIR;
++ dir.d_name[0] = '.';
++ dir.d_name[1] = '\0';
++ dir.d_namlen = 1;
++ dir.d_reclen = GENERIC_DIRSIZ(&dir);
++ uiodir.dirent = &dir;
++ error = vboxvfs_uiodir(&uiodir, dir.d_reclen, uio, 1);
++ if (error)
++ goto finished;
++
++ dir.d_fileno = node->hash_id; /* AVG_ROOTDIR_INO */
++ dir.d_type = DT_DIR;
++ dir.d_name[0] = '.';
++ dir.d_name[1] = '.';
++ dir.d_name[2] = '\0';
++ dir.d_namlen = 2;
++ dir.d_reclen = GENERIC_DIRSIZ(&dir);
++ uiodir.dirent = &dir;
++ error = vboxvfs_uiodir(&uiodir, dir.d_reclen, uio, 2);
++ if (error)
++ goto finished;
++
++ strcpy(&dir.d_name[0], AVG_THEFILE_NAME);
++ dir.d_namlen = strlen(AVG_THEFILE_NAME);
++ dir.d_fileno = AVG_THEFILE_INO;
++ dir.d_type = DT_REG;
++ dir.d_reclen = GENERIC_DIRSIZ(&dir);
++ uiodir.dirent = &dir;
++ error = vboxvfs_uiodir(&uiodir, dir.d_reclen, uio, 3);
++ if (error)
++ goto finished;
++ }
++
++finished:
++
++ /* tell the calling layer whether we need to be called again */
++ *ap->a_eofflag = uiodir.eofflag;
++
++ if (error < 0)
++ error = 0;
++
++ if (ap-g>a_ncookies != NULL) {
++ if (error)
++ free(cookies, M_TEMP);
++ else {
++ *ap->a_ncookies = uiodir.acookies;
++ *ap->a_cookies = cookies;
++ }
++ }
++
++ return (error);
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_fsync(struct vop_fsync_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_print (struct vop_print_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp = ap->a_vp;
++ struct vboxvfs_node *node;
++
++ node = VTON(vp);
++ printf(" ino %lu, on dev %s", (u_long)node->hash_id,
++ devtoname(node->vboxvfsmp->im_dev));
++ printf("\n");
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_pathconf (struct vop_pathconf_args *ap)
+ {
+- return 0;
++#if 0
++ switch (ap->a_name) {
++ case _PC_LINK_MAX:
++ *ap->a_retval = 65535;
++ return (0);
++ case _PC_NAME_MAX:
++ i *ap->a_retval = NAME_MAX;
++ return (0);
++ case _PC_PATH_MAX:
++ *ap->a_retval = PATH_MAX;
++ return (0);
++ case _PC_NO_TRUNC:
++ *ap->a_retval = 1;
++ return (0);
++ default:
++ return (EINVAL);
++ }
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_strategy (struct vop_strategy_args *ap)
+ {
+- return 0;
++#if 0
++ struct buf *bp;
++ struct vnode *vp;
++ struct vboxvfs_node *node;
++ struct bufobj *bo;
++
++ bp = ap->a_bp;
++ vp = ap->a_vp;
++ node = VTON(vp);
++
++ if (bp->b_blkno == bp->b_lblkno) {
++ bp->b_blkno = bp->b_lblkno << (node->vboxvfsmp->bshift - DEV_BSHIFT);
++ }
++ bo = node->vboxfsmp->im_bo;
++ bp->b_iooffset = dbtob(bp->b_blkno);
++ BO_STRATEGY(bo, bp);
++#endif
++ return (0);
+ }
+
++static int
++vboxvfs_bmap(struct vop_bmap_args *ap)
++{
++#if 0
++ struct vboxvfs_node *node;
++
++ node = VTON(ap->a_vp);
++
++ if (ap->a_bop != NULL)
++ *ap->a_bop = &node->vboxvfsmp->im_devvp->v_bufobj;
++ if (ap->a_bnp == NULL)
++ return (0);
++ if (ap->a_runb)
++ *ap->a_runb = 0;
++
++ /* Translate logical to physical sector number */
++ *ap->a_bnp = ap->a_bn << (node->vboxvfsmp->bshift - DEV_BSHIFT);
++
++ if (ap->a_runp)
++ *ap->a_runp = 0;
++ if (ap->a_runb)
++ *ap->a_runb = 0;
++#endif
++ return (0);
++}
++
++/*
++ * File specific ioctls.
++ */
+ static int vboxvfs_ioctl(struct vop_ioctl_args *ap)
+ {
+- return ENOTTY;
++ printf("%s called\n", __func__);
++ return (ENOTTY);
+ }
+
+ static int vboxvfs_getextattr(struct vop_getextattr_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_advlock(struct vop_advlock_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_lookup(struct vop_lookup_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *dvp;
++ struct vnode *tdp = NULL;
++ struct vnode **vpp = ap->a_vpp;
++ struct vboxvfs_node *node;
++ struct vboxvfs_mnt *vboxvfsmp;
++ u_long nameiop;
++ u_long flags;
++ char *nameptr;
++ long namelen;
++ ino_t id = 0;
++ int offset, error = 0;
++ int lkflags, ltype;
++
++ dvp = ap->a_dvp;
++ node = VTON(dvp);
++ vboxvfsmp = node->vboxvfsmp;
++ nameiop = ap->a_cnp->cn_nameiop;
++ flags = ap->a_cnp->cn_flags;
++ lkflags = ap->a_cnp->cn_lkflags;
++ nameptr = ap->a_cnp->cn_nameptr;
++ namelen = ap->a_cnp->cn_namelen;
++
++ offset = 0;
++
++ if (strcmp(nameptr, AVG_THEFILE_NAME) == 0)
++ id = AVG_THEFILE_INO;
++ else if (flags & ISDOTDOT)
++ id = AVG_ROOTDIR_INO;
++
++ /* Did we have a match? */
++ if (id) {
++ if (flags & ISDOTDOT) {
++ error = vn_vget_ino(dvp, id, lkflags, &tdp);
++ } else if (node->hash_id == id) {
++ VREF(dvp); /* we want ourself, ie "." */
++ /*
++ * When we lookup "." we still can be asked to lock it
++ * differently.
++ */
++ ltype = lkflags & LK_TYPE_MASK;
++ if (ltype != VOP_ISLOCKED(dvp)) {
++ if (ltype == LK_EXCLUSIVE)
++ vn_lock(dvp, LK_UPGRADE | LK_RETRY);
++ else /* if (ltype == LK_SHARED) */
++ vn_lock(dvp, LK_DOWNGRADE | LK_RETRY);
++ }
++ tdp = dvp;
++ } else
++ error = vboxvfs_vget(vboxvfsmp->im_mountp, id, lkflags, &tdp);
++ if (!error) {
++ *vpp = tdp;
++ /* Put this entry in the cache */
++ if (flags & MAKEENTRY)
++ cache_enter(dvp, *vpp, ap->a_cnp);
++ }
++ } else {
++ /* Enter name into cache as non-existant */
++ if (flags & MAKEENTRY)
++ cache_enter(dvp, *vpp, ap->a_cnp);
++
++ if ((flags & ISLASTCN) &&
++ (nameiop == CREATE || nameiop == RENAME)) {
++ error = EROFS;
++ } else {
++ error = ENOENT;
++ }
++ }
++
++ return (error);
++#endif
++ return (0);
+ }
+
+ static int vboxvfs_inactive(struct vop_inactive_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_reclaim(struct vop_reclaim_args *ap)
+ {
+- return 0;
++#if 0
++ struct vnode *vp;
++ struct vboxvfs_node *unode;
++
++ vp = ap->a_vp;
++ unode = VTON(vp);
++
++ /*
++ * Destroy the vm object and flush associated pages.
++ */
++ vnode_destroy_vobject(vp);
++
++ if (unode != NULL) {
++ vfs_hash_remove(vp);
++ free(unode, M_AVGFS);
++ vp->v_data = NULL;
++ }
++#endif
++ return (0);
+ }
+
++static int vboxvfs_vptofh(struct vop_vptofh_args *ap)
++{
++#if 0
++ struct vboxvfs_node *node;
++ struct ifid *ifhp;
++
++ node = VTON(ap->a_vp);
++ ifhp = (struct ifid *)ap->a_fhp;
++ ifhp->ifid_len = sizeof(struct ifid);
++ ifhp->ifid_ino = node->hash_id;
++#endif
++ return (0);
++}
++
+ static int vboxvfs_getpages(struct vop_getpages_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+ static int vboxvfs_putpages(struct vop_putpages_args *ap)
+ {
+- return 0;
++ return (0);
+ }
+
+Index: src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h
+===================================================================
+--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h (revision 4)
++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs.h (working copy)
+@@ -21,24 +21,130 @@
+ #define VBOXVFS_VFSNAME "vboxvfs"
+ #define VBOXVFS_VERSION 1
+
+-#define MAX_HOST_NAME 256
+-#define MAX_NLS_NAME 32
++#define MAX_HOST_NAME 256
++#define MAX_NLS_NAME 32
+
+-struct vboxvfs_mount_info {
+- char name[MAX_HOST_NAME];
+- char nls_name[MAX_NLS_NAME];
+- int uid;
+- int gid;
+- int ttl;
+-};
++/** Helper macros */
++#define VFSTOVBOXFS(mp) ((vboxvfs_mnt_t *)((mp)->mnt_data))
++#define VTON(vp) ((vboxvfs_node *)((vp)->v_data))
+
++MALLOC_DECLARE(M_VBOXVFS);
++
+ #ifdef _KERNEL
++#include "../../../../../include/iprt/nocrt/limits.h"
++#include "../../../../../include/iprt/alloc.h"
++#include "../../../../../include/iprt/asm.h"
++#include "../../../../../include/iprt/asm-amd64-x86.h"
++#include "../../../../../include/iprt/asm-math.h"
++#include "../../../../../include/iprt/assert.h"
++#include "../../../../../include/iprt/cdefs.h"
++#include "../../../../../include/iprt/err.h"
++#include "../../../../../include/iprt/fs.h"
++#include "../../../../../include/iprt/log.h"
++#include "../../../../../include/iprt/mangling.h"
++#include "../../../../../include/iprt/mem.h"
++#include "../../../../../include/iprt/param.h"
++#include "../../../../../include/iprt/path.h"
++#include "../../../../../include/iprt/semaphore.h"
++#include "../../../../../include/iprt/stdarg.h"
++#include "../../../../../include/iprt/stdint.h"
++#include "../../../../../include/iprt/string.h"
++#include "../../../../../include/iprt/time.h"
++#include "../../../../../include/iprt/types.h"
++#include "../../../../../include/iprt/uni.h"
++#include "../../common/VBoxGuestLib/SysHlp.h"
++#include "../../../../../include/iprt/nocrt/limits.h"
++#include "../../../../../include/iprt/alloc.h"
++#include "../../../../../include/iprt/asm.h"
++#include "../../../../../include/iprt/asm-amd64-x86.h"
++#include "../../../../../include/iprt/asm-math.h"
++#include "../../../../../include/iprt/assert.h"
++#include "../../../../../include/iprt/cdefs.h"
++#include "../../../../../include/iprt/err.h"
++#include "../../../../../include/iprt/fs.h"
++#include "../../../../../include/iprt/log.h"
++#include "../../../../../include/iprt/mangling.h"
++#include "../../../../../include/iprt/mem.h"
++#include "../../../../../include/iprt/param.h"
++#include "../../../../../include/iprt/path.h"
++#include "../../../../../include/iprt/semaphore.h"
++#include "../../../../../include/iprt/stdarg.h"
++#include "../../../../../include/iprt/stdint.h"
++#include "../../../../../include/iprt/string.h"
++#include "../../../../../include/iprt/time.h"
++#include "../../../../../include/iprt/types.h"
++#include "../../../../../include/iprt/uni.h"
+
++#include "../../common/VBoxGuestLib/SysHlp.h"
+ #include "../../common/VBoxGuestLib/VBoxGuestR0LibSharedFolders.h"
+ #include <sys/mount.h>
+-#include <sys/vnode.h>
++#include <sys/vnode.h>
+
+-struct vboxvfsmount {
++/*
++ * representation of an active mount point
++ */
++struct sfp_mount {
++ VBSFMAP map;
++};
++
++typedef struct sfp_mount sfp_mount_t;
++
++
++/*
++ * Shared Folders filesystem per-mount data structure.
++ */
++typedef struct vboxvfs_mnt {
++ struct mount *sf_vfsp; /* filesystem's vfs struct */
++ struct vnode *sf_rootnode; /* of vnode of the root directory */
++ uid_t sf_uid; /* owner of all shared folders */
++ gid_t sf_gid; /* group of all shared folders */
++ mode_t sf_dmode; /* mode of all directories */
++ mode_t sf_fmode; /* mode of all files */
++ mode_t sf_dmask; /* mask of all directories */
++ mode_t sf_fmask; /* mask of all files */
++ int sf_stat_ttl; /* ttl for stat caches (in ms) */
++ int sf_fsync; /* whether to honor fsync or not */
++ char *sf_share_name;
++ char *sf_mntpath; /* name of mount point */
++ sfp_mount_t *sf_handle;
++ uint64_t sf_ino; /* per FS ino generator */
++} vboxvfs_mnt_t;
++
++struct vboxvfs_mount_info {
++ char name[MAX_HOST_NAME];
++ char nls_name[MAX_NLS_NAME];
++ int uid;
++ int gid;
++ int ttl;
++};
++
++#if 0
++struct vboxvfs_mnt
++{
++ VBSFMAP map;
++ int im_flags;
++ struct mount *im_mountp;
++ struct g_consumer *im_cp;
++ struct bufobj *im_bo;
++ struct cdev *im_dev;
++ struct vnode *im_devvp;
++ off_t size;
++ int bsize;
++ int bshift;
++ int bmask;
++ int use_devvp;
++};
++#endif
++
++/** VNode for VBoxVFS */
++typedef struct vboxvfs_node
++{
++ struct vnode *i_vnode;
++ struct vboxvfs_mnt *vboxvfsmp;
++ ino_t hash_id;
++} vboxvfs_vnode_t;
++#if 0
++struct vboxvfs_mount {
+ uid_t uid;
+ gid_t gid;
+ mode_t file_mode;
+@@ -50,17 +156,27 @@
+ int caseopt;
+ int didrele;
+ };
+-
+-/* structs - stolen from the linux shared module code */
++#endif
+ struct sf_glob_info {
+- VBSFMAP map;
++ VBSFMAP map;
+ /* struct nls_table *nls;*/
+- int ttl;
+- int uid;
+- int gid;
+- struct vnode *vnode_root;
++ int ttl;
++ int uid;
++ int gid;
++ struct vnode *vnode_root;
+ };
+
++/** Per-file system mount instance data. */
++typedef struct vboxvfs_globinfo
++{
++ VBSFMAP Map;
++ int Ttl;
++ int Uid;
++ int Gid;
++ struct mount *pVFS;
++ vboxvfs_vnode_t *pVNodeRoot;
++} vboxvfs_globinfo_t;
++
+ struct sf_inode_info {
+ SHFLSTRING *path;
+ int force_restat;
+Index: src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk
+===================================================================
+--- src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk (revision 4)
++++ src/VBox/Additions/freebsd/vboxvfs/Makefile.kmk (working copy)
+@@ -33,12 +33,13 @@
+ $(vboxvfs_0_OUTDIR)
+ vboxvfs_SOURCES = \
+ vboxvfs_vfsops.c \
+- vboxvfs_vnops.c
++ vboxvfs_vnops.c \
++ vboxvfs_prov.c
+ vboxvfs_LIBS = \
+ $(VBOX_LIB_VBGL_R0) \
+ $(VBOX_LIB_IPRT_GUEST_R0)
+ vboxvfs_DEPS = \
+- $$(vboxvfs_0_OUTDIR)/vnode_if.h \
++# $$(vboxvfs_0_OUTDIR)/vnode_if.h \
+ $$(vboxvfs_0_OUTDIR)/vnode_if_newproto.h \
+ $$(vboxvfs_0_OUTDIR)/vnode_if_typedef.h
+ vboxvfs_CLEAN += $(vboxvfs_DEPS)
+Index: src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c
+===================================================================
+--- src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c (revision 4)
++++ src/VBox/Additions/freebsd/vboxvfs/vboxvfs_vfsops.c (working copy)
+@@ -14,13 +14,13 @@
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+-
+-#include "vboxvfs.h"
++#include <sys/types.h>
+ #include <sys/param.h>
+ #include <sys/systm.h>
+ #include <sys/proc.h>
+ #include <sys/bio.h>
+ #include <sys/buf.h>
++#include <sys/dirent.h>
+ #include <sys/kernel.h>
+ #include <sys/sysctl.h>
+ #include <sys/vnode.h>
+@@ -29,8 +29,35 @@
+ #include <sys/malloc.h>
+ #include <sys/module.h>
+
+-#include <iprt/mem.h>
++#include "vboxvfs.h"
++#include "vboxvfs_prov.h"
++#if 0
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/systm.h>
++#include <sys/uio.h>
++#include <sys/bio.h>
++#include <sys/buf.h>
++#include <sys/conf.h>
++#include <sys/dirent.h>
++#include <sys/fcntl.h>
++#include <sys/iconv.h>
++#include <sys/kernel.h>
++#include <sys/malloc.h>
++#include <sys/mount.h>
++#include <sys/namei.h>
++#include <sys/priv.h>
++#include <sys/proc.h>
++#include <sys/queue.h>
++#include <sys/vnode.h>
++#include <sys/endian.h>
+
++#include <geom/geom.h>
++#include <geom/geom_vfs.h>
++
++#include <vm/uma.h>
++#endif
++
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-soc-all
mailing list