]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - quota/path.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2005 Silicon Graphics, Inc.
12 static cmdinfo_t path_cmd
;
13 static cmdinfo_t print_cmd
;
22 fs_quota_stat_t qstat
;
27 printf(_("%s%sFilesystem Pathname\n"),
29 foreign_allowed
? _(" ") : "");
32 printf(_("%c%03d%c "), braces
? '[':' ', index
, braces
? ']':' ');
34 printf("%s", (path
->fs_flags
& FS_FOREIGN
) ? "(F) " : " ");
35 printf(_("%-19s %s"), path
->fs_dir
, path
->fs_name
);
36 if (path
->fs_flags
& FS_PROJECT_PATH
) {
37 prj
= getprprid(path
->fs_prid
);
38 printf(_(" (project %u"), path
->fs_prid
);
40 printf(_(", %s"), prj
->pr_name
);
42 } else if (xfsquotactl(XFS_GETQSTAT
, path
->fs_name
, 0, 0,
43 (void *)&qstat
) == 0 && qstat
.qs_flags
) {
46 if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ENFD
)
48 else if (qstat
.qs_flags
& XFS_QUOTA_UDQ_ACCT
)
49 c
= printf("uqnoenforce");
50 if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ENFD
)
51 c
= printf("%sgquota", c
? ", " : "");
52 else if (qstat
.qs_flags
& XFS_QUOTA_GDQ_ACCT
)
53 c
= printf("%sgqnoenforce", c
? ", " : "");
54 if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ENFD
)
55 printf("%spquota", c
? ", " : "");
56 else if (qstat
.qs_flags
& XFS_QUOTA_PDQ_ACCT
)
57 printf("%spqnoenforce", c
? ", " : "");
69 for (i
= 0; i
< fs_count
; i
++) {
71 /* Table is ordered xfs first, then foreign */
72 if (path
->fs_flags
& FS_FOREIGN
&& !foreign_allowed
)
74 printpath(path
, i
, 1, path
== fs_path
);
87 for (i
= 0; i
< fs_count
; i
++) {
89 if (path
->fs_flags
& FS_FOREIGN
&& !foreign_allowed
)
91 printpath(path
, i
, 0, 0);
102 int max
= foreign_allowed
? fs_count
: xfs_fs_count
;
105 printf(_("No paths are available\n"));
113 if (i
< 0 || i
>= max
) {
114 printf(_("value %d is out of range (0-%d)\n"),
117 fs_path
= &fs_table
[i
];
126 path_cmd
.name
= "path";
127 path_cmd
.altname
= "paths";
128 path_cmd
.args
= _("[N]");
129 path_cmd
.cfunc
= path_f
;
132 path_cmd
.flags
= CMD_FLAG_ONESHOT
| CMD_FLAG_FOREIGN_OK
;
133 path_cmd
.oneline
= _("set current path, or show the list of paths");
135 print_cmd
.name
= "print";
136 print_cmd
.altname
= "p";
137 print_cmd
.cfunc
= print_f
;
138 print_cmd
.argmin
= 0;
139 print_cmd
.argmax
= 0;
140 print_cmd
.flags
= CMD_FLAG_ONESHOT
| CMD_FLAG_FOREIGN_OK
;
141 print_cmd
.oneline
= _("list known mount points and projects");
144 add_command(&path_cmd
);
145 add_command(&print_cmd
);