xfs
[Top] [All Lists]

Re: [PATCH] Fix "quota -n" command in xfs_quota.

To: Utako Kusaka <utako@xxxxxxxxxxxxxx>
Subject: Re: [PATCH] Fix "quota -n" command in xfs_quota.
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 23 Apr 2007 22:26:06 +0100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <200704190837.AA05238@xxxxxxxxxxxxxxxxxxxxxxxx>
References: <200704190837.AA05238@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.4.2.2i
On Thu, Apr 19, 2007 at 05:37:11PM +0900, Utako Kusaka wrote:
> Hi,
> 
> "quota -n" command in xfs_quota don't work when specifying the project id.
> This patch fixes it.
> 
> Example:
> # ./xfs_quota -x -c 'quota -p -n 42' ~utako/mpnt
> Disk quotas for Project logfiles (42)
> Filesystem              Blocks      Quota      Limit  Warn/Time      Mounted 
> on
> /dev/sda6                   52          0          0   00 [--------] 
> /home/utako/mpnt

Looks good to me, but the even the original code could be a little bit cleaner:

> --- xfsprogs-2.8.20/quota/quota.orig  2007-04-18 10:36:38.000000000 +0900
> +++ xfsprogs-2.8.20/quota/quota.c     2007-04-18 11:09:10.000000000 +0900
> @@ -312,7 +312,7 @@ getprojectname(
>       static char     buffer[32];
>       fs_project_t    *p;
>  
> -     if ((p = getprprid(prid)))
> +     if (!numeric && (p = getprprid(prid)))
>               return p->pr_name;
>       snprintf(buffer, sizeof(buffer), "#%u", (unsigned int)prid);
>       return &buffer[0];

        if (!numeric) {
                fs_project_t *p = getprprid(prid);
                if (p)
                        return p->pr_name;
        }

        snprintf(buffer, sizeof(buffer), "#%u", (unsigned int)prid);
        return &buffer[0];

                


<Prev in Thread] Current Thread [Next in Thread>