login
Header Space

 
 

Compressed vnd handling tested successfully

Previous thread: docygen: python dependency by Berndt Josef Wulf on Sunday, June 12, 2005 - 7:53 pm. (1 message)

Next thread: [Summer of Code]valgrind by Ruibiao Qiu on Sunday, June 12, 2005 - 11:02 pm. (2 messages)
Cc: Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Sunday, June 12, 2005 - 8:17 pm

After Cliff Wright posted a patch for vnd(4) to handle compressed disk 
images some time ago[1] and Florian Stoehr wrote a userland tool to 
(de)compress disk images (using the cloop2 format also found on other 
systems)[2], I sat down to play with the two things tonight.

In short: very successfully!


What I basically did was build a kernel and vnconfig(8) with the patch in 
[1], and build Florian's tool (which I received in private from him).
After booting the patched kernel, I did the following steps:

Verify I was running the kernel I just built (this is all in qemu):

 	qemubsd# uname -a
 	NetBSD qemubsd 3.99.6 NetBSD 3.99.6 (GENERIC) #1: Mon Jun 13 01:12:47 MEST 2005  feyrer@miyu:/usr/cvs/src-cloop2/sys/arch/i386/compile/obj.i386/GENERIC i386


Create some toy filesystem:

 	qemubsd# /root/vndz/vnconfig -l
 	vnd0: not in use
 	vnd1: not in use
 	vnd2: not in use
 	vnd3: not in use
 	qemubsd# makefs
 	usage: makefs [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]
 		[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]
 		[-b free-blocks] [-f free-files] [-F mtree-specfile] [-x]
 		[-N userdb-dir] image-file directory
 	qemubsd#
 	qemubsd# makefs inc.fs /usr/include
 	Calculated size of `inc.fs': 11157504 bytes, 1273 inodes
 	Extent size set to 8192
 	inc.fs: 10.6MB (21792 sectors) block size 8192, fragment size 1024
 		using 1 cylinder groups of 10.64MB, 1362 blks, 1408 inodes.
 	super-block backups (for fsck -b #) at:
 	 32,
 	Populating `inc.fs'
 	Image `inc.fs' complete


Mount the filesystem the usual (uncompressed) way:

 	qemubsd# /root/vndz/vnconfig vnd0 /tmp/inc.fs
 	qemubsd# /root/vndz/vnconfig vnd0 -l
 	vnd0: / (/dev/wd0a) inode 10839
 	vnd1: not in use
 	vnd2: not in use
 	vnd3: not in use
 	qemubsd#
 	qemubsd# disklabel vnd0a
 	disklabel: Invalid signature in mbr record 0
 	# /dev/rvnd0a:
 	type: vnd
 	disk: vnd
 	label: fictitious
 	flags:
 	bytes/sector: 512
 	sectors/track: 32
 	tracks/cylinder: 64
 	sector...
Date: Tuesday, June 14, 2005 - 4:26 am

What does the "cl" stand for in the name "clcompress"?  I don't see any
obvious relationship between the name and what the tool does (which, if
I understand correctly, is to perform a special kind of compression on
files that will later be used by a modified version of vnconfig).  I
suggest using a name more like "vncompress".

--apb (Alan Barrett)
Cc: <tech-kern@...>
Date: Tuesday, June 14, 2005 - 4:32 am

Right, we agreed on renaming it from clconfig to vncompress. :)


  - Hubert
Cc: Alan Barrett <apb@...>, <tech-kern@...>
Date: Tuesday, June 14, 2005 - 12:26 pm

Please call it "vndcompress" rather than "vncompress".  Actually,  

-- thorpej
Cc: Alan Barrett <apb@...>, <tech-kern@...>
Date: Tuesday, June 14, 2005 - 12:59 pm

I think the english word for the action being taken here is "compress", 
not "zip" (checked via http://dict.leo.org :), so let's go for 
"vndcompress" (and "vnduncompress").

Who's gonna rename vnconfig -&gt; vndconfig?


  - Hubert
Cc: Jason Thorpe <thorpej@...>, Alan Barrett <apb@...>, <tech-kern@...>
Date: Tuesday, June 14, 2005 - 1:24 pm

Hubert, you need "vnddecompress" since there is no English word uncompress.=
 :)

-Andrew
Cc: Hubert Feyrer <hubert@...>, Jason Thorpe <thorpej@...>, Alan Barrett <apb@...>, <tech-kern@...>
Date: Tuesday, June 14, 2005 - 3:12 pm

But NetBSD speaks unixese not english, and vndzip is a lot easier
	eh?  It sounds like english to me. (and it is listed on e.g. www.dictionary.com)

eric
Cc: Andrew Gillham <gillham@...>, Hubert Feyrer <hubert@...>, Alan Barrett <apb@...>, <tech-kern@...>
Date: Tuesday, June 14, 2005 - 3:47 pm

-- thorpej
Date: Tuesday, June 14, 2005 - 5:47 am

Shouldn't this just be a flag to vnconfig (which ought to be called
vndconfig, but never mind :)?

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
Cc: <tech-kern@...>
Date: Tuesday, June 14, 2005 - 4:31 am

"cl" came from "cloop", that's what this is called on Linux.

-Florian
Cc: <netbsd@...>, <jb@...>, <hubert@...>
Date: Monday, June 13, 2005 - 4:49 pm

Note their is a bug when using OpenOffice on BSD read-only file system.
Linux seems to have the philosophy let it run no matter what, where as
BSD will report if it finds something wrong. This is seen in the use
of fnctl F_SETLK with OpenOffice in a read-only filesystem on a NetBSD
LiveCD. BSD says setting the lock does not make sense on a read-only
file system, and reports an error, where Linux just lets this go.
The quick hack patch I used is below, on file:
/usr/pkgsrc/misc/openoffice/work/store/source/fileunx.hxx

--- fileunx.hxx.orig 2003-08-15 04:53:11.000000000 -0700
+++ fileunx.hxx 2005-05-18 11:24:51.000000000 -0700
@@ -251,7 +251,7 @@
        lock.l_start  = 0;
        lock.l_len    = 0;
 
-       if (::fcntl (rhFile, F_SETLK, &amp;lock) &lt; 0)
+       if ((::fcntl (rhFile, F_SETLK, &amp;lock) &lt; 0) &amp;&amp; errno != EINVAL)
        {
                // Save original result.
                storeError result;
Note the EINVAL could cover other cases, so I have not turned this in
to the OpenOffice people, as it may be to broad.
 Because this was a message response I posted here, but might be better
on tech-pkg.

On Mon, 13 Jun 2005 02:17:39 +0200 (CEST)
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 6:23 am

IMHO all the kernel changes need  to be conditionalized on some kernel
option. There are lots of vnd users out there, most of which never will use
this format.

Anyone ever looked at creating an uncompressing overlay filesystem, so that
you could store all files as bzip2 -9 encoded on an arbitrary filesystem
(e.g. iso9660), but without the .bz2 suffix, and read them uncompressed
throught the fs mounted on top of it?

Martin
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:27 am

Good point!


  - Hubert
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:40 am

Looking at the code, I wonder how to do this:
  * just add an #ifdef for a symbol around the code, and keep the
    data fields for compression handling in struct vnd_softc
  * put the #ifdef also on the fields in struct vnd_softc
  * use something else than an #ifdef/option (I have no idea on kernel
    hacking :)

Thinking more about the userland tool's name, I wonder if "vndcompress" 
would be more appropriate than cl&lt;something&gt;...


  - Hubert
Cc: Martin Husemann <martin@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Tuesday, June 14, 2005 - 12:21 pm

Don't #ifdef the fields in the vnd_softc structure -- that would  

Yes, that sounds better.  Just mention which format it is compatible  
with.


-- thorpej
Cc: Martin Husemann <martin@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 2:19 pm

I recommend option 1. Unless the crypto fields are huge, leave them in. It=
=20
will make everyone's life easier.

Take care,

Bill
Cc: Martin Husemann <martin@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 9:14 am

In message &lt;Pine.LNX.4.61.0506131337200.31861@m24s24.vlinux.de&gt;, Hubert Feyrer 

Unless the fields in vnd_softc are big, I'd include them 
unconditionally -- it simplifies life for anyone who wants to write a 
kernel data structure dumper.  (I'm thinking gdb rather than libkvm.)

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb
Cc: Martin Husemann <martin@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 9:14 am

Is there a good reason for leaving the data fields around?  (LKM
issues if the structure is shared with other parts of the kernel;


I apologize if I missed something earlier, but is this something that
could be folded into vnconfig ?

-allen

-- 
                  Use NetBSD!  http://www.NetBSD.org/
Cc: Martin Husemann <martin@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>, Hubert Feyrer <hubert@...>
Date: Monday, June 13, 2005 - 9:40 pm

some vnd structures are shared with UVM and there is a vnd LKM that
i just noticed a few days ago i didn't enable in the build and will
be shortly.  is there really a good reason to make this code
conditional?  i don't see the point really...
Cc: <tech-kern@...>
Date: Monday, June 13, 2005 - 6:35 pm

I looked a bit, and it seems the vnd_softc(sp?) is only used inside the 
kernel, it's also protected by an appropriate #ifdef in the vndvar.h 
header. And as the vnd(4) driver is unlikely to interoperate with some 
other LKM (I hope?), I think it's safe to also include the data in the 


The tool compresses &amp; uncompresses a disk-image (file), and isn't all that 
different from what compress/gzip etc. do - I don't feel like we should 
add this into vnconfig(8). Of course it could be done, but it would sound 
more like a hack to me (and the -c(ompress)/-u(ncompress) flags are 
already taken in vnconfig(8) ;-).

I'd leave it as seperate tool.


FWIW, the latest version of my patch is here (!!! beware, there are some 
bugs in there according to the author, Cliff Wright, which will raise a 
few problems !!!):

 	http://www.feyrer.de/Misc/vnd.gz-HF20050614.patch


  - Hubert
Cc: <tech-kern@...>
Date: Tuesday, June 14, 2005 - 10:08 am

About the name...  I understand that you chose vncompress (without the
'd' in vnd) because it matches vnconfig.

However, vnconfig should be really named vndconfig, as the device is
vnd, not vn (this was discussed in the past, IIRC).  I'm wondering...
could we rename the utility (and provide a compatibility link for the
old name, of course)?

(Just asking this to avoid the addition of another tool with an
"incorrect" name.)

Cheers,

-- 
Julio M. Merino Vidal &lt;jmmv84@gmail.com&gt;
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/
Cc: <tech-kern@...>
Date: Tuesday, June 14, 2005 - 10:12 am

I have no opinion on this. If it's decided that vnconfig gets renamed to 
vndconfig, I'd rather make the other tool named vndcompress/vnduncomopress 
then.

Maybe core or so wants to decide this. :)

  - Hubert
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 9:06 am

This is the usual aproach I'd recommend.

Martin
Cc: <tech-kern@...>
Date: Monday, June 13, 2005 - 7:06 am

/usr/share/examples/mount_portal/advanced.1.conf contains something
which is a lot like what you want.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            --  rhialto/at/falu.nl
\X/ Hi! I'm a signature virus! Copy me to your .signature to help me spread!
Cc: <tech-kern@...>
Date: Monday, June 13, 2005 - 9:09 am

Heh, cool!

Martin
Cc: Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Sunday, June 12, 2005 - 8:43 pm

FWIW, Linux seems to use "create_compressed_fs" and 
"extract_compressed_fs" (see 
http://www.novell.com/products/linuxpackages/professional/cloop.html).
Not my first choice... cl2compress? clcompress? cl2zip? clzip?


  - Hubert

-- 
Still in exile.
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Florian Stoehr <netbsd@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:40 am

Well, do we need to split this into two programs? Hm, don't think so (in 
my opinion).

Perhaps "clcompress" is suitable?

-Florian
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:43 am

Sure not two programs, at best we can make it regard argv[0].
What do you think about "vncompress", as this is really a vnd-thing, not a 
cloop (== linux' name) thing?


  - Hubert
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 11:00 am

Reading argv[0] is evil. Don't do that.

        - Nathan
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>, Hubert Feyrer <hubert@...>
Date: Monday, June 13, 2005 - 9:41 pm

&gt; On Mon, 13 Jun 2005, Florian Stoehr wrote:
   &gt; &gt; Well, do we need to split this into two programs? Hm, don't think so
   &gt; &gt; (in my opinion).
   &gt; &gt;
   &gt; &gt; Perhaps "clcompress" is suitable?
   &gt; 
   &gt; Sure not two programs, at best we can make it regard argv[0].
   
   Reading argv[0] is evil. Don't do that.

it's already used all over our tree, including that we install only
one binary of grep instead of three for grep, egrep and fgrep.  i'm
not sure this argument is compelling for netbsd.


.mrg.
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 6:09 pm

Why not?
It's what compress/uncompress and gzip/gunzip do, too...


  - Hubert
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 6:29 pm

It may be historical practice, but it's bad historical practice. At
the very least you have to have a flag to set what to do, regardless
of the name. What does the program do when you run it as
"nbclcompress", or "clcompress-test", or whatever?

        - Nathan
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>
Date: Monday, June 13, 2005 - 6:37 pm

Right now: complain &amp; abort.
What do you suggest? Make only a "vncompress" that handles -c(compress) 
and -d(ecompress)/-u(ncompress)? That's what it did initially, but I 
really find using two names easier.


  - Hubert
Date: Tuesday, June 14, 2005 - 12:19 am

I don't see anything wrong with having one program which accepts -c and
-d (or whatever options are picked) and then, for certain values of
basename(argv[0]), supplies one or the other by default.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
Cc: <tech-kern@...>
Date: Tuesday, June 14, 2005 - 12:26 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Well, I guess it would break the principle of least surprise: if the default
is to compress, and you rename the decompressor to some other name, then you
won't be able to launch the newly created file with the same command line as
the former version (as it will no longer default to decompress but compress)

Regards.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCrwUbMiWEUf7YMGERAm8VAKDbU0upBKOGEkhWfmelw2NNJ5jx0gCg2mMZ
o5qV/qHhhANgnEY3169dou8=
=M+WJ
-----END PGP SIGNATURE-----
Date: Tuesday, June 14, 2005 - 1:23 pm

&gt; Cc: tech-kern@NetBSD.org


If.  No, I think the default should be more like...

 cflag =3D 0;
 dflag =3D 0;
 if (!strcmp(basename(av[0]),"vndzip")) cflag =3D 1;
 if (!strcmp(basename(av[0]),"vndunzip")) dflag =3D 1;
 ...process command-line flags...
 ... -c -&gt; { cflag=3D1; dflag=3D0; } ...
 ... -d -&gt; { dflag=3D1; cflag=3D0; } ...
 if (!cflag &amp;&amp; !dflag)
  { fprintf(stderr,"%s: must give -c or -d when not run as `vndzip' or `v=
ndunzip'\n",__progname);
    exit(1);
  }

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
Cc: Nathan J. Williams <nathanw@...>, Florian Stoehr <netbsd@...>, <tech-kern@...>
Date: Monday, June 13, 2005 - 10:35 pm

Salut,


I'd suggest -d because that's what [bg]zip* use.

				Tonnerre
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:46 am

OK, that's a good name!

(Although, remember, we're 100% compatible, so our newly created files 
should also work on Linux right out of the box).

-Flo
Cc: <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:52 am

That should go into the manpage. :)
BTW, what's status of this? ;)


  - Hubert
Cc: Florian Stoehr <netbsd@...>, <tech-kern@...>, Cliff Wright <cliff@...>, Joerg Braun <jb@...>
Date: Monday, June 13, 2005 - 7:56 am

I'll fixup the manpage and send it to you as soon as we've finally chosen 
a name for the program.

-Florian
Previous thread: docygen: python dependency by Berndt Josef Wulf on Sunday, June 12, 2005 - 7:53 pm. (1 message)

Next thread: [Summer of Code]valgrind by Ruibiao Qiu on Sunday, June 12, 2005 - 11:02 pm. (2 messages)
speck-geostationary