# file.h File Reference

`#include <ubixos/types.h>`
`#include <ubixfs/dirCache.h>`
`#include <vfs/mount.h>`

Include dependency graph for file.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

struct | dmadat
struct | fileDescriptorStruct
struct | userFileDescriptorStruct

## Defines

#define | DEV_BSHIFT 9
#define | DEV_BSIZE (1<<DEV_BSHIFT)
#define | SBLOCKSIZE 8192
#define | SEEK_SET 0x0
#define | VBLKSHIFT 12
#define | VBLKSIZE (1 << VBLKSHIFT)

## Typedefs

typedef fileDescriptorStruct | fileDescriptor
typedef userFileDescriptorStruct | userFileDescriptor

## Functions

void | chDir (const char *path)
int | fclose (fileDescriptor *)
int | feof (fileDescriptor *fd)
int | fgetc (fileDescriptor *fd)
fileDescriptor * | fopen (const char *, const char *)
size_t | fread (void *ptr, size_t size, size_t nmemb, fileDescriptor *fd)
int | fseek (fileDescriptor *, long, int)
size_t | fwrite (void *ptr, int size, int nmemb, fileDescriptor *fd)
void | sysChDir (const char *path)
void | sysFseek (userFileDescriptor *, long, int)
int | unlink (const char *path)
char * | verifyDir (const char *path)

## Variables

fileDescriptor * | fdTable

## Define Documentation

#define DEV_BSHIFT 9

Definition at line 36 of file file.h.

#define DEV_BSIZE (1<<DEV_BSHIFT)

Definition at line 37 of file file.h.

#define SBLOCKSIZE 8192

Definition at line 35 of file file.h.

#define SEEK_SET 0x0

Definition at line 31 of file file.h.

#define VBLKSHIFT 12

Definition at line 33 of file file.h.

Referenced by fsread().

#define VBLKSIZE (1 << VBLKSHIFT)

Definition at line 34 of file file.h.

Referenced by fsread().

## Typedef Documentation

typedef struct fileDescriptorStruct fileDescriptor

typedef struct userFileDescriptorStruct userFileDescriptor

## Function Documentation

void chDir | ( | const char * | path | ) |

int fclose | ( | fileDescriptor * |  | ) |

Definition at line 398 of file file.c.

References assert, fileDescriptorStruct::buffer, fdTable, fdTable_lock, kfree(), fileDescriptorStruct::next, NULL, vitalsStruct::openFiles, fileDescriptorStruct::prev, spinLock(), spinUnlock(), systemVitals, and x1.

Referenced by elf_loadfile(), execFile(), kmod_load(), ldEnable(), sys_exec(), sysExec(), sysFclose(), sysMkDir(), and systemTask().

Here is the call graph for this function:

int feof | ( | fileDescriptor * | fd | ) |

Definition at line 220 of file file.c.

References fdEof, and fileDescriptorStruct::status.

int fgetc | ( | fileDescriptor * | fd | ) |

Definition at line 251 of file file.c.

References vfs_mountPoint::fs, fileDescriptorStruct::mp, fileDescriptorStruct::offset, and fileSystem::vfsRead.

Referenced by sysFgetc().

fileDescriptor* fopen | ( | const char * | ,
|  | const char * |  |
| ) |  |  |

Definition at line 274 of file file.c.

References fileDescriptorStruct::buffer, fdOpen, fdTable, fdTable_lock, fileAppend, fileBinary, fileDescriptorStruct::fileName, fileRead, fileWrite, vfs_mountPoint::fs, kfree(), kmalloc(), kprintf(), fileDescriptorStruct::mode, fileDescriptorStruct::mp, fileDescriptorStruct::next, NULL, fileDescriptorStruct::offset, vitalsStruct::openFiles, fileDescriptorStruct::prev, spinLock(), spinUnlock(), sprintf(), fileDescriptorStruct::status, strcpy, strstr(), strtok(), systemVitals, vfs_findMount(), and fileSystem::vfsOpenFile.

Referenced by elf_loadfile(), execFile(), kmod_load(), ldEnable(), sys_exec(), sys_open(), sysExec(), sysFopen(), and sysMkDir().

Here is the call graph for this function:

size_t fread | ( | void * | ptr,
|  | size_t | size,
|  | size_t | nmemb,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 178 of file file.c.

References assert, vfs_mountPoint::fs, fileDescriptorStruct::mp, fileDescriptorStruct::offset, and fileSystem::vfsRead.

Referenced by elf_loadfile(), execFile(), kmod_load(), ldEnable(), read(), sys_exec(), sysExec(), and sysFread().

int fseek | ( | fileDescriptor * | ,
|  | long | ,
|  | int |  |
| ) |  |  |

Definition at line 208 of file file.c.

References fileDescriptorStruct::offset.

Referenced by elf_loadfile(), execFile(), kmod_load(), ldEnable(), sys_exec(), and sysExec().

size_t fwrite | ( | void * | ptr,
|  | int | size,
|  | int | nmemb,
|  | fileDescriptor * | fd |
| ) |  |  |

Definition at line 200 of file file.c.

References vfs_mountPoint::fs, fileDescriptorStruct::mp, fileDescriptorStruct::offset, and fileSystem::vfsWrite.

Referenced by sysFwrite().

void sysChDir | ( | const char * | path | ) |

Definition at line 102 of file file.c.

References _current, osInfo::cwd, taskStruct::oInfo, sprintf(), and strstr().

Here is the call graph for this function:

void sysFseek | ( | userFileDescriptor * | ,
|  | long | ,
|  | int |  |
| ) |  |  |

Definition at line 92 of file file.c.

References userFileDescriptorStruct::fd, NULL, and fileDescriptorStruct::offset.

int unlink | ( | const char * | path | ) |

Definition at line 480 of file file.c.

References vfs_mountPoint::fs, vfs_mountPoint::mountPoint, NULL, strtok(), vfs_findMount(), and fileSystem::vfsUnlink.

Referenced by sysUnlink().

Here is the call graph for this function:

char* verifyDir | ( | const char * | path | ) |

## Variable Documentation

fileDescriptor* fdTable

Definition at line 45 of file file.c.

Referenced by fclose(), and fopen().