Changeset cf36b70 in rtems for testsuites/fstests


Ignore:
Timestamp:
Dec 31, 2014, 9:56:05 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
29fa241
Parents:
369328f0
git-author:
Sebastian Huber <sebastian.huber@…> (12/31/14 09:56:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (01/27/15 05:54:22)
Message:

IMFS: Replace node union with individual struct

This reduces the average node size.

Add and use IMFS_GENERIC_INITIALIZER().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/fstests/fsimfsgeneric01/init.c

    r369328f0 rcf36b70  
    263263static IMFS_jnode_t *node_initialize(
    264264  IMFS_jnode_t *node,
    265   const IMFS_types_union *info
     265  void *arg
    266266)
    267267{
    268268  test_state *state = NULL;
    269269
    270   node = IMFS_node_initialize_generic(node, info);
     270  node = IMFS_node_initialize_generic(node, arg);
    271271  state = IMFS_generic_get_context_by_node(node);
    272272
     
    287287}
    288288
    289 static IMFS_jnode_t *node_destroy(IMFS_jnode_t *node)
     289static void node_destroy(IMFS_jnode_t *node)
    290290{
    291291  test_state *state = IMFS_generic_get_context_by_node(node);
     
    294294  *state = TEST_DESTROYED;
    295295
    296   return node;
     296  IMFS_node_destroy_default(node);
    297297}
    298298
    299299static const IMFS_node_control node_control = {
    300   .imfs_type = IMFS_GENERIC,
    301300  .handlers = &node_handlers,
     301  .node_size = sizeof(IMFS_generic_t),
    302302  .node_initialize = node_initialize,
    303303  .node_remove = node_remove,
     
    371371static IMFS_jnode_t *node_initialize_error(
    372372  IMFS_jnode_t *node,
    373   const IMFS_types_union *info
     373  void *arg
    374374)
    375375{
     
    386386}
    387387
    388 static IMFS_jnode_t *node_destroy_inhibited(IMFS_jnode_t *node)
     388static void node_destroy_inhibited(IMFS_jnode_t *node)
    389389{
    390390  rtems_test_assert(false);
    391 
    392   return node;
    393 }
    394 
    395 static const IMFS_node_control node_invalid_control = {
    396   .imfs_type = IMFS_DIRECTORY,
     391}
     392
     393static const IMFS_node_control node_initialization_error_control = {
    397394  .handlers = &node_handlers,
    398   .node_initialize = node_initialize_error,
    399   .node_remove = node_remove_inhibited,
    400   .node_destroy = node_destroy_inhibited
    401 };
    402 
    403 static const IMFS_node_control node_initialization_error_control = {
    404   .imfs_type = IMFS_GENERIC,
    405   .handlers = &node_handlers,
     395  .node_size = sizeof(IMFS_generic_t),
    406396  .node_initialize = node_initialize_error,
    407397  .node_remove = node_remove_inhibited,
     
    425415  rv = IMFS_make_generic_node(
    426416    path,
    427     S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    428     &node_invalid_control,
    429     NULL
    430   );
    431   rtems_test_assert(rv == -1);
    432   rtems_test_assert(errno == EINVAL);
    433   rtems_test_assert(rtems_resource_snapshot_check(&before));
    434 
    435   errno = 0;
    436   rv = IMFS_make_generic_node(
    437     path,
    438417    S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO,
    439418    &node_control,
Note: See TracChangeset for help on using the changeset viewer.