Changeset 5e88538 in rtems


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

libblock: Split file

Location:
cpukit/libblock
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/Makefile.am

    rbeea580 r5e88538  
    1515    src/ramdisk-init.c \
    1616    src/ramdisk-config.c \
     17    src/ramdisk-register.c \
    1718    src/ide_part_table.c \
    1819    src/nvdisk.c \
  • cpukit/libblock/src/ramdisk-init.c

    rbeea580 r5e88538  
    88
    99/*
    10  * Copyright (c) 2009
    11  * embedded brains GmbH
    12  * Obere Lagerstr. 30
    13  * D-82178 Puchheim
    14  * Germany
    15  * <rtems@embedded-brains.de>
     10 * Copyright (c) 2009-2012 embedded brains GmbH.  All rights reserved.
     11 *
     12 *  embedded brains GmbH
     13 *  Obere Lagerstr. 30
     14 *  82178 Puchheim
     15 *  Germany
     16 *  <rtems@embedded-brains.de>
    1617 *
    1718 * The license and distribution terms for this file may be
    1819 * found in the file LICENSE in this distribution or at
    1920 * http://www.rtems.com/license/LICENSE.
    20  *
    21  * $Id$
    2221 */
    2322
    2423#ifdef HAVE_CONFIG_H
    25 #include "config.h"
     24  #include "config.h"
    2625#endif
    2726
     
    3029#include <rtems.h>
    3130#include <rtems/ramdisk.h>
    32 
    33 const rtems_driver_address_table ramdisk_ops = {
    34   .initialization_entry = NULL,
    35   RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES
    36 };
    3731
    3832ramdisk *ramdisk_allocate(
     
    7872  }
    7973}
    80 
    81 rtems_status_code ramdisk_register(
    82   uint32_t block_size,
    83   rtems_blkdev_bnum block_count,
    84   bool trace,
    85   const char *disk,
    86   dev_t *dev_ptr
    87 )
    88 {
    89   rtems_status_code sc = RTEMS_SUCCESSFUL;
    90   rtems_device_major_number major = 0;
    91   ramdisk *rd = NULL;
    92   dev_t dev = 0;
    93 
    94   sc = rtems_io_register_driver(0, &ramdisk_ops, &major);
    95   if (sc != RTEMS_SUCCESSFUL) {
    96     return RTEMS_UNSATISFIED;
    97   }
    98 
    99   rd = ramdisk_allocate(NULL, block_size, block_count, trace);
    100   if (rd == NULL) {
    101     rtems_io_unregister_driver(major);
    102 
    103     return RTEMS_UNSATISFIED;
    104   }
    105 
    106   dev = rtems_filesystem_make_dev_t(major, 0);
    107 
    108   sc = rtems_disk_create_phys(
    109     dev,
    110     block_size,
    111     block_count,
    112     ramdisk_ioctl,
    113     rd,
    114     disk
    115   );
    116   if (sc != RTEMS_SUCCESSFUL) {
    117     ramdisk_free(rd);
    118     rtems_io_unregister_driver(major);
    119 
    120     return RTEMS_UNSATISFIED;
    121   }
    122 
    123   *dev_ptr = dev;
    124 
    125   return RTEMS_SUCCESSFUL;
    126 }
Note: See TracChangeset for help on using the changeset viewer.