Changeset beea580 in rtems for cpukit/libblock


Ignore:
Timestamp:
Mar 5, 2012, 9:01:37 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
5e88538
Parents:
e998c985
git-author:
Sebastian Huber <sebastian.huber@…> (03/05/12 09:01:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/13/12 11:24:16)
Message:

libblock: Add optional free at delete request

Location:
cpukit/libblock
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/include/rtems/ramdisk.h

    re998c985 rbeea580  
    137137   */
    138138  bool trace;
     139
     140  /**
     141   * @brief Free the RAM disk at the block device delete request.
     142   */
     143  bool free_at_delete_request;
    139144} ramdisk;
    140145
     
    214219void ramdisk_free(ramdisk *rd);
    215220
     221static inline void ramdisk_enable_free_at_delete_request(ramdisk *rd)
     222{
     223  rd->free_at_delete_request = true;
     224}
     225
    216226/**
    217227 * @brief Allocates, initializes and registers a RAM disk.
  • cpukit/libblock/src/ramdisk-driver.c

    re998c985 rbeea580  
    103103ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
    104104{
     105    struct ramdisk *rd = rtems_disk_get_driver_data(dd);
     106
    105107    switch (req)
    106108    {
     
    108110        {
    109111            rtems_blkdev_request *r = argp;
    110             struct ramdisk *rd = rtems_disk_get_driver_data(dd);
    111112
    112113            switch (r->req)
     
    125126        }
    126127
     128        case RTEMS_BLKIO_DELETED:
     129            if (rd->free_at_delete_request) {
     130              ramdisk_free(rd);
     131            }
     132            break;
     133
    127134        default:
    128135            return rtems_blkdev_ioctl (dd, req, argp);
Note: See TracChangeset for help on using the changeset viewer.