@@ -453,7 +453,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
453
453
{
454
454
int len , err , second_is_newer , bitflips = 0 , corrupted = 0 ;
455
455
uint32_t data_crc , crc ;
456
- struct ubi_vid_hdr * vh = NULL ;
456
+ struct ubi_vid_io_buf * vidb = NULL ;
457
457
unsigned long long sqnum2 = be64_to_cpu (vid_hdr -> sqnum );
458
458
459
459
if (sqnum2 == aeb -> sqnum ) {
@@ -496,12 +496,12 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
496
496
return bitflips << 1 ;
497
497
}
498
498
499
- vh = ubi_zalloc_vid_hdr (ubi , GFP_KERNEL );
500
- if (!vh )
499
+ vidb = ubi_alloc_vid_buf (ubi , GFP_KERNEL );
500
+ if (!vidb )
501
501
return - ENOMEM ;
502
502
503
503
pnum = aeb -> pnum ;
504
- err = ubi_io_read_vid_hdr (ubi , pnum , vh , 0 );
504
+ err = ubi_io_read_vid_hdr (ubi , pnum , vidb , 0 );
505
505
if (err ) {
506
506
if (err == UBI_IO_BITFLIPS )
507
507
bitflips = 1 ;
@@ -515,7 +515,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
515
515
}
516
516
}
517
517
518
- vid_hdr = vh ;
518
+ vid_hdr = ubi_get_vid_hdr ( vidb ) ;
519
519
}
520
520
521
521
/* Read the data of the copy and check the CRC */
@@ -541,7 +541,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
541
541
}
542
542
mutex_unlock (& ubi -> buf_mutex );
543
543
544
- ubi_free_vid_hdr ( ubi , vh );
544
+ ubi_free_vid_buf ( vidb );
545
545
546
546
if (second_is_newer )
547
547
dbg_bld ("second PEB %d is newer, copy_flag is set" , pnum );
@@ -553,7 +553,7 @@ int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
553
553
out_unlock :
554
554
mutex_unlock (& ubi -> buf_mutex );
555
555
out_free_vidh :
556
- ubi_free_vid_hdr ( ubi , vh );
556
+ ubi_free_vid_buf ( vidb );
557
557
return err ;
558
558
}
559
559
@@ -955,7 +955,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
955
955
int pnum , bool fast )
956
956
{
957
957
struct ubi_ec_hdr * ech = ai -> ech ;
958
- struct ubi_vid_hdr * vidh = ai -> vidh ;
958
+ struct ubi_vid_io_buf * vidb = ai -> vidb ;
959
+ struct ubi_vid_hdr * vidh = ubi_get_vid_hdr (vidb );
959
960
long long ec ;
960
961
int err , bitflips = 0 , vol_id = -1 , ec_err = 0 ;
961
962
@@ -1053,7 +1054,7 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai,
1053
1054
1054
1055
/* OK, we've done with the EC header, let's look at the VID header */
1055
1056
1056
- err = ubi_io_read_vid_hdr (ubi , pnum , vidh , 0 );
1057
+ err = ubi_io_read_vid_hdr (ubi , pnum , vidb , 0 );
1057
1058
if (err < 0 )
1058
1059
return err ;
1059
1060
switch (err ) {
@@ -1396,8 +1397,8 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,
1396
1397
if (!ai -> ech )
1397
1398
return err ;
1398
1399
1399
- ai -> vidh = ubi_zalloc_vid_hdr (ubi , GFP_KERNEL );
1400
- if (!ai -> vidh )
1400
+ ai -> vidb = ubi_alloc_vid_buf (ubi , GFP_KERNEL );
1401
+ if (!ai -> vidb )
1401
1402
goto out_ech ;
1402
1403
1403
1404
for (pnum = start ; pnum < ubi -> peb_count ; pnum ++ ) {
@@ -1446,13 +1447,13 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,
1446
1447
if (err )
1447
1448
goto out_vidh ;
1448
1449
1449
- ubi_free_vid_hdr ( ubi , ai -> vidh );
1450
+ ubi_free_vid_buf ( ai -> vidb );
1450
1451
kfree (ai -> ech );
1451
1452
1452
1453
return 0 ;
1453
1454
1454
1455
out_vidh :
1455
- ubi_free_vid_hdr ( ubi , ai -> vidh );
1456
+ ubi_free_vid_buf ( ai -> vidb );
1456
1457
out_ech :
1457
1458
kfree (ai -> ech );
1458
1459
return err ;
@@ -1510,8 +1511,8 @@ static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info **ai)
1510
1511
if (!scan_ai -> ech )
1511
1512
goto out_ai ;
1512
1513
1513
- scan_ai -> vidh = ubi_zalloc_vid_hdr (ubi , GFP_KERNEL );
1514
- if (!scan_ai -> vidh )
1514
+ scan_ai -> vidb = ubi_alloc_vid_buf (ubi , GFP_KERNEL );
1515
+ if (!scan_ai -> vidb )
1515
1516
goto out_ech ;
1516
1517
1517
1518
for (pnum = 0 ; pnum < UBI_FM_MAX_START ; pnum ++ ) {
@@ -1523,7 +1524,7 @@ static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info **ai)
1523
1524
goto out_vidh ;
1524
1525
}
1525
1526
1526
- ubi_free_vid_hdr ( ubi , scan_ai -> vidh );
1527
+ ubi_free_vid_buf ( scan_ai -> vidb );
1527
1528
kfree (scan_ai -> ech );
1528
1529
1529
1530
if (scan_ai -> force_full_scan )
@@ -1544,7 +1545,7 @@ static int scan_fast(struct ubi_device *ubi, struct ubi_attach_info **ai)
1544
1545
return err ;
1545
1546
1546
1547
out_vidh :
1547
- ubi_free_vid_hdr ( ubi , scan_ai -> vidh );
1548
+ ubi_free_vid_buf ( scan_ai -> vidb );
1548
1549
out_ech :
1549
1550
kfree (scan_ai -> ech );
1550
1551
out_ai :
@@ -1668,7 +1669,8 @@ int ubi_attach(struct ubi_device *ubi, int force_scan)
1668
1669
*/
1669
1670
static int self_check_ai (struct ubi_device * ubi , struct ubi_attach_info * ai )
1670
1671
{
1671
- struct ubi_vid_hdr * vidh = ai -> vidh ;
1672
+ struct ubi_vid_io_buf * vidb = ai -> vidb ;
1673
+ struct ubi_vid_hdr * vidh = ubi_get_vid_hdr (vidb );
1672
1674
int pnum , err , vols_found = 0 ;
1673
1675
struct rb_node * rb1 , * rb2 ;
1674
1676
struct ubi_ainf_volume * av ;
@@ -1804,7 +1806,7 @@ static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai)
1804
1806
1805
1807
last_aeb = aeb ;
1806
1808
1807
- err = ubi_io_read_vid_hdr (ubi , aeb -> pnum , vidh , 1 );
1809
+ err = ubi_io_read_vid_hdr (ubi , aeb -> pnum , vidb , 1 );
1808
1810
if (err && err != UBI_IO_BITFLIPS ) {
1809
1811
ubi_err (ubi , "VID header is not OK (%d)" ,
1810
1812
err );
0 commit comments