- Main Page
- Namespaces
- Data Structures
- Files
- Directories

- Search for |

- File List
- Globals

# file.h

Go to the documentation of this file.

    00001 /**************************************************************************************
    00002  Copyright (c) 2002 The UbixOS Project
    00003  All rights reserved.
    00004
    00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
    00006
    00007 Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
    00008 Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
    00009 in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its
    00010 contributors may be used to endorse or promote products derived from this software without specific prior written permission.
    00011
    00012 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
    00013 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    00014 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    00015 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
    00016 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
    00017 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    00018 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00019
    00020  $Id: include_2vfs_2file_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    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               /* log2(DEV_BSIZE) */
    00037 #define      DEV_BSIZE       (1<<DEV_BSHIFT)
    00038
    00039 struct dmadat {
    00040   char blkbuf[VBLKSIZE];  /* filesystem blocks */
    00041   char indbuf[VBLKSIZE];  /* indir blocks */
    00042   char sbbuf[SBLOCKSIZE]; /* superblock */
    00043   char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
    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 /* UBU */
    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 //Good
    00090 void sysChDir(const char *path);
    00091 void chDir(const char *path);
    00092 char *verifyDir(const char *path);
    00093
    00094 #endif