Flash Translation Layer  1.0
ramdisk.h
Go to the documentation of this file.
1 
8 #ifndef RAMDISK_H
9 #define RAMDISK_H
10 
11 #include <stdint.h>
12 #include <stdlib.h>
13 #include <glib.h>
14 #include <sys/time.h>
15 
16 #include "device.h"
17 
21 struct ramdisk {
22  size_t size;
23  char *buffer;
24  uint64_t *is_used;
25  int o_flags;
26 };
27 
28 int ramdisk_open(struct device *, const char *name, int flags);
29 ssize_t ramdisk_write(struct device *, struct device_request *);
30 ssize_t ramdisk_read(struct device *, struct device_request *);
31 int ramdisk_erase(struct device *, struct device_request *);
32 int ramdisk_close(struct device *);
33 
34 int ramdisk_device_init(struct device *, uint64_t flags);
35 int ramdisk_device_exit(struct device *);
36 
37 #endif
ssize_t ramdisk_write(struct device *, struct device_request *)
write to the ramdisk
Definition: ramdisk.c:107
int ramdisk_device_init(struct device *, uint64_t flags)
initialize the device and ramdisk module
Definition: ramdisk.c:307
int ramdisk_erase(struct device *, struct device_request *)
erase a segment
Definition: ramdisk.c:222
size_t size
Definition: ramdisk.h:22
structure for manage the ramdisk
Definition: ramdisk.h:21
metadata of the device
Definition: device.h:163
int ramdisk_device_exit(struct device *)
deallocate the device module
Definition: ramdisk.c:337
int ramdisk_open(struct device *, const char *name, int flags)
open the ramdisk (allocate the device resources)
Definition: ramdisk.c:31
char * buffer
Definition: ramdisk.h:23
int ramdisk_close(struct device *)
close the ramdisk
Definition: ramdisk.c:265
ssize_t ramdisk_read(struct device *, struct device_request *)
read from the ramdisk
Definition: ramdisk.c:166
contain the device information header
uint64_t * is_used
Definition: ramdisk.h:24
int o_flags
Definition: ramdisk.h:25
request for device
Definition: device.h:110