[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] Plugin inteface vs library



Le samedi 04 septembre 2010 à 14:30 +0200, Wouter Verhelst a écrit :
> Hi Laurent,

Hi Wouter,

> I noticed you've been working on a moving the working bits of nbd to a
> library. As you may have noticed, I've also been working on a dlopen()
> plugin interface for nbd-server.
> 
> Since both your and my work seem to have the same end goal (of allowing
> nbd to be embedded/used by external projects), I'd think it would make
> sense to coordinate here. Right?

I agree

> The goal of my plugin system is to write something where one could
> write a module that would implement just the things needed that differ
> from the regular nbd-server -- say, you'd implement an "open", "close",
> "read", and "write" function -- and have the server handle everything
> else -- multiple file support, copy-on-write, negotiating, etc. Or you
> could just implement an extra virtualization option, so that a client
> could get a different filename based on, say the phase of the moon. I
> dunno.
> 
> I would think that such things could be useful for what you're trying to
> do, as well; but since I don't know what your plans are, that requires
> me to guess. Can you comment on what your goals are?

My first goal is to make some code cleanup, as I think existing code is
hard to read (and understand). I think the best way to do that is to put
all the core code of NDB in a library (for moment it is an archive
libnbd.a) as it has already been done in qemu to write a server serving
all qemu disk images (qcow2, raw, ...) or to attach an NBD disk as an
emulated disk ("qemu -hda nbd:localhost"):

http://git.qemu.org/qemu.git/tree/nbd.c		(as could be the libnbd)
http://git.qemu.org/qemu.git/tree/qemu-nbd.c	(as could be the nbd-server)
http://git.qemu.org/qemu.git/tree/block/nbd.c	(as could be the nbd-client)

I'm not sure I understand how you are modifying nbd-server, but it seems
you are trying to add functionalities to it whereas I'm trying to remove
existing ones (to put them in a library)[1]. As it is two radically
different approaches, I think both of them can be implemented: plugins
allow nbd-server to read files like qemu-nbd does (qcow2, raw, ...)
whereas library allow programs like qemu to act like an nbd-server or an
nbd-client.

But if we focus only on code readability, IMHO, to have a library is a
good thing.

What is your opinion ?
I don't like to do useless work (nights are too short).

Regards,
Laurent

[1] Antoine de Saint Exupéry:
"La perfection est atteinte, non pas lorsqu'il n'y a plus rien à
ajouter, mais lorsqu'il n'y a plus rien à retirer."
"Perfection is achieved, not when there is nothing more to add, but when
there is nothing left to take away."
-- 
--------------------- laurent@...823... ----------------------
"Tout ce qui est impossible reste à accomplir"    Jules Verne
"Things are only impossible until they're not" Jean-Luc Picard





Reply to: