]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/prealloc.c
2 * Copyright (c) 2003 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 static cmdinfo_t allocsp_cmd
;
38 static cmdinfo_t freesp_cmd
;
39 static cmdinfo_t resvsp_cmd
;
40 static cmdinfo_t unresvsp_cmd
;
46 xfs_flock64_t
*segment
)
50 memset(segment
, 0, sizeof(*segment
));
51 segment
->l_whence
= SEEK_SET
;
52 segment
->l_start
= strtoul(offset
, &sp
, 0);
53 if (!sp
|| sp
== offset
) {
54 printf(_("non-numeric offset argument -- %s\n"), offset
);
57 segment
->l_len
= strtoul(length
, &sp
, 0);
58 if (!sp
|| sp
== length
) {
59 printf(_("non-numeric length argument -- %s\n"), length
);
70 xfs_flock64_t segment
;
72 if (!offset_length(argv
[1], argv
[2], &segment
))
75 if (xfsctl(fname
, fdesc
, XFS_IOC_ALLOCSP64
, &segment
) < 0) {
76 perror("xfsctl(XFS_IOC_ALLOCSP64)");
87 xfs_flock64_t segment
;
89 if (!offset_length(argv
[1], argv
[2], &segment
))
92 if (xfsctl(fname
, fdesc
, XFS_IOC_FREESP64
, &segment
) < 0) {
93 perror("xfsctl(XFS_IOC_FREESP64)");
104 xfs_flock64_t segment
;
106 if (!offset_length(argv
[1], argv
[2], &segment
))
109 if (xfsctl(fname
, fdesc
, XFS_IOC_RESVSP64
, &segment
) < 0) {
110 perror("xfsctl(XFS_IOC_RESVSP64)");
121 xfs_flock64_t segment
;
123 if (!offset_length(argv
[1], argv
[2], &segment
))
126 if (xfsctl(fname
, fdesc
, XFS_IOC_UNRESVSP64
, &segment
) < 0) {
127 perror("xfsctl(XFS_IOC_UNRESVSP64)");
136 allocsp_cmd
.name
= _("allocsp");
137 allocsp_cmd
.cfunc
= allocsp_f
;
138 allocsp_cmd
.argmin
= 2;
139 allocsp_cmd
.argmax
= 2;
140 allocsp_cmd
.args
= _("off len");
141 allocsp_cmd
.oneline
= _("allocates zeroed space for part of a file");
143 freesp_cmd
.name
= _("freesp");
144 freesp_cmd
.cfunc
= freesp_f
;
145 freesp_cmd
.argmin
= 2;
146 freesp_cmd
.argmax
= 2;
147 freesp_cmd
.args
= _("off len");
148 freesp_cmd
.oneline
= _("frees space associated with part of a file");
150 resvsp_cmd
.name
= _("resvsp");
151 resvsp_cmd
.cfunc
= resvsp_f
;
152 resvsp_cmd
.argmin
= 2;
153 resvsp_cmd
.argmax
= 2;
154 resvsp_cmd
.args
= _("off len");
156 _("reserves space associated with part of a file");
158 unresvsp_cmd
.name
= _("unresvsp");
159 unresvsp_cmd
.cfunc
= unresvsp_f
;
160 unresvsp_cmd
.argmin
= 2;
161 unresvsp_cmd
.argmax
= 2;
162 unresvsp_cmd
.args
= _("off len");
163 unresvsp_cmd
.oneline
=
164 _("frees reserved space associated with part of a file");
166 add_command(&allocsp_cmd
);
167 add_command(&freesp_cmd
);
168 add_command(&resvsp_cmd
);
169 add_command(&unresvsp_cmd
);