diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-10 11:53:07 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-10 11:53:07 +0200 |
commit | 5a300551574451fbf509685d11095bda4fcb20be (patch) | |
tree | 7bd68b5b0bc9daab6899be52dc694b7162dc6b89 /VirtualFileSystem/InodeMetadata.h | |
download | serenity-5a300551574451fbf509685d11095bda4fcb20be.zip |
Import all this stuff into a single repo called Serenity.
Diffstat (limited to 'VirtualFileSystem/InodeMetadata.h')
-rw-r--r-- | VirtualFileSystem/InodeMetadata.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/VirtualFileSystem/InodeMetadata.h b/VirtualFileSystem/InodeMetadata.h new file mode 100644 index 0000000000..4bbf95483a --- /dev/null +++ b/VirtualFileSystem/InodeMetadata.h @@ -0,0 +1,42 @@ +#pragma once + +#include "InodeIdentifier.h" + +inline bool isDirectory(word mode) { return (mode & 0170000) == 0040000; } +inline bool isCharacterDevice(word mode) { return (mode & 0170000) == 0020000; } +inline bool isBlockDevice(word mode) { return (mode & 0170000) == 0060000; } +inline bool isRegularFile(word mode) { return (mode & 0170000) == 0100000; } +inline bool isFIFO(word mode) { return (mode & 0170000) == 0010000; } +inline bool isSymbolicLink(word mode) { return (mode & 0170000) == 0120000; } +inline bool isSocket(word mode) { return (mode & 0170000) == 0140000; } +inline bool isSticky(word mode) { return mode & 01000; } +inline bool isSetUID(word mode) { return mode & 04000; } +inline bool isSetGID(word mode) { return mode & 02000; } + +struct InodeMetadata { + bool isValid() const { return inode.isValid(); } + + bool isDirectory() const { return ::isDirectory(mode); } + bool isCharacterDevice() const { return ::isCharacterDevice(mode); } + bool isBlockDevice() const { return ::isBlockDevice(mode); } + bool isRegularFile() const { return ::isRegularFile(mode); } + bool isFIFO() const { return ::isFIFO(mode); } + bool isSymbolicLink() const { return ::isSymbolicLink(mode); } + bool isSocket() const { return ::isSocket(mode); } + bool isSticky() const { return ::isSticky(mode); } + bool isSetUID() const { return ::isSetUID(mode); } + bool isSetGID() const { return ::isSetGID(mode); } + + InodeIdentifier inode; + dword size { 0 }; + word mode { 0 }; + dword uid { 0 }; + dword gid { 0 }; + dword linkCount { 0 }; + time_t atime { 0 }; + time_t ctime { 0 }; + time_t mtime { 0 }; + time_t dtime { 0 }; +}; + + |