Re: [PATCH] xfs_quota: print quota id number if the name can't be found

Eric Sandeen
2016-04-07T04:10:24Z

> On Apr 6, 2016, at 10:37 PM, Zorro Lang <zlang@redhat.com> wrote:
>
>>
>>
>>> + if (name != NULL)
>>> + fprintf(fp, "%-10s", name);
>>> + else
>>> + fprintf(fp, "#%-10u", d.d_id);
>
> There's one more problem. When we print id number we print #%-10u, but
> for name we print %-10s. There's one more "#" be printed for number.
> So if we print name and number both, the output will like this:
>
> User ID Used Soft Hard Warn/Grace
> ---------- --------------------------------------------------
> root 512000 0 0 00 [--------]
> #1000 0 307200 409600 00 [--------]
>
> You can find the line of #1000 is not align at the line of "root".
> Because the name print 10 characters, but the number print 10
> characters + #.
>
> Should we fix this problem?
> If fix it, should we make name print %-11s, or make number print
> #%-9u?

9u I think. Leave the existing format unchanged.

Thx,
Eric

> Thanks,
> Zorro
>
>>> }
>>>
>>> if (form & XFS_BLOCK_QUOTA) {
>>> @@ -571,6 +574,12 @@ report_project_mount(
>>> id = oid + 1;
>>> }
>>> } else {
>>
>> Comment:
>>
>> + /* Print default project quota even if PRID 0 isn't defined */
>>
>>> + if (!getprprid(0)) {
>>> + report_mount(fp, 0, "#0", NULL, form, XFS_PROJ_QUOTA,
>>
>> If you pass in NULL instead of "#0" does report_mount do the right thing?
>> If so, better to not hard-code "#0" here.
>>
>> -Eric
>>
>>> + mount, flags);
>>> + flags |= NO_HEADER_FLAG;
>>> + }
>>> +
>>> setprent();
>>> while ((p = getprent()) != NULL) {
>>> if (report_mount(fp, p->pr_prid, p->pr_name, NULL,
>>
>> _______________________________________________
>> xfs mailing list
>> xfs@oss.sgi.com
>> http://oss.sgi.com/mailman/listinfo/xfs