* [PATCH 01/13] Be consistent about defining NDEBUG
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-09-23 19:16 ` Jason Gunthorpe
2016-09-23 19:16 ` [PATCH 02/13] Switch valgrind memcheck.h to on by default Jason Gunthorpe
` (12 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
We setup the two standard CMake build_types so that Release includes
NDEBUG and RelWithDebInfo does not (by default CMake sets it in both).
The recommendation is for packagers to use Release (by setting
-DCMAKE_BUILD_TYPE=Release) and developers use RelWithDebInfo
(the default)
This also replaces the default flags for Release with the RelWithDebInfo,
flags (-O2 -g -DNDEBUG) which is what we consider suitable for packaging.
The CMake default of -O3 is not tested.
Note that all the packaging systems I looked at force NDEBUG into the
CFLAGS.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 5 +++++
buildlib/RDMA_BuildType.cmake | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+)
create mode 100644 buildlib/RDMA_BuildType.cmake
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a829cd477c52..06dd98203349 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,9 @@
# Common options passed to cmake are:
# -DCMAKE_EXPORT_COMPILE_COMMANDS=1
# Write a compile_commands.json file for clang tooling
+# -DCMAKE_BUILD_TYPE=RelWithDebInfo
+# Change the optimization level, Debug disables optimization,
+# Release is for packagers
# -DENABLE_VALGRIND=1 (default disabled)
# Embed valgrind notations, this has a tiny negative performance impact
# -DENABLE_RESOLVE_NEIGH=0 (default enabled)
@@ -58,12 +61,14 @@ include(CheckCCompilerFlag)
include(CheckIncludeFile)
include(CheckTypeSize)
include(RDMA_EnableCStd)
+include(RDMA_BuildType)
include(RDMA_DoFixup)
include(publish_headers)
include(rdma_functions)
#-------------------------
# Setup the basic C compiler
+RDMA_BuildType()
include_directories(${BUILD_INCLUDE})
# FIXME: Eliminate HAVE_CONFIG_H, we always have it.
add_definitions(-DHAVE_CONFIG_H)
diff --git a/buildlib/RDMA_BuildType.cmake b/buildlib/RDMA_BuildType.cmake
new file mode 100644
index 000000000000..4f7485c397a0
--- /dev/null
+++ b/buildlib/RDMA_BuildType.cmake
@@ -0,0 +1,41 @@
+# COPYRIGHT (c) 2015 Obsidian Research Corporation. See COPYING file
+
+function(RDMA_BuildType)
+ set(build_types Debug Release RelWithDebInfo MinSizeRel)
+
+ # Set the default build type to RelWithDebInfo. Since RDMA is typically used
+ # in performance contexts it doesn't make much sense to have the default build
+ # turn off the optimizer.
+ if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE String
+ "Options are ${build_types}"
+ FORCE
+ )
+ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${build_types})
+ endif()
+
+ # Release should be used by packagers, it is the same as the default RelWithDebInfo,
+ # this means it uses -O2 and -DNDEBUG (not -O3)
+ foreach (language CXX C)
+ set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELEASE")
+ if ("${${VAR_TO_MODIFY}}" STREQUAL "${${VAR_TO_MODIFY}_INIT}")
+ set(${VAR_TO_MODIFY} "${CMAKE_${language}_FLAGS_RELWITHDEBINFO_INIT}"
+ CACHE STRING "Default flags for Release configuration" FORCE)
+ endif()
+ endforeach()
+
+ # RelWithDebInfo should be used by developers, it is the same as Release but
+ # with the -DNDEBUG removed
+ foreach (language CXX C)
+ set(VAR_TO_MODIFY "CMAKE_${language}_FLAGS_RELWITHDEBINFO")
+ if (${${VAR_TO_MODIFY}} STREQUAL ${${VAR_TO_MODIFY}_INIT})
+ string(REGEX REPLACE "(^| )[/-]D *NDEBUG($| )"
+ " "
+ replacement
+ "${${VAR_TO_MODIFY}}"
+ )
+ set(${VAR_TO_MODIFY} "${replacement}"
+ CACHE STRING "Default flags for RelWithDebInfo configuration" FORCE)
+ endif()
+ endforeach()
+endfunction()
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 02/13] Switch valgrind memcheck.h to on by default
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-23 19:16 ` [PATCH 01/13] Be consistent about defining NDEBUG Jason Gunthorpe
@ 2016-09-23 19:16 ` Jason Gunthorpe
2016-09-23 19:16 ` [PATCH 03/13] Do not produce libtool .la files Jason Gunthorpe
` (11 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
We now recommend that this source be built with valgrind memcheck.h
present, so use it automatically if it is available. Users looking
to remove this tiny overhead can build with -DENABLE_VALGRIND=0
Downstream packagers should ensure the build is done with valgrind
headers available.
NOTE: Fedora/CentOS have shipped with valgrind turn on in their
packaging, so for most users this is no change.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06dd98203349..be82c2896d75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,8 +10,8 @@
# -DCMAKE_BUILD_TYPE=RelWithDebInfo
# Change the optimization level, Debug disables optimization,
# Release is for packagers
-# -DENABLE_VALGRIND=1 (default disabled)
-# Embed valgrind notations, this has a tiny negative performance impact
+# -DENABLE_VALGRIND=0 (default enabled)
+# Disable valgrind notations, this has a tiny positive performance impact
# -DENABLE_RESOLVE_NEIGH=0 (default enabled)
# Do not link to libnl and do not resolve neighbours internally for Ethernet,
# and do not build iwpmd.
@@ -189,9 +189,11 @@ RDMA_DoFixup("${HAVE_RDMA_USER_RXE}" "rdma/rdma_user_rxe.h")
#-------------------------
# Apply fixups
-# FIXME: We should probably always enable memcheck.h, and only selectively
-# turn it off in the real high performance paths. There is no reason umad
-# should ever have memcheck disabled for instance.
+# We prefer to build with valgrind memcheck.h present, but if not, or the user
+# requested valgrind disabled, then replace it with our dummy stub.
+if (NOT DEFINED ENABLE_VALGRIND)
+ set(ENABLE_VALGRIND "ON" CACHE BOOL "Enable use of valgrind annotations")
+endif()
if (ENABLE_VALGRIND)
CHECK_INCLUDE_FILE("valgrind/memcheck.h" HAVE_VALGRIND_MEMCHECK)
CHECK_INCLUDE_FILE("valgrind/drd.h" HAVE_VALGRIND_DRD)
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 03/13] Do not produce libtool .la files
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-23 19:16 ` [PATCH 01/13] Be consistent about defining NDEBUG Jason Gunthorpe
2016-09-23 19:16 ` [PATCH 02/13] Switch valgrind memcheck.h to on by default Jason Gunthorpe
@ 2016-09-23 19:16 ` Jason Gunthorpe
2016-09-23 19:16 ` [PATCH 04/13] Do not produce static libraries by default Jason Gunthorpe
` (10 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
These were preserved as part of the cmake transition, but no distributor
uses them and we don't need them internally, so time for them to go.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
buildlib/rdma_functions.cmake | 99 -------------------------------------------
1 file changed, 99 deletions(-)
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index ea53f382553f..8fe8828c0e84 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -151,103 +151,6 @@ function(rdma_alias_man_pages)
endforeach()
endfunction()
-# For compatability write out a libtool .la file. This is only meaningful if
-# the end user is statically linking, and only if the library has dependent
-# libraries.
-
-# FIXME: it isn't clear how this is actually useful for provider libraries and
-# libibverbs itself, the user must do some trick to get the constructor to run
-# in the provider, at least how to do that should be documented someplace..
-function(rdma_make_libtool_la SHARED STATIC LIBS)
- get_property(LIB TARGET ${STATIC} PROPERTY OUTPUT_NAME SET)
- if (LIB)
- get_target_property(LIB ${STATIC} OUTPUT_NAME)
- else()
- set(LIB ${STATIC})
- endif()
-
- set(BARE_LAFN "${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}.la")
- set(BARE_LIBFN "${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}")
-
- get_property(SOLIB TARGET ${SHARED} PROPERTY OUTPUT_NAME SET)
- if (SOLIB)
- get_target_property(SOLIB ${SHARED} OUTPUT_NAME)
- else()
- set(SOLIB ${SHARED})
- endif()
-
- set(DLNAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SOLIB}${CMAKE_SHARED_LIBRARY_SUFFIX}")
- get_property(TMP TARGET ${SHARED} PROPERTY SOVERSION SET)
- if (TMP)
- get_target_property(VERSION ${SHARED} VERSION)
- get_target_property(SOVERSION ${SHARED} SOVERSION)
- set(NAMES "${DLNAME}.${VERSION} ${DLNAME}.${SOVERSION} ${DLNAME}")
- set(DLNAME "${DLNAME}.${SOVERSION}")
- else()
- set(NAMES "${DLNAME}")
- set(DLNAME "${CMAKE_SHARED_LIBRARY_PREFIX}${SOLIB}${CMAKE_SHARED_LIBRARY_SUFFIX}")
- endif()
-
- if (LIBS)
- list(REMOVE_DUPLICATES LIBS)
- foreach(I ${LIBS})
- if (I MATCHES "^-l")
- list(APPEND DEPS "${I}")
- else()
- list(APPEND DEPS "-l${I}")
- endif()
- endforeach()
- string(REPLACE ";" " " DEPS "${DEPS}")
- endif()
-
- set(LAFN "${BUILD_LIB}/${BARE_LAFN}")
- file(WRITE ${LAFN}
- "# ${BARE_LAFN} - a libtool library file\n"
- "# Generated by cmake\n"
- "#\n"
- "# Please DO NOT delete this file!\n"
- "# It is necessary for linking the library.\n"
- "\n"
- "# The name that we can dlopen(3).\n"
- "dlname='${DLNAME}'\n"
- "\n"
- "# Names of this library.\n"
- "library_names='${NAMES}'\n"
- "\n"
- "# The name of the static archive.\n"
- "old_library='${BARE_LIBFN}'\n"
- "\n"
- "# Linker flags that can not go in dependency_libs.\n"
- "inherited_linker_flags=''\n"
- "\n"
- "# Libraries that this one depends upon.\n"
- "dependency_libs='${DEPS}'\n"
- "\n"
- "# Names of additional weak libraries provided by this library\n"
- "weak_library_names=''\n"
- "\n"
- "# Version information for ${CMAKE_STATIC_LIBRARY_PREFIX}${LIB}.\n"
- # We don't try very hard to emulate this, it isn't used for static linking anyhow
- "current=${SOVERSION}\n"
- "age=0\n"
- "revision=0\n"
- "\n"
- "# Is this an already installed library?\n"
- "installed=yes\n"
- "\n"
- "# Should we warn about portability when linking against -modules?\n"
- "shouldnotlink=no\n"
- "\n"
- "# Files to dlopen/dlpreopen\n"
- "dlopen=''\n"
- "dlpreopen=''\n"
- "\n"
- "# Directory that this library needs to be installed in:\n"
- "libdir='${CMAKE_INSTALL_FULL_LIBDIR}'\n"
- )
- install(FILES ${LAFN} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-endfunction()
-
# Finalize the setup of the static libraries by copying the meta information
# from the shared and setting up the libtool .la files.
function(rdma_finalize_libs)
@@ -274,7 +177,5 @@ function(rdma_finalize_libs)
set_target_properties(${STATIC} PROPERTIES LINK_LIBRARIES "${TMP}")
list(APPEND LIBS "${TMP}")
endif()
-
- rdma_make_libtool_la(${SHARED} ${STATIC} "${LIBS}")
endforeach()
endfunction()
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 04/13] Do not produce static libraries by default
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (2 preceding siblings ...)
2016-09-23 19:16 ` [PATCH 03/13] Do not produce libtool .la files Jason Gunthorpe
@ 2016-09-23 19:16 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 05/13] Have cmake run man pages through text substitution Jason Gunthorpe
` (9 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:16 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
We no longer recommend that static libraries are distributed, this
never worked sanely for libibverbs.
Use:
cmake -DENABLE_STATIC=1
To restore the old behaviour
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 6 ++++++
buildlib/rdma_functions.cmake | 34 +++++++++++++++++++++-------------
2 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be82c2896d75..9b9e34e5cd9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,8 @@
# -DENABLE_RESOLVE_NEIGH=0 (default enabled)
# Do not link to libnl and do not resolve neighbours internally for Ethernet,
# and do not build iwpmd.
+# -DENABLE_STATIC=1 (default disabled)
+# Produce static libraries along with the usual shared libraries.
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
project(RDMA C)
@@ -66,6 +68,10 @@ include(RDMA_DoFixup)
include(publish_headers)
include(rdma_functions)
+if (NOT DEFINED ENABLE_STATIC)
+ set(ENABLE_STATIC "OFF" CACHE BOOL "Produce static linking libraries as well as shared libraries.")
+endif()
+
#-------------------------
# Setup the basic C compiler
RDMA_BuildType()
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index 8fe8828c0e84..a4ecd7d4f2fe 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -47,14 +47,16 @@ endfunction()
# Basic function to produce a standard libary with a GNU LD version script.
function(rdma_library DEST VERSION_SCRIPT SOVERSION VERSION)
# Create a static library
- add_library(${DEST}-static STATIC ${ARGN})
- set_target_properties(${DEST}-static PROPERTIES
- OUTPUT_NAME ${DEST}
- LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
- install(TARGETS ${DEST}-static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
-
- list(APPEND RDMA_STATIC_LIBS ${DEST} ${DEST}-static)
- set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+ if (ENABLE_STATIC)
+ add_library(${DEST}-static STATIC ${ARGN})
+ set_target_properties(${DEST}-static PROPERTIES
+ OUTPUT_NAME ${DEST}
+ LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
+ install(TARGETS ${DEST}-static DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+
+ list(APPEND RDMA_STATIC_LIBS ${DEST} ${DEST}-static)
+ set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+ endif()
# Create a shared library
add_library(${DEST} SHARED ${ARGN})
@@ -85,12 +87,14 @@ function(rdma_provider DEST)
# FIXME: This is probably pointless, the provider library has no symbols so
# what good is it? Presumably it should be used with -Wl,--whole-archive,
# but we don't have any directions on how to make static linking work..
- add_library(${DEST} STATIC ${ARGN})
- set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
- install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ if (ENABLE_STATIC)
+ add_library(${DEST} STATIC ${ARGN})
+ set_target_properties(${DEST} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${BUILD_LIB}")
+ install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
- list(APPEND RDMA_STATIC_LIBS ${DEST}-rdmav2 ${DEST})
- set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+ list(APPEND RDMA_STATIC_LIBS ${DEST}-rdmav2 ${DEST})
+ set(RDMA_STATIC_LIBS "${RDMA_STATIC_LIBS}" CACHE INTERNAL "")
+ endif()
# Create the plugin shared library
set(DEST ${DEST}-rdmav2)
@@ -155,6 +159,10 @@ endfunction()
# from the shared and setting up the libtool .la files.
function(rdma_finalize_libs)
list(LENGTH RDMA_STATIC_LIBS LEN)
+ if (LEN LESS 2)
+ return()
+ endif()
+
math(EXPR LEN ${LEN}-1)
foreach(I RANGE 0 ${LEN} 2)
list(GET RDMA_STATIC_LIBS ${I} SHARED)
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 05/13] Have cmake run man pages through text substitution
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (3 preceding siblings ...)
2016-09-23 19:16 ` [PATCH 04/13] Do not produce static libraries by default Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
[not found] ` <1474658228-5390-6-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-23 19:17 ` [PATCH 06/13] Consolidate definitions for paths into config.h Jason Gunthorpe
` (8 subsequent siblings)
13 siblings, 1 reply; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Sean Hefty
rsocket.7 had an errant text substitution that never worked, it is
a good idea to have the man pages use the correct paths, so let
us have cmake run them through.
Any man page ending in '.in' will be substituted automatically.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
buildlib/rdma_functions.cmake | 13 +++++++++++--
librdmacm/man/CMakeLists.txt | 2 +-
librdmacm/man/{rsocket.7 => rsocket.7.in} | 4 ++--
3 files changed, 14 insertions(+), 5 deletions(-)
rename librdmacm/man/{rsocket.7 => rsocket.7.in} (97%)
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index a4ecd7d4f2fe..260dd18d78df 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -135,8 +135,17 @@ endfunction()
# filename
function(rdma_man_pages)
foreach(I ${ARGN})
- string(REGEX REPLACE "^.+[.](.+)$" "\\1" MAN_SECT ${I})
- install(FILES ${I} DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/")
+ if ("${I}" MATCHES "\\.in$")
+ string(REGEX REPLACE "^.+[.](.+)\\.in$" "\\1" MAN_SECT "${I}")
+ string(REGEX REPLACE "^(.+)\\.in$" "\\1" BASE_NAME "${I}")
+ get_filename_component(BASE_NAME "${BASE_NAME}" NAME)
+ rdma_subst_install(FILES "${I}"
+ DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/"
+ RENAME "${BASE_NAME}")
+ else()
+ string(REGEX REPLACE "^.+[.](.+)$" "\\1" MAN_SECT "${I}")
+ install(FILES "${I}" DESTINATION "${CMAKE_INSTALL_MANDIR}/man${MAN_SECT}/")
+ endif()
endforeach()
endfunction()
diff --git a/librdmacm/man/CMakeLists.txt b/librdmacm/man/CMakeLists.txt
index 791c98265ad0..d6cc106751a4 100644
--- a/librdmacm/man/CMakeLists.txt
+++ b/librdmacm/man/CMakeLists.txt
@@ -58,7 +58,7 @@ rdma_man_pages(
riostream.1
rping.1
# FIXME: rsocket has a text substitution but nothing ever filled it in.
- rsocket.7
+ rsocket.7.in
rstream.1
ucmatose.1
udaddy.1
diff --git a/librdmacm/man/rsocket.7 b/librdmacm/man/rsocket.7.in
similarity index 97%
rename from librdmacm/man/rsocket.7
rename to librdmacm/man/rsocket.7.in
index dfb9804d849a..6adf156f4062 100644
--- a/librdmacm/man/rsocket.7
+++ b/librdmacm/man/rsocket.7.in
@@ -129,7 +129,7 @@ fork off a process to handle the new connection.
.P
rsockets uses configuration files that give an administrator control
over the default settings used by rsockets. Use files under
-%sysconfig%/rdma/rsocket as shown:
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket as shown:
.P
.P
mem_default - default size of receive buffer(s)
@@ -149,7 +149,7 @@ polling_time - default number of microseconds to poll for data before waiting
All configuration files should contain a single integer value. Values may
be set by issuing a command similar to the following example.
.P
-echo 1000000 > /etc/rdma/rsocket/mem_default
+echo 1000000 > @CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket/mem_default
.P
If configuration files are not available, rsockets uses internal defaults.
Applications can override default values programmatically through the
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 06/13] Consolidate definitions for paths into config.h
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (4 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 05/13] Have cmake run man pages through text substitution Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
[not found] ` <1474658228-5390-7-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-23 19:17 ` [PATCH 07/13] Pass ancillary files that use paths through cmake substitution Jason Gunthorpe
` (7 subsequent siblings)
13 siblings, 1 reply; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Sean Hefty, Tatyana Nikolova, Bart Van Assche
config.h is the only place we pass through cmake substitution,
so it is the only place that can define the various filesystem
paths.
This patch handles the C code portions that use paths.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 10 ++++++++++
buildlib/config.h.in | 13 +++++++++++--
ibacm/CMakeLists.txt | 5 -----
ibacm/linux/osd.h | 2 +-
ibacm/src/acm.c | 6 +++---
ibacm/src/acme.c | 10 +++++-----
ibacm/src/libacm.c | 2 +-
iwpmd/src/iwarp_pm.h | 1 -
iwpmd/src/iwarp_pm_server.c | 1 +
librdmacm/src/acm.c | 2 +-
librdmacm/src/cma.h | 9 ---------
srp_daemon/srp_daemon/srp_daemon.c | 4 ++--
12 files changed, 35 insertions(+), 30 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9b9e34e5cd9d..713788f188e3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,16 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd"
set(ACM_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/ibacm"
CACHE PATH "Location for ibacm provider plugin shared library files.")
+# Allow the 'run' dir to be configurable, this historically has been /var/run, but
+# some systems now use /run/
+set(CMAKE_INSTALL_RUNDIR "var/run"
+ CACHE PATH "Location for runtime information, typically /var/run, or /run")
+if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_RUNDIR})
+ set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_RUNDIR}")
+else()
+ set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_RUNDIR}")
+endif()
+
#-------------------------
# Load CMake components
set(BUILDLIB "${CMAKE_SOURCE_DIR}/buildlib")
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 984d51bfaa09..bbc279d3c9c3 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -17,9 +17,18 @@
#define HAVE_VALGRIND_MEMCHECK_H 1
#define INCLUDE_VALGRIND 1
-#define SYSCONFDIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@"
-
#define IBV_CONFIG_DIR "@CONFIG_DIR@"
+#define RS_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket"
+#define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf"
+
+#define SRP_DEAMON_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf"
+
+#define ACM_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma"
+#define IBACM_LIB_PATH "@ACM_PROVIDER_DIR@"
+#define IBACM_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@"
+#define IBACM_PID_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.pid"
+#define IBACM_PORT_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.port"
+#define IBACM_LOG_FILE "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log"
// FIXME This has been supported in compilers forever, we should just fail to build on such old systems.
#cmakedefine HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1
diff --git a/ibacm/CMakeLists.txt b/ibacm/CMakeLists.txt
index 8887c13af463..857a6e82320a 100644
--- a/ibacm/CMakeLists.txt
+++ b/ibacm/CMakeLists.txt
@@ -3,11 +3,6 @@ publish_headers(infiniband
include/infiniband/acm_prov.h
)
-# FIXME: To config.h
-add_definitions("-DIBACM_CONFIG_PATH=\"${CMAKE_INSTALL_FULL_SYSCONFDIR}/rdma\"")
-add_definitions("-DIBACM_LIB_PATH=\"${ACM_PROVIDER_DIR}\"")
-add_definitions("-DIBACM_BIN_PATH=\"${CMAKE_INSTALL_FULL_BINDIR}\"")
-
# FIXME: Fixup the include scheme to not require all these -Is
include_directories("include")
include_directories("src")
diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h
index 5ca4c6f554c5..83d31b3589c5 100644
--- a/ibacm/linux/osd.h
+++ b/ibacm/linux/osd.h
@@ -31,6 +31,7 @@
#if !defined(OSD_H)
#define OSD_H
+#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -46,7 +47,6 @@
#include <sys/time.h>
#include <netinet/in.h>
-#define ACM_CONF_DIR IBACM_CONFIG_PATH
#define ACM_ADDR_FILE "ibacm_addr.cfg"
#define ACM_OPTS_FILE "ibacm_opts.cfg"
diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index ab1269f71d02..4650421b81b7 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -226,9 +226,9 @@ static struct sa_data {
static char *acme = IBACM_BIN_PATH "/ib_acme -A";
static char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
static char *addr_file = ACM_CONF_DIR "/" ACM_ADDR_FILE;
-static char log_file[128] = "/var/log/ibacm.log";
+static char log_file[128] = IBACM_LOG_FILE;
static int log_level = 0;
-static char lock_file[128] = "/var/run/ibacm.pid";
+static char lock_file[128] = IBACM_PID_FILE;
static short server_port = 6125;
static int support_ips_in_addr_cfg = 0;
static char prov_lib_path[256] = IBACM_LIB_PATH;
@@ -578,7 +578,7 @@ static void acm_init_server(void)
atomic_init(&client_array[i].refcnt);
}
- if (!(f = fopen("/var/run/ibacm.port", "w"))) {
+ if (!(f = fopen(IBACM_PORT_FILE, "w"))) {
acm_log(0, "notice - cannot publish ibacm port number\n");
return;
}
diff --git a/ibacm/src/acme.c b/ibacm/src/acme.c
index f1b0d010625e..4d9003047506 100644
--- a/ibacm/src/acme.c
+++ b/ibacm/src/acme.c
@@ -130,9 +130,9 @@ static void gen_opts_temp(FILE *f)
fprintf(f, "# Examples:\n");
fprintf(f, "# log_file stdout\n");
fprintf(f, "# log_file stderr\n");
- fprintf(f, "# log_file /var/log/ibacm.log\n");
+ fprintf(f, "# log_file %s\n", IBACM_LOG_FILE);
fprintf(f, "\n");
- fprintf(f, "log_file /var/log/ibacm.log\n");
+ fprintf(f, "log_file %s\n", IBACM_LOG_FILE);
fprintf(f, "\n");
fprintf(f, "# log_level:\n");
fprintf(f, "# Indicates the amount of detailed data written to the log file. Log levels\n");
@@ -147,7 +147,7 @@ static void gen_opts_temp(FILE *f)
fprintf(f, "# Specifies the location of the ACM lock file used to ensure that only a\n");
fprintf(f, "# single instance of ACM is running.\n");
fprintf(f, "\n");
- fprintf(f, "lock_file /var/run/ibacm.pid\n");
+ fprintf(f, "lock_file %s\n", IBACM_PID_FILE);
fprintf(f, "\n");
fprintf(f, "# addr_prot:\n");
fprintf(f, "# Default resolution protocol to resolve IP addresses into IB GIDs.\n");
@@ -276,7 +276,7 @@ static void gen_opts_temp(FILE *f)
fprintf(f, "# the ACM cache. This option is only valid if route_preload\n");
fprintf(f, "# indicates that routing data should be read from a file.\n");
fprintf(f, "# Default is %s/ibacm_route.data\n", ACM_CONF_DIR);
- fprintf(f, "# route_data_file /etc/rdma/ibacm_route.data\n");
+ fprintf(f, "# route_data_file %s/ibacm_route.data\n", ACM_CONF_DIR);
fprintf(f, "\n");
fprintf(f, "# addr_preload:\n");
fprintf(f, "# Specifies if the ACM address cache should be preloaded, or built on demand.\n");
@@ -292,7 +292,7 @@ static void gen_opts_temp(FILE *f)
fprintf(f, "# the ACM cache. This option is only valid if addr_preload\n");
fprintf(f, "# indicates that address data should be read from a file.\n");
fprintf(f, "# Default is %s/ibacm_hosts.data\n", ACM_CONF_DIR);
- fprintf(f, "# addr_data_file /etc/rdma/ibacm_hosts.data\n");
+ fprintf(f, "# addr_data_file %s/ibacm_hosts.data\n", ACM_CONF_DIR);
fprintf(f, "\n");
fprintf(f, "# support_ips_in_addr_cfg:\n");
fprintf(f, "# If 1 continue to read IP addresses from ibacm_addr.cfg\n");
diff --git a/ibacm/src/libacm.c b/ibacm/src/libacm.c
index 95e562deb031..3ad1db1d307b 100644
--- a/ibacm/src/libacm.c
+++ b/ibacm/src/libacm.c
@@ -48,7 +48,7 @@ static void acm_set_server_port(void)
{
FILE *f;
- if ((f = fopen("/var/run/ibacm.port", "r"))) {
+ if ((f = fopen(IBACM_PORT_FILE, "r"))) {
if (fscanf(f, "%hu", (unsigned short *) &server_port) != 1)
printf("Failed to read server port\n");
fclose(f);
diff --git a/iwpmd/src/iwarp_pm.h b/iwpmd/src/iwarp_pm.h
index bcf88ca30433..5b7c6136f386 100644
--- a/iwpmd/src/iwarp_pm.h
+++ b/iwpmd/src/iwarp_pm.h
@@ -85,7 +85,6 @@
#define IWPM_IFNAME_SIZE 16
#define IWPM_IPADDR_SIZE 16
-#define IWPM_CONFIG_FILE "/etc/iwpmd.conf"
#define IWPM_PARAM_NUM 1
#define IWPM_PARAM_NAME_LEN 64
diff --git a/iwpmd/src/iwarp_pm_server.c b/iwpmd/src/iwarp_pm_server.c
index e1c2a9c660bb..39e0aa2c3a36 100644
--- a/iwpmd/src/iwarp_pm_server.c
+++ b/iwpmd/src/iwarp_pm_server.c
@@ -31,6 +31,7 @@
*
*/
+#include "config.h"
#include "iwarp_pm.h"
const char iwpm_ulib_name [] = "iWarpPortMapperUser";
diff --git a/librdmacm/src/acm.c b/librdmacm/src/acm.c
index f0da01e6d286..75d9d8cf487e 100644
--- a/librdmacm/src/acm.c
+++ b/librdmacm/src/acm.c
@@ -120,7 +120,7 @@ static int ucma_set_server_port(void)
{
FILE *f;
- if ((f = fopen("/var/run/ibacm.port", "r" STREAM_CLOEXEC))) {
+ if ((f = fopen(IBACM_PORT_FILE, "r" STREAM_CLOEXEC))) {
fscanf(f, "%" SCNu16, &server_port);
fclose(f);
}
diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h
index 98eba8dc21e1..091d104655c5 100644
--- a/librdmacm/src/cma.h
+++ b/librdmacm/src/cma.h
@@ -179,13 +179,4 @@ struct ib_connect_hdr {
#define cma_dst_ip6 dst_addr[0]
};
-#ifndef SYSCONFDIR
-#define SYSCONFDIR "/etc"
-#endif
-#ifndef RDMADIR
-#define RDMADIR "rdma"
-#endif
-#define RDMA_CONF_DIR SYSCONFDIR "/" RDMADIR
-#define RS_CONF_DIR RDMA_CONF_DIR "/rsocket"
-
#endif /* CMA_H */
diff --git a/srp_daemon/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon/srp_daemon.c
index dfc976b8f6db..70764e00f851 100644
--- a/srp_daemon/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon/srp_daemon.c
@@ -226,7 +226,7 @@ static void usage(const char *argv0)
fprintf(stderr, "-R <rescan time> perform complete Rescan every <rescan time> seconds\n");
fprintf(stderr, "-T <retry timeout> Retries to connect to existing target after Timeout of <retry timeout> seconds\n");
fprintf(stderr, "-l <tl_retry timeout> Transport retry count before failing IO. should be in range [2..7], (default 2)\n");
- fprintf(stderr, "-f <rules file> use rules File to set to which target(s) to connect (default: /etc/srp_daemon.conf\n");
+ fprintf(stderr, "-f <rules file> use rules File to set to which target(s) to connect (default: " SRP_DEAMON_CONFIG_FILE ")\n");
fprintf(stderr, "-t <timeout> Timeout for mad response in milliseconds\n");
fprintf(stderr, "-r <retries> number of send Retries for each mad\n");
fprintf(stderr, "-n New connection command format - use also initiator extension\n");
@@ -1622,7 +1622,7 @@ static int get_config(struct config_t *conf, int argc, char *argv[])
conf->retry_timeout = 20;
conf->add_target_file = NULL;
conf->print_initiator_ext = 0;
- conf->rules_file = "/etc/srp_daemon.conf";
+ conf->rules_file = SRP_DEAMON_CONFIG_FILE;
conf->rules = NULL;
conf->tl_retry_count = 0;
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 07/13] Pass ancillary files that use paths through cmake substitution
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (5 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 06/13] Consolidate definitions for paths into config.h Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 08/13] srp_daemon: Move lock file into /var/run/ Jason Gunthorpe
` (6 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Sean Hefty, Tatyana Nikolova, Bart Van Assche
This removes hardwired paths from the documentation and broadly
makes the documentation and scripts match what the C code is now
doing.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
ibacm/CMakeLists.txt | 2 +-
ibacm/ibacm.init.in | 2 +-
ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in} | 4 ++--
iwpmd/CMakeLists.txt | 4 ++--
iwpmd/{iwpmd.1 => iwpmd.1.in} | 2 +-
iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in} | 2 +-
srp_daemon/man/CMakeLists.txt | 2 +-
srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in} | 8 ++++----
srp_daemon/srp_daemon/CMakeLists.txt | 4 +++-
srp_daemon/srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} | 4 ++--
srp_daemon/srp_daemon/srpd.in | 6 +++---
11 files changed, 21 insertions(+), 19 deletions(-)
rename ibacm/man/{ibacm_prov.7 => ibacm_prov.7.in} (95%)
rename iwpmd/{iwpmd.1 => iwpmd.1.in} (98%)
rename iwpmd/{iwpmd.conf.5 => iwpmd.conf.5.in} (92%)
rename srp_daemon/man/{srp_daemon.1 => srp_daemon.1.in} (90%)
rename srp_daemon/srp_daemon/{srp_daemon.sh => srp_daemon.sh.in} (95%)
diff --git a/ibacm/CMakeLists.txt b/ibacm/CMakeLists.txt
index 857a6e82320a..376a3a89ddae 100644
--- a/ibacm/CMakeLists.txt
+++ b/ibacm/CMakeLists.txt
@@ -52,7 +52,7 @@ rdma_man_pages(
man/ib_acme.1
man/ibacm.1
man/ibacm.7
- man/ibacm_prov.7
+ man/ibacm_prov.7.in
)
# FIXME: update the .init.in
diff --git a/ibacm/ibacm.init.in b/ibacm/ibacm.init.in
index aea262b6768a..0fb0011f3953 100644
--- a/ibacm/ibacm.init.in
+++ b/ibacm/ibacm.init.in
@@ -19,7 +19,7 @@
# host route lookups.
### END INIT INFO
-pidfile=/var/run/ibacm.pid
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.pid
subsys=/var/lock/subsys/ibacm
daemon() { /sbin/daemon ${1+"$@"}; }
diff --git a/ibacm/man/ibacm_prov.7 b/ibacm/man/ibacm_prov.7.in
similarity index 95%
rename from ibacm/man/ibacm_prov.7
rename to ibacm/man/ibacm_prov.7.in
index d04617e837c8..9e79d58f639e 100644
--- a/ibacm/man/ibacm_prov.7
+++ b/ibacm/man/ibacm_prov.7.in
@@ -12,7 +12,7 @@ To add a provider to the ibacm core service, the provider must
.TP
1. be implemented as a shared library;
.TP
-2. be installed under a configured directory, eg., /usr/lib64/ibacm/;
+2. be installed under a configured directory, eg., @ACM_PROVIDER_DIR@;
.TP
3 export a function provider_query() that returns a pointer to its provider info
and version info.
@@ -66,7 +66,7 @@ Non-related sections should be ignored.
.P
Some helper functions are also exported by the ibacm core. For example, the
acm_log define (or the acm_write() function) can be used to log messages into
-ibacm's log file (default /var/log/ibacm.log). For details, refer to
+ibacm's log file (default @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log). For details, refer to
the acm_prov.h file.
.SH "NOTES"
A provider should always set the version in its provider info structure as the
diff --git a/iwpmd/CMakeLists.txt b/iwpmd/CMakeLists.txt
index 21208dd5b82a..89a715128076 100644
--- a/iwpmd/CMakeLists.txt
+++ b/iwpmd/CMakeLists.txt
@@ -1,4 +1,4 @@
rdma_man_pages(
- iwpmd.1
- iwpmd.conf.5
+ iwpmd.1.in
+ iwpmd.conf.5.in
)
diff --git a/iwpmd/iwpmd.1 b/iwpmd/iwpmd.1.in
similarity index 98%
rename from iwpmd/iwpmd.1
rename to iwpmd/iwpmd.1.in
index a4948c509f3b..88eece7f6522 100644
--- a/iwpmd/iwpmd.1
+++ b/iwpmd/iwpmd.1.in
@@ -51,6 +51,6 @@ to the system message log.
.P
SIGTERM/SIGHUP will force iwpmd to exit.
.SH "FILES"
-/etc/iwpmd.conf
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf
.SH "SEE ALSO"
rdma_cm(7)
diff --git a/iwpmd/iwpmd.conf.5 b/iwpmd/iwpmd.conf.5.in
similarity index 92%
rename from iwpmd/iwpmd.conf.5
rename to iwpmd/iwpmd.conf.5.in
index 9dfe137d3fab..1baae82b76da 100644
--- a/iwpmd/iwpmd.conf.5
+++ b/iwpmd/iwpmd.conf.5.in
@@ -15,6 +15,6 @@ to communicate with the kernel port map client. The default is 400MB.
.SH "EXAMPLES"
nl_sock_rbuf_size=419430400
.SH "FILES"
-/etc/iwpmd.conf
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf
.SH "SEE ALSO"
iwpmd(1)
diff --git a/srp_daemon/man/CMakeLists.txt b/srp_daemon/man/CMakeLists.txt
index f05de60b97aa..cd644a6bd836 100644
--- a/srp_daemon/man/CMakeLists.txt
+++ b/srp_daemon/man/CMakeLists.txt
@@ -1,4 +1,4 @@
rdma_man_pages(
ibsrpdm.1
- srp_daemon.1
+ srp_daemon.1.in
)
diff --git a/srp_daemon/man/srp_daemon.1 b/srp_daemon/man/srp_daemon.1.in
similarity index 90%
rename from srp_daemon/man/srp_daemon.1
rename to srp_daemon/man/srp_daemon.1.in
index 6117e3679a25..6ee114284780 100644
--- a/srp_daemon/man/srp_daemon.1
+++ b/srp_daemon/man/srp_daemon.1.in
@@ -15,7 +15,7 @@ Each srp_daemon instance operates on one local port. Upon boot it performs a ful
When a new machine joins the fabric, srp_daemon checks if it is a target. When there is a change of capabilities, srp_daemon checks if the machine has turned into a target. When there is an SA change or a timeout expiration, srp_daemon performs a full rescan of the fabric.
-For each target srp_daemon finds, it checks if it should connect to this target according to its rules (default rules file is /etc/srp_daemon.conf) and if it is already connected to the local port. If it should connect to this target and if it is not connected yet, srp_daemon can either print the target details or connect to it.
+For each target srp_daemon finds, it checks if it should connect to this target according to its rules (default rules file is @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf) and if it is already connected to the local port. If it should connect to this target and if it is not connected yet, srp_daemon can either print the target details or connect to it.
.SH OPTIONS
@@ -57,7 +57,7 @@ Retries to connect to existing target after \fIretry-Timeout\fR seconds. If -R i
.TP
\fB\-f\fR \fIrules-File\fR
Decide to which targets to connect according to the rules in \fIrules-File\fR.
-If \fB\-f\fR is not specified, uses the default rules file /etc/srp_daemon.conf.
+If \fB\-f\fR is not specified, uses the default rules file @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf.
Each line in the \fIrules-File\fR is a rule which can be either an allow connection or a disallow connection according to
the first character in the line (a or d accordingly). The rest of the line is values for id_ext, ioc_guid, dgid,
service_id. Please take a look at the example section for an example of the file. srp_daemon decide whether to allow or disallow each target according to first rule that match the target. If no rule matches the target, the target is allowed and will be connected. In an allow rule it is possible to set attributes for the connection to the target. Supported attributes are max_cmd_per_lun and max_sect.
@@ -72,7 +72,7 @@ Perform \fIretries\fR retries on each send to MAD (default: 3 retries).
New format - use also initiator_ext in the connection command.
.SH FILES
-/etc/srp_daemon.conf -
+@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf -
Default rules configuration file that indicates to which targets to connect. Can be overridden using the \fB\-f\fR \fIrules-File\fR option.
Each line in this file is a rule which can be either an allow connection or a disallow connection according to
the first character in the line (a or d accordingly). The rest of the line is values for id_ext, ioc_guid, dgid,
@@ -86,7 +86,7 @@ srp_daemon -o -c -a (Prints the connection commands for the targets in the
srp_daemon -e -f rules.txt (Connects to the targets allowed in the rules file rules.txt)
.nf
-An example for a rules configuration file (such as /etc/srp_daemon.conf)
+An example for a rules configuration file (such as @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf)
------------------------------------------------------------------------
# Rules file example
# This is a comment
diff --git a/srp_daemon/srp_daemon/CMakeLists.txt b/srp_daemon/srp_daemon/CMakeLists.txt
index 84d74044186a..fe6b41811b92 100644
--- a/srp_daemon/srp_daemon/CMakeLists.txt
+++ b/srp_daemon/srp_daemon/CMakeLists.txt
@@ -15,7 +15,9 @@ target_link_libraries(srp_daemon
rdma_install_symlink(srp_daemon "${CMAKE_INSTALL_SBINDIR}/ibsrpdm")
# FIXME: Why?
rdma_install_symlink(srp_daemon "${CMAKE_INSTALL_SBINDIR}/run_srp_daemon")
-install(FILES srp_daemon.sh DESTINATION "${CMAKE_INSTALL_SBINDIR}")
+rdma_subst_install(FILES "srp_daemon.sh.in"
+ DESTINATION "${CMAKE_INSTALL_SBINDIR}"
+ RENAME "srp_daemon.sh")
install(FILES logrotate-srp_daemon DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/logrotate.d" RENAME "srp_daemon")
install(FILES rsyslog-srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rsyslog.d" RENAME "srp_daemon.conf")
diff --git a/srp_daemon/srp_daemon/srp_daemon.sh b/srp_daemon/srp_daemon/srp_daemon.sh.in
similarity index 95%
rename from srp_daemon/srp_daemon/srp_daemon.sh
rename to srp_daemon/srp_daemon/srp_daemon.sh.in
index 3981a0d4b586..cb0b81efe6e6 100755
--- a/srp_daemon/srp_daemon/srp_daemon.sh
+++ b/srp_daemon/srp_daemon/srp_daemon.sh.in
@@ -30,12 +30,12 @@
shopt -s nullglob
-prog=/usr/sbin/srp_daemon
+prog=@CMAKE_INSTALL_FULL_SBINDIR@/srp_daemon
params=$@
ibdir="/sys/class/infiniband"
rescan_interval=60
pids=""
-pidfile=/var/run/srp_daemon.sh.pid
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon.sh.pid
mypid=$$
trap_handler()
diff --git a/srp_daemon/srp_daemon/srpd.in b/srp_daemon/srp_daemon/srpd.in
index 10692e7e0f05..d77579170a3b 100755
--- a/srp_daemon/srp_daemon/srpd.in
+++ b/srp_daemon/srp_daemon/srpd.in
@@ -4,7 +4,7 @@
#
# chkconfig: - 25 75
# description: Starts/Stops InfiniBand SRP client service
-# config: /etc/srp_daemon.conf
+# config: @CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf
#
### BEGIN INIT INFO
# Provides: srpd
@@ -32,8 +32,8 @@ fi
if [ -f $RDMA_CONFIG ]; then
. $RDMA_CONFIG
fi
-pidfile=/var/run/srp_daemon.sh.pid
-prog=/usr/sbin/srp_daemon.sh
+pidfile=@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon.sh.pid
+prog=@CMAKE_INSTALL_FULL_SBINDIR@/srp_daemon.sh
checkpid() {
[ -e "/proc/$1" ]
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 08/13] srp_daemon: Move lock file into /var/run/
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (6 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 07/13] Pass ancillary files that use paths through cmake substitution Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 09/13] verbs: Move the providers into /usr/lib.../libibverbs by default Jason Gunthorpe
` (5 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Bart Van Assche
'/var/tmp' is an inappropriate places for lock files of this nature,
they belong in /var/run. /var/lock does not seem suitable because
this lock is not against a basic device node.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
buildlib/config.h.in | 1 +
srp_daemon/srp_daemon/srp_daemon.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index bbc279d3c9c3..78994a39d7ad 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -22,6 +22,7 @@
#define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf"
#define SRP_DEAMON_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/srp_daemon.conf"
+#define SRP_DEAMON_LOCK_PREFIX "@CMAKE_INSTALL_FULL_RUNDIR@/srp_daemon"
#define ACM_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma"
#define IBACM_LIB_PATH "@ACM_PROVIDER_DIR@"
diff --git a/srp_daemon/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon/srp_daemon.c
index 70764e00f851..f16674dbfafa 100644
--- a/srp_daemon/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon/srp_daemon.c
@@ -131,7 +131,7 @@ static int check_process_uniqueness(struct config_t *conf)
char path[256];
int fd;
- snprintf(path, sizeof(path), "/var/tmp/srp_daemon_%s_%d",
+ snprintf(path, sizeof(path), SRP_DEAMON_LOCK_PREFIX "_%s_%d",
conf->dev_name, conf->port_num);
if ((fd = open(path, O_CREAT|O_RDWR,
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 09/13] verbs: Move the providers into /usr/lib.../libibverbs by default
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (7 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 08/13] srp_daemon: Move lock file into /var/run/ Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 10/13] ipathverbs: Move truescale-serdes.cmds to /usr/libexec/ Jason Gunthorpe
` (4 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Doug Ledford, Yishai Hadas
The Debian packaging has always used this path, provide
official support for this configuration so Debian does not
rely on the absolute path in the .driver file, which breaks biarch.
Since there is no reason for the providers to be in the system
library search path (they export no symbols, and have no soname)
make this the default configuration.
The old behaviour can be restored by using:
cmake -DVERBS_PROVIDER_DIR=''
This continues to support out-of-tree drivers by searching both
the provider path and the system library path if an unqualified
name is given in the .driver file.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 6 +++++
buildlib/config.h.in | 2 ++
buildlib/rdma_functions.cmake | 16 ++++++++-----
libibverbs/src/init.c | 55 ++++++++++++++++++++++++++++++-------------
4 files changed, 57 insertions(+), 22 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 713788f188e3..7ae236f88f67 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,8 @@
# and do not build iwpmd.
# -DENABLE_STATIC=1 (default disabled)
# Produce static libraries along with the usual shared libraries.
+# -DVERBS_PROVIDER_DIR='' (default /usr/lib.../libibverbs)
+# Use the historical search path for providers, in the standard system library.
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
project(RDMA C)
@@ -53,6 +55,10 @@ set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd"
set(ACM_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/ibacm"
CACHE PATH "Location for ibacm provider plugin shared library files.")
+# Location to find the provider plugin shared library files
+set(VERBS_PROVIDER_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/libibverbs"
+ CACHE PATH "Location for provider plugin shared library files. If set to empty the system search path is used.")
+
# Allow the 'run' dir to be configurable, this historically has been /var/run, but
# some systems now use /run/
set(CMAKE_INSTALL_RUNDIR "var/run"
diff --git a/buildlib/config.h.in b/buildlib/config.h.in
index 78994a39d7ad..8ae2a4e536c0 100644
--- a/buildlib/config.h.in
+++ b/buildlib/config.h.in
@@ -31,6 +31,8 @@
#define IBACM_PORT_FILE "@CMAKE_INSTALL_FULL_RUNDIR@/ibacm.port"
#define IBACM_LOG_FILE "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/log/ibacm.log"
+#define VERBS_PROVIDER_DIR "@VERBS_PROVIDER_DIR@"
+
// FIXME This has been supported in compilers forever, we should just fail to build on such old systems.
#cmakedefine HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE 1
diff --git a/buildlib/rdma_functions.cmake b/buildlib/rdma_functions.cmake
index 260dd18d78df..06ccd518c81d 100644
--- a/buildlib/rdma_functions.cmake
+++ b/buildlib/rdma_functions.cmake
@@ -78,11 +78,6 @@ function(rdma_provider DEST)
file(MAKE_DIRECTORY "${BUILD_LIB}/libibverbs.d/")
file(WRITE "${BUILD_LIB}/libibverbs.d/${DEST}.driver" "driver ${BUILD_LIB}/${DEST}\n")
- # FIXME: This symlink is provided for compat with the old build, but it
- # never should have existed in the first place, nothing should use this
- # name, we can probably remove it.
- rdma_install_symlink("lib${DEST}-rdmav2.so" "${CMAKE_INSTALL_LIBDIR}/lib${DEST}.so")
-
# Create a static provider library
# FIXME: This is probably pointless, the provider library has no symbols so
# what good is it? Presumably it should be used with -Wl,--whole-archive,
@@ -108,7 +103,16 @@ function(rdma_provider DEST)
# Provider Plugins do not use SONAME versioning, there is no reason to
# create the usual symlinks.
- install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+ if (VERBS_PROVIDER_DIR)
+ install(TARGETS ${DEST} DESTINATION "${VERBS_PROVIDER_DIR}")
+ else()
+ install(TARGETS ${DEST} DESTINATION "${CMAKE_INSTALL_LIBDIR}")
+
+ # FIXME: This symlink is provided for compat with the old build, but it
+ # never should have existed in the first place, nothing should use this
+ # name, we can probably remove it.
+ rdma_install_symlink("lib${DEST}-rdmav2.so" "${CMAKE_INSTALL_LIBDIR}/lib${DEST}.so")
+ endif()
endfunction()
# Create an installed executable
diff --git a/libibverbs/src/init.c b/libibverbs/src/init.c
index bca0e02d11e1..7ae0fc87d332 100644
--- a/libibverbs/src/init.c
+++ b/libibverbs/src/init.c
@@ -190,33 +190,56 @@ void verbs_register_driver(const char *name, verbs_driver_init_func init_func)
register_driver(name, NULL, init_func);
}
+#define __IBV_QUOTE(x) #x
+#define IBV_QUOTE(x) __IBV_QUOTE(x)
+#define DLOPEN_TRAILER "-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so"
+
static void load_driver(const char *name)
{
char *so_name;
void *dlhandle;
-#define __IBV_QUOTE(x) #x
-#define IBV_QUOTE(x) __IBV_QUOTE(x)
-
- if (asprintf(&so_name,
- name[0] == '/' ?
- "%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so" :
- "lib%s-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so",
- name) < 0) {
- fprintf(stderr, PFX "Warning: couldn't load driver '%s'.\n",
- name);
+ /* If the name is an absolute path then open that path after appending
+ the trailer suffix */
+ if (name[0] == '/') {
+ if (asprintf(&so_name, "%s" DLOPEN_TRAILER, name) < 0)
+ goto out_asprintf;
+ dlhandle = dlopen(so_name, RTLD_NOW);
+ if (!dlhandle)
+ goto out_dlopen;
+ free(so_name);
return;
}
- dlhandle = dlopen(so_name, RTLD_NOW);
- if (!dlhandle) {
- fprintf(stderr, PFX "Warning: couldn't load driver '%s': %s\n",
- name, dlerror());
- goto out;
+ /* If configured with a provider plugin path then try that next */
+ if (sizeof(VERBS_PROVIDER_DIR) >= 1) {
+ if (asprintf(&so_name, VERBS_PROVIDER_DIR "/lib%s" DLOPEN_TRAILER, name) <
+ 0)
+ goto out_asprintf;
+ dlhandle = dlopen(so_name, RTLD_NOW);
+ free(so_name);
+ if (dlhandle)
+ return;
}
-out:
+ /* Otherwise use the system libary search path. This is the historical
+ behavior of libibverbs */
+ if (asprintf(&so_name, "lib%s" DLOPEN_TRAILER, name) < 0)
+ goto out_asprintf;
+ dlhandle = dlopen(so_name, RTLD_NOW);
+ if (!dlhandle)
+ goto out_dlopen;
+ free(so_name);
+ return;
+
+out_asprintf:
+ fprintf(stderr, PFX "Warning: couldn't load driver '%s'.\n", name);
+ return;
+out_dlopen:
+ fprintf(stderr, PFX "Warning: couldn't load driver '%s': %s\n", so_name,
+ dlerror());
free(so_name);
+ return;
}
static void load_drivers(void)
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 10/13] ipathverbs: Move truescale-serdes.cmds to /usr/libexec/
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (8 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 09/13] verbs: Move the providers into /usr/lib.../libibverbs by default Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 11/13] srp_daemon: Add the debian initscripts as an option Jason Gunthorpe
` (3 subsequent siblings)
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Mike Marciniszyn
This is the FHS defined place for non-user runnable helper
programs.
Debian forbids the use of /usr/libexec/ so we provide
substitution support to let cmake customize this.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
libipathverbs/CMakeLists.txt | 6 ++++--
libipathverbs/dracut_install | 2 +-
libipathverbs/truescale.conf | 1 -
libipathverbs/truescale.conf.in | 1 +
4 files changed, 6 insertions(+), 4 deletions(-)
delete mode 100644 libipathverbs/truescale.conf
create mode 100644 libipathverbs/truescale.conf.in
diff --git a/libipathverbs/CMakeLists.txt b/libipathverbs/CMakeLists.txt
index 359438ef0e49..bde405d0d776 100644
--- a/libipathverbs/CMakeLists.txt
+++ b/libipathverbs/CMakeLists.txt
@@ -1,4 +1,6 @@
-install(FILES truescale.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/")
+rdma_subst_install(FILES "truescale.conf.in"
+ DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/"
+ RENAME "truescale.conf")
install(FILES truescale-serdes.cmds
- DESTINATION "${CMAKE_INSTALL_SBINDIR}"
+ DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}"
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
diff --git a/libipathverbs/dracut_install b/libipathverbs/dracut_install
index 131adfa036b8..a7ef490ea40f 100644
--- a/libipathverbs/dracut_install
+++ b/libipathverbs/dracut_install
@@ -1,7 +1,7 @@
#!/bin/bash
inst /etc/modprobe.d/truescale.conf
-inst /usr/sbin/truescale-serdes.cmds
+inst /usr/libexec/truescale-serdes.cmds
# All files needed by truescale-serdes.cmds need to be present here
inst /sbin/lspci
diff --git a/libipathverbs/truescale.conf b/libipathverbs/truescale.conf
deleted file mode 100644
index 8ed227c91f86..000000000000
diff --git a/libipathverbs/truescale.conf.in b/libipathverbs/truescale.conf.in
new file mode 100644
index 000000000000..e2827d956015
--- /dev/null
+++ b/libipathverbs/truescale.conf.in
@@ -0,0 +1 @@
+install ib_qib modprobe -i ib_qib $CMDLINE_OPTS && @CMAKE_INSTALL_FULL_LIBEXECDIR@/truescale-serdes.cmds start
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 11/13] srp_daemon: Add the debian initscripts as an option
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (9 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 10/13] ipathverbs: Move truescale-serdes.cmds to /usr/libexec/ Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
[not found] ` <1474658228-5390-12-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-23 19:17 ` [PATCH 12/13] Document a versioning strategy and use it Jason Gunthorpe
` (2 subsequent siblings)
13 siblings, 1 reply; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Bart Van Assche
Necessary to reproduce the Debian packaging.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 3 ++
srp_daemon/srp_daemon/CMakeLists.txt | 29 ++++++++----
srp_daemon/srptools.default | 14 ++++++
srp_daemon/srptools.init | 89 ++++++++++++++++++++++++++++++++++++
4 files changed, 126 insertions(+), 9 deletions(-)
create mode 100644 srp_daemon/srptools.default
create mode 100644 srp_daemon/srptools.init
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ae236f88f67..805b25bb8669 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,9 @@ else()
set(CMAKE_INSTALL_FULL_RUNDIR "${CMAKE_INSTALL_RUNDIR}")
endif()
+set(DISTRO_FLAVOUR "None" CACHE
+ STRING "Flavour of distribution to install for. This primarily impacts the init.d scripts installed.")
+
#-------------------------
# Load CMake components
set(BUILDLIB "${CMAKE_SOURCE_DIR}/buildlib")
diff --git a/srp_daemon/srp_daemon/CMakeLists.txt b/srp_daemon/srp_daemon/CMakeLists.txt
index fe6b41811b92..4ad4edaf8c33 100644
--- a/srp_daemon/srp_daemon/CMakeLists.txt
+++ b/srp_daemon/srp_daemon/CMakeLists.txt
@@ -23,12 +23,23 @@ install(FILES logrotate-srp_daemon DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/logr
install(FILES rsyslog-srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/rsyslog.d" RENAME "srp_daemon.conf")
install(FILES srp_daemon.conf DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}")
-# FIXME: The ib init.d file should really be included in rdma-core as well.
-set(RDMA_SERVICE "openibd" CACHE STRING "init.d file service name to order srpd after")
-# NOTE: These defaults are for CentOS, packagers should override.
-set(SRP_DEFAULT_START "2 3 4 5" CACHE STRING "Default-Start service data for srpd")
-set(SRP_DEFAULT_STOP "0 1 6" CACHE STRING "Default-Stop service data for srpd")
-configure_file(srpd.in "${CMAKE_CURRENT_BINARY_DIR}/srpd")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/srpd"
- DESTINATION "${CMAKE_INSTALL_INITDDIR}"
- PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+if ("${DISTRO_FLAVOUR}" STREQUAL "Debian")
+ # Debian version of the initscript system
+ install(FILES "srptools.init"
+ DESTINATION "${CMAKE_INSTALL_INITDDIR}"
+ RENAME "srptools"
+ PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+ install(FILES "srptools.default"
+ DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/default/"
+ RENAME "srptools")
+else()
+ # FIXME: The ib init.d file should really be included in rdma-core as well.
+ set(RDMA_SERVICE "openibd" CACHE STRING "init.d file service name to order srpd after")
+ # NOTE: These defaults are for CentOS, packagers should override.
+ set(SRP_DEFAULT_START "2 3 4 5" CACHE STRING "Default-Start service data for srpd")
+ set(SRP_DEFAULT_STOP "0 1 6" CACHE STRING "Default-Stop service data for srpd")
+ configure_file(srpd.in "${CMAKE_CURRENT_BINARY_DIR}/srpd")
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/srpd"
+ DESTINATION "${CMAKE_INSTALL_INITDDIR}"
+ PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+endif()
diff --git a/srp_daemon/srptools.default b/srp_daemon/srptools.default
new file mode 100644
index 000000000000..81e84f4a5cba
--- /dev/null
+++ b/srp_daemon/srptools.default
@@ -0,0 +1,14 @@
+#How often should srpdeamon rescan the fabric (seconds)
+RETRIES=60
+
+#Where should srp-deamon log to
+LOG=/var/log/srp_daemon.log
+
+# What ports should srp-deamon be started on.
+# Format is CA:port
+# ALL or NONE will run on all ports on none
+# respectively
+
+PORTS=NONE
+#PORTS=ALL
+#PORTS="mthca0:1 mlx4_0:2"
diff --git a/srp_daemon/srptools.init b/srp_daemon/srptools.init
new file mode 100644
index 000000000000..2c1a140ccbc3
--- /dev/null
+++ b/srp_daemon/srptools.init
@@ -0,0 +1,89 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides: srptools
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Discovers SRP scsi targets.
+# Description: Discovers SRP scsi over infiniband targets.
+### END INIT INFO
+
+[ -x /usr/sbin/srp_daemon ] || exit 0
+
+IBDIR=/sys/class/infiniband
+
+PORTS=""
+RETRIES=""
+LOG=""
+
+[ -f /etc/default/srptools ] && . /etc/default/srptools
+
+start_daemon () {
+
+if [ "$PORTS" = "NONE" ] ; then
+echo "srptools disabled."
+exit 0
+fi
+
+
+if [ "$PORTS" = "ALL" ] ; then
+ for HCA_ID in `/bin/ls -1 ${IBDIR}`
+ do
+ for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
+ do
+ run_daemon
+ done
+ done
+fi
+
+
+for ADAPTER in $PORTS ; do
+ HCA_ID=`echo $ADAPTER | awk -F: '{print $1}'`
+ PORT=`echo $ADAPTER | awk -F: '{print $2}'`
+ run_daemon
+done
+}
+
+
+run_daemon() {
+# SRP deamon wedges if we start it on a port which is not up
+
+ STATUS=`/usr/sbin/ibstat $HCA_ID $PORT | grep "State:"`
+
+ if [ "$STATUS" = "State: Active" ] ; then
+ echo "Starting srp on $HCA_ID $PORT"
+
+# srp does not background itself; using the start-stop-daemon background function
+# causes us to lose stdout, which is where it logs to
+ nohup start-stop-daemon --start --quiet -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT} \
+ --exec /usr/sbin/srp_daemon -- -e -c -n -i ${HCA_ID} -p ${PORT} -R ${RETRIES} >> $LOG 2>&1 &
+ RETVAL=$?
+ fi
+}
+
+stop_daemon () {
+ for HCA_ID in `/bin/ls -1 ${IBDIR}`
+ do
+ for PORT in `/bin/ls -1 ${IBDIR}/${HCA_ID}/ports/`
+ do
+ start-stop-daemon --stop --quiet --oknodo -m --pidfile /var/run/srp_daemon.${HCA_ID}.${PORT}
+ RETVAL=$?
+ done
+ done
+}
+
+
+case "$1" in
+
+start)
+start_daemon
+;;
+stop)
+stop_daemon
+;;
+restart | reload | force-reload )
+stop_daemon
+start_daemon
+;;
+esac
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 12/13] Document a versioning strategy and use it
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (10 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 11/13] srp_daemon: Add the debian initscripts as an option Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
2016-09-23 19:17 ` [PATCH 13/13] Remove ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org from MAINTAINERS Jason Gunthorpe
2016-09-28 18:27 ` [PATCH 00/13] Policy changes and packaging support Doug Ledford
13 siblings, 0 replies; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Sean Hefty, Hal Rosenstock, Doug Ledford, Yishai Hadas
This is particularly important for the three shared libraries, and
we haven't been doing it right historically, perhaps due to libtool
braindamage.
The names of the shlibs are updated to:
libibcm 1.0.11
libibumad 3.1.11
libibverbs 1.3.11
librdmacm 1.1.11
The SONAME remains the same.
The overall package release is set to 11 due to libibumad having got up
to a .10 release.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
CMakeLists.txt | 5 +-
Documentation/versioning.md | 108 ++++++++++++++++++++++++++++++++++++++++++
libibcm/src/CMakeLists.txt | 4 +-
libibcm/src/libibcm.map | 1 +
libibumad/src/CMakeLists.txt | 4 +-
libibumad/src/libibumad.map | 1 +
libibverbs/src/CMakeLists.txt | 4 +-
libibverbs/src/libibverbs.map | 1 +
librdmacm/src/CMakeLists.txt | 4 +-
librdmacm/src/librdmacm.map | 1 +
10 files changed, 127 insertions(+), 6 deletions(-)
create mode 100644 Documentation/versioning.md
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 805b25bb8669..8d58db0b9c07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,8 +32,9 @@ else()
endif()
set(PACKAGE_NAME "RDMA")
-# FIXME versioning strategy?
-set(PACKAGE_VERSION "1")
+
+# See Documentation/versioning.md
+set(PACKAGE_VERSION "11")
#-------------------------
# Basic standard paths
diff --git a/Documentation/versioning.md b/Documentation/versioning.md
new file mode 100644
index 000000000000..0cc542aa6b79
--- /dev/null
+++ b/Documentation/versioning.md
@@ -0,0 +1,108 @@
+# Overall Package Version
+
+This version number is set in the top level CMakeLists.txt:
+
+```sh
+set(PACKAGE_VERSION "11")
+````
+
+For upstream releases this is a single integer showing the release
+ordering. We do not attempt to encode any 'ABI' information in this version.
+
+Branched stabled releases can append an additional counter eg `11.2`.
+
+Unofficial releases should include a distributor tag, eg '11.vendor2'.
+
+When the PACKAGE_VERSION is changed, the packaging files should be updated:
+
+```diff
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 389feee1e0f9..63854fe8f07f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -26,7 +26,7 @@ project(RDMA C)
+ set(PACKAGE_NAME "RDMA")
+
+ # See Documentation/versioning.md
+-set(PACKAGE_VERSION "11")
++set(PACKAGE_VERSION "12")
+
+ #-------------------------
+ # Basic standard paths
+```
+
+# Shared Library Versions
+
+The shared libraries use the typical semantic versioning scheme, eg
+*libibumad* has a version like `3.1.11`.
+
+The version number is broken up into three fields:
+- '3' is called the SONAME and is embedded into the ELF:
+ ```sh
+ $ readelf -ds build/lib/libibumad.so.3.1.11
+ 0x000000000000000e (SONAME) Library soname: [libibumad.so.3]
+ ```
+
+ We do not expect this value to ever change for our libraries. It indicates
+ the overall ABI, changing it means the library will not dynamically to old
+ programs link anymore.
+
+- '1' is called the ABI level and is used within the ELF as the last component
+ symbol version tag. This version must be changed every time a new symbol
+ is introduced. It allows the user to see what version of the ABI the
+ library provides.
+
+- '11' is the overall release number and is copied from `PACKAGE_VERSION` This
+ version increases with every package release, even if the library code did
+ not change. It allows the user to see what upstream source was used to build
+ the library.
+
+This version is encoded into the filename `build/lib/libibumad.so.3.1.11` and
+a symlink from `libibumad.so.3` to `build/lib/libibumad.so.3.1.11` is created.
+
+## Shared Library Symbol Versions
+
+Symbol versions are a linker technique that lets the library author provide
+two symbols with different ABIs that have the same API name. The linker
+differentiates the two cases internally. This allows the library author to
+change the ABI that the API uses. This project typically does not make use of
+this feature.
+
+As a secondary feature, the symbol version is also used by package managers
+like RPM to manage the ABI level. To make this work properly the ABI level
+must be correctly encoded into the symbol version.
+
+## Adding a new symbol
+
+First, increase the ABI level of the library. It is safe to re-use the ABI
+level for multiple new functions within a single release, but once a release
+is tagged the ABI level becomes *immutable*. The maintainer can provide
+guidence on what ABI level to use for each series.
+
+```diff
+ rdma_library(ibumad libibumad.map
+ # See Documentation/versioning.md
+- 3 3.1.${PACKAGE_VERSION}
++ 3 3.2.${PACKAGE_VERSION}
+```
+
+Next, add your new symbol to the symbol version file:
+
+```diff
++ IBUMAD_3.2 {
++ global:
++ umad_new_symbol;
++ } IBUMAD_1.0;
+```
+
+NOTE: Once a release is made the stanzas in the map file are *immutable* and
+cannot be changed. Do not add your new symbol to old stanzas.
+
+The new symbol should appear in the ELF:
+
+```sh
+$ readelf -s build/lib/libibumad.so.3.1.11
+ 35: 00000000000031e0 450 FUNC GLOBAL DEFAULT 12 umad_new_symbol@@IBUMAD_3.2
+```
+
+Finally update the `debian/libibumad3.symbols` file.
diff --git a/libibcm/src/CMakeLists.txt b/libibcm/src/CMakeLists.txt
index 2479886c6238..66b3362ec7a0 100644
--- a/libibcm/src/CMakeLists.txt
+++ b/libibcm/src/CMakeLists.txt
@@ -3,7 +3,9 @@ publish_headers(infiniband
../include/infiniband/cm_abi.h
)
-rdma_library(ibcm libibcm.map 1 1.0.0
+rdma_library(ibcm libibcm.map
+ # See Documentation/versioning.md
+ 1 1.0.${PACKAGE_VERSION}
cm.c
)
target_link_libraries(ibcm LINK_PUBLIC ibverbs)
diff --git a/libibcm/src/libibcm.map b/libibcm/src/libibcm.map
index 3d83e481a6bb..c94e420a6cc8 100644
--- a/libibcm/src/libibcm.map
+++ b/libibcm/src/libibcm.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
IBCM_1.0 {
global:
ib_cm_open_device;
diff --git a/libibumad/src/CMakeLists.txt b/libibumad/src/CMakeLists.txt
index b7b5d03bc53e..fbd15893d973 100644
--- a/libibumad/src/CMakeLists.txt
+++ b/libibumad/src/CMakeLists.txt
@@ -7,7 +7,9 @@ publish_headers(infiniband
../include/infiniband/umad_types.h
)
-rdma_library(ibumad libibumad.map 3 3.1.0
+rdma_library(ibumad libibumad.map
+ # See Documentation/versioning.md
+ 3 3.1.${PACKAGE_VERSION}
sysfs.c
umad.c
umad_str.c
diff --git a/libibumad/src/libibumad.map b/libibumad/src/libibumad.map
index e42dc799d69e..8bf474e26ae2 100644
--- a/libibumad/src/libibumad.map
+++ b/libibumad/src/libibumad.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
IBUMAD_1.0 {
global:
umad_init;
diff --git a/libibverbs/src/CMakeLists.txt b/libibverbs/src/CMakeLists.txt
index e1a54345c537..6989f7730c5e 100644
--- a/libibverbs/src/CMakeLists.txt
+++ b/libibverbs/src/CMakeLists.txt
@@ -17,7 +17,9 @@ else()
set(NEIGH "")
endif()
-rdma_library(ibverbs libibverbs.map 1 1.0.0
+rdma_library(ibverbs libibverbs.map
+ # See Documentation/versioning.md
+ 1 1.3.${PACKAGE_VERSION}
cmd.c
compat-1_0.c
device.c
diff --git a/libibverbs/src/libibverbs.map b/libibverbs/src/libibverbs.map
index 46744e551068..33cd6b63917b 100644
--- a/libibverbs/src/libibverbs.map
+++ b/libibverbs/src/libibverbs.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
IBVERBS_1.0 {
global:
ibv_get_device_list;
diff --git a/librdmacm/src/CMakeLists.txt b/librdmacm/src/CMakeLists.txt
index 5324f625616d..0a60786c5f7a 100644
--- a/librdmacm/src/CMakeLists.txt
+++ b/librdmacm/src/CMakeLists.txt
@@ -8,7 +8,9 @@ publish_headers(infiniband
../include/infiniband/ib.h
)
-rdma_library(rdmacm librdmacm.map 1 1.0.0
+rdma_library(rdmacm librdmacm.map
+ # See Documentation/versioning.md
+ 1 1.1.${PACKAGE_VERSION}
acm.c
addrinfo.c
cma.c
diff --git a/librdmacm/src/librdmacm.map b/librdmacm/src/librdmacm.map
index ffbd199d3119..65c049211c65 100644
--- a/librdmacm/src/librdmacm.map
+++ b/librdmacm/src/librdmacm.map
@@ -1,3 +1,4 @@
+/* Do not change this file without reading Documentation/versioning.md */
RDMACM_1.0 {
global:
rdma_create_event_channel;
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [PATCH 13/13] Remove ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org from MAINTAINERS
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (11 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 12/13] Document a versioning strategy and use it Jason Gunthorpe
@ 2016-09-23 19:17 ` Jason Gunthorpe
[not found] ` <1474658228-5390-14-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-09-28 18:27 ` [PATCH 00/13] Policy changes and packaging support Doug Ledford
13 siblings, 1 reply; 39+ messages in thread
From: Jason Gunthorpe @ 2016-09-23 19:17 UTC (permalink / raw)
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA
Turns out this is not a mailing list.
Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
MAINTAINERS | 1 -
1 file changed, 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index b39529feec9b..7a31376056e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -69,7 +69,6 @@ F: ibacm/*
IPATH/QIB USERSPACE PROVIDER (for ib_qib.ko)
M: Mike Marciniszyn <mike.marciniszyn-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
S: Supported
-L: ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
F: libipathverbs/
IWARP PORT MAPPER DAEMON (for iwarp kernel providers)
--
2.1.4
--
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
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [PATCH 00/13] Policy changes and packaging support
[not found] ` <1474658228-5390-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
` (12 preceding siblings ...)
2016-09-23 19:17 ` [PATCH 13/13] Remove ibsupport-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org from MAINTAINERS Jason Gunthorpe
@ 2016-09-28 18:27 ` Doug Ledford
13 siblings, 0 replies; 39+ messages in thread
From: Doug Ledford @ 2016-09-28 18:27 UTC (permalink / raw)
To: Jason Gunthorpe, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: Jarod Wilson, John Jolly, Honggang Li
[-- Attachment #1.1: Type: text/plain, Size: 1169 bytes --]
On 9/23/16 3:16 PM, Jason Gunthorpe wrote:
> This is the next batch of rdma-core updates, these 13 patches deal primarily
> with how the package is built and the install paths afterwards. Most likely
> these changes are mainly of interest to packagers.
>
> The discussion here is informative for some of the patches:
> http://www.spinics.net/lists/linux-rdma/msg39578.html
>
> View the commits on github:
>
> https://github.com/linux-rdma/rdma-core/pull/3
>
> Please forward Acks and I will update the commits.
>
> One important thing to note is that this series pretty much eliminates all
> hard coded paths from the tree. While this is a good thing, it means the
> default behavior is to set SYSCONFDIR to /usr/local/etc/, which is probably
> not what people testing the daemons really want. Compile with:
>
> cmake -GNinja .. -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc
>
> Which is similar to the configure --sysconfdir option
Series looks good modulo the few feedback items.
--
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG Key ID: 0E572FDD
Red Hat, Inc.
100 E. Davie St
Raleigh, NC 27601 USA
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 907 bytes --]
^ permalink raw reply [flat|nested] 39+ messages in thread