* split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter * remove last dependencies to puffs from putter, it's completely independent now
This commit is contained in:
parent
3384f1f26e
commit
9ac65ee1fe
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.729 2007/11/12 15:02:58 jmmv Exp $
|
||||
# $NetBSD: mi,v 1.730 2007/11/12 16:39:36 pooka Exp $
|
||||
. base-sys-root
|
||||
./altroot base-sys-root
|
||||
./bin base-sys-root
|
||||
|
@ -775,6 +775,7 @@
|
|||
./usr/include/dev/pci base-c-usr
|
||||
./usr/include/dev/pckbc base-c-usr
|
||||
./usr/include/dev/pcmcia base-c-usr
|
||||
./usr/include/dev/putter base-c-usr
|
||||
./usr/include/dev/raidframe base-c-usr
|
||||
./usr/include/dev/rcons base-obsolete obsolete
|
||||
./usr/include/dev/sbus base-c-usr
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: mi,v 1.1082 2007/11/12 15:05:15 jmmv Exp $
|
||||
# $NetBSD: mi,v 1.1083 2007/11/12 16:39:37 pooka Exp $
|
||||
./etc/mtree/set.comp comp-sys-root
|
||||
./usr/bin/addr2line comp-debug-bin bfd
|
||||
./usr/bin/ar comp-util-bin bfd
|
||||
|
@ -448,6 +448,7 @@
|
|||
./usr/include/dev/pcmcia/pcmciachip.h comp-obsolete obsolete
|
||||
./usr/include/dev/pcmcia/pcmciareg.h comp-obsolete obsolete
|
||||
./usr/include/dev/pcmcia/pcmciavar.h comp-obsolete obsolete
|
||||
./usr/include/dev/putter/putter.h comp-c-include
|
||||
./usr/include/dev/raidframe/raidframeio.h comp-c-include
|
||||
./usr/include/dev/raidframe/raidframevar.h comp-c-include
|
||||
./usr/include/dev/ramdisk.h comp-obsolete obsolete
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: flush.c,v 1.12 2007/10/11 19:41:14 pooka Exp $ */
|
||||
/* $NetBSD: flush.c,v 1.13 2007/11/12 16:39:35 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: flush.c,v 1.12 2007/10/11 19:41:14 pooka Exp $");
|
||||
__RCSID("$NetBSD: flush.c,v 1.13 2007/11/12 16:39:35 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
/*
|
||||
|
@ -62,8 +62,8 @@ doflush(struct puffs_usermount *pu, void *cookie, int op,
|
|||
struct puffs_flush pf;
|
||||
ssize_t n;
|
||||
|
||||
pf.pf_frhdr.pfr_len = sizeof(struct puffs_flush);
|
||||
pf.pf_frhdr.pfr_type = PUFFSOP_FLUSH;
|
||||
pf.pf_req.preq_pth.pth_framelen = sizeof(struct puffs_flush);
|
||||
pf.pf_req.preq_opclass = PUFFSOP_FLUSH;
|
||||
|
||||
pf.pf_op = op;
|
||||
pf.pf_cookie = cookie;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: requests.c,v 1.15 2007/10/31 16:09:09 pooka Exp $ */
|
||||
/* $NetBSD: requests.c,v 1.16 2007/11/12 16:39:35 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: requests.c,v 1.15 2007/10/31 16:09:09 pooka Exp $");
|
||||
__RCSID("$NetBSD: requests.c,v 1.16 2007/11/12 16:39:35 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -66,24 +66,25 @@ puffs_req_makeget(struct puffs_usermount *pu, size_t buflen, int maxops)
|
|||
int
|
||||
puffs_req_loadget(struct puffs_getreq *pgr)
|
||||
{
|
||||
struct puffs_frame pfr;
|
||||
struct putter_hdr pth;
|
||||
uint8_t *buf;
|
||||
size_t rlen;
|
||||
int fd = pgr->pgr_pu->pu_fd;
|
||||
|
||||
assert(pgr->pgr_buf == NULL);
|
||||
|
||||
if (read(fd, &pfr, sizeof(struct puffs_frame)) == -1) {
|
||||
if (read(fd, &pth, sizeof(struct putter_hdr)) == -1) {
|
||||
if (errno == EWOULDBLOCK)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
buf = malloc(pfr.pfr_alloclen);
|
||||
buf = malloc(PUFFS_MSG_MAXSIZE); /* XXX */
|
||||
assert(buf != NULL); /* XXX: a bit more grace here, thanks */
|
||||
memcpy(buf, &pfr, sizeof(pfr));
|
||||
memcpy(buf, &pth, sizeof(pth));
|
||||
|
||||
rlen = pfr.pfr_len - sizeof(pfr);
|
||||
if (read(fd, buf + sizeof(pfr), rlen) != rlen) { /* XXX */
|
||||
/* LINTED */
|
||||
rlen = pth.pth_framelen - sizeof(pth);
|
||||
if (read(fd, buf + sizeof(pth), rlen) != rlen) { /* XXX */
|
||||
free(buf);
|
||||
return -1;
|
||||
}
|
||||
|
@ -149,9 +150,9 @@ puffs_req_put(struct puffs_putreq *ppr, struct puffs_req *preq)
|
|||
ssize_t n;
|
||||
|
||||
/* LINTED conversion is benign, says author; may revisit */
|
||||
preq->preq_frhdr.pfr_len = preq->preq_buflen;
|
||||
n = write(ppr->ppr_pu->pu_fd, preq, preq->preq_frhdr.pfr_len);
|
||||
assert(n == preq->preq_frhdr.pfr_len);
|
||||
preq->preq_pth.pth_framelen = preq->preq_buflen;
|
||||
n = write(ppr->ppr_pu->pu_fd, preq, preq->preq_pth.pth_framelen);
|
||||
assert(n == preq->preq_pth.pth_framelen);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: suspend.c,v 1.6 2007/10/11 19:41:15 pooka Exp $ */
|
||||
/* $NetBSD: suspend.c,v 1.7 2007/11/12 16:39:35 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(lint)
|
||||
__RCSID("$NetBSD: suspend.c,v 1.6 2007/10/11 19:41:15 pooka Exp $");
|
||||
__RCSID("$NetBSD: suspend.c,v 1.7 2007/11/12 16:39:35 pooka Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
/*
|
||||
|
@ -36,6 +36,8 @@ __RCSID("$NetBSD: suspend.c,v 1.6 2007/10/11 19:41:15 pooka Exp $");
|
|||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <dev/puttervar.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <puffs.h>
|
||||
|
@ -48,15 +50,15 @@ __RCSID("$NetBSD: suspend.c,v 1.6 2007/10/11 19:41:15 pooka Exp $");
|
|||
int
|
||||
puffs_fs_suspend(struct puffs_usermount *pu)
|
||||
{
|
||||
struct puffs_frame pfr;
|
||||
struct puffs_req preq;
|
||||
size_t n;
|
||||
|
||||
pfr.pfr_len = sizeof(struct puffs_frame);
|
||||
pfr.pfr_type = PUFFSOP_SUSPEND;
|
||||
preq.preq_pth.pth_framelen = sizeof(struct putter_hdr);
|
||||
preq.preq_opclass = PUFFSOP_SUSPEND;
|
||||
|
||||
n = write(pu->pu_fd, &pfr, sizeof(pfr));
|
||||
n = write(pu->pu_fd, &preq, sizeof(preq));
|
||||
|
||||
/* XXX */
|
||||
assert(n == sizeof(pfr));
|
||||
assert(n == sizeof(preq));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: Makefile,v 1.25 2007/05/01 17:18:55 bouyer Exp $
|
||||
# $NetBSD: Makefile,v 1.26 2007/11/12 16:39:32 pooka Exp $
|
||||
|
||||
SUBDIR= apm ata bluetooth dec dmover hpc i2o ic ieee1394 ir isa microcode ofw \
|
||||
pci pckbport pcmcia raidframe sbus scsipi sun tc usb vme wscons
|
||||
pci pckbport pcmcia putter raidframe sbus scsipi sun tc usb vme wscons
|
||||
|
||||
INCSDIR= /usr/include/dev
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.1 2007/11/12 16:39:32 pooka Exp $
|
||||
#
|
||||
|
||||
INCSDIR=/usr/include/dev/putter
|
||||
|
||||
INCS= putter.h
|
||||
|
||||
.include <bsd.kinc.mk>
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: putter.c,v 1.1 2007/11/12 14:30:56 pooka Exp $ */
|
||||
/* $NetBSD: putter.c,v 1.2 2007/11/12 16:39:33 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: putter.c,v 1.1 2007/11/12 14:30:56 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: putter.c,v 1.2 2007/11/12 16:39:33 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
|
@ -45,9 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: putter.c,v 1.1 2007/11/12 14:30:56 pooka Exp $");
|
|||
#include <sys/poll.h>
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <dev/putter/puttervar.h>
|
||||
|
||||
#include <fs/puffs/puffs_msgif.h> /* XXX: for frame headers, goes away soon */
|
||||
#include <dev/putter/putter_sys.h>
|
||||
|
||||
/*
|
||||
* putter instance structures. these are always allocated and freed
|
||||
|
@ -91,6 +89,8 @@ static int putterdebug = 0;
|
|||
#define DPRINTF_VERBOSE(x)
|
||||
#endif
|
||||
|
||||
#define PUTTER_CLONER 0x7ffff
|
||||
|
||||
/*
|
||||
* public init / deinit
|
||||
*/
|
||||
|
@ -185,12 +185,12 @@ putter_fop_write(struct file *fp, off_t *off, struct uio *uio,
|
|||
kauth_cred_t cred, int flags)
|
||||
{
|
||||
struct putter_instance *pi = fp->f_data;
|
||||
struct puffs_frame pfr;
|
||||
struct putter_hdr pth;
|
||||
uint8_t *buf;
|
||||
size_t frsize;
|
||||
int error;
|
||||
|
||||
DPRINTF(("puffs_fop_write (%p): writing response, resid %zu\n",
|
||||
DPRINTF(("putter_fop_write (%p): writing response, resid %zu\n",
|
||||
pi->pi_private, uio->uio_resid));
|
||||
|
||||
if (pi->pi_private == PUTTER_EMBRYO || pi->pi_private == PUTTER_DEAD) {
|
||||
|
@ -198,29 +198,29 @@ putter_fop_write(struct file *fp, off_t *off, struct uio *uio,
|
|||
return ENOENT;
|
||||
}
|
||||
|
||||
error = uiomove(&pfr, sizeof(struct puffs_frame), uio);
|
||||
error = uiomove(&pth, sizeof(struct putter_hdr), uio);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/* Sorry mate, the kernel doesn't buffer. */
|
||||
frsize = pfr.pfr_len - sizeof(struct puffs_frame);
|
||||
frsize = pth.pth_framelen - sizeof(struct putter_hdr);
|
||||
if (uio->uio_resid < frsize)
|
||||
return EINVAL;
|
||||
|
||||
buf = kmem_alloc(frsize + sizeof(struct puffs_frame), KM_SLEEP);
|
||||
memcpy(buf, &pfr, sizeof(pfr));
|
||||
error = uiomove(buf+sizeof(struct puffs_frame), frsize, uio);
|
||||
buf = kmem_alloc(frsize + sizeof(struct putter_hdr), KM_SLEEP);
|
||||
memcpy(buf, &pth, sizeof(pth));
|
||||
error = uiomove(buf+sizeof(struct putter_hdr), frsize, uio);
|
||||
if (error == 0) {
|
||||
pi->pi_pop->pop_dispatch(pi->pi_private, buf);
|
||||
}
|
||||
kmem_free(buf, frsize + sizeof(struct puffs_frame));
|
||||
kmem_free(buf, frsize + sizeof(struct putter_hdr));
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Poll query interface. The question is only if an event
|
||||
* can be read from us (and by read I mean ioctl... ugh).
|
||||
* can be read from us.
|
||||
*/
|
||||
#define PUTTERPOLL_EVSET (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI)
|
||||
static int
|
||||
|
@ -406,7 +406,7 @@ puttercdopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
|||
* XXX: decide on some security model and check permissions
|
||||
*/
|
||||
|
||||
if (minor(dev) != PUFFS_CLONER)
|
||||
if (minor(dev) != PUTTER_CLONER)
|
||||
return ENXIO;
|
||||
|
||||
if ((error = falloc(l, &fp, &fd)) != 0)
|
||||
|
@ -416,7 +416,7 @@ puttercdopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
|||
|
||||
mutex_enter(&pi_mtx);
|
||||
idx = get_pi_idx(pi);
|
||||
if (idx == PUFFS_CLONER) {
|
||||
if (idx == PUTTER_CLONER) {
|
||||
mutex_exit(&pi_mtx);
|
||||
kmem_free(pi, sizeof(struct putter_instance));
|
||||
FILE_UNUSE(fp, l);
|
||||
|
@ -511,8 +511,8 @@ get_pi_idx(struct putter_instance *pi_i)
|
|||
|
||||
i = 0;
|
||||
TAILQ_FOREACH(pi, &putter_ilist, pi_entries) {
|
||||
if (i == PUFFS_CLONER)
|
||||
return PUFFS_CLONER;
|
||||
if (i == PUTTER_CLONER)
|
||||
return PUTTER_CLONER;
|
||||
if (i != pi->pi_idx)
|
||||
break;
|
||||
i++;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
/* $NetBSD: putter.h,v 1.1 2007/11/12 16:39:33 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by the
|
||||
* Research Foundation of Helsinki University of Technology
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _DEV_PUTTER_PUTTER_H_
|
||||
#define _DEV_PUTTER_PUTTER_H_
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct putter_hdr {
|
||||
uint64_t pth_framelen;
|
||||
};
|
||||
|
||||
#endif /* _SYS_PUTTER_PUTTER_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puttervar.h,v 1.1 2007/11/12 14:30:56 pooka Exp $ */
|
||||
/* $NetBSD: putter_sys.h,v 1.1 2007/11/12 16:39:33 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -28,15 +28,13 @@
|
|||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYS_PUTTER_H_
|
||||
#define _SYS_PUTTER_H_
|
||||
#ifndef _DEV_PUTTER_PUTTERSYS_H_
|
||||
#define _DEV_PUTTER_PUTTERSYS_H_
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/kauth.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/pool.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <dev/putter/putter.h>
|
||||
|
||||
struct putter_ops {
|
||||
int (*pop_getout)(void *, size_t, int, uint8_t **,size_t *,void **);
|
||||
|
@ -52,4 +50,4 @@ struct putter_instance *putter_attach(pid_t, int, void *,
|
|||
void putter_detach(struct putter_instance *);
|
||||
void putter_notify(struct putter_instance *);
|
||||
|
||||
#endif /* _SYS_PUTTER_H_ */
|
||||
#endif /* _DEV_PUTTER_PUTTERSYS_H_ */
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_msgif.c,v 1.54 2007/11/12 14:30:56 pooka Exp $ */
|
||||
/* $NetBSD: puffs_msgif.c,v 1.55 2007/11/12 16:39:34 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.54 2007/11/12 14:30:56 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.55 2007/11/12 16:39:34 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/fstrans.h>
|
||||
|
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.54 2007/11/12 14:30:56 pooka Exp $
|
|||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#include <dev/putter/puttervar.h>
|
||||
#include <dev/putter/putter_sys.h>
|
||||
|
||||
#include <fs/puffs/puffs_msgif.h>
|
||||
#include <fs/puffs/puffs_sys.h>
|
||||
|
@ -630,15 +630,22 @@ puffs_msgif_getout(void *this, size_t maxsize, int nonblock,
|
|||
puffs_msgpark_release(park);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* check size */
|
||||
preq = park->park_preq;
|
||||
|
||||
#if 0
|
||||
/* check size */
|
||||
/*
|
||||
* XXX: this check is not valid for now, we don't know
|
||||
* the size of the caller's input buffer. i.e. this
|
||||
* will most likely go away
|
||||
*/
|
||||
if (maxsize < preq->preq_frhdr.pfr_len) {
|
||||
DPRINTF(("buffer too small\n"));
|
||||
puffs_msgpark_release(park);
|
||||
error = E2BIG;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINTF(("returning\n"));
|
||||
|
||||
|
@ -665,10 +672,8 @@ puffs_msgif_getout(void *this, size_t maxsize, int nonblock,
|
|||
|
||||
if (error == 0) {
|
||||
*data = (uint8_t *)preq;
|
||||
preq->preq_frhdr.pfr_len = park->park_copylen;
|
||||
preq->preq_frhdr.pfr_alloclen = park->park_maxlen;
|
||||
preq->preq_frhdr.pfr_type = preq->preq_opclass; /* yay! */
|
||||
*dlen = preq->preq_frhdr.pfr_len;
|
||||
preq->preq_pth.pth_framelen = park->park_copylen;
|
||||
*dlen = preq->preq_pth.pth_framelen;
|
||||
*parkptr = park;
|
||||
}
|
||||
|
||||
|
@ -727,11 +732,10 @@ puffs_msgif_waitcount(void *this)
|
|||
* XXX: locking with this one?
|
||||
*/
|
||||
static void
|
||||
puffs_msgif_incoming(void *this, void *buf)
|
||||
puffs_msgif_incoming(void *this, struct puffs_req *preq)
|
||||
{
|
||||
struct puffs_mount *pmp = this;
|
||||
struct puffs_req *preq = buf;
|
||||
struct puffs_frame *pfr = &preq->preq_frhdr;
|
||||
struct putter_hdr *pth = &preq->preq_pth;
|
||||
struct puffs_msgpark *park;
|
||||
int release, wgone;
|
||||
|
||||
|
@ -756,9 +760,10 @@ puffs_msgif_incoming(void *this, void *buf)
|
|||
|
||||
mutex_enter(&park->park_mtx);
|
||||
puffs_msgpark_reference(park);
|
||||
if (pfr->pfr_len > park->park_maxlen) {
|
||||
if (pth->pth_framelen > park->park_maxlen) {
|
||||
DPRINTF(("puffs_msgif_income: invalid buffer length: "
|
||||
"%zu (req %" PRIu64 ", \n", pfr->pfr_len, preq->preq_id));
|
||||
"%" PRIu64 " (req %" PRIu64 ", \n", pth->pth_framelen,
|
||||
preq->preq_id));
|
||||
park->park_preq->preq_rv = EPROTO;
|
||||
cv_signal(&park->park_cv);
|
||||
puffs_msgpark_release(park);
|
||||
|
@ -780,11 +785,11 @@ puffs_msgif_incoming(void *this, void *buf)
|
|||
if (park->park_flags & PARKFLAG_CALL) {
|
||||
DPRINTF(("puffs_msgif_income: call for %p, arg %p\n",
|
||||
park->park_preq, park->park_donearg));
|
||||
park->park_done(pmp, buf, park->park_donearg);
|
||||
park->park_done(pmp, preq, park->park_donearg);
|
||||
release = 2;
|
||||
} else {
|
||||
/* XXX: yes, I know */
|
||||
memcpy(park->park_preq, buf, pfr->pfr_len);
|
||||
memcpy(park->park_preq, preq, pth->pth_framelen);
|
||||
release = 1;
|
||||
}
|
||||
}
|
||||
|
@ -942,12 +947,12 @@ int
|
|||
puffs_msgif_dispatch(void *this, uint8_t *buf)
|
||||
{
|
||||
struct puffs_mount *pmp = this;
|
||||
struct puffs_frame *pfr = (struct puffs_frame *)buf;
|
||||
struct puffs_req *preq = (struct puffs_req *)buf;
|
||||
|
||||
switch (PUFFSOP_OPCLASS(pfr->pfr_type)) {
|
||||
switch (PUFFSOP_OPCLASS(preq->preq_opclass)) {
|
||||
case PUFFSOP_VN:
|
||||
case PUFFSOP_VFS:
|
||||
puffs_msgif_incoming(pmp, buf);
|
||||
puffs_msgif_incoming(pmp, preq);
|
||||
break;
|
||||
case PUFFSOP_FLUSH:
|
||||
puffsop_flush(pmp, (void *)buf);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_msgif.h,v 1.59 2007/10/21 14:28:05 pooka Exp $ */
|
||||
/* $NetBSD: puffs_msgif.h,v 1.60 2007/11/12 16:39:35 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
|
||||
|
@ -42,14 +42,9 @@
|
|||
#include <sys/dirent.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
#include <uvm/uvm_prot.h>
|
||||
#include <dev/putter/putter.h>
|
||||
|
||||
/* XXX: sanitize */
|
||||
struct puffs_frame {
|
||||
uint32_t pfr_len;
|
||||
uint32_t pfr_type;
|
||||
uint32_t pfr_alloclen;
|
||||
};
|
||||
#include <uvm/uvm_prot.h>
|
||||
|
||||
#define PUFFSOP_VFS 0x01 /* read/write */
|
||||
#define PUFFSOP_VN 0x02 /* read/write */
|
||||
|
@ -105,7 +100,7 @@ enum {
|
|||
#define PUFFS_ERR_MAX PUFFS_ERR_VPTOFH
|
||||
|
||||
#define PUFFSDEVELVERS 0x80000000
|
||||
#define PUFFSVERSION 22
|
||||
#define PUFFSVERSION 23
|
||||
#define PUFFSNAMESIZE 32
|
||||
|
||||
#define PUFFS_TYPEPREFIX "puffs|"
|
||||
|
@ -155,22 +150,14 @@ struct puffs_kargs {
|
|||
|
||||
#define PUFFS_FHSIZE_MAX 1020 /* XXX: FHANDLE_SIZE_MAX - 4 */
|
||||
|
||||
/*
|
||||
* This is the device minor number for the cloning device. Make it
|
||||
* a high number "just in case", even though we don't want to open
|
||||
* any specific devices currently.
|
||||
*/
|
||||
#define PUFFS_CLONER 0x7ffff
|
||||
|
||||
struct puffs_req {
|
||||
struct puffs_frame preq_frhdr;
|
||||
|
||||
uint16_t preq_opclass;
|
||||
uint16_t preq_optype;
|
||||
struct putter_hdr preq_pth;
|
||||
|
||||
uint64_t preq_id;
|
||||
void *preq_cookie;
|
||||
|
||||
uint16_t preq_opclass;
|
||||
uint16_t preq_optype;
|
||||
int preq_rv;
|
||||
|
||||
uint32_t preq_setbacks;
|
||||
|
@ -188,23 +175,6 @@ struct puffs_req {
|
|||
uint8_t preq_buf[0] __aligned(ALIGNBYTES+1);
|
||||
};
|
||||
|
||||
struct puffs_reqh_get {
|
||||
void *phg_buf; /* user buffer */
|
||||
size_t phg_buflen; /* user buffer length */
|
||||
|
||||
int phg_nops; /* max ops user wants / number delivered */
|
||||
int phg_more; /* advisory: more ops available? */
|
||||
};
|
||||
|
||||
struct puffs_reqh_put {
|
||||
int php_nops; /* ops available / ops handled */
|
||||
|
||||
/* these describe the first request */
|
||||
uint64_t php_id; /* request id */
|
||||
void *php_buf; /* user buffer address */
|
||||
size_t php_buflen; /* user buffer length, hdr NOT incl. */
|
||||
};
|
||||
|
||||
#define PUFFS_SETBACK_INACT_N1 0x01 /* set VOP_INACTIVE for node 1 */
|
||||
#define PUFFS_SETBACK_INACT_N2 0x02 /* set VOP_INACTIVE for node 2 */
|
||||
#define PUFFS_SETBACK_NOREF_N1 0x04 /* set pn PN_NOREFS for node 1 */
|
||||
|
@ -226,7 +196,7 @@ struct puffs_reqh_put {
|
|||
|
||||
/* XXX: needs restructuring */
|
||||
struct puffs_flush {
|
||||
struct puffs_frame pf_frhdr;
|
||||
struct puffs_req pf_req;
|
||||
|
||||
void *pf_cookie;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: puffs_vfsops.c,v 1.67 2007/11/12 14:30:56 pooka Exp $ */
|
||||
/* $NetBSD: puffs_vfsops.c,v 1.68 2007/11/12 16:39:35 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.67 2007/11/12 14:30:56 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.68 2007/11/12 16:39:35 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
|
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.67 2007/11/12 14:30:56 pooka Exp
|
|||
#include <sys/fstrans.h>
|
||||
#include <sys/proc.h>
|
||||
|
||||
#include <dev/putter/puttervar.h>
|
||||
#include <dev/putter/putter_sys.h>
|
||||
|
||||
#include <fs/puffs/puffs_msgif.h>
|
||||
#include <fs/puffs/puffs_sys.h>
|
||||
|
|
Loading…
Reference in New Issue