|
FreeNOS
|
Represents an directory on a LinnFS filesystem. More...
#include <LinnDirectory.h>
Public Member Functions | |
| LinnDirectory (LinnFileSystem *fs, const u32 inode, LinnInode *inodeData) | |
| Constructor function. More... | |
| virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
| Read directory entries. More... | |
| virtual File * | lookup (const char *name) |
| Retrieves a File pointer for the given entry name. More... | |
Public Member Functions inherited from Directory | |
| Directory (const u32 inode) | |
| Constructor. More... | |
| virtual | ~Directory () |
| Destructor. More... | |
| void | insert (FileSystem::FileType type, const char *name) |
| Insert a new directory entry. More... | |
| void | remove (const char *name) |
| Remove a directory entry. More... | |
| void | clear () |
| Clears the internal list of entries. More... | |
Public Member Functions inherited from File | |
| File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
| Constructor function. More... | |
| virtual | ~File () |
| Destructor function. More... | |
| u32 | getInode () const |
| Get inode number. More... | |
| FileSystem::FileType | getType () const |
| Retrieve our filetype. More... | |
| virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
| Write bytes to the file. More... | |
| virtual FileSystem::Result | status (FileSystem::FileStat &st) |
| Retrieve file statistics. More... | |
| virtual bool | canRead () const |
| Check if the File has data ready for reading. More... | |
| virtual bool | canWrite () const |
| Check if the File can be written to. More... | |
Private Member Functions | |
| bool | getLinnDirectoryEntry (LinnDirectoryEntry *dent, const char *name) |
| Retrieve a directory entry. More... | |
Private Attributes | |
| LinnFileSystem * | m_fs |
| Filesystem pointer. More... | |
| LinnInode * | m_inodeData |
| Inode which describes the directory. More... | |
Additional Inherited Members | |
Protected Attributes inherited from File | |
| const u32 | m_inode |
| Inode number. More... | |
| const FileSystem::FileType | m_type |
| Type of this file. More... | |
| UserID | m_uid |
| Owner of the file. More... | |
| GroupID | m_gid |
| Group of the file. More... | |
| FileSystem::FileModes | m_access |
| Access permissions. More... | |
| Size | m_size |
| Size of the file, in bytes. More... | |
Represents an directory on a LinnFS filesystem.
Definition at line 44 of file LinnDirectory.h.
| LinnDirectory::LinnDirectory | ( | LinnFileSystem * | fs, |
| const u32 | inode, | ||
| LinnInode * | inodeData | ||
| ) |
Constructor function.
| fs | Filesystem pointer. |
| inode | Inode number |
| inodeData | Inode data pointer. |
Definition at line 25 of file LinnDirectory.cpp.
References File::m_access, m_inodeData, File::m_size, LinnInode::mode, and LinnInode::size.
Referenced by lookup().
|
private |
Retrieve a directory entry.
| dent | LinnDirectoryEntry buffer pointer. |
| name | Unique name of the entry. |
Definition at line 129 of file LinnDirectory.cpp.
References LinnInode::block, LinnSuperBlock::blockSize, String::equals(), LinnFileSystem::getStorage(), LinnFileSystem::getSuperBlock(), LINN_DIRENT_PER_BLOCK, LINN_INODE_NUM_BLOCKS, m_fs, m_inodeData, LinnDirectoryEntry::name, Storage::read(), and FileSystem::Success.
Referenced by lookup().
|
virtual |
Retrieves a File pointer for the given entry name.
This function reads a file from disk corresponding to the LinnInode of the given entry name. It returns an File object associated with that LinnInode.
| name | Name of the entry to lookup. |
Reimplemented from Directory.
Definition at line 96 of file LinnDirectory.cpp.
References assert, FileSystem::DirectoryFile, entry, LinnFileSystem::getInode(), getLinnDirectoryEntry(), LinnDirectory(), m_fs, NULL, FileSystem::RegularFile, LinnInode::type, and ZERO.
|
virtual |
Read directory entries.
| buffer | Input/Output buffer to output bytes to. |
| size | Maximum number of bytes to read on input. On output, the actual number of bytes read. |
| offset | Offset inside the file to start reading. |
Reimplemented from Directory.
Definition at line 36 of file LinnDirectory.cpp.
References LinnInode::block, LinnSuperBlock::blockSize, MemoryBlock::copy(), LinnFileSystem::getInode(), LinnFileSystem::getStorage(), LinnFileSystem::getSuperBlock(), LinnDirectoryEntry::inode, FileSystem::InvalidArgument, LINN_DIRENT_NAME_LEN, LINN_INODE_DIR_BLOCKS, m_fs, m_inodeData, Dirent::name, LinnDirectoryEntry::name, FileSystem::NotFound, FileSystem::PermissionDenied, Storage::read(), LinnInode::size, FileSystem::Success, Dirent::type, LinnInode::type, IOBuffer::write(), and ZERO.
|
private |
Filesystem pointer.
Definition at line 108 of file LinnDirectory.h.
Referenced by getLinnDirectoryEntry(), lookup(), and read().
|
private |
Inode which describes the directory.
Definition at line 111 of file LinnDirectory.h.
Referenced by getLinnDirectoryEntry(), LinnDirectory(), and read().
1.8.17