RTEMS  5.0.0
ramdisk.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
9  * Author: Victor V. Vengerov <vvv@oktet.ru>
10  */
11 
12 #ifndef _RTEMS_RAMDISK_H
13 #define _RTEMS_RAMDISK_H
14 
15 
16 #include <rtems.h>
17 #include <rtems/blkdev.h>
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
39 typedef struct rtems_ramdisk_config {
43  uint32_t block_size;
44 
49 
54  void *location;
56 
64 
72 
77  rtems_device_major_number major,
78  rtems_device_minor_number minor,
79  void *arg
80 );
81 
85 #define RAMDISK_DRIVER_TABLE_ENTRY \
86  { \
87  ramdisk_initialize, \
88  NULL, NULL, NULL, NULL, NULL \
89  }
90 
91 #define RAMDISK_DEVICE_BASE_NAME "/dev/rd"
92 
103 typedef struct ramdisk {
107  uint32_t block_size;
108 
113 
117  void *area;
118 
123 
127  bool malloced;
128 
132  bool trace;
133 
138 } ramdisk;
139 
140 int ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp);
141 
185  void *area_begin,
186  uint32_t media_block_size,
187  rtems_blkdev_bnum media_block_count,
188  bool trace
189 );
190 
191 void ramdisk_free(ramdisk *rd);
192 
193 static inline void ramdisk_enable_free_at_delete_request(ramdisk *rd)
194 {
195  rd->free_at_delete_request = true;
196 }
197 
210  uint32_t media_block_size,
211  rtems_blkdev_bnum media_block_count,
212  bool trace,
213  const char *disk
214 );
215 
220 #ifdef __cplusplus
221 }
222 #endif
223 
224 #endif
bool initialized
RAM disk is initialized.
Definition: ramdisk.h:122
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:45
uint32_t block_size
RAM disk block size.
Definition: ramdisk.h:43
RAM disk configuration table entry.
Definition: ramdisk.h:39
rtems_ramdisk_config rtems_ramdisk_configuration[]
External reference to the RAM disk configuration table describing each RAM disk in the system...
RAM disk descriptor.
Definition: ramdisk.h:103
struct rtems_ramdisk_config rtems_ramdisk_config
RAM disk configuration table entry.
Description of a disk device (logical and physical disks).
Definition: diskdevs.h:157
ramdisk * ramdisk_allocate(void *area_begin, uint32_t media_block_size, rtems_blkdev_bnum media_block_count, bool trace)
Allocates and initializes a RAM disk descriptor.
Definition: ramdisk-init.c:32
rtems_blkdev_bnum block_num
Number of blocks on this RAM disk.
Definition: ramdisk.h:112
struct ramdisk ramdisk
RAM disk descriptor.
bool free_at_delete_request
Free the RAM disk at the block device delete request.
Definition: ramdisk.h:137
rtems_status_code
Classic API Status.
Definition: status.h:43
void * location
RAM disk location or NULL if RAM disk memory should be allocated dynamically.
Definition: ramdisk.h:54
void * area
RAM disk memory area.
Definition: ramdisk.h:117
rtems_blkdev_bnum block_num
Number of blocks on this RAM disk.
Definition: ramdisk.h:48
rtems_status_code ramdisk_register(uint32_t media_block_size, rtems_blkdev_bnum media_block_count, bool trace, const char *disk)
Allocates, initializes and registers a RAM disk.
Definition: ramdisk-register.c:29
bool trace
Trace enable.
Definition: ramdisk.h:132
uint32_t block_size
RAM disk block size, the media size.
Definition: ramdisk.h:107
bool malloced
Indicates if memory is allocated by malloc() for this RAM disk.
Definition: ramdisk.h:127
size_t rtems_ramdisk_configuration_size
External reference the size of the RAM disk configuration table rtems_ramdisk_configuration.
rtems_device_driver ramdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
RAM disk driver initialization entry point.
Block Device Management.