RTEMS  5.1
sparse-disk.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 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>
17  *
18  * The license and distribution terms for this file may be
19  * found in the file LICENSE in this distribution or at
20  * http://www.rtems.org/license/LICENSE.
21  */
22 
23 #ifndef SPARSE_DISK_H
24 #define SPARSE_DISK_H
25 
26 #include <stddef.h>
27 #include <stdint.h>
28 #include <rtems.h>
29 #include <rtems/diskdevs.h>
30 #include <rtems/thread.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif /* __cplusplus */
35 
44 typedef struct {
45  rtems_blkdev_bnum block;
46  void *data;
48 
50 
51 typedef void (*rtems_sparse_disk_delete_handler)(rtems_sparse_disk *sparse_disk);
52 
54  rtems_mutex mutex;
55  rtems_blkdev_bnum blocks_with_buffer;
56  size_t used_count;
57  uint32_t media_block_size;
58  rtems_sparse_disk_delete_handler delete_handler;
59  uint8_t fill_pattern;
60  rtems_sparse_disk_key *key_table;
61 };
62 
85  const char *device_file_name,
86  uint32_t media_block_size,
87  rtems_blkdev_bnum blocks_with_buffer,
88  rtems_blkdev_bnum media_block_count,
89  uint8_t fill_pattern
90 );
91 
97 void rtems_sparse_disk_free( rtems_sparse_disk *sparse_disk );
98 
123  const char *device_file_name,
124  rtems_sparse_disk *sparse_disk,
125  uint32_t media_block_size,
126  rtems_blkdev_bnum blocks_with_buffer,
127  rtems_blkdev_bnum media_block_count,
128  uint8_t fill_pattern,
129  rtems_sparse_disk_delete_handler sparse_disk_delete
130 );
131 
134 #ifdef __cplusplus
135 }
136 #endif /* __cplusplus */
137 
138 #endif /* SPARSE_DISK_H */
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:45
rtems_status_code rtems_sparse_disk_register(const char *device_file_name, rtems_sparse_disk *sparse_disk, uint32_t media_block_size, rtems_blkdev_bnum blocks_with_buffer, rtems_blkdev_bnum media_block_count, uint8_t fill_pattern, rtems_sparse_disk_delete_handler sparse_disk_delete)
Initializes and registers a sparse disk.
Definition: sparse-disk.c:336
rtems_status_code
Classic API Status.
Definition: status.h:43
void rtems_sparse_disk_free(rtems_sparse_disk *sparse_disk)
Frees a sparse disk.
Definition: sparse-disk.c:301
Definition: sparse-disk.h:53
Block Device Disk Management API.
Definition: sparse-disk.h:44
Definition: mutex.h:4
rtems_status_code rtems_sparse_disk_create_and_register(const char *device_file_name, uint32_t media_block_size, rtems_blkdev_bnum blocks_with_buffer, rtems_blkdev_bnum media_block_count, uint8_t fill_pattern)
Creates and registers a sparse disk.
Definition: sparse-disk.c:306