mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:38:13 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -184,8 +184,8 @@ void IDEChannel::start_request(AsyncBlockDeviceRequest& request, bool use_dma, b
|
|||
void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult result)
|
||||
{
|
||||
// NOTE: this may be called from the interrupt handler!
|
||||
ASSERT(m_current_request);
|
||||
ASSERT(m_request_lock.is_locked());
|
||||
VERIFY(m_current_request);
|
||||
VERIFY(m_request_lock.is_locked());
|
||||
|
||||
// Now schedule reading back the buffer as soon as we leave the irq handler.
|
||||
// This is important so that we can safely write the buffer back,
|
||||
|
@ -193,7 +193,7 @@ void IDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult resu
|
|||
// before Processor::deferred_call_queue returns!
|
||||
Processor::deferred_call_queue([this, result]() {
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel::complete_current_request result: {}", (int)result);
|
||||
ASSERT(m_current_request);
|
||||
VERIFY(m_current_request);
|
||||
auto& request = *m_current_request;
|
||||
m_current_request = nullptr;
|
||||
|
||||
|
@ -334,7 +334,7 @@ void IDEChannel::handle_irq(const RegisterState&)
|
|||
dbgln_if(PATA_DEBUG, "IDEChannel: Wrote block {}/{}", m_current_request_block_index, m_current_request->block_count());
|
||||
if (++m_current_request_block_index >= m_current_request->block_count()) {
|
||||
// We read the last block, flush cache
|
||||
ASSERT(!m_current_request_flushing_cache);
|
||||
VERIFY(!m_current_request_flushing_cache);
|
||||
m_current_request_flushing_cache = true;
|
||||
m_io_group.io_base().offset(ATA_REG_COMMAND).out<u8>(ATA_CMD_CACHE_FLUSH);
|
||||
} else {
|
||||
|
@ -465,7 +465,7 @@ void IDEChannel::ata_access(Direction direction, bool slave_request, u32 lba, u8
|
|||
u16 cylinder = 0;
|
||||
|
||||
if (lba >= 0x10000000) {
|
||||
ASSERT(capabilities & ATA_CAP_LBA);
|
||||
VERIFY(capabilities & ATA_CAP_LBA);
|
||||
lba_mode = LBAMode::FortyEightBit;
|
||||
head = 0;
|
||||
} else if (capabilities & ATA_CAP_LBA) {
|
||||
|
@ -532,7 +532,7 @@ void IDEChannel::ata_read_sectors_with_dma(bool slave_request, u16 capabilities)
|
|||
prdt().offset = m_dma_buffer_page->paddr();
|
||||
prdt().size = 512 * request.block_count();
|
||||
|
||||
ASSERT(prdt().size <= PAGE_SIZE);
|
||||
VERIFY(prdt().size <= PAGE_SIZE);
|
||||
|
||||
// Stop bus master
|
||||
m_io_group.bus_master_base().out<u8>(0);
|
||||
|
@ -574,7 +574,7 @@ bool IDEChannel::ata_do_read_sector()
|
|||
void IDEChannel::ata_read_sectors(bool slave_request, u16 capabilities)
|
||||
{
|
||||
auto& request = *m_current_request;
|
||||
ASSERT(request.block_count() <= 256);
|
||||
VERIFY(request.block_count() <= 256);
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel::ata_read_sectors");
|
||||
|
||||
auto lba = request.block_index();
|
||||
|
@ -597,7 +597,7 @@ void IDEChannel::ata_write_sectors_with_dma(bool slave_request, u16 capabilities
|
|||
return;
|
||||
}
|
||||
|
||||
ASSERT(prdt().size <= PAGE_SIZE);
|
||||
VERIFY(prdt().size <= PAGE_SIZE);
|
||||
|
||||
// Stop bus master
|
||||
m_io_group.bus_master_base().out<u8>(0);
|
||||
|
@ -623,7 +623,7 @@ void IDEChannel::ata_do_write_sector()
|
|||
;
|
||||
|
||||
u8 status = m_io_group.control_base().in<u8>();
|
||||
ASSERT(status & ATA_SR_DRQ);
|
||||
VERIFY(status & ATA_SR_DRQ);
|
||||
|
||||
auto in_buffer = request.buffer().offset(m_current_request_block_index * 512);
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel: Writing 512 bytes (part {}) (status={:#02x})...", m_current_request_block_index, status);
|
||||
|
@ -641,7 +641,7 @@ void IDEChannel::ata_write_sectors(bool slave_request, u16 capabilities)
|
|||
{
|
||||
auto& request = *m_current_request;
|
||||
|
||||
ASSERT(request.block_count() <= 256);
|
||||
VERIFY(request.block_count() <= 256);
|
||||
u32 start_sector = request.block_index();
|
||||
u32 count = request.block_count();
|
||||
dbgln_if(PATA_DEBUG, "IDEChannel: Writing {} sector(s) @ LBA {}", count, start_sector);
|
||||
|
|
|
@ -59,12 +59,12 @@ size_t IDEController::devices_count() const
|
|||
|
||||
void IDEController::start_request(const StorageDevice&, AsyncBlockDeviceRequest&)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void IDEController::complete_current_request(AsyncDeviceRequest::RequestResult)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT IDEController::IDEController(PCI::Address address, bool force_pio)
|
||||
|
@ -108,7 +108,7 @@ RefPtr<StorageDevice> IDEController::device_by_channel_and_position(u32 index) c
|
|||
case 3:
|
||||
return m_channels[1].slave_device();
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
RefPtr<StorageDevice> IDEController::device(u32 index) const
|
||||
|
|
|
@ -40,12 +40,12 @@ DiskPartitionMetadata::PartitionType::PartitionType(Array<u8, 16> partition_type
|
|||
}
|
||||
UUID DiskPartitionMetadata::PartitionType::to_uuid() const
|
||||
{
|
||||
ASSERT(is_uuid());
|
||||
VERIFY(is_uuid());
|
||||
return m_partition_type;
|
||||
}
|
||||
u8 DiskPartitionMetadata::PartitionType::to_byte_indicator() const
|
||||
{
|
||||
ASSERT(!is_uuid());
|
||||
VERIFY(!is_uuid());
|
||||
return m_partition_type[0];
|
||||
}
|
||||
bool DiskPartitionMetadata::PartitionType::is_uuid() const
|
||||
|
@ -63,7 +63,7 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, u8
|
|||
, m_type(partition_type)
|
||||
{
|
||||
|
||||
ASSERT(m_type.is_valid());
|
||||
VERIFY(m_type.is_valid());
|
||||
}
|
||||
|
||||
DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Array<u8, 16> partition_type)
|
||||
|
@ -72,7 +72,7 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Arr
|
|||
, m_type(partition_type)
|
||||
{
|
||||
|
||||
ASSERT(m_type.is_valid());
|
||||
VERIFY(m_type.is_valid());
|
||||
}
|
||||
|
||||
DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Array<u8, 16> partition_type, UUID unique_guid, u64 special_attributes, String name)
|
||||
|
@ -83,8 +83,8 @@ DiskPartitionMetadata::DiskPartitionMetadata(u64 start_block, u64 end_block, Arr
|
|||
, m_attributes(special_attributes)
|
||||
, m_name(name)
|
||||
{
|
||||
ASSERT(m_type.is_valid());
|
||||
ASSERT(!m_unique_guid.is_zero());
|
||||
VERIFY(m_type.is_valid());
|
||||
VERIFY(!m_unique_guid.is_zero());
|
||||
}
|
||||
|
||||
DiskPartitionMetadata DiskPartitionMetadata::offset(u64 blocks_count) const
|
||||
|
|
|
@ -44,11 +44,11 @@ void EBRPartitionTable::search_extended_partition(const StorageDevice& device, M
|
|||
if (limit == 0)
|
||||
return;
|
||||
// EBRs should not carry more than 2 partitions (because they need to form a linked list)
|
||||
ASSERT(checked_ebr.partitions_count() <= 2);
|
||||
VERIFY(checked_ebr.partitions_count() <= 2);
|
||||
auto checked_logical_partition = checked_ebr.partition(0);
|
||||
|
||||
// If we are pointed to an invalid logical partition, something is seriously wrong.
|
||||
ASSERT(checked_logical_partition.has_value());
|
||||
VERIFY(checked_logical_partition.has_value());
|
||||
m_partitions.append(checked_logical_partition.value().offset(current_block_offset));
|
||||
if (!checked_ebr.contains_ebr())
|
||||
return;
|
||||
|
@ -66,7 +66,7 @@ EBRPartitionTable::EBRPartitionTable(const StorageDevice& device)
|
|||
return;
|
||||
m_valid = true;
|
||||
|
||||
ASSERT(partitions_count() == 0);
|
||||
VERIFY(partitions_count() == 0);
|
||||
|
||||
auto& header = this->header();
|
||||
for (size_t index = 0; index < 4; index++) {
|
||||
|
|
|
@ -79,7 +79,7 @@ GUIDPartitionTable::GUIDPartitionTable(const StorageDevice& device)
|
|||
: MBRPartitionTable(device)
|
||||
{
|
||||
m_cached_header = ByteBuffer::create_zeroed(m_device->block_size());
|
||||
ASSERT(partitions_count() == 0);
|
||||
VERIFY(partitions_count() == 0);
|
||||
if (!initialize())
|
||||
m_valid = false;
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ const GUIDPartitionHeader& GUIDPartitionTable::header() const
|
|||
|
||||
bool GUIDPartitionTable::initialize()
|
||||
{
|
||||
ASSERT(m_cached_header.data() != nullptr);
|
||||
VERIFY(m_cached_header.data() != nullptr);
|
||||
|
||||
auto first_gpt_block = (m_device->block_size() == 512) ? 1 : 0;
|
||||
|
||||
|
|
|
@ -53,12 +53,12 @@ size_t RamdiskController::devices_count() const
|
|||
|
||||
void RamdiskController::start_request(const StorageDevice&, AsyncBlockDeviceRequest&)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void RamdiskController::complete_current_request(AsyncDeviceRequest::RequestResult)
|
||||
{
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
RamdiskController::RamdiskController()
|
||||
|
|
|
@ -100,7 +100,7 @@ KResultOr<size_t> StorageDevice::read(FileDescription&, size_t offset, UserOrKer
|
|||
return EIO;
|
||||
case AsyncDeviceRequest::MemoryFault:
|
||||
// This should never happen, we're writing to a kernel buffer!
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ KResultOr<size_t> StorageDevice::write(FileDescription&, size_t offset, const Us
|
|||
return EIO;
|
||||
case AsyncDeviceRequest::MemoryFault:
|
||||
// This should never happen, we're writing to a kernel buffer!
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ KResultOr<size_t> StorageDevice::write(FileDescription&, size_t offset, const Us
|
|||
return EIO;
|
||||
case AsyncDeviceRequest::MemoryFault:
|
||||
// This should never happen, we're writing to a kernel buffer!
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ NonnullRefPtrVector<StorageController> StorageManagement::enumerate_controllers(
|
|||
|
||||
NonnullRefPtrVector<StorageDevice> StorageManagement::enumerate_storage_devices() const
|
||||
{
|
||||
ASSERT(!m_controllers.is_empty());
|
||||
VERIFY(!m_controllers.is_empty());
|
||||
NonnullRefPtrVector<StorageDevice> devices;
|
||||
for (auto& controller : m_controllers) {
|
||||
for (size_t device_index = 0; device_index < controller.devices_count(); device_index++) {
|
||||
|
@ -110,7 +110,7 @@ OwnPtr<PartitionTable> StorageManagement::try_to_initialize_partition_table(cons
|
|||
|
||||
NonnullRefPtrVector<DiskPartition> StorageManagement::enumerate_disk_partitions() const
|
||||
{
|
||||
ASSERT(!m_storage_devices.is_empty());
|
||||
VERIFY(!m_storage_devices.is_empty());
|
||||
NonnullRefPtrVector<DiskPartition> partitions;
|
||||
size_t device_index = 0;
|
||||
for (auto& device : m_storage_devices) {
|
||||
|
@ -133,7 +133,7 @@ NonnullRefPtrVector<DiskPartition> StorageManagement::enumerate_disk_partitions(
|
|||
|
||||
void StorageManagement::determine_boot_device()
|
||||
{
|
||||
ASSERT(!m_controllers.is_empty());
|
||||
VERIFY(!m_controllers.is_empty());
|
||||
if (m_boot_argument.starts_with("/dev/")) {
|
||||
StringView device_name = m_boot_argument.substring_view(5);
|
||||
Device::for_each([&](Device& device) {
|
||||
|
@ -153,8 +153,8 @@ void StorageManagement::determine_boot_device()
|
|||
|
||||
void StorageManagement::determine_boot_device_with_partition_uuid()
|
||||
{
|
||||
ASSERT(!m_disk_partitions.is_empty());
|
||||
ASSERT(m_boot_argument.starts_with("PARTUUID="));
|
||||
VERIFY(!m_disk_partitions.is_empty());
|
||||
VERIFY(m_boot_argument.starts_with("PARTUUID="));
|
||||
|
||||
auto partition_uuid = UUID(m_boot_argument.substring_view(strlen("PARTUUID=")));
|
||||
|
||||
|
@ -197,7 +197,7 @@ bool StorageManagement::initialized()
|
|||
|
||||
UNMAP_AFTER_INIT void StorageManagement::initialize(String root_device, bool force_pio)
|
||||
{
|
||||
ASSERT(!StorageManagement::initialized());
|
||||
VERIFY(!StorageManagement::initialized());
|
||||
s_the = new StorageManagement(root_device, force_pio);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue