RTEMS 6.1-rc1
sparse-disk.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2012 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef SPARSE_DISK_H
37#define SPARSE_DISK_H
38
39#include <stddef.h>
40#include <stdint.h>
41#include <rtems.h>
42#include <rtems/diskdevs.h>
43#include <rtems/thread.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif /* __cplusplus */
48
57typedef struct {
59 void *data;
61
63
64typedef void (*rtems_sparse_disk_delete_handler)(rtems_sparse_disk *sparse_disk);
65
67 rtems_mutex mutex;
68 rtems_blkdev_bnum blocks_with_buffer;
69 size_t used_count;
70 uint32_t media_block_size;
71 rtems_sparse_disk_delete_handler delete_handler;
72 uint8_t fill_pattern;
73 rtems_sparse_disk_key *key_table;
74};
75
98 const char *device_file_name,
99 uint32_t media_block_size,
100 rtems_blkdev_bnum blocks_with_buffer,
101 rtems_blkdev_bnum media_block_count,
102 uint8_t fill_pattern
103);
104
110void rtems_sparse_disk_free( rtems_sparse_disk *sparse_disk );
111
136 const char *device_file_name,
137 rtems_sparse_disk *sparse_disk,
138 uint32_t media_block_size,
139 rtems_blkdev_bnum blocks_with_buffer,
140 rtems_blkdev_bnum media_block_count,
141 uint8_t fill_pattern,
142 rtems_sparse_disk_delete_handler sparse_disk_delete
143);
144
147#ifdef __cplusplus
148}
149#endif /* __cplusplus */
150
151#endif /* SPARSE_DISK_H */
Block Device Disk Management API.
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
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:320
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:350
void rtems_sparse_disk_free(rtems_sparse_disk *sparse_disk)
Frees a sparse disk.
Definition: sparse-disk.c:315
This header file defines the RTEMS Classic API.
Definition: mutex.h:6
Definition: sparse-disk.h:57
Definition: sparse-disk.h:66
This header file provides the API of Self-Contained Objects.