From 75008bfc31412a134bdf448af34cfaa78365fdf3 Mon Sep 17 00:00:00 2001 From: pooka Date: Sat, 17 Oct 2009 23:19:52 +0000 Subject: [PATCH] Dispatch puffs_node_abortop(). Note: We use the storage of puffs_cache_write from puffs_ops for this purpose. It's not issued by the kernel and hence currently unused, and this saves us from the trouble of bumping the lib major version. --- lib/libpuffs/dispatcher.c | 25 +++++++++++++++++++++++-- lib/libpuffs/puffs.c | 15 +++++---------- lib/libpuffs/puffs.h | 15 +++++++++------ 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/lib/libpuffs/dispatcher.c b/lib/libpuffs/dispatcher.c index ba0b37663797..8bd71a0fa302 100644 --- a/lib/libpuffs/dispatcher.c +++ b/lib/libpuffs/dispatcher.c @@ -1,4 +1,4 @@ -/* $NetBSD: dispatcher.c,v 1.32 2008/08/12 19:44:39 pooka Exp $ */ +/* $NetBSD: dispatcher.c,v 1.33 2009/10/17 23:19:52 pooka Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: dispatcher.c,v 1.32 2008/08/12 19:44:39 pooka Exp $"); +__RCSID("$NetBSD: dispatcher.c,v 1.33 2009/10/17 23:19:52 pooka Exp $"); #endif /* !lint */ #include @@ -828,6 +828,24 @@ dispatch(struct puffs_cc *pcc) break; } + case PUFFS_VN_ABORTOP: + { + struct puffs_vnmsg_abortop *auxt = auxbuf; + struct puffs_cn pcn; + + if (pops->puffs_node_abortop == NULL) { + error = 0; + break; + } + + pcn.pcn_pkcnp = &auxt->pvnr_cn; + PUFFS_KCREDTOCRED(pcn.pcn_cred, &auxt->pvnr_cn_cred); + + error = pops->puffs_node_abortop(pu, opcookie, &pcn); + + break; + } + case PUFFS_VN_READ: { struct puffs_vnmsg_read *auxt = auxbuf; @@ -896,6 +914,8 @@ dispatch(struct puffs_cc *pcc) break; } +#if 0 + /* not issued by kernel currently */ } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_CACHE) { struct puffs_cacheinfo *pci = (void *)preq; @@ -904,6 +924,7 @@ dispatch(struct puffs_cc *pcc) pci->pcache_nruns, pci->pcache_runs); } error = 0; +#endif } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_ERROR) { struct puffs_error *perr = (void *)preq; diff --git a/lib/libpuffs/puffs.c b/lib/libpuffs/puffs.c index e1c9a436e22a..29ea4956917f 100644 --- a/lib/libpuffs/puffs.c +++ b/lib/libpuffs/puffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.c,v 1.98 2009/01/08 02:28:08 lukem Exp $ */ +/* $NetBSD: puffs.c,v 1.99 2009/10/17 23:19:52 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: puffs.c,v 1.98 2009/01/08 02:28:08 lukem Exp $"); +__RCSID("$NetBSD: puffs.c,v 1.99 2009/10/17 23:19:52 pooka Exp $"); #endif /* !lint */ #include @@ -99,6 +99,7 @@ fillvnopmask(struct puffs_ops *pops, uint8_t *opmask) FILLOP(print, PRINT); FILLOP(read, READ); FILLOP(write, WRITE); + FILLOP(abortop, ABORTOP); } #undef FILLOP @@ -586,21 +587,15 @@ do { \ return rv; } +/*ARGSUSED*/ struct puffs_usermount * -_puffs_init(int develv, struct puffs_ops *pops, const char *mntfromname, +_puffs_init(int dummy, struct puffs_ops *pops, const char *mntfromname, const char *puffsname, void *priv, uint32_t pflags) { struct puffs_usermount *pu; struct puffs_kargs *pargs; int sverrno; - if (develv != PUFFS_DEVEL_LIBVERSION) { - warnx("puffs_init: mounting with lib version %d, need %d", - develv, PUFFS_DEVEL_LIBVERSION); - errno = EINVAL; - return NULL; - } - pu = malloc(sizeof(struct puffs_usermount)); if (pu == NULL) goto failfree; diff --git a/lib/libpuffs/puffs.h b/lib/libpuffs/puffs.h index 1b2330b3520f..eb66f970166e 100644 --- a/lib/libpuffs/puffs.h +++ b/lib/libpuffs/puffs.h @@ -1,4 +1,4 @@ -/* $NetBSD: puffs.h,v 1.110 2008/12/12 19:45:16 pooka Exp $ */ +/* $NetBSD: puffs.h,v 1.111 2009/10/17 23:19:52 pooka Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -218,10 +218,13 @@ struct puffs_ops { uint8_t *, off_t, size_t *, const struct puffs_cred *, int); int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t, 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 *); - /* XXX: this shouldn't be here */ - void (*puffs_cache_write)(struct puffs_usermount *, - puffs_cookie_t, size_t, struct puffs_cacherun *); +#if 0 + /* enable next time this structure is changed */ + void *puffs_ops_spare[32]; +#endif }; typedef int (*pu_pathbuild_fn)(struct puffs_usermount *, @@ -354,8 +357,8 @@ enum { int fsname##_node_write(struct puffs_usermount *, \ puffs_cookie_t, uint8_t *, off_t, size_t *, \ const struct puffs_cred *, int); \ - int fsname##_cache_write(struct puffs_usermount *, \ - puffs_cookie_t, size_t, struct puffs_cacheinfo *); + int fsname##_node_abortop(struct puffs_usermount *, \ + puffs_cookie_t, const struct puffs_cn *); #define PUFFSOP_INIT(ops) \ ops = malloc(sizeof(struct puffs_ops)); \