multipath-tools/libmpathpersist-example.c
Martin Wilck b3b5938ba0 Accepting request 539327 from home:mwilck:branches:Base:System
- added sample code for libmpathpersist (bsc#1066376)
  * added libmpathpersist-example.c
- multipath-tools.spec: package libmultipath.so symlink in -devel
  package (bsc#1066376). We *do not* package header files for
  libmultipath, as the APIs are not public.

OBS-URL: https://build.opensuse.org/request/show/539327
OBS-URL: https://build.opensuse.org/package/show/Base:System/multipath-tools?expand=0&rev=141
2017-11-06 15:16:39 +00:00

42 lines
834 B
C

/*
* This is a minimal skeleton for code using libmpathpersist.
* Compile with "-lmpathpersist -lmultipath -ludev".
*
* Header files for libmultipath are intentionally not included
* in the multipath-tools-devel package, because libmultipath has
* no well defined API for external programs at this time.
*/
#include <mpath_persist.h>
#include <libudev.h>
struct udev *udev;
/*
* logsink determines where libmultipath log messages go
* 1 - log to syslog only
* -1 - log to syslog and stderr
* 0 - log to syslog and stderr, with timestamps
*/
int logsink;
static struct config *conf;
struct config *get_multipath_config(void) {
return conf;
}
void put_multipath_config(struct config* c)
{
}
int main(void)
{
udev = udev_new();
conf = mpath_lib_init();
if(!conf) {
udev_unref(udev);
return 1;
}
return 0;
}