4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (C) 2008-2010 Lawrence Livermore National Security, LLC.
23 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
24 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
28 #ifndef _SYS_VDEV_DISK_H
29 #define _SYS_VDEV_DISK_H
38 #include <sys/sunldi.h>
39 #include <sys/sunddi.h>
41 typedef struct vdev_disk {
44 struct block_device *vd_bdev;
47 extern int vdev_disk_physio(struct block_device *, caddr_t,
48 size_t, uint64_t, int);
49 extern int vdev_disk_read_rootlabel(char *, char *, nvlist_t **);
51 /* 2.6.24 API change */
52 #ifdef HAVE_2ARGS_BIO_END_IO_T
53 # define BIO_END_IO_PROTO(fn, x, y, z) static void fn(struct bio *x, int z)
54 # define BIO_END_IO_RETURN(rc) return
56 # define BIO_END_IO_PROTO(fn, x, y, z) static int fn(struct bio *x, \
57 unsigned int y, int z)
58 # define BIO_END_IO_RETURN(rc) return rc
59 #endif /* HAVE_2ARGS_BIO_END_IO_T */
61 /* 2.6.28 API change */
62 #ifdef HAVE_OPEN_BDEV_EXCLUSIVE
63 # define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
64 # define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
66 # define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
67 # define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
68 #endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
70 /* 2.6.22 API change */
71 #ifdef HAVE_1ARG_INVALIDATE_BDEV
72 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev)
74 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1)
75 #endif /* HAVE_1ARG_INVALIDATE_BDEV */
77 /* 2.6.30 API change */
78 #ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE
79 # define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev)
81 # define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
90 #endif /* _SYS_VDEV_DISK_H */