static bool dot_add_events(UAContext *ua, const char *cmd);
static int one_handler(void *ctx, int num_field, char **row);
-struct cmdstruct { const char *key; bool (*func)(UAContext *ua, const char *cmd); const char *help;const bool use_in_rs;};
-static struct cmdstruct commands[] = { /* help */ /* can be used in runscript */
+struct dcmd_struct { const char *key; bool (*func)(UAContext *ua, const char *cmd); const char *help;const bool use_in_rs;};
+static struct dcmd_struct commands[] = { /* help */ /* can be used in runscript */
{ NT_(".api"), api_cmd, NULL, false},
{ NT_(".backups"), backupscmd, NULL, false},
{ NT_(".clients"), clientscmd, NULL, true},
{ NT_(".query"), dot_querycmd, NULL, false},
{ NT_(".tags"), tagscmd, NULL, false}
};
-#define comsize ((int)(sizeof(commands)/sizeof(struct cmdstruct)))
+#define comsize ((int)(sizeof(commands)/sizeof(struct dcmd_struct)))
/*
* Execute a command from the UA
const char *plugin_type = "-fd.so";
#endif
-extern bool save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level);
+extern int save_file(JCR *jcr, FF_PKT *ff_pkt, bool top_level);
extern bool check_changes(JCR *jcr, FF_PKT *ff_pkt);
-extern int metadata_save(JCR *jcr, const plugin_metadata *plug_meta);
+extern bool metadata_save(JCR *jcr, const plugin_metadata *plug_meta);
/* Function pointers to be set here */
extern DLL_IMP_EXP int (*plugin_bopen)(BFILE *bfd, const char *fname, uint64_t flags, mode_t mode);
/* Memory allocation control structures and storage. */
-struct abufhead {
+struct sm_abufhead {
struct b_queue abq; /* Links on allocated queue */
uint32_t ablen; /* Buffer length in bytes */
const char *abfname; /* File name pointer */
static bool bufimode = false; /* Buffers not tracked when True */
-#define HEAD_SIZE BALIGN(sizeof(struct abufhead))
+#define HEAD_SIZE BALIGN(sizeof(struct sm_abufhead))
/* SMALLOC -- Allocate buffer, enqueing on the orphaned buffer
nbytes += HEAD_SIZE + 1;
if ((buf = (char *)malloc(nbytes)) != NULL) {
- struct abufhead *head = (struct abufhead *)buf;
+ struct sm_abufhead *head = (struct sm_abufhead *)buf;
P(mutex);
/* Enqueue buffer on allocated list */
qinsert(&abqueue, (struct b_queue *) buf);
{
buf -= HEAD_SIZE; /* Decrement to header */
P(mutex);
- ((struct abufhead *)buf)->abfname = bufimode ? NULL : fname;
- ((struct abufhead *)buf)->ablineno = (uint32_t) lineno;
- ((struct abufhead *)buf)->abin_use = true;
+ ((struct sm_abufhead *)buf)->abfname = bufimode ? NULL : fname;
+ ((struct sm_abufhead *)buf)->ablineno = (uint32_t) lineno;
+ ((struct sm_abufhead *)buf)->abin_use = true;
V(mutex);
return;
}
void sm_get_owner(int64_t dbglvl, char *buf)
{
/* Decrement to header */
- struct abufhead *h = (struct abufhead *) (buf - HEAD_SIZE);
+ struct sm_abufhead *h = (struct sm_abufhead *) (buf - HEAD_SIZE);
Dmsg3(dbglvl, "%p from %s:%d\n",
buf + HEAD_SIZE,
NPRT(h->abfname),
cp -= HEAD_SIZE;
qp = (struct b_queue *)cp;
- struct abufhead *head = (struct abufhead *)cp;
+ struct sm_abufhead *head = (struct sm_abufhead *)cp;
P(mutex);
Dmsg4(DT_MEMORY|1050, "sm_free %d at %p from %s:%d\n",
/* If the old and new sizes are the same, be a nice guy and just
return the buffer passed in. */
cp -= HEAD_SIZE;
- struct abufhead *head = (struct abufhead *)cp;
+ struct sm_abufhead *head = (struct sm_abufhead *)cp;
osize = head->ablen - (HEAD_SIZE + 1);
if (size == osize) {
return ptr;
*/
void sm_dump(bool bufdump, bool in_use)
{
- struct abufhead *ap;
+ struct sm_abufhead *ap;
P(mutex);
- ap = (struct abufhead *)abqueue.qnext;
+ ap = (struct sm_abufhead *)abqueue.qnext;
- while (ap != (struct abufhead *) &abqueue) {
+ while (ap != (struct sm_abufhead *) &abqueue) {
if ((ap == NULL) ||
(ap->abq.qnext->qprev != (struct b_queue *) ap) ||
Pmsg1(0, "%s\n", errmsg);
}
}
- ap = (struct abufhead *) ap->abq.qnext;
+ ap = (struct sm_abufhead *) ap->abq.qnext;
}
V(mutex);
}
/* SM_CHECK_RTN -- Check the buffers and return 1 if OK otherwise 0 */
int sm_check_rtn(const char *fname, int lineno, bool bufdump)
{
- struct abufhead *ap;
+ struct sm_abufhead *ap;
int bad, badbuf = 0;
P(mutex);
- ap = (struct abufhead *) abqueue.qnext;
- while (ap != (struct abufhead *)&abqueue) {
+ ap = (struct sm_abufhead *) abqueue.qnext;
+ while (ap != (struct sm_abufhead *)&abqueue) {
bad = 0;
if (ap != NULL) {
if (ap->abq.qnext->qprev != (struct b_queue *)ap) {
if (ap->abq.qprev->qnext != (struct b_queue *)ap) {
bad |= 0x2;
}
- if (((unsigned char *) ap)[((struct abufhead *)ap)->ablen - 1] !=
+ if (((unsigned char *) ap)[((struct sm_abufhead *)ap)->ablen - 1] !=
((((intptr_t) ap) & 0xFF) ^ 0xC5)) {
bad |= 0x4;
}
}
}
}
- ap = (struct abufhead *)ap->abq.qnext;
+ ap = (struct sm_abufhead *)ap->abq.qnext;
}
get_out:
V(mutex);
/* Commands received from director that need scanning */
static char storaddr[] = "storage address=%s port=%d ssl=%d Job=%127s Authentication=%127s";
-struct s_cmds {
+struct dir_cmds {
const char *cmd;
bool (*func)(JCR *jcr);
bool monitoraccess; /* set if monitors can access this cmd */
/*
* The following are the recognized commands from the Director.
*/
-static struct s_cmds cmds[] = {
+static struct dir_cmds cmds[] = {
{"JobId=", job_cmd, 0}, /* start Job */
{"autochanger", changer_cmd, 0},
{"bootstrap", bootstrap_cmd, 0},