Flash Translation Layer  1.0
Functions | Variables
ramdisk.c File Reference

implementation of the ramdisk which is inherited by the device More...

#include <fcntl.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include "include/flash.h"
#include "include/ramdisk.h"
#include "include/device.h"
#include "include/log.h"
#include "include/bits.h"
Include dependency graph for ramdisk.c:

Functions

int ramdisk_open (struct device *dev, const char *name, int flags)
 open the ramdisk (allocate the device resources) More...
 
ssize_t ramdisk_write (struct device *dev, struct device_request *request)
 write to the ramdisk More...
 
ssize_t ramdisk_read (struct device *dev, struct device_request *request)
 read from the ramdisk More...
 
int ramdisk_erase (struct device *dev, struct device_request *request)
 erase a segment More...
 
int ramdisk_close (struct device *dev)
 close the ramdisk More...
 
int ramdisk_device_init (struct device *dev, uint64_t flags)
 initialize the device and ramdisk module More...
 
int ramdisk_device_exit (struct device *dev)
 deallocate the device module More...
 

Variables

const struct device_operations __ramdisk_dops
 ramdisk operations More...
 

Detailed Description

implementation of the ramdisk which is inherited by the device

Author
Gijun Oh
Version
0.2
Date
2021-10-03

Function Documentation

◆ ramdisk_close()

int ramdisk_close ( struct device dev)

close the ramdisk

Parameters
devpointer of the device structure
Returns
0 for success, negative value for fail

◆ ramdisk_device_exit()

int ramdisk_device_exit ( struct device dev)

deallocate the device module

Parameters
devpointer of the device structure
Returns
0 for success, negative value for fail
Here is the call graph for this function:

◆ ramdisk_device_init()

int ramdisk_device_init ( struct device dev,
uint64_t  flags 
)

initialize the device and ramdisk module

Parameters
devpointer of the device structure
flagsflags for ramdisk and device
Returns
0 for sucess, negative value for fail
Here is the call graph for this function:

◆ ramdisk_erase()

int ramdisk_erase ( struct device dev,
struct device_request request 
)

erase a segment

Parameters
devpointer of the device structure
requestpointer of the device request structure
Returns
0 for success, negative value for fail
Here is the call graph for this function:

◆ ramdisk_open()

int ramdisk_open ( struct device dev,
const char *  name,
int  flags 
)

open the ramdisk (allocate the device resources)

Parameters
devpointer of the device structure
namethis does not use in this module
flagsopen flags for ramdisk
Returns
0 for success, negative value to fail

< This for make 4GiB disk

Here is the call graph for this function:

◆ ramdisk_read()

ssize_t ramdisk_read ( struct device dev,
struct device_request request 
)

read from the ramdisk

Parameters
devpointer of the device structure
requestpointer of the device request structure
Returns
read size (bytes)
Here is the call graph for this function:

◆ ramdisk_write()

ssize_t ramdisk_write ( struct device dev,
struct device_request request 
)

write to the ramdisk

Parameters
devpointer of the device structure
requestpointer of the device request structure
Returns
written size (bytes)
Here is the call graph for this function:

Variable Documentation

◆ __ramdisk_dops

const struct device_operations __ramdisk_dops
Initial value:
= {
.open = ramdisk_open,
.write = ramdisk_write,
.read = ramdisk_read,
.erase = ramdisk_erase,
.close = ramdisk_close,
}
int ramdisk_erase(struct device *dev, struct device_request *request)
erase a segment
Definition: ramdisk.c:222
ssize_t ramdisk_write(struct device *dev, struct device_request *request)
write to the ramdisk
Definition: ramdisk.c:107
ssize_t ramdisk_read(struct device *dev, struct device_request *request)
read from the ramdisk
Definition: ramdisk.c:166
int ramdisk_open(struct device *dev, const char *name, int flags)
open the ramdisk (allocate the device resources)
Definition: ramdisk.c:31
int ramdisk_close(struct device *dev)
close the ramdisk
Definition: ramdisk.c:265

ramdisk operations