[linux-lvm] Re: more LVM 0.8 patches

Andreas Dilger adilger at turbolinux.com
Tue Oct 24 18:47:23 UTC 2000


Christoph writes:
> > Actually, this is a bit of a problem.  In my 2.2 kernel patch, I include an
> > lvm.h that can be used for both user and kernel compiles, so that you are
> > sure you have the same IOP version, struct sizes, etc.  However, this lvm.h
> > doesn't exist on 2.4.
> 
> IMHO this is the wrong thing. Userlevel tools should not include kernel
> headers. IOP version mismatches are detected at run time.
> In my RPMs I keep including the userlevel header and it works fine for
> Linux 2.2 and 2.4.

Actually, there IS a problem that isn't addressed by the IOP version,
probably because someone changed the lvm.h file after Heinz added it
to the kernel.  In the lv_v2 struct (in the 2.4 kernel sources) the
"uint8 __unused" field was added after lv_block_exception_t, and this
was not reflected in a IOP version change.  This field is NOT in the
lvm.h lv_v2 included in the 0.8final user tools.

That is why I chose to have a single lvm.h between user and kernel
space.  I know that it is bad to include linux/*.h headers in user
tools, but I wanted the tools to compile properly with the header
in the current kernel.

*** If we at least make the header include/linux/lvm.h and tools/lib/lvm.h
    exactly the same, it will make tracking changes a lot easier.
    Better would be to have per-struct version numbers, or make the ioctl
    numbers reflect the struct sizes (which is already part of the ioctl
    definitions) we can track changes a lot easier, and allow backwards
    compatibility when struct sizes change because they will get unique
    ioctl numbers for the old and new interface.

Note that the user tools tarball that I have also includes the lvm.h
under tools/lib, I just don't use it.  At most, you will need to change
#include <linux/lvm.h> to #include <lib/lvm.h> in lvm_user.h and liblvm.h.

If people agree that we should keep kernel and user headers totally
separate, I will change this for my next release.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert



More information about the linux-lvm mailing list