]> git.proxmox.com Git - mirror_zfs-debian.git/blob - module/zfs/include/sys/vdev_disk.h
Fix spl version check
[mirror_zfs-debian.git] / module / zfs / include / sys / vdev_disk.h
1 /*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 /*
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>.
25 * LLNL-CODE-403049.
26 */
27
28 #ifndef _SYS_VDEV_DISK_H
29 #define _SYS_VDEV_DISK_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #ifdef _KERNEL
36 #include <sys/vdev.h>
37 #include <sys/ddi.h>
38 #include <sys/sunldi.h>
39 #include <sys/sunddi.h>
40
41 typedef struct vdev_disk {
42 ddi_devid_t vd_devid;
43 char *vd_minor;
44 struct block_device *vd_bdev;
45 } vdev_disk_t;
46
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 **);
50
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
55 #else
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 */
60
61 /* 2.6.29 API change */
62 #ifdef HAVE_BIO_RW_SYNCIO
63 # define DIO_RW_SYNCIO BIO_RW_SYNCIO
64 #else
65 # define DIO_RW_SYNCIO BIO_RW_SYNC
66 #endif /* HAVE_BIO_RW_SYNCIO */
67
68 /* 2.6.28 API change */
69 #ifdef HAVE_OPEN_BDEV_EXCLUSIVE
70 # define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
71 # define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
72 #else
73 # define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
74 # define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
75 #endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
76
77 /* 2.6.22 API change */
78 #ifdef HAVE_1ARG_INVALIDATE_BDEV
79 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev)
80 #else
81 # define vdev_bdev_invalidate(bdev) invalidate_bdev(bdev, 1)
82 #endif /* HAVE_1ARG_INVALIDATE_BDEV */
83
84 /* 2.6.30 API change */
85 #ifdef HAVE_BDEV_LOGICAL_BLOCK_SIZE
86 # define vdev_bdev_block_size(bdev) bdev_logical_block_size(bdev)
87 #else
88 # define vdev_bdev_block_size(bdev) bdev_hardsect_size(bdev)
89 #endif
90
91 #endif /* _KERNEL */
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* _SYS_VDEV_DISK_H */