diff --git a/src/sys/Makefile b/src/sys/Makefile index ad28d25..dac72ca 100644 --- a/src/sys/Makefile +++ b/src/sys/Makefile @@ -1,8 +1,7 @@ # $Id$ # Kernel Makefile (C) 2002 The UbixOS Project -all: ubixfs-code pci-code ufs-code vfs-code isa-code kernel-code lib-code vmm-code sys-code init-code devfs-code mpi-code kmods-code kernel-img -#ubixfs-code +all: pci-code ufs-code vfs-code isa-code kernel-code lib-code vmm-code sys-code init-code devfs-code mpi-code kmods-code kernel-img generic-code: generic (cd generic;make) diff --git a/src/sys/compile/Makefile b/src/sys/compile/Makefile index 56a9d2d..1277ec6 100644 --- a/src/sys/compile/Makefile +++ b/src/sys/compile/Makefile @@ -9,7 +9,7 @@ OBJS = null.o #Kernel Parts -KPARTS = ../ubixfs/*.o ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../vfs/*.o ../pci/*.o ../devfs/*.o ../mpi/*.o ../ufs/*.o +KPARTS = ../init/*.o ../sys/*.o ../vmm/*.o ../lib/*.o ../kernel/*.o ../isa/*.o ../vfs/*.o ../pci/*.o ../devfs/*.o ../mpi/*.o ../ufs/*.o # ../sde/*.o ../graphics/*.o ../ld/*.o -Ttext 0x30000 -Tdata 0x34000 ../ubixfs/*.o # Link the kernel statically with fixed text+data address @1M diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index 7a75677..c1924f3 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -68,7 +68,7 @@ This format will be changing down the road */ -static int devfs_open(char *file,fileDescriptor *fd) { +static int devfs_open(char *file,struct file *fd) { struct devfs_info *fsInfo = fd->mp->fsInfo; struct devfs_devices *tmpDev = 0x0; struct device_node *device = 0x0; @@ -76,7 +76,7 @@ spinLock(&devfsSpinLock); if (strcmp(file,"/") == 0x0) { - fd->start = -1; + fd->fd->start = -1; fd->size = devfs_len; spinUnlock(&devfsSpinLock); return(0x1); @@ -89,7 +89,7 @@ case 0: case 1: device = device_find(tmpDev->devMajor,tmpDev->devMinor); - (void *)fd->start = tmpDev; + (void *)fd->fd->start = tmpDev; fd->size = device->devInfo->size; break; default: @@ -111,12 +111,12 @@ Description: Read File Into Data Notes: */ -static int devfs_read(fileDescriptor *fd,char *data,long offset,long size) { +static int devfs_read(struct file *fd,char *data,long offset,long size) { int i = 0x0,x = 0x0; uInt32 sectors = 0x0; uInt16 diff = 0x0; struct device_node *device = 0x0; - struct devfs_devices *tmpDev = (void *)fd->start; + struct devfs_devices *tmpDev = (void *)fd->fd->start; if (tmpDev == -1) { kprintf("Hi Ubie [%i]!!!\n", size); @@ -157,10 +157,10 @@ Notes: ************************************************************************/ -static int devfs_write(fileDescriptor *fd,char *data,long offset,long size) { +static int devfs_write(struct file *fd,char *data,long offset,long size) { int i = 0x0,x = 0x0; struct device_node *device = 0x0; - struct devfs_devices *tmpDev = (void *)fd->start; + struct devfs_devices *tmpDev = (void *)fd->fd->start; device = device_find(tmpDev->devMajor,tmpDev->devMinor); for (i=0x0;i<((size+511)/512);i++) { diff --git a/src/sys/include/sys/kern_descrip.h b/src/sys/include/sys/kern_descrip.h index aca6f92..260de8b 100644 --- a/src/sys/include/sys/kern_descrip.h +++ b/src/sys/include/sys/kern_descrip.h @@ -91,9 +91,17 @@ #define OFLAGS(fflags) ((fflags) - 1) struct file { - int f_flag; - char path[1024]; - fileDescriptor *fd; + struct vfs_mountPoint *mp; + u_int16_t status; + u_int16_t mode; + u_int32_t offset; + u_int32_t size; + u_int32_t perms; + int f_flag; + char *buffer; + char path[1024]; + fileDescriptor *fd; + void *fsObj; }; /* TEMP */ diff --git a/src/sys/include/ubixos/sched.h b/src/sys/include/ubixos/sched.h index 670b2f2..b5a279e 100644 --- a/src/sys/include/ubixos/sched.h +++ b/src/sys/include/ubixos/sched.h @@ -58,7 +58,7 @@ struct tssStruct tss; struct i387Struct i387; struct osInfo oInfo; - fileDescriptor *imageFd; + struct file *imageFd; tState state; uInt32 gid; uInt32 uid; @@ -88,6 +88,9 @@ /*** $Log$ + Revision 1.1.1.1 2007/01/17 03:31:52 reddawg + UbixOS + Revision 1.3 2006/12/15 15:43:46 reddawg Changes diff --git a/src/sys/include/ufs/ffs.h b/src/sys/include/ufs/ffs.h index d7f53af..bb14acf 100644 --- a/src/sys/include/ufs/ffs.h +++ b/src/sys/include/ufs/ffs.h @@ -33,8 +33,9 @@ #include #include #include +#include -int ffs_read(fileDescriptor *,char *,uInt32,long); +int ffs_read(struct file *,char *,uInt32,long); #endif diff --git a/src/sys/include/ufs/ufs.h b/src/sys/include/ufs/ufs.h index ddb1522..6b3d6a5 100644 --- a/src/sys/include/ufs/ufs.h +++ b/src/sys/include/ufs/ufs.h @@ -33,6 +33,7 @@ #include #include #include +#include #define DT_REG 8 diff --git a/src/sys/include/vfs/file.h b/src/sys/include/vfs/file.h index f03aaeb..e18a1a5 100644 --- a/src/sys/include/vfs/file.h +++ b/src/sys/include/vfs/file.h @@ -44,43 +44,36 @@ typedef struct fileDescriptorStruct { struct fileDescriptorStruct *prev; struct fileDescriptorStruct *next; - struct vfs_mountPoint *mp; - uInt16 status; - uInt16 mode; - uInt32 offset; - uInt32 size; uInt16 length; uInt32 start; - char fileName[512]; - char *buffer; uInt32 ino; struct cacheNode *cacheNode; - uInt32 perms; struct dmadat *dmadat; int dsk_meta; uInt32 resid; } fileDescriptor; +#include typedef struct userFileDescriptorStruct { - struct fileDescriptorStruct *fd; + struct file *fd; uInt32 fdSize; } userFileDescriptor; extern fileDescriptor *fdTable; -fileDescriptor *fopen(const char *,const char *); -int fclose(fileDescriptor *); +struct file *fopen(struct file *,const char *,const char *); +int fclose(struct file *); /* UBU */ int unlink(const char *path); -int feof(fileDescriptor *fd); -int fgetc(fileDescriptor *fd); -size_t fread(void *ptr,size_t size,size_t nmemb,fileDescriptor *fd); -size_t fwrite(void *ptr,int size,int nmemb,fileDescriptor *fd); -int fseek(fileDescriptor *,long,int); +int feof(struct file *fd); +int fgetc(struct file *fd); +size_t fread(void *ptr,size_t size,size_t nmemb,struct file *fd); +size_t fwrite(void *ptr,int size,int nmemb,struct file *fd); +int fseek(struct file *,long,int); void sysFseek(userFileDescriptor *,long,int); diff --git a/src/sys/kernel/elf.c b/src/sys/kernel/elf.c index 391062a..d15bb0c 100644 --- a/src/sys/kernel/elf.c +++ b/src/sys/kernel/elf.c @@ -116,9 +116,10 @@ u_int32_t base_addr = 0x0; elfHeader *binaryHeader = 0x0; elfProgramHeader *programHeader = 0x0; - fileDescriptor *exec_fd = 0x0; + struct file *exec_fd = 0x0; - exec_fd = fopen(file,"r"); + exec_fd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(exec_fd,file,"r"); if (exec_fd == 0x0) return(-1); kprintf("MOO"); diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 24f0f49..2e9409a 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -162,7 +162,7 @@ int x = 0x0; u_int32_t *tmp = 0x0; - fileDescriptor *tmpFd = 0x0; + struct file *tmpFd = 0x0; elfHeader *binaryHeader = 0x0; elfProgramHeader *programHeader = 0x0; @@ -189,7 +189,8 @@ ); /* Lets Find The File */ - tmpFd = fopen(file,"r"); + tmpFd = (struct file *)kmalloc(sizeof(struct file)); + fopen(tmpFd,file,"r"); /* If We Dont Find the File Return */ if (tmpFd == 0x0) { @@ -363,14 +364,15 @@ char **argvNew = 0x0; char *args = 0x0; - fileDescriptor *tmpFd = 0x0; + struct file *tmpFd = 0x0; elfHeader *binaryHeader = 0x0; elfProgramHeader *programHeader = 0x0; elfSectionHeader *sectionHeader = 0x0; elfDynamic *elfDynamicS = 0x0; struct i386_frame *iFrame = 0x0; - tmpFd = fopen(file,"r"); + tmpFd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(tmpFd,file,"r"); _current->imageFd = tmpFd; /* If We Dont Find the File Return */ if (tmpFd == 0x0) { @@ -587,7 +589,9 @@ struct i386_frame *iFrame = 0x0; Elf_Auxargs *auxargs = 0x0; - _current->imageFd = fopen(file,"r"); + + _current->imageFd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(_current->imageFd,file,"r"); if (_current->imageFd == 0x0) return(-1); diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index 0959ea3..456447c 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -56,7 +56,8 @@ elfPltInfo *elfRel = 0x0; /* Open our dynamic linker */ - ldFd = fopen("sys:/lib/ld.so","rb"); + ldFd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(ldFd,"sys:/lib/ld.so","rb"); if (ldFd == 0x0) { kprintf("Can not open ld.so\n"); diff --git a/src/sys/kmods/kmod.c b/src/sys/kmods/kmod.c index 10e0fcb..c93528e 100644 --- a/src/sys/kmods/kmod.c +++ b/src/sys/kmods/kmod.c @@ -81,7 +81,7 @@ char *shStr = 0x0; char *dynStr = 0x0; uInt32 *reMap = 0x0; - fileDescriptor *kmod_fd = 0x0; + struct file *kmod_fd = 0x0; elfHeader *binaryHeader = 0x0; elfProgramHeader *programHeader = 0x0; elfSectionHeader *sectionHeader = 0x0; @@ -89,7 +89,8 @@ elfPltInfo *elfRel = 0x0; /* Open kernel module */ - kmod_fd = fopen(kmod_file,"rb"); + kmod_fd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(kmod_fd,kmod_file,"rb"); if (kmod_fd == 0x0) { kprintf("Can not open %s\n",kmod_file); return 0x0; diff --git a/src/sys/ufs/ffs.c b/src/sys/ufs/ffs.c index 200508e..cf4395a 100644 --- a/src/sys/ufs/ffs.c +++ b/src/sys/ufs/ffs.c @@ -6,12 +6,13 @@ #include #include #include +#include -int ffs_read(fileDescriptor *fd,char *data,uInt32 offset,long size) { +int ffs_read(struct file *fd,char *data,uInt32 offset,long size) { struct fs *fs; - fs = (struct fs *)fd->dmadat->sbbuf; + fs = (struct fs *)fd->fd->dmadat->sbbuf; if (offset < fd->size && offset >= fs->fs_maxfilesize) { //return (EOVERFLOW); diff --git a/src/sys/ufs/ufs.c b/src/sys/ufs/ufs.c index d6edc81..6dca4e3 100644 --- a/src/sys/ufs/ufs.c +++ b/src/sys/ufs/ufs.c @@ -34,6 +34,7 @@ #include #include #include +#include #define VBLKSHIFT 12 #define VBLKSIZE (1 << VBLKSHIFT) @@ -48,7 +49,7 @@ #define INO_TO_VBO(ipervblk, x) ((x) % ipervblk) -static int dskread(void *buf, u_int64_t block,size_t count,fileDescriptor *fd) { +static int dskread(void *buf, u_int64_t block,size_t count,struct file *fd) { fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,buf,block,count); return(0x0); } @@ -74,7 +75,7 @@ #endif -static ssize_t fsread(ino_t inode, void *buf, size_t nbyte,fileDescriptor *fd) { +static ssize_t fsread(ino_t inode, void *buf, size_t nbyte,struct file *fd) { #ifndef UFS2_ONLY static struct ufs1_dinode dp1; #endif @@ -93,15 +94,15 @@ u_int u; - blkbuf = fd->dmadat->blkbuf; - indbuf = fd->dmadat->indbuf; - fs = (struct fs *)fd->dmadat->sbbuf; + blkbuf = fd->fd->dmadat->blkbuf; + indbuf = fd->fd->dmadat->indbuf; + fs = (struct fs *)fd->fd->dmadat->sbbuf; #ifdef DEBUG kprintf("fsread!\n"); #endif - if (!fd->dsk_meta) { + if (!fd->fd->dsk_meta) { inomap = 0; for (n = 0; sblock_try[n] != -1; n++) { if (dskread(fs, sblock_try[n] / DEV_BSIZE, 16,fd)) @@ -126,7 +127,7 @@ kprintf("Not ufs\n"); return -1; } - fd->dsk_meta++; + fd->fd->dsk_meta++; } if (!inode) { @@ -225,7 +226,7 @@ -static __inline int fsfind(const char *name, ino_t * ino,fileDescriptor *fd) { +static __inline int fsfind(const char *name, ino_t * ino,struct file *fd) { char buf[DEV_BSIZE]; struct dirent *d; char *s; @@ -247,7 +248,7 @@ } -static ino_t lookup(const char *path,fileDescriptor *fd) { +static ino_t lookup(const char *path,struct file *fd) { char name[MAXNAMLEN + 1]; const char *s; ino_t ino; @@ -283,27 +284,27 @@ } -static int ufs_openFile(const char *file, fileDescriptor *fd) { +static int ufs_openFile(const char *file,struct file *fd) { char tmp[2]; int ino = 0; - fd->dmadat = (struct dmadat *)kmalloc(sizeof(struct dmadat)); + fd->fd->dmadat = (struct dmadat *)kmalloc(sizeof(struct dmadat)); ino = lookup(file,fd); fd->offset = 0x0; - fd->ino = ino; + fd->fd->ino = ino; if (ino == 0x0) { return(-1); } /* Quick Hack for file size */ - fsread(fd->ino,&tmp,1,fd); + fsread(fd->fd->ino,&tmp,1,fd); fd->offset = 0; /* Return */ fd->perms = 0x1; return(0x1); } -int ufs_readFile(fileDescriptor *fd,char *data,uInt32 offset,long size) { - return(fsread(fd->ino,data,size,fd)); +int ufs_readFile(struct file *fd,char *data,uInt32 offset,long size) { + return(fsread(fd->fd->ino,data,size,fd)); } int ufs_writeFile(fileDescriptor *fd, char *data,uInt32 offset,long size) { diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index 77eec2f..7d32e04 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -55,9 +55,9 @@ } return; } - + void sysFgetc(int *ptr,userFileDescriptor *userFd) { - fileDescriptor *tmpFd = 0x0; + struct file *tmpFd = 0x0; tmpFd = userFd->fd; if (userFd->fd == 0x0) { while (1) { @@ -122,7 +122,8 @@ void sysFopen(const char *file,char *flags,userFileDescriptor *userFd) { if (userFd == NULL) kprintf("Error: userFd == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); - userFd->fd = fopen(file,flags); + userFd->fd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(userFd->fd,file,flags); if (userFd->fd != 0x0) { userFd->fdSize = userFd->fd->size; } @@ -175,7 +176,7 @@ /* KERNEL */ -size_t fread(void *ptr,size_t size,size_t nmemb,fileDescriptor *fd) { +size_t fread(void *ptr,size_t size,size_t nmemb,struct file *fd) { size_t i = 0x0; if (fd == 0x0) @@ -197,7 +198,7 @@ return(i); } -size_t fwrite(void *ptr,int size,int nmemb,fileDescriptor *fd) { +size_t fwrite(void *ptr,int size,int nmemb,struct file *fd) { if (fd != 0x0) { fd->mp->fs->vfsWrite(fd,ptr,fd->offset,size * nmemb); fd->offset += size * nmemb; @@ -205,7 +206,7 @@ return(0x0); } -int fseek(fileDescriptor *tmpFd,long offset,int whence) { +int fseek(struct file *tmpFd,long offset,int whence) { #ifdef DEBUG kprintf("FSEEK\n"); #endif @@ -220,7 +221,7 @@ Notes: ************************************************************************/ -int feof(fileDescriptor *fd) { +int feof(struct file *fd) { if (fd->status == fdEof) { return(-1); } @@ -234,7 +235,7 @@ Notes: ************************************************************************/ -int fputc(int ch,fileDescriptor *fd) { +int fputc(int ch,struct file *fd) { if (fd != 0x0) { ch = fd->mp->fs->vfsWrite(fd,(char *)ch,fd->offset,1); fd->offset++; @@ -243,15 +244,15 @@ /* Return NULL If FD Is Not Found */ return(0x0); } - + /************************************************************************ Function: int fgetc(fileDescriptor *fd) Description: This Will Return The Next Character In A FD Stream Notes: -************************************************************************/ -int fgetc(fileDescriptor *fd) { +************************************************************************/ +int fgetc(struct file *fd) { int ch = 0x0; /* If Found Return Next Char */ if (fd != 0x0) { @@ -274,19 +275,20 @@ ************************************************************************/ -fileDescriptor *fopen(const char *file,const char *flags) { +struct file *fopen(struct file *tmpFd,const char *file,const char *flags) { int i = 0x0; char *path = 0x0; char *mountPoint = 0x0; char fileName[1024]; - fileDescriptor *tmpFd = 0x0; /* Allocate Memory For File Descriptor */ - if((tmpFd = (fileDescriptor *)kmalloc(sizeof(fileDescriptor))) == 0x0) { + if(tmpFd == 0x0) { kprintf("Error: tmpFd == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); return(NULL); } + tmpFd->fd = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + strcpy(fileName,file); if (strstr(fileName,":")) { @@ -296,11 +298,11 @@ else { path = fileName; } - + if (path[0] == '/') - strcpy(tmpFd->fileName, path); + strcpy(tmpFd->path, path); else - sprintf(tmpFd->fileName,"/%s",path); + sprintf(tmpFd->path,"/%s",path); /* Find our mount point or set default to sys */ if (mountPoint == 0x0) @@ -339,7 +341,7 @@ } } /* Search For The File */ - if (tmpFd->mp->fs->vfsOpenFile(tmpFd->fileName,tmpFd) == 0x1) { + if (tmpFd->mp->fs->vfsOpenFile(tmpFd->path,tmpFd) == 0x1) { /* If The File Is Found Then Set Up The Descriptor */ @@ -350,31 +352,30 @@ { kfree(tmpFd); kprintf("Error: tmpFd->buffer == NULL, File: %s, Line: %i\n",__FILE__,__LINE__); - spinUnlock(&fdTable_lock); - return 0x1; + return(0x0); } /* Set Its Status To Open */ tmpFd->status = fdOpen; /* Initial File Offset Is Zero */ - tmpFd->offset = 0; - tmpFd->prev = 0x0; + tmpFd->offset = 0x0; + //tmpFd->prev = 0x0; /* we do not want to be in a spinlock longer than we need to, so it has been moved to here. */ - spinLock(&fdTable_lock); + //spinLock(&fdTable_lock); /* Increment Number Of Open Files */ systemVitals->openFiles++; - tmpFd->next = fdTable; + //tmpFd->next = fdTable; - if (fdTable != 0x0) - fdTable->prev = tmpFd; + //if (fdTable != 0x0) + //fdTable->prev = tmpFd; - fdTable = tmpFd; + //fdTable = tmpFd; - spinUnlock(&fdTable_lock); + //spinUnlock(&fdTable_lock); /* Return The FD */ return(tmpFd); @@ -382,7 +383,7 @@ else { kfree(tmpFd->buffer); kfree(tmpFd); - spinUnlock(&fdTable_lock); + //spinUnlock(&fdTable_lock); kprintf("File Not Found? %s\n",file); return (NULL); } @@ -398,10 +399,13 @@ Notes: ************************************************************************/ -int fclose(fileDescriptor *fd) { - fileDescriptor *tmpFd = 0x0; +int fclose(struct file *fd) { + struct file *tmpFd = 0x0; assert(fd); - +kprintf("must complete this!\n"); +//K_PANIC("HMM?"); + + /* spinLock(&fdTable_lock); for (tmpFd = fdTable;tmpFd != 0x0;tmpFd = tmpFd->next) { @@ -424,7 +428,9 @@ } spinUnlock(&fdTable_lock); - return(0x1); + + */ + return(0x0); } /* UBU */ @@ -437,7 +443,7 @@ ************************************************************************/ void sysMkDir(const char *path) { - fileDescriptor *tmpFD = 0x0; + struct file *tmpFD = 0x0; char tmpDir[1024]; char rootPath[256]; char *dir = 0x0;//UBU*mountPoint = 0x0; @@ -459,7 +465,8 @@ } //kprintf("rootPath: [%s]\n",rootPath); - tmpFD = fopen(rootPath,"rb"); + tmpFD = (struct fileDescriptorStruct *)kmalloc(sizeof(struct fileDescriptorStruct)); + fopen(tmpFD,rootPath,"rb"); if (tmpFD->mp == 0x0) { kprintf("Invalid Mount Point\n"); diff --git a/src/sys/vfs/vfs_syscalls.c b/src/sys/vfs/vfs_syscalls.c index 6708485..9672a02 100644 --- a/src/sys/vfs/vfs_syscalls.c +++ b/src/sys/vfs/vfs_syscalls.c @@ -54,10 +54,10 @@ K_PANIC("UNHANDLED WHENCE"); break; case SEEK_CUR: - fd->fd->offset += uap->offset; + fd->offset += uap->offset; break; case SEEK_SET: - fd->fd->offset = uap->offset; + fd->offset = uap->offset; break; default: kprintf("offset: [%i], whence: [%i]\n",uap->offset,uap->whence); @@ -65,7 +65,7 @@ break; } - td->td_retval[0] = fd->fd->offset; + td->td_retval[0] = fd->offset; return(error); } /* end func */ @@ -118,7 +118,7 @@ if (error) return(error); - count = fread(uap->buf,uap->nbyte,0x1,fd->fd); + count = fread(uap->buf,uap->nbyte,0x1,fd); } #ifdef VFSDEBUG @@ -205,7 +205,7 @@ while (1); } - nfp->fd = fopen(uap->path,"r"); + fopen(nfp,uap->path,"r"); if (nfp->fd == 0x0) td->td_retval[0] = -1; else diff --git a/src/sys/vmm/paging.c b/src/sys/vmm/paging.c index de288e6..6a87e55 100644 --- a/src/sys/vmm/paging.c +++ b/src/sys/vmm/paging.c @@ -514,8 +514,8 @@ tmp = (char *)vmmGetFreeVirtualPage_new(_current->id,(uap->len + 0xFFF)/0x1000,VM_TASK,uap->addr); } - fd->fd->offset = uap->pos; - fread(tmp,uap->len,0x1,fd->fd); + fd->offset = uap->pos; + fread(tmp,uap->len,0x1,fd); td->td_retval[0] = tmp; }