Contains inode struct and its methods.
More...
#include <stdint.h>
#include <stdbool.h>
#include "superblock.h"
Go to the source code of this file.
|
| struct | __attribute__ ((__packed__)) inode_info |
| | Contains information about inode. More...
|
| |
| size_t | sizeof_inode (const struct superblock *superblock) |
| | Count size of inode in bytes. More...
|
| |
| void | init_inode (struct inode *inode, uint16_t id, bool is_file, const struct superblock *superblock) |
| | Constructor of inode. More...
|
| |
| void | destroy_inode (struct inode *inode) |
| | Destructor of inode. More...
|
| |
| ssize_t | read_inode (int fd, struct inode *inode, uint16_t inode_id, const struct superblock *superblock) |
| | Read inode from memory. More...
|
| |
| ssize_t | write_inode (int fd, struct inode *inode, const struct superblock *superblock) |
| | Write inode from memory. More...
|
| |
| uint16_t | sizeof_inodes_block (const struct superblock *superblock) |
| | Calculate size of block of all inodes. More...
|
| |
Contains inode struct and its methods.
- Author
- yaishenka
- Date
- 13.03.2021
Definition in file inode.h.
| struct __attribute__ |
( |
(__packed__) |
| ) |
|
Contains information about inode.
Main inode struct.
This struct contains info that can be simply written to memory
This struct represent inode
Definition at line 19 of file inode.h.
| void destroy_inode |
( |
struct inode * |
inode | ) |
|
Destructor of inode.
- Parameters
-
Definition at line 44 of file inode.c.
| void init_inode |
( |
struct inode * |
inode, |
|
|
uint16_t |
id, |
|
|
bool |
is_file, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Constructor of inode.
- Parameters
-
| inode | empty instance of inode |
| id | id of inode |
| is_file | |
Definition at line 34 of file inode.c.
| ssize_t read_inode |
( |
int |
fd, |
|
|
struct inode * |
inode, |
|
|
uint16_t |
inode_id, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Read inode from memory.
- Parameters
-
| fd | opened fd |
| inode | empty instance of inode |
| inode_id | id of inode to read |
| superblock | the superblock with metadata of FS |
- Returns
- sizeof(inode) if reading is ok; -1 otherwise and destruct inode object
- Warning
- printf strerror(errno) to stderr
Definition at line 49 of file inode.c.
| size_t sizeof_inode |
( |
const struct superblock * |
superblock | ) |
|
Count size of inode in bytes.
- Parameters
-
| superblock | the superblock with metadata of FS |
- Returns
- size of inode in FS
- Author
- yaishenka
- Date
- 11.03.2021
Definition at line 12 of file inode.c.
| uint16_t sizeof_inodes_block |
( |
const struct superblock * |
superblock | ) |
|
Calculate size of block of all inodes.
- Parameters
-
- Returns
Definition at line 111 of file inode.c.
| ssize_t write_inode |
( |
int |
fd, |
|
|
struct inode * |
inode, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Write inode from memory.
- Parameters
-
| fd | opened fd |
| inode | instance of inode |
| superblock | the superblock with metadata of FS |
- Returns
- sizeof(inode) if writing is ok; -1 otherwise
- Warning
- printf strerror(errno) to stderr
Definition at line 83 of file inode.c.