Changed mkgbmap/rmgbmap to error if NOENT/EXIST
This more closely matches behavior of functions like mkdir and remove,
even though mkgbmap/rmgbmap operate on a special object and not files.
Besides, returning an error is more useful as users are always free to
ignore said error.
Adds what appears to be one literal to mkgbmap (curiously not rmgbmap?
snuck into alignment?):
code stack ctx
before: 35968 2280 660
after: 35968 (+0.0%) 2280 (+0.0%) 660 (+0.0%)
code stack ctx
gbmap before: 38824 2296 772
gbmap after: 38828 (+0.0%) 2296 (+0.0%) 772 (+0.0%)
This commit is contained in:
@@ -16540,9 +16540,9 @@ failed:;
|
||||
// enable the global on-disk block-map
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_mkgbmap(lfs3_t *lfs3) {
|
||||
// do nothing if we already have a gbmap
|
||||
// error if we already have a gbmap
|
||||
if (lfs3_f_isgbmap(lfs3->flags)) {
|
||||
return 0;
|
||||
return LFS3_ERR_EXIST;
|
||||
}
|
||||
|
||||
// prepare our filesystem for writing
|
||||
@@ -16599,9 +16599,9 @@ failed:;
|
||||
// disable the global on-disk block-map
|
||||
#if !defined(LFS3_RDONLY) && defined(LFS3_GBMAP) && !defined(LFS3_YES_GBMAP)
|
||||
int lfs3_fs_rmgbmap(lfs3_t *lfs3) {
|
||||
// do nothing if we already don't have a gbmap
|
||||
// error if we already don't have a gbmap
|
||||
if (!lfs3_f_isgbmap(lfs3->flags)) {
|
||||
return 0;
|
||||
return LFS3_ERR_NOENT;
|
||||
}
|
||||
|
||||
// prepare our filesystem for writing
|
||||
|
||||
Reference in New Issue
Block a user