Skip to content

Commit

Permalink
fixup: more review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Oct 15, 2019
1 parent 2ceca5c commit e0a88eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 17 deletions.
1 change: 0 additions & 1 deletion core/src/filed/status.cc
Expand Up @@ -448,7 +448,6 @@ bool QstatusCmd(JobControlRecord* jcr)
BareosSocket* dir = jcr->dir_bsock;
POOLMEM* cmd;
JobControlRecord* njcr;
RecentJobResultsList::JobResult* job;
StatusPacket sp;

sp.bs = dir;
Expand Down
15 changes: 3 additions & 12 deletions core/src/include/jcr.h
Expand Up @@ -48,6 +48,7 @@

#include "lib/alist.h"
#include "lib/tree.h"
#include "lib/volume_session_info.h"

class dlist;

Expand Down Expand Up @@ -679,24 +680,14 @@ extern void b_free_jcr(const char* file, int line, JobControlRecord* jcr);
typedef void(dbg_jcr_hook_t)(JobControlRecord* jcr, FILE* fp);
extern void DbgJcrAddHook(dbg_jcr_hook_t* fct);

struct SessionIdentifier {
uint32_t id_{0};
uint32_t time_{0};
SessionIdentifier(uint32_t id, uint32_t time) : id_(id), time_(time) {}
bool operator==(const SessionIdentifier& rhs) const
{
return id_ == rhs.id_ && time_ == rhs.time_;
}
};

/* new interface */
/* new-2019 interface */
void InitJcr(std::shared_ptr<JobControlRecord> jcr,
JCR_free_HANDLER* daemon_free_jcr);
std::size_t GetJcrCount();
std::shared_ptr<JobControlRecord> GetJcrById(uint32_t JobId);
std::shared_ptr<JobControlRecord> GetJcrByFullName(std::string name);
std::shared_ptr<JobControlRecord> GetJcrByPartialName(std::string name);
std::shared_ptr<JobControlRecord> GetJcrBySession(SessionIdentifier identifier);
std::shared_ptr<JobControlRecord> GetJcrBySession(const VolumeSessionInfo& vsi);
uint32_t GetJobIdByThreadId(pthread_t tid);
/* ************* */

Expand Down
7 changes: 3 additions & 4 deletions core/src/lib/jcr.cc
Expand Up @@ -543,11 +543,10 @@ std::shared_ptr<JobControlRecord> GetJcrByPartialName(std::string name)
});
}

std::shared_ptr<JobControlRecord> GetJcrBySession(SessionIdentifier identifier)
std::shared_ptr<JobControlRecord> GetJcrBySession(const VolumeSessionInfo& vsi)
{
return GetJcr([&identifier](const JobControlRecord* jcr) {
return (SessionIdentifier{jcr->VolSessionId, jcr->VolSessionTime} ==
identifier);
return GetJcr([&vsi](const JobControlRecord* jcr) {
return (VolumeSessionInfo{jcr->VolSessionId, jcr->VolSessionTime} == vsi);
});
}

Expand Down
4 changes: 4 additions & 0 deletions core/src/lib/volume_session_info.h
Expand Up @@ -30,6 +30,10 @@ struct VolumeSessionInfo {

/* explicit constructor disables default construction */
VolumeSessionInfo(uint32_t t_id, uint32_t t_time) : id(t_id), time(t_time) {}
bool operator==(const VolumeSessionInfo& rhs) const
{
return id == rhs.id && time == rhs.time;
}
};

#endif /** BAREOS_LIB_VOLUME_SESSION_INFO_H_ */

0 comments on commit e0a88eb

Please sign in to comment.