sd_iob.h revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef int (*dcb_t)(struct buf *); /* driver callback type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * order of end action calls:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * driver callback (iob_drv_iodone) is stuffed in b_iodone and called by
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the device driver when i/o completes. It calls the hook end action
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (iob_hook_iodone) which maintains the completion count (iob_hook.count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and calls the clients end action (iob_hook.func) when the chain is complete.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iob_hook {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct buf *chain; /* all the buffers for this iob */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t start_fba; /* initial disk block for the xfer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_off_t last_fba; /* last disk block for the xfer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nsc_size_t size; /* # bytes for entire transfer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *last_vaddr; /* ending addr of last i/o request */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sdbc_ea_fn_t func; /* clients end action routine */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int (* iob_hook_iodone)(struct buf *, struct iob_hook *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blind_t param; /* param for clnt end action routine */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kmutex_t *lockp; /* mutex for releasing buffers */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t wait; /* sync for sleeping on synch i/o */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SD_BIO_STATS */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _sd_buf_list {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bl_hooks_avail; /* monitor available hook count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int bl_hook_lowmark; /* record if ever run out of hooks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int max_hook_waiters; /* record max ever waiters */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kcondvar_t hook_wait; /* sync for sleeping on synch i/o */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * NOTE: if you change this, then also make changes to the generation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of sd_iob_impl*.c in src/uts/common/Makefile.files and Makefile.rules!
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* define driver callback and driver callback function table */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ((*_sd_buflist.hooks[i].iob_hook_iodone) \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SD_IOB_H */