Changeset 98e5c95 in rtems


Ignore:
Timestamp:
Dec 11, 2013, 8:39:09 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
ce8363d3
Parents:
0b599421
Message:

PR2160: imfs: Use ENOSYS for unsupported nodes

Return an error status with errno set to ENOSYS during node creation for
nodes not available in the current configuration.

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/imfs.h

    r0b599421 r98e5c95  
    381381extern const IMFS_node_control IMFS_node_control_linfile;
    382382extern const IMFS_node_control IMFS_node_control_fifo;
    383 extern const IMFS_node_control IMFS_node_control_default;
     383extern const IMFS_node_control IMFS_node_control_enosys;
    384384
    385385extern const rtems_filesystem_operations_table miniIMFS_ops;
  • cpukit/libfs/src/imfs/imfs_init.c

    r0b599421 r98e5c95  
    5454  [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    5555  [IMFS_LINEAR_FILE] = &IMFS_node_control_linfile,
    56   [IMFS_FIFO] = &IMFS_node_control_fifo
     56  [IMFS_FIFO] = &IMFS_node_control_enosys
    5757};
    5858
  • cpukit/libfs/src/imfs/imfs_initsupp.c

    r0b599421 r98e5c95  
    2121#include "imfs.h"
    2222
     23#include <errno.h>
    2324#include <stdlib.h>
    2425#include <string.h>
     
    140141}
    141142
     143static IMFS_jnode_t *IMFS_node_initialize_enosys(
     144  IMFS_jnode_t *node,
     145  const IMFS_types_union *info
     146)
     147{
     148  errno = ENOSYS;
     149
     150  return NULL;
     151}
     152
    142153IMFS_jnode_t *IMFS_node_initialize_default(
    143154  IMFS_jnode_t *node,
     
    160171}
    161172
    162 const IMFS_node_control IMFS_node_control_default = {
     173const IMFS_node_control IMFS_node_control_enosys = {
    163174  .imfs_type = IMFS_INVALID_NODE,
    164175  .handlers = &rtems_filesystem_handlers_default,
    165   .node_initialize = IMFS_node_initialize_default,
     176  .node_initialize = IMFS_node_initialize_enosys,
    166177  .node_remove = IMFS_node_remove_default,
    167178  .node_destroy = IMFS_node_destroy_default
  • cpukit/libfs/src/imfs/miniimfs_init.c

    r0b599421 r98e5c95  
    5050  [IMFS_DIRECTORY] = &IMFS_node_control_directory,
    5151  [IMFS_DEVICE] = &IMFS_node_control_device,
    52   [IMFS_HARD_LINK] = &IMFS_node_control_default,
    53   [IMFS_SYM_LINK] = &IMFS_node_control_default,
     52  [IMFS_HARD_LINK] = &IMFS_node_control_enosys,
     53  [IMFS_SYM_LINK] = &IMFS_node_control_enosys,
    5454  [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    5555  [IMFS_LINEAR_FILE] = &IMFS_node_control_linfile,
    56   [IMFS_FIFO] = &IMFS_node_control_default
     56  [IMFS_FIFO] = &IMFS_node_control_enosys
    5757};
    5858
  • testsuites/sptests/spfifo01/init.c

    r0b599421 r98e5c95  
    3939    "Must result in failure since pipes are disabled in the configuration."
    4040  );
     41
     42  errno = 0;
    4143  status = mkfifo(FIFO_PATH, 0777);
    42   rtems_test_assert(status == 0);
    43 
    44   fd = open(FIFO_PATH, O_RDWR);
    45   rtems_test_assert(fd >= 0);
    46 
    47   n = read(fd, buf, sizeof(buf));
    48   rtems_test_assert(n == -1);
    49   rtems_test_assert(errno == ENOTSUP);
    50 
    51   n = write(fd, buf, sizeof(buf));
    52   rtems_test_assert(n == -1);
    53   rtems_test_assert(errno == ENOTSUP);
    54 
    55   status = close(fd);
    56   rtems_test_assert(status == 0);
     44  rtems_test_assert(status == -1);
     45  rtems_test_assert(errno == ENOSYS);
    5746
    5847  puts("*** END OF FIFO / PIPE OPEN TEST - 1 ***");
Note: See TracChangeset for help on using the changeset viewer.