Upgraded my vocabulary.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5319 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c6c7acd44e
commit
43c2ddb481
@ -72,7 +72,7 @@ public:
|
|||||||
if (startBlock < _BlockIndex())
|
if (startBlock < _BlockIndex())
|
||||||
_Rewind();
|
_Rewind();
|
||||||
|
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
while (true) {
|
while (true) {
|
||||||
Descriptor *descriptor = _CurrentDescriptor();
|
Descriptor *descriptor = _CurrentDescriptor();
|
||||||
if (descriptor) {
|
if (descriptor) {
|
||||||
@ -92,11 +92,11 @@ public:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT(("Descriptor #%ld found NULL\n", _DescriptorNumber()));
|
PRINT(("Descriptor #%ld found NULL\n", _DescriptorNumber()));
|
||||||
err = B_ERROR;
|
error = B_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -29,7 +29,7 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
|
|||||||
if (!id || !name || !length)
|
if (!id || !name || !length)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
if (fAtBeginning) {
|
if (fAtBeginning) {
|
||||||
sprintf(name, ".");
|
sprintf(name, ".");
|
||||||
*length = 2;
|
*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,
|
// First read in the static portion of the file id descriptor,
|
||||||
// then, based on the information therein, read in the variable
|
// then, based on the information therein, read in the variable
|
||||||
// length tail portion as well.
|
// length tail portion as well.
|
||||||
err = Parent()->Read(offset, entry, &entryLength, &block);
|
error = Parent()->Read(offset, entry, &entryLength, &block);
|
||||||
if (!err && entryLength >= sizeof(udf_file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
|
if (!error && entryLength >= sizeof(udf_file_id_descriptor) && entry->tag().init_check(block) == B_OK) {
|
||||||
PDUMP(entry);
|
PDUMP(entry);
|
||||||
offset += entry->total_length();
|
offset += entry->total_length();
|
||||||
|
|
||||||
@ -68,11 +68,11 @@ DirectoryIterator::GetNextEntry(char *name, uint32 *length, vnode_id *id)
|
|||||||
*id = to_vnode_id(entry->icb());
|
*id = to_vnode_id(entry->icb());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err)
|
if (!error)
|
||||||
fPosition = offset;
|
fPosition = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* \brief Rewinds the iterator to point to the first
|
/* \brief Rewinds the iterator to point to the first
|
||||||
|
@ -248,18 +248,18 @@ udf_tag::init_check(uint32 diskBlock)
|
|||||||
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "udf_descriptor_tag");
|
DEBUG_INIT(CF_PUBLIC | CF_VOLUME_OPS | CF_HIGH_VOLUME, "udf_descriptor_tag");
|
||||||
PRINT(("location (paramater) == %ld\n", diskBlock));
|
PRINT(("location (paramater) == %ld\n", diskBlock));
|
||||||
PRINT(("location (in structure) == %ld\n", location()));
|
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
|
// checksum
|
||||||
if (!err) {
|
if (!error) {
|
||||||
uint32 sum = 0;
|
uint32 sum = 0;
|
||||||
for (int i = 0; i <= 3; i++)
|
for (int i = 0; i <= 3; i++)
|
||||||
sum += ((uint8*)this)[i];
|
sum += ((uint8*)this)[i];
|
||||||
for (int i = 5; i <= 15; i++)
|
for (int i = 5; i <= 15; i++)
|
||||||
sum += ((uint8*)this)[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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@ Icb::Icb(Volume *volume, udf_long_address address)
|
|||||||
DEBUG_INIT_ETC(CF_PUBLIC, "Icb", ("volume: %p, address(block: %ld, "
|
DEBUG_INIT_ETC(CF_PUBLIC, "Icb", ("volume: %p, address(block: %ld, "
|
||||||
"partition: %d, length: %ld)", volume, address.block(),
|
"partition: %d, length: %ld)", volume, address.block(),
|
||||||
address.partition(), address.length()));
|
address.partition(), address.length()));
|
||||||
status_t err = volume ? B_OK : B_BAD_VALUE;
|
status_t error = volume ? B_OK : B_BAD_VALUE;
|
||||||
if (!err) {
|
if (!error) {
|
||||||
off_t block;
|
off_t block;
|
||||||
err = fVolume->MapBlock(address, &block);
|
error = fVolume->MapBlock(address, &block);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
udf_icb_header *header = reinterpret_cast<udf_icb_header*>(fData.SetTo(block));
|
udf_icb_header *header = reinterpret_cast<udf_icb_header*>(fData.SetTo(block));
|
||||||
PDUMP(header);
|
PDUMP(header);
|
||||||
err = header->tag().init_check(address.block());
|
error = header->tag().init_check(address.block());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fInitStatus = err;
|
fInitStatus = error;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
@ -104,18 +104,18 @@ Icb::Read(off_t pos, void *buffer, size_t *length, uint32 *block)
|
|||||||
status_t
|
status_t
|
||||||
Icb::GetDirectoryIterator(DirectoryIterator **iterator)
|
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);
|
*iterator = new DirectoryIterator(this);
|
||||||
if (*iterator) {
|
if (*iterator) {
|
||||||
err = fIteratorList.PushBack(*iterator);
|
error = fIteratorList.PushBack(*iterator);
|
||||||
} else {
|
} else {
|
||||||
err = B_NO_MEMORY;
|
error = B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
@ -128,8 +128,8 @@ Icb::Find(const char *filename, vnode_id *id)
|
|||||||
RETURN(B_BAD_VALUE);
|
RETURN(B_BAD_VALUE);
|
||||||
|
|
||||||
DirectoryIterator *i;
|
DirectoryIterator *i;
|
||||||
status_t err = GetDirectoryIterator(&i);
|
status_t error = GetDirectoryIterator(&i);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
vnode_id entryId;
|
vnode_id entryId;
|
||||||
uint32 length = B_FILE_NAME_LENGTH;
|
uint32 length = B_FILE_NAME_LENGTH;
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
@ -146,9 +146,9 @@ Icb::Find(const char *filename, vnode_id *id)
|
|||||||
if (foundIt) {
|
if (foundIt) {
|
||||||
*id = entryId;
|
*id = entryId;
|
||||||
} else {
|
} else {
|
||||||
err = B_ENTRY_NOT_FOUND;
|
error = B_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
@ -138,19 +138,19 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
|
|||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
|
|
||||||
Volume *volume = GetVolume();
|
Volume *volume = GetVolume();
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
uint8 *buffer = reinterpret_cast<uint8*>(_buffer);
|
uint8 *buffer = reinterpret_cast<uint8*>(_buffer);
|
||||||
bool isFirstBlock = true;
|
bool isFirstBlock = true;
|
||||||
|
|
||||||
while (bytesLeft > 0 && !err) {
|
while (bytesLeft > 0 && !error) {
|
||||||
|
|
||||||
PRINT(("pos: %Ld\n", pos));
|
PRINT(("pos: %Ld\n", pos));
|
||||||
PRINT(("bytesLeft: %ld\n", bytesLeft));
|
PRINT(("bytesLeft: %ld\n", bytesLeft));
|
||||||
|
|
||||||
udf_long_address extent;
|
udf_long_address extent;
|
||||||
bool isEmpty = false;
|
bool isEmpty = false;
|
||||||
err = list.FindExtent(pos, &extent, &isEmpty);
|
error = list.FindExtent(pos, &extent, &isEmpty);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
PRINT(("found extent for offset %Ld: (block: %ld, partition: %d, length: %ld, type: %d)\n",
|
PRINT(("found extent for offset %Ld: (block: %ld, partition: %d, length: %ld, type: %d)\n",
|
||||||
pos, extent.block(), extent.partition(), extent.length(), extent.type()));
|
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:
|
default:
|
||||||
PRINT(("Invalid extent type found: %d\n", extent.type()));
|
PRINT(("Invalid extent type found: %d\n", extent.type()));
|
||||||
err = B_ERROR;
|
error = B_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
if (!error) {
|
||||||
// Note the unmapped first block of the total read in
|
// Note the unmapped first block of the total read in
|
||||||
// the block output parameter if provided
|
// the block output parameter if provided
|
||||||
if (isFirstBlock) {
|
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
|
// Block aligned and at least one full block left. Read in using
|
||||||
// cached_read() calls.
|
// cached_read() calls.
|
||||||
off_t diskBlock;
|
off_t diskBlock;
|
||||||
err = volume->MapBlock(extent, &diskBlock);
|
error = volume->MapBlock(extent, &diskBlock);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
size_t fullBlockBytesLeft = fullBlocksLeft << volume->BlockShift();
|
size_t fullBlockBytesLeft = fullBlocksLeft << volume->BlockShift();
|
||||||
size_t readLength = fullBlockBytesLeft < extent.length()
|
size_t readLength = fullBlockBytesLeft < extent.length()
|
||||||
? fullBlockBytesLeft
|
? fullBlockBytesLeft
|
||||||
@ -199,17 +199,17 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
|
|||||||
memset(buffer, 0, readLength);
|
memset(buffer, 0, readLength);
|
||||||
} else {
|
} else {
|
||||||
off_t diskBlock;
|
off_t diskBlock;
|
||||||
err = volume->MapBlock(extent, &diskBlock);
|
error = volume->MapBlock(extent, &diskBlock);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
PRINT(("reading %ld bytes from disk block %Ld using cached_read()\n",
|
PRINT(("reading %ld bytes from disk block %Ld using cached_read()\n",
|
||||||
readLength, diskBlock));
|
readLength, diskBlock));
|
||||||
err = cached_read(volume->Device(), diskBlock, buffer,
|
error = cached_read(volume->Device(), diskBlock, buffer,
|
||||||
readLength >> volume->BlockShift(),
|
readLength >> volume->BlockShift(),
|
||||||
volume->BlockSize());
|
volume->BlockSize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
if (!error) {
|
||||||
bytesLeft -= readLength;
|
bytesLeft -= readLength;
|
||||||
bytesRead += readLength;
|
bytesRead += readLength;
|
||||||
pos += readLength;
|
pos += readLength;
|
||||||
@ -242,20 +242,20 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
|
|||||||
memset(buffer, 0, partialLength);
|
memset(buffer, 0, partialLength);
|
||||||
} else {
|
} else {
|
||||||
off_t diskBlock;
|
off_t diskBlock;
|
||||||
err = volume->MapBlock(extent, &diskBlock);
|
error = volume->MapBlock(extent, &diskBlock);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
PRINT(("reading %ld bytes from disk block %Ld using get_block()\n",
|
PRINT(("reading %ld bytes from disk block %Ld using get_block()\n",
|
||||||
partialLength, diskBlock));
|
partialLength, diskBlock));
|
||||||
uint8 *data = (uint8*)get_block(volume->Device(), diskBlock, volume->BlockSize());
|
uint8 *data = (uint8*)get_block(volume->Device(), diskBlock, volume->BlockSize());
|
||||||
err = data ? B_OK : B_BAD_DATA;
|
error = data ? B_OK : B_BAD_DATA;
|
||||||
if (!err) {
|
if (!error) {
|
||||||
memcpy(buffer, data+partialOffset, partialLength);
|
memcpy(buffer, data+partialOffset, partialLength);
|
||||||
release_block(volume->Device(), diskBlock);
|
release_block(volume->Device(), diskBlock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
if (!error) {
|
||||||
bytesLeft -= partialLength;
|
bytesLeft -= partialLength;
|
||||||
bytesRead += partialLength;
|
bytesRead += partialLength;
|
||||||
pos += partialLength;
|
pos += partialLength;
|
||||||
@ -265,14 +265,14 @@ Icb::_Read(DescriptorList &list, off_t pos, void *_buffer, size_t *length, uint3
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PRINT(("error finding extent for offset %Ld: 0x%lx, `%s'", pos,
|
PRINT(("error finding extent for offset %Ld: 0x%lx, `%s'", pos,
|
||||||
err, strerror(err)));
|
error, strerror(error)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*length = bytesRead;
|
*length = bytesRead;
|
||||||
|
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Descriptor>
|
template <class Descriptor>
|
||||||
|
@ -57,18 +57,18 @@ Udf::udf_recognize(int device, off_t offset, off_t length, uint32 blockSize,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for a valid volume recognition sequence
|
// 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
|
// Now hunt down a volume descriptor sequence from one of
|
||||||
// the anchor volume pointers (if there are any).
|
// the anchor volume pointers (if there are any).
|
||||||
if (!err) {
|
if (!error) {
|
||||||
err = walk_anchor_volume_descriptor_sequences(device, offset, length,
|
error = walk_anchor_volume_descriptor_sequences(device, offset, length,
|
||||||
blockSize, blockShift,
|
blockSize, blockShift,
|
||||||
logicalVolumeDescriptor,
|
logicalVolumeDescriptor,
|
||||||
partitionDescriptors,
|
partitionDescriptors,
|
||||||
partitionDescriptorCount);
|
partitionDescriptorCount);
|
||||||
}
|
}
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
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
|
// should be one block long. We're expecting to find 0 or more iso9660
|
||||||
// vsd's followed by some ECMA-167 vsd's.
|
// vsd's followed by some ECMA-167 vsd's.
|
||||||
MemoryChunk chunk(blockSize);
|
MemoryChunk chunk(blockSize);
|
||||||
status_t err = chunk.InitCheck();
|
status_t error = chunk.InitCheck();
|
||||||
if (!err) {
|
if (!error) {
|
||||||
bool foundISO = false;
|
bool foundISO = false;
|
||||||
bool foundExtended = false;
|
bool foundExtended = false;
|
||||||
bool foundECMA167 = 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
|
// or terminating extended area descriptor with NO ECMA-168
|
||||||
// descriptors, we return B_OK to signal that we should go
|
// descriptors, we return B_OK to signal that we should go
|
||||||
// looking for valid anchors.
|
// 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
|
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]));
|
PRINT(("block %Ld: vds search failed\n", avds_locations[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status_t err = found_vds ? B_OK : B_ERROR;
|
status_t error = found_vds ? B_OK : B_ERROR;
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -247,7 +247,7 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
|
|||||||
|
|
||||||
bool foundLogicalVolumeDescriptor = false;
|
bool foundLogicalVolumeDescriptor = false;
|
||||||
uint8 uniquePartitions = 0;
|
uint8 uniquePartitions = 0;
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
|
|
||||||
for (uint32 i = 0; i < count; i++)
|
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 "
|
PRINT(("Found more than kMaxPartitionDescriptors == %d "
|
||||||
"unique partition descriptors!\n",
|
"unique partition descriptors!\n",
|
||||||
kMaxPartitionDescriptors));
|
kMaxPartitionDescriptors));
|
||||||
err = B_BAD_VALUE;
|
error = B_BAD_VALUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -420,13 +420,13 @@ walk_volume_descriptor_sequence(udf_extent_address descriptorSequence,
|
|||||||
PRINT(("found %d unique partition%s\n", uniquePartitions,
|
PRINT(("found %d unique partition%s\n", uniquePartitions,
|
||||||
(uniquePartitions == 1 ? "" : "s")));
|
(uniquePartitions == 1 ? "" : "s")));
|
||||||
|
|
||||||
if (!err)
|
if (!error)
|
||||||
err = foundLogicalVolumeDescriptor ? B_OK : B_ERROR;
|
error = foundLogicalVolumeDescriptor ? B_OK : B_ERROR;
|
||||||
if (!err)
|
if (!error)
|
||||||
err = uniquePartitions >= 1 ? B_OK : B_ERROR;
|
error = uniquePartitions >= 1 ? B_OK : B_ERROR;
|
||||||
if (!err)
|
if (!error)
|
||||||
partitionDescriptorCount = uniquePartitions;
|
partitionDescriptorCount = uniquePartitions;
|
||||||
|
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,15 +89,15 @@
|
|||||||
defined CATEGORY_FILTER, printing will be suppressed.
|
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
|
\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().
|
corresponding text error code returned by a call to \c strerror().
|
||||||
|
|
||||||
This function is called by the \c RETURN* macros, and isn't really
|
This function is called by the \c RETURN* macros, and isn't really
|
||||||
intended for general consumption, but you might find it useful.
|
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.
|
If DEBUG is undefined, does nothing.
|
||||||
|
|
||||||
@ -105,27 +105,27 @@
|
|||||||
defined CATEGORY_FILTER, printing will be suppressed.
|
defined CATEGORY_FILTER, printing will be suppressed.
|
||||||
*/
|
*/
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
/*! \def RETURN_ERROR(err)
|
/*! \def RETURN_ERROR(error)
|
||||||
\brief Calls \c REPORT_ERROR(err) if err is a an error code (i.e.
|
\brief Calls \c REPORT_ERROR(error) if error is a an error code (i.e.
|
||||||
negative), otherwise remains silent. In either case, the enclosing
|
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
|
\note If the enclosing function's category flags are not part of the currently
|
||||||
defined CATEGORY_FILTER, printing will be suppressed.
|
defined CATEGORY_FILTER, printing will be suppressed.
|
||||||
*/
|
*/
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
/*! \def RETURN(err)
|
/*! \def RETURN(error)
|
||||||
\brief Prints out a description of the error code being returned
|
\brief Prints out a description of the error code being returned
|
||||||
(which, in this case, may be either "erroneous" or "successful")
|
(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
|
\note If the enclosing function's category flags are not part of the currently
|
||||||
defined CATEGORY_FILTER, printing will be suppressed.
|
defined CATEGORY_FILTER, printing will be suppressed.
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define DEBUG_TO_FILE 1
|
#define DEBUG_TO_FILE 0
|
||||||
|
|
||||||
#if DEBUG_TO_FILE
|
#if DEBUG_TO_FILE
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
@ -238,19 +238,19 @@ private:
|
|||||||
(objectPointer)->dump(); \
|
(objectPointer)->dump(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REPORT_ERROR(err) { \
|
#define REPORT_ERROR(error) { \
|
||||||
LPRINT(("returning error 0x%lx, `%s'\n", err, strerror(err))); \
|
LPRINT(("returning error 0x%lx, `%s'\n", error, strerror(error))); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RETURN_ERROR(err) { \
|
#define RETURN_ERROR(error) { \
|
||||||
status_t _status = err; \
|
status_t _status = error; \
|
||||||
if (_status < (status_t)B_OK) \
|
if (_status < (status_t)B_OK) \
|
||||||
REPORT_ERROR(_status); \
|
REPORT_ERROR(_status); \
|
||||||
return _status; \
|
return _status; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RETURN(err) { \
|
#define RETURN(error) { \
|
||||||
status_t _status = err; \
|
status_t _status = error; \
|
||||||
if (_status < (status_t)B_OK) { \
|
if (_status < (status_t)B_OK) { \
|
||||||
REPORT_ERROR(_status); \
|
REPORT_ERROR(_status); \
|
||||||
} else if (_status == (status_t)B_OK) { \
|
} else if (_status == (status_t)B_OK) { \
|
||||||
|
@ -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
|
// Udf volume names are at most 63 2-byte unicode chars, so 256 UTF-8
|
||||||
// chars should cover us.
|
// chars should cover us.
|
||||||
|
|
||||||
status_t err = Udf::udf_recognize(device, (data->offset + sessionOffset), data->blocks, blockSize, name);
|
status_t error = Udf::udf_recognize(device, (data->offset + sessionOffset), data->blocks, blockSize, name);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
strcpy(data->file_system_short_name, "udf");
|
strcpy(data->file_system_short_name, "udf");
|
||||||
strcpy(data->file_system_long_name, "Universal Disk Format");
|
strcpy(data->file_system_long_name, "Universal Disk Format");
|
||||||
strcpy(data->volume_name, name);
|
strcpy(data->volume_name, name);
|
||||||
|
@ -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");
|
INITIALIZE_DEBUGGING_OUTPUT_FILE("/boot/home/Desktop/udf_debug.txt");
|
||||||
DEBUG_INIT_ETC(CF_ENTRY | CF_VOLUME_OPS, NULL, ("name: `%s'", name));
|
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;
|
char *deviceName = (char*)name;
|
||||||
off_t deviceOffset = 0;
|
off_t deviceOffset = 0;
|
||||||
off_t deviceSize = 0; // in blocks
|
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
|
// the data in their own partition, as well as the data in any partitions
|
||||||
// that precede them physically on the disc.
|
// that precede them physically on the disc.
|
||||||
int device = open(name, O_RDONLY);
|
int device = open(name, O_RDONLY);
|
||||||
err = device < B_OK ? device : B_OK;
|
error = device < B_OK ? device : B_OK;
|
||||||
if (!err) {
|
if (!error) {
|
||||||
|
|
||||||
// First try to treat the device like a special partition device. If that's
|
// 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
|
// 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;
|
* geometry.cylinder_count * geometry.head_count;
|
||||||
} else {
|
} else {
|
||||||
struct stat stat;
|
struct stat stat;
|
||||||
err = fstat(device, &stat) < 0 ? B_ERROR : B_OK;
|
error = fstat(device, &stat) < 0 ? B_ERROR : B_OK;
|
||||||
if (!err) {
|
if (!error) {
|
||||||
PRINT(("stat_info:\n"));
|
PRINT(("stat_info:\n"));
|
||||||
PRINT((" st_size: %Ld\n", stat.st_size));
|
PRINT((" st_size: %Ld\n", stat.st_size));
|
||||||
deviceOffset = 0;
|
deviceOffset = 0;
|
||||||
@ -308,22 +308,22 @@ udf_mount(nspace_id nsid, const char *name, ulong flags, void *parms,
|
|||||||
|
|
||||||
|
|
||||||
// Create and mount the volume
|
// Create and mount the volume
|
||||||
if (!err) {
|
if (!error) {
|
||||||
volume = new Udf::Volume(nsid);
|
volume = new Udf::Volume(nsid);
|
||||||
err = volume ? B_OK : B_NO_MEMORY;
|
error = volume ? B_OK : B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
if (!err) {
|
if (!error) {
|
||||||
err = volume->Mount(deviceName, deviceOffset, deviceSize, 2048, flags);
|
error = volume->Mount(deviceName, deviceOffset, deviceSize, 2048, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) {
|
if (!error) {
|
||||||
if (rootID)
|
if (rootID)
|
||||||
*rootID = volume->RootIcb()->Id();
|
*rootID = volume->RootIcb()->Id();
|
||||||
if (volumeCookie)
|
if (volumeCookie)
|
||||||
*volumeCookie = volume;
|
*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
|
// Convert the given vnode id to an address, and create
|
||||||
// and return a corresponding Icb object for it.
|
// and return a corresponding Icb object for it.
|
||||||
Udf::Icb *icb = new Udf::Icb(volume, Udf::to_long_address(id, volume->BlockSize()));
|
Udf::Icb *icb = new Udf::Icb(volume, Udf::to_long_address(id, volume->BlockSize()));
|
||||||
status_t err = icb ? B_OK : B_NO_MEMORY;
|
status_t error = icb ? B_OK : B_NO_MEMORY;
|
||||||
if (!err) {
|
if (!error) {
|
||||||
err = icb->InitCheck();
|
error = icb->InitCheck();
|
||||||
if (!err) {
|
if (!error) {
|
||||||
if (node)
|
if (node)
|
||||||
*node = reinterpret_cast<void*>(icb);
|
*node = reinterpret_cast<void*>(icb);
|
||||||
} else {
|
} 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 *dir = reinterpret_cast<Udf::Icb*>(_dir);
|
||||||
Udf::Icb *node = NULL;
|
Udf::Icb *node = NULL;
|
||||||
|
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
|
|
||||||
if (strcmp(filename, ".") == 0) {
|
if (strcmp(filename, ".") == 0) {
|
||||||
*vnodeId = dir->Id();
|
*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 {
|
} else {
|
||||||
err = dir->Find(filename, vnodeId);
|
error = dir->Find(filename, vnodeId);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
Udf::Icb *icb;
|
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));
|
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);
|
Udf::Icb *dir = reinterpret_cast<Udf::Icb*>(node);
|
||||||
|
|
||||||
status_t err = B_OK;
|
status_t error = B_OK;
|
||||||
|
|
||||||
if (dir->IsDirectory()) {
|
if (dir->IsDirectory()) {
|
||||||
Udf::DirectoryIterator *iterator = NULL;
|
Udf::DirectoryIterator *iterator = NULL;
|
||||||
err = dir->GetDirectoryIterator(&iterator);
|
error = dir->GetDirectoryIterator(&iterator);
|
||||||
if (!err) {
|
if (!error) {
|
||||||
*cookie = reinterpret_cast<void*>(iterator);
|
*cookie = reinterpret_cast<void*>(iterator);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
PRINT(("Given icb is not a directory (type: %d)\n", dir->Type()));
|
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;
|
uint32 nameLength = bufferSize - sizeof(dirent) + 1;
|
||||||
|
|
||||||
status_t err = iterator->GetNextEntry(dirent->d_name, &nameLength, &(dirent->d_ino));
|
status_t error = iterator->GetNextEntry(dirent->d_name, &nameLength, &(dirent->d_ino));
|
||||||
if (!err) {
|
if (!error) {
|
||||||
*num = 1;
|
*num = 1;
|
||||||
dirent->d_dev = volume->Id();
|
dirent->d_dev = volume->Id();
|
||||||
dirent->d_reclen = sizeof(dirent) + nameLength - 1;
|
dirent->d_reclen = sizeof(dirent) + nameLength - 1;
|
||||||
} else {
|
} else {
|
||||||
*num = 0;
|
*num = 0;
|
||||||
// Clear the error for end of directory
|
// Clear the error for end of directory
|
||||||
if (err == B_ENTRY_NOT_FOUND)
|
if (error == B_ENTRY_NOT_FOUND)
|
||||||
err = B_OK;
|
error = B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETURN(err);
|
RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user