diff --git a/src/bin/init/main.c b/src/bin/init/main.c index fae25b6..e883fa7 100644 --- a/src/bin/init/main.c +++ b/src/bin/init/main.c @@ -58,7 +58,7 @@ i = fork(); if (0 == i) { printf("Starting Ubix Registry (ubistry)\n"); - exec("ubistry@sys",0x0,0x0); + exec("sys:/ubistry",0x0,0x0); printf("Error: Error Starting ubistry\n"); exit(-1); } @@ -70,7 +70,7 @@ i = fork(); if (0 == i) { printf("Starting Login Daemon.\n"); - exec("login@sys",0x0,0x0); + exec("sys:/login",0x0,0x0); printf("Error Starting System\n"); exit(-1); } @@ -97,6 +97,12 @@ /*** $Log$ + Revision 1.11 2004/06/04 13:29:56 reddawg + libc: modified mkdir(); interface + kpanic: kPanic(); now says kPanic: %s + system: now reboots when receives message for reboot + also when command start sde is received by system the STD is started + Revision 1.10 2004/05/26 13:11:41 reddawg Makefile: adjust all the Makefile to strip binaries to conserve floppy space diff --git a/src/bin/login/main.c b/src/bin/login/main.c index 4204364..11881f7 100644 --- a/src/bin/login/main.c +++ b/src/bin/login/main.c @@ -68,11 +68,11 @@ exit(-1); } data = (struct passwd *)malloc(4096); - if (!(fd = fopen("userdb@sys","r"))) { + if (!(fd = fopen("sys:/userdb","r"))) { printf("Error Opening File"); memcpy(data[0].username,"root",4); memcpy(data[0].password,"user",4); - memcpy(data[0].shell,"shell@sys", 10); + memcpy(data[0].shell,"sys:/shell", 10); } else { fread(data,4096,1,fd); @@ -96,7 +96,7 @@ if (setgid(data[i].gid) != 0x0) { printf("Set GID Failed\n"); } - if ((fd = fopen("motd@sys","r")) == 0x0) { + if ((fd = fopen("sys:/motd","r")) == 0x0) { printf("No MOTD"); } else { @@ -105,7 +105,7 @@ } fclose(fd); //chdir(data[i].path); - chdir(":"); + chdir("sys:/"); exec(data[i].shell,0x0,0x0); printf("Error: Problem Starting Shell\n"); exit(-1); diff --git a/src/bin/shell/main.c b/src/bin/shell/main.c index f95db5e..2342de7 100644 --- a/src/bin/shell/main.c +++ b/src/bin/shell/main.c @@ -46,7 +46,7 @@ sprintf(cwc,"sys"); while (1) { - printf("%s-%s@%s> ",machine,cwd,cwc); + printf("%s@%s:%s> ",machine,cwc,cwd); gets((char *)buffer); data = (uInt8 *)buffer; parseInput(inBuf,data); diff --git a/src/lib/objgfx40/objgfx40.cpp b/src/lib/objgfx40/objgfx40.cpp index e4ba6d2..8c45481 100644 --- a/src/lib/objgfx40/objgfx40.cpp +++ b/src/lib/objgfx40/objgfx40.cpp @@ -15,7 +15,7 @@ extern "C" { #include #include - #include + #include #include #include } @@ -2208,15 +2208,9 @@ * use this method unless YOU KNOW WHAT YOU'RE DOING!!!!!!!!! */ -#ifdef __UBIXOS_KERNEL__ - kmemcpy( (uInt8*)buffer+lineOfs[dy]+dx*bytesPerPix, // dest - src, // src - size); // size -#else memcpy( (uInt8*)buffer+lineOfs[dy]+dx*bytesPerPix, // dest src, // src size); // size -#endif return; } // ogSurface::ogCopyLineTo @@ -2244,15 +2238,9 @@ * use this method unless YOU KNOW WHAT YOU'RE DOING!!!!!!!!! */ -#ifdef __UBIXOS_KERNEL__ - kmemcpy( dst, // dest - (uInt8*)buffer+lineOfs[sy]+sx*bytesPerPix, // src - size); // size -#else memcpy( dst, // dest (uInt8*)buffer+lineOfs[sy]+sx*bytesPerPix, // src size); // size -#endif return; } // ogSurface::ogCopyLineFrom @@ -2798,11 +2786,7 @@ void ogSurface::ogGetPalette(ogRGBA8 _pal[256]) { -#ifdef __UBIXOS_KERNEL__ - kmemcpy(_pal, pal, sizeof(_pal)); -#else memcpy(_pal, pal, sizeof(_pal)); -#endif return; } // ogSurface::ogGetPalette @@ -3529,11 +3513,7 @@ void ogSurface::ogSetPalette(const ogRGBA8 newPal[256]) { if (pal == NULL) return; -#ifdef __UBIXOS_KERNEL__ - kmemcpy(pal, newPal, sizeof(pal)); -#else memcpy(pal, newPal, sizeof(pal)); -#endif return; } // ogSurface::ogSetPalette diff --git a/src/lib/objgfx40/ogFont.cpp b/src/lib/objgfx40/ogFont.cpp index 83bdea4..70e1ccb 100644 --- a/src/lib/objgfx40/ogFont.cpp +++ b/src/lib/objgfx40/ogFont.cpp @@ -2,10 +2,11 @@ #include extern "C" { - #include #ifdef __UBIXOS_KERNEL__ #include + #include #else + #include #include #include #endif @@ -39,15 +40,9 @@ } ogBitFont::ogBitFont(void) { -#ifdef __UBIXOS_KERNEL__ - kmemset(fontDataIdx, 0, sizeof(fontDataIdx)); - kmemset(charWidthTable, 0, sizeof(charWidthTable)); - kmemset(charHeightTable, 0, sizeof(charHeightTable)); -#else memset(fontDataIdx, 0, sizeof(fontDataIdx)); memset(charWidthTable, 0, sizeof(charWidthTable)); memset(charHeightTable, 0, sizeof(charHeightTable)); -#endif fontData = NULL; fontDataSize = 0; @@ -86,15 +81,9 @@ } // ogBitFont::SetFGColor ogBitFont::~ogBitFont(void) { -#ifdef __UBIXOS_KERNEL__ - kmemset(fontDataIdx, 0, sizeof(fontDataIdx)); - kmemset(charWidthTable, 0, sizeof(charWidthTable)); - kmemset(charHeightTable, 0, sizeof(charHeightTable)); -#else memset(fontDataIdx, 0, sizeof(fontDataIdx)); memset(charWidthTable, 0, sizeof(charWidthTable)); memset(charHeightTable, 0, sizeof(charHeightTable)); -#endif delete [] fontData; fontData = NULL; fontDataSize = 0; @@ -169,15 +158,9 @@ if (numOfChars == 0) numOfChars = 256; startingChar = header.startingChar; -#ifdef __UBIXOS_KERNEL__ - kmemset(fontDataIdx, 0, sizeof(fontDataIdx)); - kmemset(charWidthTable, 0, sizeof(charWidthTable)); - kmemset(charHeightTable, 0, sizeof(charHeightTable)); -#else memset(fontDataIdx, 0, sizeof(fontDataIdx)); memset(charWidthTable, 0, sizeof(charWidthTable)); memset(charHeightTable, 0, sizeof(charHeightTable)); -#endif size = (((uInt32)width+7) / 8)*(uInt32)height; fontDataSize = size* (uInt32)numOfChars; @@ -301,11 +284,7 @@ unsigned char ch; if (textString == NULL) return; -#ifdef __UBIXOS_KERNEL__ - if (0 == kstrlen(textString)) return; -#else if (0 == strlen(textString)) return; -#endif if (!dest.ogAvail()) return; text = (const unsigned char *)textString; diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index f5e981f..d771976 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.9 2004/05/26 11:55:25 reddawg + devfs: Added spin locks to fix some possible reentrant issues + Revision 1.8 2004/05/19 15:31:27 reddawg Fixed up the rest of the references @@ -103,7 +106,7 @@ spinLock(&devfsSpinLock); for (tmpDev = fsInfo->deviceList;tmpDev != 0x0;tmpDev = tmpDev->next) { - if (kstrcmp(tmpDev->devName,file) == 0x0) { + if (strcmp(tmpDev->devName,file) == 0x0) { switch ((fd->mode & 0x3)) { case 0: case 1: diff --git a/src/sys/include/lib/string.h b/src/sys/include/lib/string.h index 731ee2e..9587ebf 100644 --- a/src/sys/include/lib/string.h +++ b/src/sys/include/lib/string.h @@ -36,15 +36,16 @@ extern "C" { #endif -int kstrcmp(char *str1, char *str2); -int kstrncmp(const char * a, const char * b, size_t c); -void *kmemcpy(const void *dst, const void * src, size_t length); -void *kmemset(void * dst, int c, size_t length); -int kstrlen(const char * string); -int kmemcmp(const void * dst, const void * src, size_t length); -void kstrncpy(char * dest, const char * src, size_t size); +int strcmp(char *str1, char *str2); +int strncmp(const char * a, const char * b, size_t c); +void *memcpy(const void *dst, const void * src, size_t length); +void *memset(void * dst, int c, size_t length); +int strlen(const char * string); +int memcmp(const void * dst, const void * src, size_t length); +void strncpy(char * dest, const char * src, size_t size); char *strtok(char *str, const char *sep); char *strtok_r(char *str, const char *sep, char **last); +char *strstr(const char *s,char *find); int sprintf(char *buf,const char *fmt, ...); @@ -56,6 +57,9 @@ /*** $Log$ + Revision 1.2 2004/05/21 15:00:27 reddawg + Cleaned up + END ***/ diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 0e9a764..f5c2d5d 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -168,8 +168,8 @@ } */ execThread(systemTask,(uInt32)(kmalloc(0x2000)+0x2000),0x0); - execFile("init",0x0,0x0,0x0); - //execFile("shell",0x0,0x0,0x0); + execFile("sys:/init",0x0,0x0,0x0); + //execFile("sys:/shell",0x0,0x0,0x0); kprintf("Free Pages: [%i]\n",freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); kprintf("Starting Os\n"); @@ -223,6 +223,9 @@ /*** $Log$ + Revision 1.34 2004/06/25 17:25:52 reddawg + I am cleaning too + Revision 1.33 2004/06/25 13:16:23 reddawg Made kernel stack static to prevent corruptions diff --git a/src/sys/kernel/exec.c b/src/sys/kernel/exec.c index 58e9f01..a3643d5 100644 --- a/src/sys/kernel/exec.c +++ b/src/sys/kernel/exec.c @@ -34,6 +34,7 @@ #include #include #include +#include /***************************************************************************************** @@ -203,7 +204,7 @@ if (vmmRemapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr & 0xFFFFF000) + x)) == 0x0) { kpanic("Error: vmmFindFreePage Failed\n"); } - kmemset(((programHeader[i].phVaddr & 0xFFFFF000) + x),0x0,0x1000); + memset((void *)((programHeader[i].phVaddr & 0xFFFFF000) + x),0x0,0x1000); } _current->oInfo.vmStart = ((programHeader[i].phVaddr & 0xFFFFF000) + 0x1900000); /* Now Load Section To Memory */ @@ -398,7 +399,7 @@ */ for (x=0;x<(programHeader[i].phMemsz+4095);x+=0x1000) { vmmRemapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr & 0xFFFFF000) + x)); - kmemset(((programHeader[i].phVaddr & 0xFFFFF000) + x),0x0,0x1000); + memset((void *)((programHeader[i].phVaddr & 0xFFFFF000) + x),0x0,0x1000); } _current->oInfo.vmStart = ((programHeader[i].phVaddr & 0xFFFFF000) + 0x1900000); /* Now Load Section To Memory */ @@ -444,6 +445,9 @@ /*** $Log$ + Revision 1.39 2004/06/18 15:29:38 reddawg + zero out memory + Revision 1.38 2004/06/18 15:18:04 reddawg bug fixes: did some double checking on pointers and 0x0 out memory diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index 3eadd8a..d035dbc 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -86,7 +86,7 @@ */ for (x=0;x < ((programHeader[i].phMemsz)+4095);x += 0x1000) { vmmRemapPage(vmmFindFreePage(_current->id),((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START)); - kmemset(((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),0x0,0x1000); + memset(((programHeader[i].phVaddr & 0xFFFFF000) + x + LD_START),0x0,0x1000); } /* Now Load Section To Memory */ fseek(ldFd,programHeader[i].phOffset,0x0); @@ -101,7 +101,7 @@ for (i=0x0;ieShnum;i++) { switch (sectionHeader[i].shType) { case 3: - if (!kstrcmp((shStr + sectionHeader[i].shName),".dynstr")) { + if (!strcmp((shStr + sectionHeader[i].shName),".dynstr")) { dynStr = (char *)kmalloc(sectionHeader[i].shSize); fseek(ldFd,sectionHeader[i].shOffset,0x0); fread(dynStr,sectionHeader[i].shSize,1,ldFd); @@ -157,6 +157,9 @@ /*** $Log$ + Revision 1.26 2004/06/18 15:18:05 reddawg + bug fixes: did some double checking on pointers and 0x0 out memory + Revision 1.25 2004/06/17 13:16:55 reddawg debug: removed all dead debug code diff --git a/src/sys/kernel/smp.c b/src/sys/kernel/smp.c index b708b3f..3763bf0 100644 --- a/src/sys/kernel/smp.c +++ b/src/sys/kernel/smp.c @@ -235,7 +235,7 @@ uInt32 tmp; kprintf("Copying %u bytes from 0x%x to 0x00\n",ap_trampoline_end - ap_trampoline_start,ap_trampoline_start); - kmemcpy(0x0,(char *)ap_trampoline_start,ap_trampoline_end - ap_trampoline_start); + memcpy(0x0,(char *)ap_trampoline_start,ap_trampoline_end - ap_trampoline_start); apicWrite(0x280,0); apicRead(0x280); @@ -287,6 +287,9 @@ /*** $Log$ + Revision 1.3 2004/05/15 02:30:28 reddawg + Lots of changes + END ***/ diff --git a/src/sys/kernel/systemtask.c b/src/sys/kernel/systemtask.c index 95d5196..abd34dd 100644 --- a/src/sys/kernel/systemtask.c +++ b/src/sys/kernel/systemtask.c @@ -64,11 +64,11 @@ kprintf("system: backdoor opened\n"); break; case 0x80: - if (!kstrcmp(myMsg.data,"sdeStart")) { + if (!strcmp(myMsg.data,"sdeStart")) { kprintf("Starting SDE\n"); execThread(sdeThread,(uInt32)(kmalloc(0x2000)+0x2000),0x0); } - else if (!kstrcmp(myMsg.data,"freePage")) { + else if (!strcmp(myMsg.data,"freePage")) { kprintf("Free Page: %i\n",systemVitals->freePages); } break; @@ -84,6 +84,9 @@ /*** $Log$ + Revision 1.2 2004/06/25 17:25:52 reddawg + I am cleaning too + Revision 1.1 2004/06/04 17:33:33 reddawg Changed idle task to system task diff --git a/src/sys/lib/net.c b/src/sys/lib/net.c index 1b9376e..ef76884 100644 --- a/src/sys/lib/net.c +++ b/src/sys/lib/net.c @@ -24,6 +24,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Log$ + Revision 1.4 2004/06/17 03:14:59 flameshadow + chg: added missing #include for kprintf() + Revision 1.3 2004/05/20 22:54:02 reddawg Cleaned Up Warrnings @@ -74,11 +77,11 @@ } void bcopy(const void *src, void *dest, int len) { - kmemcpy(dest,src,len); + memcpy(dest,src,len); } void bzero(void *data, int n) { - kmemset(data, 0, n); + memset(data, 0, n); } diff --git a/src/sys/lib/string.c b/src/sys/lib/string.c index 1b8f456..236f0b2 100644 --- a/src/sys/lib/string.c +++ b/src/sys/lib/string.c @@ -29,7 +29,7 @@ #include -int kstrcmp(char *str1, char *str2) { +int strcmp(char *str1, char *str2) { while ((*str1 == *str2) && (*str1 != 0x0) && (*str2 != 0x0)) { str1++; str2++; @@ -45,7 +45,7 @@ } } -int kstrncmp(const char * a, const char * b, size_t c) { +int strncmp(const char * a, const char * b, size_t c) { int i = 0; while (i < c) { if ((a[i] != b[i]) || (a[i] == '\0') || (b[i] == '\0')) @@ -57,7 +57,7 @@ -void *kmemcpy(const void *dst, const void * src, size_t length) { +void *memcpy(const void *dst, const void * src, size_t length) { size_t x = length >> 2; size_t y = length & 0xf; size_t i; @@ -74,7 +74,7 @@ } -void *kmemset(void * dst, int c, size_t length) { +void *memset(void * dst, int c, size_t length) { size_t x = length >> 2; size_t y = length & 0xf; size_t i; @@ -89,7 +89,7 @@ return dst; } -int kstrlen(const char * string) { +int strlen(const char * string) { int i = 0; while (1) { @@ -100,7 +100,7 @@ return 0; } -int kmemcmp(const void * dst, const void * src, size_t length) +int memcmp(const void * dst, const void * src, size_t length) { size_t x = length >> 2; size_t y = length & 0xf; @@ -125,7 +125,7 @@ return 0; } -void kstrncpy(char * dest, const char * src, size_t size) +void strncpy(char * dest, const char * src, size_t size) { if (size == 0) return; @@ -138,8 +138,29 @@ while(('\0' != *(src-1)) && (size)); } +char *strstr(const char *s,char *find) { + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); + } + + /*** $Log$ + Revision 1.2 2004/05/19 14:40:58 reddawg + Cleaned up some warning from leaving out typedefs + Revision 1.1.1.1 2004/04/15 12:07:11 reddawg UbixOS v1.0 diff --git a/src/sys/lib/vsprintf.c b/src/sys/lib/vsprintf.c index c922052..d8c2cbd 100644 --- a/src/sys/lib/vsprintf.c +++ b/src/sys/lib/vsprintf.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:11 reddawg + UbixOS v1.0 + Revision 1.3 2004/04/13 16:36:33 reddawg Changed our copyright, it is all now under a BSD-Style license @@ -200,7 +203,7 @@ case 's': s = vaArg(args, char *); - len = kstrlen(s); + len = strlen(s); if (precision < 0) precision = len; else if (len > precision) diff --git a/src/sys/mpi/message.c b/src/sys/mpi/message.c index 4ce9880..3bb41a7 100644 --- a/src/sys/mpi/message.c +++ b/src/sys/mpi/message.c @@ -48,7 +48,7 @@ mpiMbox_t *mbox = 0x0; for (mbox = mboxList;mbox;mbox = mbox->next) { - if (!kstrcmp(mbox->name,name)) { + if (!strcmp(mbox->name,name)) { spinUnlock(&mpiSpinLock); return(mbox); } @@ -117,7 +117,7 @@ message = (mpiMessage_t *)kmalloc(sizeof(mpiMessage_t)); message->type = type; - kmemcpy(message->data,data,MESSAGE_LENGTH); + memcpy(message->data,data,MESSAGE_LENGTH); message->next = 0x0; if (mbox->msg == 0x0) { @@ -158,7 +158,7 @@ message = (mpiMessage_t *)kmalloc(sizeof(mpiMessage_t)); message->type = type; - kmemcpy(message->data,data,MESSAGE_LENGTH); + memcpy(message->data,data,MESSAGE_LENGTH); message->next = 0x0; if (mbox->msg == 0x0) { @@ -206,7 +206,7 @@ } msg->type = mbox->msg->type; - kmemcpy(msg->data,mbox->msg->data,MESSAGE_LENGTH); + memcpy(msg->data,mbox->msg->data,MESSAGE_LENGTH); tmpMsg = mbox->msg; mbox->msg = mbox->msg->next; @@ -232,7 +232,7 @@ spinLock(&mpiSpinLock); for (mbox = mboxList;mbox;mbox=mbox->next) { - if (!kstrcmp(mbox->name,name)) { + if (!strcmp(mbox->name,name)) { if (mbox->pid != _current->id) { spinUnlock(&mpiSpinLock); return(-1); @@ -251,6 +251,9 @@ /*** $Log$ + Revision 1.9 2004/05/26 15:34:29 reddawg + mpi: oops forgot a spinUnlock + Revision 1.8 2004/05/26 11:58:37 reddawg mpi: Fixed security now the pid used at time of mpiCreateMbox is the only pid allowed to do mpiFetchMessage and mpiDestroyMbox against that mail box diff --git a/src/sys/net/net/bot.c b/src/sys/net/net/bot.c index ba945fb..8b03ac1 100644 --- a/src/sys/net/net/bot.c +++ b/src/sys/net/net/bot.c @@ -44,7 +44,7 @@ #include "net/stats.h" static void sendstr(const char *str, struct netconn *conn) { - netconn_write(conn, (void *)str, kstrlen(str), NETCONN_NOCOPY); + netconn_write(conn, (void *)str, strlen(str), NETCONN_NOCOPY); } static void botErr() { diff --git a/src/sys/net/net/shell.c b/src/sys/net/net/shell.c index 920fd71..f9dd39e 100644 --- a/src/sys/net/net/shell.c +++ b/src/sys/net/net/shell.c @@ -55,7 +55,7 @@ static struct netconn *conns[NCONNS]; static void sendstr(const char *str, struct netconn *conn) { - netconn_write(conn, (void *)str, kstrlen(str), NETCONN_NOCOPY); + netconn_write(conn, (void *)str, strlen(str), NETCONN_NOCOPY); } static void prompt(struct netconn *conn) { diff --git a/src/sys/ubixfs/directory.c b/src/sys/ubixfs/directory.c index bf0a426..b9791f5 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.6 2004/06/04 13:20:22 reddawg + ubixFSmkDir(): played with it a bit to see if it still worked + Revision 1.5 2004/06/04 10:19:42 reddawg notes: we compile again, thank g-d anyways i was about to cry @@ -76,7 +79,7 @@ dirList = tmpDir; } - if (!kstrcmp(":",data)) { + if (!strcmp(":",data)) { tmpDir->dirCache = (char *)kmalloc(0x4000); } @@ -101,7 +104,7 @@ else { fd->offset = 0x0; } - kmemcpy(&tmp[i],dir,sizeof(struct directoryEntry)); + memcpy(&tmp[i],dir,sizeof(struct directoryEntry)); if (writeUbixFS(fd,(char *)tmp,fd->offset,fd->size) == 0x0) { kprintf("Error Creating Directory\n"); @@ -116,17 +119,25 @@ struct directoryEntry *dir = 0x0; struct directoryEntry *entry = 0x0; struct ubixFSInfo *fsInfo = fd->mp->fsInfo; + + kprintf("Creating Directory: %s",directory); block = getFreeBlocks(1,fd); if (block != 0x0) { + kprintf("A\n"); dir = (struct directoryEntry *)kmalloc(blockByteSize); + kprintf("B\n"); entry = (struct directoryEntry *)kmalloc(sizeof(struct directoryEntry)); + kprintf("HMM?\n"); entry->startCluster = block; entry->size = blockByteSize; - entry->attributes = 0x8000; + entry->attributes = typeDirectory; entry->permissions = 0xEAA; sprintf(entry->fileName,directory); + + dir->attributes = typeDirectory; + sprintf(dir->fileName,"Test Entry"); fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dir,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[block].realSector,blockSize); addDirEntry(entry,fd); diff --git a/src/sys/ubixfs/ubixfs.c b/src/sys/ubixfs/ubixfs.c index 72d2da2..d82d71c 100644 --- a/src/sys/ubixfs/ubixfs.c +++ b/src/sys/ubixfs/ubixfs.c @@ -82,10 +82,12 @@ int x=0; struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); struct ubixFSInfo *fsInfo = fd->mp->fsInfo; + if (file[0] == '/' && file[1] != '\0') + file++; fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),(0x4000/512)); if ((fd->mode & fileRead) == fileRead) { for (x=0;x<(0x4000/sizeof(struct directoryEntry));x++) { - if ((int)!kstrcmp(dirEntry[x].fileName,file)) { + if ((int)!strcmp(dirEntry[x].fileName,file)) { fd->start = dirEntry[x].startCluster; fd->size = dirEntry[x].size; fd->perms = dirEntry[x].permissions; @@ -97,7 +99,7 @@ } else if ((fd->mode & fileWrite) == fileWrite) { for (x=0;x<(0x4000/sizeof(struct directoryEntry));x++) { - if (!kstrcmp(dirEntry[x].fileName,file)) { + if (!strcmp(dirEntry[x].fileName,file)) { fd->start = dirEntry[x].startCluster; fd->size = dirEntry[x].size; fd->perms = dirEntry[x].permissions; @@ -174,7 +176,7 @@ dirEntry = (struct directoryEntry *)kmalloc(4096); fd->mp->device->devInfo->read(fd->mp->device->devInfo->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)) + if ((int)!strcmp(dirEntry[i].fileName,fd->fileName)) break; } dirEntry[i].size = fd->size; @@ -290,7 +292,7 @@ dirEntry = (struct directoryEntry *)kmalloc(4096); fd->mp->device->devInfo->read(fd->mp->device->devInfo->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)) + if ((int)!strcmp(dirEntry[i].fileName,fd->fileName)) break; } dirEntry[i].size = fd->size; @@ -310,7 +312,7 @@ mp->device->devInfo->read(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); for (x=0;x<(4096/sizeof(struct directoryEntry));x++) { - if ((int)!kstrcmp(dirEntry[x].fileName,path)) { + if ((int)!strcmp(dirEntry[x].fileName,path)) { dirEntry[x].attributes |= typeDeleted; dirEntry[x].fileName[0] = '?'; mp->device->devInfo->write(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8); @@ -323,6 +325,9 @@ /*** $Log$ + Revision 1.13 2004/06/28 18:12:44 reddawg + We need these files + Revision 1.12 2004/06/28 11:57:58 reddawg Fixing Up Filesystem diff --git a/src/sys/vfs/file.c b/src/sys/vfs/file.c index b274826..4afe93d 100644 --- a/src/sys/vfs/file.c +++ b/src/sys/vfs/file.c @@ -81,48 +81,31 @@ Notes: ************************************************************************/ -int sysMkDir(const char *path) { - fileDescriptor *tmpFd = 0x0; +void sysMkDir(const char *path) { + fileDescriptor *tmpFD = 0x0; + char rootPath[256]; char *dir = 0x0,*mountPoint = 0x0; + rootPath[0] = '\0'; + dir = (char *)path; + while (strstr(path,"/")) { + if (rootPath[0] == 0x0) + sprintf(rootPath,"%s/",strtok(dir,"/")); + else + sprintf(rootPath,"%s/%s",rootPath,strtok(dir,"/")); + dir = strtok(NULL,"\n"); + } + kprintf("rootPath: [%s]\n",rootPath); + tmpFD = fopen(rootPath,"rb"); - - /* Allocate Memory For File Descriptor */ - tmpFd = (fileDescriptor *)kmalloc(sizeof(fileDescriptor)); - tmpFd->mode = fileRead; + if (tmpFD->mp == 0x0) { + kprintf("Invalid Mount Point\n"); + } + tmpFD->mp->fs->vfsMakeDir(dir,tmpFD); - dir = (char *)strtok((char *)path,"@"); - mountPoint = strtok(NULL,"\n"); + fclose(tmpFD); - if (mountPoint == 0x0) { - tmpFd->mp = _current->oInfo.container; - } - else { - tmpFd->mp = findMount(mountPoint); - } - if (tmpFd->mp == 0x0) { - kpanic("Invalid Container\n"); - return(0x1); - } - if (tmpFd->mp->fs->vfsOpenFile(":",tmpFd) == 1) { - tmpFd->buffer = (char *)kmalloc(4096); - sprintf(tmpFd->fileName,"%s",":"); - /* Set Its Status To Open */ - tmpFd->status = fdOpen; - /* Initial File Offset Is Zero */ - tmpFd->offset = 0x0; - } - else { - return(0x0); - } - if (tmpFd->mp->fs->vfsMakeDir(dir,tmpFd) != 0x0) { - kpanic("Error Creating Directory\n"); - } - else { - kpanic("Made Directory\n"); - } - kfree(tmpFd->buffer); - kfree(tmpFd); - return(0x0); + kprintf("Dir: %s,Mount Point: %s\n",dir,mountPoint); + return; } @@ -171,9 +154,13 @@ char *path = 0x0,*mountPoint = 0x0; /* Allocate Memory For File Descriptor */ tmpFd = (fileDescriptor *)kmalloc(sizeof(fileDescriptor)); + if (strstr(file,":")) { + mountPoint = (char *)strtok((char *)file,":"); + path = strtok(NULL,"\n"); + } + else + path = file; - path = (char *)strtok((char *)file,"@"); - mountPoint = strtok(NULL,"\n"); if (mountPoint == 0x0) { tmpFd->mp = findMount("sys"); /* _current->oInfo.container; */ } @@ -211,7 +198,7 @@ i++; } /* Search For The File */ - if (tmpFd->mp->fs->vfsOpenFile((char *)file,tmpFd) == 1) { + if (tmpFd->mp->fs->vfsOpenFile((char *)path,tmpFd) == 1) { /* If The File Is Found Then Set Up The Descriptor */ tmpFd->buffer = (char *)kmalloc(4096); sprintf(tmpFd->fileName,"%s",file); @@ -250,6 +237,9 @@ /*** $Log$ + Revision 1.5 2004/06/16 19:56:35 reddawg + Moved fclose + Revision 1.4 2004/06/14 12:20:54 reddawg notes: many bugs repaired and ld works 100% now. diff --git a/src/sys/vfs/mount.c b/src/sys/vfs/mount.c index 0553e4a..51bf273 100644 --- a/src/sys/vfs/mount.c +++ b/src/sys/vfs/mount.c @@ -126,7 +126,7 @@ struct mountPoints *tmpMp = 0x0; for (tmpMp=systemVitals->mountPoints;tmpMp;tmpMp=tmpMp->next) { - if (kstrcmp(tmpMp->mountPoint,mountPoint) == 0x0) { + if (strcmp(tmpMp->mountPoint,mountPoint) == 0x0) { return(tmpMp); } } @@ -136,6 +136,9 @@ /*** $Log$ + Revision 1.6 2004/05/19 15:22:50 reddawg + Fixed reference issues due to changes in driver subsystem + Revision 1.5 2004/05/19 04:07:43 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been diff --git a/src/tools/format.c b/src/tools/format.c index 7763c40..8de1291 100644 --- a/src/tools/format.c +++ b/src/tools/format.c @@ -61,7 +61,7 @@ dirEntry[0].uid = 0x0; dirEntry[0].startCluster = 0x0; dirEntry[0].size = 0x4000; - sprintf(dirEntry[0].fileName,":"); + sprintf(dirEntry[0].fileName,"/"); dirEntry[1].attributes = typeDirectory; dirEntry[1].permissions = 0xEAA; dirEntry[1].gid = 0x0; diff --git a/src/tools/userdb b/src/tools/userdb index 2b1853e..af82415 100644 --- a/src/tools/userdb +++ b/src/tools/userdb Binary files differ