RTEMS 6.1-rc2
Loading...
Searching...
No Matches
diskdevs.h
Go to the documentation of this file.
1
9/*
10 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
11 * Author: Victor V. Vengerov <vvv@oktet.ru>
12 */
13
14#ifndef _RTEMS_DISKDEVS_H
15#define _RTEMS_DISKDEVS_H
16
17#include <rtems.h>
18#include <rtems/libio.h>
19#include <rtems/chain.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
26
45typedef uint32_t rtems_blkdev_bnum;
46
52 uint32_t req,
53 void *argp
54);
55
59#define RTEMS_DISK_READ_AHEAD_NO_TRIGGER ((rtems_blkdev_bnum) -1)
60
64#define RTEMS_DISK_READ_AHEAD_SIZE_AUTO (0)
65
69typedef struct {
74
83
91
98 uint32_t nr_blocks;
100
106typedef struct {
113 uint32_t read_hits;
114
122 uint32_t read_misses;
123
131
136
140 uint32_t read_blocks;
141
147 uint32_t read_errors;
148
155
159 uint32_t write_blocks;
160
166 uint32_t write_errors;
168
181 dev_t dev;
182
188
192 uint32_t capabilities;
193
197 char *name;
198
204 unsigned uses;
205
213
218
225
234 uint32_t block_size;
235
242
249
260
267
272
277
283
288
293};
294
300/* Use fstat() instead */
301RTEMS_DEPRECATED static inline dev_t rtems_disk_get_device_identifier(
302 const rtems_disk_device *dd
303)
304{
305 return dd->dev;
306}
307
308/* Use fstat() instead */
309RTEMS_DEPRECATED static inline rtems_device_major_number rtems_disk_get_major_number(
310 const rtems_disk_device *dd
311)
312{
313 return rtems_filesystem_dev_major_t(dd->dev);
314}
315
316/* Use fstat() instead */
317RTEMS_DEPRECATED static inline rtems_device_minor_number rtems_disk_get_minor_number(
318 const rtems_disk_device *dd
319)
320{
321 return rtems_filesystem_dev_minor_t(dd->dev);
322}
323
324static inline void *rtems_disk_get_driver_data(
325 const rtems_disk_device *dd
326)
327{
328 return dd->driver_data;
329}
330
331static inline uint32_t rtems_disk_get_media_block_size(
332 const rtems_disk_device *dd
333)
334{
335 return dd->media_block_size;
336}
337
338static inline uint32_t rtems_disk_get_block_size(
339 const rtems_disk_device *dd
340)
341{
342 return dd->block_size;
343}
344
345static inline rtems_blkdev_bnum rtems_disk_get_block_begin(
346 const rtems_disk_device *dd
347)
348{
349 return dd->start;
350}
351
352static inline rtems_blkdev_bnum rtems_disk_get_block_count(
353 const rtems_disk_device *dd
354)
355{
356 return dd->size;
357}
358
366/* Use rtems_blkdev_create() instead */
367RTEMS_DEPRECATED rtems_status_code rtems_disk_create_phys(
368 dev_t dev,
369 uint32_t block_size,
370 rtems_blkdev_bnum block_count,
372 void *driver_data,
373 const char *name
374);
375
376/* Use rtems_blkdev_create_partition() instead */
377RTEMS_DEPRECATED rtems_status_code rtems_disk_create_log(
378 dev_t dev,
379 dev_t phys,
380 rtems_blkdev_bnum block_begin,
381 rtems_blkdev_bnum block_count,
382 const char *name
383);
384
385/*
386 * Use rtems_blkdev_create() or rtems_blkdev_create_partition and unlink()
387 * instead.
388 */
389RTEMS_DEPRECATED rtems_status_code rtems_disk_delete(dev_t dev);
390
391/*
392 * Use rtems_blkdev_create() or rtems_blkdev_create_partition and open()
393 * instead.
394 */
395RTEMS_DEPRECATED rtems_disk_device *rtems_disk_obtain(dev_t dev);
396
397/*
398 * Use rtems_blkdev_create() or rtems_blkdev_create_partition and close()
399 * instead.
400 */
402
410/* Just remove calls to this function */
411RTEMS_DEPRECATED rtems_status_code rtems_disk_io_initialize(void);
412
413/* Just remove calls to this function */
414RTEMS_DEPRECATED rtems_status_code rtems_disk_io_done(void);
415
420/*
421 * This functionality no longer available. There is no global registration for
422 * disk devices.
423 */
424RTEMS_DEPRECATED rtems_disk_device *rtems_disk_next(dev_t dev);
425
426/* Internal function, do not use */
427rtems_status_code rtems_disk_init_phys(
429 uint32_t block_size,
430 rtems_blkdev_bnum block_count,
432 void *driver_data
433);
434
435/* Internal function, do not use */
436rtems_status_code rtems_disk_init_log(
438 rtems_disk_device *phys_dd,
439 rtems_blkdev_bnum block_begin,
440 rtems_blkdev_bnum block_count
441);
442
443#ifdef __cplusplus
444}
445#endif
446
447#endif
This header file provides the Chains API.
#define RTEMS_DEPRECATED
Instructs the compiler in a declaration to issue a warning whenever a variable, function,...
Definition: basedefs.h:334
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition: io.h:103
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:45
int(* rtems_block_device_ioctl)(rtems_disk_device *dd, uint32_t req, void *argp)
Block device IO control handler type.
Definition: diskdevs.h:50
Basic IO API.
This header file defines the RTEMS Classic API.
This structure represents a chain node.
Definition: chain.h:78
Block device read-ahead control.
Definition: diskdevs.h:69
rtems_chain_node node
Chain node for the read-ahead request queue of the read-ahead task.
Definition: diskdevs.h:73
rtems_blkdev_bnum next
Start block for the next read-ahead request.
Definition: diskdevs.h:90
uint32_t nr_blocks
Size of the next read-ahead request in blocks.
Definition: diskdevs.h:98
rtems_blkdev_bnum trigger
Block value to trigger the read-ahead request.
Definition: diskdevs.h:82
Block device statistics.
Definition: diskdevs.h:106
uint32_t read_ahead_peeks
Read-ahead transfers caused by a peek.
Definition: diskdevs.h:135
uint32_t read_ahead_transfers
Read-ahead transfer count.
Definition: diskdevs.h:130
uint32_t read_blocks
Count of blocks transfered from the device.
Definition: diskdevs.h:140
uint32_t read_errors
Read error count.
Definition: diskdevs.h:147
uint32_t write_errors
Write error count.
Definition: diskdevs.h:166
uint32_t write_blocks
Count of blocks transfered to the device.
Definition: diskdevs.h:159
uint32_t read_misses
Read miss count.
Definition: diskdevs.h:122
uint32_t write_transfers
Write transfer count.
Definition: diskdevs.h:154
uint32_t read_hits
Read hit count.
Definition: diskdevs.h:113
Description of a disk device (logical and physical disks).
Definition: diskdevs.h:177
uint32_t media_block_size
Media block size in bytes.
Definition: diskdevs.h:224
rtems_block_device_ioctl ioctl
IO control handler for this disk.
Definition: diskdevs.h:271
void * driver_data
Private data for the disk driver.
Definition: diskdevs.h:276
dev_t dev
Device identifier (concatenation of major and minor number).
Definition: diskdevs.h:181
size_t bds_per_group
Buffer descriptors per group count.
Definition: diskdevs.h:266
rtems_blkdev_stats stats
Device statistics for this disk.
Definition: diskdevs.h:287
uint32_t capabilities
Driver capabilities.
Definition: diskdevs.h:192
unsigned uses
Usage counter.
Definition: diskdevs.h:204
rtems_blkdev_bnum start
Start media block number.
Definition: diskdevs.h:212
rtems_blkdev_read_ahead read_ahead
Read-ahead control for this disk.
Definition: diskdevs.h:292
rtems_disk_device * phys_dev
Physical device identifier (equals the dev entry if it specifies a physical device).
Definition: diskdevs.h:187
rtems_blkdev_bnum size
Size of the physical or logical disk in media blocks.
Definition: diskdevs.h:217
bool deleted
Indicates that this disk should be deleted as soon as the last user releases this disk.
Definition: diskdevs.h:282
uint32_t block_size
Block size in bytes.
Definition: diskdevs.h:234
uint32_t media_blocks_per_block
Media blocks per device blocks.
Definition: diskdevs.h:248
char * name
Disk device name.
Definition: diskdevs.h:197
int block_to_media_block_shift
Block to media block shift.
Definition: diskdevs.h:259
rtems_blkdev_bnum block_count
Block count.
Definition: diskdevs.h:241