UbixOS V2 2.0

ubixfs.c
Go to the documentation of this file.
1 /*****************************************************************************************
2 Copyright (c) 2002-2004 The UbixOS Project
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification, are
6 permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions, the following disclaimer and the list of authors. Redistributions in binary
10 form must reproduce the above copyright notice, this list of conditions, the following
11 disclaimer and the list of authors in the documentation and/or other materials provided
12 with the distribution. Neither the name of the UbixOS Project nor the names of its
13 contributors may be used to endorse or promote products derived from this software
14 without specific prior written permission.
15
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
17 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26 $Id: ubixfs.c 79 2016-01-11 16:21:27Z reddawg $
27
28 *****************************************************************************************/
29
30 #include <ubixfs/ubixfs.h>
31 #include <ubixfs/dirCache.h>
32 #include <vfs/vfs.h>
33 #include <ubixos/sched.h>
34 #include <ubixos/kpanic.h>
35 #include <ubixos/exec.h>
36 #include <lib/kmalloc.h>
37 #include <string.h>
38 #include <lib/kprintf.h>
39 #include <assert.h>
40
41 /* Static defines */
42 static int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex);
43
44
45 static int openFileUbixFS(const char *file, fileDescriptor_t *fd) {
46 //int x = 0;
47 /* mji struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x4000); */
48 struct cacheNode * cacheNode = NULL;
49 //struct directoryEntry * dirEntry = NULL;
50 struct ubixFSInfo *fsInfo = fd->mp->fsInfo;
51
52
53
54 /* kprintf("openFileUbixFS(%s), cwd: %s\n", file, _current->oInfo.cwd); */
55
56 //if (fsInfo->dirCache == NULL) kprintf("dirCache is null!\n");
57 assert(fd);
58 assert(fd->mp);
59 assert(fd->mp->device);
60 assert(fd->mp->device->devInfo);
61 assert(fd->mp->device->devInfo->read);
62 assert(fsInfo);
63 assert(fsInfo->dirCache);
64 assert(file);
65
66 if ((fd->mode & fileRead) == fileRead) {
67 do {
68 cacheNode = ubixfs_cacheFind(fsInfo->dirCache,(char *) file);
69 if (cacheNode == NULL) return 0;
70 if (cacheNode->present == 1) break;
71 assert(cacheNode->size);
72 if (*cacheNode->size != 0 && cacheNode->info == NULL) {
73 //kprintf("caching name(size): %s(%d)\n",cacheNode->name,*cacheNode->size);
74 cacheNode->info = kmalloc(UBIXFS_ALIGN(*cacheNode->size));
75 fd->size = *cacheNode->size;
76 assert(cacheNode->startCluster);
77 ubixfs_loadData(fd,
78 cacheNode->info,
79 *cacheNode->size,
80 *cacheNode->startCluster);
81 cacheNode->present = 1;
82 } /* if */
83 } while(1);
84
85 assert(cacheNode);
86 if (cacheNode == NULL) return 0; /* this should be caught above */
87
88 fd->start = *cacheNode->startCluster;
89 fd->size = *cacheNode->size;
90 fd->perms = *cacheNode->permissions;
91 fd->cacheNode = cacheNode; /* Directory Start Sector */
92 /*
93 if (cacheNode->size != 0x0 && cacheNode->info == NULL) {
94 cacheNode->info = kmalloc(UBIXFS_ALIGN(*cacheNode->size));
95 ubixfs_loadData(fd,cacheNode->info,cacheNode->size,cacheNode->startCluster);
96 cacheNode->present = 0x1;
97 }
98 */
99 return(0x1);
100 }
101 else
102 if ((fd->mode & fileWrite) == fileWrite) {
103 kprintf("Ouch! in filewrite!\n");
104 #if 0
105 fd->start = dirEntry->startCluster;
106 fd->size = dirEntry->size;
107 fd->perms = dirEntry->permissions;
108 // fd->dirBlock = 0x0; /* Directory Start Sector */
109 #endif
110 return(0x1);
111 }
112
113 return 0;
114
115 }
116
117 int writeFileByte(int ch, fileDescriptor_t *fd, long offset) {
118
119 int blockCount = 0x0,batIndex = 0x0,batIndexPrev = 0x0;
120 uInt32 i = 0x0;
121 struct directoryEntry *dirEntry = 0x0;
122 struct ubixFSInfo *fsInfo = NULL;
123
124 assert(fd);
125 assert(fd->mp);
126 assert(fd->mp->diskLabel);
127
128 batIndexPrev = fd->start;
129 fsInfo = fd->mp->fsInfo;
130
131 /* Find Out How Many Blocks Long This File Is */
132 blockCount = (offset/4096);
133
134 /* Find The Block If It Doesn't Exist We Will Have To Allocate One */
135 for (i=0x0; i <= fd->mp->diskLabel->partitions[fd->mp->partition].pBatSize;
136 i++) {
137 batIndex = fsInfo->blockAllocationTable[batIndexPrev].nextBlock;
138 if (batIndex == 0x0) {
139 break;
140 }
141 batIndexPrev = batIndex;
142 }
143
144 if ((offset%4096 == 0) && (fd->status == fdRead)) {
145 fd->status = fdOpen;
146 }
147
148 /* If batIndex == 0x0 Then We Must Allocate A New Block */
149 if (batIndex == 0x0) {
150 for (i=1;i < fsInfo->batEntries;i++) {
151 if (fsInfo->blockAllocationTable[i].attributes == 0x0) {
152 fsInfo->blockAllocationTable[batIndexPrev].nextBlock = i;
153 fsInfo->blockAllocationTable[batIndex].nextBlock = -1;
154 batIndex = i;
155 fd->start = i;
156 break;
157 }
158 }
159 /* fd->mp->drive->read(fd->mp->drive->driveInfoStruct,diskLabel->partitions[0].pOffset+blockAllocationTable[batIndex].realSector,8,fd->buffer); */
160 fd->buffer[offset-(blockCount*4096)] = ch;
161 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
162 }
163 else {
164 if (fd->status != fdRead) {
165 fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
166 fd->status = fdRead;
167 }
168 fd->buffer[offset-(blockCount*4096)] = ch;
169 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,8);
170 }
171 if ((uInt32)offset > fd->size) {
172 fd->size = offset;
173 dirEntry = (struct directoryEntry *)kmalloc(4096);
174 /*
175 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);
176 */
177 for (i=0x0;i<(4096/sizeof(struct directoryEntry));i++) {
178 if ((int)!strcmp(dirEntry[i].fileName,fd->fileName))
179 break;
180 }
181 dirEntry[i].size = fd->size;
182 /*
183 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),8);
184 */
185 kfree(dirEntry);
186 }
187 return(ch);
188 }
189
190 /* Verified Functions */
191
192
193 int readUbixFS(fileDescriptor_t *fd,char *data,uInt32 offset,long size) {
194 int i = 0x0;
195 char *buffer = 0x0;
196 struct ubixFSInfo *fsInfo = NULL;
197
198 assert(fd);
199 assert(fd->mp);
200 assert(fd->mp->fsInfo);
201
202 fsInfo = fd->mp->fsInfo;
203
204 if (fd->cacheNode->present != 1)
205 kpanic("ERROR with cache node\n");
206
207 buffer = (char *)fd->cacheNode->info;
208
209 for (i=0x0; i<size; i++) {
210 if (offset > fd->size) {
211 /* Set File EOF If There Is Nothing To Do */
212 /* data[i] = '\0'; Is this safe? */
213 fd->status = fdEof;
214 return(size);
215 }
216 /* Copy Data From Buffer To Data */
217 data[i] = buffer[i + offset];
218 }
219 /* Return */
220 return(size);
221 }
222
223
224 /************************************************************************
225
226 Function: int writeUbixFS(fileDescriptor_t *fd,char *data,long offset,long size)
227 Description: Write Data Into File
228 Notes:
229
230 ************************************************************************/
231 int writeUbixFS(fileDescriptor_t *fd,char *data,long offset,long size) {
232 uInt32 blockOffset = 0x0;
233 uInt32 blockIndex;
234 uInt32 blockIndexPrev;
235 uInt32 i = 0x0;
236 struct ubixFSInfo *fsInfo = NULL;
237 struct directoryEntry *dirEntry = 0x0;
238
239 assert(fd);
240 assert(fd->mp);
241 assert(fd->mp->fsInfo);
242 assert(fd->mp->device);
243 assert(fd->mp->device->devInfo);
244
245 blockIndex = blockIndexPrev = fd->start;
246 fsInfo = fd->mp->fsInfo;
247
248 blockOffset = (offset/0x1000);
249
250 if (fd->size != 0x0) {
251 for (i = 0x0;i < blockOffset;i++) {
252 blockIndex = fsInfo->blockAllocationTable[blockIndexPrev].nextBlock;
253 if ((int)blockIndex == EOBC) {
254 blockIndex = getFreeBlocks(1,fd);
255 fsInfo->blockAllocationTable[blockIndexPrev].nextBlock = blockIndex;
256 fsInfo->blockAllocationTable[blockIndex].nextBlock = EOBC;
257 break;
258 }
259 blockIndexPrev = blockIndex;
260 }
261 }
262
263 fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
264 for (i = 0x0;i < (uInt32)size;i++) {
265
266 fd->buffer[(offset- (blockOffset *0x1000))] = data[i];
267 offset++;
268
269 if (offset%4096 == 0x0) {
270 blockOffset++;
271 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
272
273 if (fsInfo->blockAllocationTable[blockIndex].nextBlock == EOBC) {
274 blockIndexPrev = blockIndex;
275 blockIndex = getFreeBlocks(1,fd);
276 fsInfo->blockAllocationTable[blockIndexPrev].nextBlock = blockIndex;
277 fsInfo->blockAllocationTable[blockIndex].nextBlock = EOBC;
278 }
279 else {
280 blockIndex = fsInfo->blockAllocationTable[blockIndex].nextBlock;
281 fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
282 }
283 }
284 }
285 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,fd->buffer,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[blockIndex].realSector,blockSize);
286
287 if ((uInt32)offset > fd->size) {
288 fd->size = offset;
289 dirEntry = (struct directoryEntry *)kmalloc(4096);
290 /*
291 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);
292 */
293 for (i=0x0;i<(4096/sizeof(struct directoryEntry));i++) {
294 if ((int)!strcmp(dirEntry[i].fileName,fd->fileName))
295 break;
296 }
297 dirEntry[i].size = fd->size;
298 dirEntry[i].startCluster = fd->start;
299 /*
300 fd->mp->device->devInfo->write(fd->mp->device->devInfo->info,dirEntry,(fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[fd->dirBlock].realSector),blockSize);
301 */
302 kfree(dirEntry);
303 }
304 /* Return */
305 return(size);
306 }
307
308 void ubixFSUnlink(char *path,struct vfs_mountPoint *mp) {
309 int x=0;
310 struct directoryEntry *dirEntry = (struct directoryEntry *)kmalloc(0x1000);
311 struct ubixFSInfo *fsInfo = mp->fsInfo;
312
313 mp->device->devInfo->read(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8);
314
315 for (x=0;(uInt32)x<(4096/sizeof(struct directoryEntry));x++) {
316 if ((int)!strcmp(dirEntry[x].fileName,path)) {
317 dirEntry[x].attributes |= typeDeleted;
318 dirEntry[x].fileName[0] = '?';
319 mp->device->devInfo->write(mp->device->devInfo->info,dirEntry,(mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),8);
320 return;
321 }
322 }
323 kprintf("File Not Found\n");
324 return;
325 }
326
327
328 /*****************************************************************************************
329
330 Function: static
331 int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex)
332
333 Description: This will load the node data in from the disk
334
335 Notes:
336 07/23/2004 - This loads complete blocks from disk so it is aligned to 0x1000 not the
337 actual file size
338
339 *****************************************************************************************/
340 static int ubixfs_loadData(fileDescriptor_t *fd,char *data,uInt32 size,uInt32 batIndex) {
341 uInt32 i = 0x0;
342
343 struct ubixFSInfo *fsInfo = NULL;
344
345 assert(fd);
346 assert(fd->mp);
347 assert(fd->mp->fsInfo);
348
349 fsInfo = fd->mp->fsInfo;
350
351 size = UBIXFS_ALIGN(size);
352 /* Loop by block size */
353
354 for (i=0x0; i<size; i += (UBIXFS_BLOCKSIZE_BYTES)) {
355 /* Get next block if we are ready for it */
356 if (i != 0x0)
357 batIndex = fsInfo->blockAllocationTable[batIndex].nextBlock;
358 /* Read data in from media */
359 fd->mp->device->devInfo->read(fd->mp->device->devInfo->info,data+i,fd->mp->diskLabel->partitions[fd->mp->partition].pOffset+fsInfo->blockAllocationTable[batIndex].realSector,blockSize);
360 }
361 /* Return */
362 return(0x0);
363 }
364
365
366 /*****************************************************************************************
367
368 Function: int ubixfs_initialize()
369
370 Description: This will initialize a mount point it loads the BAT and Caches the rootDir
371
372 Notes:
373
374 *****************************************************************************************/
375 int ubixfs_initialize(struct vfs_mountPoint *mp) {
376 struct ubixFSInfo *fsInfo = 0x0;
377
378 assert(mp);
379 assert(mp->diskLabel);
380 assert(mp->diskLabel->partitions);
381
382 mp->fsInfo = (struct ubixFSInfo *)kmalloc(sizeof(struct ubixFSInfo));
383 assert(mp->fsInfo);
384
385 fsInfo = mp->fsInfo;
386 fsInfo->rootDir = 0x0; /* Root directory is always 0x0 on the UbixFS */
387
388 /*
389 Check the disk label to ensure this is an UbixFS partition
390 */
391 if ((mp->diskLabel->magicNum == UBIXDISKMAGIC) && (mp->diskLabel->magicNum2 == UBIXDISKMAGIC)) {
392
393 /* Allocate memory for BAT */
394 fsInfo->blockAllocationTable = (struct blockAllocationTableEntry *)kmalloc(mp->diskLabel->partitions[mp->partition].pBatSize * 512);
395 assert(fsInfo->blockAllocationTable);
396
397 /* Set up the amount of BAT entries */
398 fsInfo->batEntries = (mp->diskLabel->partitions[mp->partition].pBatSize*512) / sizeof(struct blockAllocationTableEntry);
399
400 /* Read the BAT to memory */
401 assert(mp->device->devInfo->read);
402 mp->device->devInfo->read(mp->device->devInfo->info,
403 fsInfo->blockAllocationTable,
404 mp->diskLabel->partitions[mp->partition].pOffset,
405 mp->diskLabel->partitions[mp->partition].pBatSize);
406
407 /* Set up root directory cache */
408 fsInfo->dirCache = ubixfs_cacheNew("/");
409 assert(fsInfo->dirCache);
410 fsInfo->dirCache->info = (struct directoryEntry *)kmalloc(0x4000); /* allocate root dir */
411 fsInfo->dirCache->present = 1;
412 fsInfo->dirCache->size = kmalloc(sizeof(fsInfo->dirCache->size));
413 fsInfo->dirCache->startCluster = kmalloc(sizeof(fsInfo->dirCache->startCluster));
414 fsInfo->dirCache->attributes = kmalloc(sizeof(fsInfo->dirCache->attributes));
415 fsInfo->dirCache->permissions = kmalloc(sizeof(fsInfo->dirCache->permissions));
416
417 *fsInfo->dirCache->size = 0x4000;
418 *fsInfo->dirCache->startCluster = fsInfo->rootDir;
419
420 assert(fsInfo->dirCache->info);
421 /* Read root dir in from disk it is always 0x4000 bytes long */
422 mp->device->devInfo->read(mp->device->devInfo->info,
423 fsInfo->dirCache->info,
424 (mp->diskLabel->partitions[mp->partition].pOffset+fsInfo->blockAllocationTable[fsInfo->rootDir].realSector),
425 0x4000 / 512);
426
427 /* Start our ubixfs_thread to manage the mount point */
428 /*
429 UBU disable for now
430 execThread(ubixfs_Thread,0x2000),0x0);
431 */
432 kprintf(" Offset: [%i], Partition: [%i]\n",
433 mp->diskLabel->partitions[mp->partition].pOffset,mp->partition);
434 kprintf("UbixFS Initialized\n");
435 return(0x1);
436 }
437
438 kprintf("Not a valid UbixFS disk.\n");
439 /* Return */
440 return(0x0);
441 }
442
443 /*****************************************************************************************
444
445 Function: int ubixfs_init()
446
447 Description: This is the master initialization for the Ubix File System it will make the
448 OS UbixFS aware.
449 It does not in any way shape or form connect a mount point an medium that is
450 upto the ubixfs_initialize() function
451
452 Notes:
453
454 *****************************************************************************************/
455 int ubixfs_init() {
456 /* Set up our file system structure */
457 struct fileSystem ubixFileSystem =
458 {NULL, /* prev */
459 NULL, /* next */
460 (void *)ubixfs_initialize, /* vfsInitFS */
461 (void *)readUbixFS, /* vfsRead */
462 (void *)writeUbixFS, /* vfsWrite */
463 (void *)openFileUbixFS, /* vfsOpenFile */
464 (void *)ubixFSUnlink, /* vfsUnlink */
465 (void *)ubixFSmkDir, /* vfsMakeDir */
466 NULL, /* vfsRemDir */
467 NULL, /* vfsSync */
468 0 /* vfsType */
469 }; /* ubixFileSystem */
470
471 /* Add UbixFS */
472 if (vfsRegisterFS(ubixFileSystem) != 0x0) {
473 kpanic("Unable To Enable UbixFS");
474 return(0x1);
475 }
476
477 /* Return */
478 return(0x0);
479 }
480
481 /***
482 $Log: ubixfs.c,v $
483 Revision 1.2 2006/12/05 14:10:21 reddawg
484 Workign Distro
485
486 Revision 1.1.1.1 2006/06/01 12:46:17 reddawg
487 ubix2
488
489 Revision 1.2 2005/10/12 00:13:37 reddawg
490 Removed
491
492 Revision 1.1.1.1 2005/09/26 17:24:42 reddawg
493 no message
494
495 Revision 1.44 2004/08/26 22:51:19 reddawg
496 TCA touched me :( i think he likes men....
497
498
499 sched.h: kTask_t added parentPid
500 endtask.c: fixed term back to parentPid
501 exec.c: cleaned warnings
502 fork.c: fixed term to childPid
503 sched.c: clean up for dead tasks
504 systemtask.c: clean up dead tasks
505 kmalloc.c: cleaned up warnings
506 udp.c: cleaned up warnings
507 bot.c: cleaned up warnings
508 shell.c: cleaned up warnings
509 tcpdump.c: took a dump
510 hd.c: cleaned up warnings
511 ubixfs.c: stopped prning debug info
512
513 Revision 1.43 2004/08/14 11:23:02 reddawg
514 Changes
515
516 Revision 1.42 2004/08/09 12:58:05 reddawg
517 let me know when you got the surce
518
519 Revision 1.41 2004/08/01 17:58:39 flameshadow
520 chg: fixed string allocation bug in ubixfs_cacheNew()
521
522 Revision 1.40 2004/07/28 17:07:29 flameshadow
523 chg: re-added moving cached nodes to the front of the list when found
524 add: added an assert() in ubixfs.c
525
526 Revision 1.39 2004/07/27 19:24:31 flameshadow
527 chg: reduced the number of debugging statements in the kernel.
528
529 Revision 1.38 2004/07/27 12:02:01 reddawg
530 chg: fixed marks bug readFile did a lookup which is why it looked like it was loopping so much
531
532 Revision 1.37 2004/07/27 09:05:43 flameshadow
533 chg: fixed file not found bug. Still can't find looping issue
534
535 Revision 1.36 2004/07/27 04:05:20 flameshadow
536 chg: kinda fixed it. Added bunches of debug info
537
538 Revision 1.35 2004/07/26 19:15:49 reddawg
539 test code, fixes and the like
540
541 Revision 1.34 2004/07/24 23:04:44 reddawg
542 Changes... mark let me know if you fault at pid 185 when you type stress
543
544 Revision 1.33 2004/07/23 09:10:06 reddawg
545 ubixfs: cleaned up some functions played with the caching a bit
546 vfs: renamed a bunch of functions
547 cleaned up a few misc bugs
548
549 Revision 1.32 2004/07/22 23:01:51 reddawg
550 Ok checking in before I sleep
551
552 Revision 1.31 2004/07/22 22:37:03 reddawg
553 Caching is working now the FS is extremely fast but needs to be optimized to do 32bit copies over 8bit
554
555 Revision 1.30 2004/07/22 19:01:59 flameshadow
556 chg: more directory and file caching
557
558 Revision 1.29 2004/07/22 16:34:32 flameshadow
559 add: file and dir caching kinda work
560
561 Revision 1.28 2004/07/21 22:07:18 flameshadow
562 chg: renamed caching functions (again)
563
564 Revision 1.27 2004/07/21 21:08:05 flameshadow
565 add: added provisions for file caching
566
567 Revision 1.26 2004/07/20 23:21:31 flameshadow
568 syncing
569
570 Revision 1.25 2004/07/20 21:39:53 reddawg
571 ubixfs: does propper caching now problem was you did not seek realSector however the os starts but I am getting a segfault could be from anything haven't looked into it right quick
572
573 Revision 1.24 2004/07/20 21:38:08 flameshadow
574 try now
575
576
577 Revision 1.23 2004/07/20 21:35:09 reddawg
578 Let me commit before we start to overlap
579
580 Revision 1.22 2004/07/20 21:28:16 flameshadow
581 oops
582
583 Revision 1.20 2004/07/20 19:36:49 reddawg
584 UBU Tags
585
586 Revision 1.19 2004/07/20 18:09:37 flameshadow
587 add: directory caching related stuff
588
589 Revision 1.18 2004/07/17 03:21:34 flameshadow
590 chg: cleaned up code; added assert() statements
591
592 Revision 1.15 2004/07/14 12:21:49 reddawg
593 ubixfs: enableUbixFs to ubixfs_init
594 Changed Startup Routines
595
596 Revision 1.14 2004/06/28 23:12:58 reddawg
597 file format now container:/path/to/file
598
599 Revision 1.13 2004/06/28 18:12:44 reddawg
600 We need these files
601
602 Revision 1.12 2004/06/28 11:57:58 reddawg
603 Fixing Up Filesystem
604
605 Revision 1.10 2004/06/04 13:20:22 reddawg
606 ubixFSmkDir(): played with it a bit to see if it still worked
607
608 Revision 1.9 2004/06/04 10:19:42 reddawg
609 notes: we compile again, thank g-d anyways i was about to cry
610
611 Revision 1.8 2004/06/01 00:04:53 reddawg
612 Try now mark
613
614 Revision 1.7 2004/05/19 15:20:06 reddawg
615 Fixed reference problems due to changes in drive subsystem
616
617 Revision 1.6 2004/05/19 04:07:43 reddawg
618 kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been
619
620 Revision 1.5 2004/04/29 15:45:19 reddawg
621 Fixed some bugs so now the automade images will work correctly
622
623 Revision 1.4 2004/04/28 21:10:40 reddawg
624 Lots Of changes to make it work with existing os
625
626 Revision 1.3 2004/04/28 13:33:09 reddawg
627 Overhaul to ubixfs and boot loader and MBR to work well with our schema
628 now BAT and dir and file entries are all offset 64Sectors from the start of the partition
629
630 Revision 1.2 2004/04/28 02:22:55 reddawg
631 This is a fiarly large commit but we are starting to use new driver model
632 all around
633
634 Revision 1.1.1.1 2004/04/15 12:07:08 reddawg
635 UbixOS v1.0
636
637 Revision 1.31 2004/04/13 16:36:34 reddawg
638 Changed our copyright, it is all now under a BSD-Style license
639
640 END
641 ***/
642
fileDescriptor::cacheNode
struct cacheNode * cacheNode
Definition: file.h:75
fileDescriptor::buffer
char * buffer
Definition: file.h:74
writeFileByte
int writeFileByte(int ch, fileDescriptor_t *fd, long offset)
Definition: ubixfs.c:116
buffer
char * buffer
Definition: shell.c:47
fileDescriptor::start
uint32_t start
Definition: file.h:72
blockAllocationTableEntry::attributes
long attributes
Definition: ubixfs.h:91
uInt32
unsigned long int uInt32
Definition: objgfx30.h:49
vfs.h
string.h
fileDescriptor::mode
uint16_t mode
Definition: file.h:68
directoryEntry::fileName
char fileName[256]
Definition: ubixfs.h:107
fileDescriptor
Definition: file.h:62
ubixFSInfo
Definition: ubixfs.h:125
blockAllocationTableEntry
Definition: ubixfs.h:90
file
Definition: descrip.h:67
kfree
void kfree(void *baseAddr)
Definition: kmalloc.c:342
ubixDiskLabel::magicNum2
uInt32 magicNum2
Definition: ubixfs.h:69
strcmp
int strcmp(const char *str1, const char *str2)
assert
#define assert(e)
Definition: assert.h:64
assert.h
dirCache.h
EOBC
#define EOBC
Definition: ubixfs.h:45
ubixfs_cacheNew
struct cacheNode * ubixfs_cacheNew(const char *name)
Definition: dirCache.c:193
directoryEntry::attributes
uInt16 attributes
Definition: ubixfs.h:105
ubixDiskLabel::magicNum
uInt32 magicNum
Definition: ubixfs.h:68
exec.h
directoryEntry
Definition: ubixfs.h:98
ubixDiskLabel::partitions
struct ubixDiskLabel::ubixPartitions partitions[16]
cacheNode::info
void * info
Definition: dirCache.h:42
fileSystem
filesSystem Structure
Definition: vfs.h:59
vfs_mountPoint::diskLabel
struct ubixDiskLabel * diskLabel
Definition: mount.h:71
blockSize
#define blockSize
Definition: ubixfs.h:43
sched.h
kpanic
void kpanic(const char *fmt,...)
print panic message and halt system
Definition: kpanic.c:41
ubixFSInfo::rootDir
uInt32 rootDir
Definition: ubixfs.h:129
UBIXFS_ALIGN
#define UBIXFS_ALIGN(size)
Definition: ubixfs.h:39
ubixDiskLabel::ubixPartitions::pOffset
uInt32 pOffset
Definition: ubixfs.h:74
writeUbixFS
int writeUbixFS(fileDescriptor_t *fd, char *data, long offset, long size)
Definition: ubixfs.c:229
ubixFSmkDir
int ubixFSmkDir(char *directory, fileDescriptor_t *fd)
Definition: directory.c:92
ubixFSUnlink
void ubixFSUnlink(char *path, struct vfs_mountPoint *mp)
Definition: ubixfs.c:306
fileDescriptor::mp
struct vfs_mountPoint * mp
Definition: file.h:65
ubixfs_init
int ubixfs_init()
Definition: ubixfs.c:450
vfsRegisterFS
int vfsRegisterFS(struct fileSystem newFS)
register a file system
Definition: vfs.c:79
vfs_mountPoint
Definition: mount.h:66
kpanic.h
kprintf.h
fdRead
#define fdRead
Definition: vfs.h:46
cacheNode::permissions
uInt16 * permissions
Definition: dirCache.h:48
readUbixFS
int readUbixFS(fileDescriptor_t *fd, char *data, uInt32 offset, long size)
Definition: ubixfs.c:192
cacheNode::startCluster
uInt32 * startCluster
Definition: dirCache.h:46
fdOpen
#define fdOpen
Definition: vfs.h:45
UBIXFS_BLOCKSIZE_BYTES
#define UBIXFS_BLOCKSIZE_BYTES
Definition: ubixfs.h:38
directoryEntry::startCluster
uInt32 startCluster
Definition: ubixfs.h:99
getFreeBlocks
int getFreeBlocks(int count, fileDescriptor_t *fd)
Definition: block.c:95
cacheNode::present
int present
Definition: dirCache.h:44
vfs_mountPoint::partition
int partition
Definition: mount.h:73
cacheNode::size
int * size
Definition: dirCache.h:43
cacheNode::attributes
uInt16 * attributes
Definition: dirCache.h:47
blockAllocationTableEntry::realSector
long realSector
Definition: ubixfs.h:92
device_interface::write
int(* write)(void *, void *, uInt32, uInt32)
Definition: device.h:53
fileWrite
#define fileWrite
Definition: vfs.h:50
ubixfs_cacheFind
struct cacheNode * ubixfs_cacheFind(struct cacheNode *head, char *name)
Definition: dirCache.c:55
device_interface::read
int(* read)(void *, void *, uInt32, uInt32)
Definition: device.h:52
fileDescriptor::perms
uint32_t perms
Definition: file.h:76
fileDescriptor::fileName
char fileName[512]
Definition: file.h:73
ubixfs.h
vfs_mountPoint::fsInfo
void * fsInfo
Definition: mount.h:72
device_interface::info
void * info
Definition: device.h:51
vfs_mountPoint::device
struct device_node * device
Definition: mount.h:70
kmalloc
void * kmalloc(uInt32 len)
Definition: kmalloc.c:241
ubixFSInfo::blockAllocationTable
struct blockAllocationTableEntry * blockAllocationTable
Definition: ubixfs.h:126
ubixFSInfo::batEntries
uInt32 batEntries
Definition: ubixfs.h:128
fileRead
#define fileRead
Definition: vfs.h:49
ubixFSInfo::dirCache
struct cacheNode * dirCache
Definition: ubixfs.h:127
typeDeleted
#define typeDeleted
Definition: ubixfs.h:50
ubixDiskLabel::ubixPartitions::pBatSize
uInt32 pBatSize
Definition: ubixfs.h:76
device_node::devInfo
struct device_interface * devInfo
Definition: device.h:37
fdEof
#define fdEof
Definition: vfs.h:47
fileDescriptor::status
uint16_t status
Definition: file.h:67
directoryEntry::size
uInt32 size
Definition: ubixfs.h:100
kprintf
int kprintf(const char *,...)
Definition: kprintf.c:259
ubixfs_initialize
int ubixfs_initialize(struct vfs_mountPoint *mp)
Definition: ubixfs.c:371
fileDescriptor::size
uint32_t size
Definition: file.h:70
kmalloc.h
blockAllocationTableEntry::nextBlock
long nextBlock
Definition: ubixfs.h:93
UBIXDISKMAGIC
#define UBIXDISKMAGIC
Definition: ubixfs.h:41
cacheNode
Definition: dirCache.h:35
NULL
#define NULL
Definition: fat_string.h:17