@@ -1382,7 +1382,7 @@ static int lfs_dir_getinfo(lfs_t *lfs, lfs_mdir_t *dir,
1382
1382
}
1383
1383
1384
1384
int32_t tag = lfs_dir_get (lfs , dir , 0x7c3ff000 ,
1385
- LFS_MKTAG (LFS_TYPE_NAME , id , lfs -> name_size + 1 ), info -> name );
1385
+ LFS_MKTAG (LFS_TYPE_NAME , id , lfs -> name_max + 1 ), info -> name );
1386
1386
if (tag < 0 ) {
1387
1387
return tag ;
1388
1388
}
@@ -1422,7 +1422,7 @@ int lfs_mkdir(lfs_t *lfs, const char *path) {
1422
1422
1423
1423
// check that name fits
1424
1424
lfs_size_t nlen = strlen (path );
1425
- if (nlen > lfs -> name_size ) {
1425
+ if (nlen > lfs -> name_max ) {
1426
1426
return LFS_ERR_NAMETOOLONG ;
1427
1427
}
1428
1428
@@ -1842,7 +1842,7 @@ int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
1842
1842
1843
1843
// check that name fits
1844
1844
lfs_size_t nlen = strlen (path );
1845
- if (nlen > lfs -> name_size ) {
1845
+ if (nlen > lfs -> name_max ) {
1846
1846
err = LFS_ERR_NAMETOOLONG ;
1847
1847
goto cleanup ;
1848
1848
}
@@ -1892,7 +1892,7 @@ int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
1892
1892
}
1893
1893
1894
1894
if ((file -> flags & 3 ) != LFS_O_RDONLY ) {
1895
- if (a -> size > lfs -> attr_size ) {
1895
+ if (a -> size > lfs -> attr_max ) {
1896
1896
err = LFS_ERR_NOSPC ;
1897
1897
goto cleanup ;
1898
1898
}
@@ -2252,7 +2252,7 @@ lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
2252
2252
}
2253
2253
2254
2254
if ((file -> flags & LFS_F_INLINE ) &&
2255
- file -> pos + nsize >= lfs -> inline_size ) {
2255
+ file -> pos + nsize >= lfs -> inline_max ) {
2256
2256
// inline file doesn't fit anymore
2257
2257
file -> block = 0xfffffffe ;
2258
2258
file -> off = file -> pos ;
@@ -2586,7 +2586,7 @@ int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath) {
2586
2586
} else {
2587
2587
// check that name fits
2588
2588
lfs_size_t nlen = strlen (newpath );
2589
- if (nlen > lfs -> name_size ) {
2589
+ if (nlen > lfs -> name_max ) {
2590
2590
return LFS_ERR_NAMETOOLONG ;
2591
2591
}
2592
2592
@@ -2650,7 +2650,7 @@ lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
2650
2650
2651
2651
res = lfs_dir_get (lfs , & cwd , 0x7ffff000 ,
2652
2652
LFS_MKTAG (0x100 | type , lfs_tagid (res ),
2653
- lfs_min (size , lfs -> attr_size )), buffer );
2653
+ lfs_min (size , lfs -> attr_max )), buffer );
2654
2654
if (res < 0 && res != LFS_ERR_NOENT ) {
2655
2655
return res ;
2656
2656
}
@@ -2660,7 +2660,7 @@ lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
2660
2660
2661
2661
int lfs_setattr (lfs_t * lfs , const char * path ,
2662
2662
uint8_t type , const void * buffer , lfs_size_t size ) {
2663
- if (size > lfs -> attr_size ) {
2663
+ if (size > lfs -> attr_max ) {
2664
2664
return LFS_ERR_NOSPC ;
2665
2665
}
2666
2666
@@ -2681,18 +2681,18 @@ static inline void lfs_superblockfromle32(lfs_superblock_t *superblock) {
2681
2681
superblock -> version = lfs_fromle32 (superblock -> version );
2682
2682
superblock -> block_size = lfs_fromle32 (superblock -> block_size );
2683
2683
superblock -> block_count = lfs_fromle32 (superblock -> block_count );
2684
- superblock -> inline_size = lfs_fromle32 (superblock -> inline_size );
2685
- superblock -> attr_size = lfs_fromle32 (superblock -> attr_size );
2686
- superblock -> name_size = lfs_fromle32 (superblock -> name_size );
2684
+ superblock -> inline_max = lfs_fromle32 (superblock -> inline_max );
2685
+ superblock -> attr_max = lfs_fromle32 (superblock -> attr_max );
2686
+ superblock -> name_max = lfs_fromle32 (superblock -> name_max );
2687
2687
}
2688
2688
2689
2689
static inline void lfs_superblocktole32 (lfs_superblock_t * superblock ) {
2690
2690
superblock -> version = lfs_tole32 (superblock -> version );
2691
2691
superblock -> block_size = lfs_tole32 (superblock -> block_size );
2692
2692
superblock -> block_count = lfs_tole32 (superblock -> block_count );
2693
- superblock -> inline_size = lfs_tole32 (superblock -> inline_size );
2694
- superblock -> attr_size = lfs_tole32 (superblock -> attr_size );
2695
- superblock -> name_size = lfs_tole32 (superblock -> name_size );
2693
+ superblock -> inline_max = lfs_tole32 (superblock -> inline_max );
2694
+ superblock -> attr_max = lfs_tole32 (superblock -> attr_max );
2695
+ superblock -> name_max = lfs_tole32 (superblock -> name_max );
2696
2696
}
2697
2697
2698
2698
static int lfs_init (lfs_t * lfs , const struct lfs_config * cfg ) {
@@ -2743,23 +2743,23 @@ static int lfs_init(lfs_t *lfs, const struct lfs_config *cfg) {
2743
2743
}
2744
2744
2745
2745
// check that the size limits are sane
2746
- LFS_ASSERT (lfs -> cfg -> inline_size <= LFS_INLINE_MAX );
2747
- LFS_ASSERT (lfs -> cfg -> inline_size <= lfs -> cfg -> cache_size );
2748
- lfs -> inline_size = lfs -> cfg -> inline_size ;
2749
- if (!lfs -> inline_size ) {
2750
- lfs -> inline_size = lfs_min (LFS_INLINE_MAX , lfs -> cfg -> cache_size );
2746
+ LFS_ASSERT (lfs -> cfg -> inline_max <= LFS_INLINE_MAX );
2747
+ LFS_ASSERT (lfs -> cfg -> inline_max <= lfs -> cfg -> cache_size );
2748
+ lfs -> inline_max = lfs -> cfg -> inline_max ;
2749
+ if (!lfs -> inline_max ) {
2750
+ lfs -> inline_max = lfs_min (LFS_INLINE_MAX , lfs -> cfg -> cache_size );
2751
2751
}
2752
2752
2753
- LFS_ASSERT (lfs -> cfg -> attr_size <= LFS_ATTR_MAX );
2754
- lfs -> attr_size = lfs -> cfg -> attr_size ;
2755
- if (!lfs -> attr_size ) {
2756
- lfs -> attr_size = LFS_ATTR_MAX ;
2753
+ LFS_ASSERT (lfs -> cfg -> attr_max <= LFS_ATTR_MAX );
2754
+ lfs -> attr_max = lfs -> cfg -> attr_max ;
2755
+ if (!lfs -> attr_max ) {
2756
+ lfs -> attr_max = LFS_ATTR_MAX ;
2757
2757
}
2758
2758
2759
- LFS_ASSERT (lfs -> cfg -> name_size <= LFS_NAME_MAX );
2760
- lfs -> name_size = lfs -> cfg -> name_size ;
2761
- if (!lfs -> name_size ) {
2762
- lfs -> name_size = LFS_NAME_MAX ;
2759
+ LFS_ASSERT (lfs -> cfg -> name_max <= LFS_NAME_MAX );
2760
+ lfs -> name_max = lfs -> cfg -> name_max ;
2761
+ if (!lfs -> name_max ) {
2762
+ lfs -> name_max = LFS_NAME_MAX ;
2763
2763
}
2764
2764
2765
2765
// setup default state
@@ -2836,9 +2836,9 @@ int lfs_format(lfs_t *lfs, const struct lfs_config *cfg) {
2836
2836
2837
2837
.block_size = lfs -> cfg -> block_size ,
2838
2838
.block_count = lfs -> cfg -> block_count ,
2839
- .attr_size = lfs -> attr_size ,
2840
- .name_size = lfs -> name_size ,
2841
- .inline_size = lfs -> inline_size ,
2839
+ .attr_max = lfs -> attr_max ,
2840
+ .name_max = lfs -> name_max ,
2841
+ .inline_max = lfs -> inline_max ,
2842
2842
};
2843
2843
2844
2844
lfs_superblocktole32 (& superblock );
@@ -2912,34 +2912,34 @@ int lfs_mount(lfs_t *lfs, const struct lfs_config *cfg) {
2912
2912
lfs_pairfromle32 (lfs -> root );
2913
2913
2914
2914
// check superblock configuration
2915
- if (superblock .attr_size ) {
2916
- if (superblock .attr_size > lfs -> attr_size ) {
2917
- LFS_ERROR ("Unsupported attr size (%d > %d)" ,
2918
- superblock .attr_size , lfs -> attr_size );
2915
+ if (superblock .attr_max ) {
2916
+ if (superblock .attr_max > lfs -> attr_max ) {
2917
+ LFS_ERROR ("Unsupported attr_max (%d > %d)" ,
2918
+ superblock .attr_max , lfs -> attr_max );
2919
2919
return LFS_ERR_INVAL ;
2920
2920
}
2921
2921
2922
- lfs -> attr_size = superblock .attr_size ;
2922
+ lfs -> attr_max = superblock .attr_max ;
2923
2923
}
2924
2924
2925
- if (superblock .name_size ) {
2926
- if (superblock .name_size > lfs -> name_size ) {
2927
- LFS_ERROR ("Unsupported name size (%d > %d)" ,
2928
- superblock .name_size , lfs -> name_size );
2925
+ if (superblock .name_max ) {
2926
+ if (superblock .name_max > lfs -> name_max ) {
2927
+ LFS_ERROR ("Unsupported name_max (%d > %d)" ,
2928
+ superblock .name_max , lfs -> name_max );
2929
2929
return LFS_ERR_INVAL ;
2930
2930
}
2931
2931
2932
- lfs -> name_size = superblock .name_size ;
2932
+ lfs -> name_max = superblock .name_max ;
2933
2933
}
2934
2934
2935
- if (superblock .inline_size ) {
2936
- if (superblock .inline_size > lfs -> inline_size ) {
2937
- LFS_ERROR ("Unsupported inline size (%d > %d)" ,
2938
- superblock .inline_size , lfs -> inline_size );
2935
+ if (superblock .inline_max ) {
2936
+ if (superblock .inline_max > lfs -> inline_max ) {
2937
+ LFS_ERROR ("Unsupported inline_max (%d > %d)" ,
2938
+ superblock .inline_max , lfs -> inline_max );
2939
2939
return LFS_ERR_INVAL ;
2940
2940
}
2941
2941
2942
- lfs -> inline_size = superblock .inline_size ;
2942
+ lfs -> inline_max = superblock .inline_max ;
2943
2943
}
2944
2944
2945
2945
// scan for any global updates
@@ -3265,7 +3265,7 @@ lfs_ssize_t lfs_fs_getattr(lfs_t *lfs,
3265
3265
3266
3266
int32_t res = lfs_dir_get (lfs , & superdir , 0x7ffff000 ,
3267
3267
LFS_MKTAG (0x100 | type , 0 ,
3268
- lfs_min (size , lfs -> attr_size )), buffer );
3268
+ lfs_min (size , lfs -> attr_max )), buffer );
3269
3269
if (res < 0 ) {
3270
3270
return res ;
3271
3271
}
@@ -3275,7 +3275,7 @@ lfs_ssize_t lfs_fs_getattr(lfs_t *lfs,
3275
3275
3276
3276
int lfs_fs_setattr (lfs_t * lfs ,
3277
3277
uint8_t type , const void * buffer , lfs_size_t size ) {
3278
- if (size > lfs -> attr_size ) {
3278
+ if (size > lfs -> attr_max ) {
3279
3279
return LFS_ERR_NOSPC ;
3280
3280
}
3281
3281
0 commit comments