diff --git a/src/sys/ubixfsv2/ubixfs.cpp b/src/sys/ubixfsv2/ubixfs.cpp index a98fea4..e74c7c5 100644 --- a/src/sys/ubixfsv2/ubixfs.cpp +++ b/src/sys/ubixfsv2/ubixfs.cpp @@ -175,7 +175,6 @@ startingBlock *= (bSize / 512); // startingBlock is now in sectors - if (runSize >= size) { runSize = size; size = 0; @@ -196,6 +195,48 @@ return totalSize; } // UbixFS::vfs_read +size_t +UbixFS::vfs_write(fileDescriptor * fd, void * data, off_t offset, size_t size) { + + unsigned int i; + off_t sum, startingBlock; + size_t runSize, sectorCount, totalSize, bSize; // blockSize + ubixfsInode * inode = NULL; + + if (fd == NULL || data == NULL) return ~0; + + if (size == 0) return 0; // don't fail if size is 0? + + assert(device); + assert(superBlock); + + inode = static_cast(fd->inode); + + assert(inode); + + bSize = superBlock->blockSize; + + totalSize = sum = i = 0; + + return totalSize; +} // UbixFS::vfs_write + +void +UbixFS::setFreeBlock(blockRun ibr) { + signed char * ptr; + + if (superBlock == NULL || freeBlockList == NULL) return; + if (ibr.len == 0) return; + ptr = freeBlockList + ((ibr.AG << superBlock->AGShift) >> 3); + ptr += ibr.start >> 3; + + if (ibr.start % 8 != 0) { + + ibr.len -= ibr.start % 8; + } // if + +} // UbixFS::setFreeBlock + blockRun UbixFS::getFreeBlock(blockRun ibr) { signed char * ptr; diff --git a/src/sys/ubixfsv2/ubixfs.h b/src/sys/ubixfsv2/ubixfs.h index 5d639cd..cf8a12e 100644 --- a/src/sys/ubixfsv2/ubixfs.h +++ b/src/sys/ubixfsv2/ubixfs.h @@ -137,6 +137,7 @@ blockRun getFreeBlock(uInt32); blockRun getFreeBlock(void); blockRun get8FreeBlocks(uInt32); + void setFreeBlock(blockRun); void * mknod(const char *, ubixfsInode *); uInt32 getNextAG(void); void printSuperBlock(void); @@ -148,6 +149,7 @@ virtual int vfs_format(device_t *); virtual void * vfs_mknod(const char *, mode_t); virtual size_t vfs_read(fileDescriptor *, void *, off_t, size_t); + virtual size_t vfs_write(fileDescriptor *, void *, off_t, size_t); virtual int vfs_sync(void); virtual int vfs_stop(void); virtual ~UbixFS(void);