]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/init.c
2 * Copyright (c) 2000-2002,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
23 #include "err_protos.h"
29 #include <sys/resource.h>
34 pthread_key_create(&dblkmap_key
, NULL
);
35 pthread_key_create(&ablkmap_key
, NULL
);
44 if (getrlimit(RLIMIT_FSIZE
, &rl
) == -1) {
46 fprintf(stderr
, _("getrlimit(RLIMIT_FSIZE) failed!\n"));
49 if (rl
.rlim_cur
!= RLIM_INFINITY
) {
50 rl
.rlim_max
= rl
.rlim_cur
= RLIM_INFINITY
;
51 if (setrlimit(RLIMIT_FSIZE
, &rl
) == -1) {
54 _("setrlimit failed - current: %lld, max: %lld\n"),
55 (unsigned long long)rl
.rlim_cur
,
56 (unsigned long long)rl
.rlim_max
);
63 xfs_init(libxfs_init_t
*args
)
65 memset(args
, 0, sizeof(libxfs_init_t
));
69 args
->dname
= fs_name
;
73 args
->volname
= fs_name
;
77 if (log_spec
) { /* External log specified */
78 args
->logname
= log_name
;
79 args
->lisfile
= (isa_file
?1:0);
80 /* XXX assume data file also means log file */
81 /* REVISIT: Need to do fs sanity / log validity checking */
84 if (rt_spec
) { /* RT device specified */
85 args
->rtname
= rt_name
;
86 args
->risfile
= (isa_file
?1:0);
87 /* XXX assume data file also means rt file */
90 args
->usebuflock
= do_prefetch
;
92 args
->isdirect
= LIBXFS_DIRECT
;
94 args
->isreadonly
= (LIBXFS_ISREADONLY
| LIBXFS_ISINACTIVE
);
96 args
->isreadonly
= (LIBXFS_ISINACTIVE
| LIBXFS_DANGEROUSLY
);
98 args
->isreadonly
= LIBXFS_EXCLUSIVELY
;
100 if (!libxfs_init(args
)) {
101 /* would -d be an option? */
102 if (!no_modify
&& !dangerously
) {
103 args
->isreadonly
= (LIBXFS_ISINACTIVE
|
105 if (libxfs_init(args
))
107 _("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n"));
109 do_error(_("couldn't initialize XFS library\n"));