opuntiaOS - an operating system targeting x86 and ARMv7
at master 1.5 kB view raw
1/* 2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors. 3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com> 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9#ifndef _KERNEL_FS_DEVFS_DEVFS_H 10#define _KERNEL_FS_DEVFS_DEVFS_H 11 12#include <fs/vfs.h> 13#include <libkern/c_attrs.h> 14#include <libkern/types.h> 15 16#define DEVFS_INODE_LEN (sizeof(struct devfs_inode)) 17struct PACKED devfs_inode { 18 mode_t mode; 19 uint16_t uid; 20 uint32_t size; 21 uint32_t atime; 22 uint32_t ctime; 23 uint32_t mtime; 24 uint32_t dtime; 25 uint16_t gid; 26 uint16_t links_count; 27 uint32_t blocks; 28 uint32_t flags; 29 uint32_t osd1; 30 31 /* NOTE: Instead of blocks here, we store devfs required things */ 32 uint32_t index; 33 uint32_t dev_id; 34 char* name; 35 struct file_ops* handlers; 36 struct devfs_inode* parent; 37 struct devfs_inode* prev; 38 struct devfs_inode* next; 39 struct devfs_inode* first; 40 struct devfs_inode* last; 41 uint8_t padding[24]; 42 /* Block hack ends here */ 43 44 uint32_t generation; 45 uint32_t file_acl; 46 uint32_t dir_acl; 47 uint32_t faddr; 48 uint32_t osd2[3]; 49}; 50typedef struct devfs_inode devfs_inode_t; 51 52void devfs_install(); 53int devfs_mount(); 54 55devfs_inode_t* devfs_mkdir(dentry_t* dir, const char* name, uint32_t len); 56devfs_inode_t* devfs_register(dentry_t* dir, uint32_t devid, const char* name, uint32_t len, mode_t mode, const file_ops_t* handlers); 57 58#endif /* _KERNEL_FS_DEVFS_DEVFS_H */