sofs19  0.1
FUSE based file system
dal

Disk abstraction layer. More...

Functions

void soOpenDisk (const char *devname)
 Open disk at sofs19 abstraction level. More...
 
void soCloseDisk ()
 Close disk at sofs19 abstraction level. More...
 
void soOpenSuperBlock ()
 Open the superblock dealer. More...
 
void soCloseSuperBlock ()
 Close the superblock dealer. More...
 
void soSaveSuperBlock ()
 Save superblock to disk. More...
 
SOSuperBlocksoGetSuperBlockPointer ()
 Get a pointer to the superblock. More...
 
void soOpenInodeTable ()
 Open inode table dealer. More...
 
void soCloseInodeTable ()
 Close the inode table dealer. More...
 
int soOpenInode (uint32_t in)
 open inode More...
 
void soCheckInodeHandler (int ih, const char *funcname=__FUNCTION__)
 Check given handler, throwing an exception in case of error. More...
 
SOInodesoGetInodePointer (int ih)
 get pointer to an open inode More...
 
void soSaveInode (int ih)
 Save an open inode to disk. More...
 
void soCloseInode (int ih)
 Close an open inode. More...
 
uint32_t soGetInodeNumber (int ih)
 Return the number of the inode associated to the given handler. More...
 
bool soCheckInodeAccess (int ih, int access)
 check an open inode against a requested access More...
 
void soReadDataBlock (uint32_t bn, void *buf)
 Read a block of the data zone. More...
 
void soWriteDataBlock (uint32_t bn, void *buf)
 Write a block of the data zone. More...
 

Detailed Description

Disk abstraction layer.

This layer is used to prevent higher level functions from access disk blocks at raw level.

Function Documentation

◆ soOpenDisk()

void sofs19::soOpenDisk ( const char *  devname)

Open disk at sofs19 abstraction level.

Open disk at raw level and then open superblok (SB) and inode table (IT) abstraction modules. The other sofs19 abstraction modules do not need to be initialized. They are: free inode list table (FILT) module, free block list table (FBLT) module, and data zone (DZ) module.

◆ soCloseDisk()

void sofs19::soCloseDisk ( )

Close disk at sofs19 abstraction level.

First close sofs19 abstraction modules and then close disk at raw level.

◆ soOpenSuperBlock()

void sofs19::soOpenSuperBlock ( )

Open the superblock dealer.

Prepare the internal data structure of the superblock dealer

◆ soCloseSuperBlock()

void sofs19::soCloseSuperBlock ( )

Close the superblock dealer.

Save superblock to disk and close dealer Do nothing if not loaded

◆ soSaveSuperBlock()

void sofs19::soSaveSuperBlock ( )

Save superblock to disk.

Do nothing if not loaded

◆ soGetSuperBlockPointer()

SOSuperBlock* sofs19::soGetSuperBlockPointer ( )

Get a pointer to the superblock.

Load the superblock, if not done yet

Returns
Pointer to the superblock

◆ soOpenInodeTable()

void sofs19::soOpenInodeTable ( )

Open inode table dealer.

Prepare the internal data structure for the inode table dealer

◆ soCloseInodeTable()

void sofs19::soCloseInodeTable ( )

Close the inode table dealer.

Save to disk all openning inodes and close dealer

◆ soOpenInode()

int sofs19::soOpenInode ( uint32_t  in)

open inode

If inode is already open, just increment usecount; otherwise, transfer the inode from disk and put usecount at 1.

Parameters
inthe number of the inode to open
Returns
inode handler

◆ soCheckInodeHandler()

void sofs19::soCheckInodeHandler ( int  ih,
const char *  funcname = __FUNCTION__ 
)

Check given handler, throwing an exception in case of error.

Parameters
ihthe handler to be checked
funcnamename of the function making the ckeck

◆ soGetInodePointer()

SOInode* sofs19::soGetInodePointer ( int  ih)

get pointer to an open inode

A pointer to the SOInode structured where the inode is loaded is returned.

Parameters
ihinode handler
Returns
pointer to the inode

◆ soSaveInode()

void sofs19::soSaveInode ( int  ih)

Save an open inode to disk.

The inode is not closed.

Parameters
ihinode handler

◆ soCloseInode()

void sofs19::soCloseInode ( int  ih)

Close an open inode.

Decrement usecount of given inode, releasing slot if 0 is reached.

Parameters
ihinode handler

◆ soGetInodeNumber()

uint32_t sofs19::soGetInodeNumber ( int  ih)

Return the number of the inode associated to the given handler.

Parameters
ihinode handler
Returns
inode number

◆ soCheckInodeAccess()

bool sofs19::soCheckInodeAccess ( int  ih,
int  access 
)

check an open inode against a requested access

access is a bitwise OR of one or more of R_OK, W_OK, and X_OK

See also
man 2 access
Parameters
ihinode handler
accessrequested access
Returns
true, for access granted; false for access denied

◆ soReadDataBlock()

void sofs19::soReadDataBlock ( uint32_t  bn,
void *  buf 
)

Read a block of the data zone.

Parameters
[in]bnnumber of block to be read
[in]bufpointer to the buffer where the data must be read into

◆ soWriteDataBlock()

void sofs19::soWriteDataBlock ( uint32_t  bn,
void *  buf 
)

Write a block of the data zone.

Parameters
[in]bnnumber of block to be read
[in]bufpointer to the buffer where the data must be written from