fsarchiver-0.8.6/0000755000175000017500000000000014016431625010664 500000000000000fsarchiver-0.8.6/THANKS0000644000175000017500000000221113655317102011514 00000000000000===================================================================== fsarchiver: Filesystem Archiver for Linux [http://www.fsarchiver.org] ===================================================================== Special thanks to Clive Wagenaar who helped a lot by testing fsarchiver-0.3.x and found several important bugs and help in their resolutions. Special thanks to Leon Bene who reported a crash and who executed many tests using debugging version to identify the cause of the crash. It permitted to fix a critical integer overflow bug with the "u64 headerlen" when the total size of the attributes is more than 65535 bytes in the header. It has been fixed in fsarchiver-0.6.4. Many thanks to Marcos Mello who helped a lot improve the XFS support in fsarchiver-0.6.20. He found unexpected fsarchiver behaviors with new versions of the kernel and xfsprogs, did a lot of research regarding these components, and tested the XFS fixes in fsarchiver. He also provided fixes and documentation updates in fsarchiver-0.6.24. He also did a lot of research regarding EXT4 and helped improve the handling of extfs on very large block devices in fsarchiver-0.8.2. fsarchiver-0.8.6/doc/0000755000175000017500000000000014016431625011431 500000000000000fsarchiver-0.8.6/doc/Makefile.am0000644000175000017500000000012512461437135013407 00000000000000man_MANS = fsarchiver.8 EXTRA_DIST = $(man_MANS) MAINTAINERCLEANFILES = Makefile.in fsarchiver-0.8.6/doc/Makefile.in0000644000175000017500000003553214016431530013421 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } man8dir = $(mandir)/man8 am__installdirs = "$(DESTDIR)$(man8dir)" NROFF = nroff MANS = $(man_MANS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLKID_CFLAGS = @BLKID_CFLAGS@ BLKID_LIBS = @BLKID_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ COM_ERR_LIBS = @COM_ERR_LIBS@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_DEBUG_LEVEL = @DEFAULT_DEBUG_LEVEL@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ E2P_CFLAGS = @E2P_CFLAGS@ E2P_LIBS = @E2P_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ EXT2FS_LIBS = @EXT2FS_LIBS@ FSARCHIVER_LDFLAGS = @FSARCHIVER_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOGDIR = @LOGDIR@ LTLIBOBJS = @LTLIBOBJS@ LZMA_CFLAGS = @LZMA_CFLAGS@ LZMA_LIBS = @LZMA_LIBS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ man_MANS = fsarchiver.8 EXTRA_DIST = $(man_MANS) MAINTAINERCLEANFILES = Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-man8: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man8dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.8[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man8 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic cscopelist-am \ ctags-am distclean distclean-generic distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-man8 install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags-am uninstall uninstall-am uninstall-man \ uninstall-man8 .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: fsarchiver-0.8.6/doc/fsarchiver.80000644000175000017500000002124413727437621013613 00000000000000.TH FSARCHIVER 8 "30 December 2009" .SH NAME fsarchiver \- filesystem archiver .SH DESCRIPTION fsarchiver is a system tool that allows you to save the contents of a filesystem to a compressed archive file. The filesystem contents can be restored on a device which has a different size and it can be restored on a different filesystem. Unlike tar/dar, fsarchiver also creates the filesystem when it extracts the data to devices. Everything is checksummed in the archive in order to protect the data. If the archive is corrupt, you just lose the current file, not the whole archive. .SH LINKS .SS Official project homepage: http://www.fsarchiver.org .SS Quick Start guide: http://www.fsarchiver.org/quickstart/ .SS Git repository: https://github.com/fdupoux/fsarchiver .SS Report a bug: https://github.com/fdupoux/fsarchiver/issues .SH SYNOPSIS .B fsarchiver [ .I options .B ] savefs .I archive .I device .B ... .PP .B fsarchiver [ .I options .B ] restfs .I archive .BI id= n ,dest= device [,mkfs= fstype ,mkfsopt= options ,label= \ newlabel ,uuid= newuuid ] .B ... .PP .B fsarchiver [ .I options .B ] savedir .I archive .I directory .B ... .PP .B fsarchiver [ .I options .B ] restdir .I archive destination .PP .B fsarchiver [ .I options .B ] archinfo .I archive .PP .B fsarchiver [ .I options .B ] probe [detailed] .SH COMMANDS .TP .B savefs Save .I device filesystem to .IR archive . .TP .B restfs Restore filesystems from .IR archive . This overwrites the existing data on .IR device . Zero-based index .I n indicates the part of the archive to restore. Optionally, a filesystem may be converted to .IR fstype and extra mkfs .IR options specified. .IR newlabel and .IR newuuid override values stored in the archive. .TP .B savedir Save .I directories to .I archive (similar to a compressed tarball). .TP .B restdir Restore data from .I archive which is not based on a filesystem to .IR destination . .TP .B archinfo Show information about an existing .I archive file and its contents. .TP .B probe Show list of filesystems detected on the disks. .SH "OPTIONS" .PP .IP "\fB\-h, \-\-help\fP" Show help and information about how to use fsarchiver with examples. .IP "\fB\-V, \-\-version\fP" Show program version and exit. .IP "\fB\-v, \-\-verbose\fP" Verbose mode (can be used several times to increase the level of details). The details will be printed to the console. .IP "\fB\-o, \-\-overwrite\fP" Overwrite the archive if it already exists instead of failing. .IP "\fB\-d, \-\-debug\fP" Debug mode (can be used several times to increase the level of details). The details will be written in /var/log/fsarchiver.log. .IP "\fB\-x, \-\-experimental\fP" Allow to save filesystems which support is considered experimental in fsarchiver. .IP "\fB\-A, \-\-allow-rw-mounted\fP" Allow to save a filesystem which is mounted in read-write (live backup). By default fsarchiver fails with an error if the device is mounted in read-write mode which allows modifications to be done on the filesystem during the backup. Modifications can drive to inconsistencies in the backup. Using LVM snapshots is the recommended way to make backups since it will provide consistency, but it is only available for filesystems which are on LVM logical volumes. .IP "\fB\-a, \-\-allow-no-acl-xattr\fP" Allow to save a filesystem when ACLs and extended attributes are not supported (or are disabled) by the kernel. By default fsarchiver fails with an error if it cannot access ACLs and extended attributes, since they would not be saved. If you do not need ACLs and extended attributes preserved then it is safe to use this option. .IP "\fB\-e pattern, \-\-exclude=pattern\fP" Exclude files and directories that match specified pattern. The pattern can contain shell wildcards such as * and ? or may be either a simple file/dir name or an absolute file/dir path. You must use quotes around the pattern each time you use wildcards, else it would be interpreted by the shell. The wildcards must be interpreted by fsarchiver. See examples below for more details about this option. .IP "\fB\-L label, \-\-label=label\fP" Set the label of the archive: it is just a comment about its contents. It can be used to remember a particular thing about the archive or the state of the filesystem for instance. .IP "\fB\-z level, \-\-compress=level\fP" Legacy compression levels are between 0 (very fast) and 9 (very good). The memory requirement increases a lot with the best compression levels, and it is multiplied by the number of compression threads (option -j). Level 9 is considered as an extreme compression level and requires an huge amount of memory to run. For more details please read this page: http://www.fsarchiver.org/compression/ .IP "\fB\-Z level, \-\-zstd=level\fP" Zstd compression levels are between 1 (very fast) and 22 (very good). The memory requirement increases a lot with the best compression levels, and it is multiplied by the number of compression threads (option -j). Levels above 20 are considered as extreme compression levels and requires an huge amount of memory to run. For more details please read this page: http://www.fsarchiver.org/compression/ .IP "\fB\-s mbsize, \-\-split=mbsize\fP" Split the archive into several files of mbsize megabytes each. .IP "\fB\-j count, \-\-jobs=count\fP" Create more than one (de)compression thread. Useful on multi-core CPUs. By default fsarchiver will only use one (de)compression thread (-j 1) and then only one logical processor will be used for the task. You should use this option if you have a multi-core CPU or more than one physical CPU on your computer. The typical way to use it is to specify the number of logical processors available so that all the processing power is used to (de)compress the archive very quickly. You may also want to use all logical processors but one so that your system stays responsive for other applications. .IP "\fB\-c password, \-\-cryptpass=password\fP" Encrypt/decrypt data in archive. Password length: 6 to 64 characters. You can either provide a real password or a dash (-c -). Use the dash if you do not want to provide the password in the command line. It will be prompted in the terminal instead. .SH EXAMPLES .SS save only one filesystem (/dev/sda1) to an archive: fsarchiver savefs /data/myarchive1.fsa /dev/sda1 .SS save two filesystems (/dev/sda1 and /dev/sdb1) to an archive: fsarchiver savefs /data/myarchive2.fsa /dev/sda1 /dev/sdb1 .SS restore the first filesystem from an archive (first = number 0): fsarchiver restfs /data/myarchive2.fsa id=0,dest=/dev/sda1 .SS restore the second filesystem from an archive (second = number 1): fsarchiver restfs /data/myarchive2.fsa id=1,dest=/dev/sdb1 .SS restore two filesystems from an archive (number 0 and 1): fsarchiver restfs /data/arch2.fsa id=0,dest=/dev/sda1 id=1,dest=/dev/sdb1 .SS restore a filesystem from an archive and convert it to reiserfs: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=reiserfs .SS restore a filesystem from an archive and specify extra mkfs options: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,mkfs=ext4,mkfsopt="-I 256" .SS restore a filesystem from an archive and specify a new filesystem label: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,label=root .SS restore a filesystem from an archive and specify a new filesystem UUID: fsarchiver restfs /data/myarchive1.fsa id=0,dest=/dev/sda1,uuid=5f6e5f4f-dc2a-4dbd-a6ea-9ca997cde75e .SS save the contents of /usr/src/linux to an archive (similar to tar): fsarchiver savedir /data/linux-sources.fsa /usr/src/linux .SS save a filesystem (/dev/sda1) to an archive split into volumes of 680MB: fsarchiver savefs -s 680 /data/myarchive1.fsa /dev/sda1 .SS save a filesystem and exclude all files/dirs called 'pagefile.*': fsarchiver savefs /data/myarchive.fsa /dev/sda1 --exclude='pagefile.*' .SS generic exclude for 'share' such as '/usr/share' and '/usr/local/share': fsarchiver savefs /data/myarchive.fsa --exclude=share .SS absolute exclude valid for '/usr/share' but not for '/usr/local/share': fsarchiver savefs /data/myarchive.fsa --exclude=/usr/share .SS save a filesystem (/dev/sda1) to an encrypted archive: fsarchiver savefs -c mypassword /data/myarchive1.fsa /dev/sda1 .SS same as before but prompt for password in the terminal: fsarchiver savefs -c - /data/myarchive1.fsa /dev/sda1 .SS extract an archive made of simple files to /tmp/extract: fsarchiver restdir /data/linux-sources.fsa /tmp/extract .SS show information about an archive and its filesystems: fsarchiver archinfo /data/myarchive2.fsa .SH WARNING .B fsarchiver is considered stable for Linux filesystems such as EXT4 and XFS but unstable for NTFS. .SH AUTHOR fsarchiver was written by Francois Dupoux. It is released under the GPL2 (GNU General Public License version 2). This manpage was written by Ilya Barygin and Francois Dupoux. fsarchiver-0.8.6/missing0000755000175000017500000001533614016431530012206 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: fsarchiver-0.8.6/depcomp0000755000175000017500000005602014016431530012157 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: fsarchiver-0.8.6/install-sh0000755000175000017500000003577614016431530012625 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: fsarchiver-0.8.6/Makefile.am0000644000175000017500000000056314014423774012650 00000000000000SUBDIRS = src doc EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL NEWS README distrib internals autogen.sh static: rm -f src/fsarchiver $(MAKE) LDFLAGS="$(LDFLAGS) -static" distclean-local: rm -rf autom4te.cache rm -f config.h.in~ dist-hook: rm -rf `find $(distdir) -name .svn` MAINTAINERCLEANFILES = Makefile.in configure aclocal.m4 install-sh missing depcomp fsarchiver-0.8.6/README0000644000175000017500000000744413655317102011476 00000000000000===================================================================== fsarchiver: Filesystem Archiver for Linux [http://www.fsarchiver.org] ===================================================================== About FSArchiver ---------------- FSArchiver is a system tool that allows you to save the contents of a filesystem to a compressed archive file. The filesystem contents can be restored on a device which has a different size and it can be restored on a different filesystem. Unlike tar/dar, FSArchiver also creates the filesystem when it extracts the data to devices. Everything is checksummed in the archive in order to protect the data. If the archive is corrupt, you just lose the current file, not the whole archive. FSArchiver is released under the GPLv2 license. You should read the Quick Start guide [http://www.fsarchiver.org/quickstart/] if you are using FSArchiver for the first time. Detailed description -------------------- The purpose of this project is to provide a safe and flexible filesystem backup/deployment tool. Other open-source filesystems tools such as Partimage already exist. These tools are working at the filesystem block level, so it's not possible to restore the backup to a smaller device, and restoring to a bigger one forces you to resize the filesystem by hand. The purpose is to have a very flexible program. FSArchiver can extract an archive to a device which is smaller that the original one as long as there is enough space to store the data. It can also restore the data on a different filesystem, so you can use it when you want to convert your filesystem: you can backup an EXT3 filesystem, and restore it as ReiserFS. FSArchiver works at the file level. It can make an archive of most Linux filesystems (EXT3, ReiserFS, XFS, ...) that the running kernel can mount with read-write support. It will preserve all the standard Unix file attributes (permissions, timestamps, symbolic-links, hard-links, extended-attributes, ...), as long as the kernel has support for them enabled. Limitations ----------- There are limitations anyway: FAT filesystem is supported basically for EFI System Partition volumes (UEFI systems) and won't work for bootable Windows volumes. Also, NTFS support is experimental and shouldn't be used in production. FSArchiver won't preserve features which are very specific to a filesystem. For instance, if you create a snapshot in a Btrfs volume, FSArchiver won't know anything about that, and it will just backup the contents seen when you mount the device. FSArchiver is safe when it makes backups of devices which are not mounted or are mounted read-only. There is an option to force the backup of a read-write mounted volume, but there may be problems with the files that changed during the backup. If you want to backup a device which are in use, the best thing to do is to make an LVM snapshot of it using lvcreate -s, which is part of the LVM userland tools. Unfortunately you can only make snapshots of devices which are LVM Logical Volumes. Protection against data loss ---------------------------- FSArchiver is using two levels of checksums to protect your data against corruption. Each block of each file has a 32-bit checksum written in the archive. That way we can identify which block of your file is damaged. Once a file has been restored, the MD5 checksum of the whole file is compared to the original MD5. It's a 128-bit checksum, so it will detect all file corruptions. In case one file is damaged, FSArchiver will restore all the other files from your archive, so you won't lose all your data. It's very different from tar.gz where the whole tar is compressed with gzip. In that case, the data which are written after the corruption are lost. FSArchiver-0.2.3 and newer versions are able to ignore corrupt contents in an archive file, so all the other files will be restored. fsarchiver-0.8.6/config.sub0000744000175000017500000010315414016431530012564 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2021 Free Software Foundation, Inc. timestamp='2021-01-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv4 ;; i*86v) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv ;; i*86sol2) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') ;; os2-emx) kernel=os2 os=$(echo $basic_os | sed -e 's|os2-emx|emx|') ;; nto-qnx*) kernel=nto os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') ;; *-*) # shellcheck disable=SC2162 IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: fsarchiver-0.8.6/AUTHORS0000644000175000017500000000000012461437135011646 00000000000000fsarchiver-0.8.6/src/0000755000175000017500000000000014016431625011453 500000000000000fsarchiver-0.8.6/src/thread_comp.h0000644000175000017500000000142613655317102014035 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __THREAD_COMP_H__ #define __THREAD_COMP_H__ enum {COMPTHR_COMPRESS=1, COMPTHR_DECOMPRESS=2}; void *thread_comp_fct(void *args); void *thread_decomp_fct(void *args); #endif // __THREAD_COMP_H__ fsarchiver-0.8.6/src/archreader.h0000644000175000017500000000567013655317102013655 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __ARCHREADER_H__ #define __ARCHREADER_H__ #include struct s_blockinfo; struct s_headinfo; struct s_dico; struct s_archreader; typedef struct s_archreader carchreader; struct s_archreader { int archfd; // file descriptor of the current volume (set to -1 when closed) u32 archid; // 32bit archive id for checking (random number generated at creation) u64 fscount; // how many filesystems in archive (valid only if archtype=filesystems) u32 archtype; // what has been saved in the archive: filesystems or directories u32 curvol; // current volume number, starts at 0, incremented when we change the volume u32 compalgo; // compression algorithm which has been used to create the archive u32 cryptalgo; // encryption algorithm which has been used to create the archive u32 complevel; // compression level which is specific to the compression algorithm u32 fsacomp; // fsa compression level given on the command line by the user u64 creattime; // archive create time (number of seconds since epoch) u64 minfsaver; // minimum fsarchiver version required to restore that archive u32 hasdirsinfohead; // true if the archive has a "DiRs" header (introduced in 0.6.7) int filefmtver; // set to 1 for "FsArCh_001" or 2 for "FsArCh_002" char filefmt[FSA_MAX_FILEFMTLEN]; // file format of that archive char creatver[FSA_MAX_PROGVERLEN]; // fsa version used to create archive char label[FSA_MAX_LABELLEN]; // archive label defined by the user char basepath[PATH_MAX]; // path of the first volume of an archive char volpath[PATH_MAX]; // path of the current volume of an archive }; int archreader_init(carchreader *ai); int archreader_destroy(carchreader *ai); int archreader_open(carchreader *ai); int archreader_close(carchreader *ai); int archreader_incvolume(carchreader *ai, bool waitkeypress); int archreader_volpath(carchreader *ai); int archreader_read_data(carchreader *ai, void *data, u64 size); int archreader_read_dico(carchreader *ai, struct s_dico *d); int archreader_read_volheader(carchreader *ai); int archreader_read_header(carchreader *ai, char *magic, struct s_dico **d, bool allowseek, u16 *fsid); int archreader_read_block(carchreader *ai, struct s_dico *in_blkdico, int in_skipblock, int *out_sumok, struct s_blockinfo *out_blkinfo); #endif // __ARCHREADER_H__ fsarchiver-0.8.6/src/fsarchiver.h0000644000175000017500000002177013662252212013706 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FSARCHIVER_H__ #define __FSARCHIVER_H__ #include "types.h" // ----------------------------- min and max ----------------------------- #if !defined(min) # define min(a, b) ((a) < (b) ? (a) : (b)) #endif #if !defined(max) # define max(a, b) ((a) > (b) ? (a) : (b)) #endif // -------------------------------- fsarchiver commands --------------------------------------------- enum {OPER_NULL=0, OPER_SAVEFS, OPER_RESTFS, OPER_SAVEDIR, OPER_RESTDIR, OPER_ARCHINFO, OPER_PROBE}; // ----------------------------------- dico sections ------------------------------------------------ enum {DICO_OBJ_SECTION_STDATTR=0, DICO_OBJ_SECTION_XATTR=1, DICO_OBJ_SECTION_WINATTR=2}; // ----------------------------------- archive types ------------------------------------------------ enum {ARCHTYPE_NULL=0, ARCHTYPE_FILESYSTEMS, ARCHTYPE_DIRECTORIES}; // ----------------------------------- volume header and footer ------------------------------------- enum {VOLUMEHEADKEY_VOLNUM, VOLUMEHEADKEY_ARCHID, VOLUMEHEADKEY_FILEFORMATVER, VOLUMEHEADKEY_PROGVERCREAT}; enum {VOLUMEFOOTKEY_VOLNUM, VOLUMEFOOTKEY_ARCHID, VOLUMEFOOTKEY_LASTVOL}; // ----------------------------------- algorithms used to process data------------------------------- enum {COMPRESS_NULL=0, COMPRESS_NONE, COMPRESS_LZO, COMPRESS_GZIP, COMPRESS_BZIP2, COMPRESS_LZMA, COMPRESS_LZ4, COMPRESS_ZSTD}; enum {ENCRYPT_NULL=0, ENCRYPT_NONE, ENCRYPT_BLOWFISH}; // ----------------------------------- dico keys ---------------------------------------------------- enum {OBJTYPE_NULL=0, OBJTYPE_DIR, OBJTYPE_SYMLINK, OBJTYPE_HARDLINK, OBJTYPE_CHARDEV, OBJTYPE_BLOCKDEV, OBJTYPE_FIFO, OBJTYPE_SOCKET, OBJTYPE_REGFILEUNIQUE, OBJTYPE_REGFILEMULTI}; enum {DISKITEMKEY_NULL=0, DISKITEMKEY_OBJECTID, DISKITEMKEY_PATH, DISKITEMKEY_OBJTYPE, DISKITEMKEY_SYMLINK, DISKITEMKEY_HARDLINK, DISKITEMKEY_RDEV, DISKITEMKEY_MODE, DISKITEMKEY_SIZE, DISKITEMKEY_UID, DISKITEMKEY_GID, DISKITEMKEY_ATIME, DISKITEMKEY_MTIME, DISKITEMKEY_MD5SUM, DISKITEMKEY_MULTIFILESCOUNT, DISKITEMKEY_MULTIFILESOFFSET, DISKITEMKEY_LINKTARGETTYPE, DISKITEMKEY_FLAGS}; enum {BLOCKHEADITEMKEY_NULL=0, BLOCKHEADITEMKEY_REALSIZE, BLOCKHEADITEMKEY_BLOCKOFFSET, BLOCKHEADITEMKEY_COMPRESSALGO, BLOCKHEADITEMKEY_ENCRYPTALGO, BLOCKHEADITEMKEY_ARSIZE, BLOCKHEADITEMKEY_COMPSIZE, BLOCKHEADITEMKEY_ARCSUM}; enum {BLOCKFOOTITEMKEY_NULL=0, BLOCKFOOTITEMKEY_MD5SUM}; enum {MAINHEADKEY_NULL=0, MAINHEADKEY_FILEFORMATVER, MAINHEADKEY_PROGVERCREAT, MAINHEADKEY_ARCHIVEID, MAINHEADKEY_CREATTIME, MAINHEADKEY_ARCHLABEL, MAINHEADKEY_ARCHTYPE, MAINHEADKEY_FSCOUNT, MAINHEADKEY_COMPRESSALGO, MAINHEADKEY_COMPRESSLEVEL, MAINHEADKEY_ENCRYPTALGO, MAINHEADKEY_BUFCHECKPASSCLEARMD5, MAINHEADKEY_BUFCHECKPASSCRYPTBUF, MAINHEADKEY_FSACOMPLEVEL, MAINHEADKEY_MINFSAVERSION, MAINHEADKEY_HASDIRSINFOHEAD}; enum {FSYSHEADKEY_NULL=0, FSYSHEADKEY_FILESYSTEM, FSYSHEADKEY_MNTPATH, FSYSHEADKEY_BYTESTOTAL, FSYSHEADKEY_BYTESUSED, FSYSHEADKEY_FSLABEL, FSYSHEADKEY_FSUUID, FSYSHEADKEY_FSINODESIZE, FSYSHEADKEY_FSVERSION, FSYSHEADKEY_FSEXTDEFMNTOPT, FSYSHEADKEY_FSEXTREVISION, FSYSHEADKEY_FSEXTBLOCKSIZE, FSYSHEADKEY_FSEXTFEATURECOMPAT, FSYSHEADKEY_FSEXTFEATUREINCOMPAT, FSYSHEADKEY_FSEXTFEATUREROCOMPAT, FSYSHEADKEY_FSREISERBLOCKSIZE, FSYSHEADKEY_FSREISER4BLOCKSIZE, FSYSHEADKEY_FSXFSBLOCKSIZE, FSYSHEADKEY_FSBTRFSSECTORSIZE, FSYSHEADKEY_NTFSSECTORSIZE, FSYSHEADKEY_NTFSCLUSTERSIZE, FSYSHEADKEY_BTRFSFEATURECOMPAT, FSYSHEADKEY_BTRFSFEATUREINCOMPAT, FSYSHEADKEY_BTRFSFEATUREROCOMPAT, FSYSHEADKEY_NTFSUUID, FSYSHEADKEY_MINFSAVERSION, FSYSHEADKEY_MOUNTINFO, FSYSHEADKEY_ORIGDEV, FSYSHEADKEY_TOTALCOST, FSYSHEADKEY_FSEXTFSCKMAXMNTCOUNT, FSYSHEADKEY_FSEXTFSCKCHECKINTERVAL, FSYSHEADKEY_FSEXTEOPTRAIDSTRIPEWIDTH, FSYSHEADKEY_FSEXTEOPTRAIDSTRIDE, FSYSHEADKEY_FSINODEBLOCKSPERGROUP, FSYSHEADKEY_FSXFSVERSION, FSYSHEADKEY_FSXFSFEATURECOMPAT, FSYSHEADKEY_FSXFSFEATUREROCOMPAT, FSYSHEADKEY_FSXFSFEATUREINCOMPAT, FSYSHEADKEY_FSXFSFEATURELOGINCOMPAT, FSYSHEADKEY_FSVFATTYPE, FSYSHEADKEY_FSVFATSERIAL}; enum {DIRSINFOKEY_NULL=0, DIRSINFOKEY_TOTALCOST}; // -------------------------------- fsarchiver errors --------------------------------------------- enum {FSAERR_SUCCESS=0, // success FSAERR_UNKNOWN=-1, // uknown error (default code that means error) FSAERR_ENOMEM=-2, // out of memory error FSAERR_EINVAL=-3, // invalid parameter FSAERR_ENOENT=-4, // entry not found FSAERR_ENDOFFILE=-5, // end of file/queue FSAERR_WRONGTYPE=-6, // wrong type of data FSAERR_NOTOPEN=-7, // resource has been closed FSAERR_ENOSPC=-8, // no space left on device FSAERR_SEEK=-9, // lseek64 error FSAERR_READ=-10, // read error FSAERR_WRITE=-11 // write error }; // -------------------------------- old errors codes --------------------------------------------- enum {OLDERR_FATAL=1, OLDERR_MINOR=2}; // ----------------------------- fsarchiver const ------------------------ #define FSA_VERSION PACKAGE_VERSION #define FSA_RELDATE PACKAGE_RELDATE #define FSA_FILEFORMAT PACKAGE_FILEFMT #define FSA_GCRYPT_VERSION "1.2.3" #define FSA_MAX_FILEFMTLEN 32 #define FSA_MAX_PROGVERLEN 32 #define FSA_MAX_FSNAMELEN 128 #define FSA_MAX_DEVLEN 256 #define FSA_MAX_UUIDLEN 128 #define FSA_MAX_BLKDEVICES 256 #define FSA_MAX_FSPERARCH 128 #define FSA_MAX_COMPJOBS 32 #define FSA_MAX_QUEUESIZE 32 #define FSA_MAX_BLKSIZE 921600 #define FSA_DEF_BLKSIZE 524288 #ifdef OPTION_ZSTD_SUPPORT #define FSA_DEF_COMPRESS_ALGO COMPRESS_ZSTD #define FSA_DEF_COMPRESS_LEVEL 8 #else #define FSA_DEF_COMPRESS_ALGO COMPRESS_GZIP #define FSA_DEF_COMPRESS_LEVEL 6 #endif #define FSA_DEF_FSACOMP_LEVEL 3 // legacy -z mapping for gzip level 6 #define FSA_MAX_SMALLFILECOUNT 512 // there can be up to FSA_MAX_SMALLFILECOUNT files copied in a single data block #define FSA_MAX_SMALLFILESIZE 131072 // files smaller than that will be grouped with other small files in a single data block #define FSA_COST_PER_FILE 16384 // how much it cost to copy an empty file/dir/link: used to eval the progress bar #define FSA_MAX_LABELLEN 512 #define FSA_MIN_PASSLEN 6 #define FSA_MAX_PASSLEN 64 #define FSA_FILESYSID_NULL 0xFFFF #define FSA_CHECKPASSBUF_SIZE 4096 #define FSA_FILEFLAGS_SPARSE 1<<0 // set when a regfile is a sparse file // ----------------------------- fsarchiver magics -------------------------------------------------- #define FSA_SIZEOF_MAGIC 4 #define FSA_MAGIC_VOLH "FsA0" // volume header (one per volume at the very beginning) #define FSA_MAGIC_VOLF "FsAE" // volume footer (one per volume at the very end) #define FSA_MAGIC_MAIN "ArCh" // archive header (one per archive at the beginning of the first volume) #define FSA_MAGIC_FSIN "FsIn" // filesys info (one per filesystem at the beginning of the archive) #define FSA_MAGIC_FSYB "FsYs" // filesys begin (one per filesystem when the filesys contents start) #define FSA_MAGIC_DIRS "DiRs" // dirs info (one per archive after mainhead before flat dirs/files) #define FSA_MAGIC_OBJT "ObJt" // object header (one per object: regfiles, dirs, symlinks, ...) #define FSA_MAGIC_BLKH "BlKh" // datablk header (one per data block, each regfile may have [0-n]) #define FSA_MAGIC_FILF "FiLf" // filedat footer (one per regfile, after the list of data blocks) #define FSA_MAGIC_DATF "DaEn" // data footer (one per file system, at the end of its contents, or after the contents of the flatfiles) // ------------ global variables --------------------------- extern char *valid_magic[]; // -------------------------------- version_number to u64 ------------------------------------------- #define FSA_VERSION_BUILD(a, b, c, d) ((u64)((((u64)a&0xFFFF)<<48)+(((u64)b&0xFFFF)<<32)+(((u64)c&0xFFFF)<<16)+(((u64)d&0xFFFF)<<0))) #define FSA_VERSION_GET_A(ver) ((((u64)ver)>>48)&0xFFFF) #define FSA_VERSION_GET_B(ver) ((((u64)ver)>>32)&0xFFFF) #define FSA_VERSION_GET_C(ver) ((((u64)ver)>>16)&0xFFFF) #define FSA_VERSION_GET_D(ver) ((((u64)ver)>>0)&0xFFFF) #endif // __FSARCHIVER_H__ fsarchiver-0.8.6/src/strlist.h0000644000175000017500000000255413655317102013257 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __STRLIST_H__ #define __STRLIST_H__ struct s_strlist; typedef struct s_strlist cstrlist; struct s_strlistitem; typedef struct s_strlistitem cstrlistitem; struct s_strlistitem { char *str; cstrlistitem *next; }; struct s_strlist { cstrlistitem *head; }; int strlist_destroy(cstrlist *l); int strlist_init(cstrlist *l); int strlist_empty(cstrlist *l); int strlist_add(cstrlist *l, char *str); int strlist_remove(cstrlist *l, char *str); int strlist_exists(cstrlist *l, char *str); int strlist_getitem(cstrlist *l, int index, char *buf, int bufsize); char *strlist_merge(cstrlist *l, char *bufdat, int bufsize, char sep); int strlist_split(cstrlist *l, char *text, char sep); int strlist_count(cstrlist *l); int strlist_show(cstrlist *l); #endif // __STRLIST_H__ fsarchiver-0.8.6/src/crypto.c0000644000175000017500000000556313655317102013071 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "fsarchiver.h" #include "common.h" #include "crypto.h" #include "error.h" #include // required for safety with multi-threading in gcrypt GCRY_THREAD_OPTION_PTHREAD_IMPL; int crypto_init() { // init gcrypt for multi-threading gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); // check that header files and library match if (!gcry_check_version(FSA_GCRYPT_VERSION)) { errprintf("libgcrypt version mismatch\n"); return -1; } // disable secure memory gcry_control(GCRYCTL_DISABLE_SECMEM, 0); // tell libgcrypt that initialization has completed. gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); return 0; } int crypto_cleanup() { return 0; } int crypto_blowfish(u64 insize, u64 *outsize, u8 *inbuf, u8 *outbuf, u8 *password, int passlen, int enc) { gcry_cipher_hd_t hd; u8 iv[] = "fsarchiv"; int res; // init if ((password==NULL) || (passlen==0)) return -1; if ((res=gcry_cipher_open(&hd, GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CFB, GCRY_CIPHER_SECURE))!=0) { errprintf("gcry_cipher_open() failed\n"); gcry_cipher_close(hd); return -1; } if ((res=gcry_cipher_setkey(hd, password, passlen))!=0) { errprintf("gcry_cipher_setkey() failed\n"); gcry_cipher_close(hd); return -1; } if (gcry_cipher_setiv(hd, iv, strlen((char*)iv))) { errprintf("gcry_cipher_setiv() failed\n"); gcry_cipher_close(hd); return -1; } switch(enc) { case 1: // encrypt res=gcry_cipher_encrypt(hd, outbuf, insize, inbuf, insize); break; case 0: // decrypt res=gcry_cipher_decrypt(hd, outbuf, insize, inbuf, insize); break; default: // invalid errprintf("invalid parameter: enc=%d\n", (int)enc); gcry_cipher_close(hd); return -1; } gcry_cipher_close(hd); *outsize=insize; return (res==0)?(0):(-1); } int crypto_random(u8 *buf, int bufsize) { memset(buf, 0, bufsize); gcry_randomize(buf, bufsize, GCRY_STRONG_RANDOM); return 0; } fsarchiver-0.8.6/src/comp_bzip2.c0000644000175000017500000000372613655317102013614 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include "fsarchiver.h" #include "common.h" #include "comp_bzip2.h" #include "error.h" int compress_block_bzip2(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level) { unsigned int destsize=compbufsize; switch (BZ2_bzBuffToBuffCompress((char*)compbuf, &destsize, (char*)origbuf, origsize, 9, 0, 30)) { case BZ_OK: *compsize=(u64)destsize; return FSAERR_SUCCESS; case BZ_MEM_ERROR: errprintf("BZ2_bzBuffToBuffCompress(): BZIP2 compression failed " "with an out of memory error.\nYou should use a lower " "compression level to reduce the memory requirement.\n"); return FSAERR_ENOMEM; default: return FSAERR_UNKNOWN; } return FSAERR_UNKNOWN; } int uncompress_block_bzip2(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf) { unsigned int destsize=origbufsize; int res; switch ((res=BZ2_bzBuffToBuffDecompress((char*)origbuf, &destsize, (char*)compbuf, compsize, 0, 0))) { case BZ_OK: *origsize=(u64)destsize; return FSAERR_SUCCESS; default: errprintf("BZ2_bzBuffToBuffDecompress() failed, res=%d\n", res); return FSAERR_UNKNOWN; } return FSAERR_UNKNOWN; } fsarchiver-0.8.6/src/error.c0000644000175000017500000000507413655317102012677 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "fsarchiver.h" #include "error.h" #include "common.h" #include "options.h" #include "logfile.h" int fsaprintf(int level, bool showerrno, bool showloc, const char *file, const char *fct, int line, char *format, ...) { char buffer[8192]; char temp[1024]; bool msgscreen; bool msglogfile; va_list ap; // init memset(buffer, 0, sizeof(buffer)); msgscreen=(level <= g_options.verboselevel); msglogfile=(level <= g_options.debuglevel); if (msgscreen || msglogfile) { // 1. format errno and its meaning if (showerrno) strlcatf(buffer, sizeof(buffer), "[errno=%d, %s]: ", errno, strerror(errno)); // 2. format location of the message if (showloc) strlcatf(buffer, sizeof(buffer), "%s#%d,%s(): ", file, line, fct); // 3. format text message va_start(ap, format); vsnprintf(temp, sizeof(temp), format, ap); va_end(ap); strlcatf(buffer, sizeof(buffer), "%s", temp); // 4. show message on screen if (msgscreen) { fprintf(stderr, "%s", buffer); fflush(stderr); } // 5. write message in logfile if requested if (msglogfile) logfile_write(buffer, strlen(buffer)); } return 0; } char *error_int_to_string(s64 err) { switch (err) { case FSAERR_SUCCESS: return "FSAERR_SUCCESS"; case FSAERR_UNKNOWN: return "FSAERR_UNKNOWN"; case FSAERR_ENOMEM: return "FSAERR_ENOMEM"; case FSAERR_EINVAL: return "FSAERR_EINVAL"; case FSAERR_ENOENT: return "FSAERR_ENOENT"; case FSAERR_ENDOFFILE: return "FSAERR_ENDOFFILE"; case FSAERR_WRONGTYPE: return "FSAERR_WRONGTYPE"; case FSAERR_NOTOPEN: return "FSAERR_NOTOPEN"; default: return "FSAERR_?"; } } fsarchiver-0.8.6/src/syncthread.h0000644000175000017500000000263513655317102013717 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __SYNCTHREAD_H__ #define __SYNCTHREAD_H__ // global threads sync data extern struct s_queue g_queue; // queue use to share data between the three sort of threads // global threads sync functions int get_abort(); // returns true if threads must exit because an error or signal received bool get_interrupted(); // returns true if either abort is true of stopfillqueue is true // say to the thread that is filling the queue to stop void set_stopfillqueue(); bool get_stopfillqueue(); // secondary threads counter void inc_secthreads(); void dec_secthreads(); int get_secthreads(); // filesystem bitmap used by do_extract() to say to threadio_readimg which filesystems to skip // eg: "g_fsbitmap[0]=1,g_fsbitmap[1]=0" means that we want to read filesystem 0 and skip fs 1 extern u8 g_fsbitmap[FSA_MAX_FSPERARCH]; #endif // __SYNCTHREAD_H__ fsarchiver-0.8.6/src/datafile.h0000644000175000017500000000177513655317102013330 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __DATAFILE_H__ #define __DATAFILE_H__ #include "types.h" struct s_datafile; typedef struct s_datafile cdatafile; cdatafile *datafile_alloc(); int datafile_destroy(cdatafile *f); int datafile_open_write(cdatafile *f, char *path, bool simul, bool sparse); int datafile_write(cdatafile *f, char *data, u64 len); int datafile_close(cdatafile *f, u8 *md5bufdat, int md5bufsize); #endif // __DATAFILE_H__ fsarchiver-0.8.6/src/devinfo.h0000644000175000017500000000214013655317102013174 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __DEVINFO_H__ #define __DEVINFO_H__ enum {BLKDEV_INVALID=-1, BLKDEV_PHYSDISK=0, BLKDEV_FILESYSDEV=1}; struct s_devinfo { int devtype; char devname[FSA_MAX_DEVLEN]; char longname[FSA_MAX_DEVLEN]; char label[FSA_MAX_LABELLEN]; char uuid[FSA_MAX_UUIDLEN]; char fsname[FSA_MAX_FSNAMELEN]; char name[512]; char txtsize[64]; u64 devsize; int minor; int major; u64 rdev; }; int get_devinfo(struct s_devinfo *outdev, char *indevname, int min, int maj); #endif // __DEVINFO_H__ fsarchiver-0.8.6/src/Makefile.am0000644000175000017500000000332713655317102013435 00000000000000sbin_PROGRAMS = fsarchiver fsarchiver_SOURCES = fsarchiver.c oper_save.c oper_restore.c oper_probe.c \ thread_archio.c archreader.c archwriter.c writebuf.c archinfo.c \ thread_comp.c comp_gzip.c comp_bzip2.c comp_lzma.c comp_lzo.c comp_lz4.c \ comp_zstd.c crypto.c fs_ntfs.c fs_ext2.c fs_reiserfs.c fs_reiser4.c \ fs_btrfs.c fs_xfs.c fs_jfs.c fs_vfat.c common.c dico.c strdico.c dichl.c \ queue.c error.c syncthread.c datafile.c strlist.c regmulti.c options.c \ logfile.c filesys.c devinfo.c noinst_HEADERS = fsarchiver.h oper_save.h oper_restore.h oper_probe.h \ thread_archio.h archreader.h archwriter.h writebuf.h archinfo.h \ thread_comp.h comp_gzip.h comp_bzip2.h comp_lzma.h comp_lzo.h comp_lz4.h \ comp_zstd.h crypto.h fs_ntfs.h fs_ext2.h fs_reiserfs.h fs_reiser4.h \ fs_btrfs.h fs_xfs.h fs_jfs.h fs_vfat.h common.h dico.h strdico.h dichl.h \ queue.h error.h syncthread.h datafile.h strlist.h regmulti.h options.h \ logfile.h types.h filesys.h devinfo.h fsarchiver_LDADD = -lpthread -lrt \ $(LZMA_LIBS) \ $(EXT2FS_LIBS) \ $(COM_ERR_LIBS) \ $(E2P_LIBS) \ $(BLKID_LIBS) \ $(UUID_LIBS) fsarchiver_CFLAGS = @CFLAGS@ -Wall -std=gnu99 -rdynamic -ggdb \ $(LZMA_CFLAGS) \ $(EXT2FS_CFLAGS) \ $(COM_ERR_CFLAGS) \ $(E2P_CFLAGS) \ $(BLKID_CFLAGS) \ $(UUID_CFLAGS) fsarchiver_LDFLAGS = @FSARCHIVER_LDFLAGS@ DEFS=@DEFS@ -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE MAINTAINERCLEANFILES = Makefile.in fsarchiver-0.8.6/src/options.h0000644000175000017500000000260613655317102013244 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __OPTIONS_H__ #define __OPTIONS_H__ #include "strlist.h" struct s_options; typedef struct s_options coptions; // struct that stores the options passed on the command line struct s_options { bool overwrite; bool allowsaverw; bool experimental; bool dontcheckmountopts; int verboselevel; int debuglevel; int compresslevel; int compressjobs; u16 compressalgo; u32 datablocksize; u32 smallfilethresh; u64 splitsize; u16 encryptalgo; u16 fsacomplevel; char archlabel[FSA_MAX_LABELLEN]; u8 encryptpass[FSA_MAX_PASSLEN+1]; cstrlist exclude; }; extern coptions g_options; int options_init(); int options_destroy(); int options_select_compress_level(int opt); #endif // __OPTIONS_H__ fsarchiver-0.8.6/src/oper_probe.h0000644000175000017500000000126713655317102013707 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __OPER_PROBE_H__ #define __OPER_PROBE_H__ int oper_probe(bool details); #endif // __OPER_PROBE_H__ fsarchiver-0.8.6/src/dico.h0000644000175000017500000000434213655317102012466 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __DICO_H__ #define __DICO_H__ #include "types.h" enum {DICO_ESUCCESS=0, DICO_ENOENT, DICO_EINVAL, DICO_EBADSIZE, DICO_EFULL, DICO_EMEM, DICO_EDUPLICATE, DICO_EINVALCHAR}; enum {DICTYPE_NULL=0, DICTYPE_U8, DICTYPE_U16, DICTYPE_U32, DICTYPE_U64, DICTYPE_DATA, DICTYPE_STRING}; struct s_dico; struct s_dicoitem; typedef struct s_dico cdico; typedef struct s_dicoitem cdicoitem; struct s_dico { struct s_dicoitem *head; }; struct s_dicoitem { u8 type; u8 section; u16 key; u16 size; char *data; cdicoitem *next; }; cdico *dico_alloc(); int dico_destroy(cdico *d); int dico_show(cdico *d, u8 section, char *debugtxt); int dico_count_all_sections(cdico *d); int dico_count_one_section(cdico *d, u8 section); int dico_add_data(cdico *d, u8 section, u16 key, const void *data, u16 size); int dico_add_generic(cdico *d, u8 section, u16 key, const void *data, u16 size, u8 type); int dico_get_generic(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size); int dico_get_data(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size); int dico_add_u16(cdico *d, u8 section, u16 key, u16 data); int dico_add_u32(cdico *d, u8 section, u16 key, u32 data); int dico_add_u64(cdico *d, u8 section, u16 key, u64 data); int dico_get_u16(cdico *d, u8 section, u16 key, u16 *data); int dico_get_u32(cdico *d, u8 section, u16 key, u32 *data); int dico_get_u64(cdico *d, u8 section, u16 key, u64 *data); int dico_add_string(cdico *d, u8 section, u16 key, const char *szstring); int dico_get_string(cdico *d, u8 section, u16 key, char *buffer, u16 bufsize); #endif // __DICO_H__ fsarchiver-0.8.6/src/fs_reiserfs.c0000644000175000017500000001367513721251126014063 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include "fsarchiver.h" #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "fs_reiserfs.h" #include "filesys.h" #include "strlist.h" #include "error.h" int reiserfs_mkfs(cdico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid) { char command[2048]; char buffer[2048]; char options[2048]; int exitst; u64 temp64; // ---- check mkreiserfs is available if (exec_command(command, sizeof(command), NULL, NULL, 0, NULL, 0, "mkreiserfs -V")!=0) { errprintf("mkreiserfs not found. please install reiserfsprogs-3.6 on your system or check the PATH.\n"); return -1; } // ---- set the advanced filesystem settings from the dico memset(options, 0, sizeof(options)); if (strlen(mkfslabel) > 0) strlcatf(options, sizeof(options), " -l '%.16s' ", mkfslabel); else if (dico_get_string(d, 0, FSYSHEADKEY_FSLABEL, buffer, sizeof(buffer))==0 && strlen(buffer)>0) strlcatf(options, sizeof(options), " -l '%.16s' ", buffer); if (dico_get_u64(d, 0, FSYSHEADKEY_FSREISERBLOCKSIZE, &temp64)==0) strlcatf(options, sizeof(options), " -b %ld ", (long)temp64); if (strlen(mkfsuuid) > 0) strlcatf(options, sizeof(options), " -u %s ", mkfsuuid); else if (dico_get_string(d, 0, FSYSHEADKEY_FSUUID, buffer, sizeof(buffer))==0 && strlen(buffer)==36) strlcatf(options, sizeof(options), " -u %s ", buffer); // ---- mkfsopt from command line strlcatf(options, sizeof(options), " %s ", fsoptions); if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "mkreiserfs -f %s %s", options, partition)!=0 || exitst!=0) { errprintf("command [%s] failed\n", command); return -1; } return 0; } int reiserfs_getinfo(cdico *d, char *devname) { struct reiserfs_super_block sb; char uuid[512]; u16 temp16; int ret=0; int fd=-1; int res; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { ret=-1; errprintf("cannot open(%s, O_RDONLY)\n", devname); goto reiserfs_read_sb_return; } if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET)!=REISERFS_DISK_OFFSET_IN_BYTES) { ret=-2; errprintf("cannot lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET) on %s\n", devname); goto reiserfs_read_sb_close; } res=read(fd, &sb, sizeof(sb)); if (res!=sizeof(sb)) { ret=-3; errprintf("cannot read the reiserfs superblock on device [%s]\n", devname); goto reiserfs_read_sb_close; } if (strncmp(sb.s_v1.s_magic, REISERFS_SUPER_MAGIC_STRING, strlen(REISERFS_SUPER_MAGIC_STRING)) == 0) dico_add_string(d, 0, FSYSHEADKEY_FSVERSION, "reiserfs-3.5"); else if (strncmp(sb.s_v1.s_magic, REISER2FS_SUPER_MAGIC_STRING, strlen(REISER2FS_SUPER_MAGIC_STRING)) == 0) dico_add_string(d, 0, FSYSHEADKEY_FSVERSION, "reiserfs-3.6"); else { ret=-4; errprintf("magic different from expectations superblock on %s: magic=[%s]\n", devname, sb.s_v1.s_magic); goto reiserfs_read_sb_close; } msgprintf(MSG_DEBUG1, "reiserfs_magic=[%s]\n", sb.s_v1.s_magic); // ---- label msgprintf(MSG_DEBUG1, "reiserfs_label=[%s]\n", sb.s_label); dico_add_string(d, 0, FSYSHEADKEY_FSLABEL, (char*)sb.s_label); // ---- uuid /*if ((str=e2p_uuid2str(sb.s_uuid))!=NULL) dico_add_string(d, 0, FSYSHEADKEY_FSUUID, str);*/ memset(uuid, 0, sizeof(uuid)); uuid_unparse_lower((u8*)sb.s_uuid, uuid); dico_add_string(d, 0, FSYSHEADKEY_FSUUID, uuid); msgprintf(MSG_DEBUG1, "reiserfs_uuid=[%s]\n", uuid); // ---- block size temp16=le16_to_cpu(sb.s_v1.s_blocksize); dico_add_u64(d, 0, FSYSHEADKEY_FSREISERBLOCKSIZE, temp16); msgprintf(MSG_DEBUG1, "reiserfs_blksize=[%ld]\n", (long)temp16); // ---- minimum fsarchiver version required to restore dico_add_u64(d, 0, FSYSHEADKEY_MINFSAVERSION, FSA_VERSION_BUILD(0, 6, 4, 0)); reiserfs_read_sb_close: close(fd); reiserfs_read_sb_return: return ret; } int reiserfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo) { return generic_mount(partition, mntbuf, fsbuf, "user_xattr,acl", flags); } int reiserfs_umount(char *partition, char *mntbuf) { return generic_umount(mntbuf); } int reiserfs_test(char *devname) { struct reiserfs_super_block sb; int fd=-1; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) return false; if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET)!=REISERFS_DISK_OFFSET_IN_BYTES) { close(fd); return false; } if (read(fd, &sb, sizeof(sb))!=sizeof(sb)) { close(fd); return false; } if ((strncmp(sb.s_v1.s_magic, REISERFS_SUPER_MAGIC_STRING, strlen(REISERFS_SUPER_MAGIC_STRING)) != 0) && (strncmp(sb.s_v1.s_magic, REISER2FS_SUPER_MAGIC_STRING, strlen(REISER2FS_SUPER_MAGIC_STRING)) != 0)) { close(fd); return false; } close(fd); return true; } int reiserfs_get_reqmntopt(char *partition, cstrlist *reqopt, cstrlist *badopt) { if (!reqopt || !badopt) return -1; strlist_add(badopt, "nouser_xattr"); strlist_add(badopt, "noacl"); return 0; } fsarchiver-0.8.6/src/options.c0000644000175000017500000000664213662252212013241 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include "fsarchiver.h" #include "options.h" #include "error.h" coptions g_options; int options_init() { memset(&g_options, 0, sizeof(coptions)); if (strlist_init(&g_options.exclude)!=0) return -1; return 0; } int options_destroy() { if (strlist_destroy(&g_options.exclude)!=0) return -1; memset(&g_options, 0, sizeof(coptions)); return 0; } int options_select_compress_level(int opt) { switch (opt) { #ifdef OPTION_LZ4_SUPPORT case 0: // lz4 g_options.compressalgo=COMPRESS_LZ4; break; #else case 0: // lz4 errprintf("compression level %d is not available: lz4 has been disabled at compilation time\n", opt); return -1; #endif // OPTION_LZ4_SUPPORT #ifdef OPTION_LZO_SUPPORT case 1: // lzo g_options.compressalgo=COMPRESS_LZO; g_options.compresslevel=3; break; #else case 1: // lzo errprintf("compression level %d is not available: lzo has been disabled at compilation time\n", opt); return -1; #endif // OPTION_LZO_SUPPORT case 2: // gzip fast g_options.compressalgo=COMPRESS_GZIP; g_options.compresslevel=3; break; case 3: // gzip standard g_options.compressalgo=COMPRESS_GZIP; g_options.compresslevel=6; break; case 4: // gzip best g_options.compressalgo=COMPRESS_GZIP; g_options.compresslevel=9; break; case 5: // bzip2 fast g_options.compressalgo=COMPRESS_BZIP2; g_options.datablocksize=262144; g_options.compresslevel=2; break; case 6: // bzip2 good g_options.compressalgo=COMPRESS_BZIP2; g_options.datablocksize=524288; g_options.compresslevel=5; break; #ifdef OPTION_LZMA_SUPPORT case 7: // lzma fast g_options.compressalgo=COMPRESS_LZMA; g_options.datablocksize=262144; g_options.compresslevel=1; break; case 8: // lzma medium g_options.compressalgo=COMPRESS_LZMA; g_options.datablocksize=524288; g_options.compresslevel=6; break; case 9: // lzma best g_options.compressalgo=COMPRESS_LZMA; g_options.datablocksize=FSA_MAX_BLKSIZE; g_options.compresslevel=9; break; #else case 7: // lzma case 8: // lzma case 9: // lzma errprintf("compression level %d is not available: lzma has been disabled at compilation time\n", opt); return -1; #endif default: errprintf("invalid compression level: %d\n", opt); return -1; } return 0; } fsarchiver-0.8.6/src/archwriter.c0000644000175000017500000002664713655317102013731 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "options.h" #include "archwriter.h" #include "queue.h" #include "writebuf.h" #include "comp_gzip.h" #include "comp_bzip2.h" #include "error.h" #define FSA_SMB_SUPER_MAGIC 0x517B #define FSA_CIFS_MAGIC_NUMBER 0xFF534D42 int archwriter_init(carchwriter *ai) { assert(ai); memset(ai, 0, sizeof(struct s_archwriter)); strlist_init(&ai->vollist); ai->newarch=false; ai->archfd=-1; ai->archid=0; ai->curvol=0; return 0; } int archwriter_destroy(carchwriter *ai) { assert(ai); strlist_destroy(&ai->vollist); return 0; } int archwriter_generate_id(carchwriter *ai) { assert(ai); ai->archid=generate_random_u32_id(); return 0; } int archwriter_create(carchwriter *ai) { //char testpath[PATH_MAX]; //struct statfs svfs; //int tempfd; struct stat64 st; long archflags=0; long archperm; int res; assert(ai); // init memset(&st, 0, sizeof(st)); archflags=O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE; archperm=S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH; // if the archive already exists and is a not regular file res=stat64(ai->volpath, &st); if (res==0 && !S_ISREG(st.st_mode)) { errprintf("%s already exists, and is not a regular file.\n", ai->basepath); return -1; } else if ((g_options.overwrite==0) && (res==0) && S_ISREG(st.st_mode)) // archive exists and is a regular file { errprintf("%s already exists, please remove it first.\n", ai->basepath); return -1; } // check if it's a network filesystem /*snprintf(testpath, sizeof(testpath), "%s.test", ai->volpath); if (((tempfd=open64(testpath, basicflags, archperm))<0) || (fstatfs(tempfd, &svfs)!=0) || (close(tempfd)!=0) || (unlink(testpath)!=0)) { errprintf("Cannot check the filesystem type on file %s\n", testpath); return -1; } if (svfs.f_type==FSA_CIFS_MAGIC_NUMBER || svfs.f_type==FSA_SMB_SUPER_MAGIC) { sysprintf ("writing an archive on a smbfs/cifs filesystem is " "not allowed, since it can produce corrupt archives.\n"); return -1; }*/ ai->archfd=open64(ai->volpath, archflags, archperm); if (ai->archfd < 0) { sysprintf ("cannot create archive %s\n", ai->volpath); return -1; } ai->newarch=true; strlist_add(&ai->vollist, ai->volpath); /* lockf is causing corruption when the archive is written on a smbfs/cifs filesystem */ /*if (lockf(ai->archfd, F_LOCK, 0)!=0) { sysprintf("Cannot lock archive file: %s\n", ai->volpath); close(ai->archfd); return -1; }*/ return 0; } int archwriter_close(carchwriter *ai) { assert(ai); if (ai->archfd<0) return -1; //res=lockf(ai->archfd, F_ULOCK, 0); fsync(ai->archfd); // just in case the user reboots after it exits close(ai->archfd); ai->archfd=-1; return 0; } int archwriter_remove(carchwriter *ai) { char volpath[PATH_MAX]; int count; int i; assert(ai); if (ai->archfd >= 0) { archwriter_close(ai); } if (ai->newarch==true) { count=strlist_count(&ai->vollist); for (i=0; i < count; i++) { if (strlist_getitem(&ai->vollist, i, volpath, sizeof(volpath))==0) { if (unlink(volpath)==0) msgprintf(MSG_FORCE, "removed %s\n", volpath); else errprintf("cannot remove %s\n", volpath); } } } return 0; } s64 archwriter_get_currentpos(carchwriter *ai) { assert(ai); return (s64)lseek64(ai->archfd, 0, SEEK_CUR); } int archwriter_write_buffer(carchwriter *ai, struct s_writebuf *wb) { struct statvfs64 statvfsbuf; char textbuf[128]; long lres; assert(ai); assert(wb); if (wb->size == 0) { errprintf("wb->size=%ld\n", (long)wb->size); return -1; } if ((lres=write(ai->archfd, (char*)wb->data, (long)wb->size))!=(long)wb->size) { errprintf("write(size=%ld) returned %ld\n", (long)wb->size, (long)lres); if ((lres>0) && (lres < (long)wb->size)) // probably "no space left" { if (fstatvfs64(ai->archfd, &statvfsbuf)!=0) { sysprintf("fstatvfs(fd=%d) failed\n", ai->archfd); return -1; } u64 freebytes = statvfsbuf.f_bfree * statvfsbuf.f_bsize; errprintf("Can't write to the archive file. Space on device is %s. \n" "If the archive is being written to a FAT filesystem, you may have reached \n" "the maximum filesize that it can handle (in general 2 GB)\n", format_size(freebytes, textbuf, sizeof(textbuf), 'h')); return -1; } else // another error { sysprintf("write(size=%ld) failed\n", (long)wb->size); return -1; } } return 0; } int archwriter_volpath(carchwriter *ai) { int res; res=get_path_to_volume(ai->volpath, PATH_MAX, ai->basepath, ai->curvol); return res; } int archwriter_is_path_to_curvol(carchwriter *ai, char *path) { assert(ai); assert(path); return strncmp(ai->volpath, path, PATH_MAX)==0 ? true : false; } int archwriter_incvolume(carchwriter *ai, bool waitkeypress) { assert(ai); ai->curvol++; return archwriter_volpath(ai); } int archwriter_write_volheader(carchwriter *ai) { struct s_writebuf *wb=NULL; cdico *voldico; assert(ai); if ((wb=writebuf_alloc())==NULL) { msgprintf(MSG_STACK, "writebuf_alloc() failed\n"); return -1; } if ((voldico=dico_alloc())==NULL) { msgprintf(MSG_STACK, "voldico=dico_alloc() failed\n"); return -1; } // prepare header dico_add_u32(voldico, 0, VOLUMEHEADKEY_VOLNUM, ai->curvol); dico_add_u32(voldico, 0, VOLUMEHEADKEY_ARCHID, ai->archid); dico_add_string(voldico, 0, VOLUMEHEADKEY_FILEFORMATVER, FSA_FILEFORMAT); dico_add_string(voldico, 0, VOLUMEHEADKEY_PROGVERCREAT, FSA_VERSION); // write header to buffer if (writebuf_add_header(wb, voldico, FSA_MAGIC_VOLH, ai->archid, FSA_FILESYSID_NULL)!=0) { errprintf("archio_write_header() failed\n"); return -1; } // write header to file if (archwriter_write_buffer(ai, wb)!=0) { errprintf("archwriter_write_buffer() failed\n"); return -1; } dico_destroy(voldico); writebuf_destroy(wb); return 0; } int archwriter_write_volfooter(carchwriter *ai, bool lastvol) { struct s_writebuf *wb=NULL; cdico *voldico; assert(ai); if ((wb=writebuf_alloc())==NULL) { errprintf("writebuf_alloc() failed\n"); return -1; } if ((voldico=dico_alloc())==NULL) { errprintf("voldico=dico_alloc() failed\n"); return -1; } // prepare header dico_add_u32(voldico, 0, VOLUMEFOOTKEY_VOLNUM, ai->curvol); dico_add_u32(voldico, 0, VOLUMEFOOTKEY_ARCHID, ai->archid); dico_add_u32(voldico, 0, VOLUMEFOOTKEY_LASTVOL, lastvol); // write header to buffer if (writebuf_add_header(wb, voldico, FSA_MAGIC_VOLF, ai->archid, FSA_FILESYSID_NULL)!=0) { msgprintf(MSG_STACK, "archio_write_header() failed\n"); return -1; } // write header to file if (archwriter_write_buffer(ai, wb)!=0) { msgprintf(MSG_STACK, "archwriter_write_data(size=%ld) failed\n", (long)wb->size); return -1; } dico_destroy(voldico); writebuf_destroy(wb); return 0; } int archwriter_split_check(carchwriter *ai, struct s_writebuf *wb) { s64 cursize; assert(ai); if (((cursize=archwriter_get_currentpos(ai))>=0) && (g_options.splitsize>0 && cursize+wb->size > g_options.splitsize)) { msgprintf(MSG_DEBUG4, "splitchk: YES --> cursize=%lld, g_options.splitsize=%lld, cursize+wb->size=%lld, wb->size=%lld\n", (long long)cursize, (long long)g_options.splitsize, (long long)cursize+wb->size, (long long)wb->size); return true; } else { msgprintf(MSG_DEBUG4, "splitchk: NO --> cursize=%lld, g_options.splitsize=%lld, cursize+wb->size=%lld, wb->size=%lld\n", (long long)cursize, (long long)g_options.splitsize, (long long)cursize+wb->size, (long long)wb->size); return false; } } int archwriter_split_if_necessary(carchwriter *ai, struct s_writebuf *wb) { assert(ai); if (archwriter_split_check(ai, wb)==true) { if (archwriter_write_volfooter(ai, false)!=0) { msgprintf(MSG_STACK, "cannot write volume footer: archio_write_volfooter() failed\n"); return -1; } archwriter_close(ai); archwriter_incvolume(ai, false); msgprintf(MSG_VERB2, "Creating new volume: [%s]\n", ai->volpath); if (archwriter_create(ai)!=0) { msgprintf(MSG_STACK, "archwriter_create() failed\n"); return -1; } if (archwriter_write_volheader(ai)!=0) { msgprintf(MSG_STACK, "cannot write volume header: archio_write_volheader() failed\n"); return -1; } } return 0; } int archwriter_dowrite_block(carchwriter *ai, struct s_blockinfo *blkinfo) { struct s_writebuf *wb=NULL; assert(ai); if ((wb=writebuf_alloc())==NULL) { errprintf("writebuf_alloc() failed\n"); return -1; } if (writebuf_add_block(wb, blkinfo, ai->archid, blkinfo->blkfsid)!=0) { msgprintf(MSG_STACK, "archio_write_block() failed\n"); return -1; } if (archwriter_split_if_necessary(ai, wb)!=0) { msgprintf(MSG_STACK, "archwriter_split_if_necessary() failed\n"); return -1; } if (archwriter_write_buffer(ai, wb)!=0) { msgprintf(MSG_STACK, "archwriter_write_buffer() failed\n"); return -1; } writebuf_destroy(wb); return 0; } int archwriter_dowrite_header(carchwriter *ai, struct s_headinfo *headinfo) { struct s_writebuf *wb=NULL; assert(ai); if ((wb=writebuf_alloc())==NULL) { errprintf("writebuf_alloc() failed\n"); return -1; } if (writebuf_add_header(wb, headinfo->dico, headinfo->magic, ai->archid, headinfo->fsid)!=0) { msgprintf(MSG_STACK, "archio_write_block() failed\n"); return -1; } if (archwriter_split_if_necessary(ai, wb)!=0) { msgprintf(MSG_STACK, "archwriter_split_if_necessary() failed\n"); return -1; } if (archwriter_write_buffer(ai, wb)!=0) { msgprintf(MSG_STACK, "archwriter_write_buffer() failed\n"); return -1; } writebuf_destroy(wb); return 0; } fsarchiver-0.8.6/src/oper_restore.c0000644000175000017500000017254513655317102014266 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include "fsarchiver.h" #include "strdico.h" #include "dico.h" #include "common.h" #include "options.h" #include "oper_restore.h" #include "archreader.h" #include "archinfo.h" #include "filesys.h" #include "fs_ext2.h" #include "fs_reiserfs.h" #include "fs_reiser4.h" #include "fs_btrfs.h" #include "fs_xfs.h" #include "fs_jfs.h" #include "fs_ntfs.h" #include "thread_comp.h" #include "thread_archio.h" #include "syncthread.h" #include "regmulti.h" #include "crypto.h" #include "error.h" #include "datafile.h" #include "queue.h" typedef struct s_extractar { carchreader ai; int fsid; cstats stats; u64 cost_global; u64 cost_current; } cextractar; // returns true if this file of a parent directory has been excluded int is_filedir_excluded(char *relpath) { char dirpath[PATH_MAX]; char basename[PATH_MAX]; int pos; // check if that particular file has been excluded extract_basename(relpath, basename, sizeof(basename)); if ((exclude_check(&g_options.exclude, basename)==true) // is filename excluded ? || (exclude_check(&g_options.exclude, relpath)==true)) // is filepath excluded ? { msgprintf(MSG_VERB2, "file/dir=[%s] excluded because of its own name/path\n", relpath); return true; } // check if that file belongs to a directory which has been excluded snprintf(dirpath, sizeof(dirpath), "%s", relpath); for (pos=0; dirpath[pos]; pos++); // go to the end of the string while (pos>0) { // dirpath=parent_directory(dirpath) while ((pos>=0) && (dirpath[pos]!='/')) dirpath[pos--]=0; if ((pos>0) && (dirpath[pos]=='/')) dirpath[pos]=0; extract_basename(dirpath, basename, sizeof(basename)); if (strlen(dirpath)>1 && strlen(basename)>0) { if ((exclude_check(&g_options.exclude, basename)==true) || (exclude_check(&g_options.exclude, dirpath)==true)) { msgprintf(MSG_VERB2, "file/dir=[%s] excluded because of its parent=[%s]\n", relpath, dirpath); return true; // a parent directory is excluded } } } return false; // no exclusion found for that file } // convert an array of strings "id=x,dest=/dev/xxx,..." to an array of strdico int convert_argv_to_strdicos(cstrdico *dicoargv[], int argc, char *cmdargv[]) { cstrdico *tmpdico=NULL; char buffer[1024]; struct stat64 st; s64 temp64; int fsid; int i; for (i=0; (iFSA_MAX_FSPERARCH-1)) { errprintf("invalid filesystem id [%d]: it must match a valid filesystem id as shown by archinfo\n", fsid); strdico_destroy(tmpdico); return -1; } // read and check "dest=" key in the argument if (strdico_get_string(tmpdico, buffer, sizeof(buffer), "dest")!=0) { errprintf("cannot find \"dest=\" key in \"%s\"\n", cmdargv[i]); strdico_destroy(tmpdico); return -1; } if ((stat64(buffer, &st)!=0) || (!S_ISBLK(st.st_mode))) { errprintf("\"%s\" is not a valid block device\n", buffer); strdico_destroy(tmpdico); return -1; } // add the current argument to the list of the strdico objects if (dicoargv[fsid]!=NULL) { errprintf("you mentioned filesystem with id=%d multiple times, cannot continue\n", fsid); strdico_destroy(tmpdico); return -1; } dicoargv[fsid]=tmpdico; } return 0; } int extractar_listing_print_file(cextractar *exar, int objtype, char *relpath) { char strprogress[256]; s64 progress; memset(strprogress, 0, sizeof(strprogress)); if (exar->cost_global>0) { progress=(((exar->cost_current)*100)/(exar->cost_global)); if (progress>=0 && progress<=100) snprintf(strprogress, sizeof(strprogress), "[%3d%%]", (int)progress); } msgprintf(MSG_VERB1, "-[%.2d]%s[%s] %s\n", exar->fsid, strprogress, get_objtype_name(objtype), relpath); return 0; } int extractar_restore_attr_xattr(cextractar *exar, u32 objtype, char *fullpath, char *relpath, cdico *dicoattr) { char xattrname[2048]; char xattrvalue[65535]; u16 xattrdatasize; int xattrdicsize; int ret=0; int res; int i; // ---- restore extended attributes xattrdicsize=dico_count_one_section(dicoattr, DICO_OBJ_SECTION_XATTR); for (i=0; i < xattrdicsize; i+=2) { if (dico_get_string(dicoattr, DICO_OBJ_SECTION_XATTR, (u64)(i+0), xattrname, sizeof(xattrname))!=0) { errprintf("Cannot retrieve the name of an xattr for file %s: DICO_OBJ_SECTION_XATTR, key=%ld\n", relpath, (long)(i+0)); dico_show(dicoattr, DICO_OBJ_SECTION_XATTR, "xattr"); ret=-1; continue; } memset(xattrvalue, 0, sizeof(xattrvalue)); if (dico_get_data(dicoattr, DICO_OBJ_SECTION_XATTR, (u64)(i+1), xattrvalue, sizeof(xattrvalue), &xattrdatasize)!=0) { errprintf("Cannot retrieve the value of an xattr for file %s: DICO_OBJ_SECTION_XATTR, key=%ld\n", relpath, (long)(i+1)); dico_show(dicoattr, DICO_OBJ_SECTION_XATTR, "xattr"); ret=-1; continue; } if ((res=lsetxattr(fullpath, xattrname, xattrvalue, xattrdatasize, 0))!=0) { sysprintf("xattr:lsetxattr(%s,%s) failed\n", relpath, xattrname); ret=-1; } else // success { msgprintf(MSG_VERB2, " xattr:lsetxattr(%s, %s)=%d\n", relpath, xattrname, res); } } return ret; } int extractar_restore_attr_windows(cextractar *exar, u32 objtype, char *fullpath, char *relpath, cdico *dicoattr) { char xattrname[2048]; char xattrvalue[65535]; u16 xattrdatasize; int xattrdicsize; int ret=0; int res; int i; xattrdicsize=dico_count_one_section(dicoattr, DICO_OBJ_SECTION_WINATTR); for (i=0; i < xattrdicsize; i+=2) { if (dico_get_string(dicoattr, DICO_OBJ_SECTION_WINATTR, (u64)(i+0), xattrname, sizeof(xattrname))!=0) { errprintf("Cannot retrieve the name of an winattr for file %s\n", relpath); dico_show(dicoattr, DICO_OBJ_SECTION_WINATTR, "winattr"); ret=-1; continue; } memset(xattrvalue, 0, sizeof(xattrvalue)); if (dico_get_data(dicoattr, DICO_OBJ_SECTION_WINATTR, (u64)(i+1), xattrvalue, sizeof(xattrvalue), &xattrdatasize)!=0) { errprintf("Cannot retrieve the value of an winattr for file %s\n", relpath); ret=-1; continue; } if ((res=lsetxattr(fullpath, xattrname, xattrvalue, xattrdatasize, 0))!=0) { sysprintf("winattr:lsetxattr(%s,%s) failed\n", relpath, xattrname); ret=-1; } else // success { msgprintf(MSG_VERB2, " winattr:lsetxattr(%s, %s)=%d\n", relpath, xattrname, res); } } return ret; } int extractar_restore_attr_std(cextractar *exar, u32 objtype, char *fullpath, char *relpath, cdico *dicoattr) { u32 mode, uid, gid; u64 atime, mtime; // ---- restore standard attributes (permissions, owner, ...) if (dico_get_u32(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MODE, &mode)!=0) return -1; if (dico_get_u32(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_UID, &uid)!=0) return -2; if (dico_get_u32(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_GID, &gid)!=0) return -3; if (dico_get_u64(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_ATIME, &atime)!=0) return -4; if (dico_get_u64(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MTIME, &mtime)!=0) return -5; if (lchown(fullpath, (uid_t)uid, (gid_t)gid)!=0) { sysprintf("Cannot lchown(%s) which is %s\n", fullpath, get_objtype_name(objtype)); return -6; } if (objtype!=OBJTYPE_SYMLINK) { if (chmod(fullpath, (mode_t)mode)!=0) { sysprintf("chmod(%s, %lld) failed\n", fullpath, (long long)mode); return -7; } } // set the values for atime/mtime struct timeval tv[2]; tv[0].tv_usec=0; tv[0].tv_sec=atime; tv[1].tv_usec=0; tv[1].tv_sec=mtime; if (objtype!=OBJTYPE_SYMLINK) // not a symlink { if (utimes(fullpath, tv)!=0) { sysprintf("utimes(%s) failed\n", relpath); return -8; } } #ifdef HAVE_LUTIMES else // object is a symlink { // lutimes not implemented on rhel5: don't fail for symlinks lutimes(fullpath, tv); } #endif // HAVE_LUTIMES return 0; } int extractar_restore_attr_everything(cextractar *exar, int objtype, char *fullpath, char *relpath, cdico *dicoattr) { int res=0; // ---- restore standard attributes res+=extractar_restore_attr_std(exar, objtype, fullpath, relpath, dicoattr); // ---- restore extended attributes res+=extractar_restore_attr_xattr(exar, objtype, fullpath, relpath, dicoattr); // ---- restore windows attributes res+=extractar_restore_attr_windows(exar, objtype, fullpath, relpath, dicoattr); return (res==0)?(0):(-1); } int extractar_restore_obj_symlink(cextractar *exar, char *fullpath, char *relpath, char *destdir, cdico *d, int objtype, int fstype) { char parentdir[PATH_MAX]; struct timeval tv[2]; char buffer[PATH_MAX]; u64 targettype; int fdtemp; // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; // check the list of excluded files/dirs if (is_filedir_excluded(relpath)==true) goto extractar_restore_obj_symlink_err; // update progress bar extractar_listing_print_file(exar, objtype, relpath); // create parent directory first extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); if (dico_get_string(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_SYMLINK, buffer, PATH_MAX)<0) { errprintf("Cannot read field=symlink for file=[%s]\n", fullpath); goto extractar_restore_obj_symlink_err; } // in ntfs a symlink has to be recreated as a standard file or directory (depending on what the target is) if ((dico_get_u64(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_LINKTARGETTYPE, &targettype)==0) && (strcmp(filesys[fstype].name, "ntfs")==0)) { switch (targettype) { case OBJTYPE_DIR: msgprintf(MSG_DEBUG1, "LINK: mklink=[%s], target=[%s], targettype=DIR\n", relpath, buffer); if (mkdir_recursive(fullpath)!=0) { errprintf("Cannot create directory for ntfs symlink: path=[%s]\n", fullpath); goto extractar_restore_obj_symlink_err; } break; case OBJTYPE_REGFILEUNIQUE: msgprintf(MSG_DEBUG1, "LINK: mklink=[%s], target=[%s], targettype=REGFILE\n", relpath, buffer); if ( (fdtemp=creat(fullpath, 0644)) < 0) { errprintf("Cannot create file for ntfs symlink: path=[%s]\n", fullpath); goto extractar_restore_obj_symlink_err; } close(fdtemp); break; default: msgprintf(MSG_DEBUG1, "LINK: mklink=[%s], target=[%s], targettype=UNKNOWN\n", relpath, buffer); errprintf("Unexpected target type for ntfs symlink: path=[%s]\n", fullpath); goto extractar_restore_obj_symlink_err; break; } } else // normal symbolic link for linux filesystems { msgprintf(MSG_DEBUG1, "LINK: symlink=[%s], target=[%s] (normal symlink)\n", relpath, buffer); if (symlink(buffer, fullpath)<0) { sysprintf("symlink(%s, %s) failed\n", buffer, fullpath); goto extractar_restore_obj_symlink_err; } } if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, d)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); goto extractar_restore_obj_symlink_err; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); goto extractar_restore_obj_symlink_err; } dico_destroy(d); exar->stats.cnt_symlink++; return 0; // success extractar_restore_obj_symlink_err: dico_destroy(d); exar->stats.err_symlink++; return 0; // non fatal error } int extractar_restore_obj_hardlink(cextractar *exar, char *fullpath, char *relpath, char *destdir, cdico *d, int objtype, int fstype) { char parentdir[PATH_MAX]; struct timeval tv[2]; char buffer[PATH_MAX]; char regfile[PATH_MAX]; int res; // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; // check the list of excluded files/dirs if (is_filedir_excluded(relpath)==true) goto extractar_restore_obj_hardlink_err; // create parent directory first extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); // update progress bar extractar_listing_print_file(exar, objtype, relpath); if (dico_get_string(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_HARDLINK, buffer, PATH_MAX)<0) { msgprintf(MSG_STACK, "dico_get_string(DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_HARDLINK) failed\n"); goto extractar_restore_obj_hardlink_err; } concatenate_paths(regfile, PATH_MAX, destdir, buffer); if ((res=link(regfile, fullpath))!=0) { sysprintf("link(%s, %s) failed\n", regfile, fullpath); goto extractar_restore_obj_hardlink_err; } if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, d)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); goto extractar_restore_obj_hardlink_err; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); goto extractar_restore_obj_hardlink_err; } dico_destroy(d); exar->stats.cnt_hardlink++; return 0; // success extractar_restore_obj_hardlink_err: dico_destroy(d); exar->stats.err_hardlink++; return 0; // non fatal error } int extractar_restore_obj_devfile(cextractar *exar, char *fullpath, char *relpath, char *destdir, cdico *d, int objtype, int fstype) { char parentdir[PATH_MAX]; struct timeval tv[2]; u64 dev; u32 mode; // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; // check the list of excluded files/dirs if (is_filedir_excluded(relpath)==true) goto extractar_restore_obj_devfile_err; // create parent directory first extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); // update progress bar extractar_listing_print_file(exar, objtype, relpath); if (dico_get_u64(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_RDEV, &dev)!=0) goto extractar_restore_obj_devfile_err; if (dico_get_u32(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MODE, &mode)!=0) goto extractar_restore_obj_devfile_err; if (mknod(fullpath, mode, dev)!=0) { sysprintf("mknod failed on [%s]\n", relpath); goto extractar_restore_obj_devfile_err; } if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, d)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); goto extractar_restore_obj_devfile_err; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); goto extractar_restore_obj_devfile_err; } dico_destroy(d); exar->stats.cnt_special++; return 0; // success extractar_restore_obj_devfile_err: dico_destroy(d); exar->stats.err_special++; return 0; // non fatal error } int extractar_restore_obj_directory(cextractar *exar, char *fullpath, char *relpath, char *destdir, cdico *d, int objtype, int fstype) { char parentdir[PATH_MAX]; struct timeval tv[2]; // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; // check the list of excluded files/dirs if (is_filedir_excluded(relpath)==true) goto extractar_restore_obj_directory_err; // create parent directory first extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); // update progress bar extractar_listing_print_file(exar, objtype, relpath); mkdir_recursive(fullpath); if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, d)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); goto extractar_restore_obj_directory_err; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); goto extractar_restore_obj_directory_err; } dico_destroy(d); exar->stats.cnt_dir++; return 0; // success extractar_restore_obj_directory_err: dico_destroy(d); exar->stats.err_dir++; return 0; // non fatal error } int extractar_restore_obj_regfile_multi(cextractar *exar, char *destdir, cdico *dicofirstfile, int objtype, int fstype) // d = obj-header of first small file { cdatafile *datafile=NULL; char databuf[FSA_MAX_SMALLFILESIZE]; char basename[PATH_MAX]; cdico *filehead=NULL; char magic[FSA_SIZEOF_MAGIC+1]; char fullpath[PATH_MAX]; char relpath[PATH_MAX]; char parentdir[PATH_MAX]; struct timeval tv[2]; struct s_blockinfo blkinfo; cregmulti regmulti; u8 md5sumcalc[16]; u8 md5sumorig[16]; int errors; u32 filescount; u32 tmpobjtype; u64 datsize; s64 lres; int res; int i; // init errors=0; memset(&blkinfo, 0, sizeof(blkinfo)); regmulti_init(®multi, FSA_MAX_BLKSIZE); datafile=datafile_alloc(); // ---- dequeue header for each small file which is part of that group if (dico_get_u32(dicofirstfile, 0, DISKITEMKEY_MULTIFILESCOUNT, &filescount)!=0) { errprintf("cannot read DISKITEMKEY_MULTIFILESCOUNT from header in archive\n"); return -1; } if (regmulti_rest_addheader(®multi, dicofirstfile)!=0) { errprintf("rest_addheader() failed\n"); return -1; } for (i=1; i < filescount; i++) // first header was a special case (received from calling function) { if (queue_dequeue_header(&g_queue, &filehead, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed: cannot read multireg object header\n"); errors++; return -1; } if (memcmp(magic, FSA_MAGIC_OBJT, FSA_SIZEOF_MAGIC)!=0) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_OBJT); return -1; } if (regmulti_rest_addheader(®multi, filehead)!=0) { errprintf("rest_addheader() failed for file %d\n", i); return -1; } } // ---- dequeue the block which contains data for several small files if ((lres=queue_dequeue_block(&g_queue, &blkinfo))<=0) { errprintf("queue_dequeue_block()=%ld=%s failed\n", (long)lres, error_int_to_string(lres)); return -1; } if (regmulti_rest_setdatablock(®multi, blkinfo.blkdata, blkinfo.blkrealsize)!=0) { errprintf("regmulti_rest_setdatablock() failed\n"); return -1; } free(blkinfo.blkdata); // free memory allocated by the thread_io_reader // ---- create the set of small files using the regmulti structure for (i=0; i < filescount; i++) { // get header and data for a small file from the regmulti structure if (regmulti_rest_getfile(®multi, i, &filehead, databuf, &datsize, sizeof(databuf))!=0) { errprintf("rest_addheader() failed for file %d\n", i); filehead=NULL; // else dico_destroy would fail goto extractar_restore_obj_regfile_multi_err; } if (dico_get_u32(filehead, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_OBJTYPE, &tmpobjtype)!=0) { errprintf("Cannot read object type\n"); goto extractar_restore_obj_regfile_multi_err; } if ((res=dico_get_data(filehead, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_PATH, relpath, sizeof(relpath), NULL))!=0) { errprintf("Cannot read DISKITEMKEY_PATH from header, res=%d, key=%d\n", res, DISKITEMKEY_PATH); dico_show(filehead, DICO_OBJ_SECTION_STDATTR, "DISKITEMKEY_PATH"); goto extractar_restore_obj_regfile_multi_err; } concatenate_paths(fullpath, sizeof(fullpath), destdir, relpath); extract_basename(fullpath, basename, sizeof(basename)); // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; exar->cost_current+=datsize; // filesize // check the list of excluded files/dirs if (is_filedir_excluded(relpath)!=true) { // create parent directory if necessary extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); extractar_listing_print_file(exar, tmpobjtype, relpath); if (dico_get_data(filehead, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MD5SUM, md5sumorig, 16, NULL)) { errprintf("cannot get md5sum from file footer for file=[%s]\n", relpath); dico_show(filehead, DICO_OBJ_SECTION_STDATTR, "filehead"); goto extractar_restore_obj_regfile_multi_err; } if (datafile_open_write(datafile, fullpath, false, false)<0) goto extractar_restore_obj_regfile_multi_err; res=datafile_write(datafile, databuf, datsize); datafile_close(datafile, md5sumcalc, sizeof(md5sumcalc)); if (res!=FSAERR_SUCCESS) { errprintf("removing %s\n", fullpath); unlink(fullpath); return -1; } if (memcmp(md5sumcalc, md5sumorig, 16)!=0) { errprintf("cannot restore file %s, the data block (which is shared by multiple files) is corrupt\n", relpath); res=truncate(fullpath, 0); // don't leave corrupt data in the file goto extractar_restore_obj_regfile_multi_err; } if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, filehead)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); goto extractar_restore_obj_regfile_multi_err; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); goto extractar_restore_obj_regfile_multi_err; } exar->stats.cnt_regfile++; } dico_destroy(filehead); continue; // success on that file extractar_restore_obj_regfile_multi_err: dico_destroy(filehead); exar->stats.err_regfile++; continue; } datafile_destroy(datafile); return 0; } int extractar_restore_obj_regfile_unique(cextractar *exar, char *fullpath, char *relpath, char *destdir, cdico *d, int objtype, int fstype) // large or empty files { char magic[FSA_SIZEOF_MAGIC+1]; struct s_blockinfo blkinfo; char parentdir[PATH_MAX]; cdatafile *datafile=NULL; cdico *footerdico=NULL; bool fatalerr=false; // error for restoration globally bool minorerr=false; // error for current file only bool delfile=false; struct timeval tv[2]; u8 md5sumcalc[16]; u8 md5sumorig[16]; int excluded=false; bool sparse=false; u64 filesize=0; u64 filepos=0; u64 flags=0; s64 lres; // init memset(&blkinfo, 0, sizeof(blkinfo)); memset(magic, 0, sizeof(magic)); datafile=datafile_alloc(); if (dico_get_u64(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_SIZE, &filesize)!=0) { errprintf("Cannot read filesize DISKITEMKEY_SIZE from archive for file=[%s]\n", relpath); minorerr=true; } sparse=((dico_get_u64(d, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_FLAGS, &flags)==0) && (flags&FSA_FILEFLAGS_SPARSE)); // update cost statistics and progress bar exar->cost_current+=FSA_COST_PER_FILE; exar->cost_current+=filesize; // check the list of excluded files/dirs if (is_filedir_excluded(relpath)==true) { excluded=true; } else if (minorerr==false) // file not excluded and no error yet { // create parent directory first extract_dirpath(fullpath, parentdir, sizeof(parentdir)); mkdir_recursive(parentdir); // backup parent dir atime/mtime get_parent_dir_time_attrib(fullpath, parentdir, sizeof(parentdir), tv); // show progress bar extractar_listing_print_file(exar, objtype, relpath); } if ((minorerr==false) && (datafile_open_write(datafile, fullpath, excluded, sparse)<0)) minorerr=true; msgprintf(MSG_DEBUG2, "restore_obj_regfile_unique(file=%s, size=%lld)\n", relpath, (long long)filesize); for (filepos=0; (minorerr==false) && (filesize>0) && (filepos < filesize) && (get_interrupted()==false); filepos+=blkinfo.blkrealsize) { if ((lres=queue_dequeue_block(&g_queue, &blkinfo))<=0) { errprintf("queue_dequeue_block()=%ld=%s for file(%s) failed\n", (long)lres, error_int_to_string(lres), relpath); delfile=true; minorerr=true; break; } if (blkinfo.blkoffset!=filepos) { errprintf("file offset do not match for file(%s) failed: filepos=%lld, blkinfo.blkoffset=%lld, blkinfo.blkrealsize=%lld\n", relpath, (long long)filepos, (long long)blkinfo.blkoffset, (long long)blkinfo.blkrealsize); free(blkinfo.blkdata); delfile=true; minorerr=true; break; } if (datafile_write(datafile, blkinfo.blkdata, blkinfo.blkrealsize)!=FSAERR_SUCCESS) { free(blkinfo.blkdata); delfile=true; minorerr=true; fatalerr=true; break; } free(blkinfo.blkdata); } if ((minorerr==false) && (datafile_close(datafile, md5sumcalc, sizeof(md5sumcalc))!=0)) minorerr=true; if ((minorerr==false) && (excluded==false)) { if (extractar_restore_attr_everything(exar, objtype, fullpath, relpath, d)!=0) { msgprintf(MSG_STACK, "cannot restore file attributes for file [%s]\n", relpath); minorerr=true; } // restore parent dir mtime/atime if (utimes(parentdir, tv)!=0) { sysprintf("utimes(%s) failed\n", parentdir); minorerr=true; } } // empty files have no footer (no need for a checksum) if ((fatalerr==false) && (filesize>0)) { if (queue_dequeue_header(&g_queue, &footerdico, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed: cannot read footer dico\n"); minorerr=true; goto restore_obj_regfile_unique_end; } if (excluded!=true) { if (memcmp(magic, FSA_MAGIC_FILF, FSA_SIZEOF_MAGIC)!=0) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_FILF); minorerr=true; goto restore_obj_regfile_unique_end; } if (dico_get_data(footerdico, 0, BLOCKFOOTITEMKEY_MD5SUM, md5sumorig, 16, NULL)) { errprintf("cannot get md5sum from file footer for file=[%s]\n", relpath); minorerr=true; goto restore_obj_regfile_unique_end; } if (memcmp(md5sumcalc, md5sumorig, 16)!=0) { errprintf("cannot restore file %s, file is corrupt\n", relpath); delfile=true; // don't leave corrupt data in the file minorerr=true; goto restore_obj_regfile_unique_end; } } } restore_obj_regfile_unique_end: if (delfile==true) { errprintf("removing %s\n", fullpath); unlink(fullpath); } if (excluded!=true) { if (minorerr==true) exar->stats.err_regfile++; else exar->stats.cnt_regfile++; } if (get_interrupted()==true) errprintf("operation has been interrupted\n"); dico_destroy(footerdico); dico_destroy(d); datafile_destroy(datafile); return (fatalerr==false)?(0):(-1); } int extractar_restore_object(cextractar *exar, int *errors, char *destdir, cdico *dicoattr, int fstype) { char relpath[PATH_MAX]; char fullpath[PATH_MAX]; u64 filesize; u32 objtype; int res; // init *errors=0; if (dico_get_data(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_PATH, relpath, sizeof(relpath), NULL)!=0) return -1; if (dico_get_u32(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_OBJTYPE, &objtype)!=0) return -2; if (dico_get_u64(dicoattr, DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_SIZE, &filesize)!=0) return -3; concatenate_paths(fullpath, sizeof(fullpath), destdir, relpath); // ---- recreate specific object on the filesystem switch (objtype) { case OBJTYPE_DIR: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_DIR, path=[%s]\n", relpath); res=extractar_restore_obj_directory(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_SYMLINK: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_SYMLINK, path=[%s]\n", relpath); res=extractar_restore_obj_symlink(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_HARDLINK: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_HARDLINK, path=[%s]\n", relpath); res=extractar_restore_obj_hardlink(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_CHARDEV: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_CHARDEV, path=[%s]\n", relpath); res=extractar_restore_obj_devfile(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_BLOCKDEV: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_BLOCKDEV, path=[%s]\n", relpath); res=extractar_restore_obj_devfile(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_FIFO: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_FIFO, path=[%s]\n", relpath); res=extractar_restore_obj_devfile(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_SOCKET: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_SOCKET, path=[%s]\n", relpath); res=extractar_restore_obj_devfile(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype); break; case OBJTYPE_REGFILEUNIQUE: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_REGFILEUNIQUE, path=[%s]\n", relpath); if ((res=extractar_restore_obj_regfile_unique(exar, fullpath, relpath, destdir, dicoattr, objtype, fstype))<0) { msgprintf(MSG_STACK, "restore_obj_regfile_unique(%s) failed with res=%d\n", relpath, res); return -1; } break; case OBJTYPE_REGFILEMULTI: msgprintf(MSG_DEBUG2, "objtype=OBJTYPE_REGFILEMULTI, path=[%s]\n", relpath); if ((res=extractar_restore_obj_regfile_multi(exar, destdir, dicoattr, objtype, fstype))<0) { msgprintf(MSG_STACK, "restore_obj_regfile_multi(%s) failed with res=%d\n", relpath, res); return -1; } break; default: errprintf("Unknown objtype %d\n", objtype); return -3; } if (res!=0) // value returned by restore_obj_xxx() { errprintf("Restoring file=[%s], objtype=[%s] failed\n", fullpath, get_objtype_name(objtype)); return -1; } return 0; } int extractar_extract_read_objects(cextractar *exar, int *errors, char *destdir, int fstype) { char magic[FSA_SIZEOF_MAGIC+1]; cdico *dicoattr=NULL; int headerisend; int headerisobj; u16 checkfsid; int curerr; int type; int res; // init memset(magic, 0, sizeof(magic)); *errors=0; do { // skip the garbage (just ignore everything until the next FSA_MAGIC_OBJT) // in case the archive is corrupt and random data has been added / removed in the archive do { if (queue_check_next_item(&g_queue, &type, magic)!=0) { errprintf("queue_check_next_item() failed: cannot read object from archive\n"); return -1; } headerisobj=(memcmp(magic, FSA_MAGIC_OBJT, FSA_SIZEOF_MAGIC)==0); headerisend=(memcmp(magic, FSA_MAGIC_DATF, FSA_SIZEOF_MAGIC)==0); if (headerisobj!=true && headerisend!=true) // did not find expected header: skip garbage in archive { errprintf("unexpected header found in archive, skipping it: type=%d, magic=[%s]\n", type, (type==QITEM_TYPE_HEADER)?(magic):"-block-"); if (queue_destroy_first_item(&g_queue)!=0) { errprintf("queue_destroy_first_item() failed: cannot read object from archive\n"); return -1; } } } while ((headerisobj!=true) && (headerisend!=true)); if (headerisobj==true) // if it's an object header { // read object header from archive while (queue_dequeue_header(&g_queue, &dicoattr, magic, &checkfsid)<=0) { errprintf("queue_dequeue_header() failed\n"); (*errors)++; } if (checkfsid==exar->fsid) // if filesystem-id is correct { if ((res=extractar_restore_object(exar, &curerr, destdir, dicoattr, fstype))!=0) { msgprintf(MSG_STACK, "restore_object() failed with res=%d\n", res); //dico_destroy(dicoattr); return -1; // fatal error } } else // wrong filesystem-id { errprintf("restore_object(): object has a wrong filesystem id: found=[%d], expected=[%d]\n", checkfsid, exar->fsid); (*errors)++; } //dico_destroy(dicoattr); } } while ((headerisend!=true) && (get_abort()==false)); return 0; } int extractar_read_mainhead(cextractar *exar, cdico **dicomainhead) { u8 bufcheckclear[FSA_CHECKPASSBUF_SIZE+8]; u8 bufcheckcrypt[FSA_CHECKPASSBUF_SIZE+8]; char magic[FSA_SIZEOF_MAGIC+1]; u16 cryptbufsize; u8 md5sumar[16]; u8 md5sumnew[16]; u64 clearsize; int passlen; u32 temp32; assert(exar); assert(dicomainhead); // init memset(magic, 0, sizeof(magic)); if (queue_dequeue_header(&g_queue, dicomainhead, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed: cannot read main header\n"); return -1; } if (memcmp(magic, FSA_MAGIC_MAIN, FSA_SIZEOF_MAGIC)!=0) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_MAIN); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_ARCHTYPE, &exar->ai.archtype)!=0) { errprintf("cannot find MAINHEADKEY_ARCHTYPE in main-header\n"); return -1; } if (exar->ai.archtype==ARCHTYPE_FILESYSTEMS && dico_get_u64(*dicomainhead, 0, MAINHEADKEY_FSCOUNT, &exar->ai.fscount)!=0) { errprintf("cannot find MAINHEADKEY_FSCOUNT in main-header\n"); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_ARCHIVEID, &exar->ai.archid)!=0) { errprintf("cannot find MAINHEADKEY_ARCHIVEID in main-header\n"); return -1; } if (dico_get_data(*dicomainhead, 0, MAINHEADKEY_FILEFORMATVER, exar->ai.filefmt, FSA_MAX_FILEFMTLEN, NULL)!=0) { errprintf("cannot find MAINHEADKEY_FILEFORMATVER in main-header\n"); return -1; } if (dico_get_data(*dicomainhead, 0, MAINHEADKEY_PROGVERCREAT, exar->ai.creatver, FSA_MAX_PROGVERLEN, NULL)!=0) { errprintf("cannot find MAINHEADKEY_PROGVERCREAT in main-header\n"); return -1; } if (dico_get_data(*dicomainhead, 0, MAINHEADKEY_ARCHLABEL, exar->ai.label, FSA_MAX_LABELLEN, NULL)!=0) { errprintf("cannot find MAINHEADKEY_ARCHLABEL in main-header\n"); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_COMPRESSALGO, &exar->ai.compalgo)!=0) { errprintf("cannot find MAINHEADKEY_COMPRESSALGO in main-header\n"); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_ENCRYPTALGO, &exar->ai.cryptalgo)!=0) { errprintf("cannot find MAINHEADKEY_ENCRYPTALGO in main-header\n"); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_COMPRESSLEVEL, &exar->ai.complevel)!=0) { errprintf("cannot find MAINHEADKEY_COMPRESSLEVEL in main-header\n"); return -1; } if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_FSACOMPLEVEL, &exar->ai.fsacomp)!=0) { errprintf("cannot find MAINHEADKEY_FSACOMPLEVEL in main-header\n"); return -1; } if (dico_get_u64(*dicomainhead, 0, MAINHEADKEY_CREATTIME, &exar->ai.creattime)!=0) { errprintf("cannot find MAINHEADKEY_CREATTIME in main-header\n"); return -1; } // MAINHEADKEY_HASDIRSINFOHEAD has been introduced in fsarchiver-0.6.7: don't fail if missing if (dico_get_u32(*dicomainhead, 0, MAINHEADKEY_HASDIRSINFOHEAD, &temp32)==0) exar->ai.hasdirsinfohead=temp32; // check the file format. New versions based on "FsArCh_002" also understand "FsArCh_001" which is very close (and "FsArCh_00Y"=="FsArCh_001") if (strcmp(exar->ai.filefmt, FSA_FILEFORMAT)!=0 && strcmp(exar->ai.filefmt, "FsArCh_00Y")!=0 && strcmp(exar->ai.filefmt, "FsArCh_001")!=0) { errprintf("This archive is based on a different file format: [%s]. Cannot continue.\n", exar->ai.filefmt); errprintf("It has been created with fsarchiver [%s], you should extrat the archive using that version.\n", exar->ai.creatver); errprintf("The current version of the program is [%s], and it's based on format [%s]\n", FSA_VERSION, FSA_FILEFORMAT); return -1; } // read minimum fsarchiver version requirement if (dico_get_u64(*dicomainhead, 0, MAINHEADKEY_MINFSAVERSION, &exar->ai.minfsaver)!=0) exar->ai.minfsaver=FSA_VERSION_BUILD(0, 0, 0, 0); // not defined // if encryption is enabled, check the password is correct using the encrypted random buffer saved in the archive if (exar->ai.cryptalgo!=ENCRYPT_NONE) { memset(md5sumar, 0, sizeof(md5sumar)); memset(md5sumnew, 0, sizeof(md5sumnew)); if (dico_get_data(*dicomainhead, 0, MAINHEADKEY_BUFCHECKPASSCRYPTBUF, bufcheckcrypt, sizeof(bufcheckcrypt), &cryptbufsize)!=0) { errprintf("cannot find MAINHEADKEY_BUFCHECKPASSCRYPTBUF in main-header\n"); return -1; } if (dico_get_data(*dicomainhead, 0, MAINHEADKEY_BUFCHECKPASSCLEARMD5, md5sumar, sizeof(md5sumar)+99, NULL)!=0) { errprintf("cannot find MAINHEADKEY_BUFCHECKPASSCLEARMD5 in main-header\n"); return -1; } passlen=(g_options.encryptpass==NULL)?(0):(strlen((char*)g_options.encryptpass)); if ((g_options.encryptpass==NULL) || (passlenFSA_MAX_PASSLEN)) { errprintf("you have to provide the password which was used to create archive, no password given on the command line\n"); return -1; } if (crypto_blowfish(cryptbufsize, &clearsize, bufcheckcrypt, bufcheckclear, g_options.encryptpass, strlen((char*)g_options.encryptpass), false)==0) gcry_md_hash_buffer(GCRY_MD_MD5, md5sumnew, bufcheckclear, clearsize); if (memcmp(md5sumar, md5sumnew, 16)!=0) { errprintf("you have to provide the password which was used to create archive, cannot decrypt the test buffer.\n"); return -1; } } return 0; } int extractar_filesystem_extract(cextractar *exar, cdico *dicofs, cstrdico *dicocmdline) { char filesystem[FSA_MAX_FSNAMELEN]; char text[FSA_MAX_FSNAMELEN]; char fsbuf[FSA_MAX_FSNAMELEN]; char magic[FSA_SIZEOF_MAGIC+1]; char mountinfo[4096]; char partition[1024]; char mkfsoptions[1024]; char mkfslabel[1024]; char mkfsuuid[1024]; char tempbuf[1024]; cdico *dicobegin=NULL; cdico *dicoend=NULL; char mntbuf[PATH_MAX]; u64 fsbytestotal; u64 fsbytesused; char optbuf[128]; int readwrite; int errors=0; u64 minver; u64 curver; int fstype; int ret=0; int res; // init memset(magic, 0, sizeof(magic)); memset(partition, 0, sizeof(partition)); memset(mkfslabel, 0, sizeof(mkfslabel)); memset(mkfsuuid, 0, sizeof(mkfsuuid)); // read destination partition from dicocmdline if (strdico_get_string(dicocmdline, partition, sizeof(partition), "dest")!=0) { errprintf("strdico_get_string(dicocmdline, 'dest') failed\n"); return -1; } // check that the minimum fsarchiver version required is ok if (dico_get_u64(dicofs, 0, FSYSHEADKEY_MINFSAVERSION, &minver)!=0) minver=FSA_VERSION_BUILD(0, 6, 4, 0); // fsarchiver-0.6.4 is the first fsa version having fileformat="FsArCh_002" curver=FSA_VERSION_BUILD(PACKAGE_VERSION_A, PACKAGE_VERSION_B, PACKAGE_VERSION_C, PACKAGE_VERSION_D); msgprintf(MSG_VERB2, "Current fsarchiver version: %d.%d.%d.%d\n", (int)FSA_VERSION_GET_A(curver), (int)FSA_VERSION_GET_B(curver), (int)FSA_VERSION_GET_C(curver), (int)FSA_VERSION_GET_D(curver)); msgprintf(MSG_VERB2, "Minimum fsarchiver version for that filesystem: %d.%d.%d.%d\n", (int)FSA_VERSION_GET_A(minver), (int)FSA_VERSION_GET_B(minver), (int)FSA_VERSION_GET_C(minver), (int)FSA_VERSION_GET_D(minver)); if (curver < minver) { errprintf("This filesystem can only be restored with fsarchiver %d.%d.%d.%d or more recent\n", (int)FSA_VERSION_GET_A(minver), (int)FSA_VERSION_GET_B(minver), (int)FSA_VERSION_GET_C(minver), (int)FSA_VERSION_GET_D(minver)); return -1; } // check the partition is not mounted res=generic_get_mntinfo(partition, &readwrite, mntbuf, sizeof(mntbuf), optbuf, sizeof(optbuf), fsbuf, sizeof(fsbuf)); if (res==0) { errprintf("partition [%s] is mounted on [%s].\ncannot restore an archive to a partition " "which is mounted, unmount it first: umount %s\n", partition, mntbuf, mntbuf); return -1; } // ---- read filesystem-header from archive if (queue_dequeue_header(&g_queue, &dicobegin, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed: cannot read file system dico\n"); return -1; } dico_destroy(dicobegin); if (memcmp(magic, FSA_MAGIC_FSYB, FSA_SIZEOF_MAGIC)!=0) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_FSYB); return -1; } // if a filesystem to use was specified: overwrite the default one if (strdico_get_string(dicocmdline, tempbuf, sizeof(tempbuf), "mkfs")==0) { snprintf(filesystem, sizeof(filesystem), "%s", tempbuf); } else if ((dico_get_string(dicofs, 0, FSYSHEADKEY_FILESYSTEM, filesystem, sizeof(filesystem)))<0) { errprintf("dico_get_string(FSYSHEADKEY_FILESYSTEM) failed\n"); return -1; } // read make file system options from dicocmdline if (strdico_get_string(dicocmdline, mkfsoptions, sizeof(mkfsoptions), "mkfsopt")!=0) { msgprintf(MSG_VERB2,"strdico_get_string(dicocmdline, 'mkfsopt') doesn't exist\n"); } if (strdico_get_string(dicocmdline, mkfslabel, sizeof(mkfslabel), "label")!=0) { msgprintf(MSG_VERB2,"strdico_get_string(dicocmdline, 'label') doesn't exist\n"); } if (strdico_get_string(dicocmdline, mkfsuuid, sizeof(mkfsuuid), "uuid")!=0) { msgprintf(MSG_VERB2,"strdico_get_string(dicocmdline, 'uuid') doesn't exist\n"); } if (dico_get_u64(dicofs, 0, FSYSHEADKEY_BYTESTOTAL, &fsbytestotal)!=0) { errprintf("dico_get_string(FSYSHEADKEY_BYTESTOTAL) failed\n"); return -1; } if (dico_get_u64(dicofs, 0, FSYSHEADKEY_BYTESUSED, &fsbytesused)!=0) { errprintf("dico_get_string(FSYSHEADKEY_BYTESUSED) failed\n"); return -1; } msgprintf(MSG_VERB2, "filesystem_type=[%s]\n", filesystem); msgprintf(MSG_VERB2, "filesystem_mkfsoptions=[%s]\n", mkfsoptions); msgprintf(MSG_VERB2, "filesystem_mkfslabel=[%s]\n", mkfslabel); msgprintf(MSG_VERB2, "filesystem_mkfsuuid=[%s]\n", mkfsuuid); msgprintf(MSG_VERB2, "filesystem_space_total=[%s]\n", format_size(fsbytestotal, text, sizeof(text), 'h')); msgprintf(MSG_VERB2, "filesystem_space_used=[%s]\n", format_size(fsbytesused, text, sizeof(text), 'h')); // get index of the filesystem in the filesystem table if (generic_get_fstype(filesystem, &fstype)!=0) { errprintf("filesystem [%s] is not supported by fsarchiver\n", filesystem); return -1; } // ---- make the filesystem if (filesys[fstype].mkfs(dicofs, partition, mkfsoptions, mkfslabel, mkfsuuid)!=0) { errprintf("cannot make filesystem %s on partition %s\n", filesystem, partition); return -1; } // ---- mount the new filesystem mkdir_recursive(mntbuf); generate_random_tmpdir(mntbuf, sizeof(mntbuf), 0); mkdir_recursive(mntbuf); if ((dico_get_string(dicofs, 0, FSYSHEADKEY_MOUNTINFO, mountinfo, sizeof(mountinfo)))<0) memset(mountinfo, 0, sizeof(mountinfo)); msgprintf(MSG_VERB1, "Mount information: [%s]\n", mountinfo); if (filesys[fstype].mount(partition, mntbuf, filesys[fstype].name, 0, mountinfo)!=0) { errprintf("partition [%s] cannot be mounted on %s. cannot continue.\n", partition, mntbuf); return -1; } if (extractar_extract_read_objects(exar, &errors, mntbuf, fstype)!=0) { msgprintf(MSG_STACK, "extract_read_objects(%s) failed\n", mntbuf); ret=-1; goto filesystem_extract_umount; } else if (errors>0) { msgprintf(MSG_DEBUG1, "extract_read_objects(%s) worked with errors\n", mntbuf); ret=-1; goto filesystem_extract_umount; } // read "end of file-system" header from archive if (queue_dequeue_header(&g_queue, &dicoend, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed\n"); ret=-1; goto filesystem_extract_umount; } dico_destroy(dicoend); if ((get_interrupted()==false) && (memcmp(magic, FSA_MAGIC_DATF, FSA_SIZEOF_MAGIC)!=0)) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_DATF); goto filesystem_extract_umount; } filesystem_extract_umount: if (filesys[fstype].umount(partition, mntbuf)!=0) { sysprintf("cannot umount %s\n", mntbuf); ret=-1; } else { rmdir(mntbuf); // remove temp dir created by fsarchiver } return ret; } int oper_restore(char *archive, int argc, char **argv, int oper) { cdico *dicofsinfo[FSA_MAX_FSPERARCH]; cstrdico *dicoargv[FSA_MAX_FSPERARCH]; pthread_t thread_decomp[FSA_MAX_COMPJOBS]; char magic[FSA_SIZEOF_MAGIC+1]; cdico *dicomainhead=NULL; cdico *dirsinfo=NULL; pthread_t thread_reader; struct stat64 st; char *destdir; cextractar exar; u64 totalerr=0; u64 fscost; u64 curver; int errors=0; int ret=0; int i; // init memset(&exar, 0, sizeof(exar)); exar.cost_global=0; exar.cost_current=0; archreader_init(&exar.ai); // init misc data struct to zero for (i=0; i 0) { msgprintf(MSG_VERB2, "Current fsarchiver version: %d.%d.%d.%d\n", (int)FSA_VERSION_GET_A(curver), (int)FSA_VERSION_GET_B(curver), (int)FSA_VERSION_GET_C(curver), (int)FSA_VERSION_GET_D(curver)); msgprintf(MSG_VERB2, "Minimum fsarchiver version for that archive: %d.%d.%d.%d\n", (int)FSA_VERSION_GET_A(exar.ai.minfsaver), (int)FSA_VERSION_GET_B(exar.ai.minfsaver), (int)FSA_VERSION_GET_C(exar.ai.minfsaver), (int)FSA_VERSION_GET_D(exar.ai.minfsaver)); } if (((oper==OPER_RESTFS) || (oper==OPER_RESTDIR)) && (curver < exar.ai.minfsaver)) { errprintf("This archive can only be restored with fsarchiver %d.%d.%d.%d or more recent\n", (int)FSA_VERSION_GET_A(exar.ai.minfsaver), (int)FSA_VERSION_GET_B(exar.ai.minfsaver), (int)FSA_VERSION_GET_C(exar.ai.minfsaver), (int)FSA_VERSION_GET_D(exar.ai.minfsaver)); goto do_extract_error; } // show archive information if command is OPER_ARCHINFO if (oper==OPER_ARCHINFO && archinfo_show_mainhead(&exar.ai, dicomainhead)!=0) { errprintf("archinfo_show_mainhead(%s) failed\n", archive); goto do_extract_error; } // check that the operation requested on the command line matches the archive type switch (exar.ai.archtype) { case ARCHTYPE_DIRECTORIES: if (oper==OPER_RESTFS) { errprintf("this archive does not contain filesystems, cannot use \"restfs\". Try \"restdir\" instead.\n"); goto do_extract_error; } break; case ARCHTYPE_FILESYSTEMS: if (oper==OPER_RESTDIR) { errprintf("this archive does not contain simple directories, cannot use \"restdir\". Try \"restfs\" instead.\n"); goto do_extract_error; } break; default: errprintf("this archive has an unknown type: %d, cannot continue\n", exar.ai.archtype); goto do_extract_error; } // check the user did not specify an invalid filesystem id (id >= fscount) for (i=0; (i= exar.ai.fscount)) { errprintf("invalid filesystem id: [%d]. the filesystem id must be an integer between 0 and %d\n", (int)i, (int)(exar.ai.fscount-1)); goto do_extract_error; } } // read the fsinfo header for each filesystem for (i=0; (exar.ai.archtype==ARCHTYPE_FILESYSTEMS) && (i < exar.ai.fscount) && (i= 0.6.7 // so that they don't have error when they try to restore an archive which has that header if ((exar.ai.archtype==ARCHTYPE_DIRECTORIES) && (exar.ai.hasdirsinfohead==true)) { if (queue_dequeue_header(&g_queue, &dirsinfo, magic, NULL)<=0) { errprintf("queue_dequeue_header() failed: cannot read the dirsinfo header\n"); goto do_extract_error; } if (memcmp(magic, FSA_MAGIC_DIRS, FSA_SIZEOF_MAGIC)!=0) { errprintf("header is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_DIRS); goto do_extract_error; } if ((dirsinfo!=NULL) && (dico_get_u64(dirsinfo, 0, DIRSINFOKEY_TOTALCOST, &exar.cost_global)!=0)) { errprintf("cannot read DIRSINFOKEY_TOTALCOST in dirsinfo\n"); goto do_extract_error; } } if ((oper==OPER_RESTFS) || (oper==OPER_RESTDIR)) { if ((exar.ai.cryptalgo!=ENCRYPT_NONE) && (g_options.encryptalgo!=ENCRYPT_BLOWFISH)) { errprintf("this archive has been encrypted, you have to provide a password on the command line using option '-c'\n"); goto do_extract_error; } if (exar.ai.archtype==ARCHTYPE_FILESYSTEMS) { // extract filesystem contents for (i=0; (i < exar.ai.fscount) && (i < FSA_MAX_FSPERARCH) && (get_abort()==false); i++) { if (dicoargv[i]!=NULL) // that filesystem has been requested on the command line { exar.fsid=i; memset(&exar.stats, 0, sizeof(exar.stats)); // init stats to zero msgprintf(MSG_VERB1, "============= extracting filesystem %d =============\n", i); if (extractar_filesystem_extract(&exar, dicofsinfo[i], dicoargv[i])!=0) { msgprintf(MSG_STACK, "extract_filesystem(%d) failed\n", i); goto do_extract_error; } if (get_abort()==false) stats_show(exar.stats, i); totalerr+=stats_errcount(exar.stats); } // else: the thread_archio automatically skips filesystem when g_fsbitmap[fsid]==0 } } else if (exar.ai.archtype==ARCHTYPE_DIRECTORIES) { exar.fsid=0; destdir=argv[0]; if (stat64(destdir, &st)!=0) { switch (errno) { case ENOENT: sysprintf("%s does not exist, cannot continue\n", destdir); break; default: sysprintf("fstat64(%s) failed\n", destdir); break; } goto do_extract_error; } if (!S_ISDIR(st.st_mode)) { errprintf("%s is not a valid directory, cannot continue\n", destdir); goto do_extract_error; } memset(&exar.stats, 0, sizeof(exar.stats)); // init stats to zero if (extractar_extract_read_objects(&exar, &errors, destdir, 0)!=0) // TODO: get the right fstype { errprintf("extract_read_objects(%s) failed\n", destdir); goto do_extract_error; } stats_show(exar.stats, 0); totalerr+=stats_errcount(exar.stats); } else { errprintf("unsupported archtype: %d\n", exar.ai.archtype); goto do_extract_error; } } if (get_abort()==true) msgprintf(MSG_FORCE, "operation aborted by user\n"); if (get_abort()==false && get_stopfillqueue()==false) goto do_extract_success; do_extract_error: msgprintf(MSG_DEBUG1, "THREAD-MAIN2: exit error\n"); ret=-1; do_extract_success: msgprintf(MSG_DEBUG1, "THREAD-MAIN2: exit\n"); set_stopfillqueue(); // ask thread-archio to terminate msgprintf(MSG_DEBUG2, "queue_count_items_todo(&g_queue)=%d\n", (int)queue_count_items_todo(&g_queue)); while (queue_count_items_todo(&g_queue)>0) // let thread_compress process all the pending blocks { msgprintf(MSG_DEBUG2, "queue_count_items_todo(): %ld\n", (long)queue_count_items_todo(&g_queue)); usleep(10000); } msgprintf(MSG_DEBUG2, "queue_count_items_todo(&g_queue)=%d\n", (int)queue_count_items_todo(&g_queue)); // now we are sure that thread_compress is not working on an item in the queue so we can empty the queue while (get_secthreads()>0 && queue_get_end_of_queue(&g_queue)==false) queue_destroy_first_item(&g_queue); msgprintf(MSG_DEBUG1, "THREAD-MAIN2: queue is now empty\n"); // the queue is empty, so thread_compress should now exit for (i=0; (i0) ret=-1; dico_destroy(dicomainhead); archreader_destroy(&exar.ai); return ret; } fsarchiver-0.8.6/src/archinfo.c0000644000175000017500000001303213655317102013330 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "archinfo.h" #include "archreader.h" #include "error.h" char *compalgostr(int algo) { switch (algo) { case COMPRESS_NONE: return "none"; case COMPRESS_LZO: return "lzo"; case COMPRESS_GZIP: return "gzip"; case COMPRESS_BZIP2: return "bzip2"; case COMPRESS_LZMA: return "lzma"; case COMPRESS_LZ4: return "lz4"; case COMPRESS_ZSTD: return "zstd"; default: return "unknown"; } } char *cryptalgostr(int algo) { switch (algo) { case ENCRYPT_NONE: return "none"; case ENCRYPT_BLOWFISH: return "blowfish"; default: return "unknown"; } } int archinfo_show_mainhead(carchreader *ai, cdico *dicomainhead) { char buffer[256]; if (!ai || !dicomainhead) { errprintf("a parameter is null\n"); return -1; } msgprintf(MSG_FORCE, "====================== archive information ======================\n"); msgprintf(MSG_FORCE, "Archive type: \t\t\t%s\n", (ai->archtype==ARCHTYPE_FILESYSTEMS)?"filesystems":"flat files"); if ((ai->archtype==ARCHTYPE_FILESYSTEMS)) msgprintf(0, "Filesystems count: \t\t%ld\n", (long)ai->fscount); msgprintf(MSG_FORCE, "Archive id: \t\t\t%.8x\n", (unsigned int)ai->archid); msgprintf(MSG_FORCE, "Archive file format: \t\t%s\n", ai->filefmt); msgprintf(MSG_FORCE, "Archive created with: \t\t%s\n", ai->creatver); msgprintf(MSG_FORCE, "Archive creation date: \t\t%s\n", format_time(buffer, sizeof(buffer), ai->creattime)); msgprintf(MSG_FORCE, "Archive label: \t\t\t%s\n", ai->label); if (ai->minfsaver > 0) // fsarchiver < 0.6.7 had no per-archive minfsaver version requirement msgprintf(MSG_FORCE, "Minimum fsarchiver version:\t%d.%d.%d.%d\n", (int)FSA_VERSION_GET_A(ai->minfsaver), (int)FSA_VERSION_GET_B(ai->minfsaver), (int)FSA_VERSION_GET_C(ai->minfsaver), (int)FSA_VERSION_GET_D(ai->minfsaver)); msgprintf(MSG_FORCE, "Compression level: \t\t%d (%s level %d)\n", ai->fsacomp, compalgostr(ai->compalgo), ai->complevel); msgprintf(MSG_FORCE, "Encryption algorithm: \t\t%s\n", cryptalgostr(ai->cryptalgo)); msgprintf(MSG_FORCE, "\n"); return 0; } int archinfo_show_fshead(cdico *dicofshead, int fsid) { char magic[FSA_SIZEOF_MAGIC+1]; char fsbuf[FSA_MAX_FSNAMELEN]; u32 temp32; u64 temp64; u64 fsbytestotal; u64 fsbytesused; char buffer[256]; char fslabel[256]; char fsuuid[256]; char fsorigdev[256]; // init memset(magic, 0, sizeof(magic)); if (!dicofshead) { errprintf("dicofshead is null\n"); return -1; } if (dico_get_data(dicofshead, 0, FSYSHEADKEY_FILESYSTEM, fsbuf, sizeof(fsbuf), NULL)!=0) { errprintf("cannot find FSYSHEADKEY_FILESYSTEM in filesystem-header\n"); return -1; } if (dico_get_u64(dicofshead, 0, FSYSHEADKEY_BYTESTOTAL, &fsbytestotal)!=0) { errprintf("cannot find FSYSHEADKEY_BYTESTOTAL in filesystem-header\n"); return -1; } if (dico_get_u64(dicofshead, 0, FSYSHEADKEY_BYTESUSED, &fsbytesused)!=0) { errprintf("cannot find FSYSHEADKEY_BYTESUSED in filesystem-header\n"); return -1; } if (dico_get_string(dicofshead, 0, FSYSHEADKEY_FSLABEL, fslabel, sizeof(fslabel))<0) snprintf(fslabel, sizeof(fslabel), ""); if (dico_get_string(dicofshead, 0, FSYSHEADKEY_ORIGDEV, fsorigdev, sizeof(fsorigdev))<0) snprintf(fsorigdev, sizeof(fsorigdev), ""); // filesystem uuid: maybe an ntfs uuid, fat serial or an unix uuid snprintf(fsuuid, sizeof(fsuuid), ""); if (dico_get_u64(dicofshead, 0, FSYSHEADKEY_NTFSUUID, &temp64)==0) snprintf(fsuuid, sizeof(fsuuid), "%016llX", (long long unsigned int)temp64); else if (dico_get_u32(dicofshead, 0, FSYSHEADKEY_FSVFATSERIAL, &temp32)==0) snprintf(fsuuid, sizeof(fsuuid), "%08lX", (long unsigned int)temp32); else if (dico_get_string(dicofshead, 0, FSYSHEADKEY_FSUUID, buffer, sizeof(buffer))==0 && strlen(buffer)==36) snprintf(fsuuid, sizeof(fsuuid), "%s", buffer); msgprintf(MSG_FORCE, "===================== filesystem information ====================\n"); msgprintf(MSG_FORCE, "Filesystem id in archive: \t%ld\n", (long)fsid); msgprintf(MSG_FORCE, "Filesystem format: \t\t%s\n", fsbuf); msgprintf(MSG_FORCE, "Filesystem label: \t\t%s\n", fslabel); msgprintf(MSG_FORCE, "Filesystem uuid: \t\t%s\n", fsuuid); msgprintf(MSG_FORCE, "Original device: \t\t%s\n", fsorigdev); msgprintf(MSG_FORCE, "Original filesystem size: \t%s (%lld bytes)\n", format_size(fsbytestotal, buffer, sizeof(buffer), 'h'), (long long)fsbytestotal); msgprintf(MSG_FORCE, "Space used in filesystem: \t%s (%lld bytes)\n", format_size(fsbytesused, buffer, sizeof(buffer), 'h'), (long long)fsbytesused); msgprintf(MSG_FORCE, "\n"); return 0; } fsarchiver-0.8.6/src/datafile.c0000644000175000017500000001133113655317102013310 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include "fsarchiver.h" #include "datafile.h" #include "common.h" #include "error.h" struct s_datafile { int fd; // file descriptor bool simul; // simulation: don't write anything if true bool open; // true when file is open even if simulation bool sparse; // true if that's a sparse file char path[PATH_MAX]; // path to file gcry_md_hd_t md5ctx; // struct for md5 }; cdatafile *datafile_alloc() { cdatafile *f; if ((f=malloc(sizeof(cdatafile)))==NULL) return NULL; f->path[0]=0; f->fd=-1; f->simul=false; f->open=false; f->sparse=false; return f; } int datafile_destroy(cdatafile *f) { assert(f); if (f->open) datafile_close(f, NULL, 0); free(f); return 0; } int datafile_open_write(cdatafile *f, char *path, bool simul, bool sparse) { assert(f); if (f->open) { errprintf("File is already open\n"); return -1; } if (simul==false) { errno=0; if ((f->fd=open64(path, O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0) { if (errno==ENOSPC) { sysprintf("can't write file [%s]: no space left on device\n", path); return -1; // fatal error } else { sysprintf("Cannot open %s for writing\n", path); return -1; } } } if (gcry_md_open(&f->md5ctx, GCRY_MD_MD5, 0) != GPG_ERR_NO_ERROR) { errprintf("gcry_md_open() failed\n"); return -1; } snprintf(f->path, PATH_MAX, "%s", path); f->simul=simul; f->open=true; f->sparse=sparse; return 0; } int datafile_is_block_zero(cdatafile *f, char *data, u64 len) { bool zero=true; u64 pos; for (pos=0; (posopen) { errprintf("File is not open\n"); return FSAERR_NOTOPEN; } if (f->simul==false) { if ((f->sparse==true) && (datafile_is_block_zero(f, data, len))) { if (lseek64(f->fd, len, SEEK_CUR)<0) { sysprintf("Can't lseek64() in file [%s]\n", f->path); return FSAERR_SEEK; } } else { errno=0; if ((lres=write(f->fd, data, len))!=len) // error { if ((errno==ENOSPC) || ((lres>0) && (lres < len))) { sysprintf("Can't write file [%s]: no space left on device\n", f->path); return FSAERR_ENOSPC; } else // another error { sysprintf("cannot write %s: size=%ld\n", f->path, (long)len); return FSAERR_WRITE; } } } } gcry_md_write(f->md5ctx, data, len); return FSAERR_SUCCESS; } int datafile_close(cdatafile *f, u8 *md5bufdat, int md5bufsize) { char md5store[16]; u8 *md5tmp; int res=0; assert(f); if (!f->open) { errprintf("File is not open\n"); return -1; } if ((md5tmp=gcry_md_read(f->md5ctx, GCRY_MD_MD5))==NULL) { errprintf("gcry_md_read() failed\n"); return -1; } memcpy(md5store, md5tmp, 16); gcry_md_close(f->md5ctx); if (md5bufdat!=NULL) { if (md5bufsize < 16) { errprintf("Buffer too small for md5 checksum\n"); return -1; } memcpy(md5bufdat, md5store, 16); } if ((f->open==true) && (f->simul==false)) { if ((f->sparse==true) && (ftruncate(f->fd, lseek64(f->fd, 0, SEEK_CUR))<0)) { sysprintf("ftruncate() failed for file [%s]\n", f->path); res=-1; } res=min(close(f->fd), res); } f->open=false; f->path[0]=0; f->fd=-1; return res; } fsarchiver-0.8.6/src/fs_xfs.c0000644000175000017500000004255314014417710013035 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "fs_xfs.h" #include "filesys.h" #include "strlist.h" #include "error.h" // POSIX Extended Regular Expression to match RHEL 7 kernel releases #define RHEL7_KERNEL_ERE "[[:digit:]]+\\.el7(uek)?\\." int xfs_check_compatibility(u64 compat, u64 ro_compat, u64 incompat, u64 log_incompat) { int errors=0; msgprintf(MSG_DEBUG1, "xfs features: compat=[%ld]\n", (long)compat); msgprintf(MSG_DEBUG1, "xfs features: ro_compat=[%ld]\n", (long)ro_compat); msgprintf(MSG_DEBUG1, "xfs features: incompat=[%ld]\n", (long)incompat); msgprintf(MSG_DEBUG1, "xfs features: log_incompat=[%ld]\n", (long)log_incompat); // to preserve the filesystem attributes, fsa must know all the features including the COMPAT ones if (compat & ~FSA_XFS_FEATURE_COMPAT_SUPP) errors++; if (ro_compat & ~FSA_XFS_FEATURE_RO_COMPAT_SUPP) errors++; if (incompat & ~FSA_XFS_FEATURE_INCOMPAT_SUPP) errors++; if (log_incompat & ~FSA_XFS_FEATURE_LOG_INCOMPAT_SUPP) errors++; if (errors > 0) { errprintf("this filesystem has XFS features which are not supported by this fsarchiver version.\n"); return -1; } else { return 0; } } int xfs_mkfs(cdico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid) { char stdoutbuf[2048]; char command[2048]; char buffer[2048]; char mkfsopts[2048]; char xadmopts[2048]; char uuid[64]; u64 xfstoolsver; int exitst; u64 temp64; u64 xfsver; int x, y, z; int optval; u64 sb_features_compat=0; u64 sb_features_ro_compat=0; u64 sb_features_incompat=0; u64 sb_features_log_incompat=0; // ---- check that mkfs is installed and get its version if (exec_command(command, sizeof(command), NULL, stdoutbuf, sizeof(stdoutbuf), NULL, 0, "mkfs.xfs -V")!=0) { errprintf("mkfs.xfs not found. please install xfsprogs on your system or check the PATH.\n"); return -1; } x=y=z=0; sscanf(stdoutbuf, "mkfs.xfs version %d.%d.%d", &x, &y, &z); if (x==0 && y==0) { errprintf("Can't parse mkfs.xfs version number: x=y=0\n"); return -1; } xfstoolsver=PROGVER(x,y,z); msgprintf(MSG_VERB2, "Detected mkfs.xfs version %d.%d.%d\n", x, y, z); memset(mkfsopts, 0, sizeof(mkfsopts)); memset(xadmopts, 0, sizeof(xadmopts)); memset(uuid, 0, sizeof(uuid)); if (strlen(mkfslabel) > 0) strlcatf(mkfsopts, sizeof(mkfsopts), " -L '%.12s' ", mkfslabel); else if (dico_get_string(d, 0, FSYSHEADKEY_FSLABEL, buffer, sizeof(buffer))==0 && strlen(buffer)>0) strlcatf(mkfsopts, sizeof(mkfsopts), " -L '%.12s' ", buffer); if ((dico_get_u64(d, 0, FSYSHEADKEY_FSXFSBLOCKSIZE, &temp64)==0) && (temp64%512==0) && (temp64>=512) && (temp64<=65536)) strlcatf(mkfsopts, sizeof(mkfsopts), " -b size=%ld ", (long)temp64); // ---- get xfs features attributes from the archive dico_get_u64(d, 0, FSYSHEADKEY_FSXFSFEATURECOMPAT, &sb_features_compat); dico_get_u64(d, 0, FSYSHEADKEY_FSXFSFEATUREROCOMPAT, &sb_features_ro_compat); dico_get_u64(d, 0, FSYSHEADKEY_FSXFSFEATUREINCOMPAT, &sb_features_incompat); dico_get_u64(d, 0, FSYSHEADKEY_FSXFSFEATURELOGINCOMPAT, &sb_features_log_incompat); // ---- check fsarchiver is aware of all the filesystem features used on that filesystem if (xfs_check_compatibility(sb_features_compat, sb_features_ro_compat, sb_features_incompat, sb_features_log_incompat)!=0) return -1; // Preserve XFS V4 if the original filesystem was V4 or if it was saved with // fsarchiver <= 0.6.19 which does not store the version in the metadata: // create XFS V4 if unsure for better compatibility if ((dico_get_u64(d, 0, FSYSHEADKEY_FSXFSVERSION, &temp64)!=0) || (temp64==XFS_SB_VERSION_4)) xfsver = XFS_SB_VERSION_4; else xfsver = XFS_SB_VERSION_5; // Unfortunately it is impossible to preserve XFS V5 UUID (stamped on every metadata // block) with mkfs.xfs < 4.3.0. Restoring with a new random UUID could prevent the // system from booting if this is a boot/root filesystem because grub/fstab often // use UUID to identify it. Hence it is much safer restore as XFS V4 in this case. // More details: https://github.com/fdupoux/fsarchiver/issues/4 if ((xfsver==XFS_SB_VERSION_5) && (xfstoolsver < PROGVER(4,3,0))) { xfsver = XFS_SB_VERSION_4; // Do not preserve the XFS version msgprintf(MSG_FORCE, "It is impossible to restore this filesystem as XFS V5 and preserve its UUID\n" "with mkfs.xfs < 4.3.0. This filesystem will be restored as XFS V4 instead\n" "as this is a much safer option (preserving the UUID may be required on\n" "boot/root filesystems for the operating system to be able to start). If you\n" "really need XFS V5, please upgrade xfsprogs to version 4.3.0 or more recent\n" "and rerun this operation\n"); } // Determine if the "crc" mkfs option should be enabled (checksum) // - checksum must be disabled if we want to recreate XFS V4 filesystem // - checksum must be enabled if we want to recreate XFS V5 filesystem if (xfstoolsver >= PROGVER(3,2,0)) // only use "crc" option when it is supported by mkfs { optval = (xfsver==XFS_SB_VERSION_5); strlcatf(mkfsopts, sizeof(mkfsopts), " -m crc=%d ", (int)optval); } // Determine if the "finobt" mkfs option should be enabled (free inode btree) // - starting with linux-3.16 XFS has added a btree that tracks free inodes // - this feature relies on the V5 on-disk format but it is optional // - this feature is enabled by default when using xfsprogs-3.2.3 or later // - this feature will be enabled if the original filesystem was XFS V5 and had it if (xfstoolsver >= PROGVER(3,2,1)) // only use "finobt" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT)); strlcatf(mkfsopts, sizeof(mkfsopts), " -m finobt=%d ", (int)optval); } // Determine if the "rmapbt" mkfs option should be enabled (reverse mapping btree) // - starting with linux-4.8 XFS has added a btree that maps filesystem blocks to // their owner // - this feature relies on the V5 on-disk format but it is optional // - this feature will be enabled if the original filesystem was XFS V5 and had it if (xfstoolsver >= PROGVER(4,8,0)) // only use "rmapbt" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_RMAPBT)); strlcatf(mkfsopts, sizeof(mkfsopts), " -m rmapbt=%d ", (int)optval); } // Determine if the "reflink" mkfs option should be enabled // - starting with linux-4.9 XFS has added support for reflinked files // - this feature relies on the V5 on-disk format but it is optional // - this feature is enabled by default when using xfsprogs-5.1.0 or later // - this feature will be enabled if the original filesystem was XFS V5 and had it if (xfstoolsver >= PROGVER(4,9,0)) // only use "reflink" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_REFLINK)); strlcatf(mkfsopts, sizeof(mkfsopts), " -m reflink=%d ", (int)optval); } // Determine if the "inobtcount" mkfs option should be enabled (inobt block counts) // - starting with linux-5.10 XFS has added block usage counters for inode btrees // to reduce mount times // - this optional feature relies on the V5 on-disk format and on the "finobt" // (free inode btree) mkfs option being enabled // - this feature will be enabled if the original filesystem was XFS V5 and had it if (xfstoolsver >= PROGVER(5,10,0)) // only use "inobtcount" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_INOBTCNT)); strlcatf(mkfsopts, sizeof(mkfsopts), " -m inobtcount=%d ", (int)optval); } // Determine if the "bigtime" mkfs option should be enabled (large timestamps) // - starting with linux-5.10 XFS has added support for larger inode timestamps, beyond january 2038 // - this feature relies on the V5 on-disk format but it is optional // - this feature will be enabled if the original filesystem was XFS V5 and had it if (xfstoolsver >= PROGVER(5,10,0)) // only use "bigtime" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_incompat & XFS_SB_FEAT_INCOMPAT_BIGTIME)); strlcatf(mkfsopts, sizeof(mkfsopts), " -m bigtime=%d ", (int)optval); } // Attempt to preserve filesystem UUID // - mkfs.xfs' "-m uuid=" option was added in version 4.3.0 and is the best way to set UUID // - XFS V4 UUID can be successfully set using either xfs_admin or mkfs.xfs >= 4.3.0 // - XFS V5 UUID, on the other hand, can't be set by xfs_admin without enabling a superblock // incompat flag which bumps minimal kernel version to linux-4.3 and sets two different UUIDs // in the filesystem: user-visible and metadata. For this reason XFS version is forced to V4 // if xfsprogs < 4.3.0 if (strlen(mkfsuuid) > 0) snprintf(uuid, sizeof(uuid), "%s", mkfsuuid); else if (dico_get_string(d, 0, FSYSHEADKEY_FSUUID, buffer, sizeof(buffer))==0) snprintf(uuid, sizeof(uuid), "%s", buffer); if (strlen(uuid)==36) { if (xfstoolsver >= PROGVER(4,3,0)) strlcatf(mkfsopts, sizeof(mkfsopts), " -m uuid=%s ", uuid); else strlcatf(xadmopts, sizeof(xadmopts), " -U %s ", uuid); } // Determine if the "ftype" mkfs option should be enabled (filetype in dirent) // - this feature allows the inode type to be stored in the directory structure // - this feature is madatory on XFS V5 (always enabled) but it is optional on XFS V4 // - mkfs.xfs 4.2.0 enabled it by default on XFS V4 filesystems // - the "ftype" option must be specified after the "crc" option in mkfs.xfs < 4.2.0: // https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/commit/?id=b990de8ba4e2df2bc76a140799d3ddb4a0eac4ce // - do not set ftype=1 with crc=1 as mkfs.xfs may fail (at least with xfsprogs-3.2.2) // - XFS V4 with ftype=1 is supported since linux-3.13. We purposely always disable it // on V4 filesystems to keep them compatible with older kernels if (xfstoolsver >= PROGVER(3,2,0)) // only use "ftype" option when it is supported by mkfs { // ftype is already set to 1 when it is XFS V5 if (xfsver==XFS_SB_VERSION_4) strlcatf(mkfsopts, sizeof(mkfsopts), " -n ftype=0 "); } // Determine if the "sparse" mkfs option should be enabled (sparse inode allocation) // - starting with linux-4.2 XFS can allocate discontinuous inode chunks // - this feature relies on the V5 on-disk format but it is optional // - this feature is enabled by default when using xfsprogs-4.16.0 or later // - this feature will be enabled if the original filesystem was XFS V5 and had it // - this feature is supported since mkfs.xfs 4.2.0 // - mkfs.xfs 4.5.0 in RHEL 7.3 carries a custom patch removing the option if (xfstoolsver >= PROGVER(4,2,0) && !match_uname_r(RHEL7_KERNEL_ERE)) // only use "sparse" option when it is supported by mkfs { optval = ((xfsver==XFS_SB_VERSION_5) && (sb_features_incompat & XFS_SB_FEAT_INCOMPAT_SPINODES)); strlcatf(mkfsopts, sizeof(mkfsopts), " -i sparse=%d ", (int)optval); } // ---- mkfsopt from command line strlcatf(mkfsopts, sizeof(mkfsopts), " %s ", fsoptions); // ---- create the new filesystem using mkfs.xfs if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "mkfs.xfs -f %s %s", mkfsopts, partition)!=0 || exitst!=0) { errprintf("command [%s] failed\n", command); return -1; } // ---- use xfs_admin to set the UUID if not already done with mkfs.xfs if (xadmopts[0]) { if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "xfs_admin %s %s", xadmopts, partition)!=0 || exitst!=-0) { errprintf("command [%s] failed\n", command); return -1; } } return 0; } int xfs_getinfo(cdico *d, char *devname) { struct xfs_sb sb; char uuid[512]; u64 xfsver; u32 temp32; int ret=0; int fd; int res; u64 sb_features_compat=0; u64 sb_features_ro_compat=0; u64 sb_features_incompat=0; u64 sb_features_log_incompat=0; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { ret=-1; goto xfs_read_sb_return; } res=read(fd, &sb, sizeof(sb)); if (res!=sizeof(sb)) { ret=-1; goto xfs_read_sb_close; } // ---- check it's an XFS file system if (be32_to_cpu(sb.sb_magicnum) != XFS_SB_MAGIC) { ret=-1; msgprintf(3, "sb.sb_magicnum!=XFS_SB_MAGIC\n"); goto xfs_read_sb_close; } // ---- check XFS filesystem version xfsver=be16_to_cpu(sb.sb_versionnum) & XFS_SB_VERSION_NUMBITS; switch (xfsver) { case XFS_SB_VERSION_4: case XFS_SB_VERSION_5: msgprintf(MSG_DEBUG1, "Detected XFS filesystem version %d\n", (int)xfsver); dico_add_u64(d, 0, FSYSHEADKEY_FSXFSVERSION, xfsver); break; default: ret=-1; msgprintf(MSG_STACK, "Invalid XFS filesystem version: version=[%d]\n", (int)xfsver); goto xfs_read_sb_close; break; } // ---- label msgprintf(MSG_DEBUG1, "xfs_label=[%s]\n", sb.sb_fname); dico_add_string(d, 0, FSYSHEADKEY_FSLABEL, (char*)sb.sb_fname); // ---- uuid /*if ((str=e2p_uuid2str(&sb.sb_uuid))!=NULL) dico_add_string(d, 0, FSYSHEADKEY_FSUUID, str);*/ memset(uuid, 0, sizeof(uuid)); uuid_unparse_lower((u8*)&sb.sb_uuid, uuid); dico_add_string(d, 0, FSYSHEADKEY_FSUUID, uuid); msgprintf(MSG_DEBUG1, "xfs_uuid=[%s]\n", uuid); // ---- block size temp32=be32_to_cpu(sb.sb_blocksize); if ((temp32%512!=0) || (temp32<512) || (temp32>65536)) { ret=-1; msgprintf(3, "xfs_blksize=[%ld] is an invalid xfs block size\n", (long)temp32); goto xfs_read_sb_close; } dico_add_u64(d, 0, FSYSHEADKEY_FSXFSBLOCKSIZE, temp32); msgprintf(MSG_DEBUG1, "xfs_blksize=[%ld]\n", (long)temp32); // ---- get filesystem features (will all be set to 0 if this is XFS V4) if (xfsver == XFS_SB_VERSION_5) { sb_features_compat=be32_to_cpu(sb.sb_features_compat); sb_features_ro_compat=be32_to_cpu(sb.sb_features_ro_compat); sb_features_incompat=be32_to_cpu(sb.sb_features_incompat); sb_features_log_incompat=be32_to_cpu(sb.sb_features_log_incompat); } // ---- check fsarchiver is aware of all the filesystem features used on that filesystem if (xfs_check_compatibility(sb_features_compat, sb_features_ro_compat, sb_features_incompat, sb_features_log_incompat)!=0) return -1; // ---- store features in the archive metadata dico_add_u64(d, 0, FSYSHEADKEY_FSXFSFEATURECOMPAT, (u64)sb_features_compat); dico_add_u64(d, 0, FSYSHEADKEY_FSXFSFEATUREROCOMPAT, (u64)sb_features_ro_compat); dico_add_u64(d, 0, FSYSHEADKEY_FSXFSFEATUREINCOMPAT, (u64)sb_features_incompat); dico_add_u64(d, 0, FSYSHEADKEY_FSXFSFEATURELOGINCOMPAT, (u64)sb_features_log_incompat); // ---- minimum fsarchiver version required to restore dico_add_u64(d, 0, FSYSHEADKEY_MINFSAVERSION, FSA_VERSION_BUILD(0, 6, 20, 0)); xfs_read_sb_close: close(fd); xfs_read_sb_return: return ret; } int xfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo) { return generic_mount(partition, mntbuf, fsbuf, "nouuid", flags); } int xfs_umount(char *partition, char *mntbuf) { return generic_umount(mntbuf); } int xfs_test(char *devname) { struct xfs_sb sb; int fd; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { msgprintf(MSG_DEBUG1, "open64(%s) failed\n", devname); return false; } memset(&sb, 0, sizeof(sb)); if (read(fd, &sb, sizeof(sb))!=sizeof(sb)) { close(fd); msgprintf(MSG_DEBUG1, "read failed\n"); return false; } // ---- check it's an XFS file system if (be32_to_cpu(sb.sb_magicnum) != XFS_SB_MAGIC) { close(fd); msgprintf(MSG_DEBUG1, "(be32_to_cpu(sb.sb_magicnum)=%.8x) != (XFS_SB_MAGIC=%.8x)\n", be32_to_cpu(sb.sb_magicnum), XFS_SB_MAGIC); return false; } close(fd); return true; } int xfs_get_reqmntopt(char *partition, cstrlist *reqopt, cstrlist *badopt) { if (!reqopt || !badopt) return -1; return 0; } fsarchiver-0.8.6/src/regmulti.h0000644000175000017500000000370013655317102013375 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __REGMULTI_H__ #define __REGMULTI_H__ struct s_dico; struct s_queue; struct s_regmulti; typedef struct s_regmulti cregmulti; struct s_regmulti { // common u32 count; // how many small files are in this struct u32 maxitems; // how many small files that struct can contains u32 maxblksize; // maximum size of a data block // linked list of headers struct s_dico *objhead[FSA_MAX_SMALLFILECOUNT]; // worst case: each file is just one byte: this is how many files we can store in the block // common block to be compressed char data[FSA_MAX_BLKSIZE]; u32 usedsize; // how many bytes are used in data }; int regmulti_empty(cregmulti *m); int regmulti_init(cregmulti *m, u32 maxblksize); int regmulti_count(cregmulti *m, struct s_dico *header, char *data, u32 datsize); bool regmulti_save_enough_space_for_new_file(cregmulti *m, u32 filesize); int regmulti_save_addfile(cregmulti *m, struct s_dico *header, char *data, u32 datsize); int regmulti_save_enqueue(cregmulti *m, struct s_queue *q, int fsid); int regmulti_rest_addheader(cregmulti *m, struct s_dico *header); int regmulti_rest_setdatablock(cregmulti *m, char *data, u32 datsize); int regmulti_rest_getfile(cregmulti *m, int index, struct s_dico **filehead, char *data, u64 *datsize, u32 bufsize); #endif // __REGMULTI_H__ fsarchiver-0.8.6/src/comp_lz4.h0000644000175000017500000000167113655317102013301 00000000000000 /* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2017 Cristian Vazquez. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __COMPRESS_LZ4_H__ #define __COMPRESS_LZ4_H__ #ifdef OPTION_LZ4_SUPPORT #include int compress_block_lz4(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level); int uncompress_block_lz4(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf); #endif // OPTION_LZ4_SUPPORT #endif // __COMPRESS_LZ4_H__ fsarchiver-0.8.6/src/fs_ntfs.h0000644000175000017500000000300113655317102013201 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_NTFS_H__ #define __FS_NTFS_H__ struct s_dico; struct s_strlist; #define NTFS3G_VERSION(year, month, day) ((u64)((((u64)year&0xFFFF)<<48)+(((u64)month&0xFFFF)<<32)+(((u64)day&0xFFFF)<<16))) #define NTFS3G_MINVER_Y 2009 #define NTFS3G_MINVER_M 11 #define NTFS3G_MINVER_D 14 struct s_ntfsinfo { u32 bytes_per_sector; u32 sectors_per_clusters; u32 bytes_per_cluster; u64 uuid; }; int ntfs_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int ntfs_getinfo(struct s_dico *d, char *devname); int ntfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int ntfs_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int ntfs_replace_uuid(char *devname, u64 uuid); int ntfs_umount(char *partition, char *mntbuf); int ntfs_test(char *devname); #endif // __FS_NTFS_H__ fsarchiver-0.8.6/src/comp_lzma.c0000644000175000017500000000757013655317102013532 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "fsarchiver.h" #include "common.h" #include "comp_lzma.h" #include "error.h" #ifdef OPTION_LZMA_SUPPORT #include int compress_block_lzma(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level) { lzma_stream lzma = LZMA_STREAM_INIT; int res; // init lzma structures lzma.next_in = origbuf; lzma.avail_in = origsize; lzma.next_out = compbuf; lzma.avail_out = compbufsize; // Initialize a coder to the lzma_stream if ((res=lzma_easy_encoder(&lzma, level, LZMA_CHECK_CRC32))!=LZMA_OK) { switch (res) { case LZMA_MEM_ERROR: errprintf("lzma_easy_encoder(%d): LZMA compression failed " "with an out of memory error.\nYou should use a lower " "compression level to reduce the memory requirement.\n", level); lzma_end(&lzma); return FSAERR_ENOMEM; default: errprintf("lzma_easy_encoder(%d) failed with res=%d\n", level, res); lzma_end(&lzma); return FSAERR_UNKNOWN; } } if ((res=lzma_code(&lzma, LZMA_RUN))!=LZMA_OK) { errprintf("lzma_code(LZMA_RUN) failed with res=%d\n", res); lzma_end(&lzma); return FSAERR_UNKNOWN; } if ((res=lzma_code(&lzma, LZMA_FINISH))!=LZMA_STREAM_END && res!=LZMA_OK) { errprintf("lzma_code(LZMA_FINISH) failed with res=%d\n", res); lzma_end(&lzma); return FSAERR_UNKNOWN; } *compsize=(u64)(lzma.total_out); lzma_end(&lzma); return FSAERR_SUCCESS; } int uncompress_block_lzma(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf) { lzma_stream lzma = LZMA_STREAM_INIT; u64 maxmemlimit=3ULL*1024ULL*1024ULL*1024ULL; u64 memlimit=96*1024*1024; int res; // init lzma structures lzma.next_in = compbuf; lzma.avail_in = compsize; lzma.next_out = origbuf; lzma.avail_out = origbufsize; // Initialize a coder to the lzma_stream if ((res=lzma_auto_decoder(&lzma, memlimit, 0))!=LZMA_OK) { errprintf("lzma_auto_decoder() failed with res=%d\n", res); lzma_end(&lzma); return FSAERR_UNKNOWN; } do // retry if lzma_code() returns LZMA_MEMLIMIT_ERROR (increase the memory limit) { if ((res=lzma_code(&lzma, LZMA_RUN)) != LZMA_STREAM_END) // if error { if (res == LZMA_MEMLIMIT_ERROR) // we have to raise the memory limit { memlimit+=64*1024*1024; lzma_memlimit_set(&lzma, memlimit); msgprintf(MSG_VERB2, "lzma_memlimit_set(%lld)\n", (long long)memlimit); } else // another error { errprintf("lzma_code(LZMA_RUN) failed with res=%d\n", res); lzma_end(&lzma); return FSAERR_UNKNOWN; } } } while ((res == LZMA_MEMLIMIT_ERROR) && (memlimit < maxmemlimit)); *origsize=(u64)(lzma.total_out); lzma_end(&lzma); switch (res) { case LZMA_STREAM_END: return FSAERR_SUCCESS; case LZMA_MEMLIMIT_ERROR: return FSAERR_ENOMEM; default: return FSAERR_UNKNOWN; } } #endif // OPTION_LZMA_SUPPORT fsarchiver-0.8.6/src/comp_gzip.c0000644000175000017500000000350213655317102013527 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include "fsarchiver.h" #include "common.h" #include "comp_gzip.h" #include "error.h" int compress_block_gzip(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level) { uLong gzsize; Bytef *gzbuffer; gzsize=(uLong)compbufsize; gzbuffer=(Bytef *)compbuf; switch (compress2(gzbuffer, &gzsize, (const Bytef*)origbuf, (uLong)origsize, level)) { case Z_OK: *compsize=(u64)gzsize; return FSAERR_SUCCESS; case Z_MEM_ERROR: return FSAERR_ENOMEM; default: return FSAERR_UNKNOWN; } return FSAERR_UNKNOWN; } int uncompress_block_gzip(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf) { uLong gzsize=(uLong)origbufsize; Bytef *gzbuffer=(Bytef *)origbuf; int res; switch ((res=uncompress(gzbuffer, &gzsize, (const Bytef*)compbuf, (uLong)compsize))) { case Z_OK: *origsize=(u64)gzsize; return FSAERR_SUCCESS; case Z_MEM_ERROR: return FSAERR_ENOMEM; default: errprintf("uncompress() failed, res=%d\n", res); return FSAERR_UNKNOWN; } } fsarchiver-0.8.6/src/writebuf.c0000644000175000017500000001753013655317102013375 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include "fsarchiver.h" #include "writebuf.h" #include "common.h" #include "error.h" #include "queue.h" #include "dico.h" cwritebuf *writebuf_alloc() { cwritebuf *wb; if ((wb=malloc(sizeof(cwritebuf)))==NULL) { errprintf("malloc(%d) failed: cannot allocate memory for writebuf\n", (int)sizeof(cwritebuf)); return NULL; } wb->size=0; wb->data=NULL; return wb; } int writebuf_destroy(cwritebuf *wb) { if (wb==NULL) { errprintf("wb is NULL\n"); return -1; } if (wb->data) { free(wb->data); wb->data=NULL; } wb->size=0; free(wb); return 0; } int writebuf_add_data(cwritebuf *wb, void *data, u64 size) { u64 newsize; if (wb==NULL) { errprintf("wb is NULL\n"); return -1; } if (size==0) { errprintf("size=0\n"); return -1; } newsize=wb->size+size; wb->data=realloc(wb->data, newsize+4); // "+4" required else the last byte of the buffer may be alterred (see release-0.3.3) if (!wb->data) { errprintf("realloc(oldsize=%ld, newsize=%ld) failed\n", (long)wb->size, (long)newsize+4); return -1; } memcpy(wb->data+wb->size, data, size); wb->size+=size; return 0; } int writebuf_add_dico(cwritebuf *wb, cdico *d, char *magic) { struct s_dicoitem *item; int itemnum; u32 headerlen; u32 checksum; u8 *buffer; u8 *bufpos; u16 temp16; u32 temp32; u16 count; if (!wb || !d) { errprintf("a parameter is null\n"); return -1; } // 0. debugging msgprintf(MSG_DEBUG2, "archio_write_dico(wb=%p, dico=%p, magic=[%c%c%c%c])\n", wb, d, magic[0], magic[1], magic[2], magic[3]); for (item=d->head; item!=NULL; item=item->next) if ((item->section==DICO_OBJ_SECTION_STDATTR) && (item->key==DISKITEMKEY_PATH) && (memcmp(magic, "ObJt", 4)==0)) msgprintf(MSG_DEBUG2, "filepath=[%s]\n", item->data); // 1. how many valid items there are count=dico_count_all_sections(d); msgprintf(MSG_DEBUG2, "dico_count_all_sections(dico=%p)=%d\n", d, (int)count); // 2. calculate len of header headerlen=sizeof(u16); // count for (item=d->head; item!=NULL; item=item->next) { headerlen+=sizeof(u8); // type headerlen+=sizeof(u8); // section headerlen+=sizeof(u16); // key headerlen+=sizeof(u16); // data size headerlen+=item->size; // data } msgprintf(MSG_DEBUG2, "calculated headerlen for that dico: headerlen=%d\n", (int)headerlen); // 3. allocate memory for header bufpos=buffer=malloc(headerlen); if (!buffer) { errprintf("cannot allocate memory for buffer"); return -1; } // 4. write items count in buffer temp16=cpu_to_le16(count); msgprintf(MSG_DEBUG2, "mempcpy items count to buffer: u16 count=%d\n", (int)count); bufpos=mempcpy(bufpos, &temp16, sizeof(temp16)); // 5. write all items in buffer for (item=d->head, itemnum=0; item!=NULL; item=item->next, itemnum++) { msgprintf(MSG_DEBUG2, "itemnum=%d (type=%d, section=%d, key=%d, size=%d)\n", (int)itemnum++, (int)item->type, (int)item->section, (int)item->key, (int)item->size); // a. write data type buffer bufpos=mempcpy(bufpos, &item->type, sizeof(item->type)); // b. write section to buffer bufpos=mempcpy(bufpos, &item->section, sizeof(item->section)); // c. write key to buffer temp16=cpu_to_le16(item->key); bufpos=mempcpy(bufpos, &temp16, sizeof(temp16)); // d. write sizeof(data) to buffer temp16=cpu_to_le16(item->size); bufpos=mempcpy(bufpos, &temp16, sizeof(temp16)); // e. write data to buffer if (item->size>0) bufpos=mempcpy(bufpos, item->data, item->size); } msgprintf(MSG_DEBUG2, "all %d items mempcopied to buffer\n", (int)itemnum); // 6. write header-len, header-data, header-checksum temp32=cpu_to_le32(headerlen); if (writebuf_add_data(wb, &temp32, sizeof(temp32))!=0) { free(buffer); return -1; } if (writebuf_add_data(wb, buffer, headerlen)!=0) { free(buffer); return -1; } checksum=fletcher32(buffer, headerlen); temp32=cpu_to_le32(checksum); if (writebuf_add_data(wb, &temp32, sizeof(temp32))!=0) { free(buffer); return -1; } free(buffer); msgprintf(MSG_DEBUG2, "end of archio_write_dico(wb=%p, dico=%p, magic=[%c%c%c%c])\n", wb, d, magic[0], magic[1], magic[2], magic[3]); return 0; } int writebuf_add_header(cwritebuf *wb, cdico *d, char *magic, u32 archid, u16 fsid) { u16 temp16; u32 temp32; if (!wb || !d || !magic) { errprintf("a parameter is null\n"); return -1; } // A. write dico magic string if (writebuf_add_data(wb, magic, FSA_SIZEOF_MAGIC)!=0) { errprintf("writebuf_add_data() failed to write FSA_SIZEOF_MAGIC\n"); return -2; } // B. write archive id temp32=cpu_to_le32(archid); if (writebuf_add_data(wb, &temp32, sizeof(temp32))!=0) { errprintf("writebuf_add_data() failed to write archid\n"); return -3; } // C. write filesystem id temp16=cpu_to_le16(fsid); if (writebuf_add_data(wb, &temp16, sizeof(temp16))!=0) { errprintf("writebuf_add_data() failed to write fsid\n"); return -3; } // D. write the dico of the header if (writebuf_add_dico(wb, d, magic) != 0) { errprintf("archio_write_dico() failed to write the header dico\n"); return -4; } return 0; } int writebuf_add_block(cwritebuf *wb, struct s_blockinfo *blkinfo, u32 archid, u16 fsid) { cdico *blkdico; // header written in file int res; if (!wb || !blkinfo) { errprintf("a parameter is null\n"); return -1; } if ((blkdico=dico_alloc())==NULL) { errprintf("dico_alloc() failed\n"); return -1; } if (blkinfo->blkarsize==0) { errprintf("blkinfo->blkarsize=0: block is empty\n"); return -1; } // prepare header dico_add_u64(blkdico, 0, BLOCKHEADITEMKEY_BLOCKOFFSET, blkinfo->blkoffset); dico_add_u32(blkdico, 0, BLOCKHEADITEMKEY_REALSIZE, blkinfo->blkrealsize); dico_add_u32(blkdico, 0, BLOCKHEADITEMKEY_ARSIZE, blkinfo->blkarsize); dico_add_u32(blkdico, 0, BLOCKHEADITEMKEY_COMPSIZE, blkinfo->blkcompsize); dico_add_u32(blkdico, 0, BLOCKHEADITEMKEY_ARCSUM, blkinfo->blkarcsum); dico_add_u16(blkdico, 0, BLOCKHEADITEMKEY_COMPRESSALGO, blkinfo->blkcompalgo); dico_add_u16(blkdico, 0, BLOCKHEADITEMKEY_ENCRYPTALGO, blkinfo->blkcryptalgo); // write block header res=writebuf_add_header(wb, blkdico, FSA_MAGIC_BLKH, archid, fsid); dico_destroy(blkdico); if (res!=0) { msgprintf(MSG_STACK, "cannot write FSA_MAGIC_BLKH block-header\n"); return -1; } // write block data if (writebuf_add_data(wb, blkinfo->blkdata, blkinfo->blkarsize)!=0) { msgprintf(MSG_STACK, "cannot write data block: writebuf_add_data() failed\n"); return -1; } return 0; } fsarchiver-0.8.6/src/comp_lz4.c0000644000175000017500000000362313655317102013273 00000000000000 /* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2017 Cristian Vazquez. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "fsarchiver.h" #include "common.h" #include "comp_lz4.h" #include "error.h" #ifdef OPTION_LZ4_SUPPORT int compress_block_lz4(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level) { int destsize=compbufsize; int res; #define LZ4_VERSION (LZ4_VERSION_MAJOR*10 + LZ4_VERSION_MINOR) #if LZ4_VERSION >= 17 res=LZ4_compress_default((const char*)origbuf, (char*)compbuf, (int)origsize, destsize); if (res==0){ errprintf("LZ4_compress_default(): failed.\n"); return FSAERR_UNKNOWN; } #else res=LZ4_compress((const char*)origbuf, (char*)compbuf, (int)origsize); if (res==0){ errprintf("LZ4_compress(): failed.\n"); return FSAERR_UNKNOWN; } #endif // LZ4_VERSION if (res > 0){ *compsize=(u64)res; return FSAERR_SUCCESS; } return FSAERR_UNKNOWN; } int uncompress_block_lz4(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf) { int destsize=origbufsize; int res; if((res=LZ4_decompress_safe((char*)compbuf, (char*)origbuf, compsize, destsize)) > 0){ *origsize=(u64)res; return FSAERR_SUCCESS; } errprintf("LZ4_decompress_safe() failed, res=%d\n", res); return FSAERR_UNKNOWN; } #endif //OPTION_LZ4_SUPPORT fsarchiver-0.8.6/src/fs_reiserfs.h0000644000175000017500000000646413655317102014071 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_REISERFS_H__ #define __FS_REISERFS_H__ struct s_dico; struct s_strlist; int reiserfs_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int reiserfs_getinfo(struct s_dico *d, char *devname); int reiserfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int reiserfs_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int reiserfs_umount(char *partition, char *mntbuf); int reiserfs_test(char *devname); #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" #define REISER4FS_SUPER_MAGIC_STRING "ReIsEr4" #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) struct reiserfs_super_block_v1 { u32 s_block_count; /* blocks count */ u32 s_free_blocks; /* free blocks count */ u32 s_root_block; /* root block number */ u32 s_journal_block; /* journal block number */ u32 s_journal_dev; /* journal device number */ u32 s_orig_journal_size; /* size of the journal on FS creation. used to make sure they don't overflow it */ u32 s_journal_trans_max ; /* max number of blocks in a transaction. */ u32 s_journal_block_count ; /* total size of the journal. can change over time */ u32 s_journal_max_batch ; /* max number of blocks to batch into a trans */ u32 s_journal_max_commit_age ; /* in seconds, how old can an async commit be */ u32 s_journal_max_trans_age ; /* in seconds, how old can a transaction be */ u16 s_blocksize; /* block size */ u16 s_oid_maxsize; /* max size of object id array, see get_objectid() commentary */ u16 s_oid_cursize; /* current size of object id array */ u16 s_state; /* valid or error */ char s_magic[12]; /* reiserfs magic string indicates that file system is reiserfs */ u32 s_hash_function_code; /* indicate, what hash fuction is being use to sort names in a directory*/ u16 s_tree_height; /* height of disk tree */ u16 s_bmap_nr; /* amount of bitmap blocks needed to address each block of file system */ u16 s_reserved; } __attribute__ ((__packed__)); struct reiserfs_super_block { struct reiserfs_super_block_v1 s_v1; u32 s_inode_generation; u32 s_flags; /* Right now used only by inode-attributes, if enabled */ unsigned char s_uuid[16]; /* filesystem unique identifier */ unsigned char s_label[16]; /* filesystem volume label */ char s_unused[88]; /* padding and reserved */ }; #endif // __FS_REISERFS_H__ fsarchiver-0.8.6/src/comp_zstd.c0000644000175000017500000000306713655317102013550 00000000000000 /* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include "fsarchiver.h" #include "common.h" #include "comp_zstd.h" #include "error.h" #ifdef OPTION_ZSTD_SUPPORT int compress_block_zstd(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level) { int res=0; if (ZSTD_isError((res=ZSTD_compress((char*)compbuf, compbufsize, (const char*)origbuf, (int)origsize, level)))) { errprintf("ZSTD_compress(): failed: res=%d\n", res); return FSAERR_UNKNOWN; } else { *compsize=(u64)res; return FSAERR_SUCCESS; } } int uncompress_block_zstd(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf) { int res=0; if (ZSTD_isError((res=ZSTD_decompress((char*)origbuf, origbufsize, (char*)compbuf, compsize)))) { errprintf("ZSTD_decompress(): failed: res=%d\n", res); return FSAERR_UNKNOWN; } else { *origsize=(u64)res; return FSAERR_SUCCESS; } } #endif // OPTION_ZSTD_SUPPORT fsarchiver-0.8.6/src/fs_vfat.h0000644000175000017500000000322013655317102013172 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_VFAT_H__ #define __FS_VFAT_H__ struct s_dico; struct s_strlist; int vfat_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int vfat_getinfo(struct s_dico *d, char *devname); int vfat_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int vfat_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int vfat_umount(char *partition, char *mntbuf); int vfat_test(char *devname); int vfat_check_compatibility(u64 compat, u64 ro_compat, u64 incompat, u64 log_incompat); #define VFAT_SB_MAGIC 0x55AA enum fat_type {FAT_TYPE_FAT32=0, FAT_TYPE_FAT16}; struct vfat_superblock { u8 jump[3]; u8 oem_id[8]; u16 u8s_per_sector; u8 sectors_per_cluster; u16 num_boot_sectors; u8 num_fats; u16 num_root_dir_ents; u16 total_sectors; u8 media_id; u16 sectors_per_fat; u16 sectors_per_track; u16 heads; u32 hidden_sectors; u32 total_sectors_large; u8 boot_code[474]; u16 magic; } __attribute__((packed)); #endif // __FS_VFAT_H__ fsarchiver-0.8.6/src/filesys.h0000644000175000017500000000407313655317102013227 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FILESYS_H__ #define __FILESYS_H__ #define PROGVER(x, y, z) (((u64)x)<<16)+(((u64)y)<<8)+(((u64)z)<<0) struct s_strlist; struct s_dico; struct s_filesys; typedef struct s_filesys cfilesys; struct s_filesys { char *name; int (*mount)(char *partition, char *mntbuf, char *fsname, int flags, char *mntinfo); int (*umount)(char *partition, char *mntbuf); int (*getinfo)(struct s_dico *d, char *devname); int (*mkfs)(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int (*test)(char *partition); int (*reqmntopt)(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); bool support_for_xattr; bool support_for_acls; bool winattr; bool savesymtargettype; // we have to know the type of the target to recreate a symlink on ntfs bool stable; // say if the fsarchiver support for this filesystem is considered stable or not }; extern cfilesys filesys[]; int devcmp(char *dev1, char *dev2); int generic_get_spacestats(char *dev, char *mnt, char *text, int textlen); int generic_get_fsrwstatus(char *options); int generic_get_fstype(char *fsname, int *fstype); int generic_get_mntinfo(char *devname, int *readwrite, char *mntbuf, int maxmntbuf, char *optbuf, int maxoptbuf, char *fsbuf, int maxfsbuf); int generic_mount(char *partition, char *mntbuf, char *fsbuf, char *mntopt, int flags); char *format_prog_version(u64 version, char *bufdat, int buflen); int generic_umount(char *mntbuf); #endif // __FILESYS_H__ fsarchiver-0.8.6/src/logfile.c0000644000175000017500000000356413655317102013171 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include "fsarchiver.h" #include "logfile.h" #include "common.h" #include "error.h" int g_logfile=-1; int logfile_open() { char logpath[PATH_MAX]; char timestamp[1024]; char *logdir="/var/log"; format_time(timestamp, sizeof(timestamp), time(NULL)); snprintf(logpath, sizeof(logpath), "%s/fsarchiver_%s_%ld.log", logdir, timestamp, (long)getpid()); mkdir_recursive(logdir); g_logfile=open64(logpath, O_RDWR|O_CREAT|O_TRUNC|O_LARGEFILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (g_logfile>=0) { msgprintf(MSG_VERB1, "Creating logfile in %s\n", logpath); msgprintf(MSG_VERB1, "Running fsarchiver version=[%s], fileformat=[%s]\n", FSA_VERSION, FSA_FILEFORMAT); return FSAERR_SUCCESS; } else { sysprintf("Cannot create logfile in %s\n", logpath); return FSAERR_UNKNOWN; } } int logfile_close() { close(g_logfile); return FSAERR_SUCCESS; } int logfile_write(char *str, int len) { if (g_logfile>=0) return write(g_logfile, str, len); else return FSAERR_UNKNOWN; } fsarchiver-0.8.6/src/writebuf.h0000644000175000017500000000223713655317102013400 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __WRITEBUF_H__ #define __WRITEBUF_H__ struct s_dico; struct s_blockinfo; struct s_writebuf; typedef struct s_writebuf cwritebuf; struct s_writebuf { char *data; u64 size; }; cwritebuf *writebuf_alloc(); int writebuf_destroy(cwritebuf *wb); int writebuf_add_data(cwritebuf *wb, void *data, u64 size); int writebuf_add_dico(cwritebuf *wb, struct s_dico *d, char *magic); int writebuf_add_header(cwritebuf *wb, struct s_dico *d, char *magic, u32 archid, u16 fsid); int writebuf_add_block(cwritebuf *wb, struct s_blockinfo *blkinfo, u32 archid, u16 fsid); #endif // __WRITEBUF_H__ fsarchiver-0.8.6/src/fs_reiser4.h0000644000175000017500000000361413655317102013616 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_REISER4_H__ #define __FS_REISER4_H__ struct s_dico; struct s_strlist; int reiser4_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int reiser4_getinfo(struct s_dico *d, char *devname); int reiser4_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int reiser4_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int reiser4_umount(char *partition, char *mntbuf); int reiser4_test(char *devname); #define REISERFS4_SUPER_MAGIC "ReIsEr4" #define MAGIC_SIZE 16 #define REISER4_DISK_OFFSET_IN_BYTES (64 * 1024) typedef struct reiser4_master_sb reiser4_master_sb; struct reiser4_master_sb { char magic[16]; // "ReIsEr4" u16 disk_plugin_id; // id of disk layout plugin u16 blocksize; char uuid[16]; // unique id char label[16]; // filesystem label u64 diskmap; // location of the diskmap. 0 if not present } __attribute__ ((__packed__)); /*struct format40_super { u64 sb_block_count; u64 sb_free_blocks; u64 sb_root_block; u64 sb_oid[2]; u64 sb_flushes; u32 sb_mkfs_id; char sb_magic[MAGIC_SIZE]; u16 sb_tree_height; u16 sb_policy; u64 sb_flags; char sb_unused[432]; } __attribute__((packed));*/ #endif // __FS_REISER4_H__ fsarchiver-0.8.6/src/fs_btrfs.h0000644000175000017500000001305013655317102013354 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_BTRFS_H__ #define __FS_BTRFS_H__ struct s_dico; struct s_strlist; int btrfs_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int btrfs_getinfo(struct s_dico *d, char *devname); int btrfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int btrfs_umount(char *partition, char *mntbuf); int btrfs_check_support_for_features(u64 compat, u64 incompat, u64 ro_compat); int btrfs_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int btrfs_test(char *devname); // compat flags: official definition from linux-3.14/fs/btrfs/ctree.h #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF (1ULL << 0) #define BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL (1ULL << 1) #define BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS (1ULL << 2) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO (1ULL << 3) #define BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 (1ULL << 4) #define BTRFS_FEATURE_INCOMPAT_BIG_METADATA (1ULL << 5) #define BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF (1ULL << 6) #define BTRFS_FEATURE_INCOMPAT_RAID56 (1ULL << 7) #define BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA (1ULL << 8) #define BTRFS_FEATURE_INCOMPAT_NO_HOLES (1ULL << 9) // compat flags: btrfs features that this fsarchiver version supports #define FSA_BTRFS_FEATURE_COMPAT_SUPP 0ULL #define FSA_BTRFS_FEATURE_COMPAT_RO_SUPP 0ULL #define FSA_BTRFS_FEATURE_INCOMPAT_SUPP \ (BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF | \ BTRFS_FEATURE_INCOMPAT_DEFAULT_SUBVOL | \ BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS | \ BTRFS_FEATURE_INCOMPAT_BIG_METADATA | \ BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO | \ BTRFS_FEATURE_INCOMPAT_COMPRESS_LZOv2 | \ BTRFS_FEATURE_INCOMPAT_RAID56 | \ BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF | \ BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA | \ BTRFS_FEATURE_INCOMPAT_NO_HOLES) // disk layout definitions #define BTRFS_SUPER_MAGIC 0x9123683E #define BTRFS_MAGIC "_BHRfS_M" #define BTRFS_SUPER_INFO_OFFSET (64 * 1024) #define BTRFS_SUPER_INFO_SIZE 4096 #define BTRFS_SUPER_MIRROR_MAX 3 #define BTRFS_SUPER_MIRROR_SHIFT 12 #define BTRFS_NAME_LEN 255 #define BTRFS_CSUM_SIZE 32 #define BTRFS_CSUM_TYPE_CRC32 0 #define BTRFS_FSID_SIZE 16 #define BTRFS_HEADER_FLAG_WRITTEN (1 << 0) #define BTRFS_SYSTEM_CHUNK_ARRAY_SIZE 2048 #define BTRFS_LABEL_SIZE 256 #define BTRFS_UUID_SIZE 16 static inline u64 btrfs_sb_offset(int mirror) { u64 start = 16 * 1024; if (mirror) return start << (BTRFS_SUPER_MIRROR_SHIFT * mirror); return BTRFS_SUPER_INFO_OFFSET; } struct btrfs_dev_item { /* the internal btrfs device id */ __le64 devid; /* size of the device */ __le64 total_bytes; /* bytes used */ __le64 bytes_used; /* optimal io alignment for this device */ __le32 io_align; /* optimal io width for this device */ __le32 io_width; /* minimal io size for this device */ __le32 sector_size; /* type and info about this device */ __le64 type; /* expected generation for this device */ __le64 generation; /* * starting byte of this partition on the device, * to allowr for stripe alignment in the future */ __le64 start_offset; /* grouping information for allocation decisions */ __le32 dev_group; /* seek speed 0-100 where 100 is fastest */ u8 seek_speed; /* bandwidth 0-100 where 100 is fastest */ u8 bandwidth; /* btrfs generated uuid for this device */ u8 uuid[BTRFS_UUID_SIZE]; /* uuid of FS who owns this device */ u8 fsid[BTRFS_UUID_SIZE]; } __attribute__ ((__packed__)); /* * the super block basically lists the main trees of the FS * it currently lacks any block count etc etc */ struct btrfs_super_block { u8 csum[BTRFS_CSUM_SIZE]; /* the first 4 fields must match struct btrfs_header */ u8 fsid[BTRFS_FSID_SIZE]; /* FS specific uuid */ __le64 bytenr; /* this block number */ __le64 flags; /* allowed to be different from the btrfs_header from here own down */ __le64 magic; __le64 generation; __le64 root; __le64 chunk_root; __le64 log_root; /* this will help find the new super based on the log root */ __le64 log_root_transid; __le64 total_bytes; __le64 bytes_used; __le64 root_dir_objectid; __le64 num_devices; __le32 sectorsize; __le32 nodesize; __le32 leafsize; __le32 stripesize; __le32 sys_chunk_array_size; __le64 chunk_root_generation; __le64 compat_flags; __le64 compat_ro_flags; __le64 incompat_flags; __le16 csum_type; u8 root_level; u8 chunk_root_level; u8 log_root_level; struct btrfs_dev_item dev_item; char label[BTRFS_LABEL_SIZE]; /* future expansion */ __le64 reserved[32]; u8 sys_chunk_array[BTRFS_SYSTEM_CHUNK_ARRAY_SIZE]; } __attribute__ ((__packed__)); #endif // __FS_BTRFS_H__ fsarchiver-0.8.6/src/common.h0000644000175000017500000000446513655317102013046 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __COMMON_H__ #define __COMMON_H__ #include struct timeval; struct s_strlist; struct s_stats; int exec_command(char *command, int cmdbufsize, int *exitst, char *stdoutbuf, int stdoutsize, char *stderrbuf, int stderrsize, char *format, ...); int get_parent_dir_time_attrib(char *filepath, char *parentdirbuf, int bufsize, struct timeval *tv); void concatenate_paths(char *buffer, int maxbufsize, char *p1, char *p2); int path_force_extension(char *buf, int bufsize, char *origpath, char *ext); char *format_size(u64 size, char *text, int max, char units); int image_write_data(int fdarch, char *buffer, int buflen); int extract_dirpath(char *filepath, char *dirbuf, int dirbufsize); int extract_basename(char *filepath, char *basenamebuf, int basenamebufsize); int generate_random_tmpdir(char *buffer, int bufsize, int n); char *format_time(char *buffer, int bufsize, u64 t); int stream_readline(FILE *f, char *buf, int buflen); char *format_md5(char *buf, int maxbuf, u8 *md5bin); int getpathtoprog(char *buffer, int bufsize, char *prog); int mkdir_recursive(char *path); char *get_objtype_name(int objtype); int is_dir_empty(char *path); u32 generate_random_u32_id(void); u32 fletcher32(u8 *data, u32 len); int regfile_exists(char *filepath); int is_magic_valid(char *magic); char *strlcatf(char *dest, int destbufsize, char *format, ...) __attribute__ ((format (printf, 3, 4))); int format_stacktrace(char *buffer, int bufsize); int stats_show(struct s_stats, int fsid); u64 stats_errcount(struct s_stats stats); int exclude_check(struct s_strlist *patlist, char *string); int get_path_to_volume(char *newvolbuf, int bufsize, char *basepath, long curvol); s64 get_device_size(char *partition); bool match_uname_r(char *ere); #endif // __COMMON_H__ fsarchiver-0.8.6/src/crypto.h0000644000175000017500000000153513655317102013071 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __CRYPTO_H__ #define __CRYPTO_H__ #include "types.h" int crypto_init(); int crypto_blowfish(u64 insize, u64 *outsize, u8 *inbuf, u8 *outbuf, u8 *password, int passlen, int enc); int crypto_random(u8 *buf, int bufsize); int crypto_cleanup(); #endif // __CRYPTO_H__ fsarchiver-0.8.6/src/devinfo.c0000644000175000017500000001256013655317102013176 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #include #include "fsarchiver.h" #include "devinfo.h" #include "common.h" #include "fs_ext2.h" #include "error.h" int get_devinfo(struct s_devinfo *outdev, char *indevname, int min, int maj) { char sysblkdevname[512]; blkid_tag_iterate iter; char sysblkinfo[PATH_MAX]; const char *type, *value; struct stat64 statbuf; struct dirent *dir; char temp[PATH_MAX]; blkid_dev dev; DIR *dirdesc; FILE *finfo; int found; int fd; int i; // init memset(outdev, 0, sizeof(struct s_devinfo)); // defaults values outdev->devtype=BLKDEV_INVALID; snprintf(outdev->label, sizeof(outdev->label), ""); snprintf(outdev->uuid, sizeof(outdev->uuid), ""); snprintf(outdev->fsname, sizeof(outdev->fsname), ""); // check the name starts with "/dev/" if ((strlen(indevname) < 5) || (memcmp(indevname, "/dev/", 5)!=0)) return -1; // get short name ("/dev/sda1" -> "sda1") snprintf(outdev->devname, sizeof(outdev->devname), "%s", indevname+5); // skip "/dev/" // get long name if there is one (eg: LVM / devmapper) snprintf(outdev->longname, sizeof(outdev->longname), "%s", indevname); if ((dirdesc=opendir("/dev/mapper"))!=NULL) { found=false; while (((dir=readdir(dirdesc)) != NULL) && found==false) { snprintf(temp, sizeof(temp), "/dev/mapper/%s", dir->d_name); if ((stat64(temp, &statbuf)==0) && S_ISBLK(statbuf.st_mode) && (major(statbuf.st_rdev)==maj) && (minor(statbuf.st_rdev)==min)) { snprintf(outdev->longname, sizeof(outdev->longname), "%s", temp); found=true; } } closedir(dirdesc); } // get device basic info (size, major, minor) if (((fd=open64(outdev->longname, O_RDONLY|O_LARGEFILE))<0) || ((outdev->devsize=lseek64(fd, 0, SEEK_END))<0) || (fstat64(fd, &statbuf)!=0) || (!S_ISBLK(statbuf.st_mode)) || (close(fd)<0)) return -1; outdev->rdev=statbuf.st_rdev; outdev->major=major(statbuf.st_rdev); outdev->minor=minor(statbuf.st_rdev); format_size(outdev->devsize, outdev->txtsize, sizeof(outdev->txtsize), 'h'); if (outdev->devsize==1024) // ignore extended partitions return -1; // devname shown in /sys/block (eg for HP-cciss: "cciss/c0d0" -> "cciss!c0d0") snprintf(sysblkdevname, sizeof(sysblkdevname), "%s", outdev->devname); for (i=0; (sysblkdevname[i]!=0) && (idevtype=BLKDEV_PHYSDISK; snprintf(sysblkinfo, sizeof(sysblkinfo), "/sys/block/%s/device/model", sysblkdevname); if ( ((finfo=fopen(sysblkinfo, "rb")) != NULL) && (fread(temp, 1, sizeof(temp), finfo)>0) && fclose(finfo)==0 ) for (i=0; (temp[i]!=0) && (temp[i]!='\r') && (temp[i]!='\n'); i++) outdev->name[i]=temp[i]; } else { outdev->devtype=BLKDEV_FILESYSDEV; } // get blkid infos about the device (label, uuid) blkid_cache cache = NULL; if (blkid_get_cache(&cache, NULL) < 0) return -1; if ((dev=blkid_get_dev(cache, outdev->longname, BLKID_DEV_NORMAL))!=NULL) { iter = blkid_tag_iterate_begin(dev); while (blkid_tag_next(iter, &type, &value)==0) { if (strcmp(type, "LABEL")==0) snprintf(outdev->label, sizeof(outdev->label), "%s", value); else if (strcmp(type, "UUID")==0) snprintf(outdev->uuid, sizeof(outdev->uuid), "%s", value); else if (strcmp(type, "TYPE")==0) snprintf(outdev->fsname, sizeof(outdev->fsname), "%s", value); } blkid_tag_iterate_end(iter); // workaround: blkid < 1.41 don't know ext4 and say it is ext3 instead if (strcmp(outdev->fsname, "ext3")==0) { if (ext3_test(outdev->longname)==true) snprintf(outdev->fsname, sizeof(outdev->fsname), "ext3"); else // cannot run ext4_test(): it would fail on an ext4 when e2fsprogs < 1.41 snprintf(outdev->fsname, sizeof(outdev->fsname), "ext4"); } } blkid_put_cache(cache); // free memory allocated by blkid_get_cache return 0; } fsarchiver-0.8.6/src/Makefile.in0000644000175000017500000031142114016431530013435 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ sbin_PROGRAMS = fsarchiver$(EXEEXT) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_fsarchiver_OBJECTS = fsarchiver-fsarchiver.$(OBJEXT) \ fsarchiver-oper_save.$(OBJEXT) \ fsarchiver-oper_restore.$(OBJEXT) \ fsarchiver-oper_probe.$(OBJEXT) \ fsarchiver-thread_archio.$(OBJEXT) \ fsarchiver-archreader.$(OBJEXT) \ fsarchiver-archwriter.$(OBJEXT) fsarchiver-writebuf.$(OBJEXT) \ fsarchiver-archinfo.$(OBJEXT) fsarchiver-thread_comp.$(OBJEXT) \ fsarchiver-comp_gzip.$(OBJEXT) fsarchiver-comp_bzip2.$(OBJEXT) \ fsarchiver-comp_lzma.$(OBJEXT) fsarchiver-comp_lzo.$(OBJEXT) \ fsarchiver-comp_lz4.$(OBJEXT) fsarchiver-comp_zstd.$(OBJEXT) \ fsarchiver-crypto.$(OBJEXT) fsarchiver-fs_ntfs.$(OBJEXT) \ fsarchiver-fs_ext2.$(OBJEXT) fsarchiver-fs_reiserfs.$(OBJEXT) \ fsarchiver-fs_reiser4.$(OBJEXT) fsarchiver-fs_btrfs.$(OBJEXT) \ fsarchiver-fs_xfs.$(OBJEXT) fsarchiver-fs_jfs.$(OBJEXT) \ fsarchiver-fs_vfat.$(OBJEXT) fsarchiver-common.$(OBJEXT) \ fsarchiver-dico.$(OBJEXT) fsarchiver-strdico.$(OBJEXT) \ fsarchiver-dichl.$(OBJEXT) fsarchiver-queue.$(OBJEXT) \ fsarchiver-error.$(OBJEXT) fsarchiver-syncthread.$(OBJEXT) \ fsarchiver-datafile.$(OBJEXT) fsarchiver-strlist.$(OBJEXT) \ fsarchiver-regmulti.$(OBJEXT) fsarchiver-options.$(OBJEXT) \ fsarchiver-logfile.$(OBJEXT) fsarchiver-filesys.$(OBJEXT) \ fsarchiver-devinfo.$(OBJEXT) fsarchiver_OBJECTS = $(am_fsarchiver_OBJECTS) am__DEPENDENCIES_1 = fsarchiver_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) fsarchiver_LINK = $(CCLD) $(fsarchiver_CFLAGS) $(CFLAGS) \ $(fsarchiver_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/fsarchiver-archinfo.Po \ ./$(DEPDIR)/fsarchiver-archreader.Po \ ./$(DEPDIR)/fsarchiver-archwriter.Po \ ./$(DEPDIR)/fsarchiver-common.Po \ ./$(DEPDIR)/fsarchiver-comp_bzip2.Po \ ./$(DEPDIR)/fsarchiver-comp_gzip.Po \ ./$(DEPDIR)/fsarchiver-comp_lz4.Po \ ./$(DEPDIR)/fsarchiver-comp_lzma.Po \ ./$(DEPDIR)/fsarchiver-comp_lzo.Po \ ./$(DEPDIR)/fsarchiver-comp_zstd.Po \ ./$(DEPDIR)/fsarchiver-crypto.Po \ ./$(DEPDIR)/fsarchiver-datafile.Po \ ./$(DEPDIR)/fsarchiver-devinfo.Po \ ./$(DEPDIR)/fsarchiver-dichl.Po ./$(DEPDIR)/fsarchiver-dico.Po \ ./$(DEPDIR)/fsarchiver-error.Po \ ./$(DEPDIR)/fsarchiver-filesys.Po \ ./$(DEPDIR)/fsarchiver-fs_btrfs.Po \ ./$(DEPDIR)/fsarchiver-fs_ext2.Po \ ./$(DEPDIR)/fsarchiver-fs_jfs.Po \ ./$(DEPDIR)/fsarchiver-fs_ntfs.Po \ ./$(DEPDIR)/fsarchiver-fs_reiser4.Po \ ./$(DEPDIR)/fsarchiver-fs_reiserfs.Po \ ./$(DEPDIR)/fsarchiver-fs_vfat.Po \ ./$(DEPDIR)/fsarchiver-fs_xfs.Po \ ./$(DEPDIR)/fsarchiver-fsarchiver.Po \ ./$(DEPDIR)/fsarchiver-logfile.Po \ ./$(DEPDIR)/fsarchiver-oper_probe.Po \ ./$(DEPDIR)/fsarchiver-oper_restore.Po \ ./$(DEPDIR)/fsarchiver-oper_save.Po \ ./$(DEPDIR)/fsarchiver-options.Po \ ./$(DEPDIR)/fsarchiver-queue.Po \ ./$(DEPDIR)/fsarchiver-regmulti.Po \ ./$(DEPDIR)/fsarchiver-strdico.Po \ ./$(DEPDIR)/fsarchiver-strlist.Po \ ./$(DEPDIR)/fsarchiver-syncthread.Po \ ./$(DEPDIR)/fsarchiver-thread_archio.Po \ ./$(DEPDIR)/fsarchiver-thread_comp.Po \ ./$(DEPDIR)/fsarchiver-writebuf.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(fsarchiver_SOURCES) DIST_SOURCES = $(fsarchiver_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BLKID_CFLAGS = @BLKID_CFLAGS@ BLKID_LIBS = @BLKID_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ COM_ERR_CFLAGS = @COM_ERR_CFLAGS@ COM_ERR_LIBS = @COM_ERR_LIBS@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFAULT_DEBUG_LEVEL = @DEFAULT_DEBUG_LEVEL@ DEFS = @DEFS@ -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE DEPDIR = @DEPDIR@ E2P_CFLAGS = @E2P_CFLAGS@ E2P_LIBS = @E2P_LIBS@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ EXT2FS_CFLAGS = @EXT2FS_CFLAGS@ EXT2FS_LIBS = @EXT2FS_LIBS@ FSARCHIVER_LDFLAGS = @FSARCHIVER_LDFLAGS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LOGDIR = @LOGDIR@ LTLIBOBJS = @LTLIBOBJS@ LZMA_CFLAGS = @LZMA_CFLAGS@ LZMA_LIBS = @LZMA_LIBS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ fsarchiver_SOURCES = fsarchiver.c oper_save.c oper_restore.c oper_probe.c \ thread_archio.c archreader.c archwriter.c writebuf.c archinfo.c \ thread_comp.c comp_gzip.c comp_bzip2.c comp_lzma.c comp_lzo.c comp_lz4.c \ comp_zstd.c crypto.c fs_ntfs.c fs_ext2.c fs_reiserfs.c fs_reiser4.c \ fs_btrfs.c fs_xfs.c fs_jfs.c fs_vfat.c common.c dico.c strdico.c dichl.c \ queue.c error.c syncthread.c datafile.c strlist.c regmulti.c options.c \ logfile.c filesys.c devinfo.c noinst_HEADERS = fsarchiver.h oper_save.h oper_restore.h oper_probe.h \ thread_archio.h archreader.h archwriter.h writebuf.h archinfo.h \ thread_comp.h comp_gzip.h comp_bzip2.h comp_lzma.h comp_lzo.h comp_lz4.h \ comp_zstd.h crypto.h fs_ntfs.h fs_ext2.h fs_reiserfs.h fs_reiser4.h \ fs_btrfs.h fs_xfs.h fs_jfs.h fs_vfat.h common.h dico.h strdico.h dichl.h \ queue.h error.h syncthread.h datafile.h strlist.h regmulti.h options.h \ logfile.h types.h filesys.h devinfo.h fsarchiver_LDADD = -lpthread -lrt \ $(LZMA_LIBS) \ $(EXT2FS_LIBS) \ $(COM_ERR_LIBS) \ $(E2P_LIBS) \ $(BLKID_LIBS) \ $(UUID_LIBS) fsarchiver_CFLAGS = @CFLAGS@ -Wall -std=gnu99 -rdynamic -ggdb \ $(LZMA_CFLAGS) \ $(EXT2FS_CFLAGS) \ $(COM_ERR_CFLAGS) \ $(E2P_CFLAGS) \ $(BLKID_CFLAGS) \ $(UUID_CFLAGS) fsarchiver_LDFLAGS = @FSARCHIVER_LDFLAGS@ MAINTAINERCLEANFILES = Makefile.in all: all-am .SUFFIXES: .SUFFIXES: .c .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) fsarchiver$(EXEEXT): $(fsarchiver_OBJECTS) $(fsarchiver_DEPENDENCIES) $(EXTRA_fsarchiver_DEPENDENCIES) @rm -f fsarchiver$(EXEEXT) $(AM_V_CCLD)$(fsarchiver_LINK) $(fsarchiver_OBJECTS) $(fsarchiver_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-archinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-archreader.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-archwriter.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-common.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_bzip2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_gzip.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_lz4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_lzma.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_lzo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-comp_zstd.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-crypto.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-datafile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-devinfo.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-dichl.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-dico.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-error.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-filesys.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_btrfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_ext2.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_jfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_ntfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_reiser4.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_reiserfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_vfat.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fs_xfs.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-fsarchiver.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-logfile.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-oper_probe.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-oper_restore.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-oper_save.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-options.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-queue.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-regmulti.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-strdico.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-strlist.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-syncthread.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-thread_archio.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-thread_comp.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsarchiver-writebuf.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` fsarchiver-fsarchiver.o: fsarchiver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fsarchiver.o -MD -MP -MF $(DEPDIR)/fsarchiver-fsarchiver.Tpo -c -o fsarchiver-fsarchiver.o `test -f 'fsarchiver.c' || echo '$(srcdir)/'`fsarchiver.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fsarchiver.Tpo $(DEPDIR)/fsarchiver-fsarchiver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fsarchiver.c' object='fsarchiver-fsarchiver.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fsarchiver.o `test -f 'fsarchiver.c' || echo '$(srcdir)/'`fsarchiver.c fsarchiver-fsarchiver.obj: fsarchiver.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fsarchiver.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fsarchiver.Tpo -c -o fsarchiver-fsarchiver.obj `if test -f 'fsarchiver.c'; then $(CYGPATH_W) 'fsarchiver.c'; else $(CYGPATH_W) '$(srcdir)/fsarchiver.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fsarchiver.Tpo $(DEPDIR)/fsarchiver-fsarchiver.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fsarchiver.c' object='fsarchiver-fsarchiver.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fsarchiver.obj `if test -f 'fsarchiver.c'; then $(CYGPATH_W) 'fsarchiver.c'; else $(CYGPATH_W) '$(srcdir)/fsarchiver.c'; fi` fsarchiver-oper_save.o: oper_save.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_save.o -MD -MP -MF $(DEPDIR)/fsarchiver-oper_save.Tpo -c -o fsarchiver-oper_save.o `test -f 'oper_save.c' || echo '$(srcdir)/'`oper_save.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_save.Tpo $(DEPDIR)/fsarchiver-oper_save.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_save.c' object='fsarchiver-oper_save.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_save.o `test -f 'oper_save.c' || echo '$(srcdir)/'`oper_save.c fsarchiver-oper_save.obj: oper_save.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_save.obj -MD -MP -MF $(DEPDIR)/fsarchiver-oper_save.Tpo -c -o fsarchiver-oper_save.obj `if test -f 'oper_save.c'; then $(CYGPATH_W) 'oper_save.c'; else $(CYGPATH_W) '$(srcdir)/oper_save.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_save.Tpo $(DEPDIR)/fsarchiver-oper_save.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_save.c' object='fsarchiver-oper_save.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_save.obj `if test -f 'oper_save.c'; then $(CYGPATH_W) 'oper_save.c'; else $(CYGPATH_W) '$(srcdir)/oper_save.c'; fi` fsarchiver-oper_restore.o: oper_restore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_restore.o -MD -MP -MF $(DEPDIR)/fsarchiver-oper_restore.Tpo -c -o fsarchiver-oper_restore.o `test -f 'oper_restore.c' || echo '$(srcdir)/'`oper_restore.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_restore.Tpo $(DEPDIR)/fsarchiver-oper_restore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_restore.c' object='fsarchiver-oper_restore.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_restore.o `test -f 'oper_restore.c' || echo '$(srcdir)/'`oper_restore.c fsarchiver-oper_restore.obj: oper_restore.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_restore.obj -MD -MP -MF $(DEPDIR)/fsarchiver-oper_restore.Tpo -c -o fsarchiver-oper_restore.obj `if test -f 'oper_restore.c'; then $(CYGPATH_W) 'oper_restore.c'; else $(CYGPATH_W) '$(srcdir)/oper_restore.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_restore.Tpo $(DEPDIR)/fsarchiver-oper_restore.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_restore.c' object='fsarchiver-oper_restore.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_restore.obj `if test -f 'oper_restore.c'; then $(CYGPATH_W) 'oper_restore.c'; else $(CYGPATH_W) '$(srcdir)/oper_restore.c'; fi` fsarchiver-oper_probe.o: oper_probe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_probe.o -MD -MP -MF $(DEPDIR)/fsarchiver-oper_probe.Tpo -c -o fsarchiver-oper_probe.o `test -f 'oper_probe.c' || echo '$(srcdir)/'`oper_probe.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_probe.Tpo $(DEPDIR)/fsarchiver-oper_probe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_probe.c' object='fsarchiver-oper_probe.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_probe.o `test -f 'oper_probe.c' || echo '$(srcdir)/'`oper_probe.c fsarchiver-oper_probe.obj: oper_probe.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-oper_probe.obj -MD -MP -MF $(DEPDIR)/fsarchiver-oper_probe.Tpo -c -o fsarchiver-oper_probe.obj `if test -f 'oper_probe.c'; then $(CYGPATH_W) 'oper_probe.c'; else $(CYGPATH_W) '$(srcdir)/oper_probe.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-oper_probe.Tpo $(DEPDIR)/fsarchiver-oper_probe.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='oper_probe.c' object='fsarchiver-oper_probe.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-oper_probe.obj `if test -f 'oper_probe.c'; then $(CYGPATH_W) 'oper_probe.c'; else $(CYGPATH_W) '$(srcdir)/oper_probe.c'; fi` fsarchiver-thread_archio.o: thread_archio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-thread_archio.o -MD -MP -MF $(DEPDIR)/fsarchiver-thread_archio.Tpo -c -o fsarchiver-thread_archio.o `test -f 'thread_archio.c' || echo '$(srcdir)/'`thread_archio.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-thread_archio.Tpo $(DEPDIR)/fsarchiver-thread_archio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='thread_archio.c' object='fsarchiver-thread_archio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-thread_archio.o `test -f 'thread_archio.c' || echo '$(srcdir)/'`thread_archio.c fsarchiver-thread_archio.obj: thread_archio.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-thread_archio.obj -MD -MP -MF $(DEPDIR)/fsarchiver-thread_archio.Tpo -c -o fsarchiver-thread_archio.obj `if test -f 'thread_archio.c'; then $(CYGPATH_W) 'thread_archio.c'; else $(CYGPATH_W) '$(srcdir)/thread_archio.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-thread_archio.Tpo $(DEPDIR)/fsarchiver-thread_archio.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='thread_archio.c' object='fsarchiver-thread_archio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-thread_archio.obj `if test -f 'thread_archio.c'; then $(CYGPATH_W) 'thread_archio.c'; else $(CYGPATH_W) '$(srcdir)/thread_archio.c'; fi` fsarchiver-archreader.o: archreader.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archreader.o -MD -MP -MF $(DEPDIR)/fsarchiver-archreader.Tpo -c -o fsarchiver-archreader.o `test -f 'archreader.c' || echo '$(srcdir)/'`archreader.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archreader.Tpo $(DEPDIR)/fsarchiver-archreader.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archreader.c' object='fsarchiver-archreader.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archreader.o `test -f 'archreader.c' || echo '$(srcdir)/'`archreader.c fsarchiver-archreader.obj: archreader.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archreader.obj -MD -MP -MF $(DEPDIR)/fsarchiver-archreader.Tpo -c -o fsarchiver-archreader.obj `if test -f 'archreader.c'; then $(CYGPATH_W) 'archreader.c'; else $(CYGPATH_W) '$(srcdir)/archreader.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archreader.Tpo $(DEPDIR)/fsarchiver-archreader.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archreader.c' object='fsarchiver-archreader.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archreader.obj `if test -f 'archreader.c'; then $(CYGPATH_W) 'archreader.c'; else $(CYGPATH_W) '$(srcdir)/archreader.c'; fi` fsarchiver-archwriter.o: archwriter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archwriter.o -MD -MP -MF $(DEPDIR)/fsarchiver-archwriter.Tpo -c -o fsarchiver-archwriter.o `test -f 'archwriter.c' || echo '$(srcdir)/'`archwriter.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archwriter.Tpo $(DEPDIR)/fsarchiver-archwriter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archwriter.c' object='fsarchiver-archwriter.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archwriter.o `test -f 'archwriter.c' || echo '$(srcdir)/'`archwriter.c fsarchiver-archwriter.obj: archwriter.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archwriter.obj -MD -MP -MF $(DEPDIR)/fsarchiver-archwriter.Tpo -c -o fsarchiver-archwriter.obj `if test -f 'archwriter.c'; then $(CYGPATH_W) 'archwriter.c'; else $(CYGPATH_W) '$(srcdir)/archwriter.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archwriter.Tpo $(DEPDIR)/fsarchiver-archwriter.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archwriter.c' object='fsarchiver-archwriter.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archwriter.obj `if test -f 'archwriter.c'; then $(CYGPATH_W) 'archwriter.c'; else $(CYGPATH_W) '$(srcdir)/archwriter.c'; fi` fsarchiver-writebuf.o: writebuf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-writebuf.o -MD -MP -MF $(DEPDIR)/fsarchiver-writebuf.Tpo -c -o fsarchiver-writebuf.o `test -f 'writebuf.c' || echo '$(srcdir)/'`writebuf.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-writebuf.Tpo $(DEPDIR)/fsarchiver-writebuf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='writebuf.c' object='fsarchiver-writebuf.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-writebuf.o `test -f 'writebuf.c' || echo '$(srcdir)/'`writebuf.c fsarchiver-writebuf.obj: writebuf.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-writebuf.obj -MD -MP -MF $(DEPDIR)/fsarchiver-writebuf.Tpo -c -o fsarchiver-writebuf.obj `if test -f 'writebuf.c'; then $(CYGPATH_W) 'writebuf.c'; else $(CYGPATH_W) '$(srcdir)/writebuf.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-writebuf.Tpo $(DEPDIR)/fsarchiver-writebuf.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='writebuf.c' object='fsarchiver-writebuf.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-writebuf.obj `if test -f 'writebuf.c'; then $(CYGPATH_W) 'writebuf.c'; else $(CYGPATH_W) '$(srcdir)/writebuf.c'; fi` fsarchiver-archinfo.o: archinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archinfo.o -MD -MP -MF $(DEPDIR)/fsarchiver-archinfo.Tpo -c -o fsarchiver-archinfo.o `test -f 'archinfo.c' || echo '$(srcdir)/'`archinfo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archinfo.Tpo $(DEPDIR)/fsarchiver-archinfo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archinfo.c' object='fsarchiver-archinfo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archinfo.o `test -f 'archinfo.c' || echo '$(srcdir)/'`archinfo.c fsarchiver-archinfo.obj: archinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-archinfo.obj -MD -MP -MF $(DEPDIR)/fsarchiver-archinfo.Tpo -c -o fsarchiver-archinfo.obj `if test -f 'archinfo.c'; then $(CYGPATH_W) 'archinfo.c'; else $(CYGPATH_W) '$(srcdir)/archinfo.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-archinfo.Tpo $(DEPDIR)/fsarchiver-archinfo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='archinfo.c' object='fsarchiver-archinfo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-archinfo.obj `if test -f 'archinfo.c'; then $(CYGPATH_W) 'archinfo.c'; else $(CYGPATH_W) '$(srcdir)/archinfo.c'; fi` fsarchiver-thread_comp.o: thread_comp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-thread_comp.o -MD -MP -MF $(DEPDIR)/fsarchiver-thread_comp.Tpo -c -o fsarchiver-thread_comp.o `test -f 'thread_comp.c' || echo '$(srcdir)/'`thread_comp.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-thread_comp.Tpo $(DEPDIR)/fsarchiver-thread_comp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='thread_comp.c' object='fsarchiver-thread_comp.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-thread_comp.o `test -f 'thread_comp.c' || echo '$(srcdir)/'`thread_comp.c fsarchiver-thread_comp.obj: thread_comp.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-thread_comp.obj -MD -MP -MF $(DEPDIR)/fsarchiver-thread_comp.Tpo -c -o fsarchiver-thread_comp.obj `if test -f 'thread_comp.c'; then $(CYGPATH_W) 'thread_comp.c'; else $(CYGPATH_W) '$(srcdir)/thread_comp.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-thread_comp.Tpo $(DEPDIR)/fsarchiver-thread_comp.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='thread_comp.c' object='fsarchiver-thread_comp.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-thread_comp.obj `if test -f 'thread_comp.c'; then $(CYGPATH_W) 'thread_comp.c'; else $(CYGPATH_W) '$(srcdir)/thread_comp.c'; fi` fsarchiver-comp_gzip.o: comp_gzip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_gzip.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_gzip.Tpo -c -o fsarchiver-comp_gzip.o `test -f 'comp_gzip.c' || echo '$(srcdir)/'`comp_gzip.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_gzip.Tpo $(DEPDIR)/fsarchiver-comp_gzip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_gzip.c' object='fsarchiver-comp_gzip.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_gzip.o `test -f 'comp_gzip.c' || echo '$(srcdir)/'`comp_gzip.c fsarchiver-comp_gzip.obj: comp_gzip.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_gzip.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_gzip.Tpo -c -o fsarchiver-comp_gzip.obj `if test -f 'comp_gzip.c'; then $(CYGPATH_W) 'comp_gzip.c'; else $(CYGPATH_W) '$(srcdir)/comp_gzip.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_gzip.Tpo $(DEPDIR)/fsarchiver-comp_gzip.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_gzip.c' object='fsarchiver-comp_gzip.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_gzip.obj `if test -f 'comp_gzip.c'; then $(CYGPATH_W) 'comp_gzip.c'; else $(CYGPATH_W) '$(srcdir)/comp_gzip.c'; fi` fsarchiver-comp_bzip2.o: comp_bzip2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_bzip2.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_bzip2.Tpo -c -o fsarchiver-comp_bzip2.o `test -f 'comp_bzip2.c' || echo '$(srcdir)/'`comp_bzip2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_bzip2.Tpo $(DEPDIR)/fsarchiver-comp_bzip2.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_bzip2.c' object='fsarchiver-comp_bzip2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_bzip2.o `test -f 'comp_bzip2.c' || echo '$(srcdir)/'`comp_bzip2.c fsarchiver-comp_bzip2.obj: comp_bzip2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_bzip2.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_bzip2.Tpo -c -o fsarchiver-comp_bzip2.obj `if test -f 'comp_bzip2.c'; then $(CYGPATH_W) 'comp_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/comp_bzip2.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_bzip2.Tpo $(DEPDIR)/fsarchiver-comp_bzip2.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_bzip2.c' object='fsarchiver-comp_bzip2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_bzip2.obj `if test -f 'comp_bzip2.c'; then $(CYGPATH_W) 'comp_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/comp_bzip2.c'; fi` fsarchiver-comp_lzma.o: comp_lzma.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lzma.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lzma.Tpo -c -o fsarchiver-comp_lzma.o `test -f 'comp_lzma.c' || echo '$(srcdir)/'`comp_lzma.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lzma.Tpo $(DEPDIR)/fsarchiver-comp_lzma.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lzma.c' object='fsarchiver-comp_lzma.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lzma.o `test -f 'comp_lzma.c' || echo '$(srcdir)/'`comp_lzma.c fsarchiver-comp_lzma.obj: comp_lzma.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lzma.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lzma.Tpo -c -o fsarchiver-comp_lzma.obj `if test -f 'comp_lzma.c'; then $(CYGPATH_W) 'comp_lzma.c'; else $(CYGPATH_W) '$(srcdir)/comp_lzma.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lzma.Tpo $(DEPDIR)/fsarchiver-comp_lzma.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lzma.c' object='fsarchiver-comp_lzma.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lzma.obj `if test -f 'comp_lzma.c'; then $(CYGPATH_W) 'comp_lzma.c'; else $(CYGPATH_W) '$(srcdir)/comp_lzma.c'; fi` fsarchiver-comp_lzo.o: comp_lzo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lzo.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lzo.Tpo -c -o fsarchiver-comp_lzo.o `test -f 'comp_lzo.c' || echo '$(srcdir)/'`comp_lzo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lzo.Tpo $(DEPDIR)/fsarchiver-comp_lzo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lzo.c' object='fsarchiver-comp_lzo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lzo.o `test -f 'comp_lzo.c' || echo '$(srcdir)/'`comp_lzo.c fsarchiver-comp_lzo.obj: comp_lzo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lzo.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lzo.Tpo -c -o fsarchiver-comp_lzo.obj `if test -f 'comp_lzo.c'; then $(CYGPATH_W) 'comp_lzo.c'; else $(CYGPATH_W) '$(srcdir)/comp_lzo.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lzo.Tpo $(DEPDIR)/fsarchiver-comp_lzo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lzo.c' object='fsarchiver-comp_lzo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lzo.obj `if test -f 'comp_lzo.c'; then $(CYGPATH_W) 'comp_lzo.c'; else $(CYGPATH_W) '$(srcdir)/comp_lzo.c'; fi` fsarchiver-comp_lz4.o: comp_lz4.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lz4.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lz4.Tpo -c -o fsarchiver-comp_lz4.o `test -f 'comp_lz4.c' || echo '$(srcdir)/'`comp_lz4.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lz4.Tpo $(DEPDIR)/fsarchiver-comp_lz4.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lz4.c' object='fsarchiver-comp_lz4.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lz4.o `test -f 'comp_lz4.c' || echo '$(srcdir)/'`comp_lz4.c fsarchiver-comp_lz4.obj: comp_lz4.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_lz4.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_lz4.Tpo -c -o fsarchiver-comp_lz4.obj `if test -f 'comp_lz4.c'; then $(CYGPATH_W) 'comp_lz4.c'; else $(CYGPATH_W) '$(srcdir)/comp_lz4.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_lz4.Tpo $(DEPDIR)/fsarchiver-comp_lz4.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_lz4.c' object='fsarchiver-comp_lz4.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_lz4.obj `if test -f 'comp_lz4.c'; then $(CYGPATH_W) 'comp_lz4.c'; else $(CYGPATH_W) '$(srcdir)/comp_lz4.c'; fi` fsarchiver-comp_zstd.o: comp_zstd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_zstd.o -MD -MP -MF $(DEPDIR)/fsarchiver-comp_zstd.Tpo -c -o fsarchiver-comp_zstd.o `test -f 'comp_zstd.c' || echo '$(srcdir)/'`comp_zstd.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_zstd.Tpo $(DEPDIR)/fsarchiver-comp_zstd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_zstd.c' object='fsarchiver-comp_zstd.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_zstd.o `test -f 'comp_zstd.c' || echo '$(srcdir)/'`comp_zstd.c fsarchiver-comp_zstd.obj: comp_zstd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-comp_zstd.obj -MD -MP -MF $(DEPDIR)/fsarchiver-comp_zstd.Tpo -c -o fsarchiver-comp_zstd.obj `if test -f 'comp_zstd.c'; then $(CYGPATH_W) 'comp_zstd.c'; else $(CYGPATH_W) '$(srcdir)/comp_zstd.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-comp_zstd.Tpo $(DEPDIR)/fsarchiver-comp_zstd.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='comp_zstd.c' object='fsarchiver-comp_zstd.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-comp_zstd.obj `if test -f 'comp_zstd.c'; then $(CYGPATH_W) 'comp_zstd.c'; else $(CYGPATH_W) '$(srcdir)/comp_zstd.c'; fi` fsarchiver-crypto.o: crypto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-crypto.o -MD -MP -MF $(DEPDIR)/fsarchiver-crypto.Tpo -c -o fsarchiver-crypto.o `test -f 'crypto.c' || echo '$(srcdir)/'`crypto.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-crypto.Tpo $(DEPDIR)/fsarchiver-crypto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto.c' object='fsarchiver-crypto.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-crypto.o `test -f 'crypto.c' || echo '$(srcdir)/'`crypto.c fsarchiver-crypto.obj: crypto.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-crypto.obj -MD -MP -MF $(DEPDIR)/fsarchiver-crypto.Tpo -c -o fsarchiver-crypto.obj `if test -f 'crypto.c'; then $(CYGPATH_W) 'crypto.c'; else $(CYGPATH_W) '$(srcdir)/crypto.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-crypto.Tpo $(DEPDIR)/fsarchiver-crypto.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto.c' object='fsarchiver-crypto.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-crypto.obj `if test -f 'crypto.c'; then $(CYGPATH_W) 'crypto.c'; else $(CYGPATH_W) '$(srcdir)/crypto.c'; fi` fsarchiver-fs_ntfs.o: fs_ntfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_ntfs.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_ntfs.Tpo -c -o fsarchiver-fs_ntfs.o `test -f 'fs_ntfs.c' || echo '$(srcdir)/'`fs_ntfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_ntfs.Tpo $(DEPDIR)/fsarchiver-fs_ntfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_ntfs.c' object='fsarchiver-fs_ntfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_ntfs.o `test -f 'fs_ntfs.c' || echo '$(srcdir)/'`fs_ntfs.c fsarchiver-fs_ntfs.obj: fs_ntfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_ntfs.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_ntfs.Tpo -c -o fsarchiver-fs_ntfs.obj `if test -f 'fs_ntfs.c'; then $(CYGPATH_W) 'fs_ntfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_ntfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_ntfs.Tpo $(DEPDIR)/fsarchiver-fs_ntfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_ntfs.c' object='fsarchiver-fs_ntfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_ntfs.obj `if test -f 'fs_ntfs.c'; then $(CYGPATH_W) 'fs_ntfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_ntfs.c'; fi` fsarchiver-fs_ext2.o: fs_ext2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_ext2.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_ext2.Tpo -c -o fsarchiver-fs_ext2.o `test -f 'fs_ext2.c' || echo '$(srcdir)/'`fs_ext2.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_ext2.Tpo $(DEPDIR)/fsarchiver-fs_ext2.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_ext2.c' object='fsarchiver-fs_ext2.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_ext2.o `test -f 'fs_ext2.c' || echo '$(srcdir)/'`fs_ext2.c fsarchiver-fs_ext2.obj: fs_ext2.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_ext2.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_ext2.Tpo -c -o fsarchiver-fs_ext2.obj `if test -f 'fs_ext2.c'; then $(CYGPATH_W) 'fs_ext2.c'; else $(CYGPATH_W) '$(srcdir)/fs_ext2.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_ext2.Tpo $(DEPDIR)/fsarchiver-fs_ext2.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_ext2.c' object='fsarchiver-fs_ext2.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_ext2.obj `if test -f 'fs_ext2.c'; then $(CYGPATH_W) 'fs_ext2.c'; else $(CYGPATH_W) '$(srcdir)/fs_ext2.c'; fi` fsarchiver-fs_reiserfs.o: fs_reiserfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_reiserfs.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_reiserfs.Tpo -c -o fsarchiver-fs_reiserfs.o `test -f 'fs_reiserfs.c' || echo '$(srcdir)/'`fs_reiserfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_reiserfs.Tpo $(DEPDIR)/fsarchiver-fs_reiserfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_reiserfs.c' object='fsarchiver-fs_reiserfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_reiserfs.o `test -f 'fs_reiserfs.c' || echo '$(srcdir)/'`fs_reiserfs.c fsarchiver-fs_reiserfs.obj: fs_reiserfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_reiserfs.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_reiserfs.Tpo -c -o fsarchiver-fs_reiserfs.obj `if test -f 'fs_reiserfs.c'; then $(CYGPATH_W) 'fs_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_reiserfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_reiserfs.Tpo $(DEPDIR)/fsarchiver-fs_reiserfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_reiserfs.c' object='fsarchiver-fs_reiserfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_reiserfs.obj `if test -f 'fs_reiserfs.c'; then $(CYGPATH_W) 'fs_reiserfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_reiserfs.c'; fi` fsarchiver-fs_reiser4.o: fs_reiser4.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_reiser4.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_reiser4.Tpo -c -o fsarchiver-fs_reiser4.o `test -f 'fs_reiser4.c' || echo '$(srcdir)/'`fs_reiser4.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_reiser4.Tpo $(DEPDIR)/fsarchiver-fs_reiser4.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_reiser4.c' object='fsarchiver-fs_reiser4.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_reiser4.o `test -f 'fs_reiser4.c' || echo '$(srcdir)/'`fs_reiser4.c fsarchiver-fs_reiser4.obj: fs_reiser4.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_reiser4.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_reiser4.Tpo -c -o fsarchiver-fs_reiser4.obj `if test -f 'fs_reiser4.c'; then $(CYGPATH_W) 'fs_reiser4.c'; else $(CYGPATH_W) '$(srcdir)/fs_reiser4.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_reiser4.Tpo $(DEPDIR)/fsarchiver-fs_reiser4.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_reiser4.c' object='fsarchiver-fs_reiser4.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_reiser4.obj `if test -f 'fs_reiser4.c'; then $(CYGPATH_W) 'fs_reiser4.c'; else $(CYGPATH_W) '$(srcdir)/fs_reiser4.c'; fi` fsarchiver-fs_btrfs.o: fs_btrfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_btrfs.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_btrfs.Tpo -c -o fsarchiver-fs_btrfs.o `test -f 'fs_btrfs.c' || echo '$(srcdir)/'`fs_btrfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_btrfs.Tpo $(DEPDIR)/fsarchiver-fs_btrfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_btrfs.c' object='fsarchiver-fs_btrfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_btrfs.o `test -f 'fs_btrfs.c' || echo '$(srcdir)/'`fs_btrfs.c fsarchiver-fs_btrfs.obj: fs_btrfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_btrfs.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_btrfs.Tpo -c -o fsarchiver-fs_btrfs.obj `if test -f 'fs_btrfs.c'; then $(CYGPATH_W) 'fs_btrfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_btrfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_btrfs.Tpo $(DEPDIR)/fsarchiver-fs_btrfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_btrfs.c' object='fsarchiver-fs_btrfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_btrfs.obj `if test -f 'fs_btrfs.c'; then $(CYGPATH_W) 'fs_btrfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_btrfs.c'; fi` fsarchiver-fs_xfs.o: fs_xfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_xfs.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_xfs.Tpo -c -o fsarchiver-fs_xfs.o `test -f 'fs_xfs.c' || echo '$(srcdir)/'`fs_xfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_xfs.Tpo $(DEPDIR)/fsarchiver-fs_xfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_xfs.c' object='fsarchiver-fs_xfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_xfs.o `test -f 'fs_xfs.c' || echo '$(srcdir)/'`fs_xfs.c fsarchiver-fs_xfs.obj: fs_xfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_xfs.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_xfs.Tpo -c -o fsarchiver-fs_xfs.obj `if test -f 'fs_xfs.c'; then $(CYGPATH_W) 'fs_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_xfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_xfs.Tpo $(DEPDIR)/fsarchiver-fs_xfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_xfs.c' object='fsarchiver-fs_xfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_xfs.obj `if test -f 'fs_xfs.c'; then $(CYGPATH_W) 'fs_xfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_xfs.c'; fi` fsarchiver-fs_jfs.o: fs_jfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_jfs.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_jfs.Tpo -c -o fsarchiver-fs_jfs.o `test -f 'fs_jfs.c' || echo '$(srcdir)/'`fs_jfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_jfs.Tpo $(DEPDIR)/fsarchiver-fs_jfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_jfs.c' object='fsarchiver-fs_jfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_jfs.o `test -f 'fs_jfs.c' || echo '$(srcdir)/'`fs_jfs.c fsarchiver-fs_jfs.obj: fs_jfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_jfs.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_jfs.Tpo -c -o fsarchiver-fs_jfs.obj `if test -f 'fs_jfs.c'; then $(CYGPATH_W) 'fs_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_jfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_jfs.Tpo $(DEPDIR)/fsarchiver-fs_jfs.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_jfs.c' object='fsarchiver-fs_jfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_jfs.obj `if test -f 'fs_jfs.c'; then $(CYGPATH_W) 'fs_jfs.c'; else $(CYGPATH_W) '$(srcdir)/fs_jfs.c'; fi` fsarchiver-fs_vfat.o: fs_vfat.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_vfat.o -MD -MP -MF $(DEPDIR)/fsarchiver-fs_vfat.Tpo -c -o fsarchiver-fs_vfat.o `test -f 'fs_vfat.c' || echo '$(srcdir)/'`fs_vfat.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_vfat.Tpo $(DEPDIR)/fsarchiver-fs_vfat.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_vfat.c' object='fsarchiver-fs_vfat.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_vfat.o `test -f 'fs_vfat.c' || echo '$(srcdir)/'`fs_vfat.c fsarchiver-fs_vfat.obj: fs_vfat.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-fs_vfat.obj -MD -MP -MF $(DEPDIR)/fsarchiver-fs_vfat.Tpo -c -o fsarchiver-fs_vfat.obj `if test -f 'fs_vfat.c'; then $(CYGPATH_W) 'fs_vfat.c'; else $(CYGPATH_W) '$(srcdir)/fs_vfat.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-fs_vfat.Tpo $(DEPDIR)/fsarchiver-fs_vfat.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fs_vfat.c' object='fsarchiver-fs_vfat.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-fs_vfat.obj `if test -f 'fs_vfat.c'; then $(CYGPATH_W) 'fs_vfat.c'; else $(CYGPATH_W) '$(srcdir)/fs_vfat.c'; fi` fsarchiver-common.o: common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-common.o -MD -MP -MF $(DEPDIR)/fsarchiver-common.Tpo -c -o fsarchiver-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-common.Tpo $(DEPDIR)/fsarchiver-common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='fsarchiver-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-common.o `test -f 'common.c' || echo '$(srcdir)/'`common.c fsarchiver-common.obj: common.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-common.obj -MD -MP -MF $(DEPDIR)/fsarchiver-common.Tpo -c -o fsarchiver-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-common.Tpo $(DEPDIR)/fsarchiver-common.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='common.c' object='fsarchiver-common.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-common.obj `if test -f 'common.c'; then $(CYGPATH_W) 'common.c'; else $(CYGPATH_W) '$(srcdir)/common.c'; fi` fsarchiver-dico.o: dico.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-dico.o -MD -MP -MF $(DEPDIR)/fsarchiver-dico.Tpo -c -o fsarchiver-dico.o `test -f 'dico.c' || echo '$(srcdir)/'`dico.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-dico.Tpo $(DEPDIR)/fsarchiver-dico.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dico.c' object='fsarchiver-dico.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-dico.o `test -f 'dico.c' || echo '$(srcdir)/'`dico.c fsarchiver-dico.obj: dico.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-dico.obj -MD -MP -MF $(DEPDIR)/fsarchiver-dico.Tpo -c -o fsarchiver-dico.obj `if test -f 'dico.c'; then $(CYGPATH_W) 'dico.c'; else $(CYGPATH_W) '$(srcdir)/dico.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-dico.Tpo $(DEPDIR)/fsarchiver-dico.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dico.c' object='fsarchiver-dico.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-dico.obj `if test -f 'dico.c'; then $(CYGPATH_W) 'dico.c'; else $(CYGPATH_W) '$(srcdir)/dico.c'; fi` fsarchiver-strdico.o: strdico.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-strdico.o -MD -MP -MF $(DEPDIR)/fsarchiver-strdico.Tpo -c -o fsarchiver-strdico.o `test -f 'strdico.c' || echo '$(srcdir)/'`strdico.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-strdico.Tpo $(DEPDIR)/fsarchiver-strdico.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strdico.c' object='fsarchiver-strdico.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-strdico.o `test -f 'strdico.c' || echo '$(srcdir)/'`strdico.c fsarchiver-strdico.obj: strdico.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-strdico.obj -MD -MP -MF $(DEPDIR)/fsarchiver-strdico.Tpo -c -o fsarchiver-strdico.obj `if test -f 'strdico.c'; then $(CYGPATH_W) 'strdico.c'; else $(CYGPATH_W) '$(srcdir)/strdico.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-strdico.Tpo $(DEPDIR)/fsarchiver-strdico.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strdico.c' object='fsarchiver-strdico.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-strdico.obj `if test -f 'strdico.c'; then $(CYGPATH_W) 'strdico.c'; else $(CYGPATH_W) '$(srcdir)/strdico.c'; fi` fsarchiver-dichl.o: dichl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-dichl.o -MD -MP -MF $(DEPDIR)/fsarchiver-dichl.Tpo -c -o fsarchiver-dichl.o `test -f 'dichl.c' || echo '$(srcdir)/'`dichl.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-dichl.Tpo $(DEPDIR)/fsarchiver-dichl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dichl.c' object='fsarchiver-dichl.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-dichl.o `test -f 'dichl.c' || echo '$(srcdir)/'`dichl.c fsarchiver-dichl.obj: dichl.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-dichl.obj -MD -MP -MF $(DEPDIR)/fsarchiver-dichl.Tpo -c -o fsarchiver-dichl.obj `if test -f 'dichl.c'; then $(CYGPATH_W) 'dichl.c'; else $(CYGPATH_W) '$(srcdir)/dichl.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-dichl.Tpo $(DEPDIR)/fsarchiver-dichl.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dichl.c' object='fsarchiver-dichl.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-dichl.obj `if test -f 'dichl.c'; then $(CYGPATH_W) 'dichl.c'; else $(CYGPATH_W) '$(srcdir)/dichl.c'; fi` fsarchiver-queue.o: queue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-queue.o -MD -MP -MF $(DEPDIR)/fsarchiver-queue.Tpo -c -o fsarchiver-queue.o `test -f 'queue.c' || echo '$(srcdir)/'`queue.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-queue.Tpo $(DEPDIR)/fsarchiver-queue.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='queue.c' object='fsarchiver-queue.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-queue.o `test -f 'queue.c' || echo '$(srcdir)/'`queue.c fsarchiver-queue.obj: queue.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-queue.obj -MD -MP -MF $(DEPDIR)/fsarchiver-queue.Tpo -c -o fsarchiver-queue.obj `if test -f 'queue.c'; then $(CYGPATH_W) 'queue.c'; else $(CYGPATH_W) '$(srcdir)/queue.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-queue.Tpo $(DEPDIR)/fsarchiver-queue.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='queue.c' object='fsarchiver-queue.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-queue.obj `if test -f 'queue.c'; then $(CYGPATH_W) 'queue.c'; else $(CYGPATH_W) '$(srcdir)/queue.c'; fi` fsarchiver-error.o: error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-error.o -MD -MP -MF $(DEPDIR)/fsarchiver-error.Tpo -c -o fsarchiver-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-error.Tpo $(DEPDIR)/fsarchiver-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='error.c' object='fsarchiver-error.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-error.o `test -f 'error.c' || echo '$(srcdir)/'`error.c fsarchiver-error.obj: error.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-error.obj -MD -MP -MF $(DEPDIR)/fsarchiver-error.Tpo -c -o fsarchiver-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-error.Tpo $(DEPDIR)/fsarchiver-error.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='error.c' object='fsarchiver-error.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-error.obj `if test -f 'error.c'; then $(CYGPATH_W) 'error.c'; else $(CYGPATH_W) '$(srcdir)/error.c'; fi` fsarchiver-syncthread.o: syncthread.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-syncthread.o -MD -MP -MF $(DEPDIR)/fsarchiver-syncthread.Tpo -c -o fsarchiver-syncthread.o `test -f 'syncthread.c' || echo '$(srcdir)/'`syncthread.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-syncthread.Tpo $(DEPDIR)/fsarchiver-syncthread.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syncthread.c' object='fsarchiver-syncthread.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-syncthread.o `test -f 'syncthread.c' || echo '$(srcdir)/'`syncthread.c fsarchiver-syncthread.obj: syncthread.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-syncthread.obj -MD -MP -MF $(DEPDIR)/fsarchiver-syncthread.Tpo -c -o fsarchiver-syncthread.obj `if test -f 'syncthread.c'; then $(CYGPATH_W) 'syncthread.c'; else $(CYGPATH_W) '$(srcdir)/syncthread.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-syncthread.Tpo $(DEPDIR)/fsarchiver-syncthread.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syncthread.c' object='fsarchiver-syncthread.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-syncthread.obj `if test -f 'syncthread.c'; then $(CYGPATH_W) 'syncthread.c'; else $(CYGPATH_W) '$(srcdir)/syncthread.c'; fi` fsarchiver-datafile.o: datafile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-datafile.o -MD -MP -MF $(DEPDIR)/fsarchiver-datafile.Tpo -c -o fsarchiver-datafile.o `test -f 'datafile.c' || echo '$(srcdir)/'`datafile.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-datafile.Tpo $(DEPDIR)/fsarchiver-datafile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='datafile.c' object='fsarchiver-datafile.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-datafile.o `test -f 'datafile.c' || echo '$(srcdir)/'`datafile.c fsarchiver-datafile.obj: datafile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-datafile.obj -MD -MP -MF $(DEPDIR)/fsarchiver-datafile.Tpo -c -o fsarchiver-datafile.obj `if test -f 'datafile.c'; then $(CYGPATH_W) 'datafile.c'; else $(CYGPATH_W) '$(srcdir)/datafile.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-datafile.Tpo $(DEPDIR)/fsarchiver-datafile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='datafile.c' object='fsarchiver-datafile.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-datafile.obj `if test -f 'datafile.c'; then $(CYGPATH_W) 'datafile.c'; else $(CYGPATH_W) '$(srcdir)/datafile.c'; fi` fsarchiver-strlist.o: strlist.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-strlist.o -MD -MP -MF $(DEPDIR)/fsarchiver-strlist.Tpo -c -o fsarchiver-strlist.o `test -f 'strlist.c' || echo '$(srcdir)/'`strlist.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-strlist.Tpo $(DEPDIR)/fsarchiver-strlist.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strlist.c' object='fsarchiver-strlist.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-strlist.o `test -f 'strlist.c' || echo '$(srcdir)/'`strlist.c fsarchiver-strlist.obj: strlist.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-strlist.obj -MD -MP -MF $(DEPDIR)/fsarchiver-strlist.Tpo -c -o fsarchiver-strlist.obj `if test -f 'strlist.c'; then $(CYGPATH_W) 'strlist.c'; else $(CYGPATH_W) '$(srcdir)/strlist.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-strlist.Tpo $(DEPDIR)/fsarchiver-strlist.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='strlist.c' object='fsarchiver-strlist.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-strlist.obj `if test -f 'strlist.c'; then $(CYGPATH_W) 'strlist.c'; else $(CYGPATH_W) '$(srcdir)/strlist.c'; fi` fsarchiver-regmulti.o: regmulti.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-regmulti.o -MD -MP -MF $(DEPDIR)/fsarchiver-regmulti.Tpo -c -o fsarchiver-regmulti.o `test -f 'regmulti.c' || echo '$(srcdir)/'`regmulti.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-regmulti.Tpo $(DEPDIR)/fsarchiver-regmulti.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='regmulti.c' object='fsarchiver-regmulti.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-regmulti.o `test -f 'regmulti.c' || echo '$(srcdir)/'`regmulti.c fsarchiver-regmulti.obj: regmulti.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-regmulti.obj -MD -MP -MF $(DEPDIR)/fsarchiver-regmulti.Tpo -c -o fsarchiver-regmulti.obj `if test -f 'regmulti.c'; then $(CYGPATH_W) 'regmulti.c'; else $(CYGPATH_W) '$(srcdir)/regmulti.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-regmulti.Tpo $(DEPDIR)/fsarchiver-regmulti.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='regmulti.c' object='fsarchiver-regmulti.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-regmulti.obj `if test -f 'regmulti.c'; then $(CYGPATH_W) 'regmulti.c'; else $(CYGPATH_W) '$(srcdir)/regmulti.c'; fi` fsarchiver-options.o: options.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-options.o -MD -MP -MF $(DEPDIR)/fsarchiver-options.Tpo -c -o fsarchiver-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-options.Tpo $(DEPDIR)/fsarchiver-options.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='options.c' object='fsarchiver-options.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-options.o `test -f 'options.c' || echo '$(srcdir)/'`options.c fsarchiver-options.obj: options.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-options.obj -MD -MP -MF $(DEPDIR)/fsarchiver-options.Tpo -c -o fsarchiver-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-options.Tpo $(DEPDIR)/fsarchiver-options.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='options.c' object='fsarchiver-options.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-options.obj `if test -f 'options.c'; then $(CYGPATH_W) 'options.c'; else $(CYGPATH_W) '$(srcdir)/options.c'; fi` fsarchiver-logfile.o: logfile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-logfile.o -MD -MP -MF $(DEPDIR)/fsarchiver-logfile.Tpo -c -o fsarchiver-logfile.o `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-logfile.Tpo $(DEPDIR)/fsarchiver-logfile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='logfile.c' object='fsarchiver-logfile.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-logfile.o `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c fsarchiver-logfile.obj: logfile.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-logfile.obj -MD -MP -MF $(DEPDIR)/fsarchiver-logfile.Tpo -c -o fsarchiver-logfile.obj `if test -f 'logfile.c'; then $(CYGPATH_W) 'logfile.c'; else $(CYGPATH_W) '$(srcdir)/logfile.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-logfile.Tpo $(DEPDIR)/fsarchiver-logfile.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='logfile.c' object='fsarchiver-logfile.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-logfile.obj `if test -f 'logfile.c'; then $(CYGPATH_W) 'logfile.c'; else $(CYGPATH_W) '$(srcdir)/logfile.c'; fi` fsarchiver-filesys.o: filesys.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-filesys.o -MD -MP -MF $(DEPDIR)/fsarchiver-filesys.Tpo -c -o fsarchiver-filesys.o `test -f 'filesys.c' || echo '$(srcdir)/'`filesys.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-filesys.Tpo $(DEPDIR)/fsarchiver-filesys.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filesys.c' object='fsarchiver-filesys.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-filesys.o `test -f 'filesys.c' || echo '$(srcdir)/'`filesys.c fsarchiver-filesys.obj: filesys.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-filesys.obj -MD -MP -MF $(DEPDIR)/fsarchiver-filesys.Tpo -c -o fsarchiver-filesys.obj `if test -f 'filesys.c'; then $(CYGPATH_W) 'filesys.c'; else $(CYGPATH_W) '$(srcdir)/filesys.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-filesys.Tpo $(DEPDIR)/fsarchiver-filesys.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filesys.c' object='fsarchiver-filesys.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-filesys.obj `if test -f 'filesys.c'; then $(CYGPATH_W) 'filesys.c'; else $(CYGPATH_W) '$(srcdir)/filesys.c'; fi` fsarchiver-devinfo.o: devinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-devinfo.o -MD -MP -MF $(DEPDIR)/fsarchiver-devinfo.Tpo -c -o fsarchiver-devinfo.o `test -f 'devinfo.c' || echo '$(srcdir)/'`devinfo.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-devinfo.Tpo $(DEPDIR)/fsarchiver-devinfo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='devinfo.c' object='fsarchiver-devinfo.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-devinfo.o `test -f 'devinfo.c' || echo '$(srcdir)/'`devinfo.c fsarchiver-devinfo.obj: devinfo.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -MT fsarchiver-devinfo.obj -MD -MP -MF $(DEPDIR)/fsarchiver-devinfo.Tpo -c -o fsarchiver-devinfo.obj `if test -f 'devinfo.c'; then $(CYGPATH_W) 'devinfo.c'; else $(CYGPATH_W) '$(srcdir)/devinfo.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/fsarchiver-devinfo.Tpo $(DEPDIR)/fsarchiver-devinfo.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='devinfo.c' object='fsarchiver-devinfo.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fsarchiver_CFLAGS) $(CFLAGS) -c -o fsarchiver-devinfo.obj `if test -f 'devinfo.c'; then $(CYGPATH_W) 'devinfo.c'; else $(CYGPATH_W) '$(srcdir)/devinfo.c'; fi` ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/fsarchiver-archinfo.Po -rm -f ./$(DEPDIR)/fsarchiver-archreader.Po -rm -f ./$(DEPDIR)/fsarchiver-archwriter.Po -rm -f ./$(DEPDIR)/fsarchiver-common.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_bzip2.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_gzip.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lz4.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lzma.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lzo.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_zstd.Po -rm -f ./$(DEPDIR)/fsarchiver-crypto.Po -rm -f ./$(DEPDIR)/fsarchiver-datafile.Po -rm -f ./$(DEPDIR)/fsarchiver-devinfo.Po -rm -f ./$(DEPDIR)/fsarchiver-dichl.Po -rm -f ./$(DEPDIR)/fsarchiver-dico.Po -rm -f ./$(DEPDIR)/fsarchiver-error.Po -rm -f ./$(DEPDIR)/fsarchiver-filesys.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_btrfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_ext2.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_jfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_ntfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_reiser4.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_reiserfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_vfat.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_xfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fsarchiver.Po -rm -f ./$(DEPDIR)/fsarchiver-logfile.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_probe.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_restore.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_save.Po -rm -f ./$(DEPDIR)/fsarchiver-options.Po -rm -f ./$(DEPDIR)/fsarchiver-queue.Po -rm -f ./$(DEPDIR)/fsarchiver-regmulti.Po -rm -f ./$(DEPDIR)/fsarchiver-strdico.Po -rm -f ./$(DEPDIR)/fsarchiver-strlist.Po -rm -f ./$(DEPDIR)/fsarchiver-syncthread.Po -rm -f ./$(DEPDIR)/fsarchiver-thread_archio.Po -rm -f ./$(DEPDIR)/fsarchiver-thread_comp.Po -rm -f ./$(DEPDIR)/fsarchiver-writebuf.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/fsarchiver-archinfo.Po -rm -f ./$(DEPDIR)/fsarchiver-archreader.Po -rm -f ./$(DEPDIR)/fsarchiver-archwriter.Po -rm -f ./$(DEPDIR)/fsarchiver-common.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_bzip2.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_gzip.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lz4.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lzma.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_lzo.Po -rm -f ./$(DEPDIR)/fsarchiver-comp_zstd.Po -rm -f ./$(DEPDIR)/fsarchiver-crypto.Po -rm -f ./$(DEPDIR)/fsarchiver-datafile.Po -rm -f ./$(DEPDIR)/fsarchiver-devinfo.Po -rm -f ./$(DEPDIR)/fsarchiver-dichl.Po -rm -f ./$(DEPDIR)/fsarchiver-dico.Po -rm -f ./$(DEPDIR)/fsarchiver-error.Po -rm -f ./$(DEPDIR)/fsarchiver-filesys.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_btrfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_ext2.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_jfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_ntfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_reiser4.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_reiserfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_vfat.Po -rm -f ./$(DEPDIR)/fsarchiver-fs_xfs.Po -rm -f ./$(DEPDIR)/fsarchiver-fsarchiver.Po -rm -f ./$(DEPDIR)/fsarchiver-logfile.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_probe.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_restore.Po -rm -f ./$(DEPDIR)/fsarchiver-oper_save.Po -rm -f ./$(DEPDIR)/fsarchiver-options.Po -rm -f ./$(DEPDIR)/fsarchiver-queue.Po -rm -f ./$(DEPDIR)/fsarchiver-regmulti.Po -rm -f ./$(DEPDIR)/fsarchiver-strdico.Po -rm -f ./$(DEPDIR)/fsarchiver-strlist.Po -rm -f ./$(DEPDIR)/fsarchiver-syncthread.Po -rm -f ./$(DEPDIR)/fsarchiver-thread_archio.Po -rm -f ./$(DEPDIR)/fsarchiver-thread_comp.Po -rm -f ./$(DEPDIR)/fsarchiver-writebuf.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-sbinPROGRAMS cscopelist-am ctags ctags-am \ distclean distclean-compile distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-sbinPROGRAMS install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-sbinPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: fsarchiver-0.8.6/src/comp_zstd.h0000644000175000017500000000170013655317102013545 00000000000000 /* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __COMPRESS_ZSTD_H__ #define __COMPRESS_ZSTD_H__ #ifdef OPTION_ZSTD_SUPPORT #include int compress_block_zstd(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level); int uncompress_block_zstd(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf); #endif // OPTION_ZSTD_SUPPORT #endif // __COMPRESS_ZSTD_H__ fsarchiver-0.8.6/src/archwriter.h0000644000175000017500000000503713655317102013724 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __ARCHWRITER_H__ #define __ARCHWRITER_H__ #include #include "strlist.h" struct s_writebuf; struct s_blockinfo; struct s_headinfo; struct s_strlist; struct s_archwriter; typedef struct s_archwriter carchwriter; struct s_archwriter { int archfd; // file descriptor of the current volume (set to -1 when closed) u32 archid; // 32bit archive id for checking (random number generated at creation) u32 curvol; // current volume number, starts at 0, incremented when we change the volume bool newarch; // true when the archive has been created by then current process char filefmt[FSA_MAX_FILEFMTLEN]; // file format of that archive char creatver[FSA_MAX_PROGVERLEN]; // fsa version used to create archive char label[FSA_MAX_LABELLEN]; // archive label defined by the user char basepath[PATH_MAX]; // path of the first volume of an archive char volpath[PATH_MAX]; // path of the current volume of an archive cstrlist vollist; // paths to all volumes of an archive }; int archwriter_init(carchwriter *ai); int archwriter_destroy(carchwriter *ai); int archwriter_create(carchwriter *ai); int archwriter_close(carchwriter *ai); int archwriter_remove(carchwriter *ai); int archwriter_generate_id(carchwriter *ai); s64 archwriter_get_currentpos(carchwriter *ai); int archwriter_is_path_to_curvol(carchwriter *ai, char *path); int archwriter_write_buffer(carchwriter *ai, struct s_writebuf *wb); int archwriter_incvolume(carchwriter *ai, bool waitkeypress); int archwriter_volpath(carchwriter *ai); int archwriter_write_volheader(carchwriter *ai); int archwriter_write_volfooter(carchwriter *ai, bool lastvol); int archwriter_split_check(carchwriter *ai, struct s_writebuf *wb); int archwriter_split_if_necessary(carchwriter *ai, struct s_writebuf *wb); int archwriter_dowrite_block(carchwriter *ai, struct s_blockinfo *blkinfo); int archwriter_dowrite_header(carchwriter *ai, struct s_headinfo *headinfo); #endif // __ARCHWRITER_H__ fsarchiver-0.8.6/src/fs_xfs.h0000644000175000017500000002401414014417711013033 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __FS_XFS_H__ #define __FS_XFS_H__ struct s_dico; struct s_strlist; /* * Super block * Fits into a sector-sized buffer at address 0 of each allocation group. * Only the first of these is ever updated except during growfs. */ #define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */ #define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */ #define XFS_SB_VERSION_2 2 /* 6.2 - attributes */ #define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */ #define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */ #define XFS_SB_VERSION_5 5 /* CRC enabled filesystem */ #define XFS_SB_VERSION_NUMBITS 0x000f #define XFS_SB_VERSION_ALLFBITS 0xfff0 #define XFS_SB_VERSION_ATTRBIT 0x0010 #define XFS_SB_VERSION_NLINKBIT 0x0020 #define XFS_SB_VERSION_QUOTABIT 0x0040 #define XFS_SB_VERSION_ALIGNBIT 0x0080 #define XFS_SB_VERSION_DALIGNBIT 0x0100 #define XFS_SB_VERSION_SHAREDBIT 0x0200 #define XFS_SB_VERSION_LOGV2BIT 0x0400 #define XFS_SB_VERSION_SECTORBIT 0x0800 #define XFS_SB_VERSION_EXTFLGBIT 0x1000 #define XFS_SB_VERSION_DIRV2BIT 0x2000 #define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */ #define XFS_SB_VERSION_MOREBITSBIT 0x8000 int xfs_mkfs(struct s_dico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid); int xfs_getinfo(struct s_dico *d, char *devname); int xfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo); int xfs_get_reqmntopt(char *partition, struct s_strlist *reqopt, struct s_strlist *badopt); int xfs_umount(char *partition, char *mntbuf); int xfs_test(char *devname); int xfs_check_compatibility(u64 compat, u64 ro_compat, u64 incompat, u64 log_incompat); typedef uint32_t xfs_agblock_t; /* blockno in alloc. group */ typedef uint32_t xfs_extlen_t; /* extent length in blocks */ typedef uint32_t xfs_agnumber_t; /* allocation group number */ typedef int32_t xfs_extnum_t; /* # of extents in a file */ typedef int16_t xfs_aextnum_t; /* # extents in an attribute fork */ typedef int64_t xfs_fsize_t; /* bytes in a file */ typedef uint64_t xfs_ufsize_t; /* unsigned bytes in a file */ typedef int32_t xfs_suminfo_t; /* type of bitmap summary info */ typedef int32_t xfs_rtword_t; /* word type for bitmap manipulations */ typedef int64_t xfs_lsn_t; /* log sequence number */ typedef int32_t xfs_tid_t; /* transaction identifier */ typedef uint32_t xfs_dablk_t; /* dir/attr block number (in file) */ typedef uint32_t xfs_dahash_t; /* dir/attr hash value */ typedef uint16_t xfs_prid_t; /* prid_t truncated to 16bits in XFS */ /* * These types are 64 bits on disk but are either 32 or 64 bits in memory. * Disk based types: */ typedef uint64_t xfs_fsblock_t; /* blockno in filesystem (agno|agbno) */ typedef uint64_t xfs_rfsblock_t; /* blockno in filesystem (raw) */ typedef uint64_t xfs_rtblock_t; /* extent (block) in realtime area */ typedef uint64_t xfs_dfiloff_t; /* block number in a file */ typedef uint64_t xfs_dfilblks_t; /* number of blocks in a file */ typedef __s64 xfs_off_t; /* type */ typedef __u64 xfs_ino_t; /* type */ typedef __s64 xfs_daddr_t; /* type */ typedef char * xfs_caddr_t; /* type */ typedef __u32 xfs_dev_t; typedef __u32 xfs_nlink_t; /* * Superblock - in core version. Must match the ondisk version below. * Must be padded to 64 bit alignment. */ struct xfs_sb { uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */ uint32_t sb_blocksize; /* logical block size, bytes */ xfs_rfsblock_t sb_dblocks; /* number of data blocks */ xfs_rfsblock_t sb_rblocks; /* number of realtime blocks */ xfs_rtblock_t sb_rextents; /* number of realtime extents */ uuid_t sb_uuid; /* user-visible file system unique id */ xfs_fsblock_t sb_logstart; /* starting block of log if internal */ xfs_ino_t sb_rootino; /* root inode number */ xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */ xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */ xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */ xfs_agblock_t sb_agblocks; /* size of an allocation group */ xfs_agnumber_t sb_agcount; /* number of allocation groups */ xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */ xfs_extlen_t sb_logblocks; /* number of log blocks */ uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */ uint16_t sb_sectsize; /* volume sector size, bytes */ uint16_t sb_inodesize; /* inode size, bytes */ uint16_t sb_inopblock; /* inodes per block */ char sb_fname[12]; /* file system name */ uint8_t sb_blocklog; /* log2 of sb_blocksize */ uint8_t sb_sectlog; /* log2 of sb_sectsize */ uint8_t sb_inodelog; /* log2 of sb_inodesize */ uint8_t sb_inopblog; /* log2 of sb_inopblock */ uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */ uint8_t sb_rextslog; /* log2 of sb_rextents */ uint8_t sb_inprogress; /* mkfs is in progress, don't mount */ uint8_t sb_imax_pct; /* max % of fs for inode space */ /* statistics */ /* * These fields must remain contiguous. If you really * want to change their layout, make sure you fix the * code in xfs_trans_apply_sb_deltas(). */ uint64_t sb_icount; /* allocated inodes */ uint64_t sb_ifree; /* free inodes */ uint64_t sb_fdblocks; /* free data blocks */ uint64_t sb_frextents; /* free realtime extents */ /* * End contiguous fields. */ xfs_ino_t sb_uquotino; /* user quota inode */ xfs_ino_t sb_gquotino; /* group quota inode */ uint16_t sb_qflags; /* quota flags */ uint8_t sb_flags; /* misc. flags */ uint8_t sb_shared_vn; /* shared version number */ xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */ uint32_t sb_unit; /* stripe or raid unit */ uint32_t sb_width; /* stripe or raid width */ uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */ uint8_t sb_logsectlog; /* log2 of the log sector size */ uint16_t sb_logsectsize; /* sector size for the log, bytes */ uint32_t sb_logsunit; /* stripe unit size for the log */ uint32_t sb_features2; /* additional feature bits */ /* * bad features2 field as a result of failing to pad the sb structure to * 64 bits. Some machines will be using this field for features2 bits. * Easiest just to mark it bad and not use it for anything else. * * This is not kept up to date in memory; it is always overwritten by * the value in sb_features2 when formatting the incore superblock to * the disk buffer. */ uint32_t sb_bad_features2; /* version 5 superblock fields start here */ /* feature masks */ uint32_t sb_features_compat; uint32_t sb_features_ro_compat; uint32_t sb_features_incompat; uint32_t sb_features_log_incompat; uint32_t sb_crc; /* superblock crc */ xfs_extlen_t sb_spino_align; /* sparse inode chunk alignment */ xfs_ino_t sb_pquotino; /* project quota inode */ xfs_lsn_t sb_lsn; /* last write sequence */ uuid_t sb_meta_uuid; /* metadata file system unique id */ /* must be padded to 64 bit alignment */ }; // XFS features used in XFS version 5 only #define XFS_SB_FEAT_RO_COMPAT_FINOBT (1 << 0) /* free inode btree */ #define XFS_SB_FEAT_RO_COMPAT_RMAPBT (1 << 1) /* reverse map btree */ #define XFS_SB_FEAT_RO_COMPAT_REFLINK (1 << 2) /* reflinked files */ #define XFS_SB_FEAT_RO_COMPAT_INOBTCNT (1 << 3) /* inobt block counts */ #define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */ #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */ #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */ #define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */ // features supported by the current fsarchiver version #define FSA_XFS_FEATURE_COMPAT_SUPP (u64)(0) #define FSA_XFS_FEATURE_RO_COMPAT_SUPP (u64)(XFS_SB_FEAT_RO_COMPAT_FINOBT|\ XFS_SB_FEAT_RO_COMPAT_RMAPBT|\ XFS_SB_FEAT_RO_COMPAT_REFLINK|\ XFS_SB_FEAT_RO_COMPAT_INOBTCNT) #define FSA_XFS_FEATURE_INCOMPAT_SUPP (u64)(XFS_SB_FEAT_INCOMPAT_FTYPE|\ XFS_SB_FEAT_INCOMPAT_SPINODES|\ XFS_SB_FEAT_INCOMPAT_META_UUID|\ XFS_SB_FEAT_INCOMPAT_BIGTIME) #define FSA_XFS_FEATURE_LOG_INCOMPAT_SUPP (u64)(0) #endif // __FS_XFS_H__ fsarchiver-0.8.6/src/archreader.c0000644000175000017500000004021213655317102013637 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "options.h" #include "archreader.h" #include "queue.h" #include "comp_gzip.h" #include "comp_bzip2.h" #include "error.h" int archreader_init(carchreader *ai) { assert(ai); memset(ai, 0, sizeof(struct s_archreader)); ai->cryptalgo=ENCRYPT_NULL; ai->compalgo=COMPRESS_NULL; ai->fsacomp=-1; ai->complevel=-1; ai->archfd=-1; ai->archid=0; ai->curvol=0; ai->filefmtver=0; ai->hasdirsinfohead=false; return 0; } int archreader_destroy(carchreader *ai) { assert(ai); return 0; } int archreader_open(carchreader *ai) { struct stat64 st; char volhead[64]; int magiclen; assert(ai); // on the archive volume ai->archfd=open64(ai->volpath, O_RDONLY|O_LARGEFILE); if (ai->archfd<0) { sysprintf ("cannot open archive %s\n", ai->volpath); return -1; } // check the archive volume is a regular file if (fstat64(ai->archfd, &st)!=0) { sysprintf("fstat64(%s) failed\n", ai->volpath); return -1; } if (!S_ISREG(st.st_mode)) { errprintf("%s is not a regular file, cannot continue\n", ai->volpath); close(ai->archfd); return -1; } // read file format version and rewind to beginning of the volume if (read(ai->archfd, volhead, sizeof(volhead))!=sizeof(volhead)) { sysprintf("cannot read magic from %s\n", ai->volpath); close(ai->archfd); return -1; } if (lseek64(ai->archfd, 0, SEEK_SET)!=0) { sysprintf("cannot rewind volume %s\n", ai->volpath); close(ai->archfd); return -1; } // interpret magic an get file format version magiclen=strlen(FSA_FILEFORMAT); if ((memcmp(volhead+40, "FsArCh_001", magiclen)==0) || (memcmp(volhead+40, "FsArCh_00Y", magiclen)==0)) { ai->filefmtver=1; } else if (memcmp(volhead+42, "FsArCh_002", magiclen)==0) { ai->filefmtver=2; } else { errprintf("%s is not a supported fsarchiver file format\n", ai->volpath); close(ai->archfd); return -1; } msgprintf(MSG_VERB2, "Detected fileformat=%d in archive %s\n", (int)ai->filefmtver, ai->volpath); return 0; } int archreader_close(carchreader *ai) { assert(ai); if (ai->archfd<0) return -1; lockf(ai->archfd, F_ULOCK, 0); close(ai->archfd); ai->archfd=-1; return 0; } int archreader_volpath(carchreader *ai) { int res; res=get_path_to_volume(ai->volpath, PATH_MAX, ai->basepath, ai->curvol); return res; } int archreader_incvolume(carchreader *ai, bool waitkeypress) { assert(ai); ai->curvol++; return archreader_volpath(ai); } int archreader_read_data(carchreader *ai, void *data, u64 size) { long lres; assert(ai); if ((lres=read(ai->archfd, (char*)data, (long)size))!=(long)size) { sysprintf("read failed: read(size=%ld)=%ld\n", (long)size, lres); return -1; } return 0; } int archreader_read_dico(carchreader *ai, cdico *d) { u16 size; u32 headerlen; u32 origsum; u32 newsum; u8 *buffer; u8 *bufpos; u16 temp16; u32 temp32; u8 section; u16 count; u8 type; u16 key; int i; assert(ai); assert(d); // header-len, header-data, header-checksum switch (ai->filefmtver) { case 1: if (archreader_read_data(ai, &temp16, sizeof(temp16))!=0) { errprintf("imgdisk_read_data() failed\n"); return OLDERR_FATAL; } headerlen=le16_to_cpu(temp16); break; case 2: if (archreader_read_data(ai, &temp32, sizeof(temp32))!=0) { errprintf("imgdisk_read_data() failed\n"); return OLDERR_FATAL; } headerlen=le32_to_cpu(temp32); break; default: errprintf("Fatal error: invalid file format version: ai->filefmtver=%d\n", ai->filefmtver); return OLDERR_FATAL; } bufpos=buffer=malloc(headerlen); if (!buffer) { errprintf("cannot allocate memory for header\n"); return FSAERR_ENOMEM; } if (archreader_read_data(ai, buffer, headerlen)!=0) { errprintf("cannot read header data\n"); free(buffer); return OLDERR_FATAL; } if (archreader_read_data(ai, &temp32, sizeof(temp32))!=0) { errprintf("cannot read header checksum\n"); free(buffer); return OLDERR_FATAL; } origsum=le32_to_cpu(temp32); // check header-data integrity using checksum newsum=fletcher32(buffer, headerlen); if (newsum!=origsum) { errprintf("bad checksum for header\n"); free(buffer); return OLDERR_MINOR; // header corrupt --> skip file } // read count from buffer memcpy(&temp16, bufpos, sizeof(temp16)); bufpos+=sizeof(temp16); count=le16_to_cpu(temp16); // read items for (i=0; i < count; i++) { // a. read type from buffer memcpy(&type, bufpos, sizeof(type)); bufpos+=sizeof(section); // b. read section from buffer memcpy(§ion, bufpos, sizeof(section)); bufpos+=sizeof(section); // c. read key from buffer memcpy(&temp16, bufpos, sizeof(temp16)); bufpos+=sizeof(temp16); key=le16_to_cpu(temp16); // d. read sizeof(data) memcpy(&temp16, bufpos, sizeof(temp16)); bufpos+=sizeof(temp16); size=le16_to_cpu(temp16); // e. add item to dico if (dico_add_generic(d, section, key, bufpos, size, type)!=0) return OLDERR_FATAL; bufpos+=size; } free(buffer); return FSAERR_SUCCESS; } int archreader_read_header(carchreader *ai, char *magic, cdico **d, bool allowseek, u16 *fsid) { s64 curpos; u16 temp16; u32 temp32; u32 archid; int res; assert(ai); assert(d); assert(fsid); // init memset(magic, 0, FSA_SIZEOF_MAGIC); *fsid=FSA_FILESYSID_NULL; *d=NULL; if ((*d=dico_alloc())==NULL) { errprintf("dico_alloc() failed\n"); return OLDERR_FATAL; } // search for next read header marker and magic (it may be further if corruption in archive) if ((curpos=lseek64(ai->archfd, 0, SEEK_CUR))<0) { sysprintf("lseek64() failed to get the current position in archive\n"); return OLDERR_FATAL; } if ((res=archreader_read_data(ai, magic, FSA_SIZEOF_MAGIC))!=FSAERR_SUCCESS) { msgprintf(MSG_STACK, "cannot read header magic: res=%d\n", res); return OLDERR_FATAL; } // we don't want to search for the magic if it's a volume header if (is_magic_valid(magic)!=true && allowseek!=true) { errprintf("cannot read header magic: this is not a valid fsarchiver file, or it has been created with a different version.\n"); return OLDERR_FATAL; } while (is_magic_valid(magic)!=true) { if (lseek64(ai->archfd, curpos++, SEEK_SET)<0) { sysprintf("lseek64(pos=%lld, SEEK_SET) failed\n", (long long)curpos); return OLDERR_FATAL; } if ((res=archreader_read_data(ai, magic, FSA_SIZEOF_MAGIC))!=FSAERR_SUCCESS) { msgprintf(MSG_STACK, "cannot read header magic: res=%d\n", res); return OLDERR_FATAL; } } // read the archive id if ((res=archreader_read_data(ai, &temp32, sizeof(temp32)))!=FSAERR_SUCCESS) { msgprintf(MSG_STACK, "cannot read archive-id in header: res=%d\n", res); return OLDERR_FATAL; } archid=le32_to_cpu(temp32); if (ai->archid) // only check archive-id if it's known (when main header has been read) { if (archid!=ai->archid) { errprintf("archive-id in header does not match: archid=[%.8x], expected=[%.8x]\n", archid, ai->archid); return OLDERR_MINOR; } } // read the filesystem id if ((res=archreader_read_data(ai, &temp16, sizeof(temp16)))!=FSAERR_SUCCESS) { msgprintf(MSG_STACK, "cannot read filesystem-id in header: res=%d\n", res); return OLDERR_FATAL; } *fsid=le16_to_cpu(temp16); // read the dico of the header if ((res=archreader_read_dico(ai, *d))!=FSAERR_SUCCESS) { msgprintf(MSG_STACK, "imgdisk_read_dico() failed\n"); return res; } return FSAERR_SUCCESS; } int archreader_read_volheader(carchreader *ai) { char creatver[FSA_MAX_PROGVERLEN]; char filefmt[FSA_MAX_FILEFMTLEN]; char magic[FSA_SIZEOF_MAGIC]; cdico *d; u32 volnum; u32 readid; u16 fsid; int res; int ret=0; // init assert(ai); memset(magic, 0, sizeof(magic)); // ---- a. read header from archive file if ((res=archreader_read_header(ai, magic, &d, false, &fsid))!=FSAERR_SUCCESS) { errprintf("archreader_read_header() failed to read the archive header\n"); return -1; } // ---- b. check the magic is what we expected if (strncmp(magic, FSA_MAGIC_VOLH, FSA_SIZEOF_MAGIC)!=0) { errprintf("magic is not what we expected: found=[%s] and expected=[%s]\n", magic, FSA_MAGIC_VOLH); ret=-1; goto archio_read_volheader_error; } if (dico_get_u32(d, 0, VOLUMEHEADKEY_ARCHID, &readid)!=0) { errprintf("cannot get VOLUMEHEADKEY_ARCHID from the volume header\n"); ret=-1; goto archio_read_volheader_error; } // ---- c. check the archive id if (ai->archid==0) // archid not know: this is the first volume { ai->archid=readid; } else if (readid!=ai->archid) // archid known: not the first volume { errprintf("wrong header id: found=%.8x and expected=%.8x\n", readid, ai->archid); ret=-1; goto archio_read_volheader_error; } // ---- d. check the volnum if (dico_get_u32(d, 0, VOLUMEHEADKEY_VOLNUM, &volnum)!=0) { errprintf("cannot get VOLUMEHEADKEY_VOLNUM from the volume header\n"); ret=-1; goto archio_read_volheader_error; } if (volnum!=ai->curvol) // not the right volume number { errprintf("wrong volume number in [%s]: volnum is %d and we need volnum %d\n", ai->volpath, (int)volnum, (int)ai->curvol); ret=-1; goto archio_read_volheader_error; } // ---- d. check the the file format if (dico_get_data(d, 0, VOLUMEHEADKEY_FILEFORMATVER, filefmt, FSA_MAX_FILEFMTLEN, NULL)!=0) { errprintf("cannot find VOLUMEHEADKEY_FILEFORMATVER in main-header\n"); ret=-1; goto archio_read_volheader_error; } if (ai->filefmt[0]==0) // filefmt not know: this is the first volume { memcpy(ai->filefmt, filefmt, FSA_MAX_FILEFMTLEN); } else if (strncmp(filefmt, ai->filefmt, FSA_MAX_FILEFMTLEN)!=0) { errprintf("This archive is based on a different file format: [%s]. Cannot continue.\n", ai->filefmt); errprintf("It has been created with fsarchiver [%s], you should extrat the archive using that version.\n", ai->creatver); errprintf("The current version of the program is [%s], and it's based on format [%s]\n", FSA_VERSION, FSA_FILEFORMAT); ret=-1; goto archio_read_volheader_error; } if (dico_get_data(d, 0, VOLUMEHEADKEY_PROGVERCREAT, creatver, FSA_MAX_PROGVERLEN, NULL)!=0) { errprintf("cannot find VOLUMEHEADKEY_PROGVERCREAT in main-header\n"); ret=-1; goto archio_read_volheader_error; } if (ai->creatver[0]==0) memcpy(ai->creatver, creatver, FSA_MAX_PROGVERLEN); archio_read_volheader_error: dico_destroy(d); return ret; } int archreader_read_block(carchreader *ai, cdico *in_blkdico, int in_skipblock, int *out_sumok, struct s_blockinfo *out_blkinfo) { u32 arblockcsumorig; u32 arblockcsumcalc; u32 curblocksize; // data size u64 blockoffset; // offset of the block in the file u16 compalgo; // compression algo used u16 cryptalgo; // encryption algo used u32 finalsize; // compressed block size u32 compsize; u8 *buffer; assert(ai); assert(out_sumok); assert(in_blkdico); assert(out_blkinfo); // init memset(out_blkinfo, 0, sizeof(struct s_blockinfo)); *out_sumok=-1; if (dico_get_u64(in_blkdico, 0, BLOCKHEADITEMKEY_BLOCKOFFSET, &blockoffset)!=0) { msgprintf(3, "cannot get blockoffset from block-header\n"); return -1; } if (dico_get_u32(in_blkdico, 0, BLOCKHEADITEMKEY_REALSIZE, &curblocksize)!=0 || curblocksize>FSA_MAX_BLKSIZE) { msgprintf(3, "cannot get blocksize from block-header\n"); return -1; } if (dico_get_u16(in_blkdico, 0, BLOCKHEADITEMKEY_COMPRESSALGO, &compalgo)!=0) { msgprintf(3, "cannot get BLOCKHEADITEMKEY_COMPRESSALGO from block-header\n"); return -1; } if (dico_get_u16(in_blkdico, 0, BLOCKHEADITEMKEY_ENCRYPTALGO, &cryptalgo)!=0) { msgprintf(3, "cannot get BLOCKHEADITEMKEY_ENCRYPTALGO from block-header\n"); return -1; } if (dico_get_u32(in_blkdico, 0, BLOCKHEADITEMKEY_ARSIZE, &finalsize)!=0) { msgprintf(3, "cannot get BLOCKHEADITEMKEY_ARSIZE from block-header\n"); return -1; } if (dico_get_u32(in_blkdico, 0, BLOCKHEADITEMKEY_COMPSIZE, &compsize)!=0) { msgprintf(3, "cannot get BLOCKHEADITEMKEY_COMPSIZE from block-header\n"); return -1; } if (dico_get_u32(in_blkdico, 0, BLOCKHEADITEMKEY_ARCSUM, &arblockcsumorig)!=0) { msgprintf(3, "cannot get BLOCKHEADITEMKEY_ARCSUM from block-header\n"); return -1; } if (in_skipblock==true) // the main thread does not need that block (block belongs to a filesys we want to skip) { if (lseek64(ai->archfd, (long)finalsize, SEEK_CUR)<0) { sysprintf("cannot skip block (finalsize=%ld) failed\n", (long)finalsize); return -1; } return 0; } // ---- allocate memory if ((buffer=malloc(finalsize))==NULL) { errprintf("cannot allocate block: malloc(%d) failed\n", finalsize); return FSAERR_ENOMEM; } if (read(ai->archfd, buffer, (long)finalsize)!=(long)finalsize) { sysprintf("cannot read block (finalsize=%ld) failed\n", (long)finalsize); free(buffer); return -1; } // prepare blkinfo out_blkinfo->blkdata=(char*)buffer; out_blkinfo->blkrealsize=curblocksize; out_blkinfo->blkoffset=blockoffset; out_blkinfo->blkarcsum=arblockcsumorig; out_blkinfo->blkcompalgo=compalgo; out_blkinfo->blkcryptalgo=cryptalgo; out_blkinfo->blkarsize=finalsize; out_blkinfo->blkcompsize=compsize; // ---- checksum arblockcsumcalc=fletcher32(buffer, finalsize); if (arblockcsumcalc!=arblockcsumorig) // bad checksum { errprintf("block is corrupt at offset=%ld, blksize=%ld\n", (long)blockoffset, (long)curblocksize); free(out_blkinfo->blkdata); if ((out_blkinfo->blkdata=malloc(curblocksize))==NULL) { errprintf("cannot allocate block: malloc(%d) failed\n", curblocksize); return FSAERR_ENOMEM; } memset(out_blkinfo->blkdata, 0, curblocksize); *out_sumok=false; // go to the beginning of the corrupted contents so that the next header is searched here if (lseek64(ai->archfd, -(long long)finalsize, SEEK_CUR)<0) { errprintf("lseek64() failed\n"); } } else // no corruption detected { *out_sumok=true; } return 0; } fsarchiver-0.8.6/src/fs_vfat.c0000644000175000017500000001317313655737260013210 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "filesys.h" #include "strlist.h" #include "fs_vfat.h" #include "error.h" int vfat_mkfs(cdico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid) { char stdoutbuf[2048]; char command[2048]; char buffer[2048]; char mkfsopts[2048]; int exitst; u32 temp32; u16 temp16; memset(mkfsopts, 0, sizeof(mkfsopts)); // ---- check that mkfs.vfat is installed if (exec_command(command, sizeof(command), NULL, stdoutbuf, sizeof(stdoutbuf), NULL, 0, "mkfs.vfat --help")!=0) { errprintf("mkfs.vfat not found. please install dosfstools on your system or check the PATH.\n"); return -1; } // ---- set the correct type of FAT filesystem if ((dico_get_u16(d, 0, FSYSHEADKEY_FSVFATTYPE, &temp16)==0) && (temp16==FAT_TYPE_FAT16)) strlcatf(mkfsopts, sizeof(mkfsopts), " -F 16 "); else strlcatf(mkfsopts, sizeof(mkfsopts), " -F 32 "); // ---- filesystem label if (strlen(mkfslabel) > 0) strlcatf(mkfsopts, sizeof(mkfsopts), " -n '%.11s' ", mkfslabel); else if (dico_get_string(d, 0, FSYSHEADKEY_FSLABEL, buffer, sizeof(buffer))==0 && strlen(buffer)>0) strlcatf(mkfsopts, sizeof(mkfsopts), " -n '%.11s' ", buffer); // ---- filesystem serial if (dico_get_u32(d, 0, FSYSHEADKEY_FSVFATSERIAL, &temp32)==0) strlcatf(mkfsopts, sizeof(mkfsopts), " -i '%08X' ", temp32); // ---- mkfsopt from command line strlcatf(mkfsopts, sizeof(mkfsopts), " %s ", fsoptions); // ---- create the new filesystem using mkfs.vfat if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "mkfs.vfat %s %s", mkfsopts, partition)!=0 || exitst!=0) { errprintf("command [%s] failed\n", command); return -1; } return 0; } int vfat_getinfo(cdico *d, char *devname) { struct vfat_superblock sb; char label[512]; u32 serial; u32 temp32; u16 type; int ret=0; int fd; int res; memset(label, 0, sizeof(label)); memset(&sb, 0, sizeof(sb)); if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { ret=-1; goto vfat_read_sb_return; } res=read(fd, &sb, sizeof(sb)); if (res!=sizeof(sb)) { ret=-1; goto vfat_read_sb_close; } // make sure we can find the magic number if (be16_to_cpu(sb.magic)!=VFAT_SB_MAGIC) { msgprintf(MSG_DEBUG1, "(be16_to_cpu(sb.magic)=%.2x) != (VFAT_SB_MAGIC=%.2x)\n", be16_to_cpu(sb.magic), VFAT_SB_MAGIC); ret=-1; goto vfat_read_sb_close; } // number of FATs must be 1 or 2 if (sb.num_fats != 1 && sb.num_fats != 2) { msgprintf(MSG_DEBUG1, "Invalid number of FAT tables: %d\n", (int)sb.num_fats); ret=-1; goto vfat_read_sb_close; } // num_root_dir_ents set to zero indicates a FAT32 if (sb.num_root_dir_ents == 0) { type=FAT_TYPE_FAT32; msgprintf(MSG_DEBUG1, "FAT_TYPE_FAT32\n"); memcpy(label, ((char*)&sb)+0x047, 11); memcpy(&temp32, ((char*)&sb)+0x043, 4); serial=le32_to_cpu(temp32); } else { type=FAT_TYPE_FAT16; msgprintf(MSG_DEBUG1, "FAT_TYPE_FAT16\n"); memcpy(label, ((char*)&sb)+0x02B, 11); memcpy(&temp32, ((char*)&sb)+0x027, 4); serial=le32_to_cpu(temp32); } // ---- type dico_add_u16(d, 0, FSYSHEADKEY_FSVFATTYPE, type); // ---- label msgprintf(MSG_DEBUG1, "vfat_label=[%s]\n", label); dico_add_string(d, 0, FSYSHEADKEY_FSLABEL, label); // ---- serial dico_add_u32(d, 0, FSYSHEADKEY_FSVFATSERIAL, serial); msgprintf(MSG_DEBUG1, "vfat_serial=[%08X]\n", serial); // ---- minimum fsarchiver version required to restore dico_add_u64(d, 0, FSYSHEADKEY_MINFSAVERSION, FSA_VERSION_BUILD(0, 8, 0, 0)); vfat_read_sb_close: close(fd); vfat_read_sb_return: return ret; } int vfat_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo) { return generic_mount(partition, mntbuf, fsbuf, "", flags); } int vfat_umount(char *partition, char *mntbuf) { return generic_umount(mntbuf); } int vfat_test(char *devname) { struct vfat_superblock sb; int fd; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { msgprintf(MSG_DEBUG1, "open64(%s) failed\n", devname); return false; } memset(&sb, 0, sizeof(sb)); if (read(fd, &sb, sizeof(sb))!=sizeof(sb)) { close(fd); msgprintf(MSG_DEBUG1, "read failed\n"); return false; } // ---- check it is a VFAT file system if (be16_to_cpu(sb.magic)!=VFAT_SB_MAGIC) { close(fd); msgprintf(MSG_DEBUG1, "(be16_to_cpu(sb.magic)=%.2x) != (VFAT_SB_MAGIC=%.2x)\n", be16_to_cpu(sb.magic), VFAT_SB_MAGIC); return false; } close(fd); return true; } int vfat_get_reqmntopt(char *partition, cstrlist *reqopt, cstrlist *badopt) { if (!reqopt || !badopt) return -1; return 0; } fsarchiver-0.8.6/src/queue.h0000644000175000017500000001172613655317102012700 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __QUEUE_H__ #define __QUEUE_H__ #include enum {QITEM_STATUS_NULL=0, QITEM_STATUS_TODO, QITEM_STATUS_PROGRESS, QITEM_STATUS_DONE}; enum {QITEM_TYPE_NULL=0, QITEM_TYPE_BLOCK, QITEM_TYPE_HEADER}; struct s_dico; struct s_blockinfo; typedef struct s_blockinfo cblockinfo; struct s_headinfo; typedef struct s_headinfo cheadinfo; struct s_queueitem; typedef struct s_queueitem cqueueitem; struct s_queue; typedef struct s_queue cqueue; struct s_blockinfo // used when (type==QITEM_TYPE_BLOCK) { char *blkdata; // pointer to data block as it is at a particular time (compressed or uncompressed) u32 blkrealsize; // size of the data in the normal state (not compressed and not crypted) u64 blkoffset; // offset of the block in the normal file u32 blkarcsum; // checksum of the block as it it when it's in the archive (compressed and encrypted) u32 blkarsize; // size of the block as it is in the archive (compressed and encrypted) u16 blkcompalgo; // algo used to compressed the block u32 blkcompsize; // size of the block after compression and before encryption u16 blkcryptalgo; // algo used to compressed the block u16 blkfsid; // id of filesystem to which the block belongs bool blklocked; // true if locked (being processed in the compress/crypt thread) }; struct s_headinfo // used when (type==QITEM_TYPE_HEADER) { char magic[FSA_SIZEOF_MAGIC+1]; // magic which is used to identify the type of header u16 fsid; // the filesystem to which this header belongs to, or FSA_FILESYSID_NULL if global header struct s_dico *dico; }; struct s_queueitem { int type; // QITEM_TYPE_BLOCK or QITEM_TYPE_HEADER int status; // compressed, being-compressed, not-yet-compressed s64 itemnum; // unique identifier of the item in the queue cqueueitem *next; // next block in the linked list cblockinfo blkinfo; // used when type==QITEM_TYPE_BLOCK (for blocks only) cheadinfo headinfo; // used when type==QITEM_TYPE_HEADER (for headers only) }; struct s_queue { cqueueitem *head; // head of the queue: first item pthread_mutex_t mutex; // pthread mutex for data protection pthread_cond_t cond; // condition for pthread synchronization s64 curitemnum; // unique id given to every new item (block or header) u64 itemcount; // how many items there are (headers + blocks) u64 blkcount; // how many blocks items there are (items where type==QITEM_TYPE_BLOCK only) u64 blkmax; // how many blocks items there can be before the queue is considered as full bool endofqueue; // set to true when no more data to put in queue (like eof): reader must stop }; // ----return status // a) ">0" means success for functions that return item numbers // b) =0 means success for functions that do not return item numbers // c) "<0" QERR error number // init and destroy s64 queue_init(cqueue *l, s64 blkmax); s64 queue_destroy(cqueue *l); // information functions s64 queue_count(cqueue *l); s64 queue_count_status(struct s_queue *l, int status); s64 queue_is_first_item_ready(struct s_queue *q); s64 queue_check_next_item(cqueue *q, int *type, char *magic); s64 queue_count_items_todo(cqueue *q); // modification functions s64 queue_add_block(cqueue *q, cblockinfo *blkinfo, int status); s64 queue_add_header(cqueue *q, struct s_dico *d, char *magic, u16 fsid); s64 queue_add_header_internal(cqueue *q, cheadinfo *headinfo); s64 queue_replace_block(cqueue *q, s64 itemnum, cblockinfo *blkinfo, int newstatus); s64 queue_destroy_first_item(cqueue *q); // end of queue functions s64 queue_set_end_of_queue(cqueue *q, bool state); bool queue_get_end_of_queue(cqueue *q); // get item from queue functions s64 queue_get_first_block_todo(cqueue *q, cblockinfo *blkinfo); s64 queue_dequeue_header(cqueue *q, struct s_dico **d, char *magicbuf, u16 *fsid); s64 queue_dequeue_header_internal(cqueue *q, cheadinfo *headinfo); s64 queue_dequeue_block(cqueue *q, cblockinfo *blkinfo); s64 queue_dequeue_first(cqueue *q, int *type, cheadinfo *headinfo, cblockinfo *blkinfo); #endif // __QUEUE_H__ fsarchiver-0.8.6/src/dico.c0000644000175000017500000002073013655317102012460 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "error.h" cdico *dico_alloc() { cdico *d; if ((d=malloc(sizeof(cdico)))==NULL) return NULL; d->head=NULL; return d; } int dico_destroy(cdico *d) { cdicoitem *item, *next; if (d==NULL) return -1; item=d->head; while (item!=NULL) { next=item->next; if (item->data!=NULL) free(item->data); free(item); item=next; } free(d); return 0; } int dico_add_data(cdico *d, u8 section, u16 key, const void *data, u16 size) { return dico_add_generic(d, section, key, data, size, DICTYPE_DATA); } // add an item to the dico, fails if an item with that (section,key) already exists int dico_add_generic(cdico *d, u8 section, u16 key, const void *data, u16 size, u8 type) { cdicoitem *item, *lnew, *last; assert (d); // allocate object lnew=malloc(sizeof(cdicoitem)); if (!lnew) { errprintf("malloc(%ld) failed: out of memory\n", (long)sizeof(cdicoitem)); return -3; } memset(lnew, 0, sizeof(cdicoitem)); // go to the end of the item and check for duplicates if (d->head==NULL) // item is empty { d->head=lnew; } else // item is not empty { for (item=d->head; item!=NULL; item=item->next) { last=item; if (item->section==section && item->key==key) { errprintf("dico_add_generic(): item with key=%ld is already in dico\n", (long)item->key); return -3; } } last->next=lnew; } // copy key lnew->key=key; lnew->section=section; lnew->size=size; lnew->type=type; lnew->data=NULL; // allocate memory for data if (size > 0) { lnew->data=malloc(size); if (!lnew->data) { errprintf("malloc(%ld) failed: out of memory\n", (long)size); return -3; } // copy data memcpy(lnew->data, data, size); } return 0; } int dico_get_data(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size) { return dico_get_generic(d, section, key, data, maxsize, size); } int dico_get_generic(cdico *d, u8 section, u16 key, void *data, u16 maxsize, u16 *size) { cdicoitem *item; assert(d); assert(data); // size can be NULL if the user does not want to know the size if (size!=NULL) *size=0; if (d->head==NULL) { msgprintf(MSG_DEBUG1, "dico is empty\n"); return -1; } if (maxsize<1) { msgprintf(MSG_DEBUG1, "case1: maxsize=%d\n", maxsize); return -3; } for (item=d->head; item!=NULL; item=item->next) { if ((item!=NULL) && (item->key==key && item->section==section)) { if (item->size > maxsize) // item is too big { msgprintf(MSG_DEBUG1, "case2: (item->size > maxsize): item->size =%d, maxsize=%d\n", item->size, maxsize); return -4; } if ((item->size>0) && (item->data!=NULL)) // there may be no data (size==0) memcpy(data, item->data, item->size); if (size!=NULL) *size=item->size; return 0; } } msgprintf(MSG_DEBUG1, "case3: not found\n"); return -5; // not found } int dico_count_one_section(cdico *d, u8 section) { cdicoitem *item; int count; assert(d); count=0; for (item=d->head; item!=NULL; item=item->next) if (item->section==section) count++; return count; } int dico_count_all_sections(cdico *d) { cdicoitem *item; int count; assert(d); count=0; for (item=d->head; item!=NULL; item=item->next) count++; return count; } int dico_add_u16(cdico *d, u8 section, u16 key, u16 data) { u16 ledata; assert(d); ledata=cpu_to_le16(data); return dico_add_generic(d, section, key, &ledata, sizeof(ledata), DICTYPE_U16); } int dico_add_u32(cdico *d, u8 section, u16 key, u32 data) { u32 ledata; assert(d); ledata=cpu_to_le32(data); return dico_add_generic(d, section, key, &ledata, sizeof(ledata), DICTYPE_U32); } int dico_add_u64(cdico *d, u8 section, u16 key, u64 data) { u64 ledata; assert (d); ledata=cpu_to_le64(data); return dico_add_generic(d, section, key, &ledata, sizeof(ledata), DICTYPE_U64); } int dico_add_string(cdico *d, u8 section, u16 key, const char *szstring) { u16 len; assert(d); assert(szstring); len=strlen(szstring); return dico_add_generic(d, section, key, szstring, len+1, DICTYPE_STRING); } int dico_get_u16(cdico *d, u8 section, u16 key, u16 *data) { u16 ledata; u16 size; assert(d); assert(data); *data=0; if (dico_get_data(d, section, key, &ledata, sizeof(ledata), &size)!=0) return -1; *data=le16_to_cpu(ledata); return 0; } int dico_get_u32(cdico *d, u8 section, u16 key, u32 *data) { u32 ledata; u16 size; assert(d); assert(data); *data=0; if (dico_get_data(d, section, key, &ledata, sizeof(ledata), &size)!=0) return -1; *data=le32_to_cpu(ledata); return 0; } int dico_get_u64(cdico *d, u8 section, u16 key, u64 *data) { u64 ledata; u16 size; assert(d); assert(data); *data=0; if (dico_get_data(d, section, key, &ledata, sizeof(ledata), &size)!=0) return -1; *data=le64_to_cpu(ledata); return 0; } int dico_get_string(cdico *d, u8 section, u16 key, char *buffer, u16 bufsize) { u16 size; assert(d); assert(buffer); memset(buffer, 0, bufsize); return dico_get_data(d, section, key, buffer, bufsize, &size); } int dico_show(cdico *d, u8 section, char *debugtxt) { char buffer[2048]; char text[2048]; cdicoitem *item; assert(d); msgprintf(MSG_FORCE, "\n-----------------debug-dico-begin(%s)---------------\n", debugtxt); if (d->head) { for (item=d->head; item!=NULL; item=item->next) { if (item->section==section) { snprintf(buffer, sizeof(buffer), "key=[%ld], sizeof(data)=[%d], ", (long)item->key, (int)item->size); switch (item->type) { case DICTYPE_U8: snprintf(text, sizeof(text), "type=u8, size=[%d]", (int)item->size); break; case DICTYPE_U16: snprintf(text, sizeof(text), "type=u16, size=[%d]", (int)item->size); break; case DICTYPE_U32: snprintf(text, sizeof(text), "type=u32, size=[%d]", (int)item->size); break; case DICTYPE_U64: snprintf(text, sizeof(text), "type=u64, size=[%d]", (int)item->size); break; case DICTYPE_STRING: snprintf(text, sizeof(text), "type=str, size=[%d], data=[%s]", (int)item->size, (char*)item->data); break; case DICTYPE_DATA: snprintf(text, sizeof(text), "type=dat, size=[%d]", (int)item->size); break; default: snprintf(text, sizeof(text), "type=unknown"); break; } strlcatf(buffer, sizeof(buffer) ,"%s", text); msgprintf(MSG_FORCE, "%s\n", buffer); } } } else { msgprintf(MSG_FORCE, "dico is empty\n"); } msgprintf(MSG_FORCE, "-----------------debug-dico-end(%s)------------------\n\n", debugtxt); return 0; } fsarchiver-0.8.6/src/fs_btrfs.c0000644000175000017500000001624113721251126013351 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "fs_btrfs.h" #include "filesys.h" #include "strlist.h" #include "error.h" int btrfs_check_compatibility(u64 compat, u64 incompat, u64 ro_compat) { // to preserve the filesystem attributes, fsa must know all the features including the COMPAT ones if (compat & ~FSA_BTRFS_FEATURE_COMPAT_SUPP) return -1; if (incompat & ~FSA_BTRFS_FEATURE_INCOMPAT_SUPP) return -1; if (ro_compat & ~FSA_BTRFS_FEATURE_COMPAT_RO_SUPP) return -1; return 0; } int btrfs_mkfs(cdico *d, char *partition, char *fsoptions, char *mkfslabel, char *mkfsuuid) { char command[2048]; char buffer[2048]; char options[2048]; u64 compat_flags; u64 incompat_flags; u64 compat_ro_flags; int exitst; u64 temp64; // ---- get original filesystem features (if the original filesystem was a btrfs) if (dico_get_u64(d, 0, FSYSHEADKEY_BTRFSFEATURECOMPAT, &compat_flags)!=0 || dico_get_u64(d, 0, FSYSHEADKEY_BTRFSFEATUREINCOMPAT, &incompat_flags)!=0 || dico_get_u64(d, 0, FSYSHEADKEY_BTRFSFEATUREROCOMPAT, &compat_ro_flags)!=0) { // dont fail the original filesystem may not be a btrfs. in that case set defaults features compat_flags=0; incompat_flags=0; compat_ro_flags=0; } // ---- check there is no unsuported feature in that filesystem if (btrfs_check_compatibility(compat_flags, incompat_flags, compat_ro_flags)!=0) { errprintf("this filesystem has features which are not supported by this fsarchiver version.\n"); return -1; } // ---- there is no option that just displays the version and return 0 in mkfs.btrfs-0.16 if (exec_command(command, sizeof(command), NULL, NULL, 0, NULL, 0, "mkfs.btrfs")!=0) { errprintf("mkfs.btrfs not found. please install btrfs-progs on your system or check the PATH.\n"); return -1; } // ---- set the advanced filesystem settings from the dico memset(options, 0, sizeof(options)); if (strlen(mkfslabel) > 0) strlcatf(options, sizeof(options), " -L '%s' ", mkfslabel); else if (dico_get_string(d, 0, FSYSHEADKEY_FSLABEL, buffer, sizeof(buffer))==0 && strlen(buffer)>0) strlcatf(options, sizeof(options), " -L '%s' ", buffer); if (strlen(mkfsuuid) > 0) strlcatf(options, sizeof(options), " -U '%s' ", mkfsuuid); else if (dico_get_string(d, 0, FSYSHEADKEY_FSUUID, buffer, sizeof(buffer))==0) strlcatf(options, sizeof(options), " -U '%s' ", buffer); if (dico_get_u64(d, 0, FSYSHEADKEY_FSBTRFSSECTORSIZE, &temp64)==0) strlcatf(options, sizeof(options), " -s %ld ", (long)temp64); // ---- mkfsopt from command line strlcatf(options, sizeof(options), " %s ", fsoptions); if (exec_command(command, sizeof(command), &exitst, NULL, 0, NULL, 0, "mkfs.btrfs -f %s %s", options, partition)!=0 || exitst!=0) { errprintf("command [%s] failed\n", command); return -1; } return 0; } int btrfs_getinfo(cdico *d, char *devname) { struct btrfs_super_block sb; char uuid[512]; u16 temp32; int ret=0; int fd; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) { ret=-1; errprintf("cannot open(%s, O_RDONLY)\n", devname); goto btrfs_read_sb_return; } if (lseek(fd, BTRFS_SUPER_INFO_OFFSET, SEEK_SET)!=BTRFS_SUPER_INFO_OFFSET) { ret=-2; errprintf("cannot lseek(fd, BTRFS_SUPER_INFO_OFFSET, SEEK_SET) on %s\n", devname); goto btrfs_read_sb_close; } if (read(fd, &sb, sizeof(sb))!=sizeof(sb)) { ret=-3; errprintf("cannot read the btrfs superblock on device [%s]\n", devname); goto btrfs_read_sb_close; } if (strncmp((char*)&sb.magic, BTRFS_MAGIC, sizeof(sb.magic))!=0) { ret=-4; errprintf("magic different from expectations superblock on [%s]: magic=[%.8s], expected=[%.8s]\n", devname, (char*)&sb.magic, BTRFS_MAGIC); goto btrfs_read_sb_close; } // ---- label msgprintf(MSG_DEBUG1, "btrfs_label=[%s]\n", sb.label); dico_add_string(d, 0, FSYSHEADKEY_FSLABEL, (char*)sb.label); // ---- uuid /*if ((str=e2p_uuid2str(sb.dev_item.fsid))!=NULL) dico_add_string(d, 0, FSYSHEADKEY_FSUUID, str);*/ memset(uuid, 0, sizeof(uuid)); uuid_unparse_lower((u8*)sb.dev_item.fsid, uuid); dico_add_string(d, 0, FSYSHEADKEY_FSUUID, uuid); msgprintf(MSG_DEBUG1, "btrfs_uuid=[%s]\n", uuid); // ---- sector size temp32=le32_to_cpu(sb.sectorsize); dico_add_u64(d, 0, FSYSHEADKEY_FSBTRFSSECTORSIZE, temp32); msgprintf(MSG_DEBUG1, "btrfs_sectorsize=[%ld]\n", (long)temp32); // ---- filesystem features dico_add_u64(d, 0, FSYSHEADKEY_BTRFSFEATURECOMPAT, le64_to_cpu(sb.compat_flags)); dico_add_u64(d, 0, FSYSHEADKEY_BTRFSFEATUREINCOMPAT, le64_to_cpu(sb.incompat_flags)); dico_add_u64(d, 0, FSYSHEADKEY_BTRFSFEATUREROCOMPAT, le64_to_cpu(sb.compat_ro_flags)); if (btrfs_check_compatibility(le64_to_cpu(sb.compat_flags), le64_to_cpu(sb.incompat_flags), le64_to_cpu(sb.compat_ro_flags))!=0) { errprintf("this filesystem has features which are not supported by this fsarchiver version.\n"); return -1; } // ---- minimum fsarchiver version required to restore dico_add_u64(d, 0, FSYSHEADKEY_MINFSAVERSION, FSA_VERSION_BUILD(0, 6, 4, 0)); btrfs_read_sb_close: close(fd); btrfs_read_sb_return: return ret; } int btrfs_mount(char *partition, char *mntbuf, char *fsbuf, int flags, char *mntinfo) { return generic_mount(partition, mntbuf, fsbuf, NULL, flags); } int btrfs_umount(char *partition, char *mntbuf) { return generic_umount(mntbuf); } int btrfs_test(char *devname) { struct btrfs_super_block sb; int fd; if ((fd=open64(devname, O_RDONLY|O_LARGEFILE))<0) return false; if (lseek(fd, BTRFS_SUPER_INFO_OFFSET, SEEK_SET)!=BTRFS_SUPER_INFO_OFFSET) { close(fd); return false; } if (read(fd, &sb, sizeof(sb))!=sizeof(sb)) { close(fd); return false; } if (strncmp((char*)&sb.magic, BTRFS_MAGIC, sizeof(sb.magic))!=0) { close(fd); return false; } close(fd); return true; } int btrfs_get_reqmntopt(char *partition, cstrlist *reqopt, cstrlist *badopt) { if (!reqopt || !badopt) return -1; strlist_add(badopt, "noacl"); return 0; } fsarchiver-0.8.6/src/dichl.c0000644000175000017500000000575513655317102012637 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include "fsarchiver.h" #include "dichl.h" #include "common.h" #include "error.h" cdichl *dichl_alloc() { cdichl *d; if ((d=malloc(sizeof(cdichl)))==NULL) return NULL; d->head=NULL; return d; } int dichl_destroy(cdichl *d) { cdichlitem *item, *next; if (d==NULL) return -1; item=d->head; while (item!=NULL) { next=item->next; free(item->str); free(item); item=next; } free(d); return 0; } int dichl_add(cdichl *d, u64 key1, u64 key2, char *str) { cdichlitem *item, *lnew, *last; int len; if (d==NULL || !str) { errprintf("invalid parameters\n"); return -1; } len=strlen(str); // allocate object lnew=malloc(sizeof(cdichlitem)); if (!lnew) { errprintf("malloc(%ld) failed: out of memory\n", (long)sizeof(cdichlitem)); return -1; } memset(lnew, 0, sizeof(cdichlitem)); lnew->str=malloc(len+1); if (!lnew->str) { free(lnew); errprintf("malloc(%ld) failed: out of memory\n", (long)len+1); return -1; } memcpy(lnew->str, str, len+1); lnew->key1=key1; lnew->key2=key2; lnew->next=NULL; // go to the end of the item and check for duplicates if (d->head==NULL) // item is empty { d->head=lnew; } else // item is not empty { for (item=d->head; item!=NULL; item=item->next) { last=item; if (item->key1==key1 && item->key2==key2) { errprintf("dichl_add_internal(): item with key1=%ld and key2=%ld is already in dico\n", (long)item->key1, (long)item->key2); return -1; } } last->next=lnew; } return 0; } int dichl_get(cdichl *d, u64 key1, u64 key2, char *buf, int bufsize) { cdichlitem *item; int len; if (d==NULL || !buf) { errprintf("invalid dichl\n"); return -1; } for (item=d->head; item!=NULL; item=item->next) { if ((item!=NULL) && (item->key1==key1) && (item->key2==key2)) { len=strlen(item->str); if (bufsizestr); return 0; } } return -3; // not found } fsarchiver-0.8.6/src/oper_save.h0000644000175000017500000000133113655317102013526 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __OPER_SAVE_H__ #define __OPER_SAVE_H__ int oper_save(char *archive, int argc, char **argv, int archtype); #endif // __OPER_SAVE_H__ fsarchiver-0.8.6/src/strdico.c0000644000175000017500000001706513655317102013220 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ /* * Defines an object to store a dictionnary where the key and the * associated value are both strings. It's used to store string of * parameters such as "id=0,dest=/dev/sda1,mkfs=reiserfs" * cstrdico *d; * d=strdico_alloc(); * strdico_set_valid_keys(d, "name,phone,fax"); * strdico_parse_string(d, "name=john,phone=123456789,fax="); * strdico_parse_string(d, "phone=987654321"); * strdico_get_string(d, mybuffer, sizeof(mybuffer), "phone"); * strdico_destroy(d); */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include "fsarchiver.h" #include "strdico.h" #include "common.h" #include "error.h" cstrdico *strdico_alloc() { cstrdico *d; if ((d=malloc(sizeof(cstrdico)))==NULL) return NULL; d->head=NULL; d->validkeys=NULL; return d; } int strdico_destroy(cstrdico *d) { cstrdicoitem *item, *next; assert(d); item=d->head; while (item!=NULL) { next=item->next; free(item->key); if (item->value!=NULL) free(item->value); free(item); item=next; } if (d->validkeys!=NULL) free(d->validkeys); free(d); return FSAERR_SUCCESS; } int strdico_set_valid_keys(cstrdico *d, const char *keys) { assert(d); if ((d->validkeys=strdup(keys))==NULL) { errprintf("strdup() failed: out of memory\n"); return FSAERR_ENOMEM; } return FSAERR_SUCCESS; } int strdico_parse_string(cstrdico *d, const char *strdefs) { char *bakdefs; char *saveptr; char *result; char delims[]=",;\t\n"; char key[1024]; char value[1024]; int i, pos; int res; assert(d); assert(strdefs); // init if ((bakdefs=strdup(strdefs))==NULL) { errprintf("strdup() failed: out of memory\n"); return FSAERR_ENOMEM; } result=strtok_r(bakdefs, delims, &saveptr); while (result!=NULL) { memset(key, 0, sizeof(key)); memset(value, 0, sizeof(value)); for (i=0; (result[i]!=0) && (result[i]!='=') && (i int compress_block_lzo(u64 origsize, u64 *compsize, u8 *origbuf, u8 *compbuf, u64 compbufsize, int level); int uncompress_block_lzo(u64 compsize, u64 *origsize, u8 *origbuf, u64 origbufsize, u8 *compbuf); #endif // OPTION_LZO_SUPPORT #endif // __COMPRESS_LZO_H__ fsarchiver-0.8.6/src/archinfo.h0000644000175000017500000000160413655317102013337 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __ARCHINFO_H__ #define __ARCHINFO_H__ struct s_dico; struct s_archreader; int archinfo_show_mainhead(struct s_archreader *ai, struct s_dico *dicomainhead); int archinfo_show_fshead(struct s_dico *dicofshead, int fsid); char *compalgostr(int algo); char *cryptalgostr(int algo); #endif // __ARCHINFO_H__ fsarchiver-0.8.6/src/error.h0000644000175000017500000000456213655317102012705 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __ERROR_H__ #define __ERROR_H__ struct s_stats; typedef struct s_stats cstats; struct s_stats { u64 cnt_regfile; u64 cnt_dir; u64 cnt_symlink; u64 cnt_hardlink; u64 cnt_special; u64 err_regfile; u64 err_dir; u64 err_symlink; u64 err_hardlink; u64 err_special; }; int fsaprintf(int level, bool showerrno, bool showloc, const char *file, const char *fct, int line, char *format, ...) __attribute__ ((format (printf, 7, 8))); // ---- message levels enum {MSG_FORCE=0, // always show this messages whatever the level is MSG_VERB1=1, // normal messages that have to be shown when verbose>=1 (fsarchive -v) MSG_VERB2=2, // detailed messages that have to be shown when verbose>=2 (fsarchive -vv) MSG_STACK=3, // messages shown when a function exists (propagate error at upper level) MSG_DEBUG1=4, // debugging messages level 1 (very basic info) MSG_DEBUG2=5, // debugging messages level 2 MSG_DEBUG3=6, // debugging messages level 3 MSG_DEBUG4=7, // debugging messages level 4 MSG_DEBUG5=8 // debugging messages level 5 (very detailed debug) }; char *error_int_to_string(s64 err); // use sysprintf to print an error that follows a libc function and to show errno #define sysprintf(fmt, args...) fsaprintf(0, true, true, __FILE__, __FUNCTION__, __LINE__, fmt, ## args) // use errprintf to print an error that does not come from a libc function #define errprintf(fmt, args...) fsaprintf(0, false, true, __FILE__, __FUNCTION__, __LINE__, fmt, ## args) // use msgprintf with a level to show normal messages or debug messages #define msgprintf(level, fmt, args...) fsaprintf(level, false, level>=3, __FILE__, __FUNCTION__, __LINE__, fmt, ## args) #endif // __ERROR_H__ fsarchiver-0.8.6/src/regmulti.c0000644000175000017500000001445713655317102013403 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "fsarchiver.h" #include "dico.h" #include "regmulti.h" #include "common.h" #include "queue.h" #include "error.h" int regmulti_empty(cregmulti *m) { int i; if (!m) { errprintf("invalid param\n"); return -1; } m->count=0; m->usedsize=0; for (i=0; i < m->maxitems; i++) m->objhead[i]=NULL; return 0; } int regmulti_init(cregmulti *m, u32 maxblksize) { if (!m) { errprintf("invalid param\n"); return -1; } m->maxitems=FSA_MAX_SMALLFILECOUNT; m->maxblksize=min(maxblksize, FSA_MAX_BLKSIZE); return regmulti_empty(m); } int regmulti_count(cregmulti *m, cdico *header, char *data, u32 datsize) { if (!m) { errprintf("invalid param\n"); return -1; } return m->count; } bool regmulti_save_enough_space_for_new_file(cregmulti *m, u32 filesize) { if (!m) { errprintf("invalid param\n"); return false; } if (m->count >= m->maxitems) return false; if (m->usedsize + filesize > m->maxblksize) return false; return true; } int regmulti_save_addfile(cregmulti *m, cdico *header, char *data, u32 datsize) { if (!m) { errprintf("invalid param\n"); return -1; } if (m->count >= m->maxitems) { errprintf("regmulti is full: it contains %ld items\n", (long)m->count); return -1; } if (m->usedsize+datsize > m->maxblksize) { errprintf("block is too small to store that new sub-block of data\n"); return -1; } m->objhead[m->count]=header; memcpy(m->data+m->usedsize, data, datsize); m->usedsize+=datsize; m->count++; return 0; } // add headers and datblock at the end of the queue int regmulti_save_enqueue(cregmulti *m, cqueue *q, int fsid) { cblockinfo blkinfo; char *dynblock; u32 offset=0; u64 filesize; int i; if (!m) { errprintf("invalid param\n"); return -1; } // don't do anything if block is empty if (m->count==0) return 0; for (i=0; i < m->count; i++) { if (m->objhead[i]==NULL) { errprintf("error: objhead[%d]==NULL\n", i); return -1; } // get file size from header if (dico_get_u64(m->objhead[i], DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_SIZE, &filesize)!=0) { errprintf("Cannot read filesize DISKITEMKEY_SIZE from archive\n"); return -1; } // the extraction function needs to know how many small-files are packed together if (dico_add_u32(m->objhead[i], DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MULTIFILESCOUNT, (u32)m->count)!=0) { errprintf("dico_add_u32(DISKITEMKEY_MULTIFILESCOUNT) failed\n"); return -1; } // the extraction function needs to know where the data for this file are in the block if (dico_add_u32(m->objhead[i], DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MULTIFILESOFFSET, (u32)offset)!=0) { errprintf("dico_add_u32(DISKITEMKEY_MULTIFILESCOUNT) failed\n"); return -1; } offset+=(u32)filesize; if (queue_add_header(q, m->objhead[i], FSA_MAGIC_OBJT, fsid)!=0) { errprintf("queue_add_header() failed\n"); return -1; } } // make a copy of the static block to dynamic memory if ((dynblock=malloc(m->usedsize)) == NULL) { errprintf("malloc(%ld) failed: out of memory\n", (long)m->usedsize); return -1; } memcpy(dynblock, m->data, m->usedsize); memset(&blkinfo, 0, sizeof(blkinfo)); blkinfo.blkrealsize=m->usedsize; blkinfo.blkdata=(char*)dynblock; blkinfo.blkoffset=0; // no meaning for multi-regfiles blkinfo.blkfsid=fsid; if (queue_add_block(q, &blkinfo, QITEM_STATUS_TODO)!=0) { errprintf("queue_add_block() failed\n"); return -1; } return 0; } int regmulti_rest_addheader(cregmulti *m, cdico *header) { if (!m) { errprintf("invalid param\n"); return -1; } if (m->count >= m->maxitems) { errprintf("regmulti is full: it contains %ld items\n", (long)m->count); return -1; } m->objhead[m->count]=header; m->count++; return 0; } int regmulti_rest_setdatablock(cregmulti *m, char *data, u32 datsize) { if (!m) { errprintf("invalid param\n"); return -1; } if (m->usedsize+datsize > m->maxblksize) { errprintf("block is too small to store that new sub-block of data\n"); return -1; } memcpy(m->data, data, datsize); m->usedsize=datsize; return 0; } int regmulti_rest_getfile(cregmulti *m, int index, cdico **filehead, char *data, u64 *datsize, u32 bufsize) { u32 offset; u64 filesize; if (!m || !filehead) { errprintf("invalid param\n"); return -1; } if (index >= m->count) { errprintf("index=%d out of scope: the structure only contains %ld items\n", index, (long)m->count); return -1; } // ---- return the header to the calling function *filehead=m->objhead[index]; // ---- return the data to the calling function if (dico_get_u64(m->objhead[index], DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_SIZE, &filesize)!=0) { errprintf("Cannot read filesize DISKITEMKEY_SIZE from archive\n"); return -1; } if (dico_get_u32(m->objhead[index], DICO_OBJ_SECTION_STDATTR, DISKITEMKEY_MULTIFILESOFFSET, &offset)!=0) { errprintf("Cannot read filesize DISKITEMKEY_SIZE from archive\n"); return -1; } *datsize=filesize; memcpy(data, m->data+offset, filesize); return 0; } fsarchiver-0.8.6/src/strdico.h0000644000175000017500000000253613655317102013222 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifndef __STRDICO_H__ #define __STRDICO_H__ struct s_strdico; struct s_strdicoitem; typedef struct s_strdico cstrdico; typedef struct s_strdicoitem cstrdicoitem; struct s_strdico { cstrdicoitem *head; char *validkeys; }; struct s_strdicoitem { char *key; char *value; cstrdicoitem *next; }; cstrdico *strdico_alloc(); int strdico_destroy(cstrdico *d); int strdico_set_valid_keys(cstrdico *d, const char *keys); int strdico_parse_string(cstrdico *d, const char *strdefs); int strdico_set_value(cstrdico *d, const char *key, const char *value); int strdico_get_string(cstrdico *d, char *outbuffer, int outbufsize, const char *key); int strdico_get_s64(cstrdico *d, s64 *value, const char *key); int strdico_print(cstrdico *d); #endif // __STRDICO_H__ fsarchiver-0.8.6/src/fsarchiver.c0000644000175000017500000005164313662252212013703 00000000000000/* * fsarchiver: Filesystem Archiver * * Copyright (C) 2008-2018 Francois Dupoux. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License v2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * Homepage: http://www.fsarchiver.org */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include "fsarchiver.h" #include "dico.h" #include "common.h" #include "oper_restore.h" #include "oper_save.h" #include "oper_probe.h" #include "archinfo.h" #include "syncthread.h" #include "comp_lzo.h" #include "comp_lz4.h" #include "crypto.h" #include "options.h" #include "logfile.h" #include "error.h" #include "queue.h" char *valid_magic[]={FSA_MAGIC_MAIN, FSA_MAGIC_VOLH, FSA_MAGIC_VOLF, FSA_MAGIC_FSIN, FSA_MAGIC_FSYB, FSA_MAGIC_DATF, FSA_MAGIC_OBJT, FSA_MAGIC_BLKH, FSA_MAGIC_FILF, FSA_MAGIC_DIRS, NULL}; void usage(char *progname, bool examples) { int lzo, lzma, lz4, zstd; #ifdef OPTION_LZO_SUPPORT lzo=true; #else lzo=false; #endif // OPTION_LZO_SUPPORT #ifdef OPTION_LZMA_SUPPORT lzma=true; #else lzma=false; #endif // OPTION_LZMA_SUPPORT #ifdef OPTION_LZ4_SUPPORT lz4=true; #else lz4=false; #endif // OPTION_lZ4_SUPPORT #ifdef OPTION_ZSTD_SUPPORT zstd=true; #else zstd=false; #endif // OPTION_ZSTD_SUPPORT msgprintf(MSG_FORCE, "====> fsarchiver version %s (%s) - http://www.fsarchiver.org <====\n", FSA_VERSION, FSA_RELDATE); msgprintf(MSG_FORCE, "Distributed under the GPL v2 license (GNU General Public License v2).\n"); msgprintf(MSG_FORCE, " * usage: %s [] [ [ [...]]]\n", progname); msgprintf(MSG_FORCE, "\n"); msgprintf(MSG_FORCE, " * savefs: save filesystems to an archive file (backup a device to a file)\n"); msgprintf(MSG_FORCE, " * restfs: restore filesystems from an archive (overwrites the existing data)\n"); msgprintf(MSG_FORCE, " * savedir: save directories to the archive (similar to a compressed tarball)\n"); msgprintf(MSG_FORCE, " * restdir: restore data from an archive which is not based on a filesystem\n"); msgprintf(MSG_FORCE, " * archinfo: show information about an existing archive file and its contents\n"); msgprintf(MSG_FORCE, " * probe [detailed]: show list of filesystems detected on the disks\n"); msgprintf(MSG_FORCE, "\n"); msgprintf(MSG_FORCE, " -o: overwrite the archive if it already exists instead of failing\n"); msgprintf(MSG_FORCE, " -v: verbose mode (can be used several times to increase the level of details)\n"); msgprintf(MSG_FORCE, " -d: debug mode (can be used several times to increase the level of details)\n"); msgprintf(MSG_FORCE, " -A: allow to save a filesystem which is mounted in read-write (live backup)\n"); msgprintf(MSG_FORCE, " -a: allow to save a filesystem when acls and xattrs are not supported\n"); msgprintf(MSG_FORCE, " -x: enable support for experimental features (they are disabled by default)\n"); msgprintf(MSG_FORCE, " -e : exclude files and directories that match that pattern\n"); msgprintf(MSG_FORCE, " -L