]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/init.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
11 #include "err_protos.h"
17 #include <sys/resource.h>
22 pthread_key_create(&dblkmap_key
, NULL
);
23 pthread_key_create(&ablkmap_key
, NULL
);
32 if (getrlimit(RLIMIT_FSIZE
, &rl
) == -1) {
34 fprintf(stderr
, _("getrlimit(RLIMIT_FSIZE) failed!\n"));
37 if (rl
.rlim_cur
!= RLIM_INFINITY
) {
38 rl
.rlim_max
= rl
.rlim_cur
= RLIM_INFINITY
;
39 if (setrlimit(RLIMIT_FSIZE
, &rl
) == -1) {
42 _("setrlimit failed - current: %lld, max: %lld\n"),
43 (unsigned long long)rl
.rlim_cur
,
44 (unsigned long long)rl
.rlim_max
);
51 xfs_init(libxfs_init_t
*args
)
53 memset(args
, 0, sizeof(libxfs_init_t
));
57 args
->dname
= fs_name
;
61 args
->volname
= fs_name
;
65 if (log_spec
) { /* External log specified */
66 args
->logname
= log_name
;
67 args
->lisfile
= (isa_file
?1:0);
68 /* XXX assume data file also means log file */
69 /* REVISIT: Need to do fs sanity / log validity checking */
72 if (rt_spec
) { /* RT device specified */
73 args
->rtname
= rt_name
;
74 args
->risfile
= (isa_file
?1:0);
75 /* XXX assume data file also means rt file */
78 args
->usebuflock
= do_prefetch
;
80 args
->isdirect
= LIBXFS_DIRECT
;
82 args
->isreadonly
= (LIBXFS_ISREADONLY
| LIBXFS_ISINACTIVE
);
84 args
->isreadonly
= (LIBXFS_ISINACTIVE
| LIBXFS_DANGEROUSLY
);
86 args
->isreadonly
= LIBXFS_EXCLUSIVELY
;
88 if (!libxfs_init(args
)) {
89 /* would -d be an option? */
90 if (!no_modify
&& !dangerously
) {
91 args
->isreadonly
= (LIBXFS_ISINACTIVE
|
93 if (libxfs_init(args
))
95 _("Unmount or use the dangerous (-d) option to repair a read-only mounted filesystem\n"));
97 do_error(_("couldn't initialize XFS library\n"));