Package: src:ploop
Version: 1.12.1-1
Severity: normal
Tags: patch
User: debian-powe...@lists.debian.org
Usertags: ppc64el

Dear Maintainer,

ploop is not building for ppc64el [1] because of some casting problems [2].
Using the attached patch I managed to build it for ppc64el.

[1] https://wiki.debian.org/ppc64el
[2] https://buildd.debian.org/status/package.php?p=ploop&suite=sid

Thanks,

-- 
Paulo Flabiano Smorigo
IBM Linux Technology Center
diff --git a/lib/balloon.c b/lib/balloon.c
index a392bdd..6110c9e 100644
--- a/lib/balloon.c
+++ b/lib/balloon.c
@@ -860,7 +860,7 @@ static int ploop_trim(const char *mount_point, __u64 
minlen_b, __u64 cluster)
        range.minlen = MAX(MAX_DISCARD_CLU * cluster, minlen_b);
 
        for (; range.minlen >= minlen_b; range.minlen /= 2) {
-               ploop_log(1, "Call FITRIM, for minlen=%lld", range.minlen);
+               ploop_log(1, "Call FITRIM, for minlen=%lld", (unsigned long 
long)range.minlen);
                ret = ioctl(fd, FITRIM, &range);
                if (ret < 0) {
                        if (trim_stop)
@@ -894,7 +894,8 @@ static int blk_discard(int fd, __u32 cluster, __u64 start, 
__u64 len)
                if (start % S2B(cluster) && len > range[1])
                        range[1] -= start % S2B(cluster);
 
-               ploop_log(1, "Call BLKDISCARD start=%llu length=%llu ", 
range[0], range[1]);
+               ploop_log(1, "Call BLKDISCARD start=%llu length=%llu ",
+                               (unsigned long long)range[0], (unsigned long 
long)range[1]);
                ret = ioctl_device(fd, BLKDISCARD, range);
                if (ret)
                        return ret;
@@ -918,9 +919,11 @@ static int __ploop_discard(struct ploop_disk_images_data 
*di, int fd,
 
        if (blk_discard_range != NULL)
                ploop_log(0, "Discard %s start=%llu length=%llu",
-                               device, blk_discard_range[0], 
blk_discard_range[1]);
+                               device, (unsigned long 
long)blk_discard_range[0],
+                               (unsigned long long)blk_discard_range[1]);
        else
-               ploop_log(3, "Trying to find free extents bigger than %llu 
bytes", minlen_b);
+               ploop_log(3, "Trying to find free extents bigger than %llu 
bytes",
+                               (unsigned long long)minlen_b);
 
        if (ploop_lock_di(di))
                return SYSEXIT_LOCK;
diff --git a/lib/balloon_util.c b/lib/balloon_util.c
index 798792b..88a921d 100644
--- a/lib/balloon_util.c
+++ b/lib/balloon_util.c
@@ -273,14 +273,14 @@ static int fiemap_extent_process(__u32 clu, __u32 len, 
__u32 *rmap, __u32 rlen,
                                ploop_err(0,
                                        "Image corrupted: L2[%u] == %u 
(max=%llu)",
                                        clu + j - l2_slot, delta->l2[j],
-                                       (rlen - 1) * B2S(cluster));
+                                       (long long unsigned)(rlen - 1) * 
B2S(cluster));
                                return(SYSEXIT_PLOOPFMT);
                        }
                        if (ridx < delta->l1_size) {
                                ploop_err(0,
                                        "Image corrupted: L2[%u] == %u 
(min=%llu)",
                                        clu + j - l2_slot, delta->l2[j],
-                                       delta->l1_size * B2S(cluster));
+                                       (long long unsigned)delta->l1_size * 
B2S(cluster));
                                return(SYSEXIT_PLOOPFMT);
                        }
 
@@ -538,14 +538,14 @@ static int range_build_rmap(__u32 iblk_start, __u32 
iblk_end,
                        ploop_err(0,
                                "Image corrupted: L2[%u] == %u (max=%llu) (2)",
                                clu, delta->l2[l2_slot],
-                               (rlen - 1) * B2S(cluster));
+                               (long long unsigned)(rlen - 1) * B2S(cluster));
                        return SYSEXIT_PLOOPFMT;
                }
                if (ridx && ridx < delta->l1_size) {
                        ploop_err(0,
                                "Image corrupted: L2[%u] == %u (min=%llu) (2)",
                                clu, delta->l2[l2_slot],
-                               delta->l1_size * B2S(cluster));
+                               (long long unsigned)delta->l1_size * 
B2S(cluster));
                        return SYSEXIT_PLOOPFMT;
                }
 
diff --git a/lib/check.c b/lib/check.c
index fd986bf..f433fd9 100644
--- a/lib/check.c
+++ b/lib/check.c
@@ -316,7 +316,8 @@ static int check_and_repair_sparse(const char *image, int 
*fd, __u64 cluster, in
                                ploop_err(0, "Delta file %s contains 
uninitialized blocks"
                                                " (offset=%llu len=%llu)"
                                                " which are not aligned to 
cluster size",
-                                               image, fm_ext[i].fe_logical, 
fm_ext[i].fe_length);
+                                               image, (long long 
unsigned)fm_ext[i].fe_logical,
+                                               (long long 
unsigned)fm_ext[i].fe_length);
 
                                ret = fill_hole(image, fd, fm_ext[i].fe_logical,
                                                fm_ext[i].fe_logical + 
fm_ext[i].fe_length, &log, repair);
diff --git a/lib/fsutils.c b/lib/fsutils.c
index 179f249..0668620 100644
--- a/lib/fsutils.c
+++ b/lib/fsutils.c
@@ -124,7 +124,7 @@ int make_fs(const char *device, const char *fstype, 
unsigned int fsblocksize)
        if (max_online_resize > (__u32)~0)
                max_online_resize = (__u32)~0;
        snprintf(ext_opts, sizeof(ext_opts), "-Elazy_itable_init,resize=%llu",
-                        max_online_resize);
+                        (unsigned long long)max_online_resize);
        argv[5] = ext_opts;
        /* Set the journal size to 128M to allow online resize up to 16T
         * independly on the initial image size
@@ -240,10 +240,10 @@ int dumpe2fs(const char *device, struct dump2fs_data 
*data)
 
        while (fgets(buf, sizeof(buf), fp) != NULL) {
                if ((found & BLOCK_COUNT_BIT) &&
-                               sscanf(buf, "Block count: %llu", 
&data->block_count) == 1)
+                               sscanf(buf, "Block count: %llu", (unsigned long 
long *)&data->block_count) == 1)
                        found &= ~BLOCK_COUNT_BIT;
                else if ((found & BLOCK_FREE_BIT) &&
-                               sscanf(buf, "Free blocks: %llu", 
&data->block_free) == 1)
+                               sscanf(buf, "Free blocks: %llu", (unsigned long 
long *)&data->block_free) == 1)
                        found &= ~BLOCK_FREE_BIT;
                else if ((found & BLOCK_SIZE_BIT) &&
                                sscanf(buf, "Block size: %u", 
&data->block_size) == 1)
diff --git a/lib/gpt.c b/lib/gpt.c
index 34fbe95..a6b5e8b 100644
--- a/lib/gpt.c
+++ b/lib/gpt.c
@@ -226,7 +226,7 @@ static int update_gpt_partition(int fd, const char 
*devname, __u64 new_size512,
        if (new_size512 > size) {
                ploop_err(0, "Unable to resize GPT partition:"
                                " incorrect parameter new_size=%llu size=%lu",
-                               new_size512, (long)size);
+                               (long long unsigned)new_size512, (long)size);
                return SYSEXIT_PARAM;
        }
 
diff --git a/lib/ploop.c b/lib/ploop.c
index 336dd45..131b0fd 100644
--- a/lib/ploop.c
+++ b/lib/ploop.c
@@ -288,7 +288,7 @@ int ploop_get_max_size(unsigned int blocksize, unsigned 
long long *max)
 {
        blocksize = blocksize ?  blocksize : (1 << PLOOP1_DEF_CLUSTER_LOG);
 
-       if (get_max_ploop_size(default_fmt_version(), blocksize, max))
+       if (get_max_ploop_size(default_fmt_version(), blocksize, (__u64 *)max))
                return SYSEXIT_PARAM;
 
        if (*max > B2S(PLOOP_MAX_FS_SIZE))
@@ -314,7 +314,7 @@ static int do_check_size(unsigned long long sectors, __u32 
blocksize, int versio
        if (sectors > max) {
                ploop_err(0, "An incorrect block device size is specified: %llu 
sectors."
                                " The maximum allowed size is %llu sectors",
-                               sectors, max);
+                               (long long unsigned)sectors, (long long 
unsigned)max);
                return -1;
        }
        return 0;
@@ -2474,7 +2474,7 @@ int ploop_resize_image(struct ploop_disk_images_data *di, 
struct ploop_resize_pa
                                        ploop_err(0, "Unable to change image 
size to %lu "
                                                        "sectors, minimal size 
is %llu",
                                                        (long)new_fs_size,
-                                                       (blocks - 
available_balloon_size));
+                                                       (long long 
unsigned)(blocks - available_balloon_size));
                                        ret = SYSEXIT_PARAM;
                                        goto err;
                                }

Reply via email to