64-bit compilation fixes for write_overlay and intel partitioning system modules.

This commit is contained in:
Alex Smith
2012-07-20 17:53:59 +01:00
parent 0063d2ba51
commit 7f7e76e461
4 changed files with 55 additions and 45 deletions
@@ -265,7 +265,7 @@ OverlayInode::OverlayInode(OverlayVolume *volume, fs_vnode *superVnode,
fIsDataModified(false), fIsDataModified(false),
fFileCache(NULL) fFileCache(NULL)
{ {
TRACE("inode created %lld\n", fInodeNumber); TRACE("inode created %" B_PRIdINO "\n", fInodeNumber);
recursive_lock_init(&fLock, "write overlay inode lock"); recursive_lock_init(&fLock, "write overlay inode lock");
if (superVnode != NULL) if (superVnode != NULL)
@@ -290,7 +290,7 @@ OverlayInode::OverlayInode(OverlayVolume *volume, fs_vnode *superVnode,
OverlayInode::~OverlayInode() OverlayInode::~OverlayInode()
{ {
TRACE("inode destroyed %lld\n", fInodeNumber); TRACE("inode destroyed %" B_PRIdINO "\n", fInodeNumber);
if (fFileCache != NULL) if (fFileCache != NULL)
file_cache_delete(fFileCache); file_cache_delete(fFileCache);
@@ -73,29 +73,30 @@ check_logical_location(const LogicalPartition* child,
const PrimaryPartition* parent) const PrimaryPartition* parent)
{ {
if (child->PartitionTableOffset() % child->BlockSize() != 0) { if (child->PartitionTableOffset() % child->BlockSize() != 0) {
TRACE(("check_logical_location() - PartitionTableOffset: %lld not a " TRACE(("check_logical_location() - PartitionTableOffset: %" B_PRId64 " "
"multiple of media's block size: %ld\n", "not a multiple of media's block size: %" B_PRId32 "\n",
child->PartitionTableOffset(), child->BlockSize())); child->PartitionTableOffset(), child->BlockSize()));
return false; return false;
} }
if (child->Offset() % child->BlockSize() != 0) { if (child->Offset() % child->BlockSize() != 0) {
TRACE(("check_logical_location() - Parition offset: %lld " TRACE(("check_logical_location() - Parition offset: %" B_PRId64 " "
"is not a multiple of block size: %ld\n", child->Offset(), "is not a multiple of block size: %" B_PRId32 "\n", child->Offset(),
child->BlockSize())); child->BlockSize()));
return false; return false;
} }
if (child->Size() % child->BlockSize() != 0) { if (child->Size() % child->BlockSize() != 0) {
TRACE(("check_logical_location() - Size: (%lld) is not a multiple of" TRACE(("check_logical_location() - Size: (%" B_PRId64 ") is not a "
" block size: (%ld)\n", child->Size(), child->BlockSize())); "multiple of block size: (%" B_PRId32 ")\n", child->Size(),
child->BlockSize()));
return false; return false;
} }
if (child->PartitionTableOffset() < parent->Offset() if (child->PartitionTableOffset() < parent->Offset()
|| child->PartitionTableOffset() >= parent->Offset() || child->PartitionTableOffset() >= parent->Offset()
+ parent->Size()) { + parent->Size()) {
TRACE(("check_logical_location() - Partition table: (%lld) not within " TRACE(("check_logical_location() - Partition table: (%" B_PRId64 ") not"
"extended partition (start: %lld), (end: %lld)\n", " within extended partition (start: %" B_PRId64 "), (end: "
child->PartitionTableOffset(), parent->Offset(), parent->Offset() "%" B_PRId64 ")\n", child->PartitionTableOffset(), parent->Offset(),
+ parent->Size())); parent->Offset() + parent->Size()));
return false; return false;
} }
if (child->Offset() + child->Size() > parent->Offset() + parent->Size()) { if (child->Offset() + child->Size() > parent->Offset() + parent->Size()) {
@@ -99,7 +99,7 @@ get_type_for_content_type(const char* contentType, char* type)
static status_t static status_t
pm_std_ops(int32 op, ...) pm_std_ops(int32 op, ...)
{ {
TRACE(("intel: pm_std_ops(0x%lx)\n", op)); TRACE(("intel: pm_std_ops(0x%" B_PRIx32 ")\n", op));
switch(op) { switch(op) {
case B_MODULE_INIT: case B_MODULE_INIT:
case B_MODULE_UNINIT: case B_MODULE_UNINIT:
@@ -117,9 +117,9 @@ pm_identify_partition(int fd, partition_data* partition, void** cookie)
if (fd < 0 || !partition || !cookie) if (fd < 0 || !partition || !cookie)
return -1; return -1;
TRACE(("intel: pm_identify_partition(%d, %ld: %lld, %lld, %ld)\n", fd, TRACE(("intel: pm_identify_partition(%d, %" B_PRId32 ": %" B_PRId64 ", "
partition->id, partition->offset, partition->size, "%" B_PRId64 ", %" B_PRId32 ")\n", fd, partition->id, partition->offset,
partition->block_size)); partition->size, partition->block_size));
// reject extended partitions // reject extended partitions
if (partition->type if (partition->type
&& !strcmp(partition->type, kPartitionTypeIntelExtended)) { && !strcmp(partition->type, kPartitionTypeIntelExtended)) {
@@ -182,9 +182,9 @@ pm_scan_partition(int fd, partition_data* partition, void* cookie)
if (fd < 0 || !partition || !cookie) if (fd < 0 || !partition || !cookie)
return B_ERROR; return B_ERROR;
TRACE(("intel: pm_scan_partition(%d, %ld: %lld, %lld, %ld)\n", fd, TRACE(("intel: pm_scan_partition(%d, %" B_PRId32 ": %" B_PRId64 ", "
partition->id, partition->offset, partition->size, "%" B_PRId64 ", %" B_PRId32 ")\n", fd, partition->id, partition->offset,
partition->block_size)); partition->size, partition->block_size));
PartitionMapCookie* map = (PartitionMapCookie*)cookie; PartitionMapCookie* map = (PartitionMapCookie*)cookie;
// fill in the partition_data structure // fill in the partition_data structure
@@ -287,7 +287,7 @@ pm_free_partition_content_cookie(partition_data* partition)
static status_t static status_t
ep_std_ops(int32 op, ...) ep_std_ops(int32 op, ...)
{ {
TRACE(("intel: ep_std_ops(0x%lx)\n", op)); TRACE(("intel: ep_std_ops(0x%" B_PRIx32 ")\n", op));
switch(op) { switch(op) {
case B_MODULE_INIT: case B_MODULE_INIT:
case B_MODULE_UNINIT: case B_MODULE_UNINIT:
@@ -305,8 +305,9 @@ ep_identify_partition(int fd, partition_data* partition, void** cookie)
if (fd < 0 || !partition || !cookie || !partition->cookie) if (fd < 0 || !partition || !cookie || !partition->cookie)
return -1; return -1;
TRACE(("intel: ep_identify_partition(%d, %lld, %lld, %ld)\n", fd, TRACE(("intel: ep_identify_partition(%d, %" B_PRId64 ", %" B_PRId64 ", "
partition->offset, partition->size, partition->block_size)); "%" B_PRId32 ")\n", fd, partition->offset, partition->size,
partition->block_size));
// our parent must be a intel partition map partition and we must have // our parent must be a intel partition map partition and we must have
// extended partition type // extended partition type
@@ -333,8 +334,9 @@ ep_scan_partition(int fd, partition_data* partition, void* cookie)
if (fd < 0 || !partition || !partition->cookie) if (fd < 0 || !partition || !partition->cookie)
return B_ERROR; return B_ERROR;
TRACE(("intel: ep_scan_partition(%d, %lld, %lld, %ld)\n", fd, TRACE(("intel: ep_scan_partition(%d, %" B_PRId64 ", %" B_PRId64 ", "
partition->offset, partition->size, partition->block_size)); "%" B_PRId32 ")\n", fd, partition->offset, partition->size,
partition->block_size));
partition_data* parent = get_parent_partition(partition->id); partition_data* parent = get_parent_partition(partition->id);
if (!parent) if (!parent)
@@ -373,7 +375,7 @@ ep_scan_partition(int fd, partition_data* partition, void* cookie)
// parameters // parameters
char buffer[128]; char buffer[128];
sprintf(buffer, "active %s ;\npartition_table_offset %lld ;\n", sprintf(buffer, "active %s ;\npartition_table_offset %" B_PRId64 " ;\n",
logical->Active() ? "true" : "false", logical->Active() ? "true" : "false",
logical->PartitionTableOffset()); logical->PartitionTableOffset());
child->parameters = strdup(buffer); child->parameters = strdup(buffer);
@@ -679,7 +679,8 @@ get_partitionable_spaces(partition_data* partition,
if (positions) if (positions)
delete[] positions; delete[] positions;
TRACE(("intel: get_partitionable_spaces - found: %ld\n", actualCount)); TRACE(("intel: get_partitionable_spaces - found: %" B_PRId32 "\n",
actualCount));
*_actualCount = actualCount; *_actualCount = actualCount;
@@ -752,8 +753,8 @@ status_t
pm_shadow_changed(partition_data* partition, partition_data* child, pm_shadow_changed(partition_data* partition, partition_data* child,
uint32 operation) uint32 operation)
{ {
TRACE(("intel: pm_shadow_changed(%p, %p, %lu)\n", partition, child, TRACE(("intel: pm_shadow_changed(%p, %p, %" B_PRIu32 ")\n", partition,
operation)); child, operation));
switch (operation) { switch (operation) {
case B_PARTITION_SHADOW: case B_PARTITION_SHADOW:
@@ -763,14 +764,16 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
partition->id); partition->id);
if (!physicalPartition) { if (!physicalPartition) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW): no " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW): no "
"physical partition with ID %ld\n", partition->id); "physical partition with ID %" B_PRId32 "\n",
partition->id);
return B_ERROR; return B_ERROR;
} }
// clone the map // clone the map
if (!physicalPartition->content_cookie) { if (!physicalPartition->content_cookie) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW): no " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW): no "
"content cookie, physical partition: %ld\n", partition->id); "content cookie, physical partition: %" B_PRId32 "\n",
partition->id);
return B_ERROR; return B_ERROR;
} }
@@ -796,13 +799,14 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
partition_data* physical = get_partition(child->id); partition_data* physical = get_partition(child->id);
if (!physical) { if (!physical) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): "
"no physical partition with ID %ld\n", child->id); "no physical partition with ID %" B_PRId32 "\n", child->id);
return B_ERROR; return B_ERROR;
} }
if (!physical->cookie) { if (!physical->cookie) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): "
"no cookie, physical partition: %ld\n", child->id); "no cookie, physical partition: %" B_PRId32 "\n",
child->id);
return B_ERROR; return B_ERROR;
} }
@@ -811,7 +815,7 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
if (!partition->content_cookie) { if (!partition->content_cookie) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): "
"no content cookie, physical partition: %ld\n", "no content cookie, physical partition: %" B_PRId32 "\n",
partition->id); partition->id);
return B_ERROR; return B_ERROR;
} }
@@ -823,8 +827,8 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
if (!primary || primary->IsEmpty()) { if (!primary || primary->IsEmpty()) {
dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_SHADOW_CHILD): "
"partition %ld is empty, primary index: %ld\n", child->id, "partition %" B_PRId32 " is empty, primary index: "
index); "%" B_PRId32 "\n", child->id, index);
return B_BAD_VALUE; return B_BAD_VALUE;
} }
@@ -849,7 +853,8 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
{ {
if (!partition->content_cookie) { if (!partition->content_cookie) {
dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): "
"no content cookie, partition: %ld\n", partition->id); "no content cookie, partition: %" B_PRId32 "\n",
partition->id);
return B_ERROR; return B_ERROR;
} }
@@ -867,7 +872,8 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
if (!primary) { if (!primary) {
dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): "
"no empty primary slot, partition: %ld\n", partition->id); "no empty primary slot, partition: %" B_PRId32 "\n",
partition->id);
return B_ERROR; return B_ERROR;
} }
@@ -876,7 +882,8 @@ pm_shadow_changed(partition_data* partition, partition_data* child,
type.SetType(child->type); type.SetType(child->type);
if (!type.IsValid()) { if (!type.IsValid()) {
dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): " dprintf("intel: pm_shadow_changed(B_PARTITION_CREATE_CHILD): "
"invalid partition type, partition: %ld\n", partition->id); "invalid partition type, partition: %" B_PRId32 "\n",
partition->id);
return B_ERROR; return B_ERROR;
} }
@@ -1065,7 +1072,7 @@ move_block(int fd, off_t fromOffset, off_t toOffset, uint8* buffer, int32 size)
error = errno; error = errno;
if (error == B_OK) if (error == B_OK)
error = B_IO_ERROR; error = B_IO_ERROR;
TRACE(("intel: move_block(): reading failed: %lx\n", error)); TRACE(("intel: move_block(): reading failed: %" B_PRIx32 "\n", error));
return error; return error;
} }
@@ -1074,7 +1081,7 @@ move_block(int fd, off_t fromOffset, off_t toOffset, uint8* buffer, int32 size)
error = errno; error = errno;
if (error == B_OK) if (error == B_OK)
error = B_IO_ERROR; error = B_IO_ERROR;
TRACE(("intel: move_block(): writing failed: %lx\n", error)); TRACE(("intel: move_block(): writing failed: %" B_PRIx32 "\n", error));
} }
return error; return error;
@@ -1520,9 +1527,9 @@ ep_is_sub_system_for(partition_data* partition)
if (partition == NULL) if (partition == NULL)
return false; return false;
TRACE(("intel: ep_is_sub_system_for(%ld: %lld, %lld, %ld, %s)\n", TRACE(("intel: ep_is_sub_system_for(%" B_PRId32 ": %" B_PRId64 ", "
partition->id, partition->offset, partition->size, "%" B_PRId64 ", %" B_PRId32 ", %s)\n", partition->id, partition->offset,
partition->block_size, partition->content_type)); partition->size, partition->block_size, partition->content_type));
// Intel Extended Partition can live in child partition of Intel Partition // Intel Extended Partition can live in child partition of Intel Partition
// Map // Map
@@ -2280,8 +2287,8 @@ ep_delete_child(int fd, partition_id partitionID, partition_id childID,
if (get_partition_from_offset_ep(partition, next->Offset(), if (get_partition_from_offset_ep(partition, next->Offset(),
&nextSibling)) { &nextSibling)) {
char buffer[128]; char buffer[128];
sprintf(buffer, "active %s ;\npartition_table_offset %lld ;\n", sprintf(buffer, "active %s ;\npartition_table_offset %" B_PRId64
next->Active() ? "true" : "false", " ;\n", next->Active() ? "true" : "false",
next->PartitionTableOffset()); next->PartitionTableOffset());
nextSibling->parameters = strdup(buffer); nextSibling->parameters = strdup(buffer);
} }