Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'for_v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs

Pull UDF, quota, reiserfs, ext2 fixes and cleanups from Jan Kara:
"A few assorted fixes and cleanups for udf, quota, reiserfs, and ext2"

* tag 'for_v5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
fs/reiserfs: remove unused macros
fs/quota: remove unused macro
udf: Clarify meaning of f_files in udf_statfs
udf: Allow writing to 'Rewritable' partitions
udf: Disallow R/W mode for disk with Metadata partition
udf: Fix meaning of ENTITYID_FLAGS_* macros to be really bitwise-or flags
udf: Fix free space reporting for metadata and virtual partitions
udf: Update header files to UDF 2.60
udf: Move OSTA Identifier Suffix macros from ecma_167.h to osta_udf.h
udf: Fix spelling in EXT_NEXT_EXTENT_ALLOCDESCS
ext2: Adjust indentation in ext2_fill_super
quota: avoid time_t in v1_disk_dqblk definition
reiserfs: Fix spurious unlock in reiserfs_fill_super() error handling
reiserfs: Fix memory leak of journal device string
ext2: set proper errno in error case of ext2_fill_super()

+137 -85
+4 -3
fs/ext2/super.c
··· 1073 1073 1074 1074 if (EXT2_BLOCKS_PER_GROUP(sb) == 0) 1075 1075 goto cantfind_ext2; 1076 - sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - 1077 - le32_to_cpu(es->s_first_data_block) - 1) 1078 - / EXT2_BLOCKS_PER_GROUP(sb)) + 1; 1076 + sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) - 1077 + le32_to_cpu(es->s_first_data_block) - 1) 1078 + / EXT2_BLOCKS_PER_GROUP(sb)) + 1; 1079 1079 db_count = (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / 1080 1080 EXT2_DESC_PER_BLOCK(sb); 1081 1081 sbi->s_group_desc = kmalloc_array (db_count, ··· 1138 1138 ext2_count_dirs(sb), GFP_KERNEL); 1139 1139 } 1140 1140 if (err) { 1141 + ret = err; 1141 1142 ext2_msg(sb, KERN_ERR, "error: insufficient memory"); 1142 1143 goto failed_mount3; 1143 1144 }
-2
fs/quota/quota_v2.c
··· 22 22 MODULE_DESCRIPTION("Quota format v2 support"); 23 23 MODULE_LICENSE("GPL"); 24 24 25 - #define __QUOTA_V2_PARANOIA 26 - 27 25 static void v2r0_mem2diskdqb(void *dp, struct dquot *dquot); 28 26 static void v2r0_disk2memdqb(struct dquot *dquot, void *dp); 29 27 static int v2r0_is_id(void *dp, struct dquot *dquot);
+4 -2
fs/quota/quotaio_v1.h
··· 25 25 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */ 26 26 __u32 dqb_isoftlimit; /* preferred inode limit */ 27 27 __u32 dqb_curinodes; /* current # allocated inodes */ 28 - time_t dqb_btime; /* time limit for excessive disk use */ 29 - time_t dqb_itime; /* time limit for excessive inode use */ 28 + 29 + /* below fields differ in length on 32-bit vs 64-bit architectures */ 30 + unsigned long dqb_btime; /* time limit for excessive disk use */ 31 + unsigned long dqb_itime; /* time limit for excessive inode use */ 30 32 }; 31 33 32 34 #define v1_dqoff(UID) ((loff_t)((UID) * sizeof (struct v1_disk_dqblk)))
-2
fs/reiserfs/journal.c
··· 56 56 /* gets a struct reiserfs_journal_list * from a list head */ 57 57 #define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ 58 58 j_list)) 59 - #define JOURNAL_WORK_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ 60 - j_working_list)) 61 59 62 60 /* must be correct to keep the desc and commit structs at 4k */ 63 61 #define JOURNAL_TRANS_HALF 1018
-1
fs/reiserfs/procfs.c
··· 63 63 #define MAP( i ) D4C( objectid_map( sb, rs )[ i ] ) 64 64 65 65 #define DJF( x ) le32_to_cpu( rs -> x ) 66 - #define DJV( x ) le32_to_cpu( s_v1 -> x ) 67 66 #define DJP( x ) le32_to_cpu( jp -> x ) 68 67 #define JF( x ) ( r -> s_journal -> x ) 69 68
-6
fs/reiserfs/stree.c
··· 918 918 return memcmp(stored_ih, ih, IH_SIZE); 919 919 } 920 920 921 - /* unformatted nodes are not logged anymore, ever. This is safe now */ 922 - #define held_by_others(bh) (atomic_read(&(bh)->b_count) > 1) 923 - 924 - /* block can not be forgotten as it is in I/O or held by someone */ 925 - #define block_in_use(bh) (buffer_locked(bh) || (held_by_others(bh))) 926 - 927 921 /* prepare for delete or cut of direct item */ 928 922 static inline int prepare_for_direct_item(struct treepath *path, 929 923 struct item_head *le_ih,
+3 -1
fs/reiserfs/super.c
··· 629 629 reiserfs_write_unlock(s); 630 630 mutex_destroy(&REISERFS_SB(s)->lock); 631 631 destroy_workqueue(REISERFS_SB(s)->commit_wq); 632 + kfree(REISERFS_SB(s)->s_jdev); 632 633 kfree(s->s_fs_info); 633 634 s->s_fs_info = NULL; 634 635 } ··· 1948 1947 if (!sbi->s_jdev) { 1949 1948 SWARN(silent, s, "", "Cannot allocate memory for " 1950 1949 "journal device name"); 1951 - goto error; 1950 + goto error_unlocked; 1952 1951 } 1953 1952 } 1954 1953 #ifdef CONFIG_QUOTA ··· 2241 2240 kfree(qf_names[j]); 2242 2241 } 2243 2242 #endif 2243 + kfree(sbi->s_jdev); 2244 2244 kfree(sbi); 2245 2245 2246 2246 s->s_fs_info = NULL;
+26 -20
fs/udf/ecma_167.h
··· 4 4 * This file is based on ECMA-167 3rd edition (June 1997) 5 5 * http://www.ecma.ch 6 6 * 7 - * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu> 7 + * Copyright (c) 2001-2002 Ben Fennema 8 + * Copyright (c) 2017-2019 Pali Rohár <pali.rohar@gmail.com> 8 9 * All rights reserved. 9 10 * 10 11 * Redistribution and use in source and binary forms, with or without ··· 33 32 * SUCH DAMAGE. 34 33 */ 35 34 35 + /** 36 + * @file 37 + * ECMA-167r3 defines and structure definitions 38 + */ 39 + 36 40 #include <linux/types.h> 37 41 38 42 #ifndef _ECMA_167_H 39 43 #define _ECMA_167_H 1 44 + 45 + /* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */ 46 + typedef uint8_t dchars; 40 47 41 48 /* Character set specification (ECMA 167r3 1/7.2.1) */ 42 49 struct charspec { ··· 63 54 #define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */ 64 55 #define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */ 65 56 57 + /* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */ 66 58 typedef uint8_t dstring; 67 59 68 60 /* Timestamp (ECMA 167r3 1/7.3) */ ··· 95 85 } __packed; 96 86 97 87 /* Flags (ECMA 167r3 1/7.4.1) */ 98 - #define ENTITYID_FLAGS_DIRTY 0x00 99 - #define ENTITYID_FLAGS_PROTECTED 0x01 100 - 101 - /* OSTA UDF 2.1.5.2 */ 102 - #define UDF_ID_COMPLIANT "*OSTA UDF Compliant" 103 - 104 - /* OSTA UDF 2.1.5.3 */ 105 - struct domainEntityIDSuffix { 106 - uint16_t revision; 107 - uint8_t flags; 108 - uint8_t reserved[5]; 109 - }; 110 - 111 - /* OSTA UDF 2.1.5.3 */ 112 - #define ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT 0 113 - #define ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT 1 88 + #define ENTITYID_FLAGS_DIRTY 0x01 89 + #define ENTITYID_FLAGS_PROTECTED 0x02 114 90 115 91 /* Volume Structure Descriptor (ECMA 167r3 2/9.1) */ 116 92 #define VSD_STD_ID_LEN 5 ··· 196 200 uint8_t structVersion; 197 201 uint8_t reserved; 198 202 uint8_t structData[2040]; 203 + } __packed; 204 + 205 + /* Generic Descriptor */ 206 + struct genericDesc { 207 + struct tag descTag; 208 + __le32 volDescSeqNum; 209 + uint8_t reserved[492]; 199 210 } __packed; 200 211 201 212 /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */ ··· 319 316 320 317 /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */ 321 318 #define GP_PARTITION_MAP_TYPE_UNDEF 0x00 322 - #define GP_PARTIITON_MAP_TYPE_1 0x01 319 + #define GP_PARTITION_MAP_TYPE_1 0x01 323 320 #define GP_PARTITION_MAP_TYPE_2 0x02 324 321 325 322 /* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */ ··· 726 723 #define EXTATTR_DEV_SPEC 12 727 724 #define EXTATTR_IMP_USE 2048 728 725 #define EXTATTR_APP_USE 65536 726 + #define EXTATTR_SUBTYPE 1 729 727 730 728 /* Unallocated Space Entry (ECMA 167r3 4/14.11) */ 731 729 struct unallocSpaceEntry { ··· 758 754 /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ 759 755 760 756 /* Extent Length (ECMA 167r3 4/14.14.1.1) */ 757 + #define EXT_LENGTH_MASK 0x3FFFFFFF 758 + #define EXT_TYPE_MASK 0xC0000000 761 759 #define EXT_RECORDED_ALLOCATED 0x00000000 762 760 #define EXT_NOT_RECORDED_ALLOCATED 0x40000000 763 761 #define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000 764 - #define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000 762 + #define EXT_NEXT_EXTENT_ALLOCDESCS 0xC0000000 765 763 766 764 /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ 767 765 ··· 780 774 uint8_t componentType; 781 775 uint8_t lengthComponentIdent; 782 776 __le16 componentFileVersionNum; 783 - dstring componentIdent[0]; 777 + dchars componentIdent[0]; 784 778 } __packed; 785 779 786 780 /* File Entry (ECMA 167r3 4/14.17) */
+3 -3
fs/udf/inode.c
··· 1981 1981 1982 1982 __udf_add_aext(inode, &nepos, &cp_loc, cp_len, 1); 1983 1983 udf_write_aext(inode, epos, &nepos.block, 1984 - sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDECS, 0); 1984 + sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDESCS, 0); 1985 1985 } else { 1986 1986 __udf_add_aext(inode, epos, &nepos.block, 1987 - sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDECS, 0); 1987 + sb->s_blocksize | EXT_NEXT_EXTENT_ALLOCDESCS, 0); 1988 1988 } 1989 1989 1990 1990 brelse(epos->bh); ··· 2143 2143 unsigned int indirections = 0; 2144 2144 2145 2145 while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) == 2146 - (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { 2146 + (EXT_NEXT_EXTENT_ALLOCDESCS >> 30)) { 2147 2147 udf_pblk_t block; 2148 2148 2149 2149 if (++indirections > UDF_MAX_INDIR_EXTS) {
+68 -32
fs/udf/osta_udf.h
··· 1 1 /* 2 2 * osta_udf.h 3 3 * 4 - * This file is based on OSTA UDF(tm) 2.50 (April 30, 2003) 4 + * This file is based on OSTA UDF(tm) 2.60 (March 1, 2005) 5 5 * http://www.osta.org 6 6 * 7 - * Copyright (c) 2001-2004 Ben Fennema <bfennema@falcon.csc.calpoly.edu> 7 + * Copyright (c) 2001-2004 Ben Fennema 8 + * Copyright (c) 2017-2019 Pali Rohár <pali.rohar@gmail.com> 8 9 * All rights reserved. 9 10 * 10 11 * Redistribution and use in source and binary forms, with or without ··· 33 32 * SUCH DAMAGE. 34 33 */ 35 34 35 + /** 36 + * @file 37 + * OSTA-UDF defines and structure definitions 38 + */ 39 + 36 40 #include "ecma_167.h" 37 41 38 42 #ifndef _OSTA_UDF_H 39 43 #define _OSTA_UDF_H 1 40 44 41 - /* OSTA CS0 Charspec (UDF 2.50 2.1.2) */ 45 + /* OSTA CS0 Charspec (UDF 2.60 2.1.2) */ 42 46 #define UDF_CHAR_SET_TYPE 0 43 47 #define UDF_CHAR_SET_INFO "OSTA Compressed Unicode" 44 48 45 - /* Entity Identifier (UDF 2.50 2.1.5) */ 46 - /* Identifiers (UDF 2.50 2.1.5.2) */ 49 + /* Entity Identifier (UDF 2.60 2.1.5) */ 50 + /* Identifiers (UDF 2.60 2.1.5.2) */ 51 + /* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */ 52 + /* Virtual Allocation Table (UDF 1.50 2.2.10) */ 53 + /* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */ 54 + /* OS2EA (UDF 1.50 3.3.4.5.3.1) */ 55 + /* MacUniqueIDTable (UDF 1.50 3.3.4.5.4.3) */ 56 + /* MacResourceFork (UDF 1.50 3.3.4.5.4.4) */ 47 57 #define UDF_ID_DEVELOPER "*Linux UDFFS" 48 58 #define UDF_ID_COMPLIANT "*OSTA UDF Compliant" 49 59 #define UDF_ID_LV_INFO "*UDF LV Info" 50 60 #define UDF_ID_FREE_EA "*UDF FreeEASpace" 51 61 #define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace" 52 62 #define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info" 63 + #define UDF_ID_VAT_LVEXTENSION "*UDF VAT LVExtension" 53 64 #define UDF_ID_OS2_EA "*UDF OS/2 EA" 54 65 #define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength" 55 66 #define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo" 56 67 #define UDF_ID_MAC_FINDER "*UDF Mac FinderInfo" 57 68 #define UDF_ID_MAC_UNIQUE "*UDF Mac UniqueIDTable" 58 69 #define UDF_ID_MAC_RESOURCE "*UDF Mac ResourceFork" 70 + #define UDF_ID_OS400_DIRINFO "*UDF OS/400 DirInfo" 59 71 #define UDF_ID_VIRTUAL "*UDF Virtual Partition" 60 72 #define UDF_ID_SPARABLE "*UDF Sparable Partition" 61 73 #define UDF_ID_ALLOC "*UDF Virtual Alloc Tbl" 62 74 #define UDF_ID_SPARING "*UDF Sparing Table" 63 75 #define UDF_ID_METADATA "*UDF Metadata Partition" 64 76 65 - /* Identifier Suffix (UDF 2.50 2.1.5.3) */ 66 - #define IS_DF_HARD_WRITE_PROTECT 0x01 67 - #define IS_DF_SOFT_WRITE_PROTECT 0x02 77 + /* Identifier Suffix (UDF 2.60 2.1.5.3) */ 78 + #define DOMAIN_FLAGS_HARD_WRITE_PROTECT 0x01 79 + #define DOMAIN_FLAGS_SOFT_WRITE_PROTECT 0x02 80 + 81 + struct domainIdentSuffix { 82 + __le16 UDFRevision; 83 + uint8_t domainFlags; 84 + uint8_t reserved[5]; 85 + } __packed; 68 86 69 87 struct UDFIdentSuffix { 70 88 __le16 UDFRevision; ··· 95 75 struct impIdentSuffix { 96 76 uint8_t OSClass; 97 77 uint8_t OSIdentifier; 98 - uint8_t reserved[6]; 78 + uint8_t impUse[6]; 99 79 } __packed; 100 80 101 81 struct appIdentSuffix { 102 82 uint8_t impUse[8]; 103 83 } __packed; 104 84 105 - /* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */ 106 - /* Implementation Use (UDF 2.50 2.2.6.4) */ 85 + /* Logical Volume Integrity Descriptor (UDF 2.60 2.2.6) */ 86 + /* Implementation Use (UDF 2.60 2.2.6.4) */ 107 87 struct logicalVolIntegrityDescImpUse { 108 88 struct regid impIdent; 109 89 __le32 numFiles; ··· 114 94 uint8_t impUse[0]; 115 95 } __packed; 116 96 117 - /* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */ 118 - /* Implementation Use (UDF 2.50 2.2.7.2) */ 97 + /* Implementation Use Volume Descriptor (UDF 2.60 2.2.7) */ 98 + /* Implementation Use (UDF 2.60 2.2.7.2) */ 119 99 struct impUseVolDescImpUse { 120 100 struct charspec LVICharset; 121 101 dstring logicalVolIdent[128]; ··· 135 115 __le16 partitionNum; 136 116 } __packed; 137 117 138 - /* Virtual Partition Map (UDF 2.50 2.2.8) */ 118 + /* Virtual Partition Map (UDF 2.60 2.2.8) */ 139 119 struct virtualPartitionMap { 140 120 uint8_t partitionMapType; 141 121 uint8_t partitionMapLength; ··· 146 126 uint8_t reserved2[24]; 147 127 } __packed; 148 128 149 - /* Sparable Partition Map (UDF 2.50 2.2.9) */ 129 + /* Sparable Partition Map (UDF 2.60 2.2.9) */ 150 130 struct sparablePartitionMap { 151 131 uint8_t partitionMapType; 152 132 uint8_t partitionMapLength; ··· 161 141 __le32 locSparingTable[4]; 162 142 } __packed; 163 143 164 - /* Metadata Partition Map (UDF 2.4.0 2.2.10) */ 144 + /* Metadata Partition Map (UDF 2.60 2.2.10) */ 165 145 struct metadataPartitionMap { 166 146 uint8_t partitionMapType; 167 147 uint8_t partitionMapLength; ··· 180 160 181 161 /* Virtual Allocation Table (UDF 1.5 2.2.10) */ 182 162 struct virtualAllocationTable15 { 183 - __le32 VirtualSector[0]; 163 + __le32 vatEntry[0]; 184 164 struct regid vatIdent; 185 165 __le32 previousVATICBLoc; 186 166 } __packed; 187 167 188 168 #define ICBTAG_FILE_TYPE_VAT15 0x00U 189 169 190 - /* Virtual Allocation Table (UDF 2.50 2.2.11) */ 170 + /* Virtual Allocation Table (UDF 2.60 2.2.11) */ 191 171 struct virtualAllocationTable20 { 192 172 __le16 lengthHeader; 193 173 __le16 lengthImpUse; ··· 195 175 __le32 previousVATICBLoc; 196 176 __le32 numFiles; 197 177 __le32 numDirs; 198 - __le16 minReadRevision; 199 - __le16 minWriteRevision; 200 - __le16 maxWriteRevision; 178 + __le16 minUDFReadRev; 179 + __le16 minUDFWriteRev; 180 + __le16 maxUDFWriteRev; 201 181 __le16 reserved; 202 182 uint8_t impUse[0]; 203 183 __le32 vatEntry[0]; ··· 205 185 206 186 #define ICBTAG_FILE_TYPE_VAT20 0xF8U 207 187 208 - /* Sparing Table (UDF 2.50 2.2.12) */ 188 + /* Sparing Table (UDF 2.60 2.2.12) */ 209 189 struct sparingEntry { 210 190 __le32 origLocation; 211 191 __le32 mappedLocation; ··· 221 201 mapEntry[0]; 222 202 } __packed; 223 203 224 - /* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */ 204 + /* Metadata File (and Metadata Mirror File) (UDF 2.60 2.2.13.1) */ 225 205 #define ICBTAG_FILE_TYPE_MAIN 0xFA 226 206 #define ICBTAG_FILE_TYPE_MIRROR 0xFB 227 207 #define ICBTAG_FILE_TYPE_BITMAP 0xFC 228 208 229 - /* struct struct long_ad ICB - ADImpUse (UDF 2.50 2.2.4.3) */ 209 + /* struct struct long_ad ICB - ADImpUse (UDF 2.60 2.2.4.3) */ 230 210 struct allocDescImpUse { 231 211 __le16 flags; 232 212 uint8_t impUse[4]; ··· 234 214 235 215 #define AD_IU_EXT_ERASED 0x0001 236 216 237 - /* Real-Time Files (UDF 2.50 6.11) */ 217 + /* Real-Time Files (UDF 2.60 6.11) */ 238 218 #define ICBTAG_FILE_TYPE_REALTIME 0xF9U 239 219 240 - /* Implementation Use Extended Attribute (UDF 2.50 3.3.4.5) */ 241 - /* FreeEASpace (UDF 2.50 3.3.4.5.1.1) */ 220 + /* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */ 221 + /* FreeEASpace (UDF 2.60 3.3.4.5.1.1) */ 242 222 struct freeEaSpace { 243 223 __le16 headerChecksum; 244 224 uint8_t freeEASpace[0]; 245 225 } __packed; 246 226 247 - /* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */ 227 + /* DVD Copyright Management Information (UDF 2.60 3.3.4.5.1.2) */ 248 228 struct DVDCopyrightImpUse { 249 229 __le16 headerChecksum; 250 230 uint8_t CGMSInfo; ··· 252 232 uint8_t protectionSystemInfo[4]; 253 233 } __packed; 254 234 255 - /* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */ 256 - /* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */ 235 + /* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */ 236 + struct LVExtensionEA { 237 + __le16 headerChecksum; 238 + __le64 verificationID; 239 + __le32 numFiles; 240 + __le32 numDirs; 241 + dstring logicalVolIdent[128]; 242 + } __packed; 243 + 244 + /* Application Use Extended Attribute (UDF 2.60 3.3.4.6) */ 245 + /* FreeAppEASpace (UDF 2.60 3.3.4.6.1) */ 257 246 struct freeAppEASpace { 258 247 __le16 headerChecksum; 259 248 uint8_t freeEASpace[0]; 260 249 } __packed; 261 250 262 - /* UDF Defined System Stream (UDF 2.50 3.3.7) */ 251 + /* UDF Defined System Stream (UDF 2.60 3.3.7) */ 263 252 #define UDF_ID_UNIQUE_ID "*UDF Unique ID Mapping Data" 264 253 #define UDF_ID_NON_ALLOC "*UDF Non-Allocatable Space" 265 254 #define UDF_ID_POWER_CAL "*UDF Power Cal Table" 266 255 #define UDF_ID_BACKUP "*UDF Backup" 267 256 268 - /* Operating System Identifiers (UDF 2.50 6.3) */ 257 + /* UDF Defined Non-System Streams (UDF 2.60 3.3.8) */ 258 + #define UDF_ID_MAC_RESOURCE_FORK_STREAM "*UDF Macintosh Resource Fork" 259 + /* #define UDF_ID_OS2_EA "*UDF OS/2 EA" */ 260 + #define UDF_ID_NT_ACL "*UDF NT ACL" 261 + #define UDF_ID_UNIX_ACL "*UDF UNIX ACL" 262 + 263 + /* Operating System Identifiers (UDF 2.60 6.3) */ 269 264 #define UDF_OS_CLASS_UNDEF 0x00U 270 265 #define UDF_OS_CLASS_DOS 0x01U 271 266 #define UDF_OS_CLASS_OS2 0x02U ··· 305 270 #define UDF_OS_ID_LINUX 0x05U 306 271 #define UDF_OS_ID_MKLINUX 0x06U 307 272 #define UDF_OS_ID_FREEBSD 0x07U 273 + #define UDF_OS_ID_NETBSD 0x08U 308 274 #define UDF_OS_ID_WIN9X 0x00U 309 275 #define UDF_OS_ID_WINNT 0x00U 310 276 #define UDF_OS_ID_OS400 0x00U
+28 -12
fs/udf/super.c
··· 767 767 static int udf_verify_domain_identifier(struct super_block *sb, 768 768 struct regid *ident, char *dname) 769 769 { 770 - struct domainEntityIDSuffix *suffix; 770 + struct domainIdentSuffix *suffix; 771 771 772 772 if (memcmp(ident->ident, UDF_ID_COMPLIANT, strlen(UDF_ID_COMPLIANT))) { 773 773 udf_warn(sb, "Not OSTA UDF compliant %s descriptor.\n", dname); 774 774 goto force_ro; 775 775 } 776 - if (ident->flags & (1 << ENTITYID_FLAGS_DIRTY)) { 776 + if (ident->flags & ENTITYID_FLAGS_DIRTY) { 777 777 udf_warn(sb, "Possibly not OSTA UDF compliant %s descriptor.\n", 778 778 dname); 779 779 goto force_ro; 780 780 } 781 - suffix = (struct domainEntityIDSuffix *)ident->identSuffix; 782 - if (suffix->flags & (1 << ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT) || 783 - suffix->flags & (1 << ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT)) { 781 + suffix = (struct domainIdentSuffix *)ident->identSuffix; 782 + if ((suffix->domainFlags & DOMAIN_FLAGS_HARD_WRITE_PROTECT) || 783 + (suffix->domainFlags & DOMAIN_FLAGS_SOFT_WRITE_PROTECT)) { 784 784 if (!sb_rdonly(sb)) { 785 785 udf_warn(sb, "Descriptor for %s marked write protected." 786 786 " Forcing read only mount.\n", dname); ··· 1035 1035 switch (le32_to_cpu(p->accessType)) { 1036 1036 case PD_ACCESS_TYPE_READ_ONLY: 1037 1037 case PD_ACCESS_TYPE_WRITE_ONCE: 1038 - case PD_ACCESS_TYPE_REWRITABLE: 1039 1038 case PD_ACCESS_TYPE_NONE: 1040 1039 goto force_ro; 1041 1040 } ··· 1062 1063 goto force_ro; 1063 1064 1064 1065 if (map->s_partition_type == UDF_VIRTUAL_MAP15 || 1065 - map->s_partition_type == UDF_VIRTUAL_MAP20) 1066 + map->s_partition_type == UDF_VIRTUAL_MAP20 || 1067 + map->s_partition_type == UDF_METADATA_MAP25) 1066 1068 goto force_ro; 1067 1069 1068 1070 return 0; ··· 2402 2402 buf->f_blocks = sbi->s_partmaps[sbi->s_partition].s_partition_len; 2403 2403 buf->f_bfree = udf_count_free(sb); 2404 2404 buf->f_bavail = buf->f_bfree; 2405 + /* 2406 + * Let's pretend each free block is also a free 'inode' since UDF does 2407 + * not have separate preallocated table of inodes. 2408 + */ 2405 2409 buf->f_files = (lvidiu != NULL ? (le32_to_cpu(lvidiu->numFiles) + 2406 2410 le32_to_cpu(lvidiu->numDirs)) : 0) 2407 2411 + buf->f_bfree; ··· 2496 2492 static unsigned int udf_count_free(struct super_block *sb) 2497 2493 { 2498 2494 unsigned int accum = 0; 2499 - struct udf_sb_info *sbi; 2495 + struct udf_sb_info *sbi = UDF_SB(sb); 2500 2496 struct udf_part_map *map; 2497 + unsigned int part = sbi->s_partition; 2498 + int ptype = sbi->s_partmaps[part].s_partition_type; 2501 2499 2502 - sbi = UDF_SB(sb); 2500 + if (ptype == UDF_METADATA_MAP25) { 2501 + part = sbi->s_partmaps[part].s_type_specific.s_metadata. 2502 + s_phys_partition_ref; 2503 + } else if (ptype == UDF_VIRTUAL_MAP15 || ptype == UDF_VIRTUAL_MAP20) { 2504 + /* 2505 + * Filesystems with VAT are append-only and we cannot write to 2506 + * them. Let's just report 0 here. 2507 + */ 2508 + return 0; 2509 + } 2510 + 2503 2511 if (sbi->s_lvid_bh) { 2504 2512 struct logicalVolIntegrityDesc *lvid = 2505 2513 (struct logicalVolIntegrityDesc *) 2506 2514 sbi->s_lvid_bh->b_data; 2507 - if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) { 2515 + if (le32_to_cpu(lvid->numOfPartitions) > part) { 2508 2516 accum = le32_to_cpu( 2509 - lvid->freeSpaceTable[sbi->s_partition]); 2517 + lvid->freeSpaceTable[part]); 2510 2518 if (accum == 0xFFFFFFFF) 2511 2519 accum = 0; 2512 2520 } ··· 2527 2511 if (accum) 2528 2512 return accum; 2529 2513 2530 - map = &sbi->s_partmaps[sbi->s_partition]; 2514 + map = &sbi->s_partmaps[part]; 2531 2515 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) { 2532 2516 accum += udf_count_free_bitmap(sb, 2533 2517 map->s_uspace.s_bitmap);
+1 -1
fs/udf/truncate.c
··· 241 241 242 242 while ((etype = udf_current_aext(inode, &epos, &eloc, 243 243 &elen, 0)) != -1) { 244 - if (etype == (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { 244 + if (etype == (EXT_NEXT_EXTENT_ALLOCDESCS >> 30)) { 245 245 udf_write_aext(inode, &epos, &neloc, nelen, 0); 246 246 if (indirect_ext_len) { 247 247 /* We managed to free all extents in the