00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _FILE_H
00025 #define _FILE_H
00026
00027 #include <ubixos/types.h>
00028 #include <ubixfs/dirCache.h>
00029 #include <vfs/mount.h>
00030
00031 #define SEEK_SET 0x0
00032
00033 #define VBLKSHIFT 12
00034 #define VBLKSIZE (1 << VBLKSHIFT)
00035 #define SBLOCKSIZE 8192
00036 #define DEV_BSHIFT 9
00037 #define DEV_BSIZE (1<<DEV_BSHIFT)
00038
00039 struct dmadat {
00040 char blkbuf[VBLKSIZE];
00041 char indbuf[VBLKSIZE];
00042 char sbbuf[SBLOCKSIZE];
00043 char secbuf[DEV_BSIZE];
00044 };
00045
00046 typedef struct fileDescriptorStruct {
00047 struct fileDescriptorStruct *prev;
00048 struct fileDescriptorStruct *next;
00049 struct vfs_mountPoint *mp;
00050 uInt16 status;
00051 uInt16 mode;
00052 uInt32 offset;
00053 uInt32 size;
00054 uInt16 length;
00055 uInt32 start;
00056 char fileName[512];
00057 char *buffer;
00058 uInt32 ino;
00059 struct cacheNode *cacheNode;
00060 uInt32 perms;
00061 struct dmadat *dmadat;
00062 int dsk_meta;
00063 uInt32 resid;
00064 } fileDescriptor;
00065
00066
00067 typedef struct userFileDescriptorStruct {
00068 struct fileDescriptorStruct *fd;
00069 uInt32 fdSize;
00070 } userFileDescriptor;
00071
00072 extern fileDescriptor *fdTable;
00073
00074 fileDescriptor *fopen(const char *,const char *);
00075 int fclose(fileDescriptor *);
00076
00077
00078
00079
00080 int unlink(const char *path);
00081 int feof(fileDescriptor *fd);
00082 int fgetc(fileDescriptor *fd);
00083 size_t fread(void *ptr,size_t size,size_t nmemb,fileDescriptor *fd);
00084 size_t fwrite(void *ptr,int size,int nmemb,fileDescriptor *fd);
00085 int fseek(fileDescriptor *,long,int);
00086
00087 void sysFseek(userFileDescriptor *,long,int);
00088
00089
00090 void sysChDir(const char *path);
00091 void chDir(const char *path);
00092 char *verifyDir(const char *path);
00093
00094 #endif