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

- Search for |

- File List
- Globals

# ubixfs.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: include_2ubixfs_2ubixfs_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _UBIXFS_H
    00031 #define _UBIXFS_H
    00032
    00033 #include <ubixos/types.h>
    00034 #include <vfs/vfs.h>
    00035 #include <sys/device.h>
    00036 #include <mpi/mpi.h>
    00037 #include <ubixfs/dirCache.h>
    00038
    00039
    00040 #define UBIXFS_BLOCKSIZE_BYTES     blockSize*512
    00041 #define UBIXFS_ALIGN(size) (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES)))))
    00042
    00043 #define UBIXDISKMAGIC     ((uInt32)0x45) /* The disk magic number */
    00044 #define MAXUBIXPARTITIONS 16
    00045 #define blockSize         8
    00046
    00047
    00048 #define EOBC              -1
    00049
    00050
    00051 #define typeFile      1
    00052 #define typeContainer 2
    00053 #define typeDirectory 4
    00054 #define typeDeleted   8
    00055
    00056 /* Start */
    00057 struct directoryList {
    00058   char                  dirName[256];
    00059   char                 *dirCache;
    00060   uInt32                dirBlock;
    00061   struct directoryList *next;
    00062   struct directoryList *prev;
    00063   };
    00064
    00065 typedef struct directoryList * dirList_t;
    00066
    00067 dirList_t ubixFSLoadDir(char *);
    00068 /* End   */
    00069
    00070 //Partition Information
    00071 struct ubixDiskLabel {
    00072   uInt32 magicNum;
    00073   uInt32 magicNum2;
    00074   uInt16 driveType;
    00075   uInt16 numPartitions;
    00076   struct  ubixPartitions {  //the partition table
    00077     uInt32 pSize;            //number of sectors in partition
    00078     uInt32 pOffset;          //starting sector
    00079     uInt32 pFsSize;          //filesystem basic fragment size
    00080     uInt32 pBatSize;         //BAT size
    00081     uInt8 pFsType;          //filesystem type, see below
    00082     uInt8 pFrag;            //filesystem fragments per block
    00083     } partitions[MAXUBIXPARTITIONS];
    00084   };
    00085
    00086
    00087 struct partitionInformation {
    00088   uInt32 size;                 //Size In Sectors
    00089   uInt32 startSector;          //Base Sector Of Partition
    00090   uInt32 blockAllocationTable; //Base Sector Of BAT
    00091   uInt32 rootDirectory;        //Base Sector Of Root Directory
    00092   };
    00093
    00094 //Block Allocation Table Entry
    00095 struct blockAllocationTableEntry {
    00096   long attributes; //Block Attributes
    00097   long realSector; //Real Sector
    00098   long nextBlock;  //Sector Of Next Block
    00099   long reserved;   //Reserved
    00100   };
    00101
    00102 //UbixFS Directory Entry
    00103 struct directoryEntry {
    00104   uInt32  startCluster;   //Starting Cluster Of File
    00105   uInt32  size;           //Size Of File
    00106   uInt32  creationDate;  //Date Created
    00107   uInt32  lastModified;  //Date Last Modified
    00108   uInt32  uid;           //UID Of Owner
    00109   uInt32  gid;           //GID Of Owner
    00110   uInt16 attributes;    //Files Attributes
    00111   uInt16 permissions;   //Files Permissions
    00112   char   fileName[256]; //File Name
    00113   };
    00114
    00115 struct bootSect {
    00116   uInt8 jmp[4];
    00117   uInt8 id[6];
    00118   uInt16 version;
    00119   uInt16 tmp;
    00120   uInt16 fsStart;
    00121   uInt16 tmp2;
    00122   uInt32 krnl_start;
    00123   uInt BytesPerSector;
    00124   uInt SectersPerTrack;
    00125   uInt TotalHeads;
    00126   uInt32 TotalSectors;
    00127   uInt8 code[479];
    00128   };
    00129
    00130 struct ubixFSInfo {
    00131   struct blockAllocationTableEntry *blockAllocationTable;
    00132   struct cacheNode * dirCache;
    00133   uInt32 batEntries;
    00134   uInt32 rootDir;
    00135 }; /* ubixFSInfo */
    00136
    00137 int readFile(char *file);
    00138 int writeFileByte(int ch,fileDescriptor *fd,long offset);
    00139 //int openFileUbixFS(char *file,fileDescriptor *fd);
    00140 int getFreeBlocks(int count,fileDescriptor *fd);
    00141 //extern struct ubixDiskLabel *diskLabel;
    00142
    00143 //Good Functions
    00144 //void initUbixFS(struct mountPoints *mp);
    00145
    00146 int readUbixFS(fileDescriptor *fd,char *data,uInt32,long size);
    00147 int writeUbixFS(fileDescriptor *fd,char *data,long offset,long size);
    00148 void syncBat(struct vfs_mountPoint *mp);
    00149 int freeBlocks(int block,fileDescriptor *fd);
    00150 int addDirEntry(struct directoryEntry *dir,fileDescriptor *fd);
    00151 void ubixFSUnlink(char *path,struct vfs_mountPoint *mp);
    00152 int ubixFSmkDir(char *dir,fileDescriptor *fd);
    00153
    00154 int  ubixfs_init();
    00155 int  ubixfs_initialize();
    00156 void ubixfs_thread();
    00157
    00158
    00159 #endif
    00160
    00161 /***
    00162  $Log: include_2ubixfs_2ubixfs_8h-source.html,v $
    00162  Revision 1.4  2006/12/06 04:40:59  reddawg
    00162  More syscalls implimented
    00162
    00163  Revision 1.2  2006/12/05 14:10:21  reddawg
    00164  Workign Distro
    00165
    00166  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
    00167  ubix2
    00168
    00169  Revision 1.2  2005/10/12 00:13:37  reddawg
    00170  Removed
    00171
    00172  Revision 1.1.1.1  2005/09/26 17:23:53  reddawg
    00173  no message
    00174
    00175  Revision 1.21  2004/09/14 20:57:01  reddawg
    00176  Bug fixes: macro problem over opt a multiply
    00177
    00178  Revision 1.20  2004/08/01 17:58:39  flameshadow
    00179  chg: fixed string allocation bug in ubixfs_cacheNew()
    00180
    00181  Revision 1.19  2004/07/27 12:02:01  reddawg
    00182  chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much
    00183
    00184  Revision 1.18  2004/07/23 09:10:06  reddawg
    00185  ubixfs: cleaned up some functions played with the caching a bit
    00186  vfs:    renamed a bunch of functions
    00187  cleaned up a few misc bugs
    00188
    00189  Revision 1.17  2004/07/22 22:37:03  reddawg
    00190  Caching is working now the FS is extremely fast but needs to be optimized to do 32bit copies over 8bit
    00191
    00192  Revision 1.16  2004/07/20 21:28:16  flameshadow
    00193  oops
    00194
    00195  Revision 1.14  2004/07/20 19:36:49  reddawg
    00196  UBU Tags
    00197
    00198  Revision 1.13  2004/07/14 12:21:49  reddawg
    00199  ubixfs: enableUbixFs to ubixfs_init
    00200  Changed Startup Routines
    00201
    00202  END
    00203  ***/