FreeNOS
FileSystem.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIB_LIBFS_FILESYSTEM_H
19 #define __LIB_LIBFS_FILESYSTEM_H
20 
21 #include <Types.h>
22 
31 namespace FileSystem
32 {
36  enum Action
37  {
47  };
48 
52  enum Result
53  {
54  Success = 0,
65  };
66 
70  enum FileType
71  {
77  FIFOFile = 5,
80  };
81 
85  enum FileMode
86  {
87  OwnerR = 0400,
88  OwnerW = 0200,
89  OwnerX = 0100,
90  OwnerRW = 0600,
91  OwnerRX = 0500,
92  OwnerRWX = 0700,
93  GroupR = 0040,
94  GroupW = 0020,
95  GroupX = 0010,
96  GroupRW = 0060,
97  GroupRX = 0050,
98  GroupRWX = 0070,
99  OtherR = 0004,
100  OtherW = 0002,
101  OtherX = 0001,
102  OtherRW = 0006,
103  OtherRX = 0005,
104  OtherRWX = 0007,
105  };
106 
108  typedef u16 FileModes;
109 
113  struct FileStat
114  {
122  };
123 
127  struct WaitSet
128  {
132  };
133 
138  {
139  Readable = (1 << 0),
140  Writable = (1 << 1)
141  };
142 };
143 
149 #endif /* __LIB_LIBFS_FILESYSTEM_H */
FileSystem::AlreadyExists
@ AlreadyExists
Definition: FileSystem.h:60
FileSystem::OtherX
@ OtherX
Definition: FileSystem.h:101
FileSystem::OtherRX
@ OtherRX
Definition: FileSystem.h:103
FileSystem::UnknownFile
@ UnknownFile
Definition: FileSystem.h:79
FileSystem::GroupR
@ GroupR
Definition: FileSystem.h:93
Types.h
FileSystem::WaitStatus
WaitStatus
WaitSet status flags.
Definition: FileSystem.h:137
FileSystem::WaitFileSystem
@ WaitFileSystem
Definition: FileSystem.h:45
FileSystem::FileType
FileType
All possible filetypes.
Definition: FileSystem.h:70
FileSystem::WriteFile
@ WriteFile
Definition: FileSystem.h:40
FileSystem::GroupRWX
@ GroupRWX
Definition: FileSystem.h:98
FileSystem::GroupRX
@ GroupRX
Definition: FileSystem.h:97
FileSystem::WaitSet
Provides information about an inode.
Definition: FileSystem.h:127
GroupID
unsigned short GroupID
Group Identity.
Definition: Types.h:137
FileSystem::OwnerX
@ OwnerX
Definition: FileSystem.h:89
FileSystem::InvalidArgument
@ InvalidArgument
Definition: FileSystem.h:55
ProcessID
u32 ProcessID
Process Identification Number.
Definition: Types.h:140
FileSystem::FileStat::inode
u32 inode
< File type.
Definition: FileSystem.h:116
FileSystem::IOError
@ IOError
Definition: FileSystem.h:58
FileSystem::FileStat::access
FileModes access
< Process identifier of filesystem
Definition: FileSystem.h:118
FileSystem::GroupW
@ GroupW
Definition: FileSystem.h:94
FileSystem::SymlinkFile
@ SymlinkFile
Definition: FileSystem.h:76
FileSystem::Success
@ Success
Definition: FileSystem.h:54
FileSystem::FileStat::groupID
GroupID groupID
< User identity.
Definition: FileSystem.h:121
FileSystem::IpcError
@ IpcError
Definition: FileSystem.h:63
FileSystem::FileStat::type
FileType type
Definition: FileSystem.h:115
FileSystem::NotSupported
@ NotSupported
Definition: FileSystem.h:61
FileSystem::OwnerR
@ OwnerR
Definition: FileSystem.h:87
FileSystem::FileStat::size
Size size
< File access permission bits.
Definition: FileSystem.h:119
FileSystem::GroupX
@ GroupX
Definition: FileSystem.h:95
FileSystem::SocketFile
@ SocketFile
Definition: FileSystem.h:78
FileSystem::GetFileSystems
@ GetFileSystems
Definition: FileSystem.h:46
FileSystem::FileStat::userID
UserID userID
< Size of the file in bytes.
Definition: FileSystem.h:120
FileSystem::RedirectRequest
@ RedirectRequest
Definition: FileSystem.h:62
FileSystem::OwnerRW
@ OwnerRW
Definition: FileSystem.h:90
FileSystem::OtherRWX
@ OtherRWX
Definition: FileSystem.h:104
FileSystem::OtherRW
@ OtherRW
Definition: FileSystem.h:102
FileSystem::MountFileSystem
@ MountFileSystem
Definition: FileSystem.h:44
u16
unsigned short u16
Unsigned 16-bit number.
Definition: Types.h:56
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
FileSystem::OwnerW
@ OwnerW
Definition: FileSystem.h:88
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
CreateFile
Create new files on the filesystem.
Definition: CreateFile.h:31
FileSystem::Readable
@ Readable
Definition: FileSystem.h:139
FileSystem::WaitFile
@ WaitFile
Definition: FileSystem.h:43
FileSystem::WaitSet::requested
u16 requested
< Inode number
Definition: FileSystem.h:130
FileSystem::RegularFile
@ RegularFile
Definition: FileSystem.h:72
FileSystem::DirectoryFile
@ DirectoryFile
Definition: FileSystem.h:73
FileSystem::OtherW
@ OtherW
Definition: FileSystem.h:100
FileSystem::FileModes
u16 FileModes
Multiple FileMode values combined.
Definition: FileSystem.h:108
FileSystem::FileMode
FileMode
File access permissions.
Definition: FileSystem.h:85
FileSystem::WaitSet::current
u16 current
< Requested status flags of the inode
Definition: FileSystem.h:131
FileSystem::CharacterDeviceFile
@ CharacterDeviceFile
Definition: FileSystem.h:75
UserID
unsigned short UserID
User Identity.
Definition: Types.h:134
FileSystem::FileStat
Contains file information.
Definition: FileSystem.h:113
FileSystem::FIFOFile
@ FIFOFile
Definition: FileSystem.h:77
FileSystem::Result
Result
Result code for filesystem Actions.
Definition: FileSystem.h:52
FileSystem::RetryAgain
@ RetryAgain
Definition: FileSystem.h:57
FileSystem::DeleteFile
@ DeleteFile
Definition: FileSystem.h:42
FileSystem::ReadFile
@ ReadFile
Definition: FileSystem.h:39
FileSystem::BlockDeviceFile
@ BlockDeviceFile
Definition: FileSystem.h:74
FileSystem
Definition: FileSystem.h:31
FileSystem::NotFound
@ NotFound
Definition: FileSystem.h:56
FileSystem::OtherR
@ OtherR
Definition: FileSystem.h:99
FileSystem::StatFile
@ StatFile
Definition: FileSystem.h:41
FileSystem::TimedOut
@ TimedOut
Definition: FileSystem.h:64
FileSystem::Action
Action
Actions which may be performed on a filesystem.
Definition: FileSystem.h:36
FileSystem::Writable
@ Writable
< File can be read without blocking
Definition: FileSystem.h:140
FileSystem::WaitSet::inode
u32 inode
Definition: FileSystem.h:129
FileSystem::FileStat::pid
ProcessID pid
< Inode number
Definition: FileSystem.h:117
FileSystem::OwnerRX
@ OwnerRX
Definition: FileSystem.h:91
FileSystem::PermissionDenied
@ PermissionDenied
Definition: FileSystem.h:59
FileSystem::OwnerRWX
@ OwnerRWX
Definition: FileSystem.h:92
FileSystem::GroupRW
@ GroupRW
Definition: FileSystem.h:96