Ignore:
Timestamp:
Oct 20, 2009, 7:53:19 AM (10 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, master
Children:
d61f0a7b
Parents:
b83c7ba9
Message:
  • libblock/include/rtems/diskdevs.h: Documentation. Added field to rtems_disk_device.
  • libblock/include/rtems/blkdev.h: New request code RTEMS_BLKIO_DELETED.
  • libblock/src/diskdevs.c: Major rewrite. Changed the way disks are deleted. Disks will be now deleted if they are not in use or upon last release. The IO control handler will be invoked if a physical disk is deleted with the RTEMS_BLKIO_DELETED request code. Logical disks increase now the usage count of the associated physical disk.
  • libblock/include/rtems/ramdisk.h: Documentation.
  • libblock/src/ramdisk-driver.c: Compile trace support conditionally.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/ramdisk-driver.c

    rb83c7ba9 re41369ef  
    1414 */
    1515
    16 #include <stdio.h>
     16/* FIXME: How to set this define? */
     17#if !defined(RTEMS_RAMDISK_TRACE)
     18    #define RTEMS_RAMDISK_TRACE 0
     19#endif
     20
    1721#include <stdlib.h>
    1822#include <errno.h>
    1923#include <string.h>
    20 #include <inttypes.h>
     24
     25#if RTEMS_RAMDISK_TRACE
     26    #include <stdio.h>
     27#endif
    2128
    2229#include <rtems.h>
    2330#include <rtems/ramdisk.h>
    2431
    25 static void
    26 rtems_ramdisk_printf (const ramdisk *rd, const char *format, ...)
    27 {
    28   if (rd->trace)
    29   {
    30     va_list args;
    31     va_start (args, format);
    32     printf ("ramdisk:");
    33     vprintf (format, args);
    34     printf ("\n");
    35   }
    36 }
     32#if RTEMS_RAMDISK_TRACE
     33    static void
     34    rtems_ramdisk_printf (const ramdisk *rd, const char *format, ...)
     35    {
     36        if (rd->trace)
     37        {
     38            va_list args;
     39            va_start (args, format);
     40            printf ("ramdisk:");
     41            vprintf (format, args);
     42            printf ("\n");
     43        }
     44    }
     45#endif
    3746
    3847static int
     
    4352    rtems_blkdev_sg_buffer *sg;
    4453
     54#if RTEMS_RAMDISK_TRACE
    4555    rtems_ramdisk_printf (rd, "ramdisk read: start=%d, blocks=%d",
    4656                          req->bufs[0].block, req->bufnum);
     57#endif
    4758
    4859    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
    4960    {
     61#if RTEMS_RAMDISK_TRACE
    5062        rtems_ramdisk_printf (rd, "ramdisk read: buf=%d block=%d length=%d off=%d addr=%p",
    5163                              i, sg->block, sg->length, sg->block * rd->block_size,
    5264                              from + (sg->block * rd->block_size));
     65#endif
    5366        memcpy(sg->buffer, from + (sg->block * rd->block_size), sg->length);
    5467    }
     
    6477    rtems_blkdev_sg_buffer *sg;
    6578
     79#if RTEMS_RAMDISK_TRACE
    6680    rtems_ramdisk_printf (rd, "ramdisk write: start=%d, blocks=%d",
    6781                          req->bufs[0].block, req->bufnum);
     82#endif
    6883    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
    6984    {
     85#if RTEMS_RAMDISK_TRACE
    7086        rtems_ramdisk_printf (rd, "ramdisk write: buf=%d block=%d length=%d off=%d addr=%p",
    7187                              i, sg->block, sg->length, sg->block * rd->block_size,
    7288                              to + (sg->block * rd->block_size));
     89#endif
    7390        memcpy(to + (sg->block * rd->block_size), sg->buffer, sg->length);
    7491    }
Note: See TracChangeset for help on using the changeset viewer.