Re: Feature requests related to sparse files

[email protected] Wed, 16 Mar 2011 15:11:04 -0000
Newsgroups gmane.comp.archivers.star.user
Message-ID <923111c42fe9afa7e68baa95ffbcf56f.squirrel@ssl-webmail-vh.clara.net>
------=_20110316151104_97768
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

Following up my recent message...
> 1. Allow -force-hole to apply to archive creation, not just extraction.

Attached is a diff for create.c in the star 1.5.1 source which implements
that.

It seems to work for me, but if anyone wants to test, please do. You need
to specify both -sparse and -force-hole when creating an archive to get
the new behaviour.

If any of the (non-sparse) files you archive contain all-zero regions, th=
e
final .tar file should be smaller than before. For example some CD/DVD IS=
O
image files contain very large all-zero regions, which was my original
motivation for wanting this feature.

I don't use Solaris so can't test on that. On Solaris star uses
SEEK_HOLE/SEEK_DATA to find the actual holes in files. On reading the
mk_sp_list() source, it seems that when -force-hole is specified star
doesn't use SEEK_HOLE/SEEK_DATA, so my patch should still work.


Mark

------=_20110316151104_97768
Content-Type: text/plain; name="create.c_diff.txt"
Content-Disposition: attachment; filename="create.c_diff.txt"
Content-Transfer-Encoding: quoted-printable

*** create.c_orig	2011-03-16 13:55:59.425920046 +0000
--- create.c	2011-03-16 14:42:11.357958381 +0000
***************
*** 136,141 ****
--- 136,142 ----
  extern	BOOL	abs_path;
  extern	BOOL	nowarn;
  extern	BOOL	match_tree;
+ extern	BOOL	force_hole;
  extern	BOOL	sparse;
  extern	BOOL	Ctime;
  extern	BOOL	nodump;
***************
*** 695,704 ****
--- 696,713 ----
  			}
  			return;
  		}
+=20
+ 		/*
+ 		 * Treat all files as sparse when -force-hole option is given.
+ 		 */
  		if (do_sparse && sparse_file(&fd, info)) {
  			if (!silent)
  				error("%s is sparse\n", info->f_name);
  			put_sparse(&fd, info);
+ 		} else if (do_sparse && force_hole) {
+ 			if (!silent)
+ 				error("Treating %s as sparse\n", info->f_name);
+ 			put_sparse(&fd, info);
  		} else {
  			put_tcb(ptb, info);
  			vprint(info);
------=_20110316151104_97768
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Star-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/star-users

------=_20110316151104_97768--