File indexing completed on 2025-05-11 08:24:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 #ifdef HAVE_CONFIG_H
0029 #include "config.h"
0030 #endif
0031
0032 #include "tmacros.h"
0033
0034 #include <sys/stat.h>
0035 #include <errno.h>
0036 #include <fcntl.h>
0037 #include <stdio.h>
0038 #include <unistd.h>
0039 #include <utime.h>
0040
0041 #include <rtems/imfs.h>
0042 #include <rtems/libio.h>
0043
0044 const char rtems_test_name[] = "FSIMFSCONFIG 3";
0045
0046 static const IMFS_node_control node_control = IMFS_GENERIC_INITIALIZER(
0047 &rtems_filesystem_handlers_default,
0048 IMFS_node_initialize_generic,
0049 IMFS_node_destroy_default
0050 );
0051
0052 static void Init(rtems_task_argument arg)
0053 {
0054 const struct utimbuf times = {0};
0055 const char *generic = "generic";
0056 const char *mnt = "mnt";
0057 const char *dev = "device";
0058 const char *file = "file";
0059 const char *fifo = "fifo";
0060 int rv;
0061 int fd;
0062
0063 TEST_BEGIN();
0064
0065 rv = IMFS_make_generic_node(
0066 generic,
0067 S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
0068 &node_control,
0069 NULL
0070 );
0071 rtems_test_assert(rv == 0);
0072
0073 errno = 0;
0074 rv = chown(generic, 0, 0);
0075 rtems_test_assert(rv == -1);
0076 rtems_test_assert(errno == ENOTSUP);
0077
0078 errno = 0;
0079 rv = chmod(generic, 0);
0080 rtems_test_assert(rv == -1);
0081 rtems_test_assert(errno == ENOTSUP);
0082
0083 errno = 0;
0084 rv = link(generic, "link");
0085 rtems_test_assert(rv == -1);
0086 rtems_test_assert(errno == ENOTSUP);
0087
0088 rv = mkdir(mnt, S_IRWXU);
0089 rtems_test_assert(rv == 0);
0090
0091 rv = mknod(dev, S_IFCHR | S_IRWXU, 0);
0092 rtems_test_assert(rv == 0);
0093
0094 fd = creat(file, S_IRWXU);
0095 rtems_test_assert(fd == 0);
0096
0097 rv = close(fd);
0098 rtems_test_assert(rv == 0);
0099
0100 errno = 0;
0101 rv = mkfifo(fifo, S_IRWXU);
0102 rtems_test_assert(rv == -1);
0103 rtems_test_assert(errno == ENOSYS);
0104
0105 rv = mount(
0106 "",
0107 mnt,
0108 RTEMS_FILESYSTEM_TYPE_IMFS,
0109 RTEMS_FILESYSTEM_READ_ONLY,
0110 NULL
0111 );
0112 rtems_test_assert(rv == 0);
0113
0114 errno = 0;
0115 rv = unmount(mnt);
0116 rtems_test_assert(rv == -1);
0117 rtems_test_assert(errno == ENOTSUP);
0118
0119 errno = 0;
0120 rv = rename(generic, "new");
0121 rtems_test_assert(rv == -1);
0122 rtems_test_assert(errno == ENOTSUP);
0123
0124 errno = 0;
0125 rv = symlink(generic, "link");
0126 rtems_test_assert(rv == -1);
0127 rtems_test_assert(errno == ENOTSUP);
0128
0129 errno = 0;
0130 rv = utime(generic, ×);
0131 rtems_test_assert(rv == -1);
0132 rtems_test_assert(errno == ENOTSUP);
0133
0134 rv = unlink(generic);
0135 rtems_test_assert(rv == 0);
0136
0137 TEST_END();
0138 rtems_test_exit(0);
0139 }
0140
0141 #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
0142
0143 #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 1
0144
0145 #define CONFIGURE_FILESYSTEM_IMFS
0146
0147 #define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
0148
0149 #define CONFIGURE_MAXIMUM_TASKS 1
0150
0151 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
0152
0153 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0154
0155 #define CONFIGURE_INIT
0156
0157 #include <rtems/confdefs.h>