I think I understand now that libnbdkit.so won't break the ABI for
existing plugins.  Does it require that plugins for newer nbdkit use
-lnbdkit (which would be a source API break) or would it still be
possible to compile without this?  I guess as long as plugins do not
start using -no-undefined then it would still work, so it wouldn't be
a source API break.

I had a look into how we might implement libnbdkit.so.  Some functions
are obviously self-contained (eg. nbdkit_parse_*, nbdkit_realpath,
nbdkit_debug, nbdkit_error, nbdkit_*extents).

Unfortunately some functions depend themselves on internals
of the server:

 * nbdkit_nanosleep, nbdkit_export_name, nbdkit_peer_name call
 * nbdkit_set_error calls threadlocal_set_error
 * nbdkit_shutdown must set the quit global (or call a server function)

I guess we can deal with the first ones by moving threadlocal.c into
the same library, although it's a bit awkward.  The quit flag is still
more awkward because you have to move a lot of quit pipe handling code
into the library which has knock-on effects all over.



server/debug.c:nbdkit_vdebug (const char *fs, va_list args)
server/debug.c:nbdkit_debug (const char *fs, ...)
server/extents.c:nbdkit_extents_new (uint64_t start, uint64_t end)
server/extents.c:nbdkit_extents_free (struct nbdkit_extents *exts)
server/extents.c:nbdkit_extents_count (const struct nbdkit_extents *exts)
server/extents.c:nbdkit_get_extent (const struct nbdkit_extents *exts, size_t i)
server/extents.c:nbdkit_add_extent (struct nbdkit_extents *exts,
server/log.c:nbdkit_verror (const char *fs, va_list args)
server/log.c:nbdkit_error (const char *fs, ...)
server/log.c:nbdkit_vfprintf(FILE *f, const char *fmt, va_list args)
server/plugins.c:nbdkit_set_error (int err)
server/public.c:nbdkit_absolute_path (const char *path)
server/public.c:nbdkit_realpath (const char *path)
server/public.c:nbdkit_parse_int (const char *what, const char *str, int *rp)
server/public.c:nbdkit_parse_int8_t (const char *what, const char *str, int8_t 
server/public.c:nbdkit_parse_int16_t (const char *what, const char *str, 
int16_t *rp)
server/public.c:nbdkit_parse_int32_t (const char *what, const char *str, 
int32_t *rp)
server/public.c:nbdkit_parse_int64_t (const char *what, const char *str, 
int64_t *rp)
server/public.c:nbdkit_parse_unsigned (const char *what, const char *str, 
unsigned *rp)
server/public.c:nbdkit_parse_uint8_t (const char *what, const char *str, 
uint8_t *rp)
server/public.c:nbdkit_parse_uint16_t (const char *what, const char *str, 
uint16_t *rp)
server/public.c:nbdkit_parse_uint32_t (const char *what, const char *str, 
uint32_t *rp)
server/public.c:nbdkit_parse_uint64_t (const char *what, const char *str, 
uint64_t *rp)
server/public.c:nbdkit_parse_size (const char *str)
server/public.c:nbdkit_parse_bool (const char *str)
server/public.c:nbdkit_read_password (const char *value, char **password)
server/public.c:nbdkit_nanosleep (unsigned sec, unsigned nsec)
server/public.c:nbdkit_export_name (void)
server/public.c:nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen)
server/quit.c:nbdkit_shutdown (void)

Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

Libguestfs mailing list

Reply via email to