Introduce puffs_framev_framebuf_ccpromote, which can be used to

turn a reference to puffs_framebuf in the file system from a
cb/justsend operation to a cc wait, should the file system find
itself desiring the result.
This commit is contained in:
pooka 2007-05-20 19:56:56 +00:00
parent b52e09dc19
commit 866bcfbb38
2 changed files with 30 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: framebuf.c,v 1.12 2007/05/20 16:24:37 pooka Exp $ */
/* $NetBSD: framebuf.c,v 1.13 2007/05/20 19:56:56 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: framebuf.c,v 1.12 2007/05/20 16:24:37 pooka Exp $");
__RCSID("$NetBSD: framebuf.c,v 1.13 2007/05/20 19:56:56 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -67,6 +67,8 @@ struct puffs_framebuf {
#define ISTAT_INTERNAL 0x02 /* never leaves library */
#define ISTAT_NOREPLY 0x04 /* nuke after sending */
#define ISTAT_ONQUEUE ISTAT_NODESTROY /* alias */
#define PUFBUF_INCRALLOC 4096
#define PUFBUF_REMAIN(p) (p->len - p->offset)
@ -380,6 +382,29 @@ puffs_framev_enqueue_justsend(struct puffs_usermount *pu, int fd,
return 0;
}
/*
* this beauty shall remain undocumented for now
*/
int
puffs_framev_framebuf_ccpromote(struct puffs_framebuf *pufbuf,
struct puffs_cc *pcc)
{
if ((pufbuf->istat & ISTAT_ONQUEUE) == 0) {
errno = EBUSY;
return -1;
}
pufbuf->pcc = pcc;
pufbuf->fcb = NULL;
pufbuf->fcb_arg = NULL;
pufbuf->istat &= ~ISTAT_NOREPLY;
puffs_cc_yield(pcc);
return 0;
}
static struct puffs_framebuf *
findbuf(struct puffs_usermount *pu, struct puffs_framectrl *fctrl,
struct puffs_fctrl_io *fio, struct puffs_framebuf *findme)

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs.h,v 1.60 2007/05/20 16:24:37 pooka Exp $ */
/* $NetBSD: puffs.h,v 1.61 2007/05/20 19:56:56 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -622,6 +622,8 @@ int puffs_framev_enqueue_cb(struct puffs_usermount *, int,
puffs_framev_cb, void *);
int puffs_framev_enqueue_justsend(struct puffs_usermount *, int,
struct puffs_framebuf *, int);
int puffs_framev_framebuf_ccpromote(struct puffs_framebuf *,
struct puffs_cc *);
int puffs_framev_addfd(struct puffs_usermount *pu, int);
int puffs_framev_removefd(struct puffs_usermount *pu, int, int);