Changeset 47c2327 in rtems


Ignore:
Timestamp:
Nov 30, 2009, 12:39:51 PM (9 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
f9925bc
Parents:
91182bc
Message:

documentation fixes
Avoid designated initializers for C++ compatibility
Fixed invalid state transition from FRESH to CACHED
Free memory in case of an error.

Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r91182bc r47c2327  
     12009-11-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * libblock/include/rtems/bdbuf.h: Documentation.
     4        * libblock/include/rtems/blkdev.h: Avoid designated initializers for
     5        C++ compatibility.
     6        * libblock/src/bdbuf.c: Fixed invalid state transition from FRESH to
     7        CACHED.
     8        * libblock/src/ide_part_table.c: Free memory in case of an error.
     9
    1102009-11-30      Sebastian Huber <sebastian.huber@embedded-brains.de>
    211
  • cpukit/libblock/include/rtems/bdbuf.h

    r91182bc r47c2327  
    8080 * @dot
    8181 * digraph state {
     82 *   size="16,8";
    8283 *   e [label="EMPTY",style="filled",fillcolor="aquamarine"];
    8384 *   f [label="FRESH",style="filled",fillcolor="seagreen"];
     
    160161
    161162/**
    162  * State of a buffer of the cache.
     163 * @brief State of a buffer of the cache.
     164 *
     165 * The state has several implications.  Depending on the state a buffer can be
     166 * in the AVL tree, in a list, in use by an entity and a group user or not.
    163167 */
    164168typedef enum
    165169{
    166170  /**
    167    * Not in the cache.  Not in a list.  Not in use.
     171   * @brief Empty.
     172   *
     173   * Not in the AVL tree.  Not in a list.  Not in use.  Not a user of its
     174   * group.
    168175   */
    169176  RTEMS_BDBUF_STATE_EMPTY = 0,
    170177
    171178  /**
    172    * In the cache.  Not in a list.  In use by a get or read request.
     179   * @brief Fresh.
     180   *
     181   * In the AVL tree.  Not in a list.  In use by a get or read request.  A user
     182   * of its group.
    173183   */
    174184  RTEMS_BDBUF_STATE_FRESH,
    175185
    176186  /**
    177    * In the cache.  In the LRU list.  Not in use.
    178    */
    179   RTEMS_BDBUF_STATE_CACHED,          /**< In the cache and available */
    180 
    181   /**
    182    * In the cache.  Not in a list.  In use by an upper layer.
     187   * @brief Cached.
     188   *
     189   * In the AVL tree.  In the LRU list.  Not in use.  Not a user of its group.
     190   */
     191  RTEMS_BDBUF_STATE_CACHED,
     192
     193  /**
     194   * @brief Accessed by upper layer.
     195   *
     196   * In the AVL tree.  Not in a list.  In use by an upper layer.  A user of its
     197   * group.
    183198   */
    184199  RTEMS_BDBUF_STATE_ACCESS,
    185200
    186201  /**
    187    * In the cache.  Not in a list.  In use by an upper layer.
     202   * @brief Accessed and modified by upper layer.
     203   *
     204   * In the AVL tree.  Not in a list.  In use by an upper layer.  A user of its
     205   * group.
    188206   */
    189207  RTEMS_BDBUF_STATE_ACCESS_MODIFIED,
    190208
    191209  /**
    192    * In the cache.  In the modified list.  Not in use.
     210   * @brief Modified by upper layer.
     211   *
     212   * In the AVL tree.  In the modified list.  In use by swapout mechanic.  A
     213   * user of its group.
    193214   */
    194215  RTEMS_BDBUF_STATE_MODIFIED,
    195216
    196217  /**
    197    * In the cache.  In the sync list.  Not in use.
     218   * @brief Scheduled for synchronization.
     219   *
     220   * In the AVL tree.  In the sync list.  In use by swapout mechanic.  A user
     221   * of its group.
    198222   */
    199223  RTEMS_BDBUF_STATE_SYNC,
    200224
    201225  /**
    202    * In the cache.  Not in a list.  In use by the block device driver.
     226   * @brief In transfer by block device driver.
     227   *
     228   * In the AVL tree.  Not in a list.  In use by the block device driver.  A
     229   * user of its group.
    203230   */
    204231  RTEMS_BDBUF_STATE_TRANSFER
  • cpukit/libblock/include/rtems/blkdev.h

    r91182bc r47c2327  
    183183 */
    184184#define RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \
    185   .open_entry = rtems_blkdev_generic_open, \
    186   .close_entry = rtems_blkdev_generic_close, \
    187   .read_entry = rtems_blkdev_generic_read, \
    188   .write_entry = rtems_blkdev_generic_write, \
    189   .control_entry = rtems_blkdev_generic_ioctl
     185  rtems_blkdev_generic_open, \
     186  rtems_blkdev_generic_close, \
     187  rtems_blkdev_generic_read, \
     188  rtems_blkdev_generic_write, \
     189  rtems_blkdev_generic_ioctl
    190190
    191191/**
  • cpukit/libblock/src/bdbuf.c

    r91182bc r47c2327  
    18321832    transfer_count = media_block_end - media_block;
    18331833
     1834  req->bufnum = 0;
     1835
    18341836  bd = rtems_bdbuf_get_buffer_for_access (dev, media_block, bds_per_group);
    1835 
    1836   req->bufnum = 0;
    18371837
    18381838  req->bufs [0].user   = bd;
     
    18411841  req->bufs [0].buffer = bd->buffer;
    18421842
     1843  if (rtems_bdbuf_tracer)
     1844    rtems_bdbuf_show_users ("read", bd);
     1845
    18431846  switch (bd->state)
    18441847  {
     
    18471850      return;
    18481851    case RTEMS_BDBUF_STATE_FRESH:
     1852      rtems_bdbuf_set_state (bd, RTEMS_BDBUF_STATE_TRANSFER);
    18491853      break;
    18501854    default:
     
    18551859  while (transfer_index < transfer_count)
    18561860  {
    1857     rtems_bdbuf_set_state (bd, RTEMS_BDBUF_STATE_TRANSFER);
    1858 
    1859     if (rtems_bdbuf_tracer)
    1860       rtems_bdbuf_show_users ("reading", bd);
    1861 
    18621861    media_block += media_block_count;
    18631862
     
    18671866    if (bd == NULL)
    18681867      break;
     1868
     1869    rtems_bdbuf_set_state (bd, RTEMS_BDBUF_STATE_TRANSFER);
    18691870
    18701871    req->bufs [transfer_index].user   = bd;
     
    18721873    req->bufs [transfer_index].length = block_size;
    18731874    req->bufs [transfer_index].buffer = bd->buffer;
     1875
     1876    if (rtems_bdbuf_tracer)
     1877      rtems_bdbuf_show_users ("read-ahead", bd);
    18741878
    18751879    ++transfer_index;
  • cpukit/libblock/src/ide_part_table.c

    r91182bc r47c2327  
    514514    if (rc != RTEMS_SUCCESSFUL)
    515515    {
     516        free(disk_desc);
    516517        return rc;
    517518    }
Note: See TracChangeset for help on using the changeset viewer.