diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index a8dc91e..77b6b53 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -218,22 +218,28 @@ spinUnlock(&devfsSpinLock); return(0x0); - } - + } + +int devfs_dummy() { + kprintf("PLACE HOLDER\n"); + return(0x0); + } + int devfs_init() { /* Build our devfs struct */ - struct fileSystem devFS = - {NULL, /* prev */ + struct fileSystem devFS = { + NULL, /* prev */ NULL, /* next */ - (void *)devfs_initialize, /* vfsInitFS */ + (void *)devfs_initialize, /* vfsInitFS */ (void *)devfs_read, /* vfsRead */ (void *)devfs_write, /* vfsWrite */ (void *)devfs_open, /* vfsOpenFile */ - NULL, /* vfsUnlink */ - NULL, /* vfsMakeDir */ - NULL, /* vfsRemDir */ - NULL, /* vfsSync */ - 1 /* vfsType */ + devfs_dummy, /* vfsCloseFile */ + devfs_dummy, /* vfsUnlink */ + devfs_dummy, /* vfsMakeDir */ + devfs_dummy, /* vfsRemDir */ + devfs_dummy, /* vfsSync */ + 0x1 /* vfsType */ }; /* devFS */ if (vfsRegisterFS(devFS) != 0x0) { diff --git a/src/sys/include/vfs/vfs.h b/src/sys/include/vfs/vfs.h index a06784a..b8e2d64 100644 --- a/src/sys/include/vfs/vfs.h +++ b/src/sys/include/vfs/vfs.h @@ -70,6 +70,7 @@ int (*vfsRead)(void *,char *,long,long); /*!< pointer to read routine */ int (*vfsWrite)(void *,char *,long,long); /*!< pointer to write routine */ int (*vfsOpenFile)(void *,void *); /*!< pointer to openfile routine */ + int (*vfsCloseFile)(void *,void *); /*!< pointer to closefile routine */ int (*vfsUnlink)(char *,void *); /*!< pointer to unlink routine */ int (*vfsMakeDir)(char *,void *); /*!< pointer to makedir routine */ int (*vfsRemDir)(char *); /*!< pointer to remdir routine */ diff --git a/src/sys/ufs/ufs.c b/src/sys/ufs/ufs.c index a2c8f95..9035cb8 100644 --- a/src/sys/ufs/ufs.c +++ b/src/sys/ufs/ufs.c @@ -332,26 +332,37 @@ return(0x1); } +static int ufs_closeFile(const char *file,struct file *fd) { + kfree(fd->fsObj); + return(0x0); + } + +static int ufs_dummy() { + kprintf("Dummy Func\n"); + } + int ufs_init() { /* Build our ufs struct */ - struct fileSystem ufs = - {NULL, /* prev */ - NULL, /* next */ - (void *)ufs_initialize, /* vfsInitFS */ - (void *)ufs_readFile, /* vfsRead */ - (void *)ufs_writeFile, /* vfsWrite */ - (void *)ufs_openFile, /* vfsOpenFile */ - NULL, /* vfsUnlink */ - NULL, /* vfsMakeDir */ - NULL, /* vfsRemDir */ - NULL, /* vfsSync */ - 0xAA, /* vfsType */ + struct fileSystem ufs = { + NULL, /* prev */ + NULL, /* next */ + (void *)ufs_initialize, /* vfsInitFS */ + (void *)ufs_readFile, /* vfsRead */ + (void *)ufs_writeFile, /* vfsWrite */ + (void *)ufs_openFile, /* vfsOpenFile */ + (void *)ufs_dummy, /* vfsCloseFile */ + (void *)ufs_dummy, /* vfsUnlink */ + (void *)ufs_dummy, /* vfsMakeDir */ + (void *)ufs_dummy, /* vfsRemDir */ + (void *)ufs_dummy, /* vfsSync */ + 0xAA, /* vfsType */ }; /* UFS */ if (vfsRegisterFS(ufs) != 0x0) { kpanic("Unable To Enable UFS"); return(0x1); } + //dmadat = (struct dmadat *)kmalloc(sizeof(struct dmadat)); /* Return */ return(0x0); diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index b39831a..7680062 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -348,6 +348,7 @@ /* in order to save resources we will allocate the buffer later when it is needed */ tmpFd->buffer = (char *)kmalloc(4096); +kprintf("meep meep [0x%X]\n",tmpFd->buffer); if(tmpFd->buffer == 0x0) { kfree(tmpFd); @@ -402,7 +403,11 @@ int fclose(struct file *fd) { struct file *tmpFd = 0x0; assert(fd); -kprintf("must complete this!\n"); + + //kfree(fd->fsObj); + kfree(fd->buffer); + kfree(fd); +//BUG think i'm missing things //K_PANIC("HMM?"); /* diff --git a/src/sys/vfs/vfs.c b/src/sys/vfs/vfs.c index 5dc5c45..8e3e940 100644 --- a/src/sys/vfs/vfs.c +++ b/src/sys/vfs/vfs.c @@ -97,6 +97,13 @@ return(0x1); } + /*! verify that we have all required methods */ + if ((newFS.vfsCloseFile == 0x0) || (newFS.vfsInitFS == 0x0) || (newFS.vfsMakeDir == 0x0) || (newFS.vfsOpenFile == 0x0) || (newFS.vfsRead == 0x0) || (newFS.vfsRemDir == 0x0) || (newFS.vfsSync == 0x0)) { + kprintf("Missing Methods\n"); + return(0x1); + } + + /* Allocate Memory */ tmpFs = (struct fileSystem *)kmalloc(sizeof(struct fileSystem)); if (tmpFs == NULL) { diff --git a/src/sys/vfs/vfs_syscalls.c b/src/sys/vfs/vfs_syscalls.c index 5abeef3..11e697e 100644 --- a/src/sys/vfs/vfs_syscalls.c +++ b/src/sys/vfs/vfs_syscalls.c @@ -205,7 +205,9 @@ while (1); } //BUG make fopen return 0 or -1 if error; + kprintf("[0x%X]-234\n",nfp->buffer); fopen(nfp,uap->path,"r"); + kprintf("[0x%X]-sdf\n",nfp->buffer); if (nfp == 0x0) td->td_retval[0] = -1; else @@ -214,13 +216,17 @@ } /* end func open */ int close(struct thread *td,struct close_args *uap) { + struct file *fd = 0x0; #ifdef VFSDEBUG kprintf("[%s:%i:%s]",__FILE__,__LINE__,__FUNCTION__); #endif + getfd(td,&fd,uap->fd); + kprintf("BuffeR: [0x%X]\n",fd->buffer); + kfree(fd->buffer); kfree((void *)td->o_files[uap->fd]); td->o_files[uap->fd] = 0x0; - td->td_retval[0] = 0x0; + td->td_retval[0] = 0x0; return(0x0); } /* end func close */