The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
ramdisk.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file ramdisk.h
5
* @brief a block device on a range of memory.
6
*
7
* the root filesystem image that the bootloader loads as a module becomes a
8
* block device with this driver. writes change only the memory, so they are
9
* lost at the next boot.
10
*/
11
12
#include "
block_device.h
"
13
#include "
common/stdint.h
"
14
15
typedef
struct
16
{
17
block_device_t
block
;
// the block device interface (context points here).
18
uint8_t
*
data
;
// the first byte of the image.
19
uint32_t
size
;
// the size of the image in bytes.
20
21
}
ramdisk_t
;
22
23
/**
24
* make a block device of 512-byte blocks on memory.
25
* @param disk the ramdisk to set up.
26
* @param data the first byte of the image (a kernel pointer).
27
* @param size the size of the image in bytes. a part block at the end is
28
* not used.
29
* @return false if the image is smaller than one block.
30
*/
31
bool
ramdisk_initialize
(
ramdisk_t
*disk,
void
*data,
uint32_t
size);
block_device.h
block_device_t
struct block_device block_device_t
Definition
block_device.h:5
stdint.h
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint8_t
unsigned char uint8_t
Definition
fb.h:18
ramdisk_initialize
bool ramdisk_initialize(ramdisk_t *disk, void *data, uint32_t size)
make a block device of 512-byte blocks on memory.
Definition
ramdisk.c:46
ramdisk_t
Definition
ramdisk.h:16
ramdisk_t::size
uint32_t size
Definition
ramdisk.h:19
ramdisk_t::block
block_device_t block
Definition
ramdisk.h:17
ramdisk_t::data
uint8_t * data
Definition
ramdisk.h:18
src
drivers
disk
ramdisk.h
Generated by
1.18.0