[rtems commit] IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
Sebastian Huber
sebh at rtems.org
Fri Feb 13 20:50:35 UTC 2015
Module: rtems
Branch: master
Commit: 12eee4fdb5ff2b103d8f316509c590b3325e96a7
Changeset: http://git.rtems.org/rtems/commit/?id=12eee4fdb5ff2b103d8f316509c590b3325e96a7
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 13 20:53:41 2015 +0100
IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
Resurrect CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.
---
cpukit/sapi/include/confdefs.h | 11 ++
doc/user/conf.t | 58 +++++++--
testsuites/fstests/Makefile.am | 1 +
testsuites/fstests/configure.ac | 1 +
testsuites/fstests/fsimfsconfig01/init.c | 27 +++-
testsuites/fstests/fsimfsconfig03/Makefile.am | 19 +++
.../fstests/fsimfsconfig03/fsimfsconfig03.doc | 11 ++
.../fstests/fsimfsconfig03/fsimfsconfig03.scn | 2 +
testsuites/fstests/fsimfsconfig03/init.c | 145 +++++++++++++++++++++
9 files changed, 261 insertions(+), 14 deletions(-)
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 6fb0951..0cf7228 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 fd986e2..138d322 100644
--- a/doc/user/conf.t
+++ b/doc/user/conf.t
@@ -2677,9 +2677,45 @@ infrastructure necessary to support @code{printf()}.
None.
@c
+ at c === CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM ===
+ at c
+ at subsection Use a Root IMFS with a Minimalistic Feature Set
+
+ at findex CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
+
+ at table @b
+ at item CONSTANT:
+ at code{CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM}
+
+ at item DATA TYPE:
+Boolean feature macro.
+
+ at item RANGE:
+Defined or undefined.
+
+ at item DEFAULT VALUE:
+This is not defined by default.
+
+ at end table
+
+ at subheading DESCRIPTION:
+In case this configuration option is defined, then the following configuration
+options will be defined as well
+ at itemize @bullet
+ at item @code{CONFIGURE_IMFS_DISABLE_FCHMOD},
+ at item @code{CONFIGURE_IMFS_DISABLE_CHOWN},
+ at item @code{CONFIGURE_IMFS_DISABLE_UTIME},
+ at item @code{CONFIGURE_IMFS_DISABLE_LINK},
+ at item @code{CONFIGURE_IMFS_DISABLE_SYMLINK},
+ at item @code{CONFIGURE_IMFS_DISABLE_READLINK},
+ at item @code{CONFIGURE_IMFS_DISABLE_RENAME}, and
+ at item @code{CONFIGURE_IMFS_DISABLE_UNMOUNT}.
+ at end itemize
+
+ at c
@c === CONFIGURE_IMFS_DISABLE_CHOWN ===
@c
- at subsection Disable change owner support of root IMFS
+ at 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
- at subsection Disable change mode support of root IMFS
+ at 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
- at subsection Disable change times support of root IMFS
+ at 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
- at subsection Disable create hard link support of root IMFS
+ at 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
- at subsection Disable create symbolic link support of root IMFS
+ at 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
- at subsection Disable read symbolic link support of root IMFS
+ at 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
- at subsection Disable rename support of root IMFS
+ at 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
- at subsection Disable mount support of root IMFS
+ at 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
- at subsection Disable unmount support of root IMFS
+ at 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
- at subsection Disable make nodes support of root IMFS
+ at 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
- at subsection Disable remove nodes support of root IMFS
+ at 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 6b01b20..4812c8a 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 87b8961..78800b3 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 3f842c0..e14ca8d 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, ×);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
- rv = utime(generic, ×);
+ 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 0000000..83a824c
--- /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 at .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 0000000..a7c2710
--- /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 0000000..5da52a7
--- /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 0000000..7307e74
--- /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 at 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, ×);
+ 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>
More information about the vc
mailing list