Merge branch 'master' into sam460ex

This commit is contained in:
François Revol 2012-09-21 04:14:59 +02:00
commit 8c1740d305
18 changed files with 191 additions and 51 deletions

View File

@ -28,8 +28,6 @@ AddVariableToScript $(script) : isCD : 1 ;
AddVariableToScript $(script) : cdLabel : $(HAIKU_CD_LABEL) ;
AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddVariableToScript $(script) : stripOptionalPackageDebugSymbols
: $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) ;
AddTargetVariableToScript $(script) : <build>addattr ;
AddTargetVariableToScript $(script) : <build>copyattr ;
AddTargetVariableToScript $(script) : <build>rc ;

View File

@ -904,8 +904,6 @@ AddVariableToScript $(script) : addBuildCompatibilityLibDir
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
AddVariableToScript $(script) : dontClearImage : $(HAIKU_DONT_CLEAR_IMAGE) ;
AddVariableToScript $(script) : updateOnly : [ IsUpdateHaikuImageOnly ] ;
AddVariableToScript $(script) : stripOptionalPackageDebugSymbols
: $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) ;
AddTargetVariableToScript $(script) : <build>addattr ;
AddTargetVariableToScript $(script) : <build>bfs_shell : bfsShell ;
AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;

View File

@ -283,16 +283,17 @@ rule CopyDirectoryToContainer container : directoryTokens : sourceDirectory
}
rule ExtractArchiveToContainer container : directoryTokens : archiveFile
: extractedSubDir
: extractedSubDir : stripDebugSymbols
{
# ExtractArchiveToContainer <container> : <directory> : <archiveFile>
# : <extractedSubDir> ;
# : <extractedSubDir> : <stripDebugSymbols> ;
local directory = [ AddDirectoryToContainer $(container)
: $(directoryTokens) ] ;
ARCHIVE_FILES_TO_INSTALL on $(directory) += $(archiveFile) ;
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(archiveFile) = $(extractedSubDir) ;
ARCHIVE_FILES_TO_STRIP on $(archiveFile) = $(stripDebugSymbols) ;
}
rule AddDriversToContainer container : relativeDirectoryTokens : targets
@ -607,6 +608,11 @@ rule CreateContainerExtractFilesScript container : script
ARCHIVE_SUBDIR_TO_INSTALL_FROM on $(dummyTarget) =
$(extractedSubDir:E=.) ;
local stripDebugSymbols = [ on $(archiveFile)
return $(ARCHIVE_FILES_TO_STRIP) ] ;
STRIP_DEBUG_SYMBOLS_FROM_ARCHIVE on $(dummyTarget) =
$(stripDebugSymbols) ;
Depends $(dummyTarget) : $(initScript) $(archiveFile)
$(serializationDependency) ;
Depends $(script) : $(dummyTarget) ;
@ -622,7 +628,8 @@ rule CreateContainerExtractFilesScript container : script
actions AddExtractFileToContainerExtractFilesScript
{
echo extractFile "\"$(2[2])\"" "\"$(TARGET_DIR)\"" \
"\"$(ARCHIVE_SUBDIR_TO_INSTALL_FROM)\"" >> $(2[1])
"\"$(ARCHIVE_SUBDIR_TO_INSTALL_FROM)\"" \
"\"$(STRIP_DEBUG_SYMBOLS_FROM_ARCHIVE)\"" >> $(2[1])
}
@ -729,7 +736,7 @@ rule AddWifiFirmwareToHaikuImage driver : package : archive : extract
}
rule ExtractArchiveToHaikuImage dirTokens : archiveFile : alwaysUpdate
: extractedSubDir
: extractedSubDir : stripDebugSymbols
{
# ExtractArchiveToHaikuImage <dirTokens> : <archiveFile> : <alwaysUpdate>
# : <extractedSubDir> ;
@ -738,7 +745,7 @@ rule ExtractArchiveToHaikuImage dirTokens : archiveFile : alwaysUpdate
# requested.
if ! [ IsUpdateHaikuImageOnly ] || $(alwaysUpdate) {
ExtractArchiveToContainer $(HAIKU_IMAGE_CONTAINER_NAME) : $(dirTokens)
: $(archiveFile) : $(extractedSubDir) ;
: $(archiveFile) : $(extractedSubDir) : $(stripDebugSymbols) ;
}
}
@ -825,6 +832,7 @@ rule InstallSourceArchive file : url
}
rule InstallOptionalHaikuImagePackage package : url : dirTokens : isCDPackage
: stripDebugSymbols
{
# download archive file
local archiveFile = [ DownloadFile $(package) : $(url) ] ;
@ -835,8 +843,17 @@ rule InstallOptionalHaikuImagePackage package : url : dirTokens : isCDPackage
# copy onto image
AddFilesToHaikuImage _packages_ : $(archiveFile) ;
} else {
if $(HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES) = 1 {
stripDebugSymbols ?= 1 ;
# The script will only test for = 1. This is in case someone
# manually set the flag 'true'
if $(stripDebugSymbols) = true {
stripDebugSymbols = 1 ;
}
}
# extract onto image
ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile) ;
ExtractArchiveToHaikuImage $(dirTokens) : $(archiveFile)
: : : $(stripDebugSymbols) ;
}
}
@ -1472,7 +1489,7 @@ actions BuildCDBootPPCImage1 bind MAPS
|| \
genisoimage -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg \
-V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot \
ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd
ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd
#$(RM) -R $(HAIKU_OUTPUT_DIR)/cd
}

View File

@ -848,7 +848,7 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 {
AddHeaderDirectoryToHaikuImage libs tiff : 3rdparty ;
AddHeaderDirectoryToHaikuImage libs zlib : 3rdparty ;
CopyDirectoryToHaikuImage develop headers :
CopyDirectoryToHaikuImage develop headers :
[ FDirName $(HAIKU_FREETYPE_DIR) develop headers 3rdparty ] ;
CopyDirectoryToHaikuImage develop headers : $(HAIKU_JPEG_HEADERS)
: 3rdparty ;
@ -2050,11 +2050,13 @@ if [ IsOptionalHaikuImagePackageAdded wpa_supplicant ] {
} else if $(HAIKU_GCC_VERSION[1]) >= 4 {
InstallOptionalHaikuImagePackage
wpa_supplicant-0.7.3-x86-gcc4-2012-04-03.zip
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2012-04-03.zip ;
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc4-2012-04-03.zip
: : : false ;
} else {
InstallOptionalHaikuImagePackage
wpa_supplicant-0.7.3-x86-gcc2-2012-04-03.zip
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2012-04-03.zip ;
: $(baseURL)/wpa_supplicant-0.7.3-x86-gcc2-2012-04-03.zip
: : : false ;
}
}

View File

@ -16,6 +16,7 @@ switch $(HAIKU_BUILD_PROFILE) {
HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
AddGroupToHaikuImage party : 101 : user sshd ;
HAIKU_IMAGE_HOST_NAME = shredder ;
HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
HAIKU_IMAGE_SIZE = 800 ;
AddOptionalHaikuImagePackages TimGMSoundFont TrackerNewTemplates
@ -37,6 +38,7 @@ switch $(HAIKU_BUILD_PROFILE) {
HAIKU_ROOT_USER_NAME = user ;
HAIKU_ROOT_USER_REAL_NAME = "Yourself" ;
AddGroupToHaikuImage party : 101 : user sshd ;
HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
HAIKU_IMAGE_HOST_NAME = shredder ;
HAIKU_IMAGE_SIZE = 600 ;

View File

@ -63,6 +63,7 @@ HAIKU_IMAGE_DIR = /tmp ;
HAIKU_IMAGE_SIZE = 100 ;
# Enable stripping the debug symbols from optional packages.
# Note, some optional packages may override this to prevent stripping.
HAIKU_STRIP_DEBUG_FROM_OPTIONAL_PACKAGES = 1 ;
# Set image volume label to "Walter". Default label is "Haiku".

View File

@ -16,7 +16,6 @@ set -o errexit
# dontClearImage
# isVMwareImage
# optionalPackageDescriptions
# stripOptionalPackageDebugSymbols
#
# addattr
# copyattr
@ -158,10 +157,11 @@ stripDebugInfo()
extractFile()
{
# extractFile <archive> <directory>
# extractFile <archive> <directory> <extractedSubDir> <stripDebugSymbols>
archiveFile=$1
targetExtractedDir=$2
extractedSubDir=$3
stripDebugSymbols=$4
echo "Extracting $archiveFile ..."
@ -188,7 +188,7 @@ extractFile()
rm $extractDir/.OptionalPackageDescription
fi
if [ "$stripOptionalPackageDebugSymbols" = "1" ]; then
if [ "$stripDebugSymbols" = "1" ]; then
# strip executables in common/bin
if [ -d $extractDir/common/bin ]; then
for file in `find $extractDir/common/bin -type f -a -perm +100 \

View File

@ -192,6 +192,8 @@ get_cpu_model_string(system_info *info)
return "604";
case B_CPU_PPC_604e:
return "604e";
default:
return NULL;
#endif /* __POWERPC__ */
#if __INTEL__
case B_CPU_x86:
@ -395,7 +397,6 @@ get_cpu_model_string(system_info *info)
/* National Semiconductor */
case B_CPU_NATIONAL_GEODE_GX1:
return "Geode GX1";
#endif /* __INTEL__ */
default:
if ((info->cpu_type & B_CPU_x86_VENDOR_MASK) == B_CPU_INTEL_x86) {
@ -404,6 +405,7 @@ get_cpu_model_string(system_info *info)
return parse_intel(cpuidName);
}
return NULL;
#endif /* __INTEL__ */
}
}

View File

@ -70,6 +70,7 @@ struct hda_controller {
area_id regs_area;
vuint8* regs;
uint32 irq;
bool msi;
uint16 codec_status;
uint32 num_input_streams;

View File

@ -12,6 +12,8 @@
#include <algorithm>
#include <PCI_x86.h>
#include "driver.h"
#include "hda_codec_defs.h"
@ -52,6 +54,8 @@ static const struct {
// {B_SR_384000, MAKE_RATE(44100, ??, ??), 384000},
};
static pci_x86_module_info* sPCIx86Module;
static inline void
update_pci_register(hda_controller* controller, uint8 reg, uint32 mask, uint32 value, uint8 size)
@ -797,7 +801,7 @@ hda_hw_init(hda_controller* controller)
uint16 capabilities, stateStatus, cmd;
status_t status;
/* Map MMIO registers */
// Map MMIO registers
controller->regs_area = map_physical_memory("hda_hw_regs",
controller->pci_info.u.h0.base_registers[0],
controller->pci_info.u.h0.base_register_sizes[0], B_ANY_KERNEL_ADDRESS,
@ -808,7 +812,8 @@ hda_hw_init(hda_controller* controller)
}
cmd = (gPci->read_pci_config)(controller->pci_info.bus,
controller->pci_info.device, controller->pci_info.function, PCI_command, 2);
controller->pci_info.device, controller->pci_info.function,
PCI_command, 2);
if (!(cmd & PCI_command_master)) {
(gPci->write_pci_config)(controller->pci_info.bus,
controller->pci_info.device, controller->pci_info.function,
@ -816,18 +821,42 @@ hda_hw_init(hda_controller* controller)
dprintf("hda: enabling PCI bus mastering\n");
}
/* Absolute minimum hw is online; we can now install interrupt handler */
if (get_module(B_PCI_X86_MODULE_NAME, (module_info**)&sPCIx86Module)
!= B_OK)
sPCIx86Module = NULL;
// Absolute minimum hw is online; we can now install interrupt handler
controller->irq = controller->pci_info.u.h0.interrupt_line;
controller->msi = false;
if (sPCIx86Module != NULL && sPCIx86Module->get_msi_count(
controller->pci_info.bus, controller->pci_info.device,
controller->pci_info.function) >= 1) {
// Try MSI first
uint8 vector;
if (sPCIx86Module->configure_msi(controller->pci_info.bus,
controller->pci_info.device, controller->pci_info.function,
1, &vector) == B_OK
&& sPCIx86Module->enable_msi(controller->pci_info.bus,
controller->pci_info.device, controller->pci_info.function)
== B_OK) {
dprintf("hda: using MSI vector %u\n", vector);
controller->irq = vector;
controller->msi = true;
}
}
status = install_io_interrupt_handler(controller->irq,
(interrupt_handler)hda_interrupt_handler, controller, 0);
if (status != B_OK)
goto no_irq;
/* TCSEL is reset to TC0 (clear 0-2 bits) */
// TCSEL is reset to TC0 (clear 0-2 bits)
update_pci_register(controller, PCI_HDA_TCSEL, PCI_HDA_TCSEL_MASK, 0, 1);
/* Enable snooping for ATI and Nvidia, right now for all their hda-devices,
but only based on guessing. */
// Enable snooping for ATI and Nvidia, right now for all their hda-devices,
// but only based on guessing.
switch (controller->pci_info.vendor_id) {
case NVIDIA_VENDORID:
update_pci_register(controller, NVIDIA_HDA_TRANSREG,
@ -854,7 +883,7 @@ hda_hw_init(hda_controller* controller)
controller->num_output_streams = GLOBAL_CAP_OUTPUT_STREAMS(capabilities);
controller->num_bidir_streams = GLOBAL_CAP_BIDIR_STREAMS(capabilities);
/* show some hw features */
// show some hw features
dprintf("hda: HDA v%d.%d, O:%ld/I:%ld/B:%ld, #SDO:%d, 64bit:%s\n",
controller->Read8(HDAC_VERSION_MAJOR),
controller->Read8(HDAC_VERSION_MINOR),
@ -863,29 +892,27 @@ hda_hw_init(hda_controller* controller)
GLOBAL_CAP_NUM_SDO(capabilities),
GLOBAL_CAP_64BIT(capabilities) ? "yes" : "no");
/* Get controller into valid state */
// Get controller into valid state
status = reset_controller(controller);
if (status != B_OK) {
dprintf("hda: reset_controller failed\n");
goto reset_failed;
}
/* Setup CORB/RIRB/DMA POS */
// Setup CORB/RIRB/DMA POS
status = init_corb_rirb_pos(controller);
if (status != B_OK) {
dprintf("hda: init_corb_rirb_pos failed\n");
goto corb_rirb_failed;
}
/*
* Don't enable codec state change interrupts. We don't handle
* them, as we want to use the STATE_STATUS register to identify
* available codecs. We'd have to clear that register in the interrupt
* handler to 'ack' the codec change.
*/
// Don't enable codec state change interrupts. We don't handle
// them, as we want to use the STATE_STATUS register to identify
// available codecs. We'd have to clear that register in the interrupt
// handler to 'ack' the codec change.
controller->Write16(HDAC_WAKE_ENABLE, 0x0);
/* Enable controller interrupts */
// Enable controller interrupts
controller->Write32(HDAC_INTR_CONTROL, INTR_CONTROL_GLOBAL_ENABLE
| INTR_CONTROL_CONTROLLER_ENABLE);
@ -939,6 +966,11 @@ no_irq:
controller->regs_area = B_ERROR;
controller->regs = NULL;
if (sPCIx86Module != NULL) {
put_module(B_PCI_X86_MODULE_NAME);
sPCIx86Module = NULL;
}
error:
dprintf("hda: ERROR: %s(%ld)\n", strerror(status), status);
@ -952,7 +984,7 @@ hda_hw_stop(hda_controller* controller)
{
int index;
/* Stop all audio streams */
// Stop all audio streams
for (index = 0; index < HDA_MAX_STREAMS; index++) {
if (controller->streams[index] && controller->streams[index]->running)
hda_stream_stop(controller, controller->streams[index]);
@ -969,7 +1001,7 @@ hda_hw_uninit(hda_controller* controller)
if (controller == NULL)
return;
/* Stop all audio streams */
// Stop all audio streams
hda_hw_stop(controller);
if (controller->buffer_ready_sem >= B_OK) {
@ -979,13 +1011,24 @@ hda_hw_uninit(hda_controller* controller)
reset_controller(controller);
/* Disable interrupts, and remove interrupt handler */
// Disable interrupts, and remove interrupt handler
controller->Write32(HDAC_INTR_CONTROL, 0);
if (controller->msi) {
// Disable MSI
sPCIx86Module->disable_msi(controller->pci_info.bus,
controller->pci_info.device, controller->pci_info.function);
}
remove_io_interrupt_handler(controller->irq,
(interrupt_handler)hda_interrupt_handler, controller);
/* Delete corb/rirb area */
if (sPCIx86Module != NULL) {
put_module(B_PCI_X86_MODULE_NAME);
sPCIx86Module = NULL;
}
// Delete corb/rirb area
if (controller->corb_rirb_pos_area >= 0) {
delete_area(controller->corb_rirb_pos_area);
controller->corb_rirb_pos_area = B_ERROR;
@ -994,17 +1037,16 @@ hda_hw_uninit(hda_controller* controller)
controller->stream_positions = NULL;
}
/* Unmap registers */
// Unmap registers
if (controller->regs_area >= 0) {
delete_area(controller->regs_area);
controller->regs_area = B_ERROR;
controller->regs = NULL;
}
/* Now delete all codecs */
// Now delete all codecs
for (index = 0; index < HDA_MAX_CODECS; index++) {
if (controller->codecs[index] != NULL)
hda_codec_delete(controller->codecs[index]);
}
}

View File

@ -224,7 +224,7 @@ PartitionListRow::PartitionListRow(BPartition* partition)
if (partition->ContainsFileSystem())
SetField(new BStringField(partition->Type()), kFilesystemColumn);
else
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kFilesystemColumn);
SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
}
@ -250,7 +250,7 @@ PartitionListRow::PartitionListRow(BPartition* partition)
delete_driver_settings(handle);
}
SetField(new BStringField(parameters), kParametersColumn);
} else {
SetField(new BStringField(kUnavailableString), kParametersColumn);
@ -281,6 +281,19 @@ PartitionListRow::PartitionListRow(partition_id parentID, partition_id id,
}
const char*
PartitionListRow::DevicePath()
{
BBitmapStringField* stringField
= dynamic_cast<BBitmapStringField*>(GetField(kDeviceColumn));
if (stringField == NULL)
return NULL;
return stringField->String();
}
// #pragma mark - PartitionListView
@ -312,6 +325,30 @@ PartitionListView::AttachedToWindow()
}
bool
PartitionListView::InitiateDrag(BPoint rowPoint, bool wasSelected)
{
PartitionListRow* draggedRow
= dynamic_cast<PartitionListRow*>(RowAt(rowPoint));
if (draggedRow == NULL)
return false;
const char* draggedPath = draggedRow->DevicePath();
if (draggedPath == NULL)
return false;
BRect draggedRowRect;
GetRowRect(draggedRow, &draggedRowRect);
BMessage dragMessage(B_MIME_DATA);
dragMessage.AddData("text/plain", B_MIME_TYPE, draggedPath,
strlen(draggedPath));
DragMessage(&dragMessage, draggedRowRect, NULL);
return true;
}
PartitionListRow*
PartitionListView::FindRow(partition_id id, PartitionListRow* parent)
{

View File

@ -77,6 +77,9 @@ public:
{ return fOffset; }
off_t Size() const
{ return fSize; }
const char* DevicePath();
private:
partition_id fPartitionID;
partition_id fParentID;
@ -93,6 +96,8 @@ public:
virtual void AttachedToWindow();
virtual bool InitiateDrag(BPoint rowPoint, bool wasSelected);
PartitionListRow* FindRow(partition_id id,
PartitionListRow* parent = NULL);
PartitionListRow* AddPartition(BPartition* partition);

View File

@ -9324,7 +9324,8 @@ BPoseView::MoveColumnTo(BColumn* src, BColumn* dest)
BColumn* column = fColumnList->ItemAt(index);
column->SetOffset(offset);
last = column;
offset = last->Offset() + last->Width() + kTitleColumnExtraMargin;
offset = last->Offset() + last->Width() + kTitleColumnExtraMargin
- kRoomForLine / 2;
}
// invalidate everything to the right of miny

View File

@ -17,7 +17,6 @@
#include <boot/menu.h>
#include <boot/kernel_args.h>
#include <boot/platform/generic/video.h>
#include <board_config.h>
#include <util/list.h>
#include <drivers/driver_settings.h>

View File

@ -10,13 +10,13 @@
#include "arch_framebuffer.h"
#include <arch/arm/pxa270.h>
#include <arch/cpu.h>
#include <boot/stage2.h>
#include <boot/platform.h>
#include <boot/menu.h>
#include <boot/kernel_args.h>
#include <boot/platform/generic/video.h>
#include <board_config.h>
#include <util/list.h>
#include <drivers/driver_settings.h>
@ -101,7 +101,7 @@ dprintf("error %08x\n", err);
return B_NO_INIT;
pixelFormat = bppCode = read_io_32(LCCR3);
bppCode = (bppCode >> 26) & 0x08 | (bppCode >> 24) & 0x07;
bppCode = ((bppCode >> 26) & 0x08) | ((bppCode >> 24) & 0x07);
pixelFormat >>= 30;
dma = (struct pxa27x_lcd_dma_descriptor *)(read_io_32(FDADR0) & ~0x0f);
@ -147,7 +147,7 @@ status_t
ArchFBArmPxa270::SetVideoMode(int width, int height, int depth)
{
dprintf("%s(%d, %d, %d)\n", __FUNCTION__, width, height, depth);
status_t err;
void *fb;
uint32 fbSize = width * height * depth / 8;
//fb = malloc(800 * 600 * 4 + 16 - 1);

View File

@ -10,6 +10,7 @@
#include <arch/cpu.h>
#include <arch_kernel.h>
#include <arch_system_info.h>
#include <boot/stage2.h>
#include <string.h>

View File

@ -3059,6 +3059,8 @@ cache_abort_sub_transaction(void* _cache, int32 id)
block->transaction_next = NULL;
block->transaction = NULL;
transaction->num_blocks--;
if (block->previous_transaction == NULL) {
cache->Free(block->original_data);
block->original_data = NULL;

View File

@ -20,6 +20,8 @@
#define TEST_BLOCKS(number, count) \
test_blocks(number, count, __LINE__)
#define TEST_TRANSACTION(id, num, mainNum, subNum) \
test_transaction(id, num, mainNum, subNum, __LINE__)
#define TEST_BLOCK_DATA(block, number, type) \
if ((block)->type ## _data != NULL && gBlocks[(number)]. type == 0) \
@ -157,6 +159,28 @@ init_test_blocks()
}
void
test_transaction(int32 id, int32 numBlocks, int32 numMainBlocks,
int32 numSubBlocks, int32 line)
{
MutexLocker locker(&gCache->lock);
cache_transaction* transaction = lookup_transaction(gCache, id);
if (numBlocks != transaction->num_blocks) {
error(line, "Transaction %d has wrong num_blocks (is %d, should be "
"%d)!", id, transaction->num_blocks, numBlocks);
}
if (numMainBlocks != transaction->main_num_blocks) {
error(line, "Transaction %d has wrong num_blocks (is %d, should be "
"%d)!", id, transaction->main_num_blocks, numMainBlocks);
}
if (numSubBlocks != transaction->sub_num_blocks) {
error(line, "Transaction %d has wrong num_blocks (is %d, should be "
"%d)!", id, transaction->sub_num_blocks, numSubBlocks);
}
}
void
test_blocks(off_t number, int32 count, int32 line)
{
@ -391,7 +415,9 @@ test_abort_sub_transaction()
block_cache_put(gCache, 1);
TEST_TRANSACTION(id, 2, 2, 1);
cache_abort_sub_transaction(gCache, id);
TEST_TRANSACTION(id, 2, 2, 0);
gBlocks[0].write = true;
gBlocks[0].is_dirty = false;
@ -417,7 +443,9 @@ test_abort_sub_transaction()
gBlocks[1].is_dirty = true;
TEST_BLOCKS(1, 1);
TEST_TRANSACTION(id, 1, 0, 0);
cache_start_sub_transaction(gCache, id);
TEST_TRANSACTION(id, 1, 1, 0);
gBlocks[0].present = true;
@ -427,7 +455,9 @@ test_abort_sub_transaction()
block_cache_put(gCache, 0);
TEST_TRANSACTION(id, 2, 1, 1);
cache_abort_sub_transaction(gCache, id);
TEST_TRANSACTION(id, 1, 1, 0);
gBlocks[0].write = false;
gBlocks[0].is_dirty = false;
@ -445,9 +475,6 @@ test_abort_sub_transaction()
void
test_block_cache_discard()
{
// TODO: test transaction-less block caches
// TODO: test read-only block caches
// Test transactions and block caches
start_test("Discard in main");
@ -469,11 +496,14 @@ test_block_cache_discard()
gBlocks[2].present = false;
TEST_TRANSACTION(id, 1, 0, 0);
block = block_cache_get_empty(gCache, 2, id);
TEST_TRANSACTION(id, 2, 0, 0);
block_cache_discard(gCache, 2, 1);
block_cache_put(gCache, 2);
cache_end_transaction(gCache, id, NULL, NULL);
TEST_TRANSACTION(id, 1, 0, 0);
cache_sync_transaction(gCache, id);
start_test("Discard in sub");
@ -606,6 +636,8 @@ main(int argc, char** argv)
{
block_cache_init();
// TODO: test transaction-less block caches
// TODO: test read-only block caches
test_abort_transaction();
test_abort_sub_transaction();
test_block_cache_discard();