Filesystem driver for accessing in-ram images
More...
|
int | fs_ramdisk_attach (const char *fn, void *obj, size_t size) |
| Attach a block of memory as a file in the ramdisk.
|
|
int | fs_ramdisk_detach (const char *fn, void **obj, size_t *size) |
| Detach a file from the ramdisk.
|
|
Filesystem driver for accessing in-ram images
◆ fs_ramdisk_attach()
int fs_ramdisk_attach |
( |
const char * | fn, |
|
|
void * | obj, |
|
|
size_t | size ) |
Attach a block of memory as a file in the ramdisk.
This function takes a block of memory and associates it with a file on the ramdisk. This memory should be allocated with malloc(), as an unlink() of the file will call free on the block of memory. The ramdisk then effectively takes control of the block, and is responsible for it at that point.
- Parameters
-
fn | The name to give the new file |
obj | The block of memory to associate |
size | The size of the block of memory |
- Return values
-
◆ fs_ramdisk_detach()
int fs_ramdisk_detach |
( |
const char * | fn, |
|
|
void ** | obj, |
|
|
size_t * | size ) |
Detach a file from the ramdisk.
This function retrieves the block of memory associated with the file, removing it from the ramdisk. You are responsible for freeing obj when you are done with it.
- Parameters
-
fn | The name of the file to look for. |
obj | A pointer to return the address of the object in. |
size | A pointer to return the size of the object in. |
- Return values
-