]>
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
24 static cmdinfo_t path_cmd
;
25 static cmdinfo_t print_cmd
;
34 fs_quota_stat_t qstat
;
39 printf(_("%s%sFilesystem Pathname\n"),
41 foreign_allowed
? _(" ") : "");
44 printf(_("%c%03d%c "), braces
? '[':' ', index
, braces
? ']':' ');
46 printf("%s", (path
->fs_flags
& FS_FOREIGN
) ? "(F) " : " ");
47 printf(_("%-19s %s"), path
->fs_dir
, path
->fs_name
);
48 if (path
->fs_flags
& FS_PROJECT_PATH
) {
49 prj
= getprprid(path
->fs_prid
);
50 printf(_(" (project %u"), path
->fs_prid
);
52 printf(_(", %s"), prj
->pr_name
);
54 } else if (xfsquotactl(XFS_GETQSTAT
, path
->fs_name
, 0, 0,
55 (void *)&qstat
) == 0 && qstat
.qs_flags
) {
58 if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ENFD
)
60 else if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ACCT
)
61 c
= printf("uqnoenforce");
62 if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ENFD
)
63 c
= printf("%sgquota", c
? ", " : "");
64 else if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ACCT
)
65 c
= printf("%sgqnoenforce", c
? ", " : "");
66 if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ENFD
)
67 printf("%spquota", c
? ", " : "");
68 else if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ACCT
)
69 printf("%spqnoenforce", c
? ", " : "");
81 for (i
= 0; i
< fs_count
; i
++) {
83 /* Table is ordered xfs first, then foreign */
84 if (path
->fs_flags
& FS_FOREIGN
&& !foreign_allowed
)
86 printpath(path
, i
, 1, path
== fs_path
);
99 for (i
= 0; i
< fs_count
; i
++) {
101 if (path
->fs_flags
& FS_FOREIGN
&& !foreign_allowed
)
103 printpath(path
, i
, 0, 0);
114 int max
= foreign_allowed
? fs_count
: xfs_fs_count
;
117 printf(_("No paths are available\n"));
125 if (i
< 0 || i
>= max
) {
126 printf(_("value %d is out of range (0-%d)\n"),
129 fs_path
= &fs_table
[i
];
138 path_cmd
.name
= "path";
139 path_cmd
.altname
= "paths";
140 path_cmd
.args
= _("[N]");
141 path_cmd
.cfunc
= path_f
;
144 path_cmd
.flags
= CMD_FLAG_ONESHOT
| CMD_FLAG_FOREIGN_OK
;
145 path_cmd
.oneline
= _("set current path, or show the list of paths");
147 print_cmd
.name
= "print";
148 print_cmd
.altname
= "p";
149 print_cmd
.cfunc
= print_f
;
150 print_cmd
.argmin
= 0;
151 print_cmd
.argmax
= 0;
152 print_cmd
.flags
= CMD_FLAG_ONESHOT
| CMD_FLAG_FOREIGN_OK
;
153 print_cmd
.oneline
= _("list known mount points and projects");
156 add_command(&path_cmd
);
157 add_command(&print_cmd
);