From 5644d283b63aa82f578848dd04eaf1f27cb4c060 Mon Sep 17 00:00:00 2001 From: Matt Madia Date: Sun, 9 Dec 2012 08:51:58 -0500 Subject: [PATCH] Manually applied: Fix typos: super block -> superblock (#8974) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by: Przemysław Buczkowski --- .../kernel/file_systems/ext2/Journal.cpp | 72 +++++++++---------- src/bin/bfs_tools/chkindex.cpp | 24 +++---- src/bin/bfs_tools/lib/Disk.cpp | 12 ++-- src/system/boot/platform/bios_ia32/stage1.S | 4 +- .../bfs/fragmenter/fragmenter.cpp | 18 ++--- .../kernel/file_systems/bfs/r5/Volume.cpp | 40 +++++------ .../kernel/file_systems/fs_shell/mount.c | 40 +++++------ 7 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/add-ons/kernel/file_systems/ext2/Journal.cpp b/src/add-ons/kernel/file_systems/ext2/Journal.cpp index d7f2d4c345..ab65174a46 100644 --- a/src/add-ons/kernel/file_systems/ext2/Journal.cpp +++ b/src/add-ons/kernel/file_systems/ext2/Journal.cpp @@ -114,7 +114,7 @@ Journal::Journal(Volume* fsVolume, Volume* jVolume) fInitStatus = B_NO_MEMORY; else { fInitStatus = revokeManager->Init(); - + if (fInitStatus == B_OK) { fRevokeManager = revokeManager; fInitStatus = _LoadSuperBlock(); @@ -270,7 +270,7 @@ Journal::Unlock(Transaction* owner, bool success) { TRACE("Journal::Unlock(): Lock recursion: %ld\n", recursive_lock_get_recursion(&fLock)); - if (fSeparateSubTransactions + if (fSeparateSubTransactions || recursive_lock_get_recursion(&fLock) == 1) { // we only end the transaction if we unlock it if (owner != NULL) { @@ -309,7 +309,7 @@ Journal::MapBlock(off_t logical, fsblock_t& physical) { TRACE("Journal::MapBlock()\n"); physical = logical; - + return B_OK; } @@ -340,7 +340,7 @@ Journal::TransactionID() const status_t -Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, +Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, bool detached, uint8** _escapedData, uint32 &logBlock, off_t& blockNumber, long& cookie, ArrayDeleter& escapedDataDeleter, uint32& blockCount, bool& finished) @@ -353,7 +353,7 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, JournalBlockTag* tag = (JournalBlockTag*)descriptorBlock->data; JournalBlockTag* lastTag = (JournalBlockTag*)((uint8*)descriptorBlock + fBlockSize - sizeof(JournalHeader)); - + finished = false; status_t status = B_OK; @@ -430,11 +430,11 @@ Journal::_WritePartialTransactionToLog(JournalHeader* descriptorBlock, } finished = status != B_OK; - + // Write descriptor block --tag; tag->SetLastTagFlag(); - + fsblock_t physicalBlock; status = MapBlock(descriptorBlockPos, physicalBlock); if (status != B_OK) @@ -493,14 +493,14 @@ Journal::_WriteTransactionToLog() if (size > FreeLogBlocks()) { TRACE("Journal::_WriteTransactionToLog(): Syncing block cache\n"); cache_sync_transaction(fFilesystemBlockCache, fTransactionID); - + if (size > FreeLogBlocks()) { panic("Transaction fits, but sync didn't result in enough" "free space.\n\tGot %ld when at least %ld was expected.", FreeLogBlocks(), size); } } - + TRACE("Journal::_WriteTransactionToLog(): finished managing space for " "the transaction\n"); @@ -511,7 +511,7 @@ Journal::_WriteTransactionToLog() // Prepare Descriptor block TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for " "the descriptor block, block size %lu\n", fBlockSize); - JournalHeader* descriptorBlock = + JournalHeader* descriptorBlock = (JournalHeader*)new(std::nothrow) uint8[fBlockSize]; if (descriptorBlock == NULL) { TRACE("Journal::_WriteTransactionToLog(): Failed to allocate a buffer " @@ -525,7 +525,7 @@ Journal::_WriteTransactionToLog() // Prepare Commit block TRACE("Journal::_WriteTransactionToLog(): attempting to allocate space for " "the commit block, block size %lu\n", fBlockSize); - JournalHeader* commitBlock = + JournalHeader* commitBlock = (JournalHeader*)new(std::nothrow) uint8[fBlockSize]; if (descriptorBlock == NULL) { TRACE("Journal::_WriteTransactionToLog(): Failed to allocate a buffer " @@ -555,7 +555,7 @@ Journal::_WriteTransactionToLog() uint32 blockCount = 0; uint32 logBlock = _WrapAroundLog(fLogEnd); - + bool finished = false; status = _WritePartialTransactionToLog(descriptorBlock, detached, @@ -574,10 +574,10 @@ Journal::_WriteTransactionToLog() blockCount, finished); if (!finished && status != B_OK) return status; - + // It is okay to write the commit blocks of the partial transactions // as long as the commit block of the first partial transaction isn't - // written. When it recovery reaches where the first commit should be + // written. When it recovery reaches where the first commit should be // and doesn't find it, it considers it found the end of the log. fsblock_t physicalBlock; @@ -586,7 +586,7 @@ Journal::_WriteTransactionToLog() return status; off_t logOffset = physicalBlock * fBlockSize; - + TRACE("Journal::_WriteTransactionToLog(): Writting commit block to " "%lld\n", logOffset); off_t written = write_pos(fJournalVolume->Device(), logOffset, @@ -598,7 +598,7 @@ Journal::_WriteTransactionToLog() commitBlock->IncrementSequence(); blockCount++; - + logBlock = _WrapAroundLog(logBlock + 1); } @@ -617,7 +617,7 @@ Journal::_WriteTransactionToLog() TRACE("Failed to write journal commit block.\n"); return B_IO_ERROR; } - + blockCount++; fLogEnd = _WrapAroundLog(fLogEnd + blockCount); @@ -670,7 +670,7 @@ Journal::_SaveSuperBlock() off_t superblockPos = physicalBlock * fBlockSize; JournalSuperBlock superblock; - size_t bytesRead = read_pos(fJournalVolume->Device(), superblockPos, + size_t bytesRead = read_pos(fJournalVolume->Device(), superblockPos, &superblock, sizeof(superblock)); if (bytesRead != sizeof(superblock)) @@ -678,7 +678,7 @@ Journal::_SaveSuperBlock() superblock.SetFirstCommitID(fFirstCommitID); superblock.SetLogStart(fLogStart); - + TRACE("Journal::SaveSuperBlock(): Write to %lld\n", superblockPos); size_t bytesWritten = write_pos(fJournalVolume->Device(), superblockPos, &superblock, sizeof(superblock)); @@ -701,10 +701,10 @@ Journal::_LoadSuperBlock() status_t status = MapBlock(0, superblockPos); if (status != B_OK) return status; - - TRACE("Journal::_LoadSuperBlock(): super block physical block: %llu\n", + + TRACE("Journal::_LoadSuperBlock(): superblock physical block: %llu\n", superblockPos); - + JournalSuperBlock superblock; size_t bytesRead = read_pos(fJournalVolume->Device(), superblockPos * fJournalVolume->BlockSize(), &superblock, sizeof(superblock)); @@ -803,7 +803,7 @@ Journal::_CountTags(JournalHeader* descriptorBlock) if ((tags->Flags() & JOURNAL_FLAG_LAST_TAG) != 0) count++; - + TRACE("Journal::_CountTags(): counted tags: %lu\n", count); return count; @@ -824,7 +824,7 @@ Journal::Recover() status_t status = _RecoverPassScan(lastCommitID); if (status != B_OK) return status; - + status = _RecoverPassRevoke(lastCommitID); if (status != B_OK) return status; @@ -978,7 +978,7 @@ Journal::_RecoverPassReplay(uint32 lastCommitID) "data\n"); return B_NO_MEMORY; } - + ArrayDeleter dataDeleter(data); while (nextCommitID < lastCommitID) { @@ -994,7 +994,7 @@ Journal::_RecoverPassReplay(uint32 lastCommitID) JournalBlockTag* last_tag = (JournalBlockTag*)((uint8*)header + fBlockSize - sizeof(JournalBlockTag)); - for (JournalBlockTag* tag = (JournalBlockTag*)header->data; + for (JournalBlockTag* tag = (JournalBlockTag*)header->data; tag <= last_tag; ++tag) { nextBlock = _WrapAroundLog(nextBlock + 1); @@ -1002,7 +1002,7 @@ Journal::_RecoverPassReplay(uint32 lastCommitID) if (status != B_OK) return status; - if (!fRevokeManager->Lookup(tag->BlockNumber(), + if (!fRevokeManager->Lookup(tag->BlockNumber(), nextCommitID)) { // Block isn't revoked size_t read = read_pos(fJournalVolume->Device(), @@ -1111,7 +1111,7 @@ Journal::_FlushLog(bool canWait, bool flushBlocks) TRACE("Journal::_FlushLog(): Finished. Releasing lock\n"); recursive_lock_unlock(&fLock); - + TRACE("Journal::_FlushLog(): Done, final status: %s\n", strerror(status)); return status; } @@ -1160,9 +1160,9 @@ Journal::_FullTransactionSize() const size_t count = cache_blocks_in_transaction(fFilesystemBlockCache, fTransactionID); - + TRACE("\tFull transaction size: %ld\n", count); - + return count; } @@ -1174,9 +1174,9 @@ Journal::_MainTransactionSize() const size_t count = cache_blocks_in_main_transaction(fFilesystemBlockCache, fTransactionID); - + TRACE("\tMain transaction size: %ld\n", count); - + return count; } @@ -1200,7 +1200,7 @@ Journal::_TransactionDone(bool success) TRACE("Journal::_TransactionDone(): returning B_OK\n"); return B_OK; } - + // If possible, delay flushing the transaction uint32 size = _FullTransactionSize(); TRACE("Journal::_TransactionDone(): full transaction size: %lu, max " @@ -1209,11 +1209,11 @@ Journal::_TransactionDone(bool success) if (fMaxTransactionSize > 0 && size < fMaxTransactionSize) { TRACE("Journal::_TransactionDone(): delaying flush of transaction " "%ld\n", fTransactionID); - + // Make sure the transaction fits in the log if (size < FreeLogBlocks()) cache_sync_transaction(fFilesystemBlockCache, fTransactionID); - + fUnwrittenTransactions++; TRACE("Journal::_TransactionDone(): returning B_OK\n"); return B_OK; @@ -1253,7 +1253,7 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void* _logEntry) if (journal->_SaveSuperBlock() != B_OK) panic("ext2: Failed to write journal superblock\n"); } - + TRACE("Journal::_TransactionWritten(): Removing log entry\n"); journal->fLogEntries.Remove(logEntry); diff --git a/src/bin/bfs_tools/chkindex.cpp b/src/bin/bfs_tools/chkindex.cpp index e31a827fda..8c141b6bf1 100644 --- a/src/bin/bfs_tools/chkindex.cpp +++ b/src/bin/bfs_tools/chkindex.cpp @@ -52,10 +52,10 @@ class BlockRunHashtable : public Hashtable return false; memcpy(value,&run,sizeof(block_run)); - + if (Hashtable::Put(value,value)) return true; - + free(value); return false; } @@ -133,7 +133,7 @@ collectFiles(Disk &disk) return; } collectFiles(disk,root); - + printf(" %7Ld files found.\n",gCount); delete root; @@ -201,7 +201,7 @@ checkFiles(Disk &disk,BPlusTree &tree,char *attribute) { runs[index++] = *run; } - + // sort array to speed up disk access qsort(runs,index,sizeof(block_run),(int (*)(const void *,const void *))compareBlockRuns); @@ -227,7 +227,7 @@ checkFiles(Disk &disk,BPlusTree &tree,char *attribute) delete inode; continue; } - + // check indices not based on standard attributes if (sizeIndex) { @@ -422,7 +422,7 @@ main(int argc,char **argv) printUsage(toolName); return -1; } - + while (*++argv) { char *arg = *argv; @@ -447,7 +447,7 @@ main(int argc,char **argv) else break; } - + char *attribute = argv[0]; if (!gCheckAll && attribute == NULL) { @@ -476,13 +476,13 @@ main(int argc,char **argv) fprintf(stderr,"Could not open device or file \"%s\": %s\n",info.device_name,strerror(status)); return -1; } - + if (disk.ValidateSuperBlock() < B_OK) { - fprintf(stderr,"The disk's super block is corrupt!\n"); + fprintf(stderr,"The disk's superblock is corrupt!\n"); return -1; } - + Directory *indices = (Directory *)Inode::Factory(&disk,disk.Indices()); if (indices == NULL || (status = indices->InitCheck()) < B_OK) { @@ -497,7 +497,7 @@ main(int argc,char **argv) delete indices; return -1; } - + block_run run; if (gCheckAll) @@ -515,7 +515,7 @@ main(int argc,char **argv) fprintf(stderr," Could not find index directory for \"%s\"!\n",attribute); delete indices; - + gHashtable.MakeEmpty(HASH_EMPTY_NONE,HASH_EMPTY_FREE); return 0; diff --git a/src/bin/bfs_tools/lib/Disk.cpp b/src/bin/bfs_tools/lib/Disk.cpp index 5571a29dfb..5d0fd07f73 100644 --- a/src/bin/bfs_tools/lib/Disk.cpp +++ b/src/bin/bfs_tools/lib/Disk.cpp @@ -2,7 +2,7 @@ * Copyright (c) 2001-2008 pinc Software. All Rights Reserved. */ -//! Handles BFS super block, disk access etc. +//! Handles BFS superblock, disk access etc. #include "Disk.h" #include "dump.h" @@ -157,7 +157,7 @@ Disk::Disk(const char *deviceName, bool rawMode, off_t start, off_t stop) if (fBufferedFile->ReadAt(512 + fRawDiskOffset, &fSuperBlock, sizeof(disk_super_block)) < 1) - fprintf(stderr,"Disk: Could not read super block\n"); + fprintf(stderr,"Disk: Could not read superblock\n"); //dump_super_block(&fSuperBlock); } @@ -277,21 +277,21 @@ Disk::ScanForSuperBlock(off_t start, off_t stop) printf("\n(%ld) *** BFS superblock found at: %Ld\n",superBlocks.CountItems() + 1,offset); dump_super_block(super); - // add a copy of the super block to the list + // add a copy of the superblock to the list bfs_disk_info *info = (bfs_disk_info *)malloc(sizeof(bfs_disk_info)); if (info == NULL) return B_NO_MEMORY; memcpy(&info->super_block, super, sizeof(disk_super_block)); info->offset = offset + i - 512; - /* location off the BFS super block is 512 bytes after the partition start */ + /* location off the BFS superblock is 512 bytes after the partition start */ superBlocks.AddItem(info); } } } if (superBlocks.CountItems() == 0) { - puts("\nCouldn't find any BFS super blocks!"); + puts("\nCouldn't find any BFS superblocks!"); return B_ENTRY_NOT_FOUND; } @@ -411,7 +411,7 @@ Disk::RecreateSuperBlock() bfs_inode indexDir; bfs_inode rootDir; if (ScanForIndexAndRoot(&indexDir,&rootDir) < B_OK) { - fprintf(stderr,"ERROR: Could not find root directory! Trying to recreate the super block will have no effect!\n\tSetting standard values for the root dir.\n"); + fprintf(stderr,"ERROR: Could not find root directory! Trying to recreate the superblock will have no effect!\n\tSetting standard values for the root dir.\n"); rootDir.inode_num.allocation_group = 8; rootDir.inode_num.start = 0; rootDir.inode_num.length = 1; diff --git a/src/system/boot/platform/bios_ia32/stage1.S b/src/system/boot/platform/bios_ia32/stage1.S index d8ce1181a2..af463698ed 100644 --- a/src/system/boot/platform/bios_ia32/stage1.S +++ b/src/system/boot/platform/bios_ia32/stage1.S @@ -130,7 +130,7 @@ struc BlockRun .length resw 1 endstruc -; BFS super block +; BFS superblock struc SuperBlock .name resb 32 .magic1 resd 1 @@ -665,7 +665,7 @@ kBootBlockSignature dw 0xaa55 second_boot_block: -; first comes the BFS super block +; first comes the BFS superblock superblock: %rep sizeof(SuperBlock) db 0 diff --git a/src/tests/add-ons/kernel/file_systems/bfs/fragmenter/fragmenter.cpp b/src/tests/add-ons/kernel/file_systems/bfs/fragmenter/fragmenter.cpp index 74e016a8a9..8d9a20da5a 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/fragmenter/fragmenter.cpp +++ b/src/tests/add-ons/kernel/file_systems/bfs/fragmenter/fragmenter.cpp @@ -90,7 +90,7 @@ count_bits(int value) count++; value >>= 1; } - + return count; } @@ -102,7 +102,7 @@ main(int argc, const char *const *argv) exit(1); } - const char *fileName = argv[1]; + const char *fileName = argv[1]; const char *patternString = (argc >= 3 ? argv[2] : "0f"); // skip leading "0x" in the pattern string @@ -151,12 +151,12 @@ main(int argc, const char *const *argv) exit(1); } - // read super block + // read superblock disk_super_block superBlock; read_from(fd, 512, &superBlock, sizeof(superBlock)); if (superBlock.magic1 != SUPER_BLOCK_MAGIC1) { - fprintf(stderr, "Error: Bad super block magic. This is probably not a " + fprintf(stderr, "Error: Bad superblock magic. This is probably not a " "BFS image.\n"); exit(1); } @@ -172,12 +172,12 @@ main(int argc, const char *const *argv) int64 blockCount = st.st_size / blockSize; if (blockCount != superBlock.num_blocks) { fprintf(stderr, "Error: Number of blocks in image and the number in " - "the super block differ: %lld vs. %lld\n", blockCount, + "the superblock differ: %lld vs. %lld\n", blockCount, superBlock.num_blocks); exit(1); } - - + + // iterate through the block bitmap blocks and or the bytes with 0x0f uint8 *block = new uint8[blockSize]; int64 occupiedBlocks = 0; @@ -206,10 +206,10 @@ main(int argc, const char *const *argv) printf("bfs_fragmenter: marked %lld blocks used\n", occupiedBlocks); - // write back the super block + // write back the superblock superBlock.used_blocks += occupiedBlocks; write_to(fd, 512, &superBlock, sizeof(superBlock)); - + return 0; } diff --git a/src/tests/add-ons/kernel/file_systems/bfs/r5/Volume.cpp b/src/tests/add-ons/kernel/file_systems/bfs/r5/Volume.cpp index 3eb82e2c04..a5d6f9e8ff 100644 --- a/src/tests/add-ons/kernel/file_systems/bfs/r5/Volume.cpp +++ b/src/tests/add-ons/kernel/file_systems/bfs/r5/Volume.cpp @@ -3,7 +3,7 @@ * This file may be used under the terms of the MIT License. */ -//! super block, mounting, etc. +//! superblock, mounting, etc. #include "Debug.h" @@ -73,7 +73,7 @@ DeviceOpener::~DeviceOpener() } -int +int DeviceOpener::Open(const char *device, int mode) { fDevice = open(device, mode); @@ -93,7 +93,7 @@ DeviceOpener::InitCache(off_t numBlocks) } -void +void DeviceOpener::RemoveCache(int mode) { if (!fCached) @@ -104,7 +104,7 @@ DeviceOpener::RemoveCache(int mode) } -void +void DeviceOpener::Keep() { fDevice = -1; @@ -115,7 +115,7 @@ DeviceOpener::Keep() * to compute the size, or fstat() if that failed. */ -status_t +status_t DeviceOpener::GetSize(off_t *_size, uint32 *_blockSize) { device_geometry geometry; @@ -257,7 +257,7 @@ Volume::IsValidSuperBlock() } -void +void Volume::Panic() { FATAL(("we have to panic... switch to read-only mode!\n")); @@ -313,13 +313,13 @@ Volume::Mount(const char *deviceName, uint32 flags) } #endif - // read the super block + // read the superblock if (Identify(fDevice, &fSuperBlock) != B_OK) { - FATAL(("invalid super block!\n")); + FATAL(("invalid superblock!\n")); return B_BAD_VALUE; } - // initialize short hands to the super block (to save byte swapping) + // initialize short hands to the superblock (to save byte swapping) fBlockSize = fSuperBlock.BlockSize(); fBlockShift = fSuperBlock.BlockShift(); fAllocationGroupShift = fSuperBlock.AllocationGroupShift(); @@ -409,7 +409,7 @@ Volume::Unmount() } -status_t +status_t Volume::Sync() { return fJournal->FlushLogAndBlocks(); @@ -431,7 +431,7 @@ Volume::ValidateBlockRun(block_run run) } -block_run +block_run Volume::ToBlockRun(off_t block) const { block_run run; @@ -456,14 +456,14 @@ Volume::CreateIndicesRoot(Transaction *transaction) } -status_t +status_t Volume::AllocateForInode(Transaction *transaction, const Inode *parent, mode_t type, block_run &run) { return fBlockAllocator.AllocateForInode(transaction, &parent->BlockRun(), type, run); } -status_t +status_t Volume::WriteSuperBlock() { if (write_pos(fDevice, 512, &fSuperBlock, sizeof(disk_super_block)) != sizeof(disk_super_block)) @@ -494,7 +494,7 @@ Volume::UpdateLiveQueries(Inode *inode, const char *attribute, int32 type, const * the queries - it wouldn't safe you anything in this case. */ -bool +bool Volume::CheckForLiveQuery(const char *attribute) { // ToDo: check for a live query that depends on the specified attribute @@ -502,7 +502,7 @@ Volume::CheckForLiveQuery(const char *attribute) } -void +void Volume::AddQuery(Query *query) { if (fQueryLock.Lock() < B_OK) @@ -514,7 +514,7 @@ Volume::AddQuery(Query *query) } -void +void Volume::RemoveQuery(Query *query) { if (fQueryLock.Lock() < B_OK) @@ -537,7 +537,7 @@ Volume::Identify(int fd, disk_super_block *superBlock) if (read_pos(fd, 0, buffer, sizeof(buffer)) != sizeof(buffer)) return B_IO_ERROR; - // Note: that does work only for x86, for PowerPC, the super block + // Note: that does work only for x86, for PowerPC, the superblock // may be located at offset 0! memcpy(superBlock, buffer + 512, sizeof(disk_super_block)); if (!superBlock->IsValid()) { @@ -583,11 +583,11 @@ Volume::Initialize(const char *device, const char *name, uint32 blockSize, uint3 off_t numBlocks = deviceSize / blockSize; - // create valid super block + // create valid superblock fSuperBlock.Initialize(name, numBlocks, blockSize); - - // initialize short hands to the super block (to save byte swapping) + + // initialize short hands to the superblock (to save byte swapping) fBlockSize = fSuperBlock.BlockSize(); fBlockShift = fSuperBlock.BlockShift(); fAllocationGroupShift = fSuperBlock.AllocationGroupShift(); diff --git a/src/tests/add-ons/kernel/file_systems/fs_shell/mount.c b/src/tests/add-ons/kernel/file_systems/fs_shell/mount.c index 6f8e4b7486..9ab66ca28a 100644 --- a/src/tests/add-ons/kernel/file_systems/fs_shell/mount.c +++ b/src/tests/add-ons/kernel/file_systems/fs_shell/mount.c @@ -1,8 +1,8 @@ /* This file contains the code that will create a file system, mount a file system and unmount a file system. - - THIS CODE COPYRIGHT DOMINIC GIAMPAOLO. NO WARRANTY IS EXPRESSED + + THIS CODE COPYRIGHT DOMINIC GIAMPAOLO. NO WARRANTY IS EXPRESSED OR IMPLIED. YOU MAY USE THIS CODE AND FREELY DISTRIBUTE IT FOR NON-COMMERCIAL USE AS LONG AS THIS NOTICE REMAINS ATTACHED. @@ -62,7 +62,7 @@ myfs_create_fs(char *device, char *name, int block_size, char *opts) printf("block_size %d is not a power of two!\n", block_size); return NULL; } - + myfs = (myfs_info *)calloc(1, sizeof(myfs_info)); if (myfs == NULL) { @@ -73,7 +73,7 @@ myfs_create_fs(char *device, char *name, int block_size, char *opts) myfs->fd = -1; myfs->nsid = (nspace_id)myfs; /* we can only do this when creating */ - + myfs->dsb.magic1 = SUPER_BLOCK_MAGIC1; myfs->dsb.magic2 = SUPER_BLOCK_MAGIC2; myfs->dsb.magic3 = SUPER_BLOCK_MAGIC3; @@ -84,7 +84,7 @@ myfs_create_fs(char *device, char *name, int block_size, char *opts) printf("can't create semaphore!\n"); goto cleanup; } - + myfs->fd = open(device, O_RDWR); if (myfs->fd < 0) { @@ -126,7 +126,7 @@ myfs_create_fs(char *device, char *name, int block_size, char *opts) printf("create storage map failed\n"); goto cleanup; } - + if (myfs_create_inodes(myfs) != 0) { printf("create inodes failed\n"); goto cleanup; @@ -150,7 +150,7 @@ myfs_create_fs(char *device, char *name, int block_size, char *opts) printf("creating superblock failed\n"); goto cleanup; } - + return myfs; @@ -174,7 +174,7 @@ cleanup: delete_sem(myfs->sem); free(myfs); - } + } return NULL; @@ -191,13 +191,13 @@ super_block_is_sane(myfs_info *myfs) myfs->dsb.magic2 != SUPER_BLOCK_MAGIC2 || myfs->dsb.magic3 != SUPER_BLOCK_MAGIC3) { - printf("warning: super block magic numbers are wrong:\n"); + printf("warning: superblock magic numbers are wrong:\n"); printf("0x%x (0x%x) 0x%x (0x%x) 0x%x (0x%x)\n", myfs->dsb.magic1, SUPER_BLOCK_MAGIC1, myfs->dsb.magic2, SUPER_BLOCK_MAGIC2, myfs->dsb.magic3, SUPER_BLOCK_MAGIC3); return 0; - + } if ((myfs->dsb.block_size % myfs->dev_block_size) != 0) { @@ -214,7 +214,7 @@ super_block_is_sane(myfs_info *myfs) return 0; } - /* make sure that the partition is as big as the super block + /* make sure that the partition is as big as the superblock says it is */ num_dev_blocks = get_num_device_blocks(myfs->fd); if (myfs->dsb.num_blocks * myfs->dsb.block_size > @@ -227,7 +227,7 @@ super_block_is_sane(myfs_info *myfs) if (myfs->dsb.block_size != (1 << myfs->dsb.block_shift)) { int i; - + printf("warning: block_shift %d does not match block size %d\n", myfs->dsb.block_shift, myfs->dsb.block_size); @@ -279,7 +279,7 @@ myfs_mount(nspace_id nsid, const char *device, ulong flags, ret = ENOMEM; goto error0; } - + myfs->fd = open(device, oflags); if (myfs->fd < 0) { printf("could not open %s to try and mount a myfs\n", device); @@ -288,13 +288,13 @@ myfs_mount(nspace_id nsid, const char *device, ulong flags, } if (read_super_block(myfs) != 0) { - printf("could not read super block on device %s\n", device); + printf("could not read superblock on device %s\n", device); ret = EBADF; goto error2; } - + if (super_block_is_sane(myfs) == 0) { - printf("bad super block\n"); + printf("bad superblock\n"); ret = EBADF; goto error2; } @@ -377,15 +377,15 @@ myfs_mount(nspace_id nsid, const char *device, ulong flags, /* note that the order in which things are done here is *very* important. don't mess with it unless you know what you're doing -*/ +*/ int myfs_unmount(void *ns) { myfs_info *myfs = (myfs_info *)ns; - + if (myfs == NULL) return EINVAL; - + sync_journal(myfs); myfs_shutdown_storage_map(myfs); @@ -405,7 +405,7 @@ myfs_unmount(void *ns) shutdown_tmp_blocks(myfs); close(myfs->fd); - + if (myfs->sem > 0) delete_sem(myfs->sem);