xfs_quota: print quota id number if the name can't be found
PATCH v2 1/1 xfs_quota: print quota id number if the name can't be found
When use GETNEXTQUOTA ioctl to report project quota, it always report an unexpected quota:
(null) 0 0 0 00 [--------]
The ID 0 store the default quota, even if no one set default quota, it still have quota accounting, but not enforced. So GETNEXTQUOTA can find and report this undefined quota.
Quoted 1 line
From this problem, I thought if others' quota name miss, (null) will
be printed too. e.g.
# xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] test 0 307200 409600 00 [--------] # userdel -r test # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] (null) 0 307200 409600 00 [--------]
So this problem same with above id 0's problem. For deal with this, this patch will print id number if the name can't be found.
But if use old GETQUOTA ioctl, it won't print project id 0 quota information(if it's not defined). That's different with GETNEXTQUOTA. For keep consistent, this patch also print project id 0 when use old GETQUOTA.
---
Hi,
This V2 patch has below change:
1. Add some comments
2. Change the xfs_quota man page
3. For alignment, change "#%-10u" to "#%-9u" when print ID or name mixed.
For reduce the impact on xfstests, I didn't change the original "#%-10u" when use "report -n":
if (flags & NO_LOOKUP_FLAG) {
fprintf(fp, "#%-10u", d.d_id);And didn't change "%-10s" when print quota name:
fprintf(fp, "%-10s", name);
Thanks,
Zorro
man/man8/xfs_quota.8 | 7 +++++-- quota/report.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-)
man/man8/xfs_quota.8 +5 -2
@@ -357,9 +357,12 @@ option outputs the report to .I file instead of stdout. The .B \-a -option reports on all filesystems. The +option reports on all filesystems. As default, outputs the name of +the user/group/project. But if no name is defined, outputs the +numberic ID. The .B \-n -option outputs the numeric ID instead of the name. The +option outputs the numeric ID instead of the name, even the name is +defined. The .B \-L and .B \-U
quota/report.c +15 -1
@@ -389,7 +389,11 @@ report_mount( name = p->pr_name; } } -fprintf (fp,"%-10s" , name); +/* If no name is found, print the id #num instead of (null) */ +if (name !=NULL ) +fprintf (fp,"%-10s" , name); +else +fprintf (fp,"#%-9u" , d.d_id); }if (form &XFS_BLOCK_QUOTA ) {
@@ -571,6 +575,16 @@ report_project_mount( id = oid +1 ; } }else { +if (!getprprid (0 )) { +/* +* Print default project quota, even if projid 0 +* isn't defined +*/ +report_mount (fp,0 ,NULL ,NULL , form,XFS_PROJ_QUOTA , + mount, flags); + flags |=NO_HEADER_FLAG ; + } +setprent ();while ((p =getprent ()) !=NULL ) { if (report_mount(fp, p->pr_prid, p->pr_name, NULL,
Signature · 6 lines
2.5.5 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 25 lines · Zorro Lang
When use GETNEXTQUOTA ioctl to report project quota, it always report an unexpected quota:
(null) 0 0 0 00 [--------]
The ID 0 store the default quota, even if no one set default quota, it still have quota accounting, but not enforced. So GETNEXTQUOTA can find and report this undefined quota.
From this problem, I thought if others' quota name miss, (null) will be printed too. e.g.
# xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] test 0 307200 409600 00 [--------] # userdel -r test # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] (null) 0 307200 409600 00 [--------]
Quoted 7 lines
So this problem same with above id 0's problem. For deal with this, this patch will print id number if the name can't be found.
But if use old GETQUOTA ioctl, it won't print project id 0 quota information(if it's not defined). That's different with GETNEXTQUOTA. For keep consistent, this patch also print project id 0 when use old GETQUOTA.
thanks Zorro, tiny little manpage nitpick below. Rest assured that your English is still much better than my Chinese. :)
Quoted 33 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This V2 patch has below change:
1. Add some comments
2. Change thexfs_quotaman page
3. For alignment, change "#%-10u" to "#%-9u" when print ID or name mixed.For reduce the impact on xfstests, I didn't change the original "#%-10u" when use "report -n":
if (flags & NO_LOOKUP_FLAG) { fprintf(fp, "#%-10u", d.d_id);And didn't change "%-10s" when print quota name:
fprintf(fp, "%-10s", name);Thanks,
Zorroman/man8/xfs_quota.8 | 7 +++++-- quota/report.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-)man/man8/xfs_quota.8 +0
-0
man/man8/xfs_quota.8 option outputs the report to · line 362
Quoted 7 lines
man/man8/xfs_quota.8 +3
-1@@ -357,9 +357,12 @@ option outputs the report to .I file instead of stdout. The .B \-a -option reports on all filesystems. The +option reports on all filesystems. As default, outputs the name of +the user/group/project. But if no name is defined, outputs the +numberic ID. The
"numeric" -
Maybe:
"option reports on all filesystems. By default, outputs the name of the user/group/project. If no name is defined for a given ID, outputs the numeric ID instead. The"
man/man8/xfs_quota.8 option outputs the report to · line 365
Quoted 4 lines
man/man8/xfs_quota.8 +2
-1.B \-n -option outputs the numeric ID instead of the name. The +option outputs the numeric ID instead of the name, even the name is +defined. The
Probably no need for this change; the number always exists, so just "The option outputs the numeric ID instead of the name." is enough.
Thanks,
-Eric
Quoted 28 lines
man/man8/xfs_quota.8 +0
-0.B \-L and .B \-Uquota/report.c +8
-1@@ -389,7 +389,11 @@ report_mount( name = p->pr_name; } } -fprintf (fp,"%-10s" , name); +/* If no name is found, print the id #num instead of (null) */ +if (name !=NULL ) +fprintf (fp,"%-10s" , name); +else +fprintf (fp,"#%-9u" , d.d_id); }if (form &XFS_BLOCK_QUOTA ) {@@ -571,6 +575,16 @@ report_project_mount( id = oid +1 ; } }else { +if (!getprprid (0 )) { +/* +* Print default project quota, even if projid 0
quota/report.c report_project_mount( · line 590
Quoted 10 lines
quota/report.c +7
-0+* isn't defined +*/ +report_mount (fp,0 ,NULL ,NULL , form,XFS_PROJ_QUOTA , + 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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 29 lines · Eric Sandeen
Quoted 28 lines · Zorro Lang
When use GETNEXTQUOTA ioctl to report project quota, it always report an unexpected quota:
(null) 0 0 0 00 [--------]
The ID 0 store the default quota, even if no one set default quota, it still have quota accounting, but not enforced. So GETNEXTQUOTA can find and report this undefined quota.
From this problem, I thought if others' quota name miss, (null) will be printed too. e.g.
# xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] test 0 307200 409600 00 [--------] # userdel -r test # xfs_quota -xc "report -u" $mnt User ID Used Soft Hard Warn/Grace ---------- -------------------------------------------------- root 0 0 0 00 [--------] (null) 0 307200 409600 00 [--------]So this problem same with above id 0's problem. For deal with this, this patch will print id number if the name can't be found.
Quoted 7 lines
Quoted 4 lines
But if use old GETQUOTA ioctl, it won't print project id 0 quota information(if it's not defined). That's different with GETNEXTQUOTA. For keep consistent, this patch also print project id 0 when use old GETQUOTA.
thanks Zorro, tiny little manpage nitpick below. Rest assured that your English is still much better than my Chinese. :)
Thanks Eric. Sorry for my English problem, it still looks like Chinglish :-P . I'm trying to improve my English :)
I will send V3 patch to fix these problems soon.
Thanks,
Zorro
Quoted 91 lines
Quoted 34 lines
Signed-off-by Zorro Lang <[email protected]>---
Hi,
This V2 patch has below change:
1. Add some comments
2. Change thexfs_quotaman page
3. For alignment, change "#%-10u" to "#%-9u" when print ID or name mixed.For reduce the impact on xfstests, I didn't change the original "#%-10u" when use "report -n":
if (flags & NO_LOOKUP_FLAG) { fprintf(fp, "#%-10u", d.d_id);And didn't change "%-10s" when print quota name:
fprintf(fp, "%-10s", name);Thanks,
Zorroman/man8/xfs_quota.8 | 7 +++++-- quota/report.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-)man/man8/xfs_quota.8 +0
-0man/man8/xfs_quota.8 option outputs the report to · line 362
Quoted 7 lines
man/man8/xfs_quota.8 +3
-1@@ -357,9 +357,12 @@ option outputs the report to .I file instead of stdout. The .B \-a -option reports on all filesystems. The +option reports on all filesystems. As default, outputs the name of +the user/group/project. But if no name is defined, outputs the +numberic ID. The"numeric" -
Maybe:
"option reports on all filesystems. By default, outputs the name of the user/group/project. If no name is defined for a given ID, outputs the numeric ID instead. The"
man/man8/xfs_quota.8 option outputs the report to · line 365
Quoted 4 lines
man/man8/xfs_quota.8 +2
-1.B \-n -option outputs the numeric ID instead of the name. The +option outputs the numeric ID instead of the name, even the name is +defined. TheProbably no need for this change; the number always exists, so just "The option outputs the numeric ID instead of the name." is enough.
Thanks,
-EricQuoted 30 lines
man/man8/xfs_quota.8 +0
-0.B \-L and .B \-Uquota/report.c +11
-1@@ -389,7 +389,11 @@ report_mount( name = p->pr_name; } } -fprintf (fp,"%-10s" , name); +/* If no name is found, print the id #num instead of (null) */ +if (name !=NULL ) +fprintf (fp,"%-10s" , name); +else +fprintf (fp,"#%-9u" , d.d_id); }if (form &XFS_BLOCK_QUOTA ) {@@ -571,6 +575,16 @@ report_project_mount( id = oid +1 ; } }else { +if (!getprprid (0 )) { +/* +* Print default project quota, even if projid 0 +* isn't defined +*/ + report_mount(fp, 0, NULL, NULL, form, XFS_PROJ_QUOTA,
Quoted 9 lines
quota/report.c report_project_mount( · line 590
Quoted 8 lines
quota/report.c +4
-0+ 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
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs