Accepting request 539332 from 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. (forwarded request 539327 from mwilck) OBS-URL: https://build.opensuse.org/request/show/539332 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/multipath-tools?expand=0&rev=94
This commit is contained in:
commit
0cf34e3d0e
41
libmpathpersist-example.c
Normal file
41
libmpathpersist-example.c
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Nov 6 14:46:03 UTC 2017 - mwilck@suse.com
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Nov 3 09:57:57 UTC 2017 - mwilck@suse.com
|
Fri Nov 3 09:57:57 UTC 2017 - mwilck@suse.com
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ Source1: multipath.conf
|
|||||||
Source2: dont-del-part-nodes.rules
|
Source2: dont-del-part-nodes.rules
|
||||||
# Dracut conf file to make sure 11-dm-parts.rules is included in initrd
|
# Dracut conf file to make sure 11-dm-parts.rules is included in initrd
|
||||||
Source3: dm-parts.conf
|
Source3: dm-parts.conf
|
||||||
|
Source4: libmpathpersist-example.c
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
%{?systemd_requires}
|
%{?systemd_requires}
|
||||||
BuildRequires: device-mapper-devel
|
BuildRequires: device-mapper-devel
|
||||||
@ -201,6 +202,7 @@ This package provides development files and documentation for libdmmp.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n multipath-tools-%{version}
|
%setup -q -n multipath-tools-%{version}
|
||||||
|
cp %{SOURCE4} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
[ -n "$SOURCE_DATE_EPOCH" ] && export KBUILD_BUILD_TIMESTAMP=@$SOURCE_DATE_EPOCH
|
[ -n "$SOURCE_DATE_EPOCH" ] && export KBUILD_BUILD_TIMESTAMP=@$SOURCE_DATE_EPOCH
|
||||||
@ -209,7 +211,6 @@ make CC="%__cc" OPTFLAGS="%{optflags}" %{dirflags} %{makeflags}
|
|||||||
%install
|
%install
|
||||||
make DESTDIR=%{buildroot} %{dirflags} %{makeflags} install
|
make DESTDIR=%{buildroot} %{dirflags} %{makeflags} install
|
||||||
mkdir -p %{buildroot}/var/cache/multipath/
|
mkdir -p %{buildroot}/var/cache/multipath/
|
||||||
rm %{buildroot}/%_lib/libmultipath.so
|
|
||||||
mkdir -p %{buildroot}/usr/sbin
|
mkdir -p %{buildroot}/usr/sbin
|
||||||
ln -sf /usr/sbin/service %{buildroot}/usr/sbin/rcmultipathd
|
ln -sf /usr/sbin/service %{buildroot}/usr/sbin/rcmultipathd
|
||||||
mkdir -p %{buildroot}/usr/lib/modules-load.d
|
mkdir -p %{buildroot}/usr/lib/modules-load.d
|
||||||
@ -275,11 +276,13 @@ exit 0
|
|||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
|
/%{_lib}/libmultipath.so
|
||||||
/%{_lib}/libmpathcmd.so
|
/%{_lib}/libmpathcmd.so
|
||||||
/%{_lib}/libmpathpersist.so
|
/%{_lib}/libmpathpersist.so
|
||||||
/usr/include/mpath_cmd.h
|
/usr/include/mpath_cmd.h
|
||||||
/usr/include/mpath_persist.h
|
/usr/include/mpath_persist.h
|
||||||
%{_mandir}/man3/mpath_persistent_*
|
%{_mandir}/man3/mpath_persistent_*
|
||||||
|
%doc libmpathpersist-example.c
|
||||||
|
|
||||||
%files -n kpartx
|
%files -n kpartx
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user