mirror of
https://github.com/linux-apfs/linux-apfs-rw.git
synced 2026-08-18 02:19:59 -07:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a10279ce66 | ||
|
|
7711c4704e | ||
|
|
9619c53686 | ||
|
|
f5b71842e6 | ||
|
|
83205caaad | ||
|
|
8a37600293 | ||
|
|
f0e88ca368 | ||
|
|
96d5614d04 | ||
|
|
b2418aaaa7 |
No files matched your search
+7
-2
@@ -57,10 +57,15 @@ Now you can just cd to the linux-apfs-rw directory and run::
|
|||||||
make
|
make
|
||||||
|
|
||||||
The resulting module is the apfs.ko file. Before you can use it you must insert
|
The resulting module is the apfs.ko file. Before you can use it you must insert
|
||||||
it into the kernel, as well as its dependencies. Again as root::
|
it into the kernel. Again as root::
|
||||||
|
|
||||||
|
insmod apfs.ko
|
||||||
|
|
||||||
|
If you get an "unknown symbol in module" error, run::
|
||||||
|
|
||||||
modprobe libcrc32c
|
modprobe libcrc32c
|
||||||
insmod apfs.ko
|
|
||||||
|
and then try the insmod command again.
|
||||||
|
|
||||||
Mount
|
Mount
|
||||||
=====
|
=====
|
||||||
|
|||||||
@@ -44,10 +44,33 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Compatibility wrapper around submit_bh() */
|
/* Compatibility wrapper around submit_bh() */
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || RHEL_VERSION_GE(9, 2)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0)
|
||||||
#define apfs_submit_bh(op, op_flags, bh) submit_bh(op | op_flags, bh)
|
#define apfs_submit_bh(op, op_flags, bh) \
|
||||||
|
do { \
|
||||||
|
put_bh(bh); \
|
||||||
|
if (op == REQ_OP_READ) \
|
||||||
|
bh_submit(bh, op | op_flags, bh_end_read); \
|
||||||
|
else \
|
||||||
|
bh_submit(bh, op | op_flags, bh_end_write); \
|
||||||
|
} while (0)
|
||||||
|
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || RHEL_VERSION_GE(9, 2)
|
||||||
|
#define apfs_submit_bh(op, op_flags, bh) \
|
||||||
|
do { \
|
||||||
|
if (op == REQ_OP_READ) \
|
||||||
|
bh->b_end_io = end_buffer_read_sync; \
|
||||||
|
else \
|
||||||
|
bh->b_end_io = end_buffer_write_sync; \
|
||||||
|
submit_bh(op | op_flags, bh); \
|
||||||
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define apfs_submit_bh(op, op_flags, bh) submit_bh(op, op_flags, bh)
|
#define apfs_submit_bh(op, op_flags, bh) \
|
||||||
|
do { \
|
||||||
|
if (op == REQ_OP_READ) \
|
||||||
|
bh->b_end_io = end_buffer_read_sync; \
|
||||||
|
else \
|
||||||
|
bh->b_end_io = end_buffer_write_sync; \
|
||||||
|
submit_bh(op, op_flags, bh); \
|
||||||
|
} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1324,7 +1347,7 @@ __apfs_getblk(struct super_block *sb, sector_t block)
|
|||||||
block -= nxi->nx_tier2_bno;
|
block -= nxi->nx_tier2_bno;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 7, 0) && !RHEL_VERSION_GE(9, 8)
|
||||||
return __getblk_gfp(info->blki_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
|
return __getblk_gfp(info->blki_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
|
||||||
#else
|
#else
|
||||||
return bdev_getblk(info->blki_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
|
return bdev_getblk(info->blki_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
PACKAGE_NAME="linux-apfs-rw"
|
PACKAGE_NAME="linux-apfs-rw"
|
||||||
PACKAGE_VERSION="0.3.20"
|
PACKAGE_VERSION="0.3.21"
|
||||||
|
|
||||||
BUILT_MODULE_NAME[0]="apfs"
|
BUILT_MODULE_NAME[0]="apfs"
|
||||||
DEST_MODULE_LOCATION[0]="/extra"
|
DEST_MODULE_LOCATION[0]="/extra"
|
||||||
|
|||||||
@@ -2298,7 +2298,6 @@ int apfs_nonsparse_dstream_read(struct apfs_dstream_info *dstream, void *buf, si
|
|||||||
if (!buffer_uptodate(bh)) {
|
if (!buffer_uptodate(bh)) {
|
||||||
get_bh(bh);
|
get_bh(bh);
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
bh->b_end_io = end_buffer_read_sync;
|
|
||||||
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2365,7 +2364,6 @@ void apfs_nonsparse_dstream_preread(struct apfs_dstream_info *dstream)
|
|||||||
if (!buffer_uptodate(bh)) {
|
if (!buffer_uptodate(bh)) {
|
||||||
get_bh(bh);
|
get_bh(bh);
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
bh->b_end_io = end_buffer_read_sync;
|
|
||||||
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
||||||
}
|
}
|
||||||
brelse(bh);
|
brelse(bh);
|
||||||
|
|||||||
@@ -556,7 +556,6 @@ int __apfs_write_begin(struct file *file, struct address_space *mapping, loff_t
|
|||||||
if (buffer_mapped(bh) && !buffer_uptodate(bh)) {
|
if (buffer_mapped(bh) && !buffer_uptodate(bh)) {
|
||||||
get_bh(bh);
|
get_bh(bh);
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
bh->b_end_io = end_buffer_read_sync;
|
|
||||||
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
apfs_submit_bh(REQ_OP_READ, 0, bh);
|
||||||
wait_on_buffer(bh);
|
wait_on_buffer(bh);
|
||||||
if (!buffer_uptodate(bh)) {
|
if (!buffer_uptodate(bh)) {
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ typedef int64_t lzfse_offset;
|
|||||||
typedef int32_t lzfse_offset;
|
typedef int32_t lzfse_offset;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__APPLE__) || !defined(__MACH__)
|
||||||
typedef uint64_t uintmax_t;
|
typedef uint64_t uintmax_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*! @abstract Decoder state object for lzfse compressed blocks. */
|
/*! @abstract Decoder state object for lzfse compressed blocks. */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ static int apfs_write_single_ip_bitmap(struct super_block *sb, char *bitmap, u32
|
|||||||
err = apfs_transaction_join(sb, bh);
|
err = apfs_transaction_join(sb, bh);
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
put_bh(bh);
|
||||||
bh = NULL;
|
bh = NULL;
|
||||||
|
|
||||||
spaceman->sm_ip_bmaps[idx].dirty = false;
|
spaceman->sm_ip_bmaps[idx].dirty = false;
|
||||||
|
|||||||
@@ -343,8 +343,8 @@ static int apfs_read_main_super(struct super_block *sb)
|
|||||||
xid = le64_to_cpu(msb_raw->nx_o.o_xid);
|
xid = le64_to_cpu(msb_raw->nx_o.o_xid);
|
||||||
for (i = 0; i < desc_blocks; ++i) {
|
for (i = 0; i < desc_blocks; ++i) {
|
||||||
struct apfs_nx_superblock *desc_raw;
|
struct apfs_nx_superblock *desc_raw;
|
||||||
|
bool ignore;
|
||||||
|
|
||||||
brelse(desc_bh);
|
|
||||||
desc_bh = apfs_sb_bread(sb, desc_base + i);
|
desc_bh = apfs_sb_bread(sb, desc_base + i);
|
||||||
if (!desc_bh) {
|
if (!desc_bh) {
|
||||||
apfs_err(sb, "unable to read checkpoint descriptor");
|
apfs_err(sb, "unable to read checkpoint descriptor");
|
||||||
@@ -352,18 +352,24 @@ static int apfs_read_main_super(struct super_block *sb)
|
|||||||
}
|
}
|
||||||
desc_raw = (struct apfs_nx_superblock *)desc_bh->b_data;
|
desc_raw = (struct apfs_nx_superblock *)desc_bh->b_data;
|
||||||
|
|
||||||
|
ignore = false;
|
||||||
if (le32_to_cpu(desc_raw->nx_magic) != APFS_NX_MAGIC)
|
if (le32_to_cpu(desc_raw->nx_magic) != APFS_NX_MAGIC)
|
||||||
continue; /* Not a superblock */
|
ignore = true; /* Not a superblock */
|
||||||
if (le64_to_cpu(desc_raw->nx_o.o_xid) <= xid)
|
if (le64_to_cpu(desc_raw->nx_o.o_xid) <= xid)
|
||||||
continue; /* Old */
|
ignore = true; /* Old */
|
||||||
if (!apfs_obj_verify_csum(sb, desc_bh))
|
if (!apfs_obj_verify_csum(sb, desc_bh))
|
||||||
continue; /* Corrupted */
|
ignore = true; /* Corrupted */
|
||||||
|
|
||||||
xid = le64_to_cpu(desc_raw->nx_o.o_xid);
|
if (ignore) {
|
||||||
msb_raw = desc_raw;
|
brelse(desc_bh);
|
||||||
bno = desc_base + i;
|
} else {
|
||||||
brelse(bh);
|
xid = le64_to_cpu(desc_raw->nx_o.o_xid);
|
||||||
bh = desc_bh;
|
msb_raw = desc_raw;
|
||||||
|
bno = desc_base + i;
|
||||||
|
brelse(bh);
|
||||||
|
bh = desc_bh;
|
||||||
|
}
|
||||||
|
desc_raw = NULL;
|
||||||
desc_bh = NULL;
|
desc_bh = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -640,6 +640,9 @@ static int apfs_write_ephemeral_objects(struct super_block *sb)
|
|||||||
}
|
}
|
||||||
data_len += obj_blkcnt;
|
data_len += obj_blkcnt;
|
||||||
}
|
}
|
||||||
|
brelse(cpm_bh);
|
||||||
|
cpm = NULL;
|
||||||
|
cpm_bh = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The checkpoint superblock can't be set until the very end of the
|
* The checkpoint superblock can't be set until the very end of the
|
||||||
@@ -721,7 +724,6 @@ static int apfs_transaction_commit_nx(struct super_block *sb)
|
|||||||
clear_buffer_dirty(bh);
|
clear_buffer_dirty(bh);
|
||||||
get_bh(bh);
|
get_bh(bh);
|
||||||
lock_buffer(bh);
|
lock_buffer(bh);
|
||||||
bh->b_end_io = end_buffer_write_sync;
|
|
||||||
apfs_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
|
apfs_submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
|
||||||
}
|
}
|
||||||
list_for_each_entry_safe(bhi, tmp, &nx_trans->t_buffers, list) {
|
list_for_each_entry_safe(bhi, tmp, &nx_trans->t_buffers, list) {
|
||||||
|
|||||||
Reference in new issue
Block a user