aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev_compat.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-02-22 14:55:35 -0800
committerBrian Behlendorf <[email protected]>2011-02-23 12:29:38 -0800
commit45066d1f20a582fc8229776503b1cdd554d7fde4 (patch)
treee41b6ca3b64e58d1a882f185c59bdb159fd0172b /include/linux/blkdev_compat.h
parent61e909608d15dc6900a710a0ceab6e101a68ac5a (diff)
Linux 2.6.38 compat, blkdev_get_by_path()
The open_bdev_exclusive() function has been replaced (again) by the more generic blkdev_get_by_path() function. Additionally, the counterpart function close_bdev_exclusive() has been replaced by blkdev_put(). Because these functions are more generic versions of the functions they replaced the compatibility macro must add the FMODE_EXCL mask to ensure they are exclusive. Closes #114
Diffstat (limited to 'include/linux/blkdev_compat.h')
-rw-r--r--include/linux/blkdev_compat.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/linux/blkdev_compat.h b/include/linux/blkdev_compat.h
index f841c6c00..d2e80ec88 100644
--- a/include/linux/blkdev_compat.h
+++ b/include/linux/blkdev_compat.h
@@ -280,16 +280,31 @@ bio_set_flags_failfast(struct block_device *bdev, int *flags)
#endif /* HAVE_2ARGS_BIO_END_IO_T */
/*
- * 2.6.28 API change
+ * 2.6.38 - 2.6.x API,
+ * blkdev_get_by_path()
+ * blkdev_put()
+ *
+ * 2.6.28 - 2.6.37 API,
+ * open_bdev_exclusive()
+ * close_bdev_exclusive()
+ *
+ * 2.6.12 - 2.6.27 API,
+ * open_bdev_excl()
+ * close_bdev_excl()
+ *
* Used to exclusively open a block device from within the kernel.
*/
-#ifdef HAVE_OPEN_BDEV_EXCLUSIVE
+#if defined(HAVE_BLKDEV_GET_BY_PATH)
+# define vdev_bdev_open(path, md, hld) blkdev_get_by_path(path, \
+ (md) | FMODE_EXCL, hld)
+# define vdev_bdev_close(bdev, md) blkdev_put(bdev, (md) | FMODE_EXCL)
+#elif defined(HAVE_OPEN_BDEV_EXCLUSIVE)
# define vdev_bdev_open(path, md, hld) open_bdev_exclusive(path, md, hld)
# define vdev_bdev_close(bdev, md) close_bdev_exclusive(bdev, md)
#else
# define vdev_bdev_open(path, md, hld) open_bdev_excl(path, md, hld)
# define vdev_bdev_close(bdev, md) close_bdev_excl(bdev)
-#endif /* HAVE_OPEN_BDEV_EXCLUSIVE */
+#endif /* HAVE_BLKDEV_GET_BY_PATH | HAVE_OPEN_BDEV_EXCLUSIVE */
/*
* 2.6.22 API change