Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/puffs Support extended attributes.
details: https://anonhg.NetBSD.org/src/rev/9efa7f75ab21
branches: trunk
changeset: 755044:9efa7f75ab21
user: pooka <pooka%NetBSD.org@localhost>
date: Fri May 21 10:16:54 2010 +0000
description:
Support extended attributes.
diffstat:
sys/fs/puffs/puffs_msgif.h | 75 +++++++++++-
sys/fs/puffs/puffs_vfsops.c | 56 ++++++++-
sys/fs/puffs/puffs_vnops.c | 272 ++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 385 insertions(+), 18 deletions(-)
diffs (truncated from 541 to 300 lines):
diff -r fb9b508f978e -r 9efa7f75ab21 sys/fs/puffs/puffs_msgif.h
--- a/sys/fs/puffs/puffs_msgif.h Fri May 21 08:46:14 2010 +0000
+++ b/sys/fs/puffs/puffs_msgif.h Fri May 21 10:16:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.h,v 1.70 2010/05/20 12:09:45 pooka Exp $ */
+/* $NetBSD: puffs_msgif.h,v 1.71 2010/05/21 10:16:54 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -69,7 +69,8 @@
PUFFS_VFS_INIT, PUFFS_VFS_DONE, PUFFS_VFS_SNAPSHOT,
PUFFS_VFS_EXTATTRCTL, PUFFS_VFS_SUSPEND
};
-#define PUFFS_VFS_MAX PUFFS_VFS_EXTATTRCTL /* XXX: NOT TRUE!! */
+#define PUFFS_VFS_SPARE 0
+#define PUFFS_VFS_MAX (PUFFS_VFS_EXTATTRCTL+PUFFS_VFS_SPARE)
/* moreXXX: we don't need everything here either */
enum {
@@ -88,9 +89,10 @@
PUFFS_VN_ADVLOCK, PUFFS_VN_LEASE, PUFFS_VN_WHITEOUT,
PUFFS_VN_GETPAGES, PUFFS_VN_PUTPAGES, PUFFS_VN_GETEXTATTR,
PUFFS_VN_LISTEXTATTR, PUFFS_VN_OPENEXTATTR, PUFFS_VN_DELETEEXTATTR,
- PUFFS_VN_SETEXTATTR
+ PUFFS_VN_SETEXTATTR /* PUFFS_VN_CLOSEEXTATTR */
};
-#define PUFFS_VN_MAX PUFFS_VN_SETEXTATTR
+#define PUFFS_VN_SPARE 0
+#define PUFFS_VN_MAX (PUFFS_VN_SETEXTATTR+PUFFS_VN_SPARE)
/*
* These signal invalid parameters the file system returned.
@@ -102,6 +104,10 @@
};
#define PUFFS_ERR_MAX PUFFS_ERR_VPTOFH
+/* trick to avoid protocol bump */
+#define PUFFS_ERR_GETEXTATTR PUFFS_ERR_ERROR
+#define PUFFS_ERR_LISTEXTATTR PUFFS_ERR_ERROR
+
#define PUFFSDEVELVERS 0x80000000
#define PUFFSVERSION 29
#define PUFFSNAMESIZE 32
@@ -247,6 +253,8 @@
#define PUFFS_MSG_MAXSIZE 2*MAXPHYS
#define PUFFS_MSGSTRUCT_MAX 4096 /* XXX: approxkludge */
+#define PUFFS_EXTNAMELEN NAME_MAX /* currently same as EXTATTR_MAXNAMELEN */
+
#define PUFFS_TOMOVE(a,b) (MIN((a), b->pmp_msg_maxsize - PUFFS_MSGSTRUCT_MAX))
/* puffs struct componentname built by kernel */
@@ -327,6 +335,17 @@
#define PUFFS_SUSPEND_RESUME 2
#define PUFFS_SUSPEND_ERROR 3
+#define PUFFS_EXTATTRCTL_HASNODE 0x01
+#define PUFFS_EXTATTRCTL_HASATTRNAME 0x02
+struct puffs_vfsmsg_extattrctl {
+ struct puffs_req pvfsr_pr;
+
+ int pvfsr_cmd; /* OUT */
+ int pvfsr_attrnamespace; /* OUT */
+ int pvfsr_flags; /* OUT */
+ char pvfsr_attrname[PUFFS_EXTNAMELEN]; /* OUT */
+};
+
/*
* aux structures for vnode operations.
*/
@@ -571,6 +590,54 @@
struct puffs_kcred pvnr_cn_cred; /* OUT */
};
+struct puffs_vnmsg_getextattr {
+ struct puffs_req pvn_pr;
+
+ int pvnr_attrnamespace; /* OUT */
+ char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */
+
+ struct puffs_kcred pvnr_cred; /* OUT */
+ size_t pvnr_datasize; /* IN */
+
+ size_t pvnr_resid; /* IN/OUT */
+ uint8_t pvnr_data[0] /* IN */
+ __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_setextattr {
+ struct puffs_req pvn_pr;
+
+ int pvnr_attrnamespace; /* OUT */
+ char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */
+
+ struct puffs_kcred pvnr_cred; /* OUT */
+
+ size_t pvnr_resid; /* IN/OUT */
+ uint8_t pvnr_data[0] /* OUT */
+ __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_listextattr {
+ struct puffs_req pvn_pr;
+
+ int pvnr_attrnamespace; /* OUT */
+
+ struct puffs_kcred pvnr_cred; /* OUT */
+ size_t pvnr_datasize; /* IN */
+
+ size_t pvnr_resid; /* IN/OUT */
+ uint8_t pvnr_data[0] /* IN */
+ __aligned(ALIGNBYTES+1);
+};
+
+struct puffs_vnmsg_deleteextattr {
+ struct puffs_req pvn_pr;
+
+ int pvnr_attrnamespace; /* OUT */
+ char pvnr_attrname[PUFFS_EXTNAMELEN];/* OUT */
+
+ struct puffs_kcred pvnr_cred; /* OUT */
+};
/*
* For cache reports. Everything is always out-out-out, no replies
diff -r fb9b508f978e -r 9efa7f75ab21 sys/fs/puffs/puffs_vfsops.c
--- a/sys/fs/puffs/puffs_vfsops.c Fri May 21 08:46:14 2010 +0000
+++ b/sys/fs/puffs/puffs_vfsops.c Fri May 21 10:16:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vfsops.c,v 1.87 2010/02/17 14:32:08 pooka Exp $ */
+/* $NetBSD: puffs_vfsops.c,v 1.88 2010/05/21 10:16:54 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.87 2010/02/17 14:32:08 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.88 2010/05/21 10:16:54 pooka Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -758,6 +758,56 @@
return EOPNOTSUPP;
}
+int
+puffs_vfsop_extattrctl(struct mount *mp, int cmd, struct vnode *vp,
+ int attrnamespace, const char *attrname)
+{
+ PUFFS_MSG_VARS(vfs, extattrctl);
+ struct puffs_mount *pmp = MPTOPUFFSMP(mp);
+ struct puffs_node *pnp;
+ puffs_cookie_t pnc;
+ int error, flags;
+
+ if (vp) {
+ /* doesn't make sense for puffs servers */
+ if (vp->v_mount != mp)
+ return EXDEV;
+ pnp = vp->v_data;
+ pnc = pnp->pn_cookie;
+ flags = PUFFS_EXTATTRCTL_HASNODE;
+ } else {
+ pnp = pnc = NULL;
+ flags = 0;
+ }
+
+ PUFFS_MSG_ALLOC(vfs, extattrctl);
+ extattrctl_msg->pvfsr_cmd = cmd;
+ extattrctl_msg->pvfsr_attrnamespace = attrnamespace;
+ extattrctl_msg->pvfsr_flags = flags;
+ if (attrname) {
+ strlcpy(extattrctl_msg->pvfsr_attrname, attrname,
+ sizeof(extattrctl_msg->pvfsr_attrname));
+ extattrctl_msg->pvfsr_flags |= PUFFS_EXTATTRCTL_HASATTRNAME;
+ }
+ puffs_msg_setinfo(park_extattrctl,
+ PUFFSOP_VFS, PUFFS_VFS_EXTATTRCTL, pnc);
+
+ puffs_msg_enqueue(pmp, park_extattrctl);
+ if (vp) {
+ mutex_enter(&pnp->pn_mtx);
+ puffs_referencenode(pnp);
+ mutex_exit(&pnp->pn_mtx);
+ VOP_UNLOCK(vp, 0);
+ }
+ error = puffs_msg_wait2(pmp, park_extattrctl, pnp, NULL);
+ PUFFS_MSG_RELEASE(extattrctl);
+ if (vp) {
+ puffs_releasenode(pnp);
+ }
+
+ return checkerr(pmp, error, __func__);
+}
+
const struct vnodeopv_desc * const puffs_vnodeopv_descs[] = {
&puffs_vnodeop_opv_desc,
&puffs_specop_opv_desc,
@@ -784,7 +834,7 @@
puffs_vfsop_done, /* done */
NULL, /* mountroot */
puffs_vfsop_snapshot, /* snapshot */
- vfs_stdextattrctl, /* extattrctl */
+ puffs_vfsop_extattrctl, /* extattrctl */
(void *)eopnotsupp, /* suspendctl */
genfs_renamelock_enter,
genfs_renamelock_exit,
diff -r fb9b508f978e -r 9efa7f75ab21 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c Fri May 21 08:46:14 2010 +0000
+++ b/sys/fs/puffs/puffs_vnops.c Fri May 21 10:16:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vnops.c,v 1.144 2010/03/29 13:11:33 pooka Exp $ */
+/* $NetBSD: puffs_vnops.c,v 1.145 2010/05/21 10:16:54 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.144 2010/03/29 13:11:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.145 2010/05/21 10:16:54 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -82,6 +82,10 @@
int puffs_vnop_mmap(void *);
int puffs_vnop_getpages(void *);
int puffs_vnop_abortop(void *);
+int puffs_vnop_getextattr(void *);
+int puffs_vnop_setextattr(void *);
+int puffs_vnop_listextattr(void *);
+int puffs_vnop_deleteextattr(void *);
int puffs_vnop_spec_read(void *);
int puffs_vnop_spec_write(void *);
@@ -134,7 +138,14 @@
{ &vop_bwrite_desc, genfs_nullop }, /* REAL bwrite */
{ &vop_mmap_desc, puffs_vnop_mmap }, /* REAL mmap */
{ &vop_poll_desc, puffs_vnop_poll }, /* REAL poll */
-
+ { &vop_getextattr_desc, puffs_vnop_getextattr }, /* getextattr */
+ { &vop_setextattr_desc, puffs_vnop_setextattr }, /* setextattr */
+ { &vop_listextattr_desc, puffs_vnop_listextattr }, /* listextattr */
+ { &vop_deleteextattr_desc, puffs_vnop_deleteextattr },/* deleteextattr */
+#if 0
+ { &vop_openextattr_desc, puffs_vnop_checkop }, /* openextattr */
+ { &vop_closeextattr_desc, puffs_vnop_checkop }, /* closeextattr */
+#endif
{ &vop_kqfilter_desc, genfs_eopnotsupp }, /* kqfilter XXX */
{ NULL, NULL }
};
@@ -185,13 +196,13 @@
{ &vop_bwrite_desc, vn_bwrite }, /* bwrite */
{ &vop_getpages_desc, spec_getpages }, /* genfs_getpages */
{ &vop_putpages_desc, spec_putpages }, /* genfs_putpages */
+ { &vop_getextattr_desc, puffs_vnop_checkop }, /* getextattr */
+ { &vop_setextattr_desc, puffs_vnop_checkop }, /* setextattr */
+ { &vop_listextattr_desc, puffs_vnop_checkop }, /* listextattr */
+ { &vop_deleteextattr_desc, puffs_vnop_checkop },/* deleteextattr */
#if 0
{ &vop_openextattr_desc, _openextattr }, /* openextattr */
{ &vop_closeextattr_desc, _closeextattr }, /* closeextattr */
- { &vop_getextattr_desc, _getextattr }, /* getextattr */
- { &vop_setextattr_desc, _setextattr }, /* setextattr */
- { &vop_listextattr_desc, _listextattr }, /* listextattr */
- { &vop_deleteextattr_desc, _deleteextattr }, /* deleteextattr */
#endif
{ NULL, NULL }
};
@@ -244,11 +255,11 @@
#if 0
{ &vop_openextattr_desc, _openextattr }, /* openextattr */
{ &vop_closeextattr_desc, _closeextattr }, /* closeextattr */
- { &vop_getextattr_desc, _getextattr }, /* getextattr */
- { &vop_setextattr_desc, _setextattr }, /* setextattr */
- { &vop_listextattr_desc, _listextattr }, /* listextattr */
- { &vop_deleteextattr_desc, _deleteextattr }, /* deleteextattr */
#endif
+ { &vop_getextattr_desc, puffs_vnop_checkop }, /* getextattr */
+ { &vop_setextattr_desc, puffs_vnop_checkop }, /* setextattr */
+ { &vop_listextattr_desc, puffs_vnop_checkop }, /* listextattr */
+ { &vop_deleteextattr_desc, puffs_vnop_checkop }, /* deleteextattr */
{ NULL, NULL }
};
const struct vnodeopv_desc puffs_fifoop_opv_desc =
@@ -365,6 +376,10 @@
CHECKOP_NOTSUPP(PRINT);
CHECKOP_NOTSUPP(PATHCONF);
CHECKOP_NOTSUPP(ADVLOCK);
+ CHECKOP_NOTSUPP(GETEXTATTR);
+ CHECKOP_NOTSUPP(SETEXTATTR);
+ CHECKOP_NOTSUPP(LISTEXTATTR);
+ CHECKOP_NOTSUPP(DELETEEXTATTR);
CHECKOP_SUCCESS(ACCESS);
CHECKOP_SUCCESS(CLOSE);
@@ -2582,6 +2597,241 @@
Home |
Main Index |
Thread Index |
Old Index