public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH rdma-core 3/5] ccan: Add list functionality
Date: Wed, 28 Sep 2016 10:53:37 -0600	[thread overview]
Message-ID: <20160928165337.GB22668@obsidianresearch.com> (raw)
In-Reply-To: <1475076789-14359-4-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

On Wed, Sep 28, 2016 at 06:33:07PM +0300, Yishai Hadas wrote:
> @@ -2,4 +2,9 @@ publish_internal_headers(ccan
>    minmax.h
>    build_assert.h
>    config.h
> +  list.h
> +  str.h
> +  str_debug.h
> +  check_type.h
> +  container_of.h
>    )

Sorted too..

Should you include the .c files as well? Otherwise it looks like the
debug features do not work. Can't think of a reason not to include
them.

(see below)
.. and add any missing COPYING/LICENSE files.

> +#ifndef container_of
> +#define container_of(member_ptr, containing_type, member)		\
> +	 ((containing_type *)						\
> +	  ((char *)(member_ptr)						\
> +	   - container_off(containing_type, member))			\
> +	  + check_types_match(*(member_ptr), ((containing_type *)0)->member))
> +#endif

I wonder if we could figure out a way to avoid conflicting with the
version in verbs.h? This version is better as it has the
check_types_match.. For later..

Jason

diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index ea53f382553f..5a1041f304e6 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -6,6 +6,9 @@
 # Global list of pairs of (SHARED STATIC) libary target names
 set(RDMA_STATIC_LIBS "" CACHE INTERNAL "Doc" FORCE)
 
+set(COMMON_LIBS_PIC ccan_pic)
+set(COMMON_LIBS ccan)
+
 # Install a symlink during 'make install'
 function(rdma_install_symlink LINK_CONTENT DEST)
   # Create a link in the build tree with the right content
@@ -59,6 +62,7 @@ function(rdma_library DEST VERSION_SCRIPT SOVERSION VERSION)
   # Create a shared library
   add_library(${DEST} SHARED ${ARGN})
   rdma_set_library_map(${DEST} ${VERSION_SCRIPT})
+  target_link_libraries(${DEST} LINK_PRIVATE ${COMMON_LIBS_PIC})
   set_target_properties(${DEST} PROPERTIES
     SOVERSION ${SOVERSION}
     VERSION ${VERSION}
@@ -98,6 +102,7 @@ function(rdma_provider DEST)
   # Even though these are modules we still want to use Wl,--no-undefined
   set_target_properties(${DEST} PROPERTIES LINK_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
   rdma_set_library_map(${DEST} ${BUILDLIB}/provider.map)
+  target_link_libraries(${DEST} LINK_PRIVATE ${COMMON_LIBS_PIC})
   target_link_libraries(${DEST} LINK_PRIVATE ibverbs)
   target_link_libraries(${DEST} LINK_PRIVATE ${CMAKE_THREAD_LIBS_INIT})
   set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
@@ -110,6 +115,7 @@ endfunction()
  # Create an installed executable
 function(rdma_executable EXEC)
   add_executable(${EXEC} ${ARGN})
+  target_link_libraries(${EXEC} LINK_PRIVATE ${COMMON_LIBS})
   set_target_properties(${EXEC} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_BIN}")
   install(TARGETS ${EXEC} DESTINATION "${CMAKE_INSTALL_BINDIR}")
 endfunction()
@@ -117,6 +123,7 @@ endfunction()
  # Create an installed executable (under sbin)
 function(rdma_sbin_executable EXEC)
   add_executable(${EXEC} ${ARGN})
+  target_link_libraries(${EXEC} LINK_PRIVATE ${COMMON_LIBS})
   set_target_properties(${EXEC} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_BIN}")
   install(TARGETS ${EXEC} DESTINATION "${CMAKE_INSTALL_SBINDIR}")
 endfunction()
@@ -124,6 +131,7 @@ endfunction()
 # Create an test executable (not-installed)
 function(rdma_test_executable EXEC)
   add_executable(${EXEC} ${ARGN})
+  target_link_libraries(${EXEC} LINK_PRIVATE ${COMMON_LIBS})
   set_target_properties(${EXEC} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${BUILD_BIN}")
 endfunction()
 
diff --git a/ccan/CMakeLists.txt b/ccan/CMakeLists.txt
index 70b54306bdaa..778c85130ff9 100644
--- a/ccan/CMakeLists.txt
+++ b/ccan/CMakeLists.txt
@@ -8,3 +8,10 @@ publish_internal_headers(ccan
   check_type.h
   container_of.h
   )
+
+set(C_FILES
+  str.c
+  )
+add_library(ccan STATIC ${C_FILES})
+add_library(ccan_pic STATIC ${C_FILES})
+set_property(TARGET ccan_pic PROPERTY POSITION_INDEPENDENT_CODE TRUE)
diff --git a/ibacm/CMakeLists.txt b/ibacm/CMakeLists.txt
index 8887c13af463..a09b7f789800 100644
--- a/ibacm/CMakeLists.txt
+++ b/ibacm/CMakeLists.txt
@@ -18,7 +18,7 @@ rdma_sbin_executable(ibacm
   src/acm.c
   src/acm_util.c
   )
-target_link_libraries(ibacm
+target_link_libraries(ibacm LINK_PRIVATE
   ibverbs
   ibumad
   ${CMAKE_THREAD_LIBS_INIT}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-09-28 16:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-28 15:33 [PATCH rdma-core 0/5] Licensing and cleanup issues Yishai Hadas
     [not found] ` <1475076789-14359-1-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-28 15:33   ` [PATCH rdma-core 1/5] Remove container_of and offset local declarations Yishai Hadas
2016-09-28 15:33   ` [PATCH rdma-core 2/5] ccan: Add CCAN min and max functionality Yishai Hadas
     [not found]     ` <1475076789-14359-3-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-28 16:18       ` Jason Gunthorpe
2016-09-28 15:33   ` [PATCH rdma-core 3/5] ccan: Add list functionality Yishai Hadas
     [not found]     ` <1475076789-14359-4-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-28 16:53       ` Jason Gunthorpe [this message]
2016-09-28 15:33   ` [PATCH rdma-core 4/5] libmlx5: Move to use CCAN " Yishai Hadas
2016-09-28 15:33   ` [PATCH rdma-core 5/5] libocrdma: " Yishai Hadas
     [not found]     ` <1475076789-14359-6-git-send-email-yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2016-09-29  3:02       ` Devesh Sharma
2016-09-28 16:03   ` [PATCH rdma-core 0/5] Licensing and cleanup issues Doug Ledford
2016-09-28 17:26   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160928165337.GB22668@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox