]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - quota/path.c
2 * Copyright (c) 2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #include <xfs/command.h>
20 #include <xfs/input.h>
24 static cmdinfo_t path_cmd
;
25 static cmdinfo_t print_cmd
;
34 fs_quota_stat_t qstat
;
39 printf(_("%sFilesystem Pathname\n"),
40 number
? _(" ") : "");
43 printf(_("%c%03d%c "), braces
? '[':' ', index
, braces
? ']':' ');
45 printf(_("%-19s %s"), path
->fs_dir
, path
->fs_name
);
46 if (path
->fs_flags
& FS_PROJECT_PATH
) {
47 prj
= getprprid(path
->fs_prid
);
48 printf(_(" (project %u"), path
->fs_prid
);
50 printf(_(", %s"), prj
->pr_name
);
52 } else if (xfsquotactl(XFS_GETQSTAT
, path
->fs_name
, 0, 0,
53 (void *)&qstat
) == 0 && qstat
.qs_flags
) {
56 if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ENFD
)
57 c
= printf("%suquota", c
? ", " : "");
58 else if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ACCT
)
59 c
= printf("%suqnoenforce", c
? ", " : "");
60 if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ENFD
)
61 c
= printf("%sgquota", c
? ", " : "");
62 else if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ACCT
)
63 c
= printf("%sgqnoenforce", c
? ", " : "");
64 if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ENFD
)
65 c
= printf("%spquota", c
? ", " : "");
66 else if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ACCT
)
67 c
= printf("%spqnoenforce", c
? ", " : "");
78 for (i
= 0; i
< fs_count
; i
++)
79 printpath(&fs_table
[i
], i
, 1, &fs_table
[i
] == fs_path
);
90 for (i
= 0; i
< fs_count
; i
++)
91 printpath(&fs_table
[i
], i
, 0, 0);
106 if (i
< 0 || i
>= fs_count
) {
107 printf(_("value %d is out of range (0-%d)\n"),
110 fs_path
= &fs_table
[i
];
119 path_cmd
.name
= _("path");
120 path_cmd
.altname
= _("paths");
121 path_cmd
.args
= _("[N]");
122 path_cmd
.cfunc
= path_f
;
125 path_cmd
.oneline
= _("set current path, or show the list of paths");
127 print_cmd
.name
= _("print");
128 print_cmd
.altname
= _("p");
129 print_cmd
.cfunc
= print_f
;
130 print_cmd
.argmin
= 0;
131 print_cmd
.argmax
= 0;
132 print_cmd
.oneline
= _("list known mount points and projects");
135 add_command(&path_cmd
);
136 add_command(&print_cmd
);