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.
This commit is contained in:
pooka 2009-10-17 23:19:52 +00:00
parent 805e7ceb14
commit 75008bfc31
3 changed files with 37 additions and 18 deletions

View File

@ -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. * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if !defined(lint) #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 */ #endif /* !lint */
#include <sys/types.h> #include <sys/types.h>
@ -828,6 +828,24 @@ dispatch(struct puffs_cc *pcc)
break; 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: case PUFFS_VN_READ:
{ {
struct puffs_vnmsg_read *auxt = auxbuf; struct puffs_vnmsg_read *auxt = auxbuf;
@ -896,6 +914,8 @@ dispatch(struct puffs_cc *pcc)
break; break;
} }
#if 0
/* not issued by kernel currently */
} else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_CACHE) { } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_CACHE) {
struct puffs_cacheinfo *pci = (void *)preq; struct puffs_cacheinfo *pci = (void *)preq;
@ -904,6 +924,7 @@ dispatch(struct puffs_cc *pcc)
pci->pcache_nruns, pci->pcache_runs); pci->pcache_nruns, pci->pcache_runs);
} }
error = 0; error = 0;
#endif
} else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_ERROR) { } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_ERROR) {
struct puffs_error *perr = (void *)preq; struct puffs_error *perr = (void *)preq;

View File

@ -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. * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#if !defined(lint) #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 */ #endif /* !lint */
#include <sys/param.h> #include <sys/param.h>
@ -99,6 +99,7 @@ fillvnopmask(struct puffs_ops *pops, uint8_t *opmask)
FILLOP(print, PRINT); FILLOP(print, PRINT);
FILLOP(read, READ); FILLOP(read, READ);
FILLOP(write, WRITE); FILLOP(write, WRITE);
FILLOP(abortop, ABORTOP);
} }
#undef FILLOP #undef FILLOP
@ -586,21 +587,15 @@ do { \
return rv; return rv;
} }
/*ARGSUSED*/
struct puffs_usermount * 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) const char *puffsname, void *priv, uint32_t pflags)
{ {
struct puffs_usermount *pu; struct puffs_usermount *pu;
struct puffs_kargs *pargs; struct puffs_kargs *pargs;
int sverrno; 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)); pu = malloc(sizeof(struct puffs_usermount));
if (pu == NULL) if (pu == NULL)
goto failfree; goto failfree;

View File

@ -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. * 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); uint8_t *, off_t, size_t *, const struct puffs_cred *, int);
int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t, int (*puffs_node_write)(struct puffs_usermount *, puffs_cookie_t,
uint8_t *, off_t, size_t *, const struct puffs_cred *, int); 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 */ #if 0
void (*puffs_cache_write)(struct puffs_usermount *, /* enable next time this structure is changed */
puffs_cookie_t, size_t, struct puffs_cacherun *); void *puffs_ops_spare[32];
#endif
}; };
typedef int (*pu_pathbuild_fn)(struct puffs_usermount *, typedef int (*pu_pathbuild_fn)(struct puffs_usermount *,
@ -354,8 +357,8 @@ enum {
int fsname##_node_write(struct puffs_usermount *, \ int fsname##_node_write(struct puffs_usermount *, \
puffs_cookie_t, uint8_t *, off_t, size_t *, \ puffs_cookie_t, uint8_t *, off_t, size_t *, \
const struct puffs_cred *, int); \ const struct puffs_cred *, int); \
int fsname##_cache_write(struct puffs_usermount *, \ int fsname##_node_abortop(struct puffs_usermount *, \
puffs_cookie_t, size_t, struct puffs_cacheinfo *); puffs_cookie_t, const struct puffs_cn *);
#define PUFFSOP_INIT(ops) \ #define PUFFSOP_INIT(ops) \
ops = malloc(sizeof(struct puffs_ops)); \ ops = malloc(sizeof(struct puffs_ops)); \