From 2bb43c6f362be7981361853173c751cae51e3f8e Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Mon, 10 Aug 2020 16:51:56 +0200 Subject: [PATCH 1/4] bareos.spec: remove termcap and libtermcap-devel --- core/platforms/packaging/bareos.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/platforms/packaging/bareos.spec b/core/platforms/packaging/bareos.spec index f8bc0e2c52c..0b46cbc8d44 100644 --- a/core/platforms/packaging/bareos.spec +++ b/core/platforms/packaging/bareos.spec @@ -234,7 +234,6 @@ BuildRequires: python-devel >= 2.6 BuildRequires: distribution-release BuildRequires: pwdutils BuildRequires: tcpd-devel -BuildRequires: termcap BuildRequires: update-desktop-files %if 0%{?suse_version} > 1010 @@ -247,7 +246,6 @@ BuildRequires: lsb-release %else # non suse -BuildRequires: libtermcap-devel BuildRequires: passwd # Some magic to be able to determine what platform we are running on. From 1aff4b608bddc50c61d15d95b505a81022108304 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Mon, 10 Aug 2020 17:14:41 +0200 Subject: [PATCH 2/4] bareos.spec: remove comments after %endif to avoid warnings --- core/platforms/packaging/bareos.spec | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/platforms/packaging/bareos.spec b/core/platforms/packaging/bareos.spec index 0b46cbc8d44..a61edaabb98 100644 --- a/core/platforms/packaging/bareos.spec +++ b/core/platforms/packaging/bareos.spec @@ -1350,7 +1350,8 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin %attr(0640, %{storage_daemon_user}, %{daemon_group}) %{_sysconfdir}/%{name}/bareos-sd.d/device/RadosStorage.conf.example %endif -%endif # not client_only +# not client_only +%endif %files filedaemon # fd package (bareos-fd, plugins) @@ -1531,8 +1532,8 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin /usr/share/pixmaps/bareos-tray-monitor.png %endif - -%endif # client_only +# client_only +%endif %files devel %defattr(-, root, root) @@ -1596,7 +1597,8 @@ mkdir -p %{?buildroot}/%{_libdir}/bareos/plugins/vmware_plugin %{plugin_dir}/BareosSdWrapper.py* %{plugin_dir}/bareos-sd-class-plugin.py* -%endif # python_plugins +# python_plugins +%endif %if 0%{?glusterfs} %files filedaemon-glusterfs-plugin From 34c9fd934ddb322bd2ffbacff0f17f83a82731a0 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Tue, 11 Aug 2020 10:35:56 +0200 Subject: [PATCH 3/4] ceph: detect ceph_statx symbol instead of ceph_statx.h As cephfs/ceph_statx.h does note exist anymore, we now check for the symbol ceph_statx instead of checking for the include file cephfs/ceph_statx.h. --- core/cmake/BareosCheckIncludes.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/cmake/BareosCheckIncludes.cmake b/core/cmake/BareosCheckIncludes.cmake index b8528ff2568..3e3d83b44c8 100644 --- a/core/cmake/BareosCheckIncludes.cmake +++ b/core/cmake/BareosCheckIncludes.cmake @@ -1,6 +1,6 @@ # BAREOSĀ® - Backup Archiving REcovery Open Sourced # -# Copyright (C) 2017-2019 Bareos GmbH & Co. KG +# Copyright (C) 2017-2020 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 @@ -60,7 +60,14 @@ check_include_files(sys/ea.h HAVE_SYS_EA_H) check_include_files(sys/proplist.h HAVE_SYS_PROPLIST_H) check_include_files(sys/xattr.h HAVE_SYS_XATTR_H) -check_include_files("sys/stat.h;cephfs/ceph_statx.h" HAVE_CEPHFS_CEPH_STATX_H) + +include(CheckSymbolExists) +include(CMakePushCheckState) +cmake_push_check_state() +set(CMAKE_REQUIRED_LIBRARIES cephfs) +check_symbol_exists(ceph_statx "sys/stat.h;cephfs/libcephfs.h" HAVE_CEPHFS_CEPH_STATX_H) +cmake_pop_check_state() + check_include_files(rados/librados.h HAVE_RADOS_LIBRADOS_H) check_include_files(radosstriper/libradosstriper.h HAVE_RADOSSTRIPER_LIBRADOSSTRIPER_H) From 410b8b34147eb7ae2516b1703ad39c5cc6a82a63 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Tue, 11 Aug 2020 14:09:25 +0200 Subject: [PATCH 4/4] rename HAVE_CEPHFS_CEPH_STATX_H to HAVE_CEPH_STATX as this is what we check for --- core/cmake/BareosCheckIncludes.cmake | 2 +- core/src/include/config.h.in | 2 +- core/src/plugins/filed/cephfs-fd.cc | 38 +++++++++++------------ core/src/stored/backends/cephfs_device.cc | 21 ++++++------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/core/cmake/BareosCheckIncludes.cmake b/core/cmake/BareosCheckIncludes.cmake index 3e3d83b44c8..897c9f16cde 100644 --- a/core/cmake/BareosCheckIncludes.cmake +++ b/core/cmake/BareosCheckIncludes.cmake @@ -65,7 +65,7 @@ include(CheckSymbolExists) include(CMakePushCheckState) cmake_push_check_state() set(CMAKE_REQUIRED_LIBRARIES cephfs) -check_symbol_exists(ceph_statx "sys/stat.h;cephfs/libcephfs.h" HAVE_CEPHFS_CEPH_STATX_H) +check_symbol_exists(ceph_statx "sys/stat.h;cephfs/libcephfs.h" HAVE_CEPH_STATX) cmake_pop_check_state() check_include_files(rados/librados.h HAVE_RADOS_LIBRADOS_H) diff --git a/core/src/include/config.h.in b/core/src/include/config.h.in index 22dd8db799e..fa1e707f8e8 100644 --- a/core/src/include/config.h.in +++ b/core/src/include/config.h.in @@ -114,7 +114,7 @@ extern char win_os[]; #cmakedefine HAVE_CEPHFS @HAVE_CEPHFS@ // Define to 1 if you have cephfs/ceph_stat_x.h header -#cmakedefine HAVE_CEPHFS_CEPH_STATX_H @HAVE_CEPHFS_CEPH_STATX_H@ +#cmakedefine HAVE_CEPH_STATX @HAVE_CEPH_STATX@ // Define to 1 if you have the `chflags' function #cmakedefine HAVE_CHFLAGS @HAVE_CHFLAGS@ diff --git a/core/src/plugins/filed/cephfs-fd.cc b/core/src/plugins/filed/cephfs-fd.cc index 79b6433239b..c58833097fc 100644 --- a/core/src/plugins/filed/cephfs-fd.cc +++ b/core/src/plugins/filed/cephfs-fd.cc @@ -2,7 +2,7 @@ BAREOSĀ® - Backup Archiving REcovery Open Sourced Copyright (C) 2014-2015 Planets Communications B.V. - Copyright (C) 2014-2015 Bareos GmbH & Co. KG + Copyright (C) 2014-2020 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 @@ -113,7 +113,7 @@ struct plugin_ctx { char* basedir; /* Basedir to start backup in */ char flags[FOPTS_BYTES]; /* Bareos internal flags */ int32_t type; /* FT_xx for this file */ -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx statx; /* Stat struct for next file to save */ #else struct stat statp; /* Stat struct for next file to save */ @@ -160,7 +160,7 @@ static plugin_argument plugin_arguments[] = { * a stack so we can pop it after we have processed the subdir. */ struct dir_stack_entry { -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx statx; /* Stat struct of directory */ #else struct stat statp; /* Stat struct of directory */ @@ -423,7 +423,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) * Pop the previous directory handle and continue processing that. */ entry = (struct dir_stack_entry*)p_ctx->dir_stack->pop(); -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX memcpy(&p_ctx->statx, &entry->statx, sizeof(p_ctx->statx)); #else memcpy(&p_ctx->statp, &entry->statp, sizeof(p_ctx->statp)); @@ -444,7 +444,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) * Loop until we know what file is next or when we are done. */ while (1) { -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX unsigned int stmask = 0; memset(&p_ctx->statx, 0, sizeof(p_ctx->statx)); status = @@ -463,7 +463,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) * No more entries in this directory ? */ if (status == 0) { -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX status = ceph_statx(p_ctx->cmount, p_ctx->cwd, &p_ctx->statx, CEPH_STATX_MODE, 0); #else @@ -514,7 +514,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) /* * Determine the FileType. */ -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX switch (p_ctx->statx.stx_mode & S_IFMT) { #else switch (p_ctx->statp.st_mode & S_IFMT) { @@ -548,7 +548,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) p_ctx->type = FT_SPEC; break; default: -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX Jmsg(ctx, M_FATAL, "cephfs-fd: Unknown filetype encountered %ld for %s\n", p_ctx->statx.stx_mode & S_IFMT, p_ctx->next_filename); @@ -568,7 +568,7 @@ static bRC get_next_file_to_backup(bpContext* ctx) sp.pkt_end = sizeof(sp); sp.fname = p_ctx->next_filename; sp.type = p_ctx->type; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX memcpy(&sp.statp, &p_ctx->statx, sizeof(sp.statp)); #else memcpy(&sp.statp, &p_ctx->statp, sizeof(sp.statp)); @@ -637,7 +637,7 @@ static bRC startBackupFile(bpContext* ctx, struct save_pkt* sp) new_entry = (struct dir_stack_entry*)malloc(sizeof(struct dir_stack_entry)); -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX memcpy(&new_entry->statx, &p_ctx->statx, sizeof(new_entry->statx)); #else memcpy(&new_entry->statp, &p_ctx->statp, sizeof(new_entry->statp)); @@ -664,7 +664,7 @@ static bRC startBackupFile(bpContext* ctx, struct save_pkt* sp) struct dir_stack_entry* entry; entry = (struct dir_stack_entry*)p_ctx->dir_stack->pop(); -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX memcpy(&p_ctx->statx, &entry->statx, sizeof(p_ctx->statx)); #else memcpy(&p_ctx->statp, &entry->statp, sizeof(p_ctx->statp)); @@ -734,7 +734,7 @@ static bRC startBackupFile(bpContext* ctx, struct save_pkt* sp) sp->fname = p_ctx->next_filename; sp->type = p_ctx->type; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX memcpy(&sp->statp, &p_ctx->statx, sizeof(sp->statp)); #else memcpy(&sp->statp, &p_ctx->statp, sizeof(sp->statp)); @@ -786,7 +786,7 @@ static bRC endBackupFile(bpContext* ctx) if (BitIsSet(FO_NOATIME, p_ctx->flags)) { struct utimbuf times; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX times.actime = p_ctx->statx.stx_atime.tv_sec; times.modtime = p_ctx->statx.stx_mtime.tv_sec; #else @@ -1224,7 +1224,7 @@ static bRC endRestoreFile(bpContext* ctx) { return bRC_OK; } static inline bool CephfsMakedirs(plugin_ctx* p_ctx, const char* directory) { char* bp; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx stx; #else struct stat st; @@ -1254,7 +1254,7 @@ static inline bool CephfsMakedirs(plugin_ctx* p_ctx, const char* directory) } else { *bp = '\0'; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX if (ceph_statx(p_ctx->cmount, new_directory.c_str(), &stx, CEPH_STATX_SIZE, AT_SYMLINK_NOFOLLOW) != 0) { #else @@ -1302,7 +1302,7 @@ static bRC createFile(bpContext* ctx, struct restore_pkt* rp) { int status; bool exists = false; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx stx; #else struct stat st; @@ -1315,7 +1315,7 @@ static bRC createFile(bpContext* ctx, struct restore_pkt* rp) * See if the file already exists. */ Dmsg(ctx, 400, "cephfs-fd: Replace=%c %d\n", (char)rp->replace, rp->replace); -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX status = ceph_statx(p_ctx->cmount, rp->ofname, &stx, CEPH_STATX_SIZE, AT_SYMLINK_NOFOLLOW); #else @@ -1326,7 +1326,7 @@ static bRC createFile(bpContext* ctx, struct restore_pkt* rp) switch (rp->replace) { case REPLACE_IFNEWER: -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX if (rp->statp.st_mtime <= stx.stx_mtime.tv_sec) { #else if (rp->statp.st_mtime <= st.st_mtime) { @@ -1338,7 +1338,7 @@ static bRC createFile(bpContext* ctx, struct restore_pkt* rp) } break; case REPLACE_IFOLDER: -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX if (rp->statp.st_mtime >= stx.stx_mtime.tv_sec) { #else if (rp->statp.st_mtime >= st.st_mtime) { diff --git a/core/src/stored/backends/cephfs_device.cc b/core/src/stored/backends/cephfs_device.cc index 8cab7b2990e..4b0f912d9ce 100644 --- a/core/src/stored/backends/cephfs_device.cc +++ b/core/src/stored/backends/cephfs_device.cc @@ -159,7 +159,7 @@ int cephfs_device::d_open(const char* pathname, int flags, int mode) * See if we store in an explicit directory. */ if (basedir_) { -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx stx; #else struct stat st; @@ -168,7 +168,7 @@ int cephfs_device::d_open(const char* pathname, int flags, int mode) /* * Make sure the dir exists if one is defined. */ -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX status = ceph_statx(cmount_, basedir_, &stx, CEPH_STATX_SIZE, AT_SYMLINK_NOFOLLOW); #else @@ -190,7 +190,7 @@ int cephfs_device::d_open(const char* pathname, int flags, int mode) goto bail_out; } } else { -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX if (!S_ISDIR(stx.stx_mode)) { #else if (!S_ISDIR(st.st_mode)) { @@ -291,7 +291,7 @@ boffset_t cephfs_device::d_lseek(DeviceControlRecord* dcr, bool cephfs_device::d_truncate(DeviceControlRecord* dcr) { int status; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX struct ceph_statx stx; #else struct stat st; @@ -317,7 +317,7 @@ bool cephfs_device::d_truncate(DeviceControlRecord* dcr) * 3. open new file with same mode * 4. change ownership to original */ -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX status = ceph_fstatx(cmount_, fd_, &stx, CEPH_STATX_MODE, 0); #else status = ceph_fstat(cmount_, fd_, &st); @@ -325,7 +325,7 @@ bool cephfs_device::d_truncate(DeviceControlRecord* dcr) if (status < 0) { BErrNo be; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX Mmsg2(errmsg, _("Unable to ceph_statx device %s. ERR=%s\n"), prt_name, be.bstrerror(-status)); #else @@ -336,7 +336,7 @@ bool cephfs_device::d_truncate(DeviceControlRecord* dcr) return false; } -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX if (stx.stx_size != 0) { /* ceph_ftruncate() didn't work */ #else if (st.st_size != 0) { /* ceph_ftruncate() didn't work */ @@ -348,7 +348,7 @@ bool cephfs_device::d_truncate(DeviceControlRecord* dcr) * Recreate the file -- of course, empty */ oflags = O_CREAT | O_RDWR | O_BINARY; -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX fd_ = ceph_open(cmount_, virtual_filename_, oflags, stx.stx_mode); #else fd_ = ceph_open(cmount_, virtual_filename_, oflags, st.st_mode); @@ -369,7 +369,7 @@ bool cephfs_device::d_truncate(DeviceControlRecord* dcr) /* * Reset proper owner */ -#if HAVE_CEPHFS_CEPH_STATX_H +#if HAVE_CEPH_STATX ceph_chown(cmount_, virtual_filename_, stx.stx_uid, stx.stx_gid); #else ceph_chown(cmount_, virtual_filename_, st.st_uid, st.st_gid); @@ -411,8 +411,7 @@ cephfs_device::cephfs_device() class Backend : public BackendInterface { public: - Device* GetDevice(JobControlRecord* jcr, - DeviceType device_type) override + Device* GetDevice(JobControlRecord* jcr, DeviceType device_type) override { switch (device_type) { case DeviceType::B_CEPHFS_DEV: