Skip to content
Permalink
Browse files

gfapi_device: detect glfs_ftruncate API change (Fedora 30)

... and redefine glfs_ftruncate() to fix the problem
  • Loading branch information...
pstorz authored and franku committed Jul 10, 2019
1 parent 613316e commit 2d789f0325abdd73743e057542fe106110dcb2ad
Showing with 24 additions and 1 deletion.
  1. +16 −0 core/cmake/BareosCheckSymbols.cmake
  2. +3 −0 core/src/include/config.h.in
  3. +5 −1 core/src/stored/backends/gfapi_device.h
@@ -47,3 +47,19 @@ CHECK_SYMBOL_EXISTS(rados_ioctx_set_namespace rados/librados.h HAVE_RADOS_NAMES
CHECK_SYMBOL_EXISTS(rados_nobjects_list_open rados/librados.h HAVE_RADOS_NOBJECTS_LIST)
cmake_pop_check_state()


IF(HAVE_GLUSTERFS_API_GLFS_H)
cmake_push_check_state()
set (CMAKE_REQUIRED_LIBRARIES ${GFAPI_LIBRARIES})
check_cxx_source_compiles("
#include <glusterfs/api/glfs.h>
int main(void)
{
/* new glfs_ftruncate() passes two additional args */
return glfs_ftruncate(NULL, 0, NULL, NULL);
}
"
GLFS_FTRUNCATE_HAS_FOUR_ARGS)

endif()
cmake_pop_check_state()
@@ -391,6 +391,9 @@
/* Define to 1 if you have gfapi lib */
#cmakedefine HAVE_GFAPI @HAVE_GFAPI@

/* Define to 1 if the `glfs_ftruncate' function has four arguments. */
#cmakedefine GLFS_FTRUNCATE_HAS_FOUR_ARGS @GLFS_FTRUNCATE_HAS_FOUR_ARGS@

/* Define to 1 if you have the `glfs_readdirplus' function. */
#cmakedefine HAVE_GLFS_READDIRPLUS @HAVE_GLFS_READDIRPLUS@

@@ -2,7 +2,7 @@
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2014-2014 Planets Communications B.V.
Copyright (C) 2014-2014 Bareos GmbH & Co. KG
Copyright (C) 2014-2019 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
@@ -30,6 +30,10 @@

#include <api/glfs.h>

#if defined GLFS_FTRUNCATE_HAS_FOUR_ARGS
#define glfs_ftruncate(fd, offset) glfs_ftruncate(fd, offset, NULL, NULL)
#endif

namespace storagedaemon {

class gfapi_device : public Device {

0 comments on commit 2d789f0

Please sign in to comment.
You can’t perform that action at this time.