- Main Page
- Namespaces
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# ubixfs.h File Reference

`#include <ubixos/types.h>`
`#include <vfs/vfs.h>`
`#include <sys/device.h>`
`#include <mpi/mpi.h>`
`#include <ubixfs/dirCache.h>`

Go to the source code of this file.

## Data Structures
struct | blockAllocationTableEntry
struct | bootSect
struct | directoryEntry
struct | directoryList
struct | partitionInformation
struct | ubixDiskLabel
struct | ubixDiskLabel::ubixPartitions
struct | ubixFSInfo
## Defines
#define | blockSize 8
#define | EOBC -1
#define | MAXUBIXPARTITIONS 16
#define | typeContainer 2
#define | typeDeleted 8
#define | typeDirectory 4
#define | typeFile 1
#define | UBIXDISKMAGIC ((uInt32)0x45)
#define | UBIXFS_ALIGN(size) (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES)))))
#define | UBIXFS_BLOCKSIZE_BYTES blockSize*512
## Typedefs
typedef directoryList * | dirList_t
## Functions
int | addDirEntry (struct directoryEntry *dir, fileDescriptor *fd)
int | freeBlocks (int block, fileDescriptor *fd)
int | getFreeBlocks (int count, fileDescriptor *fd)
int | readFile (char *file)
int | readUbixFS (fileDescriptor *fd, char *data, uInt32, long size)
void | syncBat (struct vfs_mountPoint *mp)
int | ubixfs_init ()
int | ubixfs_initialize ()
void | ubixfs_thread ()
dirList_t | ubixFSLoadDir (char *)
int | ubixFSmkDir (char *dir, fileDescriptor *fd)
void | ubixFSUnlink (char *path, struct vfs_mountPoint *mp)
int | writeFileByte (int ch, fileDescriptor *fd, long offset)
int | writeUbixFS (fileDescriptor *fd, char *data, long offset, long size)

## Define Documentation

#define blockSize 8

Definition at line 45 of file ubixfs.h.

Referenced by ubixfs_loadData(), ubixFSmkDir(), and writeUbixFS().

#define EOBC -1

Definition at line 48 of file ubixfs.h.

Referenced by writeUbixFS().

#define MAXUBIXPARTITIONS 16

Definition at line 44 of file ubixfs.h.

#define typeContainer 2

Definition at line 52 of file ubixfs.h.

#define typeDeleted 8

Definition at line 54 of file ubixfs.h.

Referenced by ubixFSUnlink().

#define typeDirectory 4

Definition at line 53 of file ubixfs.h.

Referenced by ubixFSmkDir().

#define typeFile 1

Definition at line 51 of file ubixfs.h.

Referenced by ubixfs_cacheFind().

#define UBIXDISKMAGIC ((uInt32)0x45)

Definition at line 43 of file ubixfs.h.

Referenced by ubixfs_initialize().

#define UBIXFS_ALIGN | ( | size |  | ) | (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES)))))

Definition at line 41 of file ubixfs.h.

Referenced by openFileUbixFS(), and ubixfs_loadData().

#define UBIXFS_BLOCKSIZE_BYTES blockSize*512

Definition at line 40 of file ubixfs.h.

Referenced by ubixfs_loadData(), and ubixFSmkDir().

## Typedef Documentation

typedef struct directoryList* dirList_t

Definition at line 65 of file ubixfs.h.

## Function Documentation

int addDirEntry | ( | struct directoryEntry * | dir,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 66 of file directory.c.

References kmalloc(), kprintf(), memcpy(), fileDescriptor::offset, readUbixFS(), fileDescriptor::size, writeUbixFS(), and x1000.

Referenced by ubixFSmkDir().

int freeBlocks | ( | int | block,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 79 of file block.c.

References blockAllocationTableEntry::attributes, ubixFSInfo::blockAllocationTable, blockAllocationTableEntry::nextBlock, and syncBat().

int getFreeBlocks | ( | int | count,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 96 of file block.c.

References blockAllocationTableEntry::attributes, ubixFSInfo::batEntries, ubixFSInfo::blockAllocationTable, blockAllocationTableEntry::nextBlock, syncBat(), and x1.

Referenced by ubixFSmkDir(), and writeUbixFS().

int readFile | ( | char * | file | ) |

int readUbixFS | ( | fileDescriptor * | fd,
|  | char * | data,
|  | uInt32 | ,
|  | long | size |
| ) |  |  |

Definition at line 194 of file ubixfs.c.

References assert, buffer, fdEof, kpanic(), NULL, and fileDescriptor::size.

Referenced by addDirEntry(), and ubixfs_init().

void syncBat | ( | struct vfs_mountPoint * | mp | ) |

Definition at line 74 of file block.c.

References ubixFSInfo::blockAllocationTable, vfs_mountPoint::device, device_node::devInfo, vfs_mountPoint::diskLabel, vfs_mountPoint::fsInfo, device_interface::info, vfs_mountPoint::partition, ubixDiskLabel::partitions, and device_interface::write.

Referenced by freeBlocks(), and getFreeBlocks().

int ubixfs_init | ( |  | ) |

Definition at line 456 of file ubixfs.c.

References kpanic(), NULL, openFileUbixFS(), readUbixFS(), ubixfs_initialize(), ubixFSmkDir(), ubixFSUnlink(), vfsRegisterFS(), writeUbixFS(), and x1.

int ubixfs_initialize | ( |  | ) |

Referenced by ubixfs_init().

void ubixfs_thread | ( |  | ) |

dirList_t ubixFSLoadDir | ( | char * |  | ) |

Definition at line 41 of file directory.c.

References directoryList::dirCache, dirList, directoryList::dirName, kmalloc(), directoryList::next, directoryList::prev, sprintf(), and strcmp().

int ubixFSmkDir | ( | char * | dir,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 94 of file directory.c.

References addDirEntry(), directoryEntry::attributes, ubixFSInfo::blockAllocationTable, blockSize, directoryEntry::fileName, getFreeBlocks(), kfree(), kmalloc(), directoryEntry::permissions, blockAllocationTableEntry::realSector, directoryEntry::size, sprintf(), directoryEntry::startCluster, typeDirectory, and UBIXFS_BLOCKSIZE_BYTES.

Referenced by ubixfs_init().

void ubixFSUnlink | ( | char * | path,
|  | struct vfs_mountPoint * | mp |
| ) |  |  |

Definition at line 309 of file ubixfs.c.

References ubixFSInfo::blockAllocationTable, vfs_mountPoint::device, device_node::devInfo, vfs_mountPoint::diskLabel, directoryEntry::fileName, vfs_mountPoint::fsInfo, device_interface::info, kmalloc(), kprintf(), vfs_mountPoint::partition, ubixDiskLabel::partitions, device_interface::read, ubixFSInfo::rootDir, strcmp(), typeDeleted, device_interface::write, and x1000.

Referenced by ubixfs_init().

int writeFileByte | ( | int | ch,
|  | fileDescriptor * | fd,
|  | long | offset |
| ) |  |  |

Definition at line 118 of file ubixfs.c.

References assert, ubixFSInfo::blockAllocationTable, fdOpen, fdRead, blockAllocationTableEntry::nextBlock, and NULL.

int writeUbixFS | ( | fileDescriptor * | fd,
|  | char * | data,
|  | long | offset,
|  | long | size |
| ) |  |  |

Definition at line 232 of file ubixfs.c.

References assert, ubixFSInfo::blockAllocationTable, blockSize, EOBC, directoryEntry::fileName, getFreeBlocks(), kfree(), kmalloc(), blockAllocationTableEntry::nextBlock, NULL, blockAllocationTableEntry::realSector, fileDescriptor::size, directoryEntry::size, directoryEntry::startCluster, strcmp(), and x1000.

Referenced by addDirEntry(), and ubixfs_init().