"tar tfv /dev/cd0" speedup patch

Tim Kientzle kientzle at freebsd.org
Thu Feb 18 06:37:34 UTC 2010


Juergen Lock wrote:
> 
>  ...  since bsdtar/libarchive know iso9660 I just did the command in the
> Subject.  It worked, but it was sloow... :(  Apparently it read all of
> the disc without seeking.  The following patch fixes this, is something
> like this desired?  If yes I could look how to do the same for Linux,

Juergen,

This is great!  If you can figure out how to get this
right, I would really appreciate it.  If you have a
tape drive handy, definitely test with that.  My first
attempts here actually broke reading from tape drives,
which is why the current code is so conservative.

Minor style comments:
>  else if (S_ISCHR(st.st_mode) &&
>     !ioctl(fd, DIOCGMEDIASIZE, &mediasize) && mediasize) {

Please be explicit:  S_ISCHR() && ioctl() == 0  && mediasize > 0

> 	archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino);

extract_skip_file isn't needed here; we don't read the
contents of device nodes.

Let me know as soon as you have something you're confident of.

Cheers,

Tim



More information about the freebsd-hackers mailing list