memset(fspath, 0, sizeof(*fspath));
ipa.inum = inum;
ipa.size = 4096;
- ipa.fspath = (uintptr_t)fspath;
+ ipa.fspath = ptr_to_u64(fspath);
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
if (ret) {
memset(inodes, 0, sizeof(*inodes));
loi.logical = arg_strtou64(argv[optind]);
loi.size = size;
- loi.inodes = (uintptr_t)inodes;
+ loi.inodes = ptr_to_u64(inodes);
fd = open_file_or_dir(argv[optind+1], &dirstream);
if (fd < 0) {
in_len = read_compress_length(inbuf);
if ((tot_in + LZO_LEN + in_len) > tot_len) {
- fprintf(stderr, "bad compress length %lu\n", in_len);
+ fprintf(stderr, "bad compress length %lu\n",
+ (unsigned long)in_len);
return -1;
}
break;
ret = get_state_private(&info->block_group_cache, start, &ptr);
if (!ret) {
- cache = (struct btrfs_block_group_cache *)
- (uintptr_t)ptr;
+ cache = u64_to_ptr(ptr);
if (cache->free_space_ctl) {
btrfs_remove_free_space_cache(cache);
kfree(cache->free_space_ctl);
#include <assert.h>
#include <stddef.h>
#include <linux/types.h>
+#include <stdint.h>
+
+#define ptr_to_u64(x) ((u64)(uintptr_t)x)
+#define u64_to_ptr(x) ((void *)(uintptr_t)x)
#ifndef READ
#define READ 0
static inline struct tree_block *unode_tree_block(struct ulist_node *unode)
{
- return (struct tree_block *)unode->aux;
+ return u64_to_ptr(unode->aux);
}
static inline u64 unode_bytenr(struct ulist_node *unode)
{
if (block) {
block->num_bytes = num_bytes;
block->level = level;
- if (ulist_add(tree_blocks, bytenr, (unsigned long long)block, 0) >= 0)
+ if (ulist_add(tree_blocks, bytenr, ptr_to_u64(block), 0) >= 0)
return 0;
free(block);
}
int i;
for (i = 0; i <64; i++)
- if (x << i & (1UL << 63))
+ if (x << i & (1ULL << 63))
return 64 - i;
return 64 - i;
}