IMFS: CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM

Resurrect CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.
This commit is contained in:
Sebastian Huber
2015-02-13 20:53:41 +01:00
parent 50f8bfdb14
commit 12eee4fdb5
9 changed files with 263 additions and 16 deletions
+11
View File
@@ -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
*/
+47 -11
View File
@@ -2676,10 +2676,46 @@ infrastructure necessary to support @code{printf()}.
@subheading NOTES:
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
+1
View File
@@ -1,6 +1,7 @@
ACLOCAL_AMFLAGS = -I ../aclocal
_SUBDIRS =
_SUBDIRS += fsimfsconfig03
_SUBDIRS += fsimfsconfig02
_SUBDIRS += fsimfsconfig01
_SUBDIRS += fsdosfsname01
+1
View File
@@ -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
+26 -5
View File
@@ -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(
"",
@@ -86,11 +105,6 @@ static void Init(rtems_task_argument arg)
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
rv = unlink(generic);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
rv = symlink(generic, "link");
rtems_test_assert(rv == -1);
@@ -101,6 +115,11 @@ static void Init(rtems_task_argument arg)
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
errno = 0;
rv = unlink(generic);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOTSUP);
TEST_END();
rtems_test_exit(0);
}
@@ -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
@@ -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
@@ -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.
@@ -0,0 +1,2 @@
*** BEGIN OF TEST FSIMFSCONFIG 3 ***
*** END OF TEST FSIMFSCONFIG 3 ***
+145
View File
@@ -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>