exfat: fixes 64 bit warnings
This commit is contained in:
parent
575eeda9a5
commit
3f5d1e7825
@ -62,8 +62,8 @@ DataStream::FindBlock(off_t pos, off_t& physical, off_t *_length)
|
||||
}
|
||||
*_length = min_c((cluster - clusterIndex + 1) * kClusterSize - offset,
|
||||
fSize - pos);
|
||||
TRACE("inode %" B_PRIdINO ": cluster %ld, pos %lld, %lld\n",
|
||||
fInode->ID(), clusterIndex, pos, physical);
|
||||
TRACE("inode %" B_PRIdINO ": cluster %" B_PRIu32 ", pos %" B_PRIdOFF ", %"
|
||||
B_PRIdOFF "\n", fInode->ID(), clusterIndex, pos, physical);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ DirectoryIterator::DirectoryIterator(Inode* inode)
|
||||
fBlock(inode->GetVolume()),
|
||||
fCurrent(NULL)
|
||||
{
|
||||
TRACE("DirectoryIterator::DirectoryIterator() %ld\n", fCluster);
|
||||
TRACE("DirectoryIterator::DirectoryIterator() %" B_PRIu32 "\n", fCluster);
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ DirectoryIterator::GetNext(char* name, size_t* _nameLength, ino_t* _id,
|
||||
if (status == B_OK && name != NULL) {
|
||||
status = unicode_to_utf8(unicodeName, nameLength, (uint8 *)name,
|
||||
_nameLength);
|
||||
TRACE("DirectoryIterator::GetNext() %ld %s, %" B_PRIdINO "\n",
|
||||
TRACE("DirectoryIterator::GetNext() %" B_PRIu32 " %s, %" B_PRIdINO "\n",
|
||||
fInode->Cluster(), name, *_id);
|
||||
}
|
||||
|
||||
@ -184,8 +184,9 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id,
|
||||
status_t status;
|
||||
int32 chunkCount = 1;
|
||||
while ((status = _NextEntry()) == B_OK) {
|
||||
TRACE("DirectoryIterator::_GetNext() %ld/%p, type 0x%x, offset %lld\n",
|
||||
fInode->Cluster(), fCurrent, fCurrent->type, fOffset);
|
||||
TRACE("DirectoryIterator::_GetNext() %" B_PRIu32 "/%p, type 0x%x, "
|
||||
"offset %" B_PRId64 "\n", fInode->Cluster(), fCurrent,
|
||||
fCurrent->type, fOffset);
|
||||
if (fCurrent->type == EXFAT_ENTRY_TYPE_FILE) {
|
||||
chunkCount = fCurrent->file.chunkCount;
|
||||
if (_id != NULL) {
|
||||
@ -194,8 +195,8 @@ DirectoryIterator::_GetNext(uchar* name, size_t* _nameLength, ino_t* _id,
|
||||
}
|
||||
if (visitor != NULL)
|
||||
visitor->VisitFile(fCurrent);
|
||||
TRACE("DirectoryIterator::_GetNext() File chunkCount %ld\n",
|
||||
chunkCount);
|
||||
TRACE("DirectoryIterator::_GetNext() File chunkCount %" B_PRId32
|
||||
"\n", chunkCount);
|
||||
} else if (fCurrent->type == EXFAT_ENTRY_TYPE_FILEINFO) {
|
||||
chunkCount--;
|
||||
TRACE("DirectoryIterator::_GetNext() Filename length %d\n",
|
||||
@ -241,7 +242,8 @@ DirectoryIterator::_NextEntry()
|
||||
fInode->GetVolume()->ClusterToBlock(fCluster, block);
|
||||
block += (fOffset / fInode->GetVolume()->EntriesPerBlock())
|
||||
% (1 << fInode->GetVolume()->SuperBlock().BlocksPerClusterShift());
|
||||
TRACE("DirectoryIterator::_NextEntry() init to block %lld\n", block);
|
||||
TRACE("DirectoryIterator::_NextEntry() init to block %" B_PRIu64 "\n",
|
||||
block);
|
||||
fCurrent = (struct exfat_entry*)fBlock.SetTo(block)
|
||||
+ fOffset % fInode->GetVolume()->EntriesPerBlock();
|
||||
} else if ((fOffset % fInode->GetVolume()->EntriesPerBlock()) == 0) {
|
||||
@ -253,7 +255,7 @@ DirectoryIterator::_NextEntry()
|
||||
fInode->GetVolume()->ClusterToBlock(fCluster, block);
|
||||
} else
|
||||
block = fBlock.BlockNumber() + 1;
|
||||
TRACE("DirectoryIterator::_NextEntry() block %lld\n", block);
|
||||
TRACE("DirectoryIterator::_NextEntry() block %" B_PRIu64 "\n", block);
|
||||
fCurrent = (struct exfat_entry*)fBlock.SetTo(block);
|
||||
} else
|
||||
fCurrent++;
|
||||
|
@ -37,8 +37,8 @@ Inode::Inode(Volume* volume, cluster_t cluster, uint32 offset)
|
||||
fCache(NULL),
|
||||
fMap(NULL)
|
||||
{
|
||||
TRACE("Inode::Inode(%ld, %d) inode %" B_PRIdINO "\n", Cluster(), Offset(),
|
||||
ID());
|
||||
TRACE("Inode::Inode(%" B_PRIu32 ", %" B_PRIu32 ") inode %" B_PRIdINO "\n",
|
||||
Cluster(), Offset(), ID());
|
||||
_Init();
|
||||
|
||||
if (ID() == 1) {
|
||||
@ -72,7 +72,8 @@ Inode::Inode(Volume* volume, ino_t ino)
|
||||
fOffset = key->offset;
|
||||
fInitStatus = B_OK;
|
||||
}
|
||||
TRACE("Inode::Inode(%" B_PRIdINO ") cluster %ld\n", ID(), Cluster());
|
||||
TRACE("Inode::Inode(%" B_PRIdINO ") cluster %" B_PRIu32 "\n", ID(),
|
||||
Cluster());
|
||||
_Init();
|
||||
|
||||
if (fInitStatus == B_OK && ID() != 1) {
|
||||
@ -204,14 +205,14 @@ Inode::ReadAt(off_t pos, uint8* buffer, size_t* _length)
|
||||
|
||||
// set/check boundaries for pos/length
|
||||
if (pos < 0) {
|
||||
ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %lld, length %lu)\n",
|
||||
ID(), pos, length);
|
||||
ERROR("inode %" B_PRIdINO ": ReadAt failed(pos %" B_PRIdOFF", length %"
|
||||
B_PRIuSIZE ")\n", ID(), pos, length);
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
|
||||
if (pos >= Size() || length == 0) {
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %lld, length %lu)\n",
|
||||
ID(), pos, length);
|
||||
TRACE("inode %" B_PRIdINO ": ReadAt 0 (pos %" B_PRIdOFF", length %"
|
||||
B_PRIuSIZE ")\n", ID(), pos, length);
|
||||
*_length = 0;
|
||||
return B_NO_ERROR;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
ino_t ID() const { return fID; }
|
||||
ino_t Parent() const { return fParent; }
|
||||
cluster_t Cluster() const { return fCluster; }
|
||||
uint32_t Offset() const { return fOffset; }
|
||||
uint32 Offset() const { return fOffset; }
|
||||
cluster_t StartCluster() const
|
||||
{ return fFileInfoEntry.file_info.StartCluster(); }
|
||||
bool IsContiguous() const
|
||||
|
@ -318,7 +318,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
}
|
||||
|
||||
fBlockSize = 1 << fSuperBlock.BlockShift();
|
||||
TRACE("block size %ld\n", fBlockSize);
|
||||
TRACE("block size %" B_PRIu32 "\n", fBlockSize);
|
||||
fEntriesPerBlock = (fBlockSize / sizeof(struct exfat_entry));
|
||||
|
||||
// check if the device size is large enough to hold the file system
|
||||
@ -348,7 +348,7 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
||||
return status;
|
||||
}
|
||||
|
||||
TRACE("Volume::Mount(): Found root node: %lld (%s)\n", fRootNode->ID(),
|
||||
TRACE("Volume::Mount(): Found root node: %" B_PRIdINO " (%s)\n", fRootNode->ID(),
|
||||
strerror(fRootNode->InitCheck()));
|
||||
|
||||
// all went fine
|
||||
@ -422,7 +422,8 @@ Volume::ClusterToBlock(cluster_t cluster, fsblock_t &block)
|
||||
return B_BAD_VALUE;
|
||||
block = ((cluster - 2) << SuperBlock().BlocksPerClusterShift())
|
||||
+ SuperBlock().FirstDataBlock();
|
||||
TRACE("Volume::ClusterToBlock() cluster %lu %u %lu: %llu, %lu\n", cluster,
|
||||
TRACE("Volume::ClusterToBlock() cluster %" B_PRIu32 " %u %" B_PRIu32 ": %"
|
||||
B_PRIu64 ", %" B_PRIu32 "\n", cluster,
|
||||
SuperBlock().BlocksPerClusterShift(), SuperBlock().FirstDataBlock(),
|
||||
block, SuperBlock().FirstFatBlock());
|
||||
return B_OK;
|
||||
@ -438,7 +439,8 @@ Volume::NextCluster(cluster_t _cluster)
|
||||
+ _cluster / clusterPerBlock;
|
||||
cluster_t *cluster = (cluster_t *)block.SetTo(blockNum);
|
||||
cluster += _cluster % clusterPerBlock;
|
||||
TRACE("Volume::NextCluster() cluster %lu next %lu\n", _cluster, *cluster);
|
||||
TRACE("Volume::NextCluster() cluster %" B_PRIu32 " next %" B_PRIu32 "\n",
|
||||
_cluster, *cluster);
|
||||
return *cluster;
|
||||
}
|
||||
|
||||
@ -465,8 +467,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent)
|
||||
key.offset = offset;
|
||||
struct node* node = fNodeTree.Lookup(key);
|
||||
if (node != NULL) {
|
||||
TRACE("Volume::GetIno() cached cluster %lu offset %lu ino %" B_PRIdINO
|
||||
"\n", cluster, offset, node->ino);
|
||||
TRACE("Volume::GetIno() cached cluster %" B_PRIu32 " offset %" B_PRIu32
|
||||
" ino %" B_PRIdINO "\n", cluster, offset, node->ino);
|
||||
return node->ino;
|
||||
}
|
||||
node = new struct node();
|
||||
@ -475,8 +477,8 @@ Volume::GetIno(cluster_t cluster, uint32 offset, ino_t parent)
|
||||
node->parent = parent;
|
||||
fNodeTree.Insert(node);
|
||||
fInoTree.Insert(node);
|
||||
TRACE("Volume::GetIno() new cluster %lu offset %lu ino %" B_PRIdINO "\n",
|
||||
cluster, offset, node->ino);
|
||||
TRACE("Volume::GetIno() new cluster %" B_PRIu32 " offset %" B_PRIu32
|
||||
" ino %" B_PRIdINO "\n", cluster, offset, node->ino);
|
||||
return node->ino;
|
||||
}
|
||||
|
||||
|
@ -98,14 +98,14 @@
|
||||
static status_t
|
||||
_lendian_unicode_to_utf8(
|
||||
const char *src,
|
||||
int32 *srcLen,
|
||||
size_t *srcLen,
|
||||
char *dst,
|
||||
uint32 *dstLen)
|
||||
size_t *dstLen)
|
||||
{
|
||||
int32 srcLimit = *srcLen;
|
||||
int32 dstLimit = *dstLen;
|
||||
int32 srcCount = 0;
|
||||
int32 dstCount = 0;
|
||||
size_t srcLimit = *srcLen;
|
||||
size_t dstLimit = *dstLen;
|
||||
size_t srcCount = 0;
|
||||
size_t dstCount = 0;
|
||||
status_t status = B_ERROR;
|
||||
|
||||
for (srcCount = 0; srcCount < srcLimit; srcCount += 2) {
|
||||
@ -142,14 +142,14 @@ _lendian_unicode_to_utf8(
|
||||
static status_t
|
||||
_utf8_to_lendian_unicode(
|
||||
const char *src,
|
||||
int32 *srcLen,
|
||||
size_t *srcLen,
|
||||
char *dst,
|
||||
uint32 *dstLen)
|
||||
size_t *dstLen)
|
||||
{
|
||||
int32 srcLimit = *srcLen;
|
||||
int32 dstLimit = *dstLen - 1;
|
||||
int32 srcCount = 0;
|
||||
int32 dstCount = 0;
|
||||
size_t srcLimit = *srcLen;
|
||||
size_t dstLimit = *dstLen - 1;
|
||||
size_t srcCount = 0;
|
||||
size_t dstCount = 0;
|
||||
status_t status = B_ERROR;
|
||||
|
||||
while ((srcCount < srcLimit) && (dstCount < dstLimit)) {
|
||||
@ -186,12 +186,12 @@ _utf8_to_lendian_unicode(
|
||||
|
||||
// takes a unicode name of unilen uchar's and converts to a utf8 name of at
|
||||
// most utf8len uint8's
|
||||
status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8,
|
||||
uint32 *utf8len)
|
||||
status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8,
|
||||
size_t *utf8len)
|
||||
{
|
||||
uint32 origlen = unilen;
|
||||
//size_t origlen = unilen;
|
||||
status_t result = _lendian_unicode_to_utf8((char *)uni,
|
||||
(int32 *)&unilen, (char *)utf8, utf8len);
|
||||
&unilen, (char *)utf8, utf8len);
|
||||
|
||||
/*if (unilen < origlen) {
|
||||
panic("Name is too long (%lx < %lx)\n", unilen, origlen);
|
||||
@ -202,13 +202,13 @@ status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8,
|
||||
}
|
||||
|
||||
|
||||
status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen)
|
||||
status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen)
|
||||
{
|
||||
uint32 origlen = strlen(utf8) + 1;
|
||||
uint32 utf8len = origlen;
|
||||
size_t origlen = strlen(utf8) + 1;
|
||||
size_t utf8len = origlen;
|
||||
|
||||
status_t result = _utf8_to_lendian_unicode(utf8,
|
||||
(int32 *)&utf8len, (char *)uni, unilen);
|
||||
&utf8len, (char *)uni, unilen);
|
||||
|
||||
/*if (origlen < utf8len) {
|
||||
panic("Name is too long (%lx < %lx)\n", *unilen, origlen);
|
||||
|
@ -9,9 +9,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t unicode_to_utf8(const uchar *uni, uint32 unilen, uint8 *utf8,
|
||||
uint32 *utf8len);
|
||||
status_t utf8_to_unicode(const char *utf8, uchar *uni, uint32 *unilen);
|
||||
status_t unicode_to_utf8(const uchar *uni, size_t unilen, uint8 *utf8,
|
||||
size_t *utf8len);
|
||||
status_t utf8_to_unicode(const char *utf8, uchar *uni, size_t *unilen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ exfat_read_pages(fs_volume* _volume, fs_vnode* _node, void* _cookie,
|
||||
|
||||
while (true) {
|
||||
file_io_vec fileVecs[8];
|
||||
uint32 fileVecCount = 8;
|
||||
size_t fileVecCount = 8;
|
||||
|
||||
status = file_map_translate(inode->Map(), pos, bytesLeft, fileVecs,
|
||||
&fileVecCount, 0);
|
||||
@ -322,10 +322,10 @@ exfat_get_file_map(fs_volume* _volume, fs_vnode* _node, off_t offset,
|
||||
offset += blockLength;
|
||||
size -= blockLength;
|
||||
|
||||
if (size <= vecs[index - 1].length || offset >= inode->Size()) {
|
||||
if ((off_t)size <= vecs[index - 1].length || offset >= inode->Size()) {
|
||||
// We're done!
|
||||
*_count = index;
|
||||
TRACE("exfat_get_file_map for inode %lld\n", inode->ID());
|
||||
TRACE("exfat_get_file_map for inode %" B_PRIdINO"\n", inode->ID());
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
@ -367,7 +367,7 @@ static status_t
|
||||
exfat_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, uint32 cmd,
|
||||
void* buffer, size_t bufferLength)
|
||||
{
|
||||
TRACE("ioctl: %lu\n", cmd);
|
||||
TRACE("ioctl: %" B_PRIu32 "\n", cmd);
|
||||
|
||||
/*Volume* volume = (Volume*)_volume->private_volume;*/
|
||||
return B_DEV_INVALID_IOCTL;
|
||||
|
Loading…
Reference in New Issue
Block a user