Skip to content

Commit

Permalink
fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pstorz authored and arogge committed Nov 2, 2022
1 parent a00f8fc commit d25ff29
Show file tree
Hide file tree
Showing 18 changed files with 144 additions and 94 deletions.
2 changes: 2 additions & 0 deletions core/src/dird/CMakeLists.txt
Expand Up @@ -173,7 +173,9 @@ if(HAVE_WIN32)
target_sources(
bareos-dir PRIVATE ../win32/generic/main.cc ../win32/generic/service.cc
)
target_link_options(bareos-dir PRIVATE -Wno-cast-function-type)
target_link_libraries(bareos-dir PRIVATE comctl32)
target_compile_options(bareos-dir PRIVATE -Wno-cast-function-type)
endif()

if(HAVE_NDMP)
Expand Down
4 changes: 2 additions & 2 deletions core/src/dird/ndmp_dma_backup_common.cc
@@ -1,7 +1,7 @@
/*
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2013-2019 Bareos GmbH & Co. KG
Copyright (C) 2013-2022 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
Expand Down Expand Up @@ -333,7 +333,7 @@ void NdmpBackupCleanup(JobControlRecord* jcr, int TermCode)

#else /* HAVE_NDMP */

void NdmpBackupCleanup(JobControlRecord* jcr, int TermCode)
void NdmpBackupCleanup(JobControlRecord* jcr, [[maybe_unused]] int TermCode)
{
Jmsg(jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/dird/ndmp_dma_generic.cc
Expand Up @@ -679,7 +679,9 @@ void DoNdmpClientStatus(UaContext* ua,
query_cbs);
}
#else
void DoNdmpClientStatus(UaContext* ua, ClientResource* client, char* cmd)
void DoNdmpClientStatus(UaContext* ua,
[[maybe_unused]] ClientResource* client,
[[maybe_unused]] char* cmd)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/dird/ndmp_dma_restore_common.cc
Expand Up @@ -230,7 +230,7 @@ void NdmpRestoreCleanup(JobControlRecord* jcr, int TermCode)

#else /* HAVE_NDMP */

void NdmpRestoreCleanup(JobControlRecord* jcr, int TermCode)
void NdmpRestoreCleanup(JobControlRecord* jcr, [[maybe_unused]] int TermCode)
{
Jmsg(jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
}
Expand Down
46 changes: 25 additions & 21 deletions core/src/dird/ndmp_dma_storage.cc
Expand Up @@ -1090,59 +1090,63 @@ bool ndmp_native_setup_robot_and_tape_for_native_backup_job(

#else
// Dummy entry points when NDMP not enabled.
void DoNdmpStorageStatus(UaContext* ua, StorageResource* store, char* cmd)
void DoNdmpStorageStatus(UaContext* ua,
[[maybe_unused]] StorageResource* store,
[[maybe_unused]] char* cmd)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
}

dlist<vol_list_t>* ndmp_get_vol_list(UaContext* ua,
StorageResource* store,
bool listall,
bool scan)
[[maybe_unused]] StorageResource* store,
[[maybe_unused]] bool listall,
[[maybe_unused]] bool scan)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return (dlist<vol_list_t>*)NULL;
}

slot_number_t NdmpGetNumSlots(UaContext* ua, StorageResource* store)
slot_number_t NdmpGetNumSlots(UaContext* ua,
[[maybe_unused]] StorageResource* store)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return 0;
}

drive_number_t NdmpGetNumDrives(UaContext* ua, StorageResource* store)
drive_number_t NdmpGetNumDrives(UaContext* ua,
[[maybe_unused]] StorageResource* store)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return 0;
}

bool NdmpTransferVolume(UaContext* ua,
StorageResource* store,
slot_number_t src_slot,
slot_number_t dst_slot)
[[maybe_unused]] StorageResource* store,
[[maybe_unused]] slot_number_t src_slot,
[[maybe_unused]] slot_number_t dst_slot)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return false;
}

bool NdmpAutochangerVolumeOperation(UaContext* ua,
StorageResource* store,
const char* operation,
drive_number_t drive,
slot_number_t slot)
[[maybe_unused]] StorageResource* store,
[[maybe_unused]] const char* operation,
[[maybe_unused]] drive_number_t drive,
[[maybe_unused]] slot_number_t slot)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return false;
}

bool NdmpSendLabelRequest(UaContext* ua,
StorageResource* store,
MediaDbRecord* mr,
MediaDbRecord* omr,
PoolDbRecord* pr,
bool relabel,
drive_number_t drive,
slot_number_t slot)
bool NdmpSendLabelRequest([[maybe_unused]] UaContext* ua,
[[maybe_unused]] StorageResource* store,
[[maybe_unused]] MediaDbRecord* mr,
[[maybe_unused]] MediaDbRecord* omr,
[[maybe_unused]] PoolDbRecord* pr,
[[maybe_unused]] bool relabel,
[[maybe_unused]] drive_number_t drive,
[[maybe_unused]] slot_number_t slot)
{
Jmsg(ua->jcr, M_FATAL, 0, _("NDMP protocol not supported\n"));
return false;
Expand Down
1 change: 1 addition & 0 deletions core/src/filed/CMakeLists.txt
Expand Up @@ -85,6 +85,7 @@ if(HAVE_WIN32)

target_compile_definitions(fd_objects PRIVATE ${FD_COMPILE_DEFINITIONS})
target_compile_definitions(bareos-fd PRIVATE ${FD_COMPILE_DEFINITIONS})
target_compile_options(fd_objects PRIVATE -Wno-cast-function-type)
endif()

target_link_libraries(
Expand Down
13 changes: 7 additions & 6 deletions core/src/filed/fd_plugins.cc
Expand Up @@ -1343,7 +1343,7 @@ bool PluginSetAttributes(JobControlRecord* jcr,

// Plugin specific callback for getting ACL information.
bacl_exit_code PluginBuildAclStreams(JobControlRecord* jcr,
AclData* acl_data,
[[maybe_unused]] AclData* acl_data,
[[maybe_unused]] FindFilesPacket* ff_pkt)
{
Plugin* plugin;
Expand Down Expand Up @@ -1387,11 +1387,12 @@ bacl_exit_code PluginBuildAclStreams(JobControlRecord* jcr,
}

// Plugin specific callback for setting ACL information.
bacl_exit_code plugin_parse_acl_streams(JobControlRecord* jcr,
AclData* acl_data,
[[maybe_unused]] int stream,
char* content,
uint32_t content_length)
bacl_exit_code plugin_parse_acl_streams(
JobControlRecord* jcr,
[[maybe_unused]] AclData* acl_data,
[[maybe_unused]] int stream,
[[maybe_unused]] char* content,
[[maybe_unused]] uint32_t content_length)
{
Plugin* plugin;

Expand Down
16 changes: 8 additions & 8 deletions core/src/findlib/acl.cc
Expand Up @@ -72,18 +72,18 @@
* Entry points when compiled without support for ACLs or on an unsupported
* platform.
*/
bacl_exit_code BuildAclStreams(JobControlRecord* jcr,
AclData* acl_data,
FindFilesPacket* ff_pkt)
bacl_exit_code BuildAclStreams([[maybe_unused]] JobControlRecord* jcr,
[[maybe_unused]] AclData* acl_data,
[[maybe_unused]] FindFilesPacket* ff_pkt)
{
return bacl_exit_fatal;
}

bacl_exit_code parse_acl_streams(JobControlRecord* jcr,
AclData* acl_data,
int stream,
char* content,
uint32_t content_length)
bacl_exit_code parse_acl_streams([[maybe_unused]] JobControlRecord* jcr,
[[maybe_unused]] AclData* acl_data,
[[maybe_unused]] int stream,
[[maybe_unused]] char* content,
[[maybe_unused]] uint32_t content_length)
{
return bacl_exit_fatal;
}
Expand Down
7 changes: 4 additions & 3 deletions core/src/findlib/attribs.cc
Expand Up @@ -186,9 +186,10 @@ int SelectDataStream(FindFilesPacket* ff_pkt, bool compatible)
}

// Restore all file attributes like owner, mode and file times.
static inline bool RestoreFileAttributes(JobControlRecord* jcr,
Attributes* attr,
BareosWinFilePacket* ofd)
static inline bool RestoreFileAttributes(
JobControlRecord* jcr,
Attributes* attr,
[[maybe_unused]] BareosWinFilePacket* ofd)
{
bool ok = true;
bool suppress_errors;
Expand Down
9 changes: 7 additions & 2 deletions core/src/findlib/find_one.cc
Expand Up @@ -94,7 +94,11 @@ static void FreeDirFfPkt(FindFilesPacket* dir_ff_pkt)
* If we do not have a list of file system types, we accept anything.
*/
#if defined(HAVE_WIN32)
static bool AcceptFstype(FindFilesPacket* ff, void* dummy) { return true; }
static bool AcceptFstype([[maybe_unused]] FindFilesPacket* ff,
[[maybe_unused]] void* dummy)
{
return true;
}
#else
static bool AcceptFstype(FindFilesPacket* ff, [[maybe_unused]] void* dummy)
{
Expand Down Expand Up @@ -128,7 +132,8 @@ static bool AcceptFstype(FindFilesPacket* ff, [[maybe_unused]] void* dummy)
* If we do not have a list of drive types, we accept anything.
*/
#if defined(HAVE_WIN32)
static inline bool AcceptDrivetype(FindFilesPacket* ff, void* dummy)
static inline bool AcceptDrivetype(FindFilesPacket* ff,
[[maybe_unused]] void* dummy)
{
int i;
char dt[100];
Expand Down
4 changes: 2 additions & 2 deletions core/src/findlib/mkpath.cc
Expand Up @@ -2,7 +2,7 @@
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
Copyright (C) 2016-2019 Bareos GmbH & Co. KG
Copyright (C) 2016-2022 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
Expand Down Expand Up @@ -51,7 +51,7 @@

static bool makedir(JobControlRecord* jcr,
char* path,
mode_t mode,
[[maybe_unused]] mode_t mode,
int* created)
{
struct stat statp;
Expand Down
2 changes: 1 addition & 1 deletion core/src/stored/CMakeLists.txt
Expand Up @@ -193,7 +193,6 @@ if(NOT ${HAVE_DYNAMIC_SD_BACKENDS})
endif()

add_library(stored_objects STATIC ${SDSRCS})

add_executable(bareos-sd stored.cc)

target_link_libraries(
Expand All @@ -204,6 +203,7 @@ target_link_libraries(
if(HAVE_WIN32)
target_sources(bareos-sd PRIVATE ../win32/generic/main.cc)
target_link_libraries(bareos-sd PRIVATE comctl32)
target_compile_options(stored_objects PRIVATE -Wno-cast-function-type)
endif()
if(HAVE_NDMP)
target_link_libraries(stored_objects PRIVATE bareosndmp)
Expand Down
4 changes: 2 additions & 2 deletions core/src/tools/bsmtp.cc
Expand Up @@ -188,7 +188,7 @@ static void usage()
* Same as timezone.tz_minuteswest
* Unix TzOffset coded by: Attila Fülöp
*/
static long TzOffset(time_t lnow, struct tm& tm)
static long TzOffset([[maybe_unused]] time_t lnow, struct tm& tm)
{
#if defined(HAVE_WIN32)
# if defined(HAVE_MINGW)
Expand Down Expand Up @@ -455,8 +455,8 @@ int main(int argc, char* argv[])
s = WSASocket(rp->ai_family, rp->ai_socktype, rp->ai_protocol, NULL, 0, 0);
# else
s = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
# endif
if (s < 0) { continue; }
# endif

if (connect(s, rp->ai_addr, rp->ai_addrlen) != -1) { break; }

Expand Down
2 changes: 1 addition & 1 deletion core/src/win32/findlib/win32.cc
Expand Up @@ -558,7 +558,7 @@ static void* copy_thread(void* data)

// Create a copy thread that restores the EFS data.
static inline bool SetupCopyThread(JobControlRecord* jcr,
BareosWinFilePacket* bfd)
[[maybe_unused]] BareosWinFilePacket* bfd)
{
int nr_save_elements;
CopyThreadContext* new_context;
Expand Down
33 changes: 23 additions & 10 deletions core/src/win32/plugins/filed/mssqlvdi-fd.cc
Expand Up @@ -3,7 +3,7 @@
Copyright (C) 2010 Zilvinas Krapavickas <zkrapavickas@gmail.com>
Copyright (C) 2013-2014 Planets Communications B.V.
Copyright (C) 2013-2020 Bareos GmbH & Co. KG
Copyright (C) 2013-2022 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
Expand Down Expand Up @@ -123,7 +123,7 @@ static PluginFunctions pluginFuncs
freePlugin, /* free plugin instance */
getPluginValue, setPluginValue, handlePluginEvent, startBackupFile,
endBackupFile, startRestoreFile, endRestoreFile, pluginIO, createFile,
setFileAttributes, checkFile};
setFileAttributes, checkFile, nullptr, nullptr, nullptr, nullptr};

// Plugin private context
struct plugin_ctx {
Expand Down Expand Up @@ -316,13 +316,17 @@ static bRC freePlugin(PluginContext* ctx)
}

// Return some plugin value (none defined)
static bRC getPluginValue(PluginContext* ctx, pVariable var, void* value)
static bRC getPluginValue([[maybe_unused]] PluginContext* ctx,
[[maybe_unused]] pVariable var,
[[maybe_unused]] void* value)
{
return bRC_OK;
}

// Set a plugin value (none defined)
static bRC setPluginValue(PluginContext* ctx, pVariable var, void* value)
static bRC setPluginValue([[maybe_unused]] PluginContext* ctx,
[[maybe_unused]] pVariable var,
[[maybe_unused]] void* value)
{
return bRC_OK;
}
Expand Down Expand Up @@ -433,7 +437,7 @@ static bRC startBackupFile(PluginContext* ctx, struct save_pkt* sp)
}

// Done with backup of this file
static bRC endBackupFile(PluginContext* ctx)
static bRC endBackupFile([[maybe_unused]] PluginContext* ctx)
{
/*
* We would return bRC_More if we wanted startBackupFile to be called again to
Expand Down Expand Up @@ -1604,7 +1608,7 @@ static bRC pluginIO(PluginContext* ctx, struct io_pkt* io)
}

// See if we need to do any postprocessing after the restore.
static bRC end_restore_job(PluginContext* ctx, void* value)
static bRC end_restore_job(PluginContext* ctx, [[maybe_unused]] void* value)
{
bRC retval = bRC_OK;
plugin_ctx* p_ctx = (plugin_ctx*)ctx->plugin_private_context;
Expand All @@ -1626,7 +1630,8 @@ static bRC end_restore_job(PluginContext* ctx, void* value)
* Bareos is notifying us that a plugin name string was found,
* and passing us the plugin command, so we can prepare for a restore.
*/
static bRC startRestoreFile(PluginContext* ctx, const char* cmd)
static bRC startRestoreFile([[maybe_unused]] PluginContext* ctx,
[[maybe_unused]] const char* cmd)
{
return bRC_OK;
}
Expand All @@ -1635,7 +1640,10 @@ static bRC startRestoreFile(PluginContext* ctx, const char* cmd)
* Bareos is notifying us that the plugin data has terminated,
* so the restore for this particular file is done.
*/
static bRC endRestoreFile(PluginContext* ctx) { return bRC_OK; }
static bRC endRestoreFile([[maybe_unused]] PluginContext* ctx)
{
return bRC_OK;
}

/**
* This is called during restore to create the file (if necessary) We must
Expand Down Expand Up @@ -1668,12 +1676,17 @@ static bRC createFile(PluginContext* ctx, struct restore_pkt* rp)
* We will get here if the File is a directory after everything is written in
* the directory.
*/
static bRC setFileAttributes(PluginContext* ctx, struct restore_pkt* rp)
static bRC setFileAttributes([[maybe_unused]] PluginContext* ctx,
[[maybe_unused]] struct restore_pkt* rp)
{
return bRC_OK;
}

// When using Incremental dump, all previous dumps are necessary
static bRC checkFile(PluginContext* ctx, char* fname) { return bRC_OK; }
static bRC checkFile([[maybe_unused]] PluginContext* ctx,
[[maybe_unused]] char* fname)
{
return bRC_OK;
}

} /* namespace filedaemon */

0 comments on commit d25ff29

Please sign in to comment.