Skip to content

Commit 69a996a

Browse files
committed
compiled with clang++, fixed compile warnings with both g++ and clang++
1 parent 328d96d commit 69a996a

28 files changed

+492
-298
lines changed

Makefile.in

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \
8484
$(top_srcdir)/tools/install-sh $(top_srcdir)/tools/missing
8585
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
8686
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
87+
$(top_srcdir)/tools/ft_cxx_flags.m4 \
8788
$(top_srcdir)/tools/ft_cxx_features.m4 \
8889
$(top_srcdir)/tools/ft_cxx_unordered_map.m4 \
8990
$(top_srcdir)/tools/ft_need_funcs.m4 \

README.md

+53-47
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
###############################################################################
2-
###############################################################################
3-
###############################################################################
4-
######### #########
5-
######### THIS DOCUMENT EXPLAINS HOW TO USE #########
6-
######### RISKY PROGRAMS AND PROCEDURES #########
7-
######### THAT MAY COMPLETELY AND IRREVERSIBLY DELETE #########
8-
######### ALL THE DATA ON YOUR DISKS #########
9-
######### #########
10-
######### THE AUTHOR DECLINES ALL RESPONSIBILITIES #########
11-
######### FOR ANY DAMAGE THAT MAY DERIVE #########
12-
######### FROM USING THE PROGRAMS AND PROCEDURES #########
13-
######### DESCRIBED IN THIS DOCUMENT #########
14-
######### #########
15-
###############################################################################
16-
###############################################################################
17-
###############################################################################
18-
19-
This document explains how use the programs 'fstransform', 'fsmove'
20-
and 'fsremap' to transform the contents of a Linux device
21-
- usually a disk partition - from a filesystem type to another
22-
while preserving its contents.
1+
###############################################################
2+
###############################################################
3+
###
4+
### DISCLAIMER
5+
###
6+
### THIS DOCUMENT EXPLAINS HOW TO USE
7+
### RISKY PROGRAMS AND PROCEDURES
8+
### THAT MAY COMPLETELY AND IRREVERSIBLY DELETE
9+
### ALL THE DATA ON YOUR DISKS
10+
###
11+
### THE AUTHOR DECLINES ALL RESPONSIBILITIES
12+
### FOR ANY DAMAGE THAT MAY DERIVE
13+
### FROM USING THE PROGRAMS AND PROCEDURES
14+
### DESCRIBED IN THIS DOCUMENT
15+
###
16+
###############################################################
17+
###############################################################
18+
19+
20+
This document explains how use the programs 'fstransform', 'fsmove' and
21+
'fsremap' to transform the contents of a Linux device - usually a disk
22+
partition - from a filesystem type to another while preserving its contents.
2323

2424
For example, a disk partition can be transformed from 'jfs' to 'ext4',
2525
or from 'ext2' to 'xfs', or many other combinations.
@@ -48,9 +48,10 @@ All this foreword means only one thing:
4848
The author declines ALL responsibilities for ANY damage that may derive
4949
from using the programs and procedures described in this document.
5050

51-
###############################################################################
52-
###############################################################################
53-
###############################################################################
51+
###############################################################
52+
###############################################################
53+
54+
### Introduction
5455

5556
Enough legalese... now let's get to the interesting part.
5657

@@ -66,9 +67,11 @@ It works even if the filesystem is almost full
6667
and even if it contains very large files, for example if some files
6768
are larger than half the device or larger than the available space.
6869

70+
### REQUIREMENTS
71+
6972
There are four requirements for fstransform to have a chance to succeed:
7073

71-
1) the device must have a little free space, typically at least 5%
74+
1. the device must have a little free space, typically at least 5%
7275

7376
WARNING: transforming an almost full device to 'xfs' file-system
7477
can be tricky:
@@ -79,7 +82,7 @@ There are four requirements for fstransform to have a chance to succeed:
7982
before resuming fstransform.
8083
A future fstransform version may automate this operation.
8184

82-
2) the filesystem on the device must support SPARSE FILES, i.e. files with holes
85+
2. the filesystem on the device must support SPARSE FILES, i.e. files with holes
8386
(see for example http://en.wikipedia.org/wiki/Sparse_file for an explanation of what they are)
8487
and at least one of the two system calls "ioctl(FS_IOC_FIEMAP)" or "ioctl(FIBMAP)"
8588
(see the file Documentation/filesystems/fiemap.txt in any recent Linux kernel
@@ -88,24 +91,25 @@ There are four requirements for fstransform to have a chance to succeed:
8891
ioctl(FIBMAP) is limited by design to 2G-1 blocks, which typically translates to 8TB - 4kB.
8992
To transform file systems equal or larger than 8TB, ioctl(FIEMAP) is required.
9093

91-
3) the initial and final filesystems must be supported by the Linux kernel
94+
3. the initial and final filesystems must be supported by the Linux kernel
9295
(i.e. it must be able to mount them)
9396
and by the tools 'mkfs' and 'fsck'
9497
(i.e. it must be possible to create them and check them for errors)
9598

96-
4) the following programs must be available:
99+
4. the following programs must be available:
97100
the two custom-made programs 'fsmove' and 'fsremap' (distributed with the script)
98101
and several common Linux tools:
99102
which, expr, id, blockdev, losetup, mount, umount,
100103
mkdir, rmdir, rm, mkfifo, dd, sync, fsck, mkfs
101104

102105

103-
KNOWN LIMITS:
106+
### KNOWN LIMITS
107+
108+
* If the device contains a HUGE number of files with multiple hard links,
109+
fstransform will be very slow and consume a LOT of memory.
110+
Devices with more than one million files with multiple hard links
111+
can cause fstransform to crash with "out of memory" errors.
104112

105-
1) if the device contains a HUGE number of files with multiple hard links,
106-
fstransform will be very slow and consume a LOT of memory.
107-
Devices with more than one million files with multiple hard links
108-
can cause fstransform to crash with "out of memory" errors.
109113

110114
2) JFS file systems equal or larger than 8TB cannot be converted due to
111115
missing support for ioctl(FIEMAP) in the kernel:
@@ -120,7 +124,8 @@ KNOWN LIMITS:
120124
4) for the same reason, a device cannot be converted _to_ REISERFS format "3.5"
121125
if it contains files larger than 2TB - 4k.
122126

123-
FOREWORD:
127+
128+
### DETAILS TO KNOW
124129

125130
If the original device is almost full, the program 'fsremap'
126131
will create a relatively small backup file ("secondary storage")
@@ -136,9 +141,9 @@ To pass the same option to 'fstransform', you must execute something like
136141
fstransform --opts-fsremap='-s <size>' <other-options-and-arguments>
137142

138143

139-
PROCEDURE:
144+
### PROCEDURE
140145

141-
0) compile fsmove and fsremap.
146+
0. compile fsmove and fsremap.
142147
Running "./configure" then "make" should suffice on any recent Linux machine,
143148
as long as g++ is installed.
144149

@@ -152,15 +157,15 @@ PROCEDURE:
152157
Below, they will be referred as {fsmove} and {fsremap}
153158

154159

155-
1) OPTIONAL - CAN BE SKIPPED
160+
1. OPTIONAL - CAN BE SKIPPED
156161
mount read-write the device you want to remap to a new file-system type
157162

158163
mount {device} {device-mount-point} [your-options]
159164

160165
if the device is already mounted, check that it is mounted read-write
161166
and that no process is using it.
162167

163-
2) decide the target file-system type.
168+
2. decide the target file-system type.
164169

165170
For some combinations of the initial and final filesystems
166171
it is not necessary to use 'fstransform',
@@ -175,14 +180,14 @@ PROCEDURE:
175180
"convert Linux File System ext2 to ext3"
176181
"convert Linux File System ext3 to ext4"
177182

178-
But for most combinations, the only way is either to do a full backup + format +
179-
restore the data, or use 'fstransform'
183+
But for most combinations, the only way is either to do a full backup +
184+
format + restore the data, or use 'fstransform'
180185

181-
3) execute the program
186+
3. execute the program
182187

183188
fstransform {device} {target-file-system-type}
184189

185-
4) follow the instructions - the program will tell you what it is doing,
190+
4. follow the instructions - the program will tell you what it is doing,
186191
and will also call 'fsmove' and 'fsremap' which show progress percentage
187192
and estimated time left.
188193

@@ -193,10 +198,11 @@ PROCEDURE:
193198
In case there are errors, you can even try to fix them instead of
194199
aborting the execution (if you know what you are doing).
195200

196-
5) be PATIENT. Transforming a large device takes a LONG time...
197-
On a fairly fast disk, it takes about 1 minute per 1 gigabyte.
198-
It means transforming 250GB of takes about 4 hours.
199-
Solid state disks (SSD) can be much faster.
201+
5. be PATIENT. Transforming a large device takes a LONG time...
202+
On a fairly fast disk, it takes about one minute per gigabyte.
203+
It means transforming 1000GB takes about 16 hours.
204+
Raid disks can be somewhat faster, and solid state disks (SSD)
205+
can be _much_ faster.
200206

201207
6) if something goes really wrong, check in /var/tmp/fstransform
202208
for the log files

acinclude.m4

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
m4_include([tools/ft_cxx_flags.m4])
12
m4_include([tools/ft_cxx_features.m4])
23
m4_include([tools/ft_cxx_unordered_map.m4])
34
m4_include([tools/ft_need_funcs.m4])

configure

+107-4
Original file line numberDiff line numberDiff line change
@@ -3637,8 +3637,111 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
36373637
# Checks for compiler characteristics
36383638
36393639
3640-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_cv_prog_ac_ct_CXX supports explicit template instantiation" >&5
3641-
$as_echo_n "checking whether $ac_cv_prog_ac_ct_CXX supports explicit template instantiation... " >&6; }
3640+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -Wall" >&5
3641+
$as_echo_n "checking whether $CXX accepts -Wall... " >&6; }
3642+
if ${ac_cv_cxx_flag_Wall+:} false; then :
3643+
$as_echo_n "(cached) " >&6
3644+
else
3645+
save_CXXFLAGS="$CXXFLAGS"
3646+
CXXFLAGS="$CXXFLAGS -Wall"
3647+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3648+
/* end confdefs.h. */
3649+
3650+
3651+
int
3652+
main ()
3653+
{
3654+
3655+
return 0;
3656+
3657+
;
3658+
return 0;
3659+
}
3660+
_ACEOF
3661+
if ac_fn_cxx_try_compile "$LINENO"; then :
3662+
ac_cv_cxx_flag_Wall=yes
3663+
else
3664+
ac_cv_cxx_flag_Wall=no
3665+
CXXFLAGS="$save_CXXFLAGS"
3666+
3667+
fi
3668+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3669+
3670+
fi
3671+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_flag_Wall" >&5
3672+
$as_echo "$ac_cv_cxx_flag_Wall" >&6; }
3673+
3674+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -Wextra" >&5
3675+
$as_echo_n "checking whether $CXX accepts -Wextra... " >&6; }
3676+
if ${ac_cv_cxx_flag_Wextra+:} false; then :
3677+
$as_echo_n "(cached) " >&6
3678+
else
3679+
save_CXXFLAGS="$CXXFLAGS"
3680+
CXXFLAGS="$CXXFLAGS -Wextra"
3681+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3682+
/* end confdefs.h. */
3683+
3684+
3685+
int
3686+
main ()
3687+
{
3688+
3689+
return 0;
3690+
3691+
;
3692+
return 0;
3693+
}
3694+
_ACEOF
3695+
if ac_fn_cxx_try_compile "$LINENO"; then :
3696+
ac_cv_cxx_flag_Wextra=yes
3697+
else
3698+
ac_cv_cxx_flag_Wextra=no
3699+
CXXFLAGS="$save_CXXFLAGS"
3700+
3701+
fi
3702+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3703+
3704+
fi
3705+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_flag_Wextra" >&5
3706+
$as_echo "$ac_cv_cxx_flag_Wextra" >&6; }
3707+
3708+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -W" >&5
3709+
$as_echo_n "checking whether $CXX accepts -W... " >&6; }
3710+
if ${ac_cv_cxx_flag_W+:} false; then :
3711+
$as_echo_n "(cached) " >&6
3712+
else
3713+
save_CXXFLAGS="$CXXFLAGS"
3714+
CXXFLAGS="$CXXFLAGS -W"
3715+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3716+
/* end confdefs.h. */
3717+
3718+
3719+
int
3720+
main ()
3721+
{
3722+
3723+
return 0;
3724+
3725+
;
3726+
return 0;
3727+
}
3728+
_ACEOF
3729+
if ac_fn_cxx_try_compile "$LINENO"; then :
3730+
ac_cv_cxx_flag_W=yes
3731+
else
3732+
ac_cv_cxx_flag_W=no
3733+
CXXFLAGS="$save_CXXFLAGS"
3734+
3735+
fi
3736+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
3737+
3738+
fi
3739+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_flag_W" >&5
3740+
$as_echo "$ac_cv_cxx_flag_W" >&6; }
3741+
3742+
3743+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports explicit template instantiation" >&5
3744+
$as_echo_n "checking whether $CXX supports explicit template instantiation... " >&6; }
36423745
if ${ac_cv_cxx_have_template_instantiation+:} false; then :
36433746
$as_echo_n "(cached) " >&6
36443747
else
@@ -3679,8 +3782,8 @@ fi
36793782
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_have_template_instantiation" >&5
36803783
$as_echo "$ac_cv_cxx_have_template_instantiation" >&6; }
36813784
3682-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $ac_cv_prog_ac_ct_CXX supports inhibiting template instantiation" >&5
3683-
$as_echo_n "checking whether $ac_cv_prog_ac_ct_CXX supports inhibiting template instantiation... " >&6; }
3785+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX supports inhibiting template instantiation" >&5
3786+
$as_echo_n "checking whether $CXX supports inhibiting template instantiation... " >&6; }
36843787
if ${ac_cv_cxx_have_template_inhibition+:} false; then :
36853788
$as_echo_n "(cached) " >&6
36863789
else

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ AC_PROG_INSTALL
1717
AC_LANG(C++)
1818

1919
# Checks for compiler characteristics
20+
FT_CXX_FLAGS
2021
FT_CXX_FEATURES
2122

2223
# Checks for header files.

fsattr/build/Makefile.in

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
8282
$(top_srcdir)/tools/depcomp
8383
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
8484
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
85+
$(top_srcdir)/tools/ft_cxx_flags.m4 \
8586
$(top_srcdir)/tools/ft_cxx_features.m4 \
8687
$(top_srcdir)/tools/ft_cxx_unordered_map.m4 \
8788
$(top_srcdir)/tools/ft_need_funcs.m4 \

fsmove/build/Makefile.in

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
8282
$(top_srcdir)/tools/depcomp
8383
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
8484
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
85+
$(top_srcdir)/tools/ft_cxx_flags.m4 \
8586
$(top_srcdir)/tools/ft_cxx_features.m4 \
8687
$(top_srcdir)/tools/ft_cxx_unordered_map.m4 \
8788
$(top_srcdir)/tools/ft_need_funcs.m4 \

fsmove/src/io/io_posix.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ int fm_io_posix::disk_stat(const char * path, fm_disk_stat & disk_stat)
214214
/**
215215
* use some file-system specific trickery and try to free some space.
216216
*/
217-
void fm_io_posix::try_to_make_free_space(const char * path)
217+
void fm_io_posix::try_to_make_free_space(const char * FT_ARG_UNUSED(path))
218218
{
219219
#if 0
220220
/*
221221
* we COULD run 'xfs_fsr <path>' and try to free some space on 'xfs' file-systems,
222222
* but at least on linux with an almost-full source device
223223
* xfs_fsr can WORSEN the problem by triggering 'loop write error' kernel errors,
224224
* which mean the source device has not enough space to accommodate the loop file contents.
225-
* typically this CORRUPTS the file system inside target (loop) device!
225+
* this typically CORRUPTS the file system inside target (loop) device!
226226
*/
227227
const char * cmd = "xfs_fsr";
228228
const char * const args[] = { cmd, path, NULL };

fsmove/src/io/io_prealloc.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void fm_io_prealloc::sync()
8383
* Since we are preallocating, we can (and will) avoid any modification
8484
* to the source file system. Thus this method does nothing.
8585
*/
86-
int fm_io_prealloc::remove_file(const char * source_path)
86+
int fm_io_prealloc::remove_file(const char * FT_ARG_UNUSED(source_path))
8787
{
8888
return 0;
8989
}
@@ -93,7 +93,7 @@ int fm_io_prealloc::remove_file(const char * source_path)
9393
* Since we are preallocating, we can (and will) avoid any modification
9494
* to the source file system. Thus this method does nothing.
9595
*/
96-
int fm_io_prealloc::remove_special(const char * source_path)
96+
int fm_io_prealloc::remove_special(const char * FT_ARG_UNUSED(source_path))
9797
{
9898
return 0;
9999
}
@@ -114,7 +114,7 @@ int fm_io_prealloc::remove_dir(const ft_string & path)
114114
* copy the contents of regular file 'source_path' to 'target_path'.
115115
* Since we are preallocating, we just preallocate enough blocks inside 'target_path'
116116
*/
117-
int fm_io_prealloc::copy_file_contents(const ft_string & source_path, const ft_stat & source_stat, const ft_string & target_path)
117+
int fm_io_prealloc::copy_file_contents(const ft_string & FT_ARG_UNUSED(source_path), const ft_stat & source_stat, const ft_string & target_path)
118118
{
119119
const char * target = target_path.c_str();
120120
int err = 0;

0 commit comments

Comments
 (0)