Linux LVM users
 help / color / mirror / Atom feed
From: Luca Berra <bluca@comedia.it>
To: linux-lvm@sistina.com
Subject: Re: [linux-lvm] Linux 2.4.0-test12-pre7 LVM .9 vs .8final
Date: Tue, 12 Dec 2000 08:48:07 +0100	[thread overview]
Message-ID: <20001212084807.A27177@colombina.comedia.it> (raw)
In-Reply-To: <3A3477D0.94BC1D88@twc.de>; from ulf@twc.de on Mon, Dec 11, 2000 at 07:44:32AM +0100

[-- Attachment #1: Type: text/plain, Size: 362 bytes --]

On Mon, Dec 11, 2000 at 07:44:32AM +0100, Ulf Bartelt wrote:
> A set of lvm tools for multiple versions of the io protocol could help a
> lot...
> 
> Sure this can be faked using links, wrappers etc...

i am using this piece of junk for testing and switching back btw 0.8 and 0.9

L.

-- 
Luca Berra -- bluca@comedia.it
    Communication Media & Services S.r.l.

[-- Attachment #2: lvm_wrapper.c --]
[-- Type: text/plain, Size: 1589 bytes --]

/*
A wrapper for Linux LVM user space tools
No Copyright 2000 Luca Berra <bluca@vodka.it>

This program is free software: you can do anything you want
with it, I don't give a damn.

By using this piece of crap you agree that I (Luca Berra)
cannot be held responsible for any damage that it may cause.

To build: cc -o lvm_wrapper lwm_wrapper.c /usr/lib/liblvm.a
To use: move all lvm tools in /sbin/lvm/<iop>, where iop is the iop
	version supported by the tools (eg: 6 for lvm 0.8, 10 for lvm 0.9)
	install lvm_wrapper in /sbin.
	create links to lvm_wrapper for any program in /sbin/lvm/<iop>
	(for i in /sbin/lvm/*/*;do ln -s lvm_wrapper /sbin/${i##*/};done)

I suppose that if the tools are using a shared library you have changed the
shared library name to something including a version number.
else add a putenv("LD_LIBRARY_PATH=....") or putenv("LD_PRELOAD=....")
before the execv.

*/

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>

#define LVM_CMD_PREFIX "/sbin/lvm"
struct stat buf;
char prog[PATH_MAX];
int opt_d = 0;

int
main(int argc, char **argv)
{
	int ret = lvm_get_iop_version();
	char *cmd = strrchr(argv[0], '/');
	if (cmd == NULL) {
	    cmd = argv[0];
	} else {
	    cmd++;
	}

	if (ret < 0) {
		fprintf(stderr, "%s -- LVM driver/module not loaded?\n\n", cmd);
		exit(-1);
	}
        
	snprintf(prog, PATH_MAX, "%s/%d/%s", LVM_CMD_PREFIX, ret, cmd);

	if (stat(prog, &buf) < 0) {
		fprintf(stderr, "%s -- invalid i/o protocol version %d\n\n", cmd, ret);
		exit(-1);
	}

	execv(prog,argv);
}

  parent reply	other threads:[~2000-12-12  7:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-08 16:47 [linux-lvm] Linux 2.4.0-test12-pre7 LVM .9 vs .8final Ricardo Muggli
2000-12-11  6:44 ` Ulf Bartelt
2000-12-11 14:32   ` lewis
2000-12-12  9:06     ` Ulf Bartelt
2000-12-12  7:48   ` Luca Berra [this message]
2000-12-12 23:07     ` lewis
2000-12-13  7:36       ` Luca Berra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001212084807.A27177@colombina.comedia.it \
    --to=bluca@comedia.it \
    --cc=linux-lvm@sistina.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox