]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/file.c
958cebda315b1e7b893a500e7a1c1268fa78a8a3
2 * Copyright (c) 2004-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/libxfs.h>
20 #include <xfs/command.h>
21 #include <xfs/input.h>
26 static cmdinfo_t file_cmd
;
27 static cmdinfo_t print_cmd
;
39 printf(_("%c%03d%c %-14s (%s,%s,%s,%s%s%s%s)\n"),
40 braces
? '[' : ' ', index
, braces
? ']' : ' ', file
->name
,
41 file
->flags
& IO_FOREIGN
? _("foreign") : _("xfs"),
42 file
->flags
& IO_OSYNC
? _("sync") : _("non-sync"),
43 file
->flags
& IO_DIRECT
? _("direct") : _("non-direct"),
44 file
->flags
& IO_READONLY
? _("read-only") : _("read-write"),
45 file
->flags
& IO_REALTIME
? _(",real-time") : "",
46 file
->flags
& IO_APPEND
? _(",append-only") : "",
47 file
->flags
& IO_NONBLOCK
? _(",non-block") : "");
55 for (i
= 0; i
< filecount
; i
++)
56 print_fileio(&filetable
[i
], i
, &filetable
[i
] == file
);
80 if (i
< 0 || i
>= filecount
) {
81 printf(_("value %d is out of range (0-%d)\n"), i
, filecount
-1);
92 file_cmd
.name
= _("file");
93 file_cmd
.altname
= _("f");
94 file_cmd
.args
= _("[N]");
95 file_cmd
.cfunc
= file_f
;
98 file_cmd
.flags
= CMD_NOMAP_OK
| CMD_FOREIGN_OK
;
99 file_cmd
.oneline
= _("set the current file");
101 print_cmd
.name
= _("print");
102 print_cmd
.altname
= _("p");
103 print_cmd
.cfunc
= print_f
;
104 print_cmd
.argmin
= 0;
105 print_cmd
.argmax
= 0;
106 print_cmd
.flags
= CMD_NOMAP_OK
| CMD_NOFILE_OK
| CMD_FOREIGN_OK
;
107 print_cmd
.oneline
= _("list current open files and memory mappings");
109 add_command(&file_cmd
);
110 add_command(&print_cmd
);