mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
vfs: return -EROFS if remove operation is not implemented
This commit is contained in:
parent
991f8e8c29
commit
a587069b18
@ -583,7 +583,7 @@ int vfs_rename(const char *from_path, const char *to_path)
|
|||||||
DEBUG("vfs_rename: rename not supported by fs!\n");
|
DEBUG("vfs_rename: rename not supported by fs!\n");
|
||||||
/* remember to decrement the open_files count */
|
/* remember to decrement the open_files count */
|
||||||
atomic_fetch_sub(&mountp->open_files, 1);
|
atomic_fetch_sub(&mountp->open_files, 1);
|
||||||
return -EPERM;
|
return -EROFS;
|
||||||
}
|
}
|
||||||
const char *rel_to;
|
const char *rel_to;
|
||||||
vfs_mount_t *mountp_to;
|
vfs_mount_t *mountp_to;
|
||||||
@ -642,7 +642,7 @@ int vfs_unlink(const char *name)
|
|||||||
DEBUG("vfs_unlink: unlink not supported by fs!\n");
|
DEBUG("vfs_unlink: unlink not supported by fs!\n");
|
||||||
/* remember to decrement the open_files count */
|
/* remember to decrement the open_files count */
|
||||||
atomic_fetch_sub(&mountp->open_files, 1);
|
atomic_fetch_sub(&mountp->open_files, 1);
|
||||||
return -EPERM;
|
return -EROFS;
|
||||||
}
|
}
|
||||||
res = mountp->fs->fs_op->unlink(mountp, rel_path);
|
res = mountp->fs->fs_op->unlink(mountp, rel_path);
|
||||||
DEBUG("vfs_unlink: unlink %p, \"%s\"", (void *)mountp, rel_path);
|
DEBUG("vfs_unlink: unlink %p, \"%s\"", (void *)mountp, rel_path);
|
||||||
@ -679,7 +679,7 @@ int vfs_mkdir(const char *name, mode_t mode)
|
|||||||
DEBUG("vfs_mkdir: mkdir not supported by fs!\n");
|
DEBUG("vfs_mkdir: mkdir not supported by fs!\n");
|
||||||
/* remember to decrement the open_files count */
|
/* remember to decrement the open_files count */
|
||||||
atomic_fetch_sub(&mountp->open_files, 1);
|
atomic_fetch_sub(&mountp->open_files, 1);
|
||||||
return -EPERM;
|
return -EROFS;
|
||||||
}
|
}
|
||||||
res = mountp->fs->fs_op->mkdir(mountp, rel_path, mode);
|
res = mountp->fs->fs_op->mkdir(mountp, rel_path, mode);
|
||||||
DEBUG("vfs_mkdir: mkdir %p, \"%s\"", (void *)mountp, rel_path);
|
DEBUG("vfs_mkdir: mkdir %p, \"%s\"", (void *)mountp, rel_path);
|
||||||
@ -716,7 +716,7 @@ int vfs_rmdir(const char *name)
|
|||||||
DEBUG("vfs_rmdir: rmdir not supported by fs!\n");
|
DEBUG("vfs_rmdir: rmdir not supported by fs!\n");
|
||||||
/* remember to decrement the open_files count */
|
/* remember to decrement the open_files count */
|
||||||
atomic_fetch_sub(&mountp->open_files, 1);
|
atomic_fetch_sub(&mountp->open_files, 1);
|
||||||
return -EPERM;
|
return -EROFS;
|
||||||
}
|
}
|
||||||
res = mountp->fs->fs_op->rmdir(mountp, rel_path);
|
res = mountp->fs->fs_op->rmdir(mountp, rel_path);
|
||||||
DEBUG("vfs_rmdir: rmdir %p, \"%s\"", (void *)mountp, rel_path);
|
DEBUG("vfs_rmdir: rmdir %p, \"%s\"", (void *)mountp, rel_path);
|
||||||
|
@ -96,28 +96,28 @@ static void test_vfs_null_fs_ops_rename(void)
|
|||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
||||||
int res = vfs_rename("/test/foo", "/test/bar");
|
int res = vfs_rename("/test/foo", "/test/bar");
|
||||||
TEST_ASSERT_EQUAL_INT(-EPERM, res);
|
TEST_ASSERT_EQUAL_INT(-EROFS, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_vfs_null_fs_ops_unlink(void)
|
static void test_vfs_null_fs_ops_unlink(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
||||||
int res = vfs_unlink("/test/foo");
|
int res = vfs_unlink("/test/foo");
|
||||||
TEST_ASSERT_EQUAL_INT(-EPERM, res);
|
TEST_ASSERT_EQUAL_INT(-EROFS, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_vfs_null_fs_ops_mkdir(void)
|
static void test_vfs_null_fs_ops_mkdir(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
||||||
int res = vfs_mkdir("/test/foodir", 0);
|
int res = vfs_mkdir("/test/foodir", 0);
|
||||||
TEST_ASSERT_EQUAL_INT(-EPERM, res);
|
TEST_ASSERT_EQUAL_INT(-EROFS, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_vfs_null_fs_ops_rmdir(void)
|
static void test_vfs_null_fs_ops_rmdir(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
TEST_ASSERT_EQUAL_INT(0, _test_vfs_fs_op_mount_res);
|
||||||
int res = vfs_rmdir("/test/foodir");
|
int res = vfs_rmdir("/test/foodir");
|
||||||
TEST_ASSERT_EQUAL_INT(-EPERM, res);
|
TEST_ASSERT_EQUAL_INT(-EROFS, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_vfs_null_fs_ops_stat(void)
|
static void test_vfs_null_fs_ops_stat(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user