Changeset 24ec25d in rtems


Ignore:
Timestamp:
Feb 5, 2015, 3:14:59 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
e4d35d8
Parents:
194eb007
git-author:
Sebastian Huber <sebastian.huber@…> (02/05/15 15:14:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/12/15 19:53:34)
Message:

IMFS: Introduce IMFS_mknod_control

Drop IMFS_node_control::node_size field and add node_size parameter to
IMFS_allocate_node() and IMFS_create_node(). This reduces the size of
generic nodes.

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libfs/src/imfs/fifoimfs_init.c

    r194eb007 r24ec25d  
    4848};
    4949
    50 static const IMFS_node_control *const
    51   IMFS_fifo_node_controls [IMFS_TYPE_COUNT] = {
    52   [IMFS_DIRECTORY] = &IMFS_node_control_directory,
    53   [IMFS_DEVICE] = &IMFS_node_control_device,
    54   [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    55   [IMFS_FIFO] = &IMFS_node_control_fifo
     50static const IMFS_mknod_control *const
     51  IMFS_fifo_mknod_controls[IMFS_TYPE_COUNT] = {
     52  [IMFS_DIRECTORY] = &IMFS_mknod_control_directory,
     53  [IMFS_DEVICE] = &IMFS_mknod_control_device,
     54  [IMFS_MEMORY_FILE] = &IMFS_mknod_control_memfile,
     55  [IMFS_FIFO] = &IMFS_mknod_control_fifo
    5656};
    5757
     
    6464    mt_entry,
    6565    &fifoIMFS_ops,
    66     IMFS_fifo_node_controls
     66    IMFS_fifo_mknod_controls
    6767  );
    6868}
  • cpukit/libfs/src/imfs/imfs.h

    r194eb007 r24ec25d  
    215215typedef struct {
    216216  const rtems_filesystem_file_handlers_r *handlers;
    217   size_t node_size;
    218217  IMFS_node_control_initialize node_initialize;
    219218  IMFS_node_control_remove node_remove;
    220219  IMFS_node_control_destroy node_destroy;
    221220} IMFS_node_control;
     221
     222typedef struct {
     223  IMFS_node_control node_control;
     224  size_t node_size;
     225} IMFS_mknod_control;
    222226
    223227/** @} */
     
    372376
    373377typedef struct {
    374   const IMFS_node_control *node_controls [IMFS_TYPE_COUNT];
     378  const IMFS_mknod_control *mknod_controls[ IMFS_TYPE_COUNT ];
    375379} IMFS_fs_info_t;
    376380
     
    379383 */
    380384
    381 extern const IMFS_node_control IMFS_node_control_directory;
    382 extern const IMFS_node_control IMFS_node_control_device;
    383 extern const IMFS_node_control IMFS_node_control_memfile;
     385extern const IMFS_mknod_control IMFS_mknod_control_directory;
     386extern const IMFS_mknod_control IMFS_mknod_control_device;
     387extern const IMFS_mknod_control IMFS_mknod_control_memfile;
    384388extern const IMFS_node_control IMFS_node_control_linfile;
    385 extern const IMFS_node_control IMFS_node_control_fifo;
    386 extern const IMFS_node_control IMFS_node_control_enosys;
     389extern const IMFS_mknod_control IMFS_mknod_control_fifo;
     390extern const IMFS_mknod_control IMFS_mknod_control_enosys;
    387391
    388392extern const rtems_filesystem_operations_table miniIMFS_ops;
     
    417421  rtems_filesystem_mount_table_entry_t *mt_entry,
    418422  const rtems_filesystem_operations_table *op_table,
    419   const IMFS_node_control *const node_controls [IMFS_TYPE_COUNT]
     423  const IMFS_mknod_control *const mknod_controls[ IMFS_TYPE_COUNT ]
    420424);
    421425/**
     
    560564 */
    561565extern IMFS_jnode_t *IMFS_allocate_node(
    562   IMFS_fs_info_t *fs_info,
    563566  const IMFS_node_control *node_control,
     567  size_t node_size,
    564568  const char *name,
    565569  size_t namelen,
     
    577581  const rtems_filesystem_location_info_t *parentloc,
    578582  const IMFS_node_control *node_control,
     583  size_t node_size,
    579584  const char *name,
    580585  size_t namelen,
     
    615620  { \
    616621    ( handlers ), \
    617     sizeof( IMFS_generic_t ), \
    618622    ( init ), \
    619623    IMFS_node_remove_default, \
  • cpukit/libfs/src/imfs/imfs_creat.c

    r194eb007 r24ec25d  
    2424
    2525IMFS_jnode_t *IMFS_allocate_node(
    26   IMFS_fs_info_t *fs_info,
    2726  const IMFS_node_control *node_control,
     27  size_t node_size,
    2828  const char *name,
    2929  size_t namelen,
     
    4747   *  Allocate an IMFS jnode
    4848   */
    49   node = calloc( 1, node_control->node_size );
     49  node = calloc( 1, node_size );
    5050  if ( !node ) {
    5151    errno = ENOMEM;
     
    8989  const rtems_filesystem_location_info_t *parentloc,
    9090  const IMFS_node_control *node_control,
     91  size_t node_size,
    9192  const char *name,
    9293  size_t namelen,
     
    9596)
    9697{
    97   IMFS_fs_info_t *fs_info = parentloc->mt_entry->fs_info;
    9898  IMFS_jnode_t *node = IMFS_allocate_node(
    99     fs_info,
    10099    node_control,
     100    node_size,
    101101    name,
    102102    namelen,
  • cpukit/libfs/src/imfs/imfs_fifo.c

    r194eb007 r24ec25d  
    131131};
    132132
    133 const IMFS_node_control IMFS_node_control_fifo = {
    134   .handlers = &IMFS_fifo_handlers,
    135   .node_size = sizeof(IMFS_fifo_t),
    136   .node_initialize = IMFS_node_initialize_default,
    137   .node_remove = IMFS_node_remove_default,
    138   .node_destroy = IMFS_node_destroy_default
     133const IMFS_mknod_control IMFS_mknod_control_fifo = {
     134  {
     135    .handlers = &IMFS_fifo_handlers,
     136    .node_initialize = IMFS_node_initialize_default,
     137    .node_remove = IMFS_node_remove_default,
     138    .node_destroy = IMFS_node_destroy_default
     139  },
     140  .node_size = sizeof( IMFS_fifo_t )
    139141};
  • cpukit/libfs/src/imfs/imfs_handlers_device.c

    r194eb007 r24ec25d  
    6464}
    6565
    66 const IMFS_node_control IMFS_node_control_device = {
    67   .handlers = &IMFS_device_handlers,
    68   .node_size = sizeof(IMFS_device_t),
    69   .node_initialize = IMFS_node_initialize_device,
    70   .node_remove = IMFS_node_remove_default,
    71   .node_destroy = IMFS_node_destroy_default
     66const IMFS_mknod_control IMFS_mknod_control_device = {
     67  {
     68    .handlers = &IMFS_device_handlers,
     69    .node_initialize = IMFS_node_initialize_device,
     70    .node_remove = IMFS_node_remove_default,
     71    .node_destroy = IMFS_node_destroy_default
     72  },
     73  .node_size = sizeof( IMFS_device_t )
    7274};
  • cpukit/libfs/src/imfs/imfs_handlers_directory.c

    r194eb007 r24ec25d  
    103103}
    104104
    105 const IMFS_node_control IMFS_node_control_directory = {
    106   .handlers = &IMFS_directory_handlers,
    107   .node_size = sizeof(IMFS_directory_t),
    108   .node_initialize = IMFS_node_initialize_directory,
    109   .node_remove = IMFS_node_remove_directory,
    110   .node_destroy = IMFS_node_destroy_default
     105const IMFS_mknod_control IMFS_mknod_control_directory = {
     106  {
     107    .handlers = &IMFS_directory_handlers,
     108    .node_initialize = IMFS_node_initialize_directory,
     109    .node_remove = IMFS_node_remove_directory,
     110    .node_destroy = IMFS_node_destroy_default
     111  },
     112  .node_size = sizeof( IMFS_directory_t )
    111113};
  • cpukit/libfs/src/imfs/imfs_handlers_memfile.c

    r194eb007 r24ec25d  
    7070};
    7171
    72 const IMFS_node_control IMFS_node_control_memfile = {
    73   .handlers = &IMFS_memfile_handlers,
    74   .node_size = sizeof(IMFS_file_t),
    75   .node_initialize = IMFS_node_initialize_default,
    76   .node_remove = IMFS_node_remove_default,
    77   .node_destroy = IMFS_memfile_remove
     72const IMFS_mknod_control IMFS_mknod_control_memfile = {
     73  {
     74    .handlers = &IMFS_memfile_handlers,
     75    .node_initialize = IMFS_node_initialize_default,
     76    .node_remove = IMFS_node_remove_default,
     77    .node_destroy = IMFS_memfile_remove
     78  },
     79  .node_size = sizeof( IMFS_file_t )
    7880};
    7981
    8082const IMFS_node_control IMFS_node_control_linfile = {
    8183  .handlers = &IMFS_linfile_handlers,
    82   .node_size = sizeof(IMFS_file_t),
    8384  .node_initialize = IMFS_node_initialize_default,
    8485  .node_remove = IMFS_node_remove_default,
  • cpukit/libfs/src/imfs/imfs_init.c

    r194eb007 r24ec25d  
    4444};
    4545
    46 static const IMFS_node_control *const
    47   IMFS_node_controls [IMFS_TYPE_COUNT] = {
    48   [IMFS_DIRECTORY] = &IMFS_node_control_directory,
    49   [IMFS_DEVICE] = &IMFS_node_control_device,
    50   [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    51   [IMFS_FIFO] = &IMFS_node_control_enosys
     46static const IMFS_mknod_control *const
     47  IMFS_mknod_controls[ IMFS_TYPE_COUNT ] = {
     48  [IMFS_DIRECTORY] = &IMFS_mknod_control_directory,
     49  [IMFS_DEVICE] = &IMFS_mknod_control_device,
     50  [IMFS_MEMORY_FILE] = &IMFS_mknod_control_memfile,
     51  [IMFS_FIFO] = &IMFS_mknod_control_enosys
    5252};
    5353
     
    6060    mt_entry,
    6161    &IMFS_ops,
    62     IMFS_node_controls
     62    IMFS_mknod_controls
    6363  );
    6464}
  • cpukit/libfs/src/imfs/imfs_initsupp.c

    r194eb007 r24ec25d  
    5959  rtems_filesystem_mount_table_entry_t *mt_entry,
    6060  const rtems_filesystem_operations_table *op_table,
    61   const IMFS_node_control *const node_controls [IMFS_TYPE_COUNT]
     61  const IMFS_mknod_control *const mknod_controls[ IMFS_TYPE_COUNT ]
    6262)
    6363{
     
    6969
    7070    memcpy(
    71       fs_info->node_controls,
    72       node_controls,
    73       sizeof( fs_info->node_controls )
     71      fs_info->mknod_controls,
     72      mknod_controls,
     73      sizeof( fs_info->mknod_controls )
    7474    );
    7575
    7676    root_node = IMFS_allocate_node(
    77       fs_info,
    78       fs_info->node_controls [IMFS_DIRECTORY],
     77      &fs_info->mknod_controls[ IMFS_DIRECTORY ]->node_control,
     78      fs_info->mknod_controls[ IMFS_DIRECTORY ]->node_size,
    7979      "",
    8080      0,
     
    166166}
    167167
    168 const IMFS_node_control IMFS_node_control_enosys = {
    169   .handlers = &rtems_filesystem_handlers_default,
    170   .node_size = sizeof(IMFS_jnode_t),
    171   .node_initialize = IMFS_node_initialize_enosys,
    172   .node_remove = IMFS_node_remove_default,
    173   .node_destroy = IMFS_node_destroy_default
     168const IMFS_mknod_control IMFS_mknod_control_enosys = {
     169  {
     170    .handlers = &rtems_filesystem_handlers_default,
     171    .node_initialize = IMFS_node_initialize_enosys,
     172    .node_remove = IMFS_node_remove_default,
     173    .node_destroy = IMFS_node_destroy_default
     174  },
     175  .node_size = sizeof( IMFS_jnode_t )
    174176};
  • cpukit/libfs/src/imfs/imfs_link.c

    r194eb007 r24ec25d  
    4747    parentloc,
    4848    &IMFS_node_control_hard_link,
     49    sizeof( IMFS_link_t ),
    4950    name,
    5051    namelen,
     
    134135static const IMFS_node_control IMFS_node_control_hard_link = {
    135136  .handlers = &IMFS_link_handlers,
    136   .node_size = sizeof(IMFS_link_t),
    137137  .node_initialize = IMFS_node_initialize_hard_link,
    138138  .node_remove = IMFS_node_remove_hard_link,
  • cpukit/libfs/src/imfs/imfs_load_tar.c

    r194eb007 r24ec25d  
    127127            currentloc,
    128128            &IMFS_node_control_linfile,
     129            sizeof( IMFS_file_t ),
    129130            rtems_filesystem_eval_path_get_token( &ctx ),
    130131            rtems_filesystem_eval_path_get_tokenlen( &ctx ),
  • cpukit/libfs/src/imfs/imfs_make_generic_node.c

    r194eb007 r24ec25d  
    8686        currentloc,
    8787        node_control,
     88        sizeof( IMFS_generic_t ),
    8889        rtems_filesystem_eval_path_get_token( &ctx ),
    8990        rtems_filesystem_eval_path_get_tokenlen( &ctx ),
  • cpukit/libfs/src/imfs/imfs_mknod.c

    r194eb007 r24ec25d  
    4848  int rv = 0;
    4949  const IMFS_fs_info_t *fs_info = parentloc->mt_entry->fs_info;
     50  const IMFS_mknod_control *mknod_control =
     51    fs_info->mknod_controls[ get_type( mode ) ];
    5052  IMFS_jnode_t *new_node;
    5153
    5254  new_node = IMFS_create_node(
    5355    parentloc,
    54     fs_info->node_controls[ get_type( mode ) ],
     56    &mknod_control->node_control,
     57    mknod_control->node_size,
    5558    name,
    5659    namelen,
  • cpukit/libfs/src/imfs/imfs_symlink.c

    r194eb007 r24ec25d  
    5050    parentloc,
    5151    &IMFS_node_control_sym_link,
     52    sizeof( IMFS_sym_link_t ),
    5253    name,
    5354    namelen,
     
    134135static const IMFS_node_control IMFS_node_control_sym_link = {
    135136  .handlers = &IMFS_link_handlers,
    136   .node_size = sizeof(IMFS_sym_link_t),
    137137  .node_initialize = IMFS_node_initialize_sym_link,
    138138  .node_remove = IMFS_node_remove_default,
  • cpukit/libfs/src/imfs/memfile.c

    r194eb007 r24ec25d  
    8989    const unsigned char *buffer = file->Linearfile.direct;
    9090
    91     file->Node.control            = &IMFS_node_control_memfile;
     91    file->Node.control            = &IMFS_mknod_control_memfile.node_control;
    9292    file->File.size               = 0;
    9393    file->Memfile.indirect        = 0;
  • cpukit/libfs/src/imfs/miniimfs_init.c

    r194eb007 r24ec25d  
    4444};
    4545
    46 static const IMFS_node_control *const
    47   IMFS_mini_node_controls [IMFS_TYPE_COUNT] = {
    48   [IMFS_DIRECTORY] = &IMFS_node_control_directory,
    49   [IMFS_DEVICE] = &IMFS_node_control_device,
    50   [IMFS_MEMORY_FILE] = &IMFS_node_control_memfile,
    51   [IMFS_FIFO] = &IMFS_node_control_enosys
     46static const IMFS_mknod_control *const
     47  IMFS_mini_mknod_controls[ IMFS_TYPE_COUNT ] = {
     48  [IMFS_DIRECTORY] = &IMFS_mknod_control_directory,
     49  [IMFS_DEVICE] = &IMFS_mknod_control_device,
     50  [IMFS_MEMORY_FILE] = &IMFS_mknod_control_memfile,
     51  [IMFS_FIFO] = &IMFS_mknod_control_enosys
    5252};
    5353
     
    6060    mt_entry,
    6161    &miniIMFS_ops,
    62     IMFS_mini_node_controls
     62    IMFS_mini_mknod_controls
    6363  );
    6464}
  • testsuites/fstests/fsimfsgeneric01/init.c

    r194eb007 r24ec25d  
    299299static const IMFS_node_control node_control = {
    300300  .handlers = &node_handlers,
    301   .node_size = sizeof(IMFS_generic_t),
    302301  .node_initialize = node_initialize,
    303302  .node_remove = node_remove,
     
    393392static const IMFS_node_control node_initialization_error_control = {
    394393  .handlers = &node_handlers,
    395   .node_size = sizeof(IMFS_generic_t),
    396394  .node_initialize = node_initialize_error,
    397395  .node_remove = node_remove_inhibited,
Note: See TracChangeset for help on using the changeset viewer.