Flash Translation Layer  1.0
Macros | Functions | Variables
zone.c File Reference

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

#include <libzbd/zbd.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <glib.h>
#include <unistd.h>
#include "include/zone.h"
#include "include/device.h"
#include "include/log.h"
Include dependency graph for zone.c:

Macros

#define _GNU_SOURCE
 

Functions

int zone_open (struct device *dev, const char *name, int flags)
 open the zoned block deivce file More...
 
static ssize_t zone_do_rw (int fd, int flag, void *buffer, size_t count, off_t offset)
 execute the read and write function More...
 
ssize_t zone_write (struct device *dev, struct device_request *request)
 write to the zoned block device More...
 
ssize_t zone_read (struct device *dev, struct device_request *request)
 read to the zoned block device More...
 
int zone_erase (struct device *dev, struct device_request *request)
 erase the segment to the zoned block device More...
 
int zone_close (struct device *dev)
 close the zoned block device More...
 
int zone_device_init (struct device *dev, uint64_t flags)
 initialize the device module More...
 
int zone_device_exit (struct device *dev)
 deallocate the device module More...
 

Variables

struct device_operations __zone_dops
 zoned block device operations More...
 

Detailed Description

implementation of the lizbd which is inherited by the device

Author
Gijun Oh
Version
0.2
Date
2021-10-09

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE

Function Documentation

◆ zone_close()

int zone_close ( struct device dev)

close the zoned block device

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

◆ zone_device_exit()

int zone_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:

◆ zone_device_init()

int zone_device_init ( struct device dev,
uint64_t  flags 
)

initialize the device 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:

◆ zone_do_rw()

static ssize_t zone_do_rw ( int  fd,
int  flag,
void *  buffer,
size_t  count,
off_t  offset 
)
static

execute the read and write function

Parameters
fdthe number which contains the file descriptor
flagI/O direction
bufferpointer of the buffer
countthe number of byte to read or write
offsetposition which wants to read or write
Returns
the number of bytes after read or write, negative number means fail

◆ zone_erase()

int zone_erase ( struct device dev,
struct device_request request 
)

erase the segment to the zoned block device

Parameters
devpointer of the device structre
requestpointer of the user request
Returns
0 for success, negative number for fail

◆ zone_open()

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

open the zoned block deivce file

Parameters
devpointer of the device structure
namezoned block device's device filename
flagsopen flags for ramdisk
Returns
0 for success, negative number for fail
Here is the call graph for this function:

◆ zone_read()

ssize_t zone_read ( struct device dev,
struct device_request request 
)

read to the zoned block device

Parameters
devpointer of the device structre
requestpointer of the user request
Returns
the number of bytes to read, negative number for fail
Here is the call graph for this function:

◆ zone_write()

ssize_t zone_write ( struct device dev,
struct device_request request 
)

write to the zoned block device

Parameters
devpointer of the device structre
requestpointer of the user request
Returns
the number of bytes to write, negative number for fail
Here is the call graph for this function:

Variable Documentation

◆ __zone_dops

struct device_operations __zone_dops
Initial value:
= {
.open = zone_open,
.write = zone_write,
.read = zone_read,
.erase = zone_erase,
.close = zone_close,
}
int zone_close(struct device *dev)
close the zoned block device
Definition: zone.c:354
int zone_open(struct device *dev, const char *name, int flags)
open the zoned block deivce file
Definition: zone.c:32
int zone_erase(struct device *dev, struct device_request *request)
erase the segment to the zoned block device
Definition: zone.c:316
ssize_t zone_read(struct device *dev, struct device_request *request)
read to the zoned block device
Definition: zone.c:256
ssize_t zone_write(struct device *dev, struct device_request *request)
write to the zoned block device
Definition: zone.c:173

zoned block device operations