RTEMS CPU Kit with SuperCore  4.11.3
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 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34 
43 typedef struct {
44  rtems_blkdev_bnum block;
45  void *data;
47 
48 typedef struct rtems_sparse_disk rtems_sparse_disk;
49 
50 typedef void (*rtems_sparse_disk_delete_handler)(rtems_sparse_disk *sparse_disk);
51 
52 struct rtems_sparse_disk {
54  rtems_blkdev_bnum blocks_with_buffer;
55  size_t used_count;
56  uint32_t media_block_size;
57  rtems_sparse_disk_delete_handler delete_handler;
58  uint8_t fill_pattern;
59  rtems_sparse_disk_key *key_table;
60 };
61 
84  const char *device_file_name,
85  uint32_t media_block_size,
86  rtems_blkdev_bnum blocks_with_buffer,
87  rtems_blkdev_bnum media_block_count,
88  uint8_t fill_pattern
89 );
90 
96 void rtems_sparse_disk_free( rtems_sparse_disk *sparse_disk );
97 
122  const char *device_file_name,
123  rtems_sparse_disk *sparse_disk,
124  uint32_t media_block_size,
125  rtems_blkdev_bnum blocks_with_buffer,
126  rtems_blkdev_bnum media_block_count,
127  uint8_t fill_pattern,
128  rtems_sparse_disk_delete_handler sparse_disk_delete
129 );
130 
133 #ifdef __cplusplus
134 }
135 #endif /* __cplusplus */
136 
137 #endif /* SPARSE_DISK_H */
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:46
Objects_Id rtems_id
Used to manage and manipulate RTEMS object identifiers.
Definition: types.h:80
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:360
rtems_status_code
Classic API Status.
Definition: status.h:46
void rtems_sparse_disk_free(rtems_sparse_disk *sparse_disk)
Frees a sparse disk.
Definition: sparse-disk.c:325
Definition: sparse-disk.h:52
Block Device Disk Management API.
Definition: sparse-disk.h:43
Definition: mutex.h:5
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:330