1dnl # 2dnl # 2.6.38 API change, 3dnl # Added blkdev_get_by_path() 4dnl # 5AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH], [ 6 ZFS_LINUX_TEST_SRC([blkdev_get_by_path], [ 7 #include <linux/fs.h> 8 #include <linux/blkdev.h> 9 ], [ 10 struct block_device *bdev __attribute__ ((unused)) = NULL; 11 const char *path = "path"; 12 fmode_t mode = 0; 13 void *holder = NULL; 14 15 bdev = blkdev_get_by_path(path, mode, holder); 16 ]) 17]) 18 19AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH], [ 20 AC_MSG_CHECKING([whether blkdev_get_by_path() exists]) 21 ZFS_LINUX_TEST_RESULT([blkdev_get_by_path], [ 22 AC_MSG_RESULT(yes) 23 ], [ 24 ZFS_LINUX_TEST_ERROR([blkdev_get_by_path()]) 25 ]) 26]) 27 28dnl # 29dnl # 2.6.38 API change, 30dnl # Added blkdev_put() 31dnl # 32AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_PUT], [ 33 ZFS_LINUX_TEST_SRC([blkdev_put], [ 34 #include <linux/fs.h> 35 #include <linux/blkdev.h> 36 ], [ 37 struct block_device *bdev = NULL; 38 fmode_t mode = 0; 39 40 blkdev_put(bdev, mode); 41 ]) 42]) 43 44AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_PUT], [ 45 AC_MSG_CHECKING([whether blkdev_put() exists]) 46 ZFS_LINUX_TEST_RESULT([blkdev_put], [ 47 AC_MSG_RESULT(yes) 48 ], [ 49 ZFS_LINUX_TEST_ERROR([blkdev_put()]) 50 ]) 51]) 52 53dnl # 54dnl # 4.1 API, exported blkdev_reread_part() symbol, back ported to the 55dnl # 3.10.0 CentOS 7.x enterprise kernels. 56dnl # 57AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART], [ 58 ZFS_LINUX_TEST_SRC([blkdev_reread_part], [ 59 #include <linux/fs.h> 60 #include <linux/blkdev.h> 61 ], [ 62 struct block_device *bdev = NULL; 63 int error; 64 65 error = blkdev_reread_part(bdev); 66 ]) 67]) 68 69AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_REREAD_PART], [ 70 AC_MSG_CHECKING([whether blkdev_reread_part() exists]) 71 ZFS_LINUX_TEST_RESULT([blkdev_reread_part], [ 72 AC_MSG_RESULT(yes) 73 AC_DEFINE(HAVE_BLKDEV_REREAD_PART, 1, 74 [blkdev_reread_part() exists]) 75 ], [ 76 AC_MSG_RESULT(no) 77 ]) 78]) 79 80dnl # 81dnl # check_disk_change() was removed in 5.10 82dnl # 83AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE], [ 84 ZFS_LINUX_TEST_SRC([check_disk_change], [ 85 #include <linux/fs.h> 86 #include <linux/blkdev.h> 87 ], [ 88 struct block_device *bdev = NULL; 89 bool error; 90 91 error = check_disk_change(bdev); 92 ]) 93]) 94 95AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE], [ 96 AC_MSG_CHECKING([whether check_disk_change() exists]) 97 ZFS_LINUX_TEST_RESULT([check_disk_change], [ 98 AC_MSG_RESULT(yes) 99 AC_DEFINE(HAVE_CHECK_DISK_CHANGE, 1, 100 [check_disk_change() exists]) 101 ], [ 102 AC_MSG_RESULT(no) 103 ]) 104]) 105 106dnl # 107dnl # 5.10 API, check_disk_change() is removed, in favor of 108dnl # bdev_check_media_change(), which doesn't force revalidation 109dnl # 110AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [ 111 ZFS_LINUX_TEST_SRC([bdev_check_media_change], [ 112 #include <linux/fs.h> 113 #include <linux/blkdev.h> 114 ], [ 115 struct block_device *bdev = NULL; 116 int error; 117 118 error = bdev_check_media_change(bdev); 119 ]) 120]) 121 122AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE], [ 123 AC_MSG_CHECKING([whether bdev_disk_changed() exists]) 124 ZFS_LINUX_TEST_RESULT([bdev_check_media_change], [ 125 AC_MSG_RESULT(yes) 126 AC_DEFINE(HAVE_BDEV_CHECK_MEDIA_CHANGE, 1, 127 [bdev_check_media_change() exists]) 128 ], [ 129 AC_MSG_RESULT(no) 130 ]) 131]) 132 133dnl # 134dnl # 2.6.22 API change 135dnl # Single argument invalidate_bdev() 136dnl # 137AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV], [ 138 ZFS_LINUX_TEST_SRC([invalidate_bdev], [ 139 #include <linux/buffer_head.h> 140 #include <linux/blkdev.h> 141 ],[ 142 struct block_device *bdev = NULL; 143 invalidate_bdev(bdev); 144 ]) 145]) 146 147AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV], [ 148 AC_MSG_CHECKING([whether invalidate_bdev() exists]) 149 ZFS_LINUX_TEST_RESULT([invalidate_bdev], [ 150 AC_MSG_RESULT(yes) 151 ],[ 152 ZFS_LINUX_TEST_ERROR([invalidate_bdev()]) 153 ]) 154]) 155 156dnl # 157dnl # 5.11 API, lookup_bdev() takes dev_t argument. 158dnl # 2.6.27 API, lookup_bdev() was first exported. 159dnl # 4.4.0-6.21 API, lookup_bdev() on Ubuntu takes mode argument. 160dnl # 161AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV], [ 162 ZFS_LINUX_TEST_SRC([lookup_bdev_devt], [ 163 #include <linux/blkdev.h> 164 ], [ 165 int error __attribute__ ((unused)); 166 const char path[] = "/example/path"; 167 dev_t dev; 168 169 error = lookup_bdev(path, &dev); 170 ]) 171 172 ZFS_LINUX_TEST_SRC([lookup_bdev_1arg], [ 173 #include <linux/fs.h> 174 #include <linux/blkdev.h> 175 ], [ 176 struct block_device *bdev __attribute__ ((unused)); 177 const char path[] = "/example/path"; 178 179 bdev = lookup_bdev(path); 180 ]) 181 182 ZFS_LINUX_TEST_SRC([lookup_bdev_mode], [ 183 #include <linux/fs.h> 184 ], [ 185 struct block_device *bdev __attribute__ ((unused)); 186 const char path[] = "/example/path"; 187 188 bdev = lookup_bdev(path, FMODE_READ); 189 ]) 190]) 191 192AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV], [ 193 AC_MSG_CHECKING([whether lookup_bdev() wants dev_t arg]) 194 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_devt], 195 [lookup_bdev], [fs/block_dev.c], [ 196 AC_MSG_RESULT(yes) 197 AC_DEFINE(HAVE_DEVT_LOOKUP_BDEV, 1, 198 [lookup_bdev() wants dev_t arg]) 199 ], [ 200 AC_MSG_RESULT(no) 201 202 AC_MSG_CHECKING([whether lookup_bdev() wants 1 arg]) 203 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_1arg], 204 [lookup_bdev], [fs/block_dev.c], [ 205 AC_MSG_RESULT(yes) 206 AC_DEFINE(HAVE_1ARG_LOOKUP_BDEV, 1, 207 [lookup_bdev() wants 1 arg]) 208 ], [ 209 AC_MSG_RESULT(no) 210 211 AC_MSG_CHECKING([whether lookup_bdev() wants mode arg]) 212 ZFS_LINUX_TEST_RESULT_SYMBOL([lookup_bdev_mode], 213 [lookup_bdev], [fs/block_dev.c], [ 214 AC_MSG_RESULT(yes) 215 AC_DEFINE(HAVE_MODE_LOOKUP_BDEV, 1, 216 [lookup_bdev() wants mode arg]) 217 ], [ 218 ZFS_LINUX_TEST_ERROR([lookup_bdev()]) 219 ]) 220 ]) 221 ]) 222]) 223 224dnl # 225dnl # 2.6.30 API change 226dnl # 227dnl # The bdev_physical_block_size() interface was added to provide a way 228dnl # to determine the smallest write which can be performed without a 229dnl # read-modify-write operation. 230dnl # 231dnl # Unfortunately, this interface isn't entirely reliable because 232dnl # drives are sometimes known to misreport this value. 233dnl # 234AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ 235 ZFS_LINUX_TEST_SRC([bdev_physical_block_size], [ 236 #include <linux/blkdev.h> 237 ],[ 238 struct block_device *bdev __attribute__ ((unused)) = NULL; 239 bdev_physical_block_size(bdev); 240 ]) 241]) 242 243AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE], [ 244 AC_MSG_CHECKING([whether bdev_physical_block_size() is available]) 245 ZFS_LINUX_TEST_RESULT([bdev_physical_block_size], [ 246 AC_MSG_RESULT(yes) 247 ],[ 248 ZFS_LINUX_TEST_ERROR([bdev_physical_block_size()]) 249 ]) 250]) 251 252dnl # 253dnl # 2.6.30 API change 254dnl # Added bdev_logical_block_size(). 255dnl # 256AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ 257 ZFS_LINUX_TEST_SRC([bdev_logical_block_size], [ 258 #include <linux/blkdev.h> 259 ],[ 260 struct block_device *bdev __attribute__ ((unused)) = NULL; 261 bdev_logical_block_size(bdev); 262 ]) 263]) 264 265AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE], [ 266 AC_MSG_CHECKING([whether bdev_logical_block_size() is available]) 267 ZFS_LINUX_TEST_RESULT([bdev_logical_block_size], [ 268 AC_MSG_RESULT(yes) 269 ],[ 270 ZFS_LINUX_TEST_ERROR([bdev_logical_block_size()]) 271 ]) 272]) 273 274dnl # 275dnl # 5.11 API change 276dnl # Added bdev_whole() helper. 277dnl # 278AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE], [ 279 ZFS_LINUX_TEST_SRC([bdev_whole], [ 280 #include <linux/blkdev.h> 281 ],[ 282 struct block_device *bdev = NULL; 283 bdev = bdev_whole(bdev); 284 ]) 285]) 286 287AC_DEFUN([ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE], [ 288 AC_MSG_CHECKING([whether bdev_whole() is available]) 289 ZFS_LINUX_TEST_RESULT([bdev_whole], [ 290 AC_MSG_RESULT(yes) 291 AC_DEFINE(HAVE_BDEV_WHOLE, 1, [bdev_whole() is available]) 292 ],[ 293 AC_MSG_RESULT(no) 294 ]) 295]) 296 297AC_DEFUN([ZFS_AC_KERNEL_SRC_BLKDEV], [ 298 ZFS_AC_KERNEL_SRC_BLKDEV_GET_BY_PATH 299 ZFS_AC_KERNEL_SRC_BLKDEV_PUT 300 ZFS_AC_KERNEL_SRC_BLKDEV_REREAD_PART 301 ZFS_AC_KERNEL_SRC_BLKDEV_INVALIDATE_BDEV 302 ZFS_AC_KERNEL_SRC_BLKDEV_LOOKUP_BDEV 303 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE 304 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE 305 ZFS_AC_KERNEL_SRC_BLKDEV_CHECK_DISK_CHANGE 306 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_CHECK_MEDIA_CHANGE 307 ZFS_AC_KERNEL_SRC_BLKDEV_BDEV_WHOLE 308]) 309 310AC_DEFUN([ZFS_AC_KERNEL_BLKDEV], [ 311 ZFS_AC_KERNEL_BLKDEV_GET_BY_PATH 312 ZFS_AC_KERNEL_BLKDEV_PUT 313 ZFS_AC_KERNEL_BLKDEV_REREAD_PART 314 ZFS_AC_KERNEL_BLKDEV_INVALIDATE_BDEV 315 ZFS_AC_KERNEL_BLKDEV_LOOKUP_BDEV 316 ZFS_AC_KERNEL_BLKDEV_BDEV_LOGICAL_BLOCK_SIZE 317 ZFS_AC_KERNEL_BLKDEV_BDEV_PHYSICAL_BLOCK_SIZE 318 ZFS_AC_KERNEL_BLKDEV_CHECK_DISK_CHANGE 319 ZFS_AC_KERNEL_BLKDEV_BDEV_CHECK_MEDIA_CHANGE 320 ZFS_AC_KERNEL_BLKDEV_BDEV_WHOLE 321]) 322