Upgraded my vocabulary.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5319 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2003-11-11 19:11:25 +00:00
parent c6c7acd44e
commit 43c2ddb481
10 changed files with 118 additions and 118 deletions

View File

@ -72,7 +72,7 @@ public:
if (startBlock < _BlockIndex())
_Rewind();
status_t err = B_OK;
status_t error = B_OK;
while (true) {
Descriptor *descriptor = _CurrentDescriptor();
if (descriptor) {
@ -92,11 +92,11 @@ public:
}
} else {
PRINT(("Descriptor #%ld found NULL\n", _DescriptorNumber()));
err = B_ERROR;
error = B_ERROR;
break;
}
}
RETURN(err);
RETURN(error);
}
private:

View File

@ -29,7 +29,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
if (!id || !name || !length)
return B_BAD_VALUE;
status_t err = B_OK;
status_t error = B_OK;
if (fAtBeginning) {
sprintf(name, ".");
*length = 2;
@ -50,8 +50,8 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
// First read in the static portion of the file id descriptor,
// then, based on the information therein, read in the variable
// length tail portion as well.
err = Parent()->Read(offset, entry, &entryLength, &block);
if (!err && entryLength >= sizeof(udf_file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
error = Parent()->Read(offset, entry, &entryLength, &block);
if (!error && entryLength >= sizeof(udf_file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
PDUMP(entry);
offset += entry->total_length();
@ -68,11 +68,11 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
*id = to_vnode_id(entry->icb());
}
if (!err)
if (!error)
fPosition = offset;
}
RETURN(err);
RETURN(error);
}
/* \brief Rewinds the iterator to point to the first

View File

@ -248,18 +248,18 @@ udf_tag::init_check(uint32 diskBlock)
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "udf_descriptor_tag");
PRINT(("location (paramater) == %ld\n", diskBlock));
PRINT(("location (in structure) == %ld\n", location()));
status_t err = (diskBlock == location()) ? B_OK : B_NO_INIT;
status_t error = (diskBlock == location()) ? B_OK : B_NO_INIT;
// checksum
if (!err) {
if (!error) {
uint32 sum = 0;
for (int i = 0; i <= 3; i++)
sum += ((uint8*)this)[i];
for (int i = 5; i <= 15; i++)
sum += ((uint8*)this)[i];
err = sum % 256 == checksum() ? B_OK : B_NO_INIT;
error = sum % 256 == checksum() ? B_OK : B_NO_INIT;
}
RETURN(err);
RETURN(error);
}

View File

@ -20,17 +20,17 @@ Icb::Icb(Volume *volume, udf_long_address address)
DEBUG_INIT_ETC(CF_PUBLIC, "Icb", ("volume: %p, address(block: %ld, "
"partition: %d, length: %ld)", volume, address.block(),
address.partition(), address.length()));
status_t err = volume ? B_OK : B_BAD_VALUE;
if (!err) {
status_t error = volume ? B_OK : B_BAD_VALUE;
if (!error) {
off_t block;
err = fVolume->MapBlock(address, &block);
if (!err) {
error = fVolume->MapBlock(address, &block);
if (!error) {
udf_icb_header *header = reinterpret_cast<udf_icb_header*>(fData.SetTo(block));
PDUMP(header);
err = header->tag().init_check(address.block());
error = header->tag().init_check(address.block());
}
}
fInitStatus = err;
fInitStatus = error;
}
status_t
@ -104,18 +104,18 @@ Icb::Read(off_t pos, void *buffer, size_t *length, uint32 *block)
status_t
Icb::GetDirectoryIterator(DirectoryIterator **iterator)
{
status_t err = iterator ? B_OK : B_BAD_VALUE;
status_t error = iterator ? B_OK : B_BAD_VALUE;
if (!err) {
if (!error) {
*iterator = new DirectoryIterator(this);
if (*iterator) {
err = fIteratorList.PushBack(*iterator);
error = fIteratorList.PushBack(*iterator);
} else {
err = B_NO_MEMORY;
error = B_NO_MEMORY;
}
}
return err;
return error;
}
status_t
@ -128,8 +128,8 @@ Icb::Find(const char *filename, vnode_id *id)
RETURN(B_BAD_VALUE);
DirectoryIterator *i;
status_t err = GetDirectoryIterator(&i);
if (!err) {
status_t error = GetDirectoryIterator(&i);
if (!error) {
vnode_id entryId;
uint32 length = B_FILE_NAME_LENGTH;
char name[B_FILE_NAME_LENGTH];
@ -146,9 +146,9 @@ Icb::Find(const char *filename, vnode_id *id)
if (foundIt) {
*id = entryId;
} else {
err = B_ENTRY_NOT_FOUND;
error = B_ENTRY_NOT_FOUND;
}
}
RETURN(err);
RETURN(error);
}

View File

@ -138,19 +138,19 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
size_t bytesRead = 0;
Volume *volume = GetVolume();
status_t err = B_OK;
status_t error = B_OK;
uint8 *buffer = reinterpret_cast<uint8*>(_buffer);
bool isFirstBlock = true;
while (bytesLeft > 0 && !err) {
while (bytesLeft > 0 && !error) {
PRINT(("pos: %Ld\n", pos));
PRINT(("bytesLeft: %ld\n", bytesLeft));
udf_long_address extent;
bool isEmpty = false;
err = list.FindExtent(pos, &extent, &isEmpty);
if (!err) {
error = list.FindExtent(pos, &extent, &isEmpty);
if (!error) {
PRINT(("found extent for offset %Ld: (block: %ld, partition: %d, length: %ld, type: %d)\n",
pos, extent.block(), extent.partition(), extent.length(), extent.type()));
@ -166,11 +166,11 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
default:
PRINT(("Invalid extent type found: %d\n", extent.type()));
err = B_ERROR;
error = B_ERROR;
break;
}
if (!err) {
if (!error) {
// Note the unmapped first block of the total read in
// the block output parameter if provided
if (isFirstBlock) {
@ -187,8 +187,8 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
// Block aligned and at least one full block left. Read in using
// cached_read() calls.
off_t diskBlock;
err = volume->MapBlock(extent, &diskBlock);
if (!err) {
error = volume->MapBlock(extent, &diskBlock);
if (!error) {
size_t fullBlockBytesLeft = fullBlocksLeft << volume->BlockShift();
size_t readLength = fullBlockBytesLeft < extent.length()
? fullBlockBytesLeft
@ -199,17 +199,17 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
memset(buffer, 0, readLength);
} else {
off_t diskBlock;
err = volume->MapBlock(extent, &diskBlock);
if (!err) {
error = volume->MapBlock(extent, &diskBlock);
if (!error) {
PRINT(("reading %ld bytes from disk block %Ld using cached_read()\n",
readLength, diskBlock));
err = cached_read(volume->Device(), diskBlock, buffer,
error = cached_read(volume->Device(), diskBlock, buffer,
readLength >> volume->BlockShift(),
volume->BlockSize());
}
}
if (!err) {
if (!error) {
bytesLeft -= readLength;
bytesRead += readLength;
pos += readLength;
@ -242,20 +242,20 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
memset(buffer, 0, partialLength);
} else {
off_t diskBlock;
err = volume->MapBlock(extent, &diskBlock);
if (!err) {
error = volume->MapBlock(extent, &diskBlock);
if (!error) {
PRINT(("reading %ld bytes from disk block %Ld using get_block()\n",
partialLength, diskBlock));
uint8 *data = (uint8*)get_block(volume->Device(), diskBlock, volume->BlockSize());
err = data ? B_OK : B_BAD_DATA;
if (!err) {
error = data ? B_OK : B_BAD_DATA;
if (!error) {
memcpy(buffer, data+partialOffset, partialLength);
release_block(volume->Device(), diskBlock);
}
}
}
if (!err) {
if (!error) {
bytesLeft -= partialLength;
bytesRead += partialLength;
pos += partialLength;
@ -265,14 +265,14 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
}
} else {
PRINT(("error finding extent for offset %Ld: 0x%lx, `%s'", pos,
err, strerror(err)));
error, strerror(error)));
break;
}
}
*length = bytesRead;
RETURN(err);
RETURN(error);
}
template <class Descriptor>

View File

@ -57,18 +57,18 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
}
// Check for a valid volume recognition sequence
status_t err = walk_volume_recognition_sequence(device, offset, blockSize, blockShift);
status_t error = walk_volume_recognition_sequence(device, offset, blockSize, blockShift);
// Now hunt down a volume descriptor sequence from one of
// the anchor volume pointers (if there are any).
if (!err) {
err = walk_anchor_volume_descriptor_sequences(device, offset, length,
if (!error) {
error = walk_anchor_volume_descriptor_sequences(device, offset, length,
blockSize, blockShift,
logicalVolumeDescriptor,
partitionDescriptors,
partitionDescriptorCount);
}
RETURN(err);
RETURN(error);
}
status_t
@ -105,8 +105,8 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uin
// should be one block long. We're expecting to find 0 or more iso9660
// vsd's followed by some ECMA-167 vsd's.
MemoryChunk chunk(blockSize);
status_t err = chunk.InitCheck();
if (!err) {
status_t error = chunk.InitCheck();
if (!error) {
bool foundISO = false;
bool foundExtended = false;
bool foundECMA167 = false;
@ -156,10 +156,10 @@ walk_volume_recognition_sequence(int device, off_t offset, uint32 blockSize, uin
// or terminating extended area descriptor with NO ECMA-168
// descriptors, we return B_OK to signal that we should go
// looking for valid anchors.
err = foundECMA167 || (foundExtended && !foundECMA168) ? B_OK : B_ERROR;
error = foundECMA167 || (foundExtended && !foundECMA168) ? B_OK : B_ERROR;
}
RETURN(err);
RETURN(error);
}
static
@ -229,8 +229,8 @@ walk_anchor_volume_descriptor_sequences(int device, off_t offset, off_t length,
PRINT(("block %Ld: vds search failed\n", avds_locations[i]));
}
}
status_t err = found_vds ? B_OK : B_ERROR;
RETURN(err);
status_t error = found_vds ? B_OK : B_ERROR;
RETURN(error);
}
static
@ -247,7 +247,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
bool foundLogicalVolumeDescriptor = false;
uint8 uniquePartitions = 0;
status_t err = B_OK;
status_t error = B_OK;
for (uint32 i = 0; i < count; i++)
{
@ -365,7 +365,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
PRINT(("Found more than kMaxPartitionDescriptors == %d "
"unique partition descriptors!\n",
kMaxPartitionDescriptors));
err = B_BAD_VALUE;
error = B_BAD_VALUE;
break;
}
}
@ -420,13 +420,13 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
PRINT(("found %d unique partition%s\n", uniquePartitions,
(uniquePartitions == 1 ? "" : "s")));
if (!err)
err = foundLogicalVolumeDescriptor ? B_OK : B_ERROR;
if (!err)
err = uniquePartitions >= 1 ? B_OK : B_ERROR;
if (!err)
if (!error)
error = foundLogicalVolumeDescriptor ? B_OK : B_ERROR;
if (!error)
error = uniquePartitions >= 1 ? B_OK : B_ERROR;
if (!error)
partitionDescriptorCount = uniquePartitions;
RETURN(err);
RETURN(error);
}

View File

@ -89,15 +89,15 @@
defined CATEGORY_FILTER, printing will be suppressed.
*/
//----------------------------------------------------------------------
/*! \def REPORT_ERROR(err)
/*! \def REPORT_ERROR(error)
\brief Calls \c LPRINT(x) with a format string listing the error
code in \c err (assumed to be a \c status_t value) and the
code in \c error (assumed to be a \c status_t value) and the
corresponding text error code returned by a call to \c strerror().
This function is called by the \c RETURN* macros, and isn't really
intended for general consumption, but you might find it useful.
\param err A \c status_t error code to report.
\param error A \c status_t error code to report.
If DEBUG is undefined, does nothing.
@ -105,27 +105,27 @@
defined CATEGORY_FILTER, printing will be suppressed.
*/
//----------------------------------------------------------------------
/*! \def RETURN_ERROR(err)
\brief Calls \c REPORT_ERROR(err) if err is a an error code (i.e.
/*! \def RETURN_ERROR(error)
\brief Calls \c REPORT_ERROR(error) if error is a an error code (i.e.
negative), otherwise remains silent. In either case, the enclosing
function is then exited with a call to \c "return err;".
function is then exited with a call to \c "return error;".
\param err A \c status_t error code to report (if negative) and return.
\param error A \c status_t error code to report (if negative) and return.
If DEBUG is undefined, silently returns the value in \c err.
If DEBUG is undefined, silently returns the value in \c error.
\note If the enclosing function's category flags are not part of the currently
defined CATEGORY_FILTER, printing will be suppressed.
*/
//----------------------------------------------------------------------
/*! \def RETURN(err)
/*! \def RETURN(error)
\brief Prints out a description of the error code being returned
(which, in this case, may be either "erroneous" or "successful")
and then exits the enclosing function with a call to \c "return err;".
and then exits the enclosing function with a call to \c "return error;".
\param err A \c status_t error code to report and return.
\param error A \c status_t error code to report and return.
If DEBUG is undefined, silently returns the value in \c err.
If DEBUG is undefined, silently returns the value in \c error.
\note If the enclosing function's category flags are not part of the currently
defined CATEGORY_FILTER, printing will be suppressed.

View File

@ -22,7 +22,7 @@
#endif
#include <unistd.h>
#define DEBUG_TO_FILE 1
#define DEBUG_TO_FILE 0
#if DEBUG_TO_FILE
# include <stdio.h>
@ -238,19 +238,19 @@ private:
(objectPointer)->dump(); \
}
#define REPORT_ERROR(err) { \
LPRINT(("returning error 0x%lx, `%s'\n", err, strerror(err))); \
#define REPORT_ERROR(error) { \
LPRINT(("returning error 0x%lx, `%s'\n", error, strerror(error))); \
}
#define RETURN_ERROR(err) { \
status_t _status = err; \
#define RETURN_ERROR(error) { \
status_t _status = error; \
if (_status < (status_t)B_OK) \
REPORT_ERROR(_status); \
return _status; \
}
#define RETURN(err) { \
status_t _status = err; \
#define RETURN(error) { \
status_t _status = error; \
if (_status < (status_t)B_OK) { \
REPORT_ERROR(_status); \
} else if (_status == (status_t)B_OK) { \

View File

@ -50,8 +50,8 @@ ds_fs_id(partition_data *data, int32 device, uint64 sessionOffset,
// Udf volume names are at most 63 2-byte unicode chars, so 256 UTF-8
// chars should cover us.
status_t err = Udf::udf_recognize(device, (data->offset + sessionOffset), data->blocks, blockSize, name);
if (!err) {
status_t error = Udf::udf_recognize(device, (data->offset + sessionOffset), data->blocks, blockSize, name);
if (!error) {
strcpy(data->file_system_short_name, "udf");
strcpy(data->file_system_long_name, "Universal Disk Format");
strcpy(data->volume_name, name);

View File

@ -240,7 +240,7 @@ udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
INITIALIZE_DEBUGGING_OUTPUT_FILE("/boot/home/Desktop/udf_debug.txt");
DEBUG_INIT_ETC(CF_ENTRY | CF_VOLUME_OPS, NULL, ("name: `%s'", name));
status_t err = B_OK;
status_t error = B_OK;
char *deviceName = (char*)name;
off_t deviceOffset = 0;
off_t deviceSize = 0; // in blocks
@ -256,8 +256,8 @@ udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
// the data in their own partition, as well as the data in any partitions
// that precede them physically on the disc.
int device = open(name, O_RDONLY);
err = device < B_OK ? device : B_OK;
if (!err) {
error = device < B_OK ? device : B_OK;
if (!error) {
// First try to treat the device like a special partition device. If that's
// what we have, then we can use the partition_info data to figure out the
@ -295,8 +295,8 @@ udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
* geometry.cylinder_count * geometry.head_count;
} else {
struct stat stat;
err = fstat(device, &stat) < 0 ? B_ERROR : B_OK;
if (!err) {
error = fstat(device, &stat) < 0 ? B_ERROR : B_OK;
if (!error) {
PRINT(("stat_info:\n"));
PRINT((" st_size: %Ld\n", stat.st_size));
deviceOffset = 0;
@ -308,22 +308,22 @@ udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
// Create and mount the volume
if (!err) {
if (!error) {
volume = new Udf::Volume(nsid);
err = volume ? B_OK : B_NO_MEMORY;
error = volume ? B_OK : B_NO_MEMORY;
}
if (!err) {
err = volume->Mount(deviceName, deviceOffset, deviceSize, 2048, flags);
if (!error) {
error = volume->Mount(deviceName, deviceOffset, deviceSize, 2048, flags);
}
if (!err) {
if (!error) {
if (rootID)
*rootID = volume->RootIcb()->Id();
if (volumeCookie)
*volumeCookie = volume;
}
RETURN(err);
RETURN(error);
}
@ -403,10 +403,10 @@ udf_read_vnode(void *ns, vnode_id id, char reenter, void **node)
// Convert the given vnode id to an address, and create
// and return a corresponding Icb object for it.
Udf::Icb *icb = new Udf::Icb(volume, Udf::to_long_address(id, volume->BlockSize()));
status_t err = icb ? B_OK : B_NO_MEMORY;
if (!err) {
err = icb->InitCheck();
if (!err) {
status_t error = icb ? B_OK : B_NO_MEMORY;
if (!error) {
error = icb->InitCheck();
if (!error) {
if (node)
*node = reinterpret_cast<void*>(icb);
} else {
@ -414,7 +414,7 @@ udf_read_vnode(void *ns, vnode_id id, char reenter, void **node)
}
}
RETURN(err);
RETURN(error);
}
@ -465,22 +465,22 @@ udf_walk(void *ns, void *_dir, const char *filename, char **resolvedPath, vnode_
Udf::Icb *dir = reinterpret_cast<Udf::Icb*>(_dir);
Udf::Icb *node = NULL;
status_t err = B_OK;
status_t error = B_OK;
if (strcmp(filename, ".") == 0) {
*vnodeId = dir->Id();
err = get_vnode(volume->Id(), *vnodeId, reinterpret_cast<void**>(&node)) == B_OK ? B_OK : B_BAD_VALUE;
error = get_vnode(volume->Id(), *vnodeId, reinterpret_cast<void**>(&node)) == B_OK ? B_OK : B_BAD_VALUE;
} else {
err = dir->Find(filename, vnodeId);
if (!err) {
error = dir->Find(filename, vnodeId);
if (!error) {
Udf::Icb *icb;
err = get_vnode(volume->Id(), *vnodeId, reinterpret_cast<void**>(&icb));
error = get_vnode(volume->Id(), *vnodeId, reinterpret_cast<void**>(&icb));
}
}
PRINT(("vnodeId: %Ld\n", *vnodeId));
RETURN(err);
RETURN(error);
}
@ -714,22 +714,22 @@ udf_open_dir(void *ns, void *node, void **cookie)
Udf::Icb *dir = reinterpret_cast<Udf::Icb*>(node);
status_t err = B_OK;
status_t error = B_OK;
if (dir->IsDirectory()) {
Udf::DirectoryIterator *iterator = NULL;
err = dir->GetDirectoryIterator(&iterator);
if (!err) {
error = dir->GetDirectoryIterator(&iterator);
if (!error) {
*cookie = reinterpret_cast<void*>(iterator);
} else {
PRINT(("Error getting directory iterator: 0x%lx, `%s'\n", err, strerror(err)));
PRINT(("Error getting directory iterator: 0x%lx, `%s'\n", error, strerror(error)));
}
} else {
PRINT(("Given icb is not a directory (type: %d)\n", dir->Type()));
err = B_BAD_VALUE;
error = B_BAD_VALUE;
}
RETURN(err);
RETURN(error);
}
@ -755,19 +755,19 @@ udf_read_dir(void *ns, void *node, void *cookie, long *num,
uint32 nameLength = bufferSize - sizeof(dirent) + 1;
status_t err = iterator->GetNextEntry(dirent->d_name, &nameLength, &(dirent->d_ino));
if (!err) {
status_t error = iterator->GetNextEntry(dirent->d_name, &nameLength, &(dirent->d_ino));
if (!error) {
*num = 1;
dirent->d_dev = volume->Id();
dirent->d_reclen = sizeof(dirent) + nameLength - 1;
} else {
*num = 0;
// Clear the error for end of directory
if (err == B_ENTRY_NOT_FOUND)
err = B_OK;
if (error == B_ENTRY_NOT_FOUND)
error = B_OK;
}
RETURN(err);
RETURN(error);
}