@@ -49,7 +49,7 @@ static void exfat_put_super(struct super_block *sb)
49
49
sync_blockdev (sb -> s_bdev );
50
50
exfat_set_vol_flags (sb , VOL_CLEAN );
51
51
exfat_free_bitmap (sbi );
52
- brelse (sbi -> pbr_bh );
52
+ brelse (sbi -> boot_bh );
53
53
mutex_unlock (& sbi -> s_lock );
54
54
55
55
call_rcu (& sbi -> rcu , exfat_delayed_free );
@@ -101,7 +101,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
101
101
int exfat_set_vol_flags (struct super_block * sb , unsigned short new_flag )
102
102
{
103
103
struct exfat_sb_info * sbi = EXFAT_SB (sb );
104
- struct pbr64 * bpb = (struct pbr64 * )sbi -> pbr_bh -> b_data ;
104
+ struct boot_sector * p_boot = (struct boot_sector * )sbi -> boot_bh -> b_data ;
105
105
bool sync ;
106
106
107
107
/* flags are not changed */
@@ -116,18 +116,18 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
116
116
if (sb_rdonly (sb ))
117
117
return 0 ;
118
118
119
- bpb -> bsx . vol_flags = cpu_to_le16 (new_flag );
119
+ p_boot -> vol_flags = cpu_to_le16 (new_flag );
120
120
121
- if (new_flag == VOL_DIRTY && !buffer_dirty (sbi -> pbr_bh ))
121
+ if (new_flag == VOL_DIRTY && !buffer_dirty (sbi -> boot_bh ))
122
122
sync = true;
123
123
else
124
124
sync = false;
125
125
126
- set_buffer_uptodate (sbi -> pbr_bh );
127
- mark_buffer_dirty (sbi -> pbr_bh );
126
+ set_buffer_uptodate (sbi -> boot_bh );
127
+ mark_buffer_dirty (sbi -> boot_bh );
128
128
129
129
if (sync )
130
- sync_dirty_buffer (sbi -> pbr_bh );
130
+ sync_dirty_buffer (sbi -> boot_bh );
131
131
return 0 ;
132
132
}
133
133
@@ -366,13 +366,14 @@ static int exfat_read_root(struct inode *inode)
366
366
return 0 ;
367
367
}
368
368
369
- static struct pbr * exfat_read_pbr_with_logical_sector (struct super_block * sb )
369
+ static struct boot_sector * exfat_read_boot_with_logical_sector (
370
+ struct super_block * sb )
370
371
{
371
372
struct exfat_sb_info * sbi = EXFAT_SB (sb );
372
- struct pbr * p_pbr = (struct pbr * ) ( sbi -> pbr_bh ) -> b_data ;
373
+ struct boot_sector * p_boot = (struct boot_sector * )sbi -> boot_bh -> b_data ;
373
374
unsigned short logical_sect = 0 ;
374
375
375
- logical_sect = 1 << p_pbr -> bsx . f64 . sect_size_bits ;
376
+ logical_sect = 1 << p_boot -> sect_size_bits ;
376
377
377
378
if (!is_power_of_2 (logical_sect ) ||
378
379
logical_sect < 512 || logical_sect > 4096 ) {
@@ -387,58 +388,57 @@ static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb)
387
388
}
388
389
389
390
if (logical_sect > sb -> s_blocksize ) {
390
- brelse (sbi -> pbr_bh );
391
- sbi -> pbr_bh = NULL ;
391
+ brelse (sbi -> boot_bh );
392
+ sbi -> boot_bh = NULL ;
392
393
393
394
if (!sb_set_blocksize (sb , logical_sect )) {
394
395
exfat_err (sb , "unable to set blocksize %u" ,
395
396
logical_sect );
396
397
return NULL ;
397
398
}
398
- sbi -> pbr_bh = sb_bread (sb , 0 );
399
- if (!sbi -> pbr_bh ) {
399
+ sbi -> boot_bh = sb_bread (sb , 0 );
400
+ if (!sbi -> boot_bh ) {
400
401
exfat_err (sb , "unable to read boot sector (logical sector size = %lu)" ,
401
402
sb -> s_blocksize );
402
403
return NULL ;
403
404
}
404
405
405
- p_pbr = (struct pbr * )sbi -> pbr_bh -> b_data ;
406
+ p_boot = (struct boot_sector * )sbi -> boot_bh -> b_data ;
406
407
}
407
- return p_pbr ;
408
+ return p_boot ;
408
409
}
409
410
410
411
/* mount the file system volume */
411
412
static int __exfat_fill_super (struct super_block * sb )
412
413
{
413
414
int ret ;
414
- struct pbr * p_pbr ;
415
- struct pbr64 * p_bpb ;
415
+ struct boot_sector * p_boot ;
416
416
struct exfat_sb_info * sbi = EXFAT_SB (sb );
417
417
418
418
/* set block size to read super block */
419
419
sb_min_blocksize (sb , 512 );
420
420
421
421
/* read boot sector */
422
- sbi -> pbr_bh = sb_bread (sb , 0 );
423
- if (!sbi -> pbr_bh ) {
422
+ sbi -> boot_bh = sb_bread (sb , 0 );
423
+ if (!sbi -> boot_bh ) {
424
424
exfat_err (sb , "unable to read boot sector" );
425
425
return - EIO ;
426
426
}
427
427
428
428
/* PRB is read */
429
- p_pbr = (struct pbr * )sbi -> pbr_bh -> b_data ;
429
+ p_boot = (struct boot_sector * )sbi -> boot_bh -> b_data ;
430
430
431
- /* check the validity of PBR */
432
- if (le16_to_cpu ((p_pbr -> signature )) != PBR_SIGNATURE ) {
431
+ /* check the validity of BOOT */
432
+ if (le16_to_cpu ((p_boot -> signature )) != BOOT_SIGNATURE ) {
433
433
exfat_err (sb , "invalid boot record signature" );
434
434
ret = - EINVAL ;
435
435
goto free_bh ;
436
436
}
437
437
438
438
439
439
/* check logical sector size */
440
- p_pbr = exfat_read_pbr_with_logical_sector (sb );
441
- if (!p_pbr ) {
440
+ p_boot = exfat_read_boot_with_logical_sector (sb );
441
+ if (!p_boot ) {
442
442
ret = - EIO ;
443
443
goto free_bh ;
444
444
}
@@ -447,43 +447,43 @@ static int __exfat_fill_super(struct super_block *sb)
447
447
* res_zero field must be filled with zero to prevent mounting
448
448
* from FAT volume.
449
449
*/
450
- if (memchr_inv (p_pbr -> bpb . f64 . res_zero , 0 ,
451
- sizeof (p_pbr -> bpb . f64 . res_zero ))) {
450
+ if (memchr_inv (p_boot -> must_be_zero , 0 ,
451
+ sizeof (p_boot -> must_be_zero ))) {
452
452
ret = - EINVAL ;
453
453
goto free_bh ;
454
454
}
455
455
456
- p_bpb = (struct pbr64 * )p_pbr ;
457
- if (!p_bpb -> bsx . num_fats ) {
456
+ p_boot = (struct boot_sector * )p_boot ;
457
+ if (!p_boot -> num_fats ) {
458
458
exfat_err (sb , "bogus number of FAT structure" );
459
459
ret = - EINVAL ;
460
460
goto free_bh ;
461
461
}
462
462
463
- sbi -> sect_per_clus = 1 << p_bpb -> bsx . sect_per_clus_bits ;
464
- sbi -> sect_per_clus_bits = p_bpb -> bsx . sect_per_clus_bits ;
463
+ sbi -> sect_per_clus = 1 << p_boot -> sect_per_clus_bits ;
464
+ sbi -> sect_per_clus_bits = p_boot -> sect_per_clus_bits ;
465
465
sbi -> cluster_size_bits = sbi -> sect_per_clus_bits + sb -> s_blocksize_bits ;
466
466
sbi -> cluster_size = 1 << sbi -> cluster_size_bits ;
467
- sbi -> num_FAT_sectors = le32_to_cpu (p_bpb -> bsx . fat_length );
468
- sbi -> FAT1_start_sector = le32_to_cpu (p_bpb -> bsx . fat_offset );
469
- sbi -> FAT2_start_sector = p_bpb -> bsx . num_fats == 1 ?
467
+ sbi -> num_FAT_sectors = le32_to_cpu (p_boot -> fat_length );
468
+ sbi -> FAT1_start_sector = le32_to_cpu (p_boot -> fat_offset );
469
+ sbi -> FAT2_start_sector = p_boot -> num_fats == 1 ?
470
470
sbi -> FAT1_start_sector :
471
471
sbi -> FAT1_start_sector + sbi -> num_FAT_sectors ;
472
- sbi -> data_start_sector = le32_to_cpu (p_bpb -> bsx . clu_offset );
473
- sbi -> num_sectors = le64_to_cpu (p_bpb -> bsx . vol_length );
472
+ sbi -> data_start_sector = le32_to_cpu (p_boot -> clu_offset );
473
+ sbi -> num_sectors = le64_to_cpu (p_boot -> vol_length );
474
474
/* because the cluster index starts with 2 */
475
- sbi -> num_clusters = le32_to_cpu (p_bpb -> bsx . clu_count ) +
475
+ sbi -> num_clusters = le32_to_cpu (p_boot -> clu_count ) +
476
476
EXFAT_RESERVED_CLUSTERS ;
477
477
478
- sbi -> root_dir = le32_to_cpu (p_bpb -> bsx . root_cluster );
478
+ sbi -> root_dir = le32_to_cpu (p_boot -> root_cluster );
479
479
sbi -> dentries_per_clu = 1 <<
480
480
(sbi -> cluster_size_bits - DENTRY_SIZE_BITS );
481
481
482
- sbi -> vol_flag = le16_to_cpu (p_bpb -> bsx . vol_flags );
482
+ sbi -> vol_flag = le16_to_cpu (p_boot -> vol_flags );
483
483
sbi -> clu_srch_ptr = EXFAT_FIRST_CLUSTER ;
484
484
sbi -> used_clusters = EXFAT_CLUSTERS_UNTRACKED ;
485
485
486
- if (le16_to_cpu (p_bpb -> bsx . vol_flags ) & VOL_DIRTY ) {
486
+ if (le16_to_cpu (p_boot -> vol_flags ) & VOL_DIRTY ) {
487
487
sbi -> vol_flag |= VOL_DIRTY ;
488
488
exfat_warn (sb , "Volume was not properly unmounted. Some data may be corrupt. Please run fsck." );
489
489
}
@@ -517,7 +517,7 @@ static int __exfat_fill_super(struct super_block *sb)
517
517
free_upcase_table :
518
518
exfat_free_upcase_table (sbi );
519
519
free_bh :
520
- brelse (sbi -> pbr_bh );
520
+ brelse (sbi -> boot_bh );
521
521
return ret ;
522
522
}
523
523
@@ -608,7 +608,7 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
608
608
free_table :
609
609
exfat_free_upcase_table (sbi );
610
610
exfat_free_bitmap (sbi );
611
- brelse (sbi -> pbr_bh );
611
+ brelse (sbi -> boot_bh );
612
612
613
613
check_nls_io :
614
614
unload_nls (sbi -> nls_io );
0 commit comments