summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-02-13 20:53:41 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-02-13 20:53:41 +0100
commit12eee4fdb5ff2b103d8f316509c590b3325e96a7 (patch)
treef7661a3377de980df55e436d8acea3f831ba5931
parent50f8bfdb14dc8277ae69735675c030ae458009c4 (diff)
downloadrtems-12eee4fdb5ff2b103d8f316509c590b3325e96a7.tar.bz2
IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
Resurrect CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.
-rw-r--r--cpukit/sapi/include/confdefs.h11
-rw-r--r--doc/user/conf.t58
-rw-r--r--testsuites/fstests/Makefile.am1
-rw-r--r--testsuites/fstests/configure.ac1
-rw-r--r--testsuites/fstests/fsimfsconfig01/init.c27
-rw-r--r--testsuites/fstests/fsimfsconfig03/Makefile.am19
-rw-r--r--testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc11
-rw-r--r--testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn2
-rw-r--r--testsuites/fstests/fsimfsconfig03/init.c145
9 files changed, 261 insertions, 14 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 6fb09512f6..0cf7228ed2 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -346,6 +346,17 @@ const rtems_libio_helper rtems_fs_init_helper =
#endif
#endif
+#ifdef CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+ #define CONFIGURE_IMFS_DISABLE_FCHMOD
+ #define CONFIGURE_IMFS_DISABLE_CHOWN
+ #define CONFIGURE_IMFS_DISABLE_UTIME
+ #define CONFIGURE_IMFS_DISABLE_LINK
+ #define CONFIGURE_IMFS_DISABLE_SYMLINK
+ #define CONFIGURE_IMFS_DISABLE_READLINK
+ #define CONFIGURE_IMFS_DISABLE_RENAME
+ #define CONFIGURE_IMFS_DISABLE_UNMOUNT
+#endif
+
/**
* DEVFS
*/
diff --git a/doc/user/conf.t b/doc/user/conf.t
index fd986e2362..138d322994 100644
--- a/doc/user/conf.t
+++ b/doc/user/conf.t
@@ -2677,9 +2677,45 @@ infrastructure necessary to support @code{printf()}.
None.
@c
+@c === CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM ===
+@c
+@subsection Use a Root IMFS with a Minimalistic Feature Set
+
+@findex CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+
+@table @b
+@item CONSTANT:
+@code{CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM}
+
+@item DATA TYPE:
+Boolean feature macro.
+
+@item RANGE:
+Defined or undefined.
+
+@item DEFAULT VALUE:
+This is not defined by default.
+
+@end table
+
+@subheading DESCRIPTION:
+In case this configuration option is defined, then the following configuration
+options will be defined as well
+@itemize @bullet
+@item @code{CONFIGURE_IMFS_DISABLE_FCHMOD},
+@item @code{CONFIGURE_IMFS_DISABLE_CHOWN},
+@item @code{CONFIGURE_IMFS_DISABLE_UTIME},
+@item @code{CONFIGURE_IMFS_DISABLE_LINK},
+@item @code{CONFIGURE_IMFS_DISABLE_SYMLINK},
+@item @code{CONFIGURE_IMFS_DISABLE_READLINK},
+@item @code{CONFIGURE_IMFS_DISABLE_RENAME}, and
+@item @code{CONFIGURE_IMFS_DISABLE_UNMOUNT}.
+@end itemize
+
+@c
@c === CONFIGURE_IMFS_DISABLE_CHOWN ===
@c
-@subsection Disable change owner support of root IMFS
+@subsection Disable Change Owner Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_CHOWN
@@ -2705,7 +2741,7 @@ owner is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_FCHMOD ===
@c
-@subsection Disable change mode support of root IMFS
+@subsection Disable Change Mode Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_FCHMOD
@@ -2731,7 +2767,7 @@ mode is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_UTIME ===
@c
-@subsection Disable change times support of root IMFS
+@subsection Disable Change Times Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_UTIME
@@ -2757,7 +2793,7 @@ is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_LINK ===
@c
-@subsection Disable create hard link support of root IMFS
+@subsection Disable Create Hard Link Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_LINK
@@ -2783,7 +2819,7 @@ links is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_SYMLINK ===
@c
-@subsection Disable create symbolic link support of root IMFS
+@subsection Disable Create Symbolic Link Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_SYMLINK
@@ -2809,7 +2845,7 @@ symbolic links is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_READLINK ===
@c
-@subsection Disable read symbolic link support of root IMFS
+@subsection Disable Read Symbolic Link Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_READLINK
@@ -2835,7 +2871,7 @@ links is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_RENAME ===
@c
-@subsection Disable rename support of root IMFS
+@subsection Disable Rename Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_RENAME
@@ -2861,7 +2897,7 @@ is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_MOUNT ===
@c
-@subsection Disable mount support of root IMFS
+@subsection Disable Mount Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_MOUNT
@@ -2887,7 +2923,7 @@ file systems is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_UNMOUNT ===
@c
-@subsection Disable unmount support of root IMFS
+@subsection Disable Unmount Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_UNMOUNT
@@ -2913,7 +2949,7 @@ systems is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_MKNOD ===
@c
-@subsection Disable make nodes support of root IMFS
+@subsection Disable Make Nodes Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_MKNOD
@@ -2939,7 +2975,7 @@ directories, devices, regular files and FIFOs is disabled in the root IMFS.
@c
@c === CONFIGURE_IMFS_DISABLE_RMNOD ===
@c
-@subsection Disable remove nodes support of root IMFS
+@subsection Disable Remove Nodes Support of Root IMFS
@findex CONFIGURE_IMFS_DISABLE_RMNOD
diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am
index 6b01b20184..4812c8a955 100644
--- a/testsuites/fstests/Makefile.am
+++ b/testsuites/fstests/Makefile.am
@@ -1,6 +1,7 @@
ACLOCAL_AMFLAGS = -I ../aclocal
_SUBDIRS =
+_SUBDIRS += fsimfsconfig03
_SUBDIRS += fsimfsconfig02
_SUBDIRS += fsimfsconfig01
_SUBDIRS += fsdosfsname01
diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac
index 87b8961746..78800b3a70 100644
--- a/testsuites/fstests/configure.ac
+++ b/testsuites/fstests/configure.ac
@@ -77,6 +77,7 @@ AC_CHECK_SIZEOF([blkcnt_t])
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
+fsimfsconfig03/Makefile
fsimfsconfig02/Makefile
fsimfsconfig01/Makefile
fsdosfsname01/Makefile
diff --git a/testsuites/fstests/fsimfsconfig01/init.c b/testsuites/fstests/fsimfsconfig01/init.c
index 3f842c0451..e14ca8d5d8 100644
--- a/testsuites/fstests/fsimfsconfig01/init.c
+++ b/testsuites/fstests/fsimfsconfig01/init.c
@@ -20,6 +20,7 @@
#include <sys/stat.h>
#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <utime.h>
@@ -40,7 +41,11 @@ static void Init(rtems_task_argument arg)
struct utimbuf times;
const char *generic = "generic";
const char *mnt = "mnt";
+ const char *dev = "device";
+ const char *file = "file";
+ const char *fifo = "fifo";
int rv;
+ int fd;
TEST_BEGIN();
@@ -70,6 +75,20 @@ static void Init(rtems_task_argument arg)
rv = mkdir(mnt, S_IRWXU);
rtems_test_assert(rv == 0);
+ rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
+ rtems_test_assert(rv == 0);
+
+ fd = creat(file, S_IRWXU);
+ rtems_test_assert(fd == 3);
+
+ rv = close(fd);
+ rtems_test_assert(rv == 0);
+
+ errno = 0;
+ rv = mkfifo(fifo, S_IRWXU);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOSYS);
+
errno = 0;
rv = mount(
"",
@@ -87,17 +106,17 @@ static void Init(rtems_task_argument arg)
rtems_test_assert(errno == ENOTSUP);
errno = 0;
- rv = unlink(generic);
+ rv = symlink(generic, "link");
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
- rv = symlink(generic, "link");
+ rv = utime(generic, &times);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
- rv = utime(generic, &times);
+ rv = unlink(generic);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
@@ -108,6 +127,8 @@ static void Init(rtems_task_argument arg)
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
#define CONFIGURE_FILESYSTEM_IMFS
#define CONFIGURE_IMFS_DISABLE_CHOWN
diff --git a/testsuites/fstests/fsimfsconfig03/Makefile.am b/testsuites/fstests/fsimfsconfig03/Makefile.am
new file mode 100644
index 0000000000..83a824cb58
--- /dev/null
+++ b/testsuites/fstests/fsimfsconfig03/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = fsimfsconfig03
+fsimfsconfig03_SOURCES = init.c
+
+dist_rtems_tests_DATA = fsimfsconfig03.scn fsimfsconfig03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(fsimfsconfig03_OBJECTS)
+LINK_LIBS = $(fsimfsconfig03_LDLIBS)
+
+fsimfsconfig03$(EXEEXT): $(fsimfsconfig03_OBJECTS) $(fsimfsconfig03_DEPENDENCIES)
+ @rm -f fsimfsconfig03$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc
new file mode 100644
index 0000000000..a7c2710093
--- /dev/null
+++ b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.doc
@@ -0,0 +1,11 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: fsimfsconfig03
+
+directives:
+
+ TBD
+
+concepts:
+
+ - Ensure that the IMFS configuration defines work.
diff --git a/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn
new file mode 100644
index 0000000000..5da52a7a0f
--- /dev/null
+++ b/testsuites/fstests/fsimfsconfig03/fsimfsconfig03.scn
@@ -0,0 +1,2 @@
+*** BEGIN OF TEST FSIMFSCONFIG 3 ***
+*** END OF TEST FSIMFSCONFIG 3 ***
diff --git a/testsuites/fstests/fsimfsconfig03/init.c b/testsuites/fstests/fsimfsconfig03/init.c
new file mode 100644
index 0000000000..7307e74c95
--- /dev/null
+++ b/testsuites/fstests/fsimfsconfig03/init.c
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <utime.h>
+
+#include <rtems/imfs.h>
+#include <rtems/libio.h>
+
+const char rtems_test_name[] = "FSIMFSCONFIG 3";
+
+static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
+ &rtems_filesystem_handlers_default,
+ IMFS_node_initialize_generic,
+ IMFS_node_destroy_default
+);
+
+static void Init(rtems_task_argument arg)
+{
+ struct utimbuf times;
+ const char *generic = "generic";
+ const char *mnt = "mnt";
+ const char *dev = "device";
+ const char *file = "file";
+ const char *fifo = "fifo";
+ int rv;
+ int fd;
+
+ TEST_BEGIN();
+
+ rv = IMFS_make_generic_node(
+ generic,
+ S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
+ &node_control,
+ NULL
+ );
+ rtems_test_assert(rv == 0);
+
+ errno = 0;
+ rv = chown(generic, 0, 0);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ errno = 0;
+ rv = chmod(generic, 0);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ errno = 0;
+ rv = link(generic, "link");
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ rv = mkdir(mnt, S_IRWXU);
+ rtems_test_assert(rv == 0);
+
+ rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
+ rtems_test_assert(rv == 0);
+
+ fd = creat(file, S_IRWXU);
+ rtems_test_assert(fd == 3);
+
+ rv = close(fd);
+ rtems_test_assert(rv == 0);
+
+ errno = 0;
+ rv = mkfifo(fifo, S_IRWXU);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOSYS);
+
+ rv = mount(
+ "",
+ mnt,
+ RTEMS_FILESYSTEM_TYPE_IMFS,
+ RTEMS_FILESYSTEM_READ_ONLY,
+ NULL
+ );
+ rtems_test_assert(rv == 0);
+
+ errno = 0;
+ rv = unmount(mnt);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ errno = 0;
+ rv = rename(generic, "new");
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ errno = 0;
+ rv = symlink(generic, "link");
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ errno = 0;
+ rv = utime(generic, &times);
+ rtems_test_assert(rv == -1);
+ rtems_test_assert(errno == ENOTSUP);
+
+ rv = unlink(generic);
+ rtems_test_assert(rv == 0);
+
+ TEST_END();
+ rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
+#define CONFIGURE_FILESYSTEM_IMFS
+
+#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>