Re: [Partclone-user] confirm bf12b3b3f4983aff17489fe649460648d450a90c
Brought to you by:
thomas_tsai
From: thomas <th...@nc...> - 2010-09-02 14:54:08
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thanks for your effort and contribution. I will check patch file and commit to repository in the next version. BR, Thomas. On 2010年09月02日 21:56, jan Köster wrote: > > > 2010/9/2 jan Köster <tu...@go... <mailto:tu...@go...>> > > Hi I modefied partclone with a gzip out/input but i don't found the > the source file with file operations. Where can i find them ? > > > my patches: > diff -u -r -N partclone-0.2.13/configure.ac <http://configure.ac> > partclone-0.2.13-gzip/configure.ac <http://configure.ac> > --- partclone-0.2.13/configure.ac <http://configure.ac> 2010-07-28 > 12:05:12.000000000 +0200 > +++ partclone-0.2.13-gzip/configure.ac <http://configure.ac> > 2010-09-02 13:11:52.132450071 +0200 > @@ -359,7 +359,14 @@ > AS_HELP_STRING(--enable-ncursesw,enable TEXT User Interface), > enable_ncursesw=yes, > ) > + > +##zlib## > +AC_ARG_ENABLE(gzip, > + AS_HELP_STRING(--enable-gzip,enable GZIP Compression), > + enable_gzip=yes, > +) > + > +AM_CONDITIONAL(ENABLE_ZLIB, test "$enable_ncursesw" = yes) > > if test "$enable_ncursesw" = "yes"; then > > @@ -372,6 +379,16 @@ > AC_MSG_ERROR([*** Ncursesw library (libncursesw5) not found])) > fi > > +if test "$enable_gzip" = "yes"; then > + > +dnl Check for ZLIB > +AC_CHECKING([ for Zlib Library and Header files ... ]) > +AC_CHECK_HEADERS([zlib.h], , > + AC_MSG_ERROR([*** zlib header files (zlib.h) not found]) > +) > +AC_CHECK_LIB(z,compress, , > + AC_MSG_ERROR([*** Zlib library (z) not found])) > +fi > > ##static linking## > AC_ARG_ENABLE(static, > > diff -u -r -N partclone-0.2.13/src/Makefile.am > partclone-0.2.13-gzip/src/Makefile.am > --- partclone-0.2.13/src/Makefile.am 2010-07-28 12:05:12.000000000 +0200 > +++ partclone-0.2.13-gzip/src/Makefile.am 2010-09-02 > 13:48:55.112450881 +0200 > @@ -6,45 +6,49 @@ > version.h: FORCE > $(TOOLBOX) --update-version > > -partclone_info_SOURCES=infoclone.c partclone.c partclone.h fs_common.h > +if ENABLE_ZLIB > + partclone_compress_SOURCES=image_compress.c > +endif > + > +partclone_info_SOURCES=infoclone.c partclone.c partclone.h fs_common.h > ${partclone_compress_SOURCES} > > -partclone_restore_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h restore.c > +partclone_restore_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h restore.c ${partclone_compress_SOURCES} > partclone_restore_CFLAGS=-DRESTORE > > -partclone_chkimg_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h chkimg.c > +partclone_chkimg_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h chkimg.c ${partclone_compress_SOURCES} > > -partclone_dd_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h ddclone.c > +partclone_dd_SOURCES=partclone.c partclone.h progress.c progress.h > gettext.h ddclone.c ${partclone_compress_SOURCES} > > if ENABLE_EXTFS > sbin_PROGRAMS += partclone.extfs > -partclone_extfs_SOURCES=main.c partclone.c progress.c extfsclone.c > extfsclone.h partclone.h progress.h gettext.h > +partclone_extfs_SOURCES=main.c partclone.c progress.c extfsclone.c > ${partclone_compress_SOURCES} extfsclone.h partclone.h progress.h gettext.h > partclone_extfs_CFLAGS=-DEXTFS > partclone_extfs_LDADD=-lext2fs -lcom_err -lpthread > endif > > if ENABLE_REISERFS > sbin_PROGRAMS += partclone.reiserfs > -partclone_reiserfs_SOURCES=main.c partclone.c progress.c > reiserfsclone.c reiserfsclone.h partclone.h progress.h gettext.h > +partclone_reiserfs_SOURCES=main.c partclone.c progress.c > reiserfsclone.c ${partclone_compress_SOURCES} reiserfsclone.h > partclone.h progress.h gettext.h > partclone_reiserfs_CFLAGS=-DREISERFS > partclone_reiserfs_LDADD=-lreiserfs -ldal > endif > > if ENABLE_REISER4 > sbin_PROGRAMS += partclone.reiser4 > -partclone_reiser4_SOURCES=main.c partclone.c progress.c reiser4clone.c > reiser4clone.h partclone.h progress.h gettext.h > +partclone_reiser4_SOURCES=main.c partclone.c progress.c reiser4clone.c > ${partclone_compress_SOURCES} reiser4clone.h partclone.h progress.h > gettext.h > partclone_reiser4_CFLAGS=-DREISER4 > partclone_reiser4_LDADD=-lreiser4 -laal > endif > > if ENABLE_HFSP > sbin_PROGRAMS += partclone.hfsp > -partclone_hfsp_SOURCES=main.c partclone.c progress.c hfsplusclone.c > hfsplusclone.h partclone.h progress.h gettext.h > +partclone_hfsp_SOURCES=main.c partclone.c progress.c hfsplusclone.c > ${partclone_compress_SOURCES} hfsplusclone.h partclone.h progress.h > gettext.h > partclone_hfsp_CFLAGS=-DHFSPLUS > endif > > if ENABLE_XFS > sbin_PROGRAMS += partclone.xfs > -partclone_xfs_SOURCES=main.c partclone.c progress.c xfsclone.c > xfsclone.h partclone.h progress.h gettext.h > +partclone_xfs_SOURCES=main.c partclone.c progress.c xfsclone.c > ${partclone_compress_SOURCES} xfsclone.h partclone.h progress.h gettext.h > partclone_xfs_CFLAGS=-DXFS -D_FILE_OFFSET_BITS=64 > partclone_xfs_LDFLAGS= > partclone_xfs_LDADD=-lxfs -lrt -lpthread > @@ -52,13 +56,13 @@ > > if ENABLE_FAT > sbin_PROGRAMS += partclone.fat > -partclone_fat_SOURCES=main.c partclone.c progress.c fatclone.c > fatclone.h partclone.h progress.h gettext.h > +partclone_fat_SOURCES=main.c partclone.c progress.c fatclone.c > ${partclone_compress_SOURCES} fatclone.h partclone.h progress.h gettext.h > partclone_fat_CFLAGS=-DFAT > endif > > if ENABLE_NTFS > sbin_PROGRAMS += partclone.ntfs > -partclone_ntfs_SOURCES=main.c partclone.c progress.c ntfsclone-ng.c > ntfsclone-ng.h partclone.h progress.h gettext.h > +partclone_ntfs_SOURCES=main.c partclone.c progress.c ntfsclone-ng.c > ${partclone_compress_SOURCES} ntfsclone-ng.h partclone.h progress.h > gettext.h > partclone_ntfs_CFLAGS=-DNTFS > partclone_ntfs_LDADD=-lntfs > sbin_PROGRAMS += partclone.ntfsfixboot > @@ -72,14 +76,14 @@ > > if ENABLE_UFS > sbin_PROGRAMS += partclone.ufs > -partclone_ufs_SOURCES=main.c partclone.c progress.c ufsclone.c > ufsclone.h partclone.h progress.h gettext.h > +partclone_ufs_SOURCES=main.c partclone.c progress.c ufsclone.c > ${partclone_compress_SOURCES} ufsclone.h partclone.h progress.h gettext.h > partclone_ufs_CFLAGS=-DUFS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 > partclone_ufs_LDADD=-lufs -lbsd > endif > > if ENABLE_VMFS > sbin_PROGRAMS += partclone.vmfs > -partclone_vmfs_SOURCES=main.c partclone.c progress.c vmfsclone.c > vmfsclone.h partclone.h progress.h gettext.h > +partclone_vmfs_SOURCES=main.c partclone.c progress.c vmfsclone.c > ${partclone_compress_SOURCES} vmfsclone.h partclone.h progress.h gettext.h > partclone_vmfs_CFLAGS=-DVMFS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 > $(UUID_CFLAGS) > partclone_vmfs_LDADD=-lvmfs -luuid > > @@ -93,12 +97,11 @@ > if ENABLE_JFS > sbin_PROGRAMS += partclone.jfs > #partclone_jfs_SOURCES=main.c partclone.c progress.c jfs_devices.c > jfs_devices.h jfsclone.c jfsclone.h partclone.h progress.h gettext.h > -partclone_jfs_SOURCES=main.c partclone.c progress.c jfsclone.c > jfsclone.h partclone.h progress.h gettext.h > +partclone_jfs_SOURCES=main.c partclone.c progress.c jfsclone.c > ${partclone_compress_SOURCES} jfsclone.h partclone.h progress.h gettext.h > partclone_jfs_CFLAGS=-DJFS > partclone_jfs_LDADD=-luuid -ljfs > endif > > - > # Extra > install-exec-hook: > $(LN_S) -f partclone.extfs $(DESTDIR)$(sbindir)/partclone.ext2 > > diff -u -r -N partclone-0.2.13/src/image_compress.h > partclone-0.2.13-gzip/src/image_compress.h > --- partclone-0.2.13/src/image_compress.h 1970-01-01 > 01:00:00.000000000 +0100 > +++ partclone-0.2.13-gzip/src/image_compress.h 2010-09-02 > 14:49:25.332450769 +0200 > @@ -0,0 +1,17 @@ > +/** > + * image_compress.h - Part of Partclone project. > + * > + * Copyright (c) 2010~ Jan Koester <jan...@ex... > <mailto:jan...@ex...>> > + * > + * function and structure used by main. > + * > + * 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 of the License, or > + * (at your option) any later version. > + */ > + > +extern void compress_image(char *imagegz, char *image); > +extern void uncompress_image(); > +extern long uncompress_size(); > +extern long compress_size(); > \ Kein Zeilenumbruch am Dateiende. > > diff -u -r -N partclone-0.2.13/src/partclone.c > partclone-0.2.13-gzip/src/partclone.c > --- partclone-0.2.13/src/partclone.c 2010-07-28 12:05:12.000000000 +0200 > +++ partclone-0.2.13-gzip/src/partclone.c 2010-09-02 > 14:58:04.953702349 +0200 > @@ -113,6 +113,9 @@ > #ifdef HAVE_LIBNCURSESW > " -N, --ncurses Using Ncurses User Interface\n" > #endif > +#ifdef HAVE_LIBZ > + " -z, --gzip Compress Image with gzip\n" > +#endif > " -X, --dialog Output message as Dialog Format\n" > " -I, --ignore_fschk Ignore filesystem check\n" > " --ignore_crc Ignore crc check error\n" > @@ -153,6 +156,9 @@ > #ifdef HAVE_LIBNCURSESW > { "ncurses", no_argument, NULL, 'N' }, > #endif > +#ifdef HAVE_LIBZ > + { "gzip", no_argument, NULL, 'z' }, > +#endif > { NULL, 0, NULL, 0 } > }; > > @@ -236,6 +242,11 @@ > opt->ncurses = 1; > break; > #endif > +#ifdef HAVE_LIBZ > + case 'z': > + opt->gzip = 1; > + break; > +#endif > case 'C': > opt->check = 0; > break; > @@ -784,7 +795,7 @@ > char *mp; > int flags = O_WRONLY | O_LARGEFILE; > struct stat st_dev; > - > + > log_mesg(1, 0, 0, debug, "open target file/device\n"); > if (opt->clone){ > if (strcmp(target, "-") == 0){ > @@ -795,8 +806,9 @@ > flags |= O_CREAT; /// new file > if (!opt->overwrite) /// overwrite > flags |= O_EXCL; > + > ret = open (target, flags, S_IRUSR); > - > + > if (ret == -1){ > if (errno == EEXIST){ > log_mesg(0, 0, 1, debug, "Output file '%s' already > exists.\nUse option --overwrite if you want to replace its content.\n", > target); > > diff -u -r -N partclone-0.2.13/src/image_compress.c > partclone-0.2.13-gzip/src/image_compress.c > --- partclone-0.2.13/src/image_compress.c 1970-01-01 > 01:00:00.000000000 +0100 > +++ partclone-0.2.13-gzip/src/image_compress.c 2010-09-02 > 14:49:21.143700176 +0200 > @@ -0,0 +1,62 @@ > +/** > + * image_compress.c - Part of Partclone project. > + * > + * Copyright (c) 2010~ Jan Koester <jan...@ex... > <mailto:jan...@ex...>> > + * > + * function and structure used by main. > + * > + * 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 of the License, or > + * (at your option) any later version. > + */ > + > +#include <stdio.h> > +#include <string.h> > +#include <zlib.h> > +#include "image_compress.h" > + > +#define Z_BEST_COMPRESSION 9 > + > +void compress_image(char *imagegz, const char *image){ > + Byte *compr; > + uLong comprLen; > + z_stream c_stream; /* compression stream */ > + int err; > + int len = strlen(hello)+1; > + c_stream.zalloc = (alloc_func)0; > + c_stream.zfree = (free_func)0; > + c_stream.opaque = (voidpf)0; > + err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); > + CHECK_ERR(err, "deflateInit"); > + c_stream.next_in = (Bytef*)hello; > + c_stream.next_out = compr; > + while (c_stream.total_in != (uLong)len && c_stream.total_out < > comprLen) { > + c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ > + err = deflate(&c_stream, Z_NO_FLUSH); > + CHECK_ERR(err, "deflate"); > + } > + /* Finish the stream, still forcing small buffers: */ > + for (;;) { > + c_stream.avail_out = 1; > + err = deflate(&c_stream, Z_FINISH); > + if (err == Z_STREAM_END) break; > + CHECK_ERR(err, "deflate"); > + } > + > + err = deflateEnd(&c_stream); > + CHECK_ERR(err, "deflateEnd"); > + } > +} > + > +void uncompress_image(){ > +// printf("Test Uncompress"); > +} > + > +long uncompress_size(){ > + > +} > + > +long compress_size(){ > + > +} > \ Kein Zeilenumbruch am Dateiende. > > diff -u -r -N partclone-0.2.13/src/partclone.h > partclone-0.2.13-gzip/src/partclone.h > --- partclone-0.2.13/src/partclone.h 2010-07-28 12:05:12.000000000 +0200 > +++ partclone-0.2.13-gzip/src/partclone.h 2010-09-02 > 14:06:41.722450617 +0200 > @@ -79,10 +79,11 @@ > int rescue; > int check; > int ncurses; > + int gzip; > int dialog; > int force; > int ignore_fschk; > - int ignore_crc; > + int ignore_crc; > unsigned long fresh; > }; > typedef struct cmd_opt cmd_opt; > @@ -101,6 +102,7 @@ > int percent; > char data[1024]; > }; > + > typedef struct dialog_mesg p_dialog_mesg; > /** > * debug message > > > > > > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > > > > _______________________________________________ > Partclone-user mailing list > Par...@li... > https://lists.sourceforge.net/lists/listinfo/partclone-user - -- Thomas, 蔡育欽 國家高速網路與計算中心 格網技術組 專案助理研究員 thomas at nchc org tw pub key 46379ACF fingerprint = 7BB2 2103 CADC 59F6 11D5 BCB3 5E97 22B4 4637 9ACF -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkx/uoQACgkQXpcitEY3ms+jtgCgqIWp0GR3ClS0PH+3y7KXsS2a D30An0f1lcCnGXA9ybHr0N80WR0shFEx =dfoq -----END PGP SIGNATURE----- |