diff --git a/apfs_raw.h b/apfs_raw.h index 20e8eae..2195e8a 100644 --- a/apfs_raw.h +++ b/apfs_raw.h @@ -268,6 +268,10 @@ struct apfs_phys_ext_val { #define APFS_FILE_EXTENT_LEN_MASK 0x00ffffffffffffffULL #define APFS_FILE_EXTENT_FLAG_MASK 0xff00000000000000ULL #define APFS_FILE_EXTENT_FLAG_SHIFT 56 +#define APFS_FILE_EXTENT_CRYPTO_FLAG 0x01 /* Made-up name */ +#define APFS_FILE_EXTENT_PREALLOCATED 0x02 /* Made-up name */ +#define APFS_VALID_FILE_EXTENT_FLAGS (APFS_FILE_EXTENT_CRYPTO_FLAG \ + | APFS_FILE_EXTENT_PREALLOCATED) /* * Put a bound on maximum file size so that a growing truncation will always @@ -1051,13 +1055,19 @@ struct apfs_checkpoint_map_phys { #define APFS_FS_SPILLEDOVER 0x00000010LL #define APFS_FS_RUN_SPILLOVER_CLEANER 0x00000020LL #define APFS_FS_ALWAYS_CHECK_EXTENTREF 0x00000040LL +#define APFS_FS_PREVIOUSLY_SEALED 0x00000080LL /* Made-up name */ +#define APFS_FS_PFK 0x00000100LL /* Made-up name */ +#define APFS_FS_UNKNOWN_200 0x00000200LL #define APFS_FS_FLAGS_VALID_MASK (APFS_FS_UNENCRYPTED \ - | APFS_FS_EFFACEABLE \ - | APFS_FS_RESERVED_4 \ - | APFS_FS_ONEKEY \ - | APFS_FS_SPILLEDOVER \ - | APFS_FS_RUN_SPILLOVER_CLEANER \ - | APFS_FS_ALWAYS_CHECK_EXTENTREF) + | APFS_FS_EFFACEABLE \ + | APFS_FS_RESERVED_4 \ + | APFS_FS_ONEKEY \ + | APFS_FS_SPILLEDOVER \ + | APFS_FS_RUN_SPILLOVER_CLEANER \ + | APFS_FS_ALWAYS_CHECK_EXTENTREF \ + | APFS_FS_PREVIOUSLY_SEALED \ + | APFS_FS_PFK \ + | APFS_FS_UNKNOWN_200) #define APFS_FS_CRYPTOFLAGS (APFS_FS_UNENCRYPTED \ | APFS_FS_EFFACEABLE \ @@ -1124,7 +1134,9 @@ struct apfs_checkpoint_map_phys { #define APFS_INCOMPAT_NORMALIZATION_INSENSITIVE 0x00000008LL #define APFS_INCOMPAT_INCOMPLETE_RESTORE 0x00000010LL #define APFS_INCOMPAT_SEALED_VOLUME 0x00000020LL -#define APFS_INCOMPAT_RESERVED_40 0x00000040LL +#define APFS_INCOMPAT_PFK 0x00000040LL /* Made-up name */ +#define APFS_INCOMPAT_EXTENT_PREALLOC_FLAG 0x00000080LL /* Made-up name */ +#define APFS_INCOMPAT_SECONDARY_FSROOT 0x00000100LL /* Made-up name */ #define APFS_SUPPORTED_INCOMPAT_MASK (APFS_INCOMPAT_CASE_INSENSITIVE \ | APFS_INCOMPAT_DATALESS_SNAPS \ @@ -1132,7 +1144,9 @@ struct apfs_checkpoint_map_phys { | APFS_INCOMPAT_NORMALIZATION_INSENSITIVE \ | APFS_INCOMPAT_INCOMPLETE_RESTORE \ | APFS_INCOMPAT_SEALED_VOLUME \ - | APFS_INCOMPAT_RESERVED_40) + | APFS_INCOMPAT_PFK \ + | APFS_INCOMPAT_EXTENT_PREALLOC_FLAG \ + | APFS_INCOMPAT_SECONDARY_FSROOT) #define APFS_MODIFIED_NAMELEN 32 @@ -1162,6 +1176,18 @@ struct apfs_modified_by { #define APFS_CRYPTO_RESERVED_5 5 #define APFS_UNASSIGNED_CRYPTO_ID (~0ULL) +/* Doc id index flags. I'm making up the names for now. */ +#define APFS_DOC_ID_HAS_PREV_TREE 0x00000001 +#define APFS_DOC_ID_UNKNOWN_02 0x00000002 +#define APFS_DOC_ID_UNKNOWN_04 0x00000004 +#define APFS_DOC_ID_UNKNOWN_08 0x00000008 +#define APFS_DOC_ID_UNKNOWN_10 0x00000010 +#define APFS_DOC_ID_VALID_FLAGS (APFS_DOC_ID_HAS_PREV_TREE \ + | APFS_DOC_ID_UNKNOWN_02 \ + | APFS_DOC_ID_UNKNOWN_04 \ + | APFS_DOC_ID_UNKNOWN_08 \ + | APFS_DOC_ID_UNKNOWN_10) + /* * Structure used to store the encryption state */ @@ -1277,9 +1303,10 @@ enum { APFS_XATTR_DATA_EMBEDDED = 0x00000002, APFS_XATTR_FILE_SYSTEM_OWNED = 0x00000004, APFS_XATTR_RESERVED_8 = 0x00000008, + APFS_XATTR_UNKNOWN_10 = 0x00000010, }; -#define APFS_XATTR_VALID_FLAGS 0x0000000f +#define APFS_XATTR_VALID_FLAGS 0x0000001f /* * Structure of the value of an extended attributes record diff --git a/super.c b/super.c index 381fe5e..4da0a16 100644 --- a/super.c +++ b/super.c @@ -1295,8 +1295,16 @@ static int apfs_check_vol_features(struct super_block *sb) apfs_warn(sb, "incomplete restore is not supported"); return -EINVAL; } - if (features & APFS_INCOMPAT_RESERVED_40) { - apfs_warn(sb, "reserved incompatible feature flag is set"); + if (features & APFS_INCOMPAT_PFK) { + apfs_warn(sb, "PFK is not supported"); + return -EINVAL; + } + if (features & APFS_INCOMPAT_EXTENT_PREALLOC_FLAG) { + apfs_warn(sb, "extent prealloc flag is not supported"); + return -EINVAL; + } + if (features & APFS_INCOMPAT_SECONDARY_FSROOT) { + apfs_warn(sb, "secondary fsroot is not supported"); return -EINVAL; } if (features & APFS_INCOMPAT_SEALED_VOLUME) {