Adopted LFS3_ERR_BUSY for root-related errors

Now that we use LFS3_ERR_BUSY for traversals, we no longer have an
excuse for not returning LFS3_ERR_BUSY on root-related errors:

- lfs3_remove(&lfs3, "/") => LFS3_ERR_BUSY
- lfs3_rename(&lfs3, "/", *) => LFS3_ERR_BUSY
- lfs3_rename(&lfs3, *, "/") => LFS3_ERR_BUSY

This better aligns with POSIX. Arguably we should have defined
LFS3_ERR_BUSY for this case anyways, it's not like additional error
codes cost much.

No code changes.
This commit is contained in:
Christopher Haster
2025-11-09 01:02:18 -06:00
parent 4010afeafd
commit e196be53df
5 changed files with 47 additions and 47 deletions
+4 -4
View File
@@ -2595,7 +2595,7 @@ code = '''
}
// try to remove root, which doesn't really make sense
lfs3_remove(&lfs3, "/") => LFS3_ERR_INVAL;
lfs3_remove(&lfs3, "/") => LFS3_ERR_BUSY;
// make a directory
err = lfs3_mkdir(&lfs3, "ardvark");
@@ -2605,7 +2605,7 @@ code = '''
//
// it doesn't really matter which error returns first, so accept both
err = lfs3_remove(&lfs3, "/");
assert(err == LFS3_ERR_NOTEMPTY || err == LFS3_ERR_INVAL);
assert(err == LFS3_ERR_NOTEMPTY || err == LFS3_ERR_BUSY);
for (int remount = 0; remount < 2; remount++) {
// remount?
@@ -4830,14 +4830,14 @@ code = '''
}
// try to rename root, which doesn't really make sense
lfs3_rename(&lfs3, "/", "notroot") => LFS3_ERR_INVAL;
lfs3_rename(&lfs3, "/", "notroot") => LFS3_ERR_BUSY;
// make a directory
err = lfs3_mkdir(&lfs3, "ardvark");
assert(!err || (TEST_PLS && err == LFS3_ERR_EXIST));
// try to rename root, which doesn't really make sense
lfs3_rename(&lfs3, "/", "notroot") => LFS3_ERR_INVAL;
lfs3_rename(&lfs3, "/", "notroot") => LFS3_ERR_BUSY;
for (int remount = 0; remount < 2; remount++) {
// remount?