diff -Nru linux-apfs-rw-0.3.2/debian/changelog linux-apfs-rw-0.3.2/debian/changelog --- linux-apfs-rw-0.3.2/debian/changelog 2023-10-25 13:32:35.000000000 +0000 +++ linux-apfs-rw-0.3.2/debian/changelog 2023-12-06 15:50:54.000000000 +0000 @@ -1,3 +1,10 @@ +linux-apfs-rw (0.3.2-0ubuntu4) noble; urgency=medium + + * Support linux 6.7 (LP: #2045777): + - debian/patches/0004-Support-for-kernel-6.7.patch + + -- Andrea Righi Wed, 06 Dec 2023 15:50:54 +0000 + linux-apfs-rw (0.3.2-0ubuntu3) noble; urgency=medium * debian/patches/0003-Fix-for-the-kernel-6.6-build-errors.patch: diff -Nru linux-apfs-rw-0.3.2/debian/patches/0004-Support-for-kernel-6.7.patch linux-apfs-rw-0.3.2/debian/patches/0004-Support-for-kernel-6.7.patch --- linux-apfs-rw-0.3.2/debian/patches/0004-Support-for-kernel-6.7.patch 1970-01-01 00:00:00.000000000 +0000 +++ linux-apfs-rw-0.3.2/debian/patches/0004-Support-for-kernel-6.7.patch 2023-12-06 15:45:26.000000000 +0000 @@ -0,0 +1,289 @@ +From: Woody Suwalski +Subject: [PATCH] support for kernel 6.7 +origin: upstream, https://github.com/terraluna977/linux-apfs-rw/tree/kernel-6.7 + +[arighi: backport patch to fix context conflicts] +Signed-off-by: Andrea Righi +--- + apfs.h | 4 ++++ + dir.c | 21 ++++++++++++++------- + extents.c | 4 +++- + file.c | 17 +++++++++++++++++ + inode.c | 52 ++++++++++++++++++++++++++++++++++++++++++++-------- + xattr.c | 4 ++++ + 6 files changed, 86 insertions(+), 16 deletions(-) + +diff --git a/apfs.h b/apfs.h +index d3d8d39..87b88a4 100644 +--- a/apfs.h ++++ b/apfs.h +@@ -1093,7 +1093,11 @@ apfs_getblk(struct super_block *sb, sector_t block) + { + struct buffer_head *bh; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + bh = __getblk_gfp(APFS_NXI(sb)->nx_bdev, block, sb->s_blocksize, __GFP_MOVABLE); ++#else ++ bh = bdev_getblk(APFS_NXI(sb)->nx_bdev, block, sb->s_blocksize, __GFP_MOVABLE); ++#endif + if (bh) + set_buffer_uptodate(bh); + return bh; +diff --git a/dir.c b/dir.c +index 2e1a30e..9021d14 100644 +--- a/dir.c ++++ b/dir.c +@@ -601,11 +601,12 @@ static int apfs_create_dentry(struct dentry *dentry, struct inode *inode) + } + + /* Now update the parent inode */ +-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +- parent->i_mtime = parent->i_ctime = current_time(inode); +-#else +- inode_set_ctime_to_ts(parent, inode_set_ctime_current(inode)); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) ++ inode_set_mtime_to_ts(parent, inode_set_ctime_current(parent)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) + parent->i_mtime = inode_set_ctime_current(parent); ++#else ++ parent->i_mtime = parent->i_ctime = current_time(inode); + #endif + ++APFS_I(parent)->i_nchildren; + apfs_inode_join_transaction(parent->i_sb, parent); +@@ -1041,8 +1042,10 @@ static int apfs_delete_dentry(struct dentry *dentry) + /* Now update the parent inode */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + parent->i_mtime = parent->i_ctime = current_time(parent); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + parent->i_mtime = inode_set_ctime_current(parent); ++#else ++ inode_set_mtime_to_ts(parent, inode_set_ctime_current(parent)); + #endif + --APFS_I(parent)->i_nchildren; + apfs_inode_join_transaction(sb, parent); +@@ -1209,8 +1212,10 @@ static int apfs_create_orphan_link(struct inode *inode) + /* Now update the child count for private-dir */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + priv_dir->i_mtime = priv_dir->i_ctime = current_time(priv_dir); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + priv_dir->i_mtime = inode_set_ctime_current(priv_dir); ++#else ++ inode_set_mtime_to_ts(priv_dir, inode_set_ctime_current(priv_dir)); + #endif + ++APFS_I(priv_dir)->i_nchildren; + apfs_inode_join_transaction(sb, priv_dir); +@@ -1258,8 +1263,10 @@ int apfs_delete_orphan_link(struct inode *inode) + /* Now update the child count for private-dir */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + priv_dir->i_mtime = priv_dir->i_ctime = current_time(priv_dir); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + priv_dir->i_mtime = inode_set_ctime_current(priv_dir); ++#else ++ inode_set_mtime_to_ts(priv_dir, inode_set_ctime_current(priv_dir)); + #endif + --APFS_I(priv_dir)->i_nchildren; + apfs_inode_join_transaction(sb, priv_dir); +diff --git a/extents.c b/extents.c +index 3c7b2e7..89955d6 100644 +--- a/extents.c ++++ b/extents.c +@@ -1699,8 +1699,10 @@ loff_t apfs_remap_file_range(struct file *src_file, loff_t off, struct file *dst + + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + dst_inode->i_mtime = dst_inode->i_ctime = current_time(dst_inode); +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + dst_inode->i_mtime = inode_set_ctime_current(dst_inode); ++#else ++ inode_set_mtime_to_ts(dst_inode, inode_set_ctime_current(dst_inode)); + #endif + dst_inode->i_size = src_inode->i_size; + dst_ai->i_key_class = src_ai->i_key_class; +diff --git a/file.c b/file.c +index 093cc97..0e4c2f7 100644 +--- a/file.c ++++ b/file.c +@@ -18,6 +18,9 @@ static vm_fault_t apfs_page_mkwrite(struct vm_fault *vmf) + struct vm_area_struct *vma = vmf->vma; + #endif + struct page *page = vmf->page; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) ++ struct folio *folio; ++#endif + struct inode *inode = file_inode(vma->vm_file); + struct super_block *sb = inode->i_sb; + struct buffer_head *bh, *head; +@@ -55,7 +58,21 @@ static vm_fault_t apfs_page_mkwrite(struct vm_fault *vmf) + } + + if (!page_has_buffers(page)) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + create_empty_buffers(page, sb->s_blocksize, 0); ++#else ++ { ++ folio = page_folio(page); ++ if (IS_ERR(folio)) ++ { ++ ret = PTR_ERR(folio); ++ goto out_unlock; ++ } ++ bh = folio_buffers(folio); ++ if (!bh) ++ bh = create_empty_buffers(folio, sb->s_blocksize, 0); ++ } ++#endif + + size = i_size_read(inode); + if (page->index == size >> PAGE_SHIFT) +diff --git a/inode.c b/inode.c +index 983c5e5..a554c46 100644 +--- a/inode.c ++++ b/inode.c +@@ -486,6 +486,9 @@ int __apfs_write_begin(struct file *file, struct address_space *mapping, loff_t + struct apfs_dstream_info *dstream = &APFS_I(inode)->i_dstream; + struct super_block *sb = inode->i_sb; + struct page *page; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) ++ struct folio *folio; ++#endif + struct buffer_head *bh, *head; + unsigned int blocksize, block_start, block_end, from, to; + pgoff_t index = pos >> PAGE_SHIFT; +@@ -519,8 +522,16 @@ int __apfs_write_begin(struct file *file, struct address_space *mapping, loff_t + if (!page) + return -ENOMEM; + if (!page_has_buffers(page)) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + create_empty_buffers(page, sb->s_blocksize, 0); +- ++#else ++ folio = page_folio(page); ++ if (IS_ERR(folio)) ++ return PTR_ERR(folio); ++ bh = folio_buffers(folio); ++ if (!bh) ++ bh = create_empty_buffers(folio, sb->s_blocksize, 0); ++#endif + /* CoW moves existing blocks, so read them but mark them as unmapped */ + head = page_buffers(page); + blocksize = head->b_size; +@@ -789,13 +800,19 @@ static int apfs_inode_from_query(struct apfs_query *query, struct inode *inode) + ai->i_nchildren = le32_to_cpu(inode_val->nchildren); + } + +- inode->i_atime = ns_to_timespec64(le64_to_cpu(inode_val->access_time)); + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + inode->i_ctime = ns_to_timespec64(le64_to_cpu(inode_val->change_time)); + #else + inode_set_ctime_to_ts(inode, ns_to_timespec64(le64_to_cpu(inode_val->change_time))); + #endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) ++ inode->i_atime = ns_to_timespec64(le64_to_cpu(inode_val->access_time)); + inode->i_mtime = ns_to_timespec64(le64_to_cpu(inode_val->mod_time)); ++#else ++ inode_set_atime_to_ts(inode, ns_to_timespec64(le64_to_cpu(inode_val->access_time))); ++ inode_set_mtime_to_ts(inode, ns_to_timespec64(le64_to_cpu(inode_val->mod_time))); ++#endif + ai->i_crtime = ns_to_timespec64(le64_to_cpu(inode_val->create_time)); + + dstream->ds_size = inode->i_size = inode->i_blocks = 0; +@@ -1102,6 +1119,9 @@ static int apfs_build_inode_val(struct inode *inode, struct qstr *qname, + { + struct apfs_inode_val *val; + struct apfs_x_field xkey; ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) ++ struct timespec64 ts; ++#endif + int total_xlen, val_len; + bool is_device = S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode); + __le32 rdev; +@@ -1120,7 +1140,12 @@ static int apfs_build_inode_val(struct inode *inode, struct qstr *qname, + val->parent_id = cpu_to_le64(APFS_I(inode)->i_parent_id); + val->private_id = cpu_to_le64(apfs_ino(inode)); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + val->mod_time = cpu_to_le64(timespec64_to_ns(&inode->i_mtime)); ++#else ++ ts = inode_get_mtime(inode); ++ val->mod_time = cpu_to_le64(timespec64_to_ns(&ts)); ++#endif + val->create_time = val->change_time = val->access_time = val->mod_time; + + if (S_ISDIR(inode->i_mode)) +@@ -1482,14 +1507,22 @@ int apfs_update_inode(struct inode *inode, char *new_name) + if (gid_valid(sbi->s_gid)) + inode_raw->group = cpu_to_le32(ai->i_saved_gid); + +- inode_raw->access_time = cpu_to_le64(timespec64_to_ns(&inode->i_atime)); + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + inode_raw->change_time = cpu_to_le64(timespec64_to_ns(&inode->i_ctime)); + #else + struct timespec64 ictime = inode_get_ctime(inode); + inode_raw->change_time = cpu_to_le64(timespec64_to_ns(&ictime)); + #endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) ++ inode_raw->access_time = cpu_to_le64(timespec64_to_ns(&inode->i_atime)); + inode_raw->mod_time = cpu_to_le64(timespec64_to_ns(&inode->i_mtime)); ++#else ++ struct timespec64 ts = inode_get_mtime(inode); ++ inode_raw->mod_time = cpu_to_le64(timespec64_to_ns(&ts)); ++ ts = inode_get_atime(inode); ++ inode_raw->access_time = cpu_to_le64(timespec64_to_ns(&ts)); ++#endif + inode_raw->create_time = cpu_to_le64(timespec64_to_ns(&ai->i_crtime)); + + if (S_ISDIR(inode->i_mode)) { +@@ -1670,9 +1703,11 @@ struct inode *apfs_new_inode(struct inode *dir, umode_t mode, dev_t rdev) + now = current_time(inode); + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) + inode->i_atime = inode->i_mtime = inode->i_ctime = ai->i_crtime = now; +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + inode_set_ctime_to_ts(inode, now); + inode->i_atime = inode->i_mtime = ai->i_crtime = now; ++#else ++ simple_inode_init_ts(inode); + #endif + vsb_raw->apfs_last_mod_time = cpu_to_le64(timespec64_to_ns(&now)); + +@@ -1767,11 +1802,12 @@ static int apfs_setsize(struct inode *inode, loff_t new_size) + + if (new_size == inode->i_size) + return 0; +-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) +- inode->i_mtime = inode->i_ctime = current_time(inode); +-#else +- inode_set_ctime_to_ts(inode, inode_set_ctime_current(inode)); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) ++ inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) + inode->i_mtime = inode_set_ctime_current(inode); ++#else ++ inode->i_mtime = inode->i_ctime = current_time(inode); + #endif + + err = apfs_inode_create_dstream_rec(inode); +diff --git a/xattr.c b/xattr.c +index 5dd8cfe..6eb76f3 100644 +--- a/xattr.c ++++ b/xattr.c +@@ -162,7 +162,11 @@ static int apfs_xattr_extents_read(struct inode *parent, + goto out; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) + bhs[i] = __getblk_gfp(APFS_NXI(sb)->nx_bdev, bno, sb->s_blocksize, __GFP_MOVABLE); ++#else ++ bhs[i] = bdev_getblk(APFS_NXI(sb)->nx_bdev, bno, sb->s_blocksize, __GFP_MOVABLE); ++#endif + if (!bhs[i]) { + apfs_err(sb, "failed to map block 0x%llx", bno); + ret = -EIO; +-- +2.40.1 + diff -Nru linux-apfs-rw-0.3.2/debian/patches/series linux-apfs-rw-0.3.2/debian/patches/series --- linux-apfs-rw-0.3.2/debian/patches/series 2023-10-25 13:32:23.000000000 +0000 +++ linux-apfs-rw-0.3.2/debian/patches/series 2023-12-06 15:45:26.000000000 +0000 @@ -1,3 +1,4 @@ 0001-linux-6.5-substitute-strcpy-with-strscpy.patch 0002-linux-6.5-fix-blkdev_get_by_path-holder-and-superblo.patch 0003-Fix-for-the-kernel-6.6-build-errors.patch +0004-Support-for-kernel-6.7.patch