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

staging: exfat: remove DOSNAMEs.

remove 'dos_name','short_name' and related definitions.

'dos_name' and 'short_name' are definitions before VFAT.
These are never used in exFAT.

Signed-off-by: Tetsuhiro Kohada <Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp>
Link: https://lore.kernel.org/r/20200217072941.34116-1-Kohada.Tetsuhiro@dc.MitsubishiElectric.co.jp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tetsuhiro Kohada and committed by
Greg Kroah-Hartman
fa4f4ce5 b1f17561

+33 -103
+4 -48
drivers/staging/exfat/exfat.h
··· 189 189 #define MAX_PATH_DEPTH 15 /* max depth of path name */ 190 190 #define MAX_NAME_LENGTH 256 /* max len of filename including NULL */ 191 191 #define MAX_PATH_LENGTH 260 /* max len of pathname including NULL */ 192 - #define DOS_NAME_LENGTH 11 /* DOS filename length excluding NULL */ 193 - #define DOS_PATH_LENGTH 80 /* DOS pathname length excluding NULL */ 194 192 195 193 /* file attributes */ 196 194 #define ATTR_NORMAL 0x0000 ··· 207 209 #define FM_SYMLINK 0x40 208 210 209 211 #define NUM_UPCASE 2918 210 - 211 - #define DOS_CUR_DIR_NAME ". " 212 - #define DOS_PAR_DIR_NAME ".. " 213 212 214 213 #ifdef __LITTLE_ENDIAN 215 214 #define UNI_CUR_DIR_NAME ".\0" ··· 256 261 257 262 struct dir_entry_t { 258 263 char name[MAX_NAME_LENGTH * MAX_CHARSET_SIZE]; 259 - 260 - /* used only for FAT12/16/32, not used for exFAT */ 261 - char short_name[DOS_NAME_LENGTH + 2]; 262 - 263 264 u32 attr; 264 265 u64 Size; 265 266 u32 num_subdirs; ··· 372 381 u8 dummy[32]; 373 382 }; 374 383 375 - struct dos_dentry_t { 376 - u8 name[DOS_NAME_LENGTH]; 377 - u8 attr; 378 - u8 lcase; 379 - u8 create_time_ms; 380 - u8 create_time[2]; 381 - u8 create_date[2]; 382 - u8 access_date[2]; 383 - u8 start_clu_hi[2]; 384 - u8 modify_time[2]; 385 - u8 modify_date[2]; 386 - u8 start_clu_lo[2]; 387 - u8 size[4]; 388 - }; 389 - 390 - /* MS-DOS FAT extended directory entry (32 bytes) */ 391 - struct ext_dentry_t { 392 - u8 order; 393 - u8 unicode_0_4[10]; 394 - u8 attr; 395 - u8 sysid; 396 - u8 checksum; 397 - u8 unicode_5_10[12]; 398 - u8 start_clu[2]; 399 - u8 unicode_11_12[4]; 400 - }; 401 - 402 384 /* MS-DOS EXFAT file directory entry (32 bytes) */ 403 385 struct file_dentry_t { 404 386 u8 type; ··· 444 480 u32 dir; 445 481 s32 entry; 446 482 struct chain_t clu; 447 - }; 448 - 449 - /* DOS name structure */ 450 - struct dos_name_t { 451 - u8 name[DOS_NAME_LENGTH]; 452 - u8 name_case; 453 483 }; 454 484 455 485 /* unicode name structure */ ··· 683 725 u32 type, 684 726 struct dentry_t **file_ep); 685 727 void release_entry_set(struct entry_set_cache_t *es); 686 - s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, 687 - u32 type); 728 + s32 count_entries(struct super_block *sb, struct chain_t *p_dir, u32 type); 688 729 void update_dir_checksum(struct super_block *sb, struct chain_t *p_dir, 689 730 s32 entry); 690 731 void update_dir_checksum_with_entry_set(struct super_block *sb, ··· 691 734 bool is_dir_empty(struct super_block *sb, struct chain_t *p_dir); 692 735 693 736 /* name conversion functions */ 694 - s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, 695 - struct uni_name_t *p_uniname, s32 *entries, 696 - struct dos_name_t *p_dosname); 737 + s32 get_num_entries(struct super_block *sb, struct chain_t *p_dir, 738 + struct uni_name_t *p_uniname, s32 *entries); 697 739 u16 calc_checksum_2byte(void *data, s32 len, u16 chksum, s32 type); 698 740 699 741 /* name resolution functions */ ··· 740 784 /* dir operation functions */ 741 785 s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, 742 786 struct uni_name_t *p_uniname, s32 num_entries, 743 - struct dos_name_t *p_dosname, u32 type); 787 + u32 type); 744 788 void exfat_delete_dir_entry(struct super_block *sb, struct chain_t *p_dir, 745 789 s32 entry, s32 order, s32 num_entries); 746 790 void exfat_get_uni_name_from_ext_entry(struct super_block *sb,
+16 -31
drivers/staging/exfat/exfat_core.c
··· 1044 1044 1045 1045 static s32 exfat_init_ext_entry(struct super_block *sb, struct chain_t *p_dir, 1046 1046 s32 entry, s32 num_entries, 1047 - struct uni_name_t *p_uniname, 1048 - struct dos_name_t *p_dosname) 1047 + struct uni_name_t *p_uniname) 1049 1048 { 1050 1049 int i; 1051 1050 sector_t sector; ··· 1686 1687 */ 1687 1688 s32 exfat_find_dir_entry(struct super_block *sb, struct chain_t *p_dir, 1688 1689 struct uni_name_t *p_uniname, s32 num_entries, 1689 - struct dos_name_t *p_dosname, u32 type) 1690 + u32 type) 1690 1691 { 1691 1692 int i = 0, dentry = 0, num_ext_entries = 0, len, step; 1692 1693 s32 order = 0; ··· 1850 1851 return count; 1851 1852 } 1852 1853 1853 - s32 count_dos_name_entries(struct super_block *sb, struct chain_t *p_dir, 1854 - u32 type) 1854 + s32 count_entries(struct super_block *sb, struct chain_t *p_dir, u32 type) 1855 1855 { 1856 1856 int i, count = 0; 1857 1857 s32 dentries_per_clu; ··· 1962 1964 */ 1963 1965 1964 1966 /* input : dir, uni_name 1965 - * output : num_of_entry, dos_name(format : aaaaaa~1.bbb) 1967 + * output : num_of_entry 1966 1968 */ 1967 - s32 get_num_entries_and_dos_name(struct super_block *sb, struct chain_t *p_dir, 1968 - struct uni_name_t *p_uniname, s32 *entries, 1969 - struct dos_name_t *p_dosname) 1969 + s32 get_num_entries(struct super_block *sb, struct chain_t *p_dir, 1970 + struct uni_name_t *p_uniname, s32 *entries) 1970 1971 { 1971 1972 s32 num_entries; 1972 1973 ··· 2133 2136 s32 ret, dentry, num_entries; 2134 2137 u64 size; 2135 2138 struct chain_t clu; 2136 - struct dos_name_t dos_name; 2137 2139 struct super_block *sb = inode->i_sb; 2138 2140 struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info); 2139 2141 2140 - ret = get_num_entries_and_dos_name(sb, p_dir, p_uniname, &num_entries, 2141 - &dos_name); 2142 + ret = get_num_entries(sb, p_dir, p_uniname, &num_entries); 2142 2143 if (ret) 2143 2144 return ret; 2144 2145 ··· 2169 2174 if (ret != 0) 2170 2175 return ret; 2171 2176 2172 - ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, 2173 - &dos_name); 2177 + ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname); 2174 2178 if (ret != 0) 2175 2179 return ret; 2176 2180 ··· 2194 2200 struct uni_name_t *p_uniname, u8 mode, struct file_id_t *fid) 2195 2201 { 2196 2202 s32 ret, dentry, num_entries; 2197 - struct dos_name_t dos_name; 2198 2203 struct super_block *sb = inode->i_sb; 2199 2204 2200 - ret = get_num_entries_and_dos_name(sb, p_dir, p_uniname, &num_entries, 2201 - &dos_name); 2205 + ret = get_num_entries(sb, p_dir, p_uniname, &num_entries); 2202 2206 if (ret) 2203 2207 return ret; 2204 2208 ··· 2206 2214 return -ENOSPC; 2207 2215 2208 2216 /* (1) update the directory entry */ 2209 - /* fill the dos name directory entry information of the created file. 2217 + /* fill the directory entry information of the created file. 2210 2218 * the first cluster is not determined yet. (0) 2211 2219 */ 2212 2220 ret = exfat_init_dir_entry(sb, p_dir, dentry, TYPE_FILE | mode, ··· 2214 2222 if (ret != 0) 2215 2223 return ret; 2216 2224 2217 - ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname, 2218 - &dos_name); 2225 + ret = exfat_init_ext_entry(sb, p_dir, dentry, num_entries, p_uniname); 2219 2226 if (ret != 0) 2220 2227 return ret; 2221 2228 ··· 2267 2276 { 2268 2277 s32 ret, newentry = -1, num_old_entries, num_new_entries; 2269 2278 sector_t sector_old, sector_new; 2270 - struct dos_name_t dos_name; 2271 2279 struct dentry_t *epold, *epnew; 2272 2280 struct super_block *sb = inode->i_sb; 2273 2281 ··· 2285 2295 } 2286 2296 num_old_entries++; 2287 2297 2288 - ret = get_num_entries_and_dos_name(sb, p_dir, p_uniname, 2289 - &num_new_entries, &dos_name); 2298 + ret = get_num_entries(sb, p_dir, p_uniname, &num_new_entries); 2290 2299 if (ret) { 2291 2300 exfat_buf_unlock(sb, sector_old); 2292 2301 return ret; ··· 2330 2341 exfat_buf_unlock(sb, sector_old); 2331 2342 2332 2343 ret = exfat_init_ext_entry(sb, p_dir, newentry, 2333 - num_new_entries, p_uniname, 2334 - &dos_name); 2344 + num_new_entries, p_uniname); 2335 2345 if (ret != 0) 2336 2346 return ret; 2337 2347 ··· 2348 2360 exfat_buf_unlock(sb, sector_old); 2349 2361 2350 2362 ret = exfat_init_ext_entry(sb, p_dir, oldentry, 2351 - num_new_entries, p_uniname, 2352 - &dos_name); 2363 + num_new_entries, p_uniname); 2353 2364 if (ret != 0) 2354 2365 return ret; 2355 2366 ··· 2365 2378 { 2366 2379 s32 ret, newentry, num_new_entries, num_old_entries; 2367 2380 sector_t sector_mov, sector_new; 2368 - struct dos_name_t dos_name; 2369 2381 struct dentry_t *epmov, *epnew; 2370 2382 struct super_block *sb = inode->i_sb; 2371 2383 ··· 2388 2402 } 2389 2403 num_old_entries++; 2390 2404 2391 - ret = get_num_entries_and_dos_name(sb, p_newdir, p_uniname, 2392 - &num_new_entries, &dos_name); 2405 + ret = get_num_entries(sb, p_newdir, p_uniname, &num_new_entries); 2393 2406 if (ret) { 2394 2407 exfat_buf_unlock(sb, sector_mov); 2395 2408 return ret; ··· 2430 2445 exfat_buf_unlock(sb, sector_mov); 2431 2446 2432 2447 ret = exfat_init_ext_entry(sb, p_newdir, newentry, num_new_entries, 2433 - p_uniname, &dos_name); 2448 + p_uniname); 2434 2449 if (ret != 0) 2435 2450 return ret; 2436 2451
+13 -24
drivers/staging/exfat/exfat_super.c
··· 539 539 int ret, dentry, num_entries; 540 540 struct chain_t dir; 541 541 struct uni_name_t uni_name; 542 - struct dos_name_t dos_name; 543 542 struct dentry_t *ep, *ep2; 544 543 struct entry_set_cache_t *es = NULL; 545 544 struct super_block *sb = inode->i_sb; ··· 558 559 if (ret) 559 560 goto out; 560 561 561 - ret = get_num_entries_and_dos_name(sb, &dir, &uni_name, &num_entries, 562 - &dos_name); 562 + ret = get_num_entries(sb, &dir, &uni_name, &num_entries); 563 563 if (ret) 564 564 goto out; 565 565 566 566 /* search the file name for directories */ 567 567 dentry = exfat_find_dir_entry(sb, &dir, &uni_name, num_entries, 568 - &dos_name, TYPE_ALL); 568 + TYPE_ALL); 569 569 if (dentry < -1) { 570 570 ret = -ENOENT; 571 571 goto out; ··· 1454 1456 sizeof(struct date_time_t)); 1455 1457 memset((char *)&info->access_timestamp, 0, 1456 1458 sizeof(struct date_time_t)); 1457 - strcpy(info->short_name, "."); 1458 1459 strcpy(info->name, "."); 1459 1460 1460 1461 dir.dir = p_fs->root_dir; ··· 1468 1471 p_fs->cluster_size_bits; 1469 1472 } 1470 1473 1471 - count = count_dos_name_entries(sb, &dir, TYPE_DIR); 1474 + count = count_entries(sb, &dir, TYPE_DIR); 1472 1475 if (count < 0) { 1473 1476 ret = count; /* propagate error upward */ 1474 1477 goto out; ··· 1535 1538 info->Size = (u64)count_num_clusters(sb, &dir) << 1536 1539 p_fs->cluster_size_bits; 1537 1540 1538 - count = count_dos_name_entries(sb, &dir, TYPE_DIR); 1541 + count = count_entries(sb, &dir, TYPE_DIR); 1539 1542 if (count < 0) { 1540 1543 ret = count; /* propagate error upward */ 1541 1544 goto out; ··· 2058 2061 struct super_block *sb = inode->i_sb; 2059 2062 struct bd_info_t *p_bd = &(EXFAT_SB(sb)->bd_info); 2060 2063 struct dir_entry_t de; 2064 + struct inode *tmp; 2061 2065 unsigned long inum; 2062 - loff_t cpos; 2066 + loff_t cpos, i_pos; 2063 2067 int err = 0; 2064 2068 2065 2069 __lock_super(sb); ··· 2109 2111 if (!de.name[0]) 2110 2112 goto end_of_dir; 2111 2113 2112 - if (!memcmp(de.short_name, DOS_CUR_DIR_NAME, DOS_NAME_LENGTH)) { 2113 - inum = inode->i_ino; 2114 - } else if (!memcmp(de.short_name, DOS_PAR_DIR_NAME, DOS_NAME_LENGTH)) { 2115 - inum = parent_ino(filp->f_path.dentry); 2114 + i_pos = ((loff_t)EXFAT_I(inode)->fid.start_clu << 32) | 2115 + ((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff); 2116 + tmp = exfat_iget(sb, i_pos); 2117 + if (tmp) { 2118 + inum = tmp->i_ino; 2119 + iput(tmp); 2116 2120 } else { 2117 - loff_t i_pos = ((loff_t)EXFAT_I(inode)->fid.start_clu << 32) | 2118 - ((EXFAT_I(inode)->fid.rwoffset - 1) & 0xffffffff); 2119 - struct inode *tmp = exfat_iget(sb, i_pos); 2120 - 2121 - if (tmp) { 2122 - inum = tmp->i_ino; 2123 - iput(tmp); 2124 - } else { 2125 - inum = iunique(sb, EXFAT_ROOT_INO); 2126 - } 2121 + inum = iunique(sb, EXFAT_ROOT_INO); 2127 2122 } 2128 2123 2129 2124 if (!dir_emit(ctx, de.name, strlen(de.name), inum, ··· 3820 3829 int err; 3821 3830 3822 3831 BUILD_BUG_ON(sizeof(struct dentry_t) != DENTRY_SIZE); 3823 - BUILD_BUG_ON(sizeof(struct dos_dentry_t) != DENTRY_SIZE); 3824 - BUILD_BUG_ON(sizeof(struct ext_dentry_t) != DENTRY_SIZE); 3825 3832 BUILD_BUG_ON(sizeof(struct file_dentry_t) != DENTRY_SIZE); 3826 3833 BUILD_BUG_ON(sizeof(struct strm_dentry_t) != DENTRY_SIZE); 3827 3834 BUILD_BUG_ON(sizeof(struct name_dentry_t) != DENTRY_SIZE);