Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs Add NetBSD version of...
details: https://anonhg.NetBSD.org/src/rev/1b26222fd65b
branches: trunk
changeset: 759632:1b26222fd65b
user: haad <haad%NetBSD.org@localhost>
date: Tue Dec 14 01:28:18 2010 +0000
description:
Add NetBSD version of zfs snapshot management code. IT needs testing it
was only compile tested for now, but I would like to have some code in to be
sure that it will not be lost.
diffstat:
external/cddl/osnet/dist/uts/common/fs/gfs.c | 21 +++++++-
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c | 41 ++++------------
2 files changed, 27 insertions(+), 35 deletions(-)
diffs (193 lines):
diff -r 45243831b816 -r 1b26222fd65b external/cddl/osnet/dist/uts/common/fs/gfs.c
--- a/external/cddl/osnet/dist/uts/common/fs/gfs.c Tue Dec 14 01:25:37 2010 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/gfs.c Tue Dec 14 01:28:18 2010 +0000
@@ -121,6 +121,7 @@
* both the caller and the vnode type provider need to access gfsv_ops
* and gfsv_template, and the caller also needs to know gfsv_name.
*/
+#ifdef PORT_SOLARIS
int
gfs_make_opsvec(gfs_opsvec_t *vec)
{
@@ -143,6 +144,7 @@
}
return (error);
}
+#endif
/*
* Low level directory routines
@@ -257,15 +259,17 @@
static int
gfs_readdir_emit_int(gfs_readdir_state_t *st, uio_t *uiop, offset_t next)
{
- int reclen;
+ int reclen, namelen;
dirent64_t *dp;
edirent_t *edp;
if (st->grd_flags & V_RDDIR_ENTFLAGS) {
edp = st->grd_dirent;
+ namelen = strlen(edp->ed_name);
reclen = EDIRENT_RECLEN(strlen(edp->ed_name));
} else {
dp = st->grd_dirent;
+ namelen = strlen(dp->d_name);
reclen = DIRENT64_RECLEN(strlen(dp->d_name));
}
@@ -282,8 +286,9 @@
edp->ed_off = next;
edp->ed_reclen = (ushort_t)reclen;
} else {
- dp->d_off = next;
dp->d_reclen = (ushort_t)reclen;
+ dp->d_type = DT_DIR;
+ dp->d_namlen = namelen;
}
if (uiomove((caddr_t)st->grd_dirent, reclen, UIO_READ, uiop))
@@ -458,12 +463,17 @@
{
gfs_file_t *fp;
vnode_t *vp;
+ int error;
/*
* Allocate vnode and internal data structure
*/
fp = kmem_zalloc(size, KM_SLEEP);
- vp = vn_alloc(KM_SLEEP);
+ /* XXX FreeBSD adds vfs_t * as parameter to gfs_file_create and
+ gfs_dir_create */
+ error = getnewvnode(VT_ZFS, pvp->v_vfsp, ops, &vp);
+ ASSERT(error == 0);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
/*
* Set up various pointers
@@ -639,6 +649,7 @@
mutex_enter(&fp->gfs_parent->v_lock);
}
mutex_enter(&vp->v_lock);
+#ifdef PORT_SOLARIS
if (vp->v_count == 1) {
/*
* Really remove this vnode
@@ -680,6 +691,7 @@
if (dp)
gfs_dir_unlock(dp);
}
+#endif
return (data);
}
@@ -1093,6 +1105,7 @@
* putpage() routines.
*/
/* ARGSUSED */
+#ifdef PORT_SOLARIS
int
gfs_vop_map(vnode_t *vp, offset_t off, struct as *as, caddr_t *addrp,
size_t len, uchar_t prot, uchar_t maxprot, uint_t flags, cred_t *cred,
@@ -1154,7 +1167,7 @@
return (rv);
}
-
+#endif
/*
* gfs_vop_inactive: VOP_INACTIVE() entry point
*
diff -r 45243831b816 -r 1b26222fd65b external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c Tue Dec 14 01:25:37 2010 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ctldir.c Tue Dec 14 01:28:18 2010 +0000
@@ -111,16 +111,13 @@
return (0);
}
-vnodeops_t *zfsctl_ops_root;
-vnodeops_t *zfsctl_ops_snapdir;
-vnodeops_t *zfsctl_ops_snapshot;
-vnodeops_t *zfsctl_ops_shares;
-vnodeops_t *zfsctl_ops_shares_dir;
+//vnodeops_t *zfsctl_ops_shares_dir;
-static const fs_operation_def_t zfsctl_tops_root[];
-static const fs_operation_def_t zfsctl_tops_snapdir[];
-static const fs_operation_def_t zfsctl_tops_snapshot[];
-static const fs_operation_def_t zfsctl_tops_shares[];
+static struct vnodeopv_entry_desc zfsctl_ops_root;
+static struct vnodeopv_entry_desc zfsctl_ops_snapdir;
+static struct vnodeopv_entry_desc zfsctl_ops_snapshot;
+static struct vnodeopv_entry_desc zfsctl_ops_shares;
+
static vnode_t *zfsctl_mknode_snapdir(vnode_t *);
static vnode_t *zfsctl_mknode_shares(vnode_t *);
@@ -159,31 +156,11 @@
void
zfsctl_init(void)
{
- VERIFY(gfs_make_opsvec(zfsctl_opsvec) == 0);
}
void
zfsctl_fini(void)
{
- /*
- * Remove vfsctl vnode ops
- */
- if (zfsctl_ops_root)
- vn_freevnodeops(zfsctl_ops_root);
- if (zfsctl_ops_snapdir)
- vn_freevnodeops(zfsctl_ops_snapdir);
- if (zfsctl_ops_snapshot)
- vn_freevnodeops(zfsctl_ops_snapshot);
- if (zfsctl_ops_shares)
- vn_freevnodeops(zfsctl_ops_shares);
- if (zfsctl_ops_shares_dir)
- vn_freevnodeops(zfsctl_ops_shares_dir);
-
- zfsctl_ops_root = NULL;
- zfsctl_ops_snapdir = NULL;
- zfsctl_ops_snapshot = NULL;
- zfsctl_ops_shares = NULL;
- zfsctl_ops_shares_dir = NULL;
}
/*
@@ -1123,6 +1100,7 @@
}
}
+#ifndef __NetBSD__
static const fs_operation_def_t zfsctl_tops_snapdir[] = {
{ VOPNAME_OPEN, { .vop_open = zfsctl_common_open } },
{ VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } },
@@ -1153,7 +1131,7 @@
{ VOPNAME_FID, { .vop_fid = zfsctl_shares_fid } },
{ NULL }
};
-
+#endif
/*
* pvp is the GFS vnode '.zfs/snapshot'.
*
@@ -1220,7 +1198,7 @@
gfs_vop_inactive(vp, cr, ct);
}
-
+#ifndef __NetBSD__
/*
* These VP's should never see the light of day. They should always
* be covered.
@@ -1229,6 +1207,7 @@
VOPNAME_INACTIVE, { .vop_inactive = zfsctl_snapshot_inactive },
NULL, NULL
};
+#endif
int
zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp)
Home |
Main Index |
Thread Index |
Old Index