]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/resblks.c
2 * Copyright (c) 2003-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>
25 static cmdinfo_t resblks_cmd
;
26 static int resblks_f(int argc
, char **argv
);
33 xfs_fsop_resblks_t res
;
37 blks
= cvtnum(file
->geom
.blocksize
, file
->geom
.sectsize
, argv
[1]);
39 printf(_("non-numeric argument -- %s\n"), argv
[1]);
43 if (xfsctl(file
->name
, file
->fd
, XFS_IOC_SET_RESBLKS
, &res
) < 0) {
44 perror("XFS_IOC_SET_RESBLKS");
47 } else if (xfsctl(file
->name
, file
->fd
, XFS_IOC_GET_RESBLKS
, &res
) < 0) {
48 perror("XFS_IOC_GET_RESBLKS");
51 printf(_("reserved blocks = %llu\n"),
52 (unsigned long long) res
.resblks
);
53 printf(_("available reserved blocks = %llu\n"),
54 (unsigned long long) res
.resblks_avail
);
61 resblks_cmd
.name
= _("resblks");
62 resblks_cmd
.cfunc
= resblks_f
;
63 resblks_cmd
.argmin
= 0;
64 resblks_cmd
.argmax
= 1;
65 resblks_cmd
.flags
= CMD_NOMAP_OK
;
66 resblks_cmd
.args
= _("[blocks]");
68 _("get and/or set count of reserved filesystem blocks");
71 add_command(&resblks_cmd
);