[rtems commit] IMFS: Do not check for unsupported types

Sebastian Huber sebh at rtems.org
Tue Mar 13 11:31:31 UTC 2012


Module:    rtems
Branch:    master
Commit:    e00cca9b74acb6ec67cc9696cd0a005aa3d991c3
Changeset: http://git.rtems.org/rtems/commit/?id=e00cca9b74acb6ec67cc9696cd0a005aa3d991c3

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Feb 21 15:52:55 2012 +0100

IMFS: Do not check for unsupported types

Allow creation of nodes with an unsupported type.  Later the usage of
such nodes will return an error status.

---

 cpukit/libfs/src/imfs/imfs_creat.c |   10 ----------
 testsuites/sptests/spfifo01/init.c |   24 +++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/cpukit/libfs/src/imfs/imfs_creat.c b/cpukit/libfs/src/imfs/imfs_creat.c
index 37e3ac0..4c030a2 100644
--- a/cpukit/libfs/src/imfs/imfs_creat.c
+++ b/cpukit/libfs/src/imfs/imfs_creat.c
@@ -45,16 +45,6 @@ IMFS_jnode_t *IMFS_create_node(
   fs_info = parent_loc->mt_entry->fs_info;
 
   /*
-   *  Reject creation of FIFOs if support is disabled.
-   */
-  if ( type == IMFS_FIFO &&
-       fs_info->fifo_handlers == &rtems_filesystem_handlers_default ) {
-    errno = ENOTSUP;
-
-    return NULL;
-  }
-
-  /*
    *  Allocate filesystem node and fill in basic information
    */
   node  = IMFS_allocate_node( type, name, namelen, mode );
diff --git a/testsuites/sptests/spfifo01/init.c b/testsuites/sptests/spfifo01/init.c
index dc5f975..71d2369 100644
--- a/testsuites/sptests/spfifo01/init.c
+++ b/testsuites/sptests/spfifo01/init.c
@@ -15,6 +15,9 @@
 
 #include <sys/stat.h>
 #include <stdio.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <unistd.h>
 
 #include "tmacros.h"
 
@@ -23,6 +26,9 @@
 static void test_main(void)
 {
   int status = -1;
+  int fd;
+  char buf [1];
+  ssize_t n;
 
   puts("\n\n*** FIFO / PIPE OPEN TEST - 1 ***");
 
@@ -32,7 +38,21 @@ static void test_main(void)
     "Must result in failure since pipes are disabled in the configuration."
   );
   status = mkfifo(FIFO_PATH, 0777);
-  rtems_test_assert(status == -1);
+  rtems_test_assert(status == 0);
+
+  fd = open(FIFO_PATH, O_RDWR);
+  rtems_test_assert(fd >= 0);
+
+  n = read(fd, buf, sizeof(buf));
+  rtems_test_assert(n == -1);
+  rtems_test_assert(errno == ENOTSUP);
+
+  n = write(fd, buf, sizeof(buf));
+  rtems_test_assert(n == -1);
+  rtems_test_assert(errno == ENOTSUP);
+
+  status = close(fd);
+  rtems_test_assert(status == 0);
 
   puts("*** END OF FIFO / PIPE OPEN TEST - 1 ***");
 }
@@ -48,6 +68,8 @@ rtems_task Init(rtems_task_argument not_used)
 
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
 #define CONFIGURE_MAXIMUM_TASKS 1
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE




More information about the vc mailing list