diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index ca2debe..09b3139 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.2 2004/04/26 22:22:33 reddawg + DevFS now uses correct size of device + Revision 1.1.1.1 2004/04/15 12:06:54 reddawg UbixOS v1.0 @@ -39,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -72,7 +75,7 @@ int devFSOpen(char *file,fileDescriptor *fd) { struct devFsInfo *fsInfo = fd->mp->fsInfo; struct devFsDevices *tmpDev = 0x0; - struct driveDriver *drive = 0x0; + struct deviceNode *device = 0x0; kprintf("Opening DevFS File [0x%X]\n",fsInfo->deviceList); for (tmpDev = fsInfo->deviceList;tmpDev != 0x0;tmpDev = tmpDev->next) { kprintf("[%s][%s]\n",tmpDev->devName,file); @@ -82,9 +85,9 @@ case 0: case 1: kprintf("Opened Device: [%s]\n",tmpDev->devName); - drive = findDrive(tmpDev->devMajor); + device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); (void *)fd->start = tmpDev; - (void *)fd->size = drive->size; + (void *)fd->size = device->size; break; default: kprintf("Invalid File Mode\n"); @@ -108,12 +111,12 @@ int i = 0x0,x = 0x0; uInt32 sectors = 0x0; uInt16 diff = 0x0; - struct driveDriver *drive = 0x0; + struct deviceNode *device = 0x0; struct devFsDevices *tmpDev = (void *)fd->start; kprintf("[0x%X]\n",tmpDev->devMajor); - drive = findDrive(tmpDev->devMajor); - kprintf("[0x%X][0x%X]\n",drive,drive->driveInfoStruct); + device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); + kprintf("[0x%X][0x%X]\n",device,device->info); kprintf("Reading From Device: [%s]\n",fd->fileName); @@ -124,7 +127,7 @@ kprintf("Sectors: [%i:%i]\n",sectors,diff); for (i=0x0;iread(drive->driveInfoStruct,i + (offset/512),1,fd->buffer); + device->read(device->info,fd->buffer,i + (offset/512),1); for (x=0x0;x<(size - (i*512));x++) { if (diff > 0) { data[x] = fd->buffer[x + diff]; @@ -149,20 +152,20 @@ ************************************************************************/ int devFSWrite(fileDescriptor *fd,char *data,long offset,long size) { int i = 0x0,x = 0x0; - struct driveDriver *drive = 0x0; + struct deviceNode *device = 0x0; struct devFsDevices *tmpDev = (void *)fd->start; kprintf("[0x%X]\n",tmpDev->devMajor); - drive = findDrive(tmpDev->devMajor); - kprintf("[0x%X][0x%X]\n",drive,drive->driveInfoStruct); + device = deviceFind(tmpDev->devMajor,tmpDev->devMinor); + kprintf("[0x%X][0x%X]\n",device,device->info); kprintf("Writing To Device: [%s]\n",fd->fileName); for (i=0x0;i<((size+511)/512);i++) { - drive->read(drive->driveInfoStruct,i + (offset/512),1,fd->buffer); + device->read(device->info,fd->buffer,i + (offset/512),1); for (x=0x0;((x < 512) && ((x + (i * 512)) < size));x++) { fd->buffer[x] = data[x]; } - drive->write(drive->driveInfoStruct,i + (offset/512),1,fd->buffer); + device->write(device->info,fd->buffer,i + (offset/512),1); data += 512; } return(size); diff --git a/src/sys/include/devfs/devfs.h b/src/sys/include/devfs/devfs.h index dd00da6..97d82b8 100644 --- a/src/sys/include/devfs/devfs.h +++ b/src/sys/include/devfs/devfs.h @@ -26,7 +26,6 @@ #include #include -#include struct devFsDevices { struct devFsDevices *next; diff --git a/src/sys/include/isa/fdc.h b/src/sys/include/isa/fdc.h index a036bc9..c8bad87 100644 --- a/src/sys/include/isa/fdc.h +++ b/src/sys/include/isa/fdc.h @@ -72,8 +72,8 @@ void reset(void); bool writeBlock(int block,byte *blockBuffer, unsigned long numSectors); bool readBlock(int block,byte *blockBuffer, unsigned long numSectors); -void fdcWrite(void *info,long startSector,long sectorCount,void *baseAddr); -void fdcRead(void *info,long startSector,long sectorCount,void *baseAddr); +void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount); +void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount); #endif diff --git a/src/sys/include/pci/hd.h b/src/sys/include/pci/hd.h index f484e50..15217a7 100644 --- a/src/sys/include/pci/hd.h +++ b/src/sys/include/pci/hd.h @@ -1,3 +1,5 @@ +#include + #ifndef _HD_H #define _HD_H @@ -13,6 +15,7 @@ struct driveInfo { + struct driveDiskLabel *diskLabel; char hdSector[512]; char hdEnable; char hdDev; @@ -27,8 +30,14 @@ void initHardDisk(); int initDrive(struct driveInfo *); -void hdWrite(struct driveInfo *hdd,long startSector,long sectorCount,void *baseAddr); -void hdRead(struct driveInfo *hdd,long startSector,long sectorCount,void *baseAddr); +void hdWrite(struct driveInfo *hdd,void *,uInt32,uInt32); +void hdRead(struct driveInfo *hdd,void *,uInt32,uInt32); +int hdReset(); +int hdIoctl(); +int hdStart(); +int hdStop(); +int hdStandby(); +int hdInit(); extern struct driveInfo *hdd0; extern struct driveInfo *hdd1; diff --git a/src/sys/include/sys/device.h b/src/sys/include/sys/device.h index fd1ec6a..08938bd 100644 --- a/src/sys/include/sys/device.h +++ b/src/sys/include/sys/device.h @@ -33,6 +33,7 @@ int major; int minor; uInt32 size; + void *info; void (*read)(void *,void *,uInt32,uInt32); void (*write)(void *,void *,uInt32,uInt32); void (*reset)(void *); diff --git a/src/sys/include/sys/drives.h b/src/sys/include/sys/drives.h deleted file mode 100644 index 9439aea..0000000 --- a/src/sys/include/sys/drives.h +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************************** - Copyright (c) 2002 The UbixOS Project - All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors. -Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors -in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its -contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Id$ - -**************************************************************************************/ - -#ifndef _DRIVES_H -#define _DRIVES_H - -#include - -#define MAXPARTITIONS 4 - -struct driveDiskLabel { - uInt32 magicNum; - uInt32 magicNum2; - uInt16 driveType; - uInt16 numPartitions; - struct drivePartitions { //the partition table - uInt32 pSize; //number of sectors in partition - uInt32 pOffset; //starting sector - uInt32 pFsSize; //filesystem basic fragment size - uInt32 pBatSize; //BAT size - uInt8 pFsType; //filesystem type, see below - uInt8 pFrag; //filesystem fragments per block - } partitions[MAXPARTITIONS]; - }; - -struct driveDriver { - struct driveDriver *prev; - struct driveDriver *next; - struct driveDiskLabel *diskLabel; - int id; - uInt32 size; - void *driveInfoStruct; - char driveType; - void (*read)(void *,long,long,void *); - void (*write)(void *,long,long,void *); - void (*reset)(void *); - }; - - -extern struct driveDriver *drives; -extern int currentDrive; - -void addDrive(int id,char type,void *driveInfoStruct,void *read,void *write,void *reset,uInt32 size); -struct driveDriver *findDrive(int id); - -#endif - diff --git a/src/sys/include/ubixfs/ubixfs.h b/src/sys/include/ubixfs/ubixfs.h index da67636..35a9cdd 100644 --- a/src/sys/include/ubixfs/ubixfs.h +++ b/src/sys/include/ubixfs/ubixfs.h @@ -25,11 +25,11 @@ #define _UBIXFS_H #include +#include #include -#include #define UBIXDISKMAGIC ((uInt32)0x45) /* The disk magic number */ -#define MAXUBIXPARTITIONS 16 +#define MAXPARTITIONS 4 #define blockSize 8 #define blockByteSize blockSize*512 @@ -45,19 +45,18 @@ struct ubixDiskLabel { uInt32 magicNum; uInt32 magicNum2; - uShort driveType; - uShort numPartitions; - struct ubixPartitions { //the partition table + uInt16 driveType; + uInt16 numPartitions; + struct drivePartitions { //the partition table uInt32 pSize; //number of sectors in partition uInt32 pOffset; //starting sector uInt32 pFsSize; //filesystem basic fragment size uInt32 pBatSize; //BAT size - uChar pFsType; //filesystem type, see below - uChar pFrag; //filesystem fragments per block - } partitions[MAXUBIXPARTITIONS]; + uInt8 pFsType; //filesystem type, see below + uInt8 pFrag; //filesystem fragments per block + } partitions[MAXPARTITIONS]; }; - struct partitionInformation { uInt32 size; //Size In Sectors uInt32 startSector; //Base Sector Of Partition diff --git a/src/sys/include/vfs/mount.h b/src/sys/include/vfs/mount.h index ce5114c..3fdb7f4 100644 --- a/src/sys/include/vfs/mount.h +++ b/src/sys/include/vfs/mount.h @@ -30,7 +30,8 @@ struct mountPoints *prev; struct mountPoints *next; struct fileSystem *fs; - struct driveDriver *drive; + struct deviceNode *device; + struct ubixDiskLabel *diskLabel; void *fsInfo; int partition; char mountPoint[1024]; diff --git a/src/sys/isa/fdc.c b/src/sys/isa/fdc.c index 8437ef6..a19c2c3 100644 --- a/src/sys/isa/fdc.c +++ b/src/sys/isa/fdc.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.3 2004/04/26 22:22:33 reddawg + DevFS now uses correct size of device + Revision 1.2 2004/04/22 21:20:05 reddawg FDC now adds drives to the devfs @@ -47,8 +50,9 @@ #include #include #include -#include +#include #include +#include static volatile bool done = FALSE; static drvGeom geometry = { dg144Heads,dg144Tracks,dg144Spt }; @@ -63,11 +67,17 @@ unsigned long tbaddr = 0x80000L; +int fdcInit2(struct deviceNode *dev) { + dev->size = (1024 * 1450); + return(0x0); + } + void fdcInit() { setVector(floppyIsr, mVec+6, (dInt+dPresent)); irqEnable(6); reset(); - addDrive(0,0,0x0,fdcRead,fdcWrite,0x0,(1024 * 1450)); + //addDevice(0,0,0x0,fdcRead,fdcWrite,0x0,(1024 * 1450)); + deviceAdd(0,0,'c',fdcRead,fdcWrite,0x0,fdcInit2,0x0,0x0,0x0,0x0,0x0); devFsMkNod("fd0",'b',0x0,0x0); return; } @@ -294,11 +304,11 @@ return; } -void fdcRead(void *info,long startSector,long sectorCount,void *baseAddr) { +void fdcRead(void *info,void *baseAddr,uInt32 startSector,uInt32 sectorCount) { readBlock(startSector,baseAddr,sectorCount); return; } -void fdcWrite(void *info,long startSector,long sectorCount,void *baseAddr){ +void fdcWrite(void *info,void *baseAddr,uInt32 startSector,uInt32 sectorCount){ writeBlock(startSector,baseAddr,sectorCount); return; } diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index c2475ff..3a490fd 100644 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.2 2004/04/15 21:00:01 reddawg + New Way To Wait + Revision 1.1.1.1 2004/04/15 12:07:19 reddawg UbixOS v1.0 @@ -137,7 +140,7 @@ } void sysGetDrives(uInt32 *ptr) { - *ptr = (uInt32)drives; + *ptr = 0x0;//(uInt32)devices; return; } diff --git a/src/sys/pci/hd.c b/src/sys/pci/hd.c index 807400b..6ff63f6 100644 --- a/src/sys/pci/hd.c +++ b/src/sys/pci/hd.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.3 2004/04/27 21:05:19 reddawg + Updating drivers to use new model + Revision 1.2 2004/04/26 22:22:33 reddawg DevFS now uses correct size of device @@ -41,7 +44,7 @@ #include #include -#include +#include #include #include #include @@ -66,12 +69,9 @@ hdd3->hdPort = 0x177; hdd3->hdDev = 0x50; if (!initDrive(hdd0)) { - addDrive(1,1,hdd0,hdRead,hdWrite,0x0,hdd0->hdSize*512); + //addDrive(1,1,hdd0,hdRead,hdWrite,0x0,hdd0->hdSize*512); + deviceAdd(1,0,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0); devFsMkNod("ad0",'c',0x1,0x0); - devFsMkNod("ad0s1",'c',0x1,0x1); - devFsMkNod("ad0s2",'c',0x1,0x2); - devFsMkNod("ad0s3",'c',0x1,0x3); - devFsMkNod("ad0s4",'c',0x1,0x4); } /* if (!initDrive(hdd1)) { @@ -86,6 +86,30 @@ */ return; } + +int hdInit() { + return(0x0); + } + +int hdStandby() { + return(0x0); + } + +int hdStart() { + return(0x0); + } + +int hdStop() { + return(0x0); + } + +int hdIoctl() { + return(0x0); + } + +int hdReset() { + return(0x0); + } int initDrive(struct driveInfo *hdd) { char retVal = 0x0; @@ -161,7 +185,7 @@ return(0); } -void hdWrite(struct driveInfo *hdd,long startSector,long sectorCount,void *baseAddr) { +void hdWrite(struct driveInfo *hdd,void *baseAddr,uInt32 startSector,uInt32 sectorCount) { long counter = 0x0; long retVal = 0x0; short transactionCount = 0x0; @@ -222,7 +246,7 @@ return; } -void hdRead(struct driveInfo *hdd,long startSector,long sectorCount,void *baseAddr) { +void hdRead(struct driveInfo *hdd,void *baseAddr,uInt32 startSector,uInt32 sectorCount) { long counter = 0x0; long retVal = 0x0; short transactionCount = 0x0; diff --git a/src/sys/sys/Makefile b/src/sys/sys/Makefile index 76e74cf..293a990 100644 --- a/src/sys/sys/Makefile +++ b/src/sys/sys/Makefile @@ -6,7 +6,7 @@ include ../Makefile.inc # Objects -OBJS = dma.o drives.o idt.o io.o video.o device.o +OBJS = dma.o idt.o io.o video.o device.o all: $(OBJS) diff --git a/src/sys/sys/drives.c b/src/sys/sys/drives.c deleted file mode 100644 index 8b71a38..0000000 --- a/src/sys/sys/drives.c +++ /dev/null @@ -1,79 +0,0 @@ -/***************************************************************************************** - Copyright (c) 2002 The UbixOS Project - All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions, the following disclaimer and the list of authors. Redistributions in binary -form must reproduce the above copyright notice, this list of conditions, the following -disclaimer and the list of authors in the documentation and/or other materials provided -with the distribution. Neither the name of the UbixOS Project nor the names of its -contributors may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Log$ - Revision 1.1.1.1 2004/04/15 12:07:17 reddawg - UbixOS v1.0 - - Revision 1.2 2004/04/13 16:36:34 reddawg - Changed our copyright, it is all now under a BSD-Style license - - - - $Id$ - -*****************************************************************************************/ - -#include -#include -#include - -struct driveDriver *drives = 0x0; -int currentDrive = 0x0; - -void addDrive(int id,char type,void *driveInfoStruct,void *read,void *write,void *reset,uInt32 size) { - struct driveDriver *tmp = 0x0; - tmp = (struct driveDriver *)kmalloc(sizeof(struct driveDriver),-2); - tmp->driveInfoStruct = driveInfoStruct; - tmp->read = read; - tmp->write = write; - tmp->reset = reset; - tmp->id = id; - tmp->driveType = type; - tmp->size = size; - if (!drives) { - tmp->next = 0x0; - tmp->prev = 0x0; - drives = tmp; - } - else { - tmp->next = drives; - tmp->prev = 0x0; - drives = tmp; - } - } - -struct driveDriver *findDrive(int id) { - struct driveDriver *tmp = 0x0; - for (tmp = drives;tmp;tmp=tmp->next) { - if (tmp->id == id) return(tmp); - } - return(0x0); - } - -/*** - END - ***/ - diff --git a/src/sys/ubixfs/block.c b/src/sys/ubixfs/block.c index 914c1cf..15b6b8a 100644 --- a/src/sys/ubixfs/block.c +++ b/src/sys/ubixfs/block.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:07:07 reddawg + UbixOS v1.0 + Revision 1.3 2004/04/13 16:36:34 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -41,7 +44,7 @@ void syncBat(struct mountPoints *mp) { struct ubixFsInfo *fsInfo = mp->fsInfo; - mp->drive->write(mp->drive->driveInfoStruct,mp->drive->diskLabel->partitions[mp->partition].pOffset,mp->drive->diskLabel->partitions[mp->partition].pBatSize,fsInfo->blockAllocationTable); + mp->device->write(mp->device->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize); } int freeBlocks(int block,fileDescriptor *fd) { diff --git a/src/sys/ubixfs/directory.c b/src/sys/ubixfs/directory.c index 6f2d5f0..cb4b8f0 100644 --- a/src/sys/ubixfs/directory.c +++ b/src/sys/ubixfs/directory.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:07:07 reddawg + UbixOS v1.0 + Revision 1.6 2004/04/13 16:36:34 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -86,7 +89,7 @@ entry->permissions = 0xEAA; sprintf(entry->fileName,directory); - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector,blockSize,dir); + fd->mp->device->write(fd->mp->device->info,dir,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector,blockSize); addDirEntry(entry,fd); kfree(dir); kfree(entry); diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index 14e1b86..648ba56 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:07:08 reddawg + UbixOS v1.0 + Revision 1.31 2004/04/13 16:36:34 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -37,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -60,20 +63,24 @@ void initUbixFS(struct mountPoints *mp) { struct ubixFsInfo *fsInfo = 0x0; - mp->drive->diskLabel = (struct driveDiskLabel *)kmalloc(512,-2); - mp->drive->read(mp->drive->driveInfoStruct,1,1,mp->drive->diskLabel); + mp->diskLabel = (struct ubixDiskLabel *)kmalloc(512,sysID); + kprintf("A"); + mp->device->read(mp->device->info,mp->diskLabel,1,1); + kprintf("B"); mp->fsInfo = (struct ubixFsInfo *)kmalloc(sizeof(struct ubixFsInfo),-2); fsInfo = mp->fsInfo; - if ((mp->drive->diskLabel->magicNum == UBIXDISKMAGIC) && (mp->drive->diskLabel->magicNum2 == UBIXDISKMAGIC)) { - fsInfo->blockAllocationTable = (struct blockAllocationTableEntry *)kmalloc(mp->drive->diskLabel->partitions[mp->partition].pBatSize*512,-2); + if ((mp->diskLabel->magicNum == UBIXDISKMAGIC) && (mp->diskLabel->magicNum2 == UBIXDISKMAGIC)) { + fsInfo->blockAllocationTable = (struct blockAllocationTableEntry *)kmalloc(mp->diskLabel->partitions[mp->partition].pBatSize*512,-2); /* fsInfo->blockAllocationTable[0].nextBlock = 100; */ - fsInfo->batEntries = ((mp->drive->diskLabel->partitions[mp->partition].pBatSize*512)/sizeof(struct blockAllocationTableEntry)); - mp->drive->read(mp->drive->driveInfoStruct,mp->drive->diskLabel->partitions[mp->partition].pOffset,mp->drive->diskLabel->partitions[mp->partition].pBatSize,fsInfo->blockAllocationTable); - kprintf("Offset: [%i], Partition: [%i]\n",mp->drive->diskLabel->partitions[mp->partition].pOffset,mp->partition); + fsInfo->batEntries = ((mp->diskLabel->partitions[mp->partition].pBatSize*512)/sizeof(struct blockAllocationTableEntry)); + kprintf("C"); + mp->device->read(mp->device->info,fsInfo->blockAllocationTable,mp->diskLabel->partitions[mp->partition].pOffset,mp->diskLabel->partitions[mp->partition].pBatSize); + kprintf("Offset: [%i], Partition: [%i]\n",mp->diskLabel->partitions[mp->partition].pOffset,mp->partition); kprintf("UbixFS Initialized\n"); } else { kprintf("Insert System Disk!\n"); + while (1); initUbixFS(mp); } /* Return */ @@ -84,7 +91,7 @@ int x=0; struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(4096,_current->id); struct ubixFsInfo *fsInfo = fd->mp->fsInfo; - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8,dirEntry); + fd->mp->device->read(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8); if ((fd->mode & fileRead) == fileRead) { for (x=0;x<(4096/sizeof(struct directoryEntry));x++) { if ((int)!kstrcmp(dirEntry[x].fileName,file)) { @@ -116,7 +123,7 @@ fd->size = 0x0; fd->start = dirEntry[x].startCluster; fd->dirBlock = 0x0; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8,dirEntry); + fd->mp->device->write(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8); kfree(dirEntry); return(0x1); } @@ -136,7 +143,7 @@ blockCount = (offset/4096); /* Find The Block If It Doesn't Exist We Will Have To Allocate One */ - for (i=0x0;i<=fd->mp->drive->diskLabel->partitions[fd->mp->partition].pBatSize;i++) { + for (i=0x0;i<=fd->mp->diskLabel->partitions[fd->mp->partition].pBatSize;i++) { batIndex = fsInfo->blockAllocationTable[batIndexPrev].nextBlock; if (batIndex == 0x0) { break; @@ -161,26 +168,26 @@ } /* fd->mp->drive->read(fd->mp->drive->driveInfoStruct,diskLabel->partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd->buffer); */ fd->buffer[offset-(blockCount*4096)] = ch; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8,fd->buffer); + fd->mp->device->write(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); } else { if (fd->status != fdRead) { - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8,fd->buffer); + fd->mp->device->read(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); fd->status = fdRead; } fd->buffer[offset-(blockCount*4096)] = ch; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8,fd->buffer); + fd->mp->device->write(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8); } if (offset > fd->size) { fd->size = offset; dirEntry = (struct directoryEntry *)kmalloc(4096,-2); - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8,dirEntry); + fd->mp->device->read(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); for (i=0x0;i<(4096/sizeof(struct directoryEntry));i++) { if ((int)!kstrcmp(dirEntry[i].fileName,fd->fileName)) break; } dirEntry[i].size = fd->size; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8,dirEntry); + fd->mp->device->write(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8); kfree(dirEntry); } return(ch); @@ -209,7 +216,7 @@ } } /* If The File Size Is Greater Then The Offset Lets Goto Work */ - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize,fd->buffer); + fd->mp->device->read(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize); for (i=0x0;i fd->size) { /* Set File EOF If There Is Nothing To Do */ @@ -222,7 +229,7 @@ offset++; if (offset%4096 == 0 && offset != size) { batIndex = fsInfo->blockAllocationTable[batIndex].nextBlock; - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize,fd->buffer); + fd->mp->device->read(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize); blockCount++; } } @@ -263,7 +270,7 @@ } } - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize,fd->buffer); + fd->mp->device->read(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); for (i = 0x0;i < size;i++) { fd->buffer[(offset- (blockOffset *0x1000))] = data[i]; @@ -271,7 +278,7 @@ if (offset%4096 == 0x0) { blockOffset++; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize,fd->buffer); + fd->mp->device->write(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); if (fsInfo->blockAllocationTable[blockIndex].nextBlock == EOBC) { blockIndexPrev = blockIndex; @@ -281,23 +288,23 @@ } else { blockIndex = fsInfo->blockAllocationTable[blockIndex].nextBlock; - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize,fd->buffer); + fd->mp->device->read(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); } } } - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize,fd->buffer); + fd->mp->device->write(fd->mp->device->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize); if (offset > fd->size) { fd->size = offset; dirEntry = (struct directoryEntry *)kmalloc(4096,-2); - fd->mp->drive->read(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize,dirEntry); + fd->mp->device->read(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); for (i=0x0;i<(4096/sizeof(struct directoryEntry));i++) { if ((int)!kstrcmp(dirEntry[i].fileName,fd->fileName)) break; } dirEntry[i].size = fd->size; dirEntry[i].startCluster = fd->start; - fd->mp->drive->write(fd->mp->drive->driveInfoStruct,(fd->mp->drive->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize,dirEntry); + fd->mp->device->write(fd->mp->device->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize); kfree(dirEntry); } /* Return */ @@ -309,13 +316,13 @@ struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x1000,_current->id); struct ubixFsInfo *fsInfo = mp->fsInfo; - mp->drive->read(mp->drive->driveInfoStruct,(mp->drive->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8,dirEntry); + mp->device->read(mp->device->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8); for (x=0;x<(4096/sizeof(struct directoryEntry));x++) { if ((int)!kstrcmp(dirEntry[x].fileName,path)) { dirEntry[x].attributes |= typeDeleted; dirEntry[x].fileName[0] = '?'; - mp->drive->write(mp->drive->driveInfoStruct,(mp->drive->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8,dirEntry); + mp->device->write(mp->device->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[0].realSector),8); return; } } diff --git a/src/sys/vfs/mount.c b/src/sys/vfs/mount.c index 50cc742..c8245b1 100644 --- a/src/sys/vfs/mount.c +++ b/src/sys/vfs/mount.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.1.1.1 2004/04/15 12:06:53 reddawg + UbixOS v1.0 + Revision 1.4 2004/04/13 16:36:34 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -38,7 +41,7 @@ #include #include #include -#include +#include /************************************************************************ @@ -50,8 +53,8 @@ ************************************************************************/ int mount(int driveId,int partition,int vfsType,char *mountPoint,char *perms) { - struct mountPoints *mp = 0x0; - struct driveDriver *drive = 0x0; + struct mountPoints *mp = 0x0; + struct deviceNode *device = 0x0; /* Allocate Memory For Mount Point */ mp = (struct mountPoints *)kmalloc(sizeof(struct mountPoints),sysID); @@ -60,10 +63,10 @@ sprintf(mp->mountPoint,mountPoint); /* Set Pointer To Physical Drive */ - drive = findDrive(driveId); + device = deviceFind(driveId,0x0); /* Set Up Mp Defaults */ - mp->drive = drive; + mp->device = device; mp->fs = vfsFindFS(vfsType); mp->partition = partition; mp->perms = *perms;