Skip to content

Commit

Permalink
compat: test and compat patch for bdev_nr_sectors
Browse files Browse the repository at this point in the history
  • Loading branch information
chrboe committed May 9, 2022
1 parent 3c776e5 commit ba8c076
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
@@ -0,0 +1,5 @@
@@
struct block_device *bd;
@@
- bdev_nr_sectors(bd)
+ get_capacity(bd->bd_disk)
3 changes: 3 additions & 0 deletions drbd/drbd-kernel-compat/gen_patch_names.c
Expand Up @@ -439,6 +439,9 @@ int main(int argc, char **argv)
patch(1, "add_disk", true, false,
COMPAT_ADD_DISK_RETURNS_INT, "returns_int");

patch(1, "bdev_nr_sectors", true, false,
COMPAT_HAVE_BDEV_NR_SECTORS, "present");

/* #define BLKDEV_ISSUE_ZEROOUT_EXPORTED */
/* #define BLKDEV_ZERO_NOUNMAP */

Expand Down
8 changes: 8 additions & 0 deletions drbd/drbd-kernel-compat/tests/have_bdev_nr_sectors.c
@@ -0,0 +1,8 @@
/* { "version": "v5.10-rc5", "commit": "a782483cc1f875355690625d8253a232f2581418", "comment": "the bdev_nr_sectors helper was introduced", "author": "Christoph Hellwig <hch@lst.de>", "date": "Thu Nov 26 18:43:37 2020 +0100" } */

#include <linux/blkdev.h>

sector_t foo(struct block_device *bdev)
{
return bdev_nr_sectors(bdev);
}

0 comments on commit ba8c076

Please sign in to comment.