2010-06-02 Chris Johns <chrisj@rtems.org>

* psxfile01/test.c, psxmount/test.c, psxreaddir/test.c,
        psxstat/test.c: Update to the new mount API.
This commit is contained in:
Chris Johns
2010-06-02 00:50:37 +00:00
parent 558a5f48fc
commit 042a44210a
5 changed files with 78 additions and 91 deletions
+5
View File
@@ -1,3 +1,8 @@
2010-06-02 Chris Johns <chrisj@rtems.org>
* psxfile01/test.c, psxmount/test.c, psxreaddir/test.c,
psxstat/test.c: Update to the new mount API.
2010-05-29 Ralf Corsépius <ralf.corsepius@rtems.org>
* configure.ac: Add AC_CHECK_SIZEOF(off_t).
+18 -18
View File
@@ -40,6 +40,7 @@ void test_case_reopen_append(void);
char test_write_buffer[ 1024 ];
rtems_filesystem_operations_table IMFS_ops_no_evalformake;
rtems_filesystem_operations_table IMFS_ops_no_rename;
/*
* File test support routines.
*/
@@ -118,11 +119,12 @@ void stat_a_file(
}
int no_evalformake_IMFS_initialize(
rtems_filesystem_mount_table_entry_t *temp_mt_entry
rtems_filesystem_mount_table_entry_t *mt_entry,
const void *data
)
{
return IMFS_initialize_support(
temp_mt_entry,
mt_entry,
&IMFS_ops_no_evalformake,
&IMFS_memfile_handlers,
&IMFS_directory_handlers
@@ -130,11 +132,12 @@ int no_evalformake_IMFS_initialize(
}
int no_rename_IMFS_initialize(
rtems_filesystem_mount_table_entry_t *temp_mt_entry
rtems_filesystem_mount_table_entry_t *mt_entry,
const void *data
)
{
return IMFS_initialize_support(
temp_mt_entry,
mt_entry,
&IMFS_ops_no_rename,
&IMFS_memfile_handlers,
&IMFS_directory_handlers
@@ -170,7 +173,6 @@ int main(
time_t ctime2;
rtems_status_code rtems_status;
rtems_time_of_day time;
rtems_filesystem_mount_table_entry_t *mt_entry;
IMFS_ops_no_evalformake = IMFS_ops;
IMFS_ops_no_rename = IMFS_ops;
@@ -181,7 +183,14 @@ int main(
IMFS_ops_no_rename.fsmount_me_h = no_rename_IMFS_initialize;
IMFS_ops_no_rename.rename_h = NULL;
puts( "register no eval-for-make filesystem" );
status = rtems_filesystem_register( "nefm", no_evalformake_IMFS_initialize );
rtems_test_assert( status == 0 );
puts( "register no rename filesystem" );
status = rtems_filesystem_register( "nren", no_rename_IMFS_initialize );
rtems_test_assert( status == 0 );
printf( "\n\n*** FILE TEST 1 ***\n" );
/*
@@ -418,11 +427,8 @@ since new path is not valid");
rtems_test_assert(status == 0);
puts("mounting filesystem with IMFS_ops at /imfs");
status = mount(&mt_entry, &IMFS_ops,
RTEMS_FILESYSTEM_READ_WRITE,
NULL, "/imfs");
status = mount("null", "/imfs", "imfs", RTEMS_FILESYSTEM_READ_WRITE, NULL);
rtems_test_assert(status == 0);
rtems_test_assert(mt_entry != NULL);
puts("creating directory /imfs/test (on newly mounted filesystem)");
status = mkdir("/imfs/test", 0777);
rtems_test_assert(status == 0);
@@ -448,11 +454,8 @@ since new path is not valid");
puts("Mounting filesystem @ /imfs with no support for evalformake");
status = mount(&mt_entry, &IMFS_ops_no_evalformake,
RTEMS_FILESYSTEM_READ_WRITE,
NULL, "/imfs");
status = mount("null", "/imfs", "nefm", RTEMS_FILESYSTEM_READ_WRITE, NULL);
rtems_test_assert(status == 0);
rtems_test_assert(mt_entry != NULL);
puts("change directory to /imfs");
status = chdir("/imfs");
@@ -473,11 +476,8 @@ since new path is not valid");
puts("Mounting filesystem @ /imfs with no support for rename");
status = mount(&mt_entry, &IMFS_ops_no_rename,
RTEMS_FILESYSTEM_READ_WRITE,
NULL, "/imfs");
status = mount("null", "/imfs", "nren", RTEMS_FILESYSTEM_READ_WRITE, NULL);
rtems_test_assert(status == 0);
rtems_test_assert(mt_entry != NULL);
puts("creating directory /imfs/test");
status = mkdir("/imfs/test", 0777);
+40 -52
View File
@@ -35,7 +35,6 @@
#include <errno.h>
#include <rtems.h>
#include <rtems/libio.h>
#include <rtems/imfs.h>
#include <pmacros.h>
extern rtems_filesystem_location_info_t rtems_filesystem_current;
@@ -96,7 +95,6 @@ int main(
int fd;
int status;
struct stat statbuf;
rtems_filesystem_mount_table_entry_t *mt_entry;
static char mount_point_string[25] = { "/c/z/my_mount_point" };
@@ -157,18 +155,13 @@ int main(
printf("Attempting to mount IMFS file system at /c/z/my_mount_point \n");
status = mount(
&mt_entry,
&IMFS_ops,
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
mount_point_string );
"null",
mount_point_string,
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == 0 );
if( mt_entry == NULL ){
printf(" NULL mount table entry was returned\n");
}
else {
printf("2nd file system successfully mounted at /c/z/my_mount_point \n");
}
printf("2nd file system successfully mounted at /c/z/my_mount_point \n");
/*
* Change directory to the mount point and create a group of files under
@@ -218,11 +211,11 @@ int main(
printf("Mount a NULL file system and verify EINVAL\n");
status = mount(
&mt_entry,
NULL,
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
mount_point_string );
"null",
mount_point_string,
"nofound",
RTEMS_FILESYSTEM_READ_WRITE,
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EINVAL );
@@ -232,11 +225,11 @@ int main(
printf("mount with option of -62 should fail with EINVAL\n");
status = mount(
&mt_entry,
&IMFS_ops,
-62,
NULL,
"/c/y/my_mount_point" );
"null",
"/c/y/my_mount_point",
"imfs",
-62,
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EINVAL );
@@ -246,18 +239,13 @@ int main(
printf("Mount a Read Only filesystem at /c/y/my_mount_point \n");
status = mount(
&mt_entry,
&IMFS_ops,
RTEMS_FILESYSTEM_READ_ONLY,
NULL,
"/c/y/my_mount_point" );
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
NULL );
rtems_test_assert( status == 0 );
if( mt_entry == NULL ){
printf(" NULL mount table entry was returned\n");
}
else {
printf("Read only file system successfully mounted at /c/y/my_mount_point \n");
}
printf("Read only file system successfully mounted at /c/y/my_mount_point \n");
/*
* Create a directory that passes through the read only file system.
@@ -277,11 +265,11 @@ int main(
printf("Verify a mount point returns EBUSY for another mount\n");
status = mount(
&mt_entry,
&IMFS_ops,
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
NULL,
"/c/y/my_mount_point" );
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == EBUSY);
@@ -291,11 +279,11 @@ int main(
printf("Mount on a file should fail with ENOTDIR\n");
status = mount(
&mt_entry,
&IMFS_ops,
RTEMS_FILESYSTEM_READ_ONLY,
NULL,
"/b/my_file" );
"null",
"/b/my_file",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
NULL );
rtems_test_assert( status == -1 );
rtems_test_assert( errno == ENOTDIR );
@@ -343,11 +331,11 @@ int main(
printf("Mount /c/y/my_mount_point\n");
status = mount(
&mt_entry,
&IMFS_ops,
RTEMS_FILESYSTEM_READ_ONLY,
NULL,
"/c/y/my_mount_point" );
"null",
"/c/y/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_ONLY,
NULL );
rtems_test_assert( status == 0 );
/*
@@ -392,11 +380,11 @@ int main(
printf("Mount a file system at /c/y/my_mount_point/my_dir\n");
status = mount(
&mt_entry,
&IMFS_ops,
"null",
"/c/y/my_mount_point/my_dir",
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
"/c/y/my_mount_point/my_dir");
NULL );
rtems_test_assert( status == 0 );
printf("unmount /c/y/my_mount_point should fail with EBUSY\n");
+5 -9
View File
@@ -183,8 +183,7 @@ int compare_descending( const struct dirent **a, const struct dirent **b )
void test_across_mount(void)
{
rtems_filesystem_mount_table_entry_t *mt_entry;
int status;
int status;
/*
* Verify Readdir works correctly over mount points.
@@ -196,15 +195,12 @@ void test_across_mount(void)
complete_printdir("/imfs" );
printf("Attempting to mount IMFS file system at /imfs \n");
status = mount(
&mt_entry,
&IMFS_ops,
"null",
"/imfs",
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
"/imfs" );
NULL );
rtems_test_assert( status == 0 );
if( mt_entry == NULL ){
printf(" NULL mount table entry was returned\n");
}
printf( "create /imfs/testdir and /imfs/testdir/testsubdir\n");
status = mkdir( "/imfs/testdir", 0777 );
+10 -12
View File
@@ -468,7 +468,6 @@ void Cause_faults(void)
int fd;
int status;
char longer_name[100];
rtems_filesystem_mount_table_entry_t *mt_entry;
/*
* Verify chmod with an invalid type.
@@ -650,11 +649,11 @@ void Cause_faults(void)
printf("Attempting to mount IMFS file system at /dir1/my_mount_point \n");
status = mount(
&mt_entry,
&IMFS_ops,
"null",
"/my_mount_point/dir1/my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
"/my_mount_point/dir1/my_mount_point" );
NULL );
rtems_test_assert( status == 0 );
printf("rmdir /dir1/my_mount_point should fail with EBUSY\n");
@@ -730,9 +729,8 @@ int main(
)
#endif
{
rtems_status_code status;
rtems_time_of_day time;
rtems_filesystem_mount_table_entry_t *mt_entry;
rtems_status_code status;
rtems_time_of_day time;
puts( "\n\n*** STAT TEST 01 ***" );
@@ -749,11 +747,11 @@ int main(
status = mkdir("/my_mount_point", S_IRWXU );
rtems_test_assert( status == 0 );
status = mount(
&mt_entry,
&IMFS_ops,
"null",
"my_mount_point",
"imfs",
RTEMS_FILESYSTEM_READ_WRITE,
NULL,
"my_mount_point" );
NULL );
rtems_test_assert( status == 0 );
status = chdir( "/my_mount_point" );
rtems_test_assert( status == 0 );