Go to the documentation of this file.
40 #include "../fat/fat_filelib.h"
58 kprintf(
"uap->size: %i, FD: [0x%X], BUF: [0x%X][%c]\n", uap->
nbytes, uap->
fd, uap->
buf, t[0]);
84 if (args->
FILE->
fd == 0x0) {
156 struct file *fdd = 0x0;
163 if (fdd == 0 || fdd->
fd == 0x0) {
205 struct file *fdd = 0x0;
212 if (fdd == 0 || fdd->
fd == 0x0) {
247 kprintf(
"Error: userFd == NULL, File: %s, Line: %i\n", __FILE__, __LINE__);
252 if (args->
FILE->
fd != 0x0) {
336 tmpFd->
offset = offset + whence;
380 kprintf(
"[%s:%i]", __FILE__, __LINE__);
406 char *mountPoint = 0x0;
412 kprintf(
"Error: tmpFd == NULL, File: %s, Line: %i\n", __FILE__, __LINE__);
421 if (path[0] ==
"." && path[1] ==
'\0')
428 if (
strstr(fileName,
":")) {
429 mountPoint = (
char*)
strtok((
char*) &fileName,
":");
442 if (mountPoint == 0x0) {
449 if (tmpFd->
mp == 0x0) {
456 for (i = 0;
'\0' != flags[i]; i++) {
475 kprintf(
"Invalid mode '%c' for fopen\n", flags[i]);
488 if (tmpFd->
buffer == 0x0) {
490 kprintf(
"Error: tmpFd->buffer == NULL, File: %s, Line: %i\n", __FILE__, __LINE__);
551 for (tmpFd =
fdTable; tmpFd != 0x0; tmpFd = tmpFd->
next) {
605 if (
strstr(path,
":") == 0x0) {
607 dir = (
char*) &tmpDir;
609 while (
strstr(dir,
"/")) {
610 if (rootPath[0] == 0x0)
619 tmpFD =
fopen(rootPath,
"rb");
621 if (tmpFD->
mp == 0x0) {
622 kprintf(
"Invalid Mount Point\n");
639 int unlink(
const char *node) {
640 char *path = 0x0, *mountPoint = 0x0;
643 path = (
char*)
strtok((
char*) node,
"@");
655 kprintf(
"DBG: Mount Point Bad");
char * strtok(char *str, const char *sep)
int(* vfsWrite)(void *, char *, off_t, long)
int sys_fclose(struct thread *td, struct sys_fclose_args *args)
int fputc(int ch, fileDescriptor_t *fd)
struct vfs_mountPoint * vfs_findMount(char *mountPoint)
char * strcpy(char *, const char *)
userFileDescriptor * FILE
int unlink(const char *node)
fileDescriptor_t * fopen(const char *file, const char *flags)
int sysUnlink(const char *path, int *retVal)
int sys_fgetc(struct thread *td, struct sys_fgetc_args *args)
struct fileDescriptor * fd
size_t fread(void *ptr, size_t size, size_t nmemb, fileDescriptor_t *fd)
void kfree(void *baseAddr)
int sys_fopen(struct thread *td, struct sys_fopen_args *args)
int tty_print(char *, tty_term *)
void spinUnlock(spinLock_t *lock)
int feof(fileDescriptor_t *fd)
size_t fwrite(void *ptr, int size, int nmemb, fileDescriptor_t *fd)
userFileDescriptor * FILE
#define SPIN_LOCK_INITIALIZER
userFileDescriptor * FILE
int(* vfsRead)(void *, char *, off_t, long)
void sysMkDir(const char *path)
fileDescriptor_t * fdTable
struct vfs_mountPoint * mp
int sprintf(char *buf, const char *fmt,...)
void spinLock(spinLock_t *lock)
int(* vfsMakeDir)(char *, void *)
int sys_fwrite(struct thread *td, struct sys_fwrite_args *uap)
vitalsNode * systemVitals
int fclose(fileDescriptor_t *fd)
int sys_fchdir(struct thread *td, struct sys_fchdir_args *args)
void sysFwrite(char *ptr, int size, userFileDescriptor *userFd)
int getfd(struct thread *td, struct file **fp, int fd)
get pointer to file fd in specified thread
int sys_fseek(struct thread *td, struct sys_fseek_args *args)
int sys_fread(struct thread *td, struct sys_fread_args *args)
int sys_chdir(struct thread *td, struct sys_chdir_args *args)
userFileDescriptor * FILE
tty_term * tty_foreground
userFileDescriptor * FILE
void * kmalloc(uInt32 len)
void * memset(void *dst, int c, size_t length)
int fgetc(fileDescriptor_t *fd)
int sys_rename(struct thread *td, struct sys_rename_args *args)
int kprintf(const char *,...)
int sys_lseek(struct thread *td, struct sys_lseek_args *args)
fileDescriptor_t * vfs_fileTable
char * strstr(const char *s, char *find)
int(* vfsUnlink)(char *, void *)
struct fileDescriptor * prev
int(* vfsOpenFile)(void *, void *)
struct fileDescriptor * next
int fseek(fileDescriptor_t *tmpFd, long offset, int whence)