Fix build for Linux 6.0

Milan P. Stanić reports via email that the submit_bh() api has changed
in Linux 6.0, and the driver no longer builds. Implement a simple macro
wrapper called apfs_submit_bh() to fix this without littering the code
with version checks.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
This commit is contained in:
Ernesto A. Fernández
2022-10-05 16:31:24 -03:00
parent e4bf2d51d3
commit e2ca36a76d
4 changed files with 10 additions and 3 deletions
+7
View File
@@ -30,6 +30,13 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags
#define lockdep_assert_held_write(l) ((void)(l))
#endif
/* Compatibility wrapper around submit_bh() */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
#define apfs_submit_bh(op, op_flags, bh) submit_bh(op, op_flags, bh)
#else
#define apfs_submit_bh(op, op_flags, bh) submit_bh(op | op_flags, bh)
#endif
#define APFS_IOC_SET_DFLT_PFK _IOW('@', 0x80, struct apfs_wrapped_crypto_state)
#define APFS_IOC_SET_DIR_CLASS _IOW('@', 0x81, u32)
#define APFS_IOC_SET_PFK _IOW('@', 0x82, struct apfs_wrapped_crypto_state)
+1 -1
View File
@@ -475,7 +475,7 @@ static int apfs_write_begin(struct file *file, struct address_space *mapping,
get_bh(bh);
lock_buffer(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(REQ_OP_READ, 0, bh);
apfs_submit_bh(REQ_OP_READ, 0, bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
err = -EIO;
+1 -1
View File
@@ -602,7 +602,7 @@ static int apfs_transaction_commit_nx(struct super_block *sb)
clear_buffer_dirty(bh);
lock_buffer(bh);
bh->b_end_io = apfs_end_buffer_write_sync;
submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
apfs_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
}
err = apfs_checkpoint_end(sb);
if (err)
+1 -1
View File
@@ -155,7 +155,7 @@ static int apfs_xattr_extents_read(struct inode *parent,
get_bh(bh);
lock_buffer(bh);
bh->b_end_io = end_buffer_read_sync;
submit_bh(REQ_OP_READ, 0, bh);
apfs_submit_bh(REQ_OP_READ, 0, bh);
}
}
for (i = 0; i < blkcnt; i++) {