xdb.h revision 65908c77dfc02644236ba18bffe67b5ed6f23135
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_XDB_H
#define _SYS_XDB_H
#ifdef __cplusplus
extern "C" {
#endif
#define XDB_DBG_ALL 0xf
#define XDB_DBG_IO 0x1
#define XDB_DBG_INFO 0x2
/*
* Info of the exported blk device
*/
/*
* Other handy macrosx
*/
#define XDB_MINOR2INST(m) (int)(m)
#define XDB_INST2MINOR(i) (minor_t)(i)
#define XDB_INST2SOFTS(instance) \
/* get kva of a mapped-in page coresponding to (xreq-index, seg) pair */
#define XDB_BP2XREQ(bp) \
/* describe one blkif segment */
typedef struct xdb_seg {
} xdb_seg_t;
/* one blkif_request_t matches one xdb_request_t */
typedef struct xdb_request {
/* buf associated with this I/O request */
/* softstate instance associated with this I/O request */
/* the next segment we're going to process */
int xr_curseg;
/* index of this xdb_request_t in vdp->xs_req */
int xr_idx;
/* next index for a statical linked list */
int xr_next;
/* 'id' copied from blkif_request_t */
/* 'operation' copied from blkif_request_t */
/* how many pages(segments) in this I/O request */
/* all segments of this I/O request */
/* all grant table handles used in this I/O request */
/* Soft state data structure for each backend vbd */
struct xdb {
/* devinfo node pointer of this xdb */
/* coresponding frontend domain id */
/* read-only, removable, cdrom? */
/* # of total sectors */
/* sector size if existed */
/* blkif I/O request ring buffer */
/* handle to access the ring buffer */
/* base kva for mapped-in I/O page from frontend domain */
/* mutex lock for I/O related code path */
/*
* mutex lock for event handling related code path
* need to be grabbed before xs_iomutex
*/
/* # of on-going I/O buf in backend domain */
/* task thread for pushing buf to underlying target driver */
/* cv used in I/O code path, protected by xs_iomutex */
/*
* head and tail of linked list for I/O bufs need to be pushed to
* underlying target driver
*/
/* head of free list of xdb_request_t */
int xs_free_req;
/* pre-allocated xdb_request_t pool */
/* Protected by xs_cbmutex */
char *xs_lofi_path;
char *xs_params_path;
struct xenbus_watch *xs_watch_params;
struct xenbus_watch *xs_watch_media_req;
int xs_watch_taskq_count;
/* Protected by xs_cbmutex and xs_iomutex */
/* Protected by xs_iomutex */
#ifdef DEBUG
#endif /* DEBUG */
};
#ifdef __cplusplus
}
#endif
#endif /* _SYS_XDB_H */