Fixing off_t handling in flashcp

Fabien Proriol Fabien.Proriol at viavisolutions.com
Mon Sep 28 04:38:30 PDT 2015


Hi,

I used it since 2014 by appling this patch with my OpenEmbedded recipe, and it's work well for ARM architecture (xilinx zynq).

Fabien
________________________________________
De : Paul Barker [paul at paulbarker.me.uk]
Envoyé : samedi 26 septembre 2015 12:55
À : linux-mtd at lists.infradead.org; Fabien Proriol
Objet : Fixing off_t handling in flashcp

Hi,

flashcp uses "%lu" to print values of type off_t. For example, from line 307 of
flashcp.c, with formatting butchered to fit in 80 cols:

    log_printf (LOG_NORMAL,"\rWriting data: %dk/%luk (%lu%%)",
                KB (written + i),
                KB (filestat.st_size),
                PERCENTAGE (written + i,filestat.st_size));

The KB() macro doesn't change the type of filestat.st_size, which is 64 bits
when large file support is enabled. On a 32-bit system this should be printed as
"%llu" not "%lu".

Looking through the archives there is already a patch to address this but it
doesn't seem to have been applied or replied to:
http://lists.infradead.org/pipermail/linux-mtd/2014-November/056410.html

I'd like to see this fixed as the current display output is ugly on our systems.
Could someone take another look at this patch from Fabien? I'll also test this
at work this week to ensure it works correctly.

Thanks,

--
Paul Barker

Email: paul at paulbarker.me.uk
http://www.paulbarker.me.uk


More information about the linux-mtd mailing list