Flash Translation Layer  1.0
Functions | Variables
page-interface.c File Reference

interface for page ftl More...

#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include "include/log.h"
#include "include/page.h"
#include "include/device.h"
Include dependency graph for page-interface.c:

Functions

static int page_ftl_open_interface (struct flash_device *flash, const char *name, int flags)
 open the page flash translation layer based device More...
 
static ssize_t page_ftl_write_interface (struct flash_device *flash, void *buffer, size_t count, off_t offset)
 write the page flash translation layer based device More...
 
static ssize_t page_ftl_read_interface (struct flash_device *flash, void *buffer, size_t count, off_t offset)
 read the page flash translation layer based device More...
 
static int page_ftl_close_interface (struct flash_device *flash)
 close the page flash translation layer based device More...
 
static int page_ftl_ioctl_interface (struct flash_device *flash, unsigned int request,...)
 additional commands support interface More...
 
int page_ftl_module_init (struct flash_device *flash, uint64_t flags)
 initialize the page flash translation layer module More...
 
int page_ftl_module_exit (struct flash_device *flash)
 free resources in the page flash translation layer module More...
 

Variables

const struct flash_operations __page_fops
 implementation of the flash_operations More...
 

Detailed Description

interface for page ftl

Author
Gijun Oh
Version
0.2
Date
2021-09-22

Function Documentation

◆ page_ftl_close_interface()

static int page_ftl_close_interface ( struct flash_device flash)
static

close the page flash translation layer based device

Parameters
flashpointer of the flash device information
Returns
zero to success, error number to fail
Here is the call graph for this function:

◆ page_ftl_ioctl_interface()

static int page_ftl_ioctl_interface ( struct flash_device flash,
unsigned int  request,
  ... 
)
static

additional commands support interface

Parameters
flashpointer of the flash device information
requestioctl's request identifier
...additional parameters
Returns
0 for success, negative number for failed
Here is the call graph for this function:

◆ page_ftl_module_exit()

int page_ftl_module_exit ( struct flash_device flash)

free resources in the page flash translation layer module

Parameters
flashpointer of the flash device information
Returns
zero to success, error number to fail
Note
You must not free resources related on the flash module which is parent module
Here is the call graph for this function:

◆ page_ftl_module_init()

int page_ftl_module_init ( struct flash_device flash,
uint64_t  flags 
)

initialize the page flash translation layer module

Parameters
flashpointer of the flash device information
flagsflags for flash and submodule
Returns
zero to success, error number to fail
Here is the call graph for this function:

◆ page_ftl_open_interface()

static int page_ftl_open_interface ( struct flash_device flash,
const char *  name,
int  flags 
)
static

open the page flash translation layer based device

Parameters
flashpointer of the flash device information
namefile's name
Returns
zero to success, error number to fail
Here is the call graph for this function:

◆ page_ftl_read_interface()

static ssize_t page_ftl_read_interface ( struct flash_device flash,
void *  buffer,
size_t  count,
off_t  offset 
)
static

read the page flash translation layer based device

Parameters
flashpointer of the flash device information
bufferpointer of the data buffer
countsize of the buffer (bytes)
offsetsize of the offset (bytes)
Returns
positive or zero read size to success, negative number to fail

check the pointer validity

allocate the request

submit the request

Here is the call graph for this function:

◆ page_ftl_write_interface()

static ssize_t page_ftl_write_interface ( struct flash_device flash,
void *  buffer,
size_t  count,
off_t  offset 
)
static

write the page flash translation layer based device

Parameters
flashpointer of the flash device information
bufferpointer of the data buffer
countsize of the buffer (bytes)
offsetsize of the offset (bytes)
Returns
positive or zero write size to success, negative number to fail

check the pointer validity

allocate the request

submit the request

Here is the call graph for this function:

Variable Documentation

◆ __page_fops

const struct flash_operations __page_fops
Initial value:
= {
}
static int page_ftl_close_interface(struct flash_device *flash)
close the page flash translation layer based device
Definition: page-interface.c:257
static ssize_t page_ftl_read_interface(struct flash_device *flash, void *buffer, size_t count, off_t offset)
read the page flash translation layer based device
Definition: page-interface.c:149
static ssize_t page_ftl_write_interface(struct flash_device *flash, void *buffer, size_t count, off_t offset)
write the page flash translation layer based device
Definition: page-interface.c:50
static int page_ftl_ioctl_interface(struct flash_device *flash, unsigned int request,...)
additional commands support interface
Definition: page-interface.c:281
static int page_ftl_open_interface(struct flash_device *flash, const char *name, int flags)
open the page flash translation layer based device
Definition: page-interface.c:24

implementation of the flash_operations