[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 13/30] xen: introduce a new format specifier to print sizes in human-readable form
On 28/09/16 12:56, Roger Pau Monne wrote: > On Wed, Sep 28, 2016 at 10:24:07AM +0200, Juergen Gross wrote: >> On 27/09/16 17:57, Roger Pau Monne wrote: >>> Introduce a new %pB format specifier to print sizes (in bytes) in a >> Code suggests it is pZ. > Right, first implementation used pB, but then I realized this was already > used by Linux to print something else. > >>> diff --git a/xen/common/vsprintf.c b/xen/common/vsprintf.c >>> index f92fb67..2dadaec 100644 >>> --- a/xen/common/vsprintf.c >>> +++ b/xen/common/vsprintf.c >>> @@ -386,6 +386,21 @@ static char *pointer(char *str, char *end, const char >>> **fmt_ptr, >>> *str = 'v'; >>> return number(str + 1, end, v->vcpu_id, 10, -1, -1, 0); >>> } >>> + case 'Z': >>> + { >>> + static const char units[][3] = {"B", "KB", "MB", "GB", "TB"}; >>> + size_t size = (size_t)arg; >>> + int i = 0; >>> + >>> + /* Advance parents fmt string, as we have consumed 'B' */ And this comment. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |