Changeset d0c3b38b in rtems for cpukit/libblock
- Timestamp:
- 05/05/09 12:57:16 (15 years ago)
- Branches:
- 4.10, 4.11, 5, master
- Children:
- ce7cfe7
- Parents:
- d8602eb
- Location:
- cpukit/libblock
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libblock/include/rtems/ramdisk.h
rd8602eb rd0c3b38b 1 1 /** 2 * @file rtems/ramdisk.h 3 * RAM disk block device implementation 2 * @file 3 * 4 * RAM disk block device. 4 5 */ 5 6 … … 22 23 #endif 23 24 24 /* RAM disk configuration table entry */ 25 /** 26 * @defgroup rtems_ramdisk RAM Disk Device 27 * 28 * @ingroup rtems_blkdev 29 * 30 * @{ 31 */ 32 33 /** 34 * RAM disk configuration table entry. 35 */ 25 36 typedef struct rtems_ramdisk_config { 26 int block_size; /* RAM disk block size */ 27 int block_num; /* Number of blocks on this RAM disk */ 28 void *location; /* RAM disk permanent location (out of RTEMS controlled 29 memory), or NULL if RAM disk memory should be 30 allocated dynamically */ 37 /** 38 * RAM disk block size (must be a power of two). 39 */ 40 uint32_t block_size; 41 42 /** 43 * Number of blocks on this RAM disk. 44 */ 45 rtems_blkdev_bnum block_num; 46 47 /** 48 * RAM disk location or @c NULL if RAM disk memory should be allocated 49 * dynamically. 50 */ 51 void *location; 31 52 } rtems_ramdisk_config; 32 53 33 /* If application want to use RAM disk, it should specify configuration of 34 * available RAM disks. 35 * The following is definitions for RAM disk configuration table 54 /** 55 * External reference to the RAM disk configuration table describing each RAM 56 * disk in the system. 57 * 58 * The configuration table is provided by the application. 36 59 */ 37 extern rtems_ramdisk_config rtems_ramdisk_configuration[]; 60 extern rtems_ramdisk_config rtems_ramdisk_configuration []; 61 62 /** 63 * External reference the size of the RAM disk configuration table 64 * @ref rtems_ramdisk_configuration. 65 * 66 * The configuration table size is provided by the application. 67 */ 38 68 extern size_t rtems_ramdisk_configuration_size; 39 69 40 /* ramdisk_initialize --41 * 70 /** 71 * RAM disk driver initialization entry point. 42 72 */ 43 rtems_device_driver 44 ramdisk_initialize( 45 rtems_device_major_number major,46 rtems_device_minor_number minor,47 void *arg);73 rtems_device_driver ramdisk_initialize( 74 rtems_device_major_number major, 75 rtems_device_minor_number minor, 76 void *arg 77 ); 48 78 79 /** 80 * RAM disk driver table entry. 81 */ 49 82 #define RAMDISK_DRIVER_TABLE_ENTRY \ 50 { ramdisk_initialize, RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES } 83 { \ 84 .initialization_entry = ramdisk_initialize, \ 85 RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \ 86 } 87 88 /** @} */ 51 89 52 90 #ifdef __cplusplus -
cpukit/libblock/src/ramdisk.c
rd8602eb rd0c3b38b 1 /* ramdisk.c -- RAM disk block device implementation 2 * 1 /** 2 * @file 3 * 4 * RAM disk block device. 5 */ 6 7 /* 3 8 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia 4 9 * Author: Victor V. Vengerov <vvv@oktet.ru> … … 19 24 #include <inttypes.h> 20 25 21 #include "rtems/blkdev.h"22 #include "rtems/diskdevs.h"23 #include "rtems/ramdisk.h"26 #include <rtems/blkdev.h> 27 #include <rtems/diskdevs.h> 28 #include <rtems/ramdisk.h> 24 29 25 30 /** … … 31 36 #endif 32 37 33 #define RAMDISK_DEVICE_BASE_NAME "/dev/r amdisk"38 #define RAMDISK_DEVICE_BASE_NAME "/dev/rd" 34 39 35 40 /* Internal RAM disk descriptor */ 36 41 struct ramdisk { 37 int block_size; /* RAM disk block size */ 38 int block_num; /* Number of blocks on this RAM disk */ 39 void *area; /* RAM disk memory area */ 40 bool initialized;/* RAM disk is initialized */ 41 bool malloced; /* != 0, if memory allocated by malloc for this 42 RAM disk */ 43 #if RTEMS_RAMDISK_TRACE 44 int info_level; /* Trace level */ 42 uint32_t block_size; /* RAM disk block size */ 43 rtems_blkdev_bnum block_num; /* Number of blocks on this RAM disk */ 44 void *area; /* RAM disk memory area */ 45 bool initialized; /* RAM disk is initialized */ 46 bool malloced; /* != 0, if memory allocated by malloc for this RAM disk */ 47 #if RTEMS_RAMDISK_TRACE 48 int info_level; /* Trace level */ 45 49 #endif 46 50 }; 47 51 48 52 static struct ramdisk *ramdisk; 49 static uint32_t 53 static uint32_t nramdisks; 50 54 51 55 #if RTEMS_RAMDISK_TRACE … … 243 247 { 244 248 dev_t dev = rtems_filesystem_make_dev_t(major, i); 245 char name [sizeof(RAMDISK_DEVICE_BASE_NAME "0123456789")];246 snprintf(name, sizeof(name), RAMDISK_DEVICE_BASE_NAME "%" PRIu32, i);249 char name [] = RAMDISK_DEVICE_BASE_NAME "a"; 250 name [sizeof(RAMDISK_DEVICE_BASE_NAME)] += i; 247 251 r->block_size = c->block_size; 248 252 r->block_num = c->block_num;
Note: See TracChangeset
for help on using the changeset viewer.