Add some kludges to be able to execute requests on the regular program
stack instead of the continuation stack. This is for lib/36011, where pthread gets confused since we aren't running on the regular stack. I'm not really sure which direction to go to with this quite yet, so make the hack hard to enable on purpose. The whole request dispatch code needs cleaning anyway.
This commit is contained in:
parent
8b1e1fad90
commit
4966e1c1de
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs.c,v 1.42 2007/05/09 18:36:52 pooka Exp $ */
|
||||
/* $NetBSD: puffs.c,v 1.43 2007/05/10 12:26:28 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: puffs.c,v 1.42 2007/05/09 18:36:52 pooka Exp $");
|
||||
__RCSID("$NetBSD: puffs.c,v 1.43 2007/05/10 12:26:28 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -56,6 +56,13 @@ __RCSID("$NetBSD: puffs.c,v 1.42 2007/05/09 18:36:52 pooka Exp $");
|
|||
|
||||
#include "puffs_priv.h"
|
||||
|
||||
/*
|
||||
* Set the following to 1 to not handle each request on a separate
|
||||
* stack. This is highly volatile kludge, therefore no external
|
||||
* interface.
|
||||
*/
|
||||
int puffs_fakecc;
|
||||
|
||||
/* Most file systems want this for opts, so just give it to them */
|
||||
const struct mntopt puffsmopts[] = {
|
||||
MOPT_STDOPTS,
|
||||
|
@ -452,6 +459,7 @@ int
|
|||
puffs_dopreq(struct puffs_usermount *pu, struct puffs_req *preq,
|
||||
struct puffs_putreq *ppr)
|
||||
{
|
||||
struct puffs_cc fakecc;
|
||||
struct puffs_cc *pcc;
|
||||
int rv;
|
||||
|
||||
|
@ -474,13 +482,22 @@ puffs_dopreq(struct puffs_usermount *pu, struct puffs_req *preq,
|
|||
if (pu->pu_flags & PUFFS_FLAG_OPDUMP)
|
||||
puffsdump_req(preq);
|
||||
|
||||
pcc = puffs_cc_create(pu);
|
||||
if (puffs_fakecc) {
|
||||
pcc = &fakecc;
|
||||
pcc_init_local(pcc);
|
||||
|
||||
/* XXX: temporary kludging */
|
||||
pcc->pcc_preq = malloc(preq->preq_buflen);
|
||||
if (pcc->pcc_preq == NULL)
|
||||
return -1;
|
||||
(void) memcpy(pcc->pcc_preq, preq, preq->preq_buflen);
|
||||
pcc->pcc_pu = pu;
|
||||
pcc->pcc_preq = preq;
|
||||
pcc->pcc_flags = PCC_FAKECC;
|
||||
} else {
|
||||
pcc = puffs_cc_create(pu);
|
||||
|
||||
/* XXX: temporary kludging */
|
||||
pcc->pcc_preq = malloc(preq->preq_buflen);
|
||||
if (pcc->pcc_preq == NULL)
|
||||
return -1;
|
||||
(void) memcpy(pcc->pcc_preq, preq, preq->preq_buflen);
|
||||
}
|
||||
|
||||
rv = puffs_docc(pcc, ppr);
|
||||
|
||||
|
@ -500,7 +517,10 @@ puffs_docc(struct puffs_cc *pcc, struct puffs_putreq *ppr)
|
|||
|
||||
assert((pcc->pcc_flags & PCC_DONE) == 0);
|
||||
|
||||
puffs_cc_continue(pcc);
|
||||
if (pcc->pcc_flags & PCC_REALCC)
|
||||
puffs_cc_continue(pcc);
|
||||
else
|
||||
puffs_calldispatcher(pcc);
|
||||
rv = pcc->pcc_rv;
|
||||
|
||||
if ((pcc->pcc_flags & PCC_DONE) == 0)
|
||||
|
@ -512,12 +532,18 @@ puffs_docc(struct puffs_cc *pcc, struct puffs_putreq *ppr)
|
|||
if (pu->pu_flags & PUFFS_FLAG_OPDUMP)
|
||||
puffsdump_rv(pcc->pcc_preq);
|
||||
|
||||
puffs_req_putcc(ppr, pcc);
|
||||
if (pcc->pcc_flags & PCC_REALCC)
|
||||
puffs_req_putcc(ppr, pcc);
|
||||
else
|
||||
puffs_req_put(ppr, pcc->pcc_preq);
|
||||
break;
|
||||
case PUFFCALL_IGNORE:
|
||||
puffs_cc_destroy(pcc);
|
||||
if (pcc->pcc_flags & PCC_REALCC)
|
||||
puffs_cc_destroy(pcc);
|
||||
break;
|
||||
case PUFFCALL_AGAIN:
|
||||
if (pcc->pcc_flags & PCC_FAKECC)
|
||||
assert(pcc->pcc_flags & PCC_DONE);
|
||||
break;
|
||||
default:
|
||||
assert(/*CONSTCOND*/0);
|
||||
|
@ -538,7 +564,7 @@ puffs_calldispatcher(struct puffs_cc *pcc)
|
|||
void *opcookie = preq->preq_cookie;
|
||||
int error, rv, buildpath;
|
||||
|
||||
assert(pcc->pcc_flags & (PCC_ONCE | PCC_REALCC));
|
||||
assert(pcc->pcc_flags & (PCC_FAKECC | PCC_REALCC));
|
||||
|
||||
if (PUFFSOP_WANTREPLY(preq->preq_opclass))
|
||||
rv = PUFFCALL_ANSWER;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_priv.h,v 1.7 2007/05/05 15:48:18 pooka Exp $ */
|
||||
/* $NetBSD: puffs_priv.h,v 1.8 2007/05/10 12:26:28 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -88,7 +88,7 @@ struct puffs_cc {
|
|||
|
||||
TAILQ_ENTRY(puffs_cc) entries;
|
||||
};
|
||||
#define PCC_ONCE 0x01
|
||||
#define PCC_FAKECC 0x01
|
||||
#define PCC_REALCC 0x02
|
||||
#define PCC_FREEPRIV 0x04
|
||||
#define PCC_PREQ_NOCOPY 0x08
|
||||
|
@ -105,7 +105,7 @@ struct puffs_cc {
|
|||
#define pcc_init_local(ap) \
|
||||
do { \
|
||||
memset(ap, 0, sizeof(*ap)); \
|
||||
(ap)->pcc_flags = PCC_ONCE; \
|
||||
(ap)->pcc_flags = PCC_FAKECC; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue