1e9dbad6fSeschrock /* 2e9dbad6fSeschrock * CDDL HEADER START 3e9dbad6fSeschrock * 4e9dbad6fSeschrock * The contents of this file are subject to the terms of the 5e9dbad6fSeschrock * Common Development and Distribution License (the "License"). 6e9dbad6fSeschrock * You may not use this file except in compliance with the License. 7e9dbad6fSeschrock * 8e9dbad6fSeschrock * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9e9dbad6fSeschrock * or http://www.opensolaris.org/os/licensing. 10e9dbad6fSeschrock * See the License for the specific language governing permissions 11e9dbad6fSeschrock * and limitations under the License. 12e9dbad6fSeschrock * 13e9dbad6fSeschrock * When distributing Covered Code, include this CDDL HEADER in each 14e9dbad6fSeschrock * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15e9dbad6fSeschrock * If applicable, add the following below this CDDL HEADER, with the 16e9dbad6fSeschrock * fields enclosed by brackets "[]" replaced with your own identifying 17e9dbad6fSeschrock * information: Portions Copyright [yyyy] [name of copyright owner] 18e9dbad6fSeschrock * 19e9dbad6fSeschrock * CDDL HEADER END 20e9dbad6fSeschrock */ 21e9dbad6fSeschrock 22e9dbad6fSeschrock /* 233fb517f7SJames Moore * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 24e9dbad6fSeschrock */ 25e9dbad6fSeschrock 26e9dbad6fSeschrock #ifndef _SYS_ZVOL_H 27e9dbad6fSeschrock #define _SYS_ZVOL_H 28e9dbad6fSeschrock 29e9dbad6fSeschrock #include <sys/zfs_context.h> 30e9dbad6fSeschrock 31e9dbad6fSeschrock #ifdef __cplusplus 32e9dbad6fSeschrock extern "C" { 33e9dbad6fSeschrock #endif 34e9dbad6fSeschrock 35e7cbe64fSgw25295 #define ZVOL_OBJ 1ULL 36e7cbe64fSgw25295 #define ZVOL_ZAP_OBJ 2ULL 37e7cbe64fSgw25295 38e9dbad6fSeschrock #ifdef _KERNEL 39e9dbad6fSeschrock extern int zvol_check_volsize(uint64_t volsize, uint64_t blocksize); 40e9dbad6fSeschrock extern int zvol_check_volblocksize(uint64_t volblocksize); 41a2eea2e1Sahrens extern int zvol_get_stats(objset_t *os, nvlist_t *nv); 42ecd6cf80Smarks extern void zvol_create_cb(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx); 43681d9761SEric Taylor extern int zvol_create_minor(const char *); 44e9dbad6fSeschrock extern int zvol_remove_minor(const char *); 45681d9761SEric Taylor extern void zvol_remove_minors(const char *); 46*c61ea566SGeorge Wilson extern int zvol_set_volsize(const char *, uint64_t); 47e9dbad6fSeschrock 48e9dbad6fSeschrock extern int zvol_open(dev_t *devp, int flag, int otyp, cred_t *cr); 49e7cbe64fSgw25295 extern int zvol_dump(dev_t dev, caddr_t addr, daddr_t offset, int nblocks); 50e9dbad6fSeschrock extern int zvol_close(dev_t dev, int flag, int otyp, cred_t *cr); 51e9dbad6fSeschrock extern int zvol_strategy(buf_t *bp); 52e9dbad6fSeschrock extern int zvol_read(dev_t dev, uio_t *uiop, cred_t *cr); 53e9dbad6fSeschrock extern int zvol_write(dev_t dev, uio_t *uiop, cred_t *cr); 54e9dbad6fSeschrock extern int zvol_aread(dev_t dev, struct aio_req *aio, cred_t *cr); 55e9dbad6fSeschrock extern int zvol_awrite(dev_t dev, struct aio_req *aio, cred_t *cr); 56e9dbad6fSeschrock extern int zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, 57e9dbad6fSeschrock int *rvalp); 58e9dbad6fSeschrock extern int zvol_busy(void); 59e9dbad6fSeschrock extern void zvol_init(void); 60e9dbad6fSeschrock extern void zvol_fini(void); 613fb517f7SJames Moore 623fb517f7SJames Moore extern int zvol_get_volume_params(minor_t minor, uint64_t *blksize, 633fb517f7SJames Moore uint64_t *max_xfer_len, void **minor_hdl, void **objset_hdl, void **zil_hdl, 643fb517f7SJames Moore void **rl_hdl, void **bonus_hdl); 653fb517f7SJames Moore extern uint64_t zvol_get_volume_size(void *minor_hdl); 663fb517f7SJames Moore extern int zvol_get_volume_wce(void *minor_hdl); 673fb517f7SJames Moore extern void zvol_log_write_minor(void *minor_hdl, dmu_tx_t *tx, offset_t off, 683fb517f7SJames Moore ssize_t resid, boolean_t sync); 693fb517f7SJames Moore 70e9dbad6fSeschrock #endif 71e9dbad6fSeschrock 72e9dbad6fSeschrock #ifdef __cplusplus 73e9dbad6fSeschrock } 74e9dbad6fSeschrock #endif 75e9dbad6fSeschrock 76e9dbad6fSeschrock #endif /* _SYS_ZVOL_H */ 77