Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/block_if.h
| Show All 32 Lines | |||||
| * are thread safe, with no assumptions about the context of the completion | * are thread safe, with no assumptions about the context of the completion | ||||
| * callback - it may occur in the caller's context, or asynchronously in | * callback - it may occur in the caller's context, or asynchronously in | ||||
| * another thread. | * another thread. | ||||
| */ | */ | ||||
| #ifndef _BLOCK_IF_H_ | #ifndef _BLOCK_IF_H_ | ||||
| #define _BLOCK_IF_H_ | #define _BLOCK_IF_H_ | ||||
| #include <sys/nv.h> | |||||
| #include <sys/uio.h> | #include <sys/uio.h> | ||||
| #include <sys/unistd.h> | #include <sys/unistd.h> | ||||
| struct vm_snapshot_meta; | struct vm_snapshot_meta; | ||||
| /* | /* | ||||
| * BLOCKIF_IOV_MAX is the maximum number of scatter/gather entries in | * BLOCKIF_IOV_MAX is the maximum number of scatter/gather entries in | ||||
| * a single request. BLOCKIF_RING_MAX is the maxmimum number of | * a single request. BLOCKIF_RING_MAX is the maxmimum number of | ||||
| * pending requests that can be queued. | * pending requests that can be queued. | ||||
| */ | */ | ||||
| #define BLOCKIF_IOV_MAX 128 /* not practical to be IOV_MAX */ | #define BLOCKIF_IOV_MAX 128 /* not practical to be IOV_MAX */ | ||||
| #define BLOCKIF_RING_MAX 128 | #define BLOCKIF_RING_MAX 128 | ||||
| struct blockif_req { | struct blockif_req { | ||||
| int br_iovcnt; | int br_iovcnt; | ||||
| off_t br_offset; | off_t br_offset; | ||||
| ssize_t br_resid; | ssize_t br_resid; | ||||
| void (*br_callback)(struct blockif_req *req, int err); | void (*br_callback)(struct blockif_req *req, int err); | ||||
| void *br_param; | void *br_param; | ||||
| struct iovec br_iov[BLOCKIF_IOV_MAX]; | struct iovec br_iov[BLOCKIF_IOV_MAX]; | ||||
| }; | }; | ||||
| struct blockif_ctxt; | struct blockif_ctxt; | ||||
| struct blockif_ctxt *blockif_open(const char *optstr, const char *ident); | int blockif_legacy_config(nvlist_t *nvl, const char *opts); | ||||
| struct blockif_ctxt *blockif_open(nvlist_t *nvl, const char *ident); | |||||
| off_t blockif_size(struct blockif_ctxt *bc); | off_t blockif_size(struct blockif_ctxt *bc); | ||||
| void blockif_chs(struct blockif_ctxt *bc, uint16_t *c, uint8_t *h, | void blockif_chs(struct blockif_ctxt *bc, uint16_t *c, uint8_t *h, | ||||
| uint8_t *s); | uint8_t *s); | ||||
| int blockif_sectsz(struct blockif_ctxt *bc); | int blockif_sectsz(struct blockif_ctxt *bc); | ||||
| void blockif_psectsz(struct blockif_ctxt *bc, int *size, int *off); | void blockif_psectsz(struct blockif_ctxt *bc, int *size, int *off); | ||||
| int blockif_queuesz(struct blockif_ctxt *bc); | int blockif_queuesz(struct blockif_ctxt *bc); | ||||
| int blockif_is_ro(struct blockif_ctxt *bc); | int blockif_is_ro(struct blockif_ctxt *bc); | ||||
| int blockif_candelete(struct blockif_ctxt *bc); | int blockif_candelete(struct blockif_ctxt *bc); | ||||
| Show All 16 Lines | |||||