The manual
ginnOS
The reference: libc, the libraries and the kernel
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
15typedef 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 */
31bool ramdisk_initialize(ramdisk_t *disk, void *data, uint32_t size);
struct block_device block_device_t
Definition block_device.h:5
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
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
Definition ramdisk.h:16
uint32_t size
Definition ramdisk.h:19
block_device_t block
Definition ramdisk.h:17
uint8_t * data
Definition ramdisk.h:18