fdbuffer.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1998,2001 by Sun Microsystems, Inc.
* All rights reserved.
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/fdbuffer.h>
#ifdef DEBUG
static int fdb_debug;
#define FDB_D_CREATE 001
#define FDB_D_ALLOC 002
#define FDB_D_IO 004
#define FDB_D_ASYNC 010
#else
#endif
static struct kmem_cache *fdb_cache;
/* ARGSUSED */
static int
{
return (0);
}
/* ARGSUSED */
static void
{
}
void
fdb_init()
{
}
static void
{
fdb->fd_iocount = 0;
fdb->fd_iodispatch = 0;
}
{
"?fdb_page_create: pp: %p len: %lux flags: %x",
return (fdb);
}
int flags,
{
"?fdb_addr_create: addr: %p len: %lux flags: %x",
return (fdb);
}
void
{
if (flag & FDB_ICALLBACK)
}
int
{
}
void
{
}
}
case FDB_PAGEIO:
break;
case FDB_VADDR:
break;
default:
break;
}
}
}
/*
* The offset should be from the begining of the buffer
* it has nothing to do with file offset. This fact should be
* reflected in the caller of this routine.
*/
void
{
} else {
}
}
{
}
}
/*
* Note that offsets refer to offsets from the begining of the buffer
* and as such the memory should be cleared accordingly.
*/
static void
{
if (!fdh)
return;
case FDB_PAGEIO:
while (fdh) {
do {
int zerolen;
/*
* This offset is wrong since
* the offset passed from the pages
* perspective starts at some virtual
* address but the hole is relative
* to the beginning of the fdbuffer.
*/
continue;
zerolen);
l -= zerolen;
o += zerolen;
if (l == 0)
break;
if (!pp)
break;
}
break;
case FDB_VADDR:
while (fdh) {
}
default:
panic("fdb_zero_holes: Unknown fdb type.");
break;
}
}
buf_t *
int b_flags)
{
"?fdb_iosetup: off: %llx len: %lux fdb: len: %lux flags: %x",
/*
* The fdb can be used either in sync or async mode, if the
* buffer has not been used it may be used in either mode, but
* once you have started to use the buf in either mode all
* subsequent i/o requests must take place the same way.
*/
fdb->fd_iodispatch++;
case FDB_PAGEIO:
}
break;
case FDB_VADDR:
}
break;
default:
panic("fdb_iosetup: Unsupported fdb type.");
break;
};
return (bp);
}
{
}
void
{
"?fdb_ioerrdone: fdb: len: %lux flags: %x error: %d",
if (error)
else
/*
* If there is outstanding i/o return wainting for i/o's to complete.
*/
if (fdb->fd_iodispatch > 0) {
return;
}
}
void
{
int icallback;
"?fdb_iodone: fdb: len: %lux flags: %x error: %d",
fdb->fd_iodispatch--;
else
}
/*
* ioack collects the total amount of i/o accounted for
* this includes:
*
* - i/o completed
* - i/o attempted but not completed,
* - i/o not done due to holes.
*
* Once the entire i/o ranges has been accounted for we'll
* call the async function associated with the fdb.
*
*/
if ((fdb->fd_iodispatch == 0) &&
}
} else {
if (icallback) {
}
}
}