Contains useful methods to work with FS.
More...
#include <string.h>
#include <stdio.h>
#include "superblock.h"
#include "block.h"
#include "inode.h"
Go to the source code of this file.
|
uint16_t | create_dir_helper (int fd, const struct superblock *superblock, uint16_t parent_node_id, bool is_root) |
| Helper for create new directory Creates dir with parent = parent_node_id (or itself if is_root). Push to new dir records about "." and "..". More...
|
|
uint16_t | create_file_helper (int fd, const struct superblock *superblock, uint16_t parent_node_id) |
| Helper for create new file Creates file with parent = parent_node_id. More...
|
|
uint16_t | get_inode_id_of_dir (int fd, const char *path, const struct superblock *superblock) |
| Parse path and find inode of this dir. More...
|
|
bool | is_dir_exist (int fd, struct inode *inode, const char *dirname, const struct superblock *superblock) |
| Check if dir exists in inode. More...
|
|
uint16_t | get_file_inode_id (int fd, struct inode *inode, const char *dirname, const struct superblock *superblock) |
| Return inode_id of file. More...
|
|
Contains useful methods to work with FS.
- Author
- yaishenka
- Date
- 13.03.2021
Definition in file methods.h.
uint16_t create_dir_helper |
( |
const int |
fd, |
|
|
const struct superblock * |
superblock, |
|
|
uint16_t |
parent_node_id, |
|
|
bool |
is_root |
|
) |
| |
Helper for create new directory Creates dir with parent = parent_node_id (or itself if is_root). Push to new dir records about "." and "..".
- Parameters
-
fd | opened fd |
superblock | |
parent_node_id | parent of new dir |
is_root | |
- Returns
- id of new inode if all ok; superblock->fs_info->inodes_count otherwise
- Author
- yaishenka
- Date
- 12.03.2021
Definition at line 8 of file methods.c.
uint16_t create_file_helper |
( |
int |
fd, |
|
|
const struct superblock * |
superblock, |
|
|
uint16_t |
parent_node_id |
|
) |
| |
Helper for create new file Creates file with parent = parent_node_id.
- Parameters
-
fd | |
superblock | |
parent_node_id | |
- Returns
- id of new inode if all ok; superblock->fs_info->inodes_count otherwise
Definition at line 76 of file methods.c.
uint16_t get_file_inode_id |
( |
int |
fd, |
|
|
struct inode * |
inode, |
|
|
const char * |
dirname, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Return inode_id of file.
- Parameters
-
fd | |
inode | |
dirname | |
superblock | |
- Returns
- inode_id of file if it exists in this node; superblock->fs_info.inodes_count otherwise
Definition at line 232 of file methods.c.
uint16_t get_inode_id_of_dir |
( |
int |
fd, |
|
|
const char * |
path, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Parse path and find inode of this dir.
- Parameters
-
- Returns
- id of inode of this dir if all ok; superblock->fs_info.inodes_count otherwise
Definition at line 197 of file methods.c.
bool is_dir_exist |
( |
int |
fd, |
|
|
struct inode * |
inode, |
|
|
const char * |
dirname, |
|
|
const struct superblock * |
superblock |
|
) |
| |
Check if dir exists in inode.
- Parameters
-
fd | |
inode | |
dirname | |
superblock | |
- Returns
Definition at line 210 of file methods.c.