# ubixfs.c File Reference

`#include <ubixfs/ubixfs.h>`
`#include <ubixfs/dirCache.h>`
`#include <vfs/vfs.h>`
`#include <ubixos/types.h>`
`#include <ubixos/sched.h>`
`#include <ubixos/kpanic.h>`
`#include <ubixos/exec.h>`
`#include <lib/kmalloc.h>`
`#include <lib/string.h>`
`#include <lib/kprintf.h>`
`#include <assert.h>`

Include dependency graph for ubixfs.c:

Go to the source code of this file.

## Functions

static int | openFileUbixFS (const char *file, fileDescriptor *fd)
int | readUbixFS (fileDescriptor *fd, char *data, uInt32 offset, long size)
int | ubixfs_init ()
int | ubixfs_initialize (struct vfs_mountPoint *mp)
static int | ubixfs_loadData (fileDescriptor *fd, char *data, uInt32 size, uInt32 batIndex)
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)

## Function Documentation

static int openFileUbixFS | ( | const char * | file,
|  | fileDescriptor * | fd |
| ) |  |  | `[static]`

Definition at line 46 of file ubixfs.c.

References assert, fileDescriptorStruct::cacheNode, vfs_mountPoint::device, device_node::devInfo, ubixFSInfo::dirCache, fileRead, fileWrite, vfs_mountPoint::fsInfo, cacheNode::info, kmalloc(), kprintf(), fileDescriptorStruct::mode, fileDescriptorStruct::mp, NULL, cacheNode::permissions, fileDescriptorStruct::perms, cacheNode::present, device_interface::read, fileDescriptorStruct::size, cacheNode::size, fileDescriptorStruct::start, cacheNode::startCluster, UBIXFS_ALIGN, ubixfs_cacheFind(), ubixfs_loadData(), and x1.

Referenced by ubixfs_init().

Here is the call graph for this function:

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

Definition at line 194 of file ubixfs.c.

References assert, fileDescriptorStruct::cacheNode, fdEof, vfs_mountPoint::fsInfo, cacheNode::info, kpanic(), fileDescriptorStruct::mp, NULL, cacheNode::present, fileDescriptorStruct::size, and fileDescriptorStruct::status.

Referenced by addDirEntry(), and ubixfs_init().

Here is the call graph for this function:

int ubixfs_init | ( |  | ) |

Definition at line 456 of file ubixfs.c.

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

Here is the call graph for this function:

int ubixfs_initialize | ( | struct vfs_mountPoint * | mp | ) |

Definition at line 376 of file ubixfs.c.

References assert, cacheNode::attributes, ubixFSInfo::batEntries, ubixFSInfo::blockAllocationTable, vfs_mountPoint::device, device_node::devInfo, ubixFSInfo::dirCache, vfs_mountPoint::diskLabel, vfs_mountPoint::fsInfo, cacheNode::info, device_interface::info, kmalloc(), kprintf(), ubixDiskLabel::magicNum, ubixDiskLabel::magicNum2, vfs_mountPoint::partition, ubixDiskLabel::partitions, ubixDiskLabel::ubixPartitions::pBatSize, cacheNode::permissions, cacheNode::present, device_interface::read, ubixFSInfo::rootDir, cacheNode::size, cacheNode::startCluster, UBIXDISKMAGIC, ubixfs_cacheNew(), and x1.

Here is the call graph for this function:

static int ubixfs_loadData | ( | fileDescriptor * | fd,
|  | char * | data,
|  | uInt32 | size,
|  | uInt32 | batIndex |
| ) |  |  | `[static]`

Definition at line 341 of file ubixfs.c.

References assert, ubixFSInfo::blockAllocationTable, blockSize, vfs_mountPoint::device, device_node::devInfo, vfs_mountPoint::diskLabel, vfs_mountPoint::fsInfo, device_interface::info, fileDescriptorStruct::mp, blockAllocationTableEntry::nextBlock, NULL, vfs_mountPoint::partition, ubixDiskLabel::partitions, device_interface::read, blockAllocationTableEntry::realSector, UBIXFS_ALIGN, and UBIXFS_BLOCKSIZE_BYTES.

Referenced by openFileUbixFS().

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().

Here is the call graph for this function:

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

Definition at line 118 of file ubixfs.c.

References assert, ubixFSInfo::blockAllocationTable, vfs_mountPoint::diskLabel, fdOpen, fdRead, vfs_mountPoint::fsInfo, fileDescriptorStruct::mp, blockAllocationTableEntry::nextBlock, NULL, vfs_mountPoint::partition, ubixDiskLabel::partitions, ubixDiskLabel::ubixPartitions::pBatSize, fileDescriptorStruct::start, and fileDescriptorStruct::status.

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

Definition at line 232 of file ubixfs.c.

References assert, ubixFSInfo::blockAllocationTable, blockSize, fileDescriptorStruct::buffer, vfs_mountPoint::device, device_node::devInfo, vfs_mountPoint::diskLabel, EOBC, fileDescriptorStruct::fileName, directoryEntry::fileName, vfs_mountPoint::fsInfo, getFreeBlocks(), device_interface::info, kfree(), kmalloc(), fileDescriptorStruct::mp, blockAllocationTableEntry::nextBlock, NULL, vfs_mountPoint::partition, ubixDiskLabel::partitions, device_interface::read, blockAllocationTableEntry::realSector, directoryEntry::size, fileDescriptorStruct::size, fileDescriptorStruct::start, directoryEntry::startCluster, strcmp(), device_interface::write, and x1000.

Referenced by addDirEntry(), and ubixfs_init().

Here is the call graph for this function: