kernel/kernel/inc/drivers/fs/vfs.h

66 lines
1.9 KiB
C
Raw Normal View History

/* Copyright (C) Antifallobst <antifallobst@systemausfall.org>
*
* NoxOS is free software:
* you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* NoxOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef NOX_VFS_H
#define NOX_VFS_H
#include "utils/stdtypes.h"
#include "utils/string.h"
#include "boot/boot_info.h"
#define VFS_MAX_NAME_LENGTH 128
typedef struct vfs_node_T vfs_node_T;
typedef enum {
VFS_NODE_DIRECTORY,
VFS_NODE_FILE,
VFS_NODE_MOUNT,
VFS_NODE_BLOCK_DEVICE,
VFS_NODE_ENUM_END
} vfs_node_type_E;
typedef struct {
void* buffer;
uint64_t buffer_size;
bool reclaimable;
vfs_node_T* node;
} vfs_node_cache_T;
struct vfs_node_T{
char name[VFS_MAX_NAME_LENGTH];
vfs_node_type_E type;
vfs_node_cache_T* cache;
vfs_node_T* prev;
vfs_node_T* next;
vfs_node_T* parent;
vfs_node_T* childs;
};
extern vfs_node_T* g_vfs_root_node;
vfs_node_T* vfs_node_create (vfs_node_T* parent, string_t name, vfs_node_type_E type);
vfs_node_T* vfs_node_destruct (vfs_node_T* node);
void vfs_node_dump_info (vfs_node_T* node, uint64_t indent);
vfs_node_T* vfs_node_resolve_child (vfs_node_T* node, string_t child_name);
void vfs_init (boot_info_T* boot_info);
vfs_node_T* vfs_resolve_path (string_t path);
void vfs_unpack_archive_ustar ();
#endif //NOX_VFS_H