]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/file.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2004-2005 Silicon Graphics, Inc.
13 static cmdinfo_t file_cmd
;
14 static cmdinfo_t print_cmd
;
26 printf(_("%c%03d%c %-14s (%s,%s,%s,%s%s%s%s%s%s%s)\n"),
27 braces
? '[' : ' ', index
, braces
? ']' : ' ', file
->name
,
28 file
->flags
& IO_FOREIGN
? _("foreign") : _("xfs"),
29 file
->flags
& IO_OSYNC
? _("sync") : _("non-sync"),
30 file
->flags
& IO_DIRECT
? _("direct") : _("non-direct"),
31 file
->flags
& IO_READONLY
? _("read-only") : _("read-write"),
32 file
->flags
& IO_REALTIME
? _(",real-time") : "",
33 file
->flags
& IO_APPEND
? _(",append-only") : "",
34 file
->flags
& IO_NONBLOCK
? _(",non-block") : "",
35 file
->flags
& IO_TMPFILE
? _(",tmpfile") : "",
36 file
->flags
& IO_PATH
? _(",path") : "",
37 file
->flags
& IO_NOFOLLOW
? _(",nofollow") : "");
45 for (i
= 0; i
< filecount
; i
++)
46 print_fileio(&filetable
[i
], i
, &filetable
[i
] == file
);
70 if (i
< 0 || i
>= filecount
) {
71 printf(_("value %d is out of range (0-%d)\n"), i
, filecount
-1);
83 file_cmd
.name
= "file";
84 file_cmd
.altname
= "f";
85 file_cmd
.args
= _("[N]");
86 file_cmd
.cfunc
= file_f
;
89 file_cmd
.flags
= CMD_NOMAP_OK
| CMD_FOREIGN_OK
| CMD_FLAG_ONESHOT
;
90 file_cmd
.oneline
= _("set the current file");
92 print_cmd
.name
= "print";
93 print_cmd
.altname
= "p";
94 print_cmd
.cfunc
= print_f
;
97 print_cmd
.flags
= CMD_NOMAP_OK
| CMD_NOFILE_OK
| CMD_FOREIGN_OK
|
99 print_cmd
.oneline
= _("list current open files and memory mappings");
101 add_command(&file_cmd
);
102 add_command(&print_cmd
);