[packages/libvxhs] - new - added types patch to fix type and return value warnings (breaking build with -Werror) - adde

qboosh qboosh at pld-linux.org
Fri May 22 16:52:17 CEST 2020


commit e23868700b366a130da65f2fb54b197d9cea26e6
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri May 22 16:52:42 2020 +0200

    - new
    - added types patch to fix type and return value warnings (breaking build with -Werror)
    - added link patch to link libvxhs.so with openssl libs

 libvxhs-link.patch  |  29 +++++++++++++
 libvxhs-types.patch | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 libvxhs.spec        |  74 ++++++++++++++++++++++++++++++++
 3 files changed, 223 insertions(+)
---
diff --git a/libvxhs.spec b/libvxhs.spec
new file mode 100644
index 0000000..d78dd5b
--- /dev/null
+++ b/libvxhs.spec
@@ -0,0 +1,74 @@
+Summary:	The Veritas HyperScale storage connector library
+Summary(pl.UTF-8):	Biblioteka dostępu do danych w przestrzeni Veritas HyperScale
+Name:		libvxhs
+Version:	1.0
+%define	gitref	19255696d892a6d50dd39e803e791feedfdd6a07
+%define	snap	20170421
+%define	rel	1
+Release:	0.%{snap}.%{rel}
+License:	GPL v2+
+Group:		Libraries
+#Source0Download: https://github.com/VeritasHyperScale/libqnio/releases
+Source0:	https://github.com/VeritasHyperScale/libqnio/archive/%{gitref}/libqnio-%{snap}.tar.gz
+# Source0-md5:	16830e3c777a73d5d57a87f626c5a2dc
+Patch0:		%{name}-types.patch
+Patch1:		%{name}-link.patch
+URL:		https://github.com/VeritasHyperScale/libqnio
+BuildRequires:	openssl-devel
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+libvxhs is a storage connector library for accessing vdisks on Veritas
+HyperScale storage.
+
+%description -l pl.UTF-8
+libvxhs to biblioteka połączeniowa służąca do dostępu do dysków
+wirtualnych w przestrzeni Veritas HyperScale.
+
+%package devel
+Summary:	Header files for libvxhs library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki libvxhs
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for libvxhs library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libvxhs.
+
+%prep
+%setup -q -n libqnio-%{gitref}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%{__make} -C src \
+	CC="%{__cc}" \
+	LDFLAGS="%{rpmldflags}" \
+	OPTFLAGS="%{rpmcflags} -D_REENTRANT"
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C src install \
+	DESTDIR=$RPM_BUILD_ROOT \
+	LIBRARY=%{_libdir} \
+	TEST_TARGET_DIR=%{_bindir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc README.md
+%attr(755,root,root) %{_bindir}/qnio_client
+%attr(755,root,root) %{_bindir}/qnio_server
+%attr(755,root,root) %{_libdir}/libvxhs.so
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/qnio
diff --git a/libvxhs-link.patch b/libvxhs-link.patch
new file mode 100644
index 0000000..04f3ffa
--- /dev/null
+++ b/libvxhs-link.patch
@@ -0,0 +1,29 @@
+--- libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/Makefile.orig	2017-04-20 02:26:17.000000000 +0200
++++ libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/Makefile	2020-05-22 09:51:01.857777388 +0200
+@@ -8,7 +8,8 @@
+ CPPFLAGS     = -Iinclude
+ CFLAGS       = -fPIC -fno-strict-aliasing -Wall -Werror -g -pthread
+ DEPFLAGS     = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
+-LDFLAGS      = -shared
++LDFLAGS      = 
++SLDFLAGS     = $(LDFLAGS) -shared
+ DEBUGFLAGS   = -O0 -D_DEBUG -D_REENTRANT
+ RELEASEFLAGS = -03 -D_REENTRANT
+ HEADERS      = /usr/include/qnio
+@@ -44,13 +45,13 @@
+ 	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEV2) $(DEPFLAGS) $(OPTFLAGS) -c -o $@ $<
+ 
+ $(BASE_TARGET): $(BASE_OBJECTS)
+-	$(CC) $(FLAGS) $(CFLAGS) $(LDFLAGS) -o $(BASE_TARGET) $(BASE_OBJECTS)
++	$(CC) $(FLAGS) $(CFLAGS) $(SLDFLAGS) -o $(BASE_TARGET) $(BASE_OBJECTS) -lssl -lcrypto
+ 
+ $(TEST_TARGET): $(TEST_OBJECTS) $(BASE_TARGET)
+-	$(CC) $(FLAGS) $(CFLAGS) -o $(TEST_TARGET) $(TEST_OBJECTS) -L. -lvxhs -lssl -lcrypto
++	$(CC) $(FLAGS) $(CFLAGS) $(LDFLAGS) -o $(TEST_TARGET) $(TEST_OBJECTS) -L. -lvxhs -lssl -lcrypto
+ 
+ $(TEST_CLIENT_TARGET): $(TEST_CLIENT_OBJECTS) $(BASE_TARGET)
+-	$(CC) $(FLAGS) $(CFLAGS) -o $(TEST_CLIENT_TARGET) $(TEST_CLIENT_OBJECTS) -L. -lvxhs -lssl -lcrypto -lrt
++	$(CC) $(FLAGS) $(CFLAGS) $(LDFLAGS) -o $(TEST_CLIENT_TARGET) $(TEST_CLIENT_OBJECTS) -L. -lvxhs -lssl -lcrypto -lrt
+ 
+ clean:
+ 	\rm -f $(BASE_TARGET)
diff --git a/libvxhs-types.patch b/libvxhs-types.patch
new file mode 100644
index 0000000..0a0fdb9
--- /dev/null
+++ b/libvxhs-types.patch
@@ -0,0 +1,120 @@
+--- libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/nio_client.c.orig	2017-04-20 02:26:17.000000000 +0200
++++ libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/nio_client.c	2020-05-22 08:50:31.620777403 +0200
+@@ -537,7 +537,7 @@
+ send_on_connection(struct qnio_msg *msg, struct conn *c)
+ {
+     msg->ctx = c;
+-    msg->hinfo.cookie = (uint64_t) msg;
+-    msg->hinfo.crc = (unsigned char)((uint64_t) msg % CRC_MODULO);
++    msg->hinfo.cookie = (uint64_t)(uintptr_t) msg;
++    msg->hinfo.crc = (unsigned char)((uintptr_t) msg % CRC_MODULO);
+     nioDbg("Msg is born on client side msgid=%ld %p",msg->hinfo.cookie, msg);
+     if (ck_pr_load_int(&c->flags) & CONN_FLAG_DISCONNECTED) {
+--- libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/nio_core.c.orig	2017-04-20 02:26:17.000000000 +0200
++++ libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/nio_core.c	2020-05-22 09:05:07.942696626 +0200
+@@ -91,7 +91,7 @@
+     struct iovec resp;
+ 
+     rinfo = &conn->rinfo;
+-    msg = (struct qnio_msg *)rinfo->hinfo.cookie;
++    msg = (struct qnio_msg *)(uintptr_t)rinfo->hinfo.cookie;
+     nioDbg("Msg is recvd from wire on client side msgid=%ld", msg->hinfo.cookie);
+     LIST_DEL(&msg->lnode);
+     nioDbg("Msg removed from pending list msgid=%ld", msg->hinfo.cookie);
+@@ -149,13 +149,13 @@
+         return err;
+     }
+     if (conn->ctx->mode == QNIO_CLIENT_MODE) {
+-        msg = (struct qnio_msg *)hinfo->cookie;
++        msg = (struct qnio_msg *)(uintptr_t)hinfo->cookie;
+         if (msg->recv != NULL) {
+             rinfo->buf_source = BUF_SRC_USER;
+         } else {
+             nioDbg("Client side message, assigning default buffer");
+             aligned_size = ((hinfo->payload_size / BUF_ALIGN) + 1) * BUF_ALIGN;
+-            posix_memalign((void **)&rinfo->buf, BUF_ALIGN, aligned_size);
++            if (posix_memalign((void **)&rinfo->buf, BUF_ALIGN, aligned_size)) rinfo->buf = NULL; // FIXME: real error handling
+             rinfo->buf_source = BUF_SRC_MALLOC;
+         }
+     } else if (conn->ctx->mode == QNIO_SERVER_MODE) {
+@@ -166,7 +166,7 @@
+         } else {
+             nioDbg("Server side message, assigning default buffer");
+             aligned_size = ((hinfo->payload_size / BUF_ALIGN) + 1) * BUF_ALIGN;
+-            posix_memalign((void **)&rinfo->buf, BUF_ALIGN, aligned_size);
++            if (posix_memalign((void **)&rinfo->buf, BUF_ALIGN, aligned_size)) rinfo->buf = NULL; // FIXME: real error handling
+             rinfo->buf_source = BUF_SRC_MALLOC;
+         }
+     } else {
+--- libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/test/server.c.orig	2017-04-20 02:26:17.000000000 +0200
++++ libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/test/server.c	2020-05-22 09:06:50.795472758 +0200
+@@ -8,6 +8,7 @@
+  * GNU GPL, version 2 or (at your option) any later version.
+  */
+ 
++#include <inttypes.h>
+ #include <pthread.h>
+ #include <libgen.h>
+ #include "defs.h"
+@@ -64,7 +65,7 @@
+     fclose(backing_file);
+ 
+     if (verbose) {
+-        printf("read %ld bytes\n", n);
++        printf("read %zd bytes\n", n);
+     }
+ 
+     returnd->iov_len = size;
+@@ -117,7 +118,7 @@
+     fclose(backing_file);
+ 
+     if (verbose) {
+-        printf("wrote %ld bytes\n", n);
++        printf("wrote %zd bytes\n", n);
+     }
+ 
+     msg->hinfo.err = 0;
+@@ -146,7 +147,7 @@
+     int fd;
+ 
+     if (verbose) {
+-        printf("In server callback for msg #%ld\n", msg->hinfo.cookie);
++        printf("In server callback for msg #%"PRIu64"\n", msg->hinfo.cookie);
+     }
+ 
+     switch (opcode) {
+--- libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/slab.c.orig	2017-04-20 02:26:17.000000000 +0200
++++ libqnio-19255696d892a6d50dd39e803e791feedfdd6a07/src/lib/qnio/slab.c	2020-05-22 09:29:40.824717340 +0200
+@@ -31,7 +31,9 @@
+         if(fptr != NULL)
+             entry = fptr(NULL);
+         else if(alignment != 0)
+-            posix_memalign(&entry, alignment, alloc_size);
++	{
++            if(posix_memalign(&entry, alignment, alloc_size)) entry = NULL; // FIXME: real error handling
++	}
+         else
+             entry = malloc(alloc_size);
+         node = (fifo_node_t *) malloc(sizeof(fifo_node_t));
+@@ -67,7 +69,9 @@
+         if(slab->init_fptr != NULL)
+             entry = slab->init_fptr(NULL);
+         else if(slab->alignment != 0)
+-            posix_memalign(&entry, slab->alignment, slab->alloc_size);
++	{
++            if(posix_memalign(&entry, slab->alignment, slab->alloc_size)) entry = NULL; // FIXME: real error handling
++	}
+         else
+             entry = malloc(slab->alloc_size);
+         node = (fifo_node_t *) malloc(sizeof(fifo_node_t));
+@@ -101,7 +105,9 @@
+     else
+     {
+         if(slab->alignment != 0)
+-            posix_memalign(&entry, slab->alignment, slab->alloc_size);
++	{
++            if(posix_memalign(&entry, slab->alignment, slab->alloc_size)) entry = NULL; // FIXME: real error handling
++	}
+         else
+             entry = malloc(slab->alloc_size);
+         node = (fifo_node_t *) malloc(sizeof(fifo_node_t));
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libvxhs.git/commitdiff/e23868700b366a130da65f2fb54b197d9cea26e6



More information about the pld-cvs-commit mailing list