Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libpuffs * support extended attributes
details: https://anonhg.NetBSD.org/src/rev/cf13c374ad97
branches: trunk
changeset: 755047:cf13c374ad97
user: pooka <pooka%NetBSD.org@localhost>
date: Fri May 21 10:50:52 2010 +0000
description:
* support extended attributes
* bump major due to structure growth
* add some spare space
* remove ABI sillyness
diffstat:
lib/libpuffs/dispatcher.c | 142 ++++++++++++++++++++++++++++++++++++++++++--
lib/libpuffs/puffs.c | 21 ++++--
lib/libpuffs/puffs.h | 43 +++++++++----
lib/libpuffs/shlib_version | 14 +---
4 files changed, 181 insertions(+), 39 deletions(-)
diffs (truncated from 361 to 300 lines):
diff -r d1913c1b852c -r cf13c374ad97 lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Fri May 21 10:43:07 2010 +0000
+++ b/lib/libpuffs/dispatcher.c Fri May 21 10:50:52 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dispatcher.c,v 1.33 2009/10/17 23:19:52 pooka Exp $ */
+/* $NetBSD: dispatcher.c,v 1.34 2010/05/21 10:50:52 pooka Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.33 2009/10/17 23:19:52 pooka Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.34 2010/05/21 10:50:52 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -230,15 +230,26 @@
break;
}
- case PUFFS_VFS_SUSPEND:
+ case PUFFS_VFS_EXTATTRCTL:
{
- struct puffs_vfsmsg_suspend *auxt = auxbuf;
+ struct puffs_vfsmsg_extattrctl *auxt = auxbuf;
+ const char *attrname;
+ int flags;
- error = 0;
- if (pops->puffs_fs_suspend == NULL)
+ if (pops->puffs_fs_extattrctl == NULL) {
+ error = EOPNOTSUPP;
break;
+ }
- pops->puffs_fs_suspend(pu, auxt->pvfsr_status);
+ if (auxt->pvfsr_flags & PUFFS_EXTATTRCTL_HASATTRNAME)
+ attrname = auxt->pvfsr_attrname;
+ else
+ attrname = NULL;
+
+ flags = auxt->pvfsr_flags & PUFFS_EXTATTRCTL_HASNODE;
+ error = pops->puffs_fs_extattrctl(pu, auxt->pvfsr_cmd,
+ opcookie, flags,
+ auxt->pvfsr_attrnamespace, attrname);
break;
}
@@ -908,6 +919,123 @@
break;
}
+ case PUFFS_VN_GETEXTATTR:
+ {
+ struct puffs_vnmsg_getextattr *auxt = auxbuf;
+ PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+ size_t res, *resp, *sizep;
+ uint8_t *data;
+
+ if (pops->puffs_node_getextattr == NULL) {
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ if (auxt->pvnr_datasize)
+ sizep = &auxt->pvnr_datasize;
+ else
+ sizep = NULL;
+
+ res = auxt->pvnr_resid;
+ if (res > 0) {
+ data = auxt->pvnr_data;
+ resp = &auxt->pvnr_resid;
+ } else {
+ data = NULL;
+ resp = NULL;
+ }
+
+ error = pops->puffs_node_getextattr(pu,
+ opcookie, auxt->pvnr_attrnamespace,
+ auxt->pvnr_attrname, sizep, data, resp, pcr);
+
+ /* need to move a bit more? */
+ preq->preq_buflen =
+ sizeof(struct puffs_vnmsg_getextattr)
+ + (res - auxt->pvnr_resid);
+ break;
+ }
+
+ case PUFFS_VN_SETEXTATTR:
+ {
+ struct puffs_vnmsg_setextattr *auxt = auxbuf;
+ PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+ size_t *resp;
+ uint8_t *data;
+
+ if (pops->puffs_node_setextattr == NULL) {
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ if (auxt->pvnr_resid > 0) {
+ data = auxt->pvnr_data;
+ resp = &auxt->pvnr_resid;
+ } else {
+ data = NULL;
+ resp = NULL;
+ }
+
+ error = pops->puffs_node_setextattr(pu,
+ opcookie, auxt->pvnr_attrnamespace,
+ auxt->pvnr_attrname, data, resp, pcr);
+ break;
+ }
+
+ case PUFFS_VN_LISTEXTATTR:
+ {
+ struct puffs_vnmsg_listextattr *auxt = auxbuf;
+ PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+ size_t res, *resp, *sizep;
+ uint8_t *data;
+
+ if (pops->puffs_node_listextattr == NULL) {
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ if (auxt->pvnr_datasize)
+ sizep = &auxt->pvnr_datasize;
+ else
+ sizep = NULL;
+
+ res = auxt->pvnr_resid;
+ if (res > 0) {
+ data = auxt->pvnr_data;
+ resp = &auxt->pvnr_resid;
+ } else {
+ data = NULL;
+ resp = NULL;
+ }
+
+ res = auxt->pvnr_resid;
+ error = pops->puffs_node_listextattr(pu,
+ opcookie, auxt->pvnr_attrnamespace,
+ sizep, data, resp, pcr);
+
+ /* need to move a bit more? */
+ preq->preq_buflen =
+ sizeof(struct puffs_vnmsg_listextattr)
+ + (res - auxt->pvnr_resid);
+ break;
+ }
+
+ case PUFFS_VN_DELETEEXTATTR:
+ {
+ struct puffs_vnmsg_deleteextattr *auxt = auxbuf;
+ PUFFS_MAKECRED(pcr, &auxt->pvnr_cred);
+
+ if (pops->puffs_node_deleteextattr == NULL) {
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ error = pops->puffs_node_deleteextattr(pu,
+ opcookie, auxt->pvnr_attrnamespace,
+ auxt->pvnr_attrname, pcr);
+ break;
+ }
+
default:
printf("inval op %d\n", preq->preq_optype);
error = EINVAL;
diff -r d1913c1b852c -r cf13c374ad97 lib/libpuffs/puffs.c
--- a/lib/libpuffs/puffs.c Fri May 21 10:43:07 2010 +0000
+++ b/lib/libpuffs/puffs.c Fri May 21 10:50:52 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.c,v 1.106 2010/05/19 12:16:45 pooka Exp $ */
+/* $NetBSD: puffs.c,v 1.107 2010/05/21 10:50:52 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.106 2010/05/19 12:16:45 pooka Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.107 2010/05/21 10:50:52 pooka Exp $");
#endif /* !lint */
#include <sys/param.h>
@@ -70,10 +70,11 @@
opmask[PUFFS_VN_##upper] = 1; \
} while (/*CONSTCOND*/0)
static void
-fillvnopmask(struct puffs_ops *pops, uint8_t *opmask)
+fillvnopmask(struct puffs_ops *pops, struct puffs_kargs *pa)
{
+ uint8_t *opmask = pa->pa_vnopmask;
- memset(opmask, 0, PUFFS_VN_MAX);
+ memset(opmask, 0, sizeof(pa->pa_vnopmask));
FILLOP(create, CREATE);
FILLOP(mknod, MKNOD);
@@ -100,6 +101,11 @@
FILLOP(read, READ);
FILLOP(write, WRITE);
FILLOP(abortop, ABORTOP);
+
+ FILLOP(getextattr, GETEXTATTR);
+ FILLOP(setextattr, SETEXTATTR);
+ FILLOP(listextattr, LISTEXTATTR);
+ FILLOP(deleteextattr, DELETEEXTATTR);
}
#undef FILLOP
@@ -609,9 +615,8 @@
return rv;
}
-/*ARGSUSED*/
struct puffs_usermount *
-_puffs_init(int dummy, struct puffs_ops *pops, const char *mntfromname,
+puffs_init(struct puffs_ops *pops, const char *mntfromname,
const char *puffsname, void *priv, uint32_t pflags)
{
struct puffs_usermount *pu;
@@ -635,9 +640,9 @@
goto failfree;
memset(pargs, 0, sizeof(struct puffs_kargs));
- pargs->pa_vers = PUFFSDEVELVERS | PUFFSVERSION;
+ pargs->pa_vers = PUFFSVERSION;
pargs->pa_flags = PUFFS_FLAG_KERN(pflags);
- fillvnopmask(pops, pargs->pa_vnopmask);
+ fillvnopmask(pops, pargs);
puffs_setmntinfo(pu, mntfromname, puffsname);
puffs_zerostatvfs(&pargs->pa_svfsb);
diff -r d1913c1b852c -r cf13c374ad97 lib/libpuffs/puffs.h
--- a/lib/libpuffs/puffs.h Fri May 21 10:43:07 2010 +0000
+++ b/lib/libpuffs/puffs.h Fri May 21 10:50:52 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs.h,v 1.114 2010/01/12 18:42:39 pooka Exp $ */
+/* $NetBSD: puffs.h,v 1.115 2010/05/21 10:50:52 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -89,6 +89,8 @@
LIST_ENTRY(puffs_node) pn_entries;
LIST_HEAD(,puffs_kcache)pn_cacheinfo; /* PUFFS_KFLAG_CACHE */
+
+ void *pn_spare[4];
};
#define PUFFS_NODE_REMOVED 0x01 /* not on entry list */
@@ -159,7 +161,8 @@
struct puffs_newinfo *);
int (*puffs_fs_nodetofh)(struct puffs_usermount *, puffs_cookie_t,
void *, size_t *);
- void (*puffs_fs_suspend)(struct puffs_usermount *, int);
+ int (*puffs_fs_extattrctl)(struct puffs_usermount *, int,
+ puffs_cookie_t, int, int, const char *);
int (*puffs_node_lookup)(struct puffs_usermount *,
puffs_cookie_t, struct puffs_newinfo *, const struct puffs_cn *);
@@ -220,11 +223,17 @@
uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
int (*puffs_node_abortop)(struct puffs_usermount *, puffs_cookie_t,
const struct puffs_cn *);
+ int (*puffs_node_getextattr)(struct puffs_usermount *, puffs_cookie_t,
+ int, const char *, size_t *, uint8_t *, size_t *,
+ const struct puffs_cred *);
+ int (*puffs_node_setextattr)(struct puffs_usermount *, puffs_cookie_t,
+ int, const char *, uint8_t *, size_t *, const struct puffs_cred *);
+ int (*puffs_node_listextattr)(struct puffs_usermount *, puffs_cookie_t,
+ int, size_t *, uint8_t *, size_t *, const struct puffs_cred *);
+ int (*puffs_node_deleteextattr)(struct puffs_usermount *,
+ puffs_cookie_t, int, const char *, const struct puffs_cred *);
-#if 0
- /* enable next time this structure is changed */
void *puffs_ops_spare[32];
-#endif
};
typedef int (*pu_pathbuild_fn)(struct puffs_usermount *,
@@ -289,7 +298,8 @@
size_t, struct puffs_newinfo *); \
int fsname##_fs_nodetofh(struct puffs_usermount *, \
puffs_cookie_t, void *, size_t *); \
- void fsname##_fs_suspend(struct puffs_usermount *, int); \
+ int fsname##_fs_extattrctl(struct puffs_usermount *, int, \
+ puffs_cookie_t, int, int, const char *); \
\
int fsname##_node_lookup(struct puffs_usermount *, \
puffs_cookie_t, struct puffs_newinfo *, \
Home |
Main Index |
Thread Index |
Old Index