Filesystem: Read-only file system checks

o Make sure EROFS is indicated for write operations on a read-only file
   system.
 o Add error indication for read-only file systems in fchmod() and
   fchown() according to POSIX.
This commit is contained in:
Sebastian Huber
2012-03-02 10:18:10 +01:00
parent 3b7c123c8d
commit 3ba4f828e4
9 changed files with 289 additions and 32 deletions

View File

@@ -242,18 +242,41 @@ int main(
* Create a directory that passes through the read only file system.
*/
printf("create c/y/my_mount_point/../../y/my_mount_point/new_dir\n");
status = mkdir("c/y/my_mount_point/../../y/my_mount_point/new_dir",S_IRWXU );
printf("create c/y/my_mount_point/../../y/new_dir\n");
status = mkdir("c/y/my_mount_point/../../y/new_dir",S_IRWXU );
rtems_test_assert( status == 0 );
status = stat("c/y/my_mount_point/../../y/my_mount_point/new_dir",&statbuf );
status = stat("c/y/my_mount_point/../../y/new_dir",&statbuf );
rtems_test_assert( status == 0 );
status = stat("c/y/my_mount_point/new_dir/..", &statbuf );
status = stat("c/y/new_dir", &statbuf );
rtems_test_assert( status == 0 );
/*
* Attempt to mount a second file system at a used mount point.
*/
printf("Verify a mount point returns EROFS for another mount\n");
status = mount(
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EROFS);
printf("Unmount /c/y/my_mount_point\n");
status = unmount( "/c/y/my_mount_point" );
rtems_test_assert( status == 0 );
printf("Mount a read-write file system at /c/y/my_mount_point\n");
status = mount(
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == 0 );
printf("Verify a mount point returns EBUSY for another mount\n");
status = mount(
"null",
@@ -330,7 +353,7 @@ int main(
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == 0 );