/* Define to 1 if you have the `tcgetattr' function. */
#undef HAVE_TCGETATTR
+/* Define to 1 if you have the <termcap.h> header file. */
+#undef HAVE_TERMCAP_H
+
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
stdint.h \
string.h \
termios.h \
+ termcap.h \
unistd.h \
sys/bitypes.h \
sys/byteorder.h \
+
for ac_header in \
stdint.h \
string.h \
termios.h \
+ termcap.h \
unistd.h \
sys/bitypes.h \
sys/byteorder.h \
========================================================
1.35 Items to do for release:
-- Find memory leaks in address_conf.c
-- Network order of port and ip addresses.
-- SetIP in dird/fd_cmds.c is broken.
-- don't use inet_addr() it is deprecated.
-- Fix code in filed.c for init_bsock();
-- Fix code in console.c for init_bsock();
-
-
- Knoppix CDROM
-- Make Verify jobs require exclusive use of Volume as Restore
- jobs do.
- Perhaps add read/write programs and/or plugins to FileSets.
- Add new DCR calling sequences everywhere in SD. This will permit
simultaneous use of multiple devices by a single job.
- Fix restore ++++ that get intermingled with "Building directory tree"
-- Solve the termcap.h problem on Solaris configure.
- Test Win32 errno handling.
non-existent directories will not be restored properly.
Wish list:
+- Fix restore jobs so that multiple jobs can run if they
+ are not using the same tape(s).
- Allow the user to select JobType for manual pruning/purging.
- Look at adding Client run command that will use the
port opened by the client.
- When passwords do not match, print message that points the
user to the doc.
- Do tape alerts -- see tapealert.txt
+- Find memory leaks in address_conf.c
+- Network order of port and ip addresses.
+- SetIP in dird/fd_cmds.c is broken.
+- don't use inet_addr() it is deprecated.
+- Fix code in filed.c for init_bsock();
+- Fix code in console.c for init_bsock();
+- Solve the termcap.h problem on Solaris configure.
+- Make Verify jobs require exclusive use of Volume as Restore
+ jobs do.
/* Bacula common configuration defines */
-#undef TRUE
-#undef FALSE
+#undef TRUE
+#undef FALSE
#define TRUE 1
#define FALSE 0
#endif
#ifdef PROTOTYPES
-# define __PROTO(p) p
+# define __PROTO(p) p
#else
-# define __PROTO(p) ()
+# define __PROTO(p) ()
#endif
#ifdef DEBUG
#define DEFAULT_NETWORK_BUFFER_SIZE (32 * 1024)
/*
- * Stream definitions. Once defined these must NEVER
+ * Stream definitions. Once defined these must NEVER
* change as they go on the storage media.
* Note, the following streams are passed from the SD to the DIR
* so that they may be put into the catalog (actually only the
* STREAM_MD5_SIGNATURE
* STREAM_SHA1_SIGNATURE
*/
-#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
-#define STREAM_FILE_DATA 2 /* Standard uncompressed data */
-#define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */
-#define STREAM_GZIP_DATA 4 /* GZip compressed file data */
+#define STREAM_UNIX_ATTRIBUTES 1 /* Generic Unix attributes */
+#define STREAM_FILE_DATA 2 /* Standard uncompressed data */
+#define STREAM_MD5_SIGNATURE 3 /* MD5 signature for the file */
+#define STREAM_GZIP_DATA 4 /* GZip compressed file data */
/* Extended Unix attributes with Win32 Extended data. Deprecated. */
#define STREAM_UNIX_ATTRIBUTES_EX 5 /* Extended Unix attr for Win32 EX */
-#define STREAM_SPARSE_DATA 6 /* Sparse data stream */
+#define STREAM_SPARSE_DATA 6 /* Sparse data stream */
#define STREAM_SPARSE_GZIP_DATA 7
-#define STREAM_PROGRAM_NAMES 8 /* program names for program data */
-#define STREAM_PROGRAM_DATA 9 /* Data needing program */
-#define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */
-#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
-#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
-#define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
+#define STREAM_PROGRAM_NAMES 8 /* program names for program data */
+#define STREAM_PROGRAM_DATA 9 /* Data needing program */
+#define STREAM_SHA1_SIGNATURE 10 /* SHA1 signature for the file */
+#define STREAM_WIN32_DATA 11 /* Win32 BackupRead data */
+#define STREAM_WIN32_GZIP_DATA 12 /* Gzipped Win32 BackupRead data */
+#define STREAM_MACOS_FORK_DATA 13 /* Mac resource fork */
#define STREAM_HFSPLUS_ATTRIBUTES 14 /* Mac OS extra attributes */
#define STREAM_UNIX_ATTRIBUTES_ACL 15 /* ACL attributes on UNIX */
/*
- * File type (Bacula defined).
+ * File type (Bacula defined).
* NOTE!!! These are saved in the Attributes record on the tape, so
- * do not change them. If need be, add to them.
+ * do not change them. If need be, add to them.
*
* This is stored as 32 bits on tape, but only FT_MASK bits are
* used for the file type. The upper bits are used to indicate
* additional optional fields in the attribute record.
*/
-#define FT_MASK 0xFFFF /* Bits used by FT (type) */
-#define FT_LNKSAVED 1 /* hard link to file already saved */
-#define FT_REGE 2 /* Regular file but empty */
-#define FT_REG 3 /* Regular file */
-#define FT_LNK 4 /* Soft Link */
-#define FT_DIREND 5 /* Directory at end (saved) */
-#define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
-#define FT_NOACCESS 7 /* Not able to access */
-#define FT_NOFOLLOW 8 /* Could not follow link */
-#define FT_NOSTAT 9 /* Could not stat file */
-#define FT_NOCHG 10 /* Incremental option, file not changed */
-#define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
-#define FT_ISARCH 12 /* Trying to save archive file */
-#define FT_NORECURSE 13 /* No recursion into directory */
-#define FT_NOFSCHG 14 /* Different file system, prohibited */
-#define FT_NOOPEN 15 /* Could not open directory */
-#define FT_RAW 16 /* Raw block device */
-#define FT_FIFO 17 /* Raw fifo device */
+#define FT_MASK 0xFFFF /* Bits used by FT (type) */
+#define FT_LNKSAVED 1 /* hard link to file already saved */
+#define FT_REGE 2 /* Regular file but empty */
+#define FT_REG 3 /* Regular file */
+#define FT_LNK 4 /* Soft Link */
+#define FT_DIREND 5 /* Directory at end (saved) */
+#define FT_SPEC 6 /* Special file -- chr, blk, fifo, sock */
+#define FT_NOACCESS 7 /* Not able to access */
+#define FT_NOFOLLOW 8 /* Could not follow link */
+#define FT_NOSTAT 9 /* Could not stat file */
+#define FT_NOCHG 10 /* Incremental option, file not changed */
+#define FT_DIRNOCHG 11 /* Incremental option, directory not changed */
+#define FT_ISARCH 12 /* Trying to save archive file */
+#define FT_NORECURSE 13 /* No recursion into directory */
+#define FT_NOFSCHG 14 /* Different file system, prohibited */
+#define FT_NOOPEN 15 /* Could not open directory */
+#define FT_RAW 16 /* Raw block device */
+#define FT_FIFO 17 /* Raw fifo device */
/* This directory packet is sent to the FD file processing routine so
* that it can filter packets, but otherwise, it is not used
* or saved */
-#define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
+#define FT_DIRBEGIN 18 /* Directory at beginning (not saved) */
/* Definitions for upper part of type word (see above). */
-#define AR_DATA_STREAM (1<<16) /* Data stream id present */
+#define AR_DATA_STREAM (1<<16) /* Data stream id present */
/*
* Internal code for Signature types
*/
-#define NO_SIG 0
+#define NO_SIG 0
#define MD5_SIG 1
#define SHA1_SIG 2
*/
/* Debug Messages that are printed */
#ifdef DEBUG
-#define Dmsg0(lvl, msg) d_msg(__FILE__, __LINE__, lvl, msg)
-#define Dmsg1(lvl, msg, a1) d_msg(__FILE__, __LINE__, lvl, msg, a1)
+#define Dmsg0(lvl, msg) d_msg(__FILE__, __LINE__, lvl, msg)
+#define Dmsg1(lvl, msg, a1) d_msg(__FILE__, __LINE__, lvl, msg, a1)
#define Dmsg2(lvl, msg, a1, a2) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
#define Dmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
#define Dmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
#endif /* DEBUG */
#ifdef TRACE_FILE
-#define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
-#define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
+#define Tmsg0(lvl, msg) t_msg(__FILE__, __LINE__, lvl, msg)
+#define Tmsg1(lvl, msg, a1) t_msg(__FILE__, __LINE__, lvl, msg, a1)
#define Tmsg2(lvl, msg, a1, a2) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
#define Tmsg3(lvl, msg, a1, a2, a3) t_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
#define Tmsg4(lvl, msg, arg1, arg2, arg3, arg4) t_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
/* Messages that are printed (uses d_msg) */
-#define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
-#define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
+#define Pmsg0(lvl, msg) p_msg(__FILE__, __LINE__, lvl, msg)
+#define Pmsg1(lvl, msg, a1) p_msg(__FILE__, __LINE__, lvl, msg, a1)
#define Pmsg2(lvl, msg, a1, a2) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2)
#define Pmsg3(lvl, msg, a1, a2, a3) p_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3)
#define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) p_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4)
/* Daemon Error Messages that are delivered according to the message resource */
-#define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
-#define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
-#define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
+#define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg)
+#define Emsg1(typ, lvl, msg, a1) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1)
+#define Emsg2(typ, lvl, msg, a1, a2) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2)
#define Emsg3(typ, lvl, msg, a1, a2, a3) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3)
#define Emsg4(typ, lvl, msg, a1, a2, a3, a4) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4)
#define Emsg5(typ, lvl, msg, a1, a2, a3, a4, a5) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5)
#define Emsg6(typ, lvl, msg, a1, a2, a3, a4, a5, a6) e_msg(__FILE__, __LINE__, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
/* Job Error Messages that are delivered according to the message resource */
-#define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
-#define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
+#define Jmsg0(jcr, typ, lvl, msg) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
+#define Jmsg1(jcr, typ, lvl, msg, a1) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
#define Jmsg2(jcr, typ, lvl, msg, a1, a2) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
#define Jmsg3(jcr, typ, lvl, msg, a1, a2, a3) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
#define Jmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
#define Jmsg6(jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6) j_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4, a5, a6)
/* Queued Job Error Messages that are delivered according to the message resource */
-#define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
-#define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
+#define Qmsg0(jcr, typ, lvl, msg) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg)
+#define Qmsg1(jcr, typ, lvl, msg, a1) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1)
#define Qmsg2(jcr, typ, lvl, msg, a1, a2) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2)
#define Qmsg3(jcr, typ, lvl, msg, a1, a2, a3) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3)
#define Qmsg4(jcr, typ, lvl, msg, a1, a2, a3, a4) q_msg(__FILE__, __LINE__, jcr, typ, lvl, msg, a1, a2, a3, a4)
/* Memory Messages that are edited into a Pool Memory buffer */
-#define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
-#define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
+#define Mmsg0(buf, msg) m_msg(__FILE__, __LINE__, buf, msg)
+#define Mmsg1(buf, msg, a1) m_msg(__FILE__, __LINE__, buf, msg, a1)
#define Mmsg2(buf, msg, a1, a2) m_msg(__FILE__, __LINE__, buf, msg, a1, a2)
#define Mmsg3(buf, msg, a1, a2, a3) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3)
#define Mmsg4(buf, msg, a1, a2, a3, a4) m_msg(__FILE__, __LINE__, buf, msg, a1, a2, a3, a4)
/* Edit message into Pool Memory buffer -- no __FILE__ and __LINE__ */
int Mmsg(POOLMEM **msgbuf, const char *fmt,...);
+int Mmsg(POOLMEM *&msgbuf, const char *fmt,...);
struct JCR;
void j_msg(const char *file, int line, JCR *jcr, int type, int level, const char *fmt,...);
void q_msg(const char *file, int line, JCR *jcr, int type, int level, const char *fmt,...);
int m_msg(const char *file, int line, POOLMEM **msgbuf, const char *fmt,...);
+int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...);
/* Use our strdup with smartalloc */
} else {
sep = '/';
}
- Mmsg(&dbf, "%s%c%s-%s", working_directory, sep, mdb->db_name, name);
+ Mmsg(dbf, "%s%c%s-%s", working_directory, sep, mdb->db_name, name);
return dbf;
}
fseek(mdb->poolfd, 0L, SEEK_SET); /* rewind file */
len = sizeof(pr);
while (fread(&pr, len, 1, mdb->poolfd) > 0) {
- Mmsg(&mdb->cmd, " %7d %6d %6d %-10s %s\n",
+ Mmsg(mdb->cmd, " %7d %6d %6d %-10s %s\n",
pr.PoolId, pr.NumVols, pr.MaxVols, pr.PoolType, pr.Name);
sendit(ctx, mdb->cmd);
}
fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */
len = sizeof(mr);
while (fread(&mr, len, 1, mdb->mediafd) > 0) {
- Mmsg(&mdb->cmd, " %-10s %17s %-15s %s\n",
+ Mmsg(mdb->cmd, " %-10s %17s %-15s %s\n",
mr.VolStatus, edit_uint64_with_commas(mr.VolBytes, ewc),
mr.MediaType, mr.VolumeName);
sendit(ctx, mdb->cmd);
fseek(mdb->mediafd, 0L, SEEK_SET);
while (fread(&mr, mrlen, 1, mdb->mediafd) > 0) {
if (mr.MediaId == jm.MediaId) {
- Mmsg(&mdb->cmd, " %7d %-10s %10d %10d\n",
+ Mmsg(mdb->cmd, " %7d %-10s %10d %10d\n",
jm.JobId, mr.VolumeName, jm.FirstIndex, jm.LastIndex);
sendit(ctx, mdb->cmd);
break;
fseek(mdb->mediafd, 0L, SEEK_SET);
while (fread(&mr, mrlen, 1, mdb->mediafd) > 0) {
if (mr.MediaId == jm.MediaId) {
- Mmsg(&mdb->cmd, " %7d %-10s %10d %10d\n",
+ Mmsg(mdb->cmd, " %7d %-10s %10d %10d\n",
jm.JobId, mr.VolumeName, jm.FirstIndex, jm.LastIndex);
sendit(ctx, mdb->cmd);
break;
}
localtime_r(&ojr.StartTime, &tm);
strftime(dt, sizeof(dt), "%m-%d %H:%M", &tm);
- Mmsg(&mdb->cmd, " %7d %-10s %c %c %14s %10s %c %s\n",
- ojr.JobId, dt, (char)ojr.Type, (char)ojr.Level,
+ Mmsg(mdb->cmd, " %7d %-10s %c %c %14s %10s %c %s\n",
+ ojr.JobId, dt, (char)ojr.JobType, (char)ojr.JobLevel,
edit_uint64_with_commas(ojr.JobBytes, ewc1),
edit_uint64_with_commas(ojr.JobFiles, ewc2),
(char)ojr.JobStatus, ojr.Name);
total_bytes += ojr.JobBytes;
total_jobs++;
}
- Mmsg(&mdb->cmd, " %7s %10s %15s\n",
+ Mmsg(mdb->cmd, " %7s %10s %15s\n",
edit_uint64_with_commas(total_jobs, ewc1),
edit_uint64_with_commas(total_files, ewc2),
edit_uint64_with_commas(total_bytes, ewc3));
fseek(mdb->jobfd, ojr.rec_addr, SEEK_SET);
if (fwrite(jr, len, 1, mdb->jobfd) != 1) {
- Mmsg1(&mdb->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno));
+ Mmsg1(mdb->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno));
stat = 0;
}
fflush(mdb->jobfd);
fseek(mdb->jobfd, ojr.rec_addr, SEEK_SET);
if (fwrite(jr, len, 1, mdb->jobfd) != 1) {
- Mmsg1(&mdb->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno));
+ Mmsg1(&db->errmsg, _("Error updating DB Job file. ERR=%s\n"), strerror(errno));
stat = 0;
}
fflush(mdb->jobfd);
fseek(mdb->mediafd, omr.rec_addr, SEEK_SET);
if (fwrite(mr, len, 1, mdb->mediafd) != 1) {
- Mmsg1(&mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno));
+ Mmsg1(mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno));
stat = 0;
}
fflush(mdb->mediafd);
fseek(mdb->poolfd, opr.rec_addr, SEEK_SET);
if (fwrite(&opr, len, 1, mdb->poolfd) != 1) {
- Mmsg1(&mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno));
+ Mmsg1(mdb->errmsg, _("Error updating DB Media file. ERR=%s\n"), strerror(errno));
stat = 0;
} else {
memcpy(pr, &opr, len); /* return record written */
db_lock(mdb);
if (sql_query(mdb, query) != 0) {
- Mmsg(&mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
db_unlock(mdb);
return 0;
}
db_lock(mdb);
if (sql_query(mdb, query) != 0) {
- Mmsg(&mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
db_unlock(mdb);
Dmsg0(500, "db_sql_query failed\n");
return 0;
bstrncat(sequence, "_seq", sizeof(sequence));
bsnprintf(query, sizeof(query), "SELECT currval('%s')", sequence);
-// Mmsg(&query, "SELECT currval('%s')", sequence);
+// Mmsg(query, "SELECT currval('%s')", sequence);
Dmsg1(500, "my_postgresql_currval invoked with '%s'\n", query);
result = PQexec(mdb->db, query);
bacula_db_version = 0;
db_sql_query(mdb, query, int_handler, (void *)&bacula_db_version);
if (bacula_db_version != BDB_VERSION) {
- Mmsg(&mdb->errmsg, "Version error for database \"%s\". Wanted %d, got %d\n",
+ Mmsg(mdb->errmsg, "Version error for database \"%s\". Wanted %d, got %d\n",
mdb->db_name, BDB_VERSION, bacula_db_version);
Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
return 0;
JobTDate = (utime_t)stime;
/* Must create it */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"INSERT INTO Job (Job,Name,Type,Level,JobStatus,SchedTime,JobTDate) VALUES \
('%s','%s','%c','%c','%c','%s',%s)",
jr->Job, jr->Name, (char)(jr->JobType), (char)(jr->JobLevel),
db_lock(mdb);
#ifdef not_used_in_new_code
- Mmsg(&mdb->cmd, "SELECT JobId, MediaId FROM JobMedia WHERE \
+ Mmsg(mdb->cmd, "SELECT JobId, MediaId FROM JobMedia WHERE \
JobId=%d AND MediaId=%d", jm->JobId, jm->MediaId);
Dmsg0(300, mdb->cmd);
#endif
/* Now get count for VolIndex */
- Mmsg(&mdb->cmd, "SELECT count(*) from JobMedia");
+ Mmsg(mdb->cmd, "SELECT count(*) from JobMedia");
count = get_sql_record_max(jcr, mdb);
if (count < 0) {
count = 0;
count++;
/* Must create it */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"INSERT INTO JobMedia (JobId,MediaId,FirstIndex,LastIndex,\
StartFile,EndFile,StartBlock,EndBlock,VolIndex) \
VALUES (%u,%u,%u,%u,%u,%u,%u,%u,%u)",
Dmsg0(200, "In create pool\n");
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT PoolId,Name FROM Pool WHERE Name='%s'", pr->Name);
+ Mmsg(mdb->cmd, "SELECT PoolId,Name FROM Pool WHERE Name='%s'", pr->Name);
Dmsg1(200, "selectpool: %s\n", mdb->cmd);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
}
/* Must create it */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"INSERT INTO Pool (Name,NumVols,MaxVols,UseOnce,UseCatalog,\
AcceptAnyVolume,AutoPrune,Recycle,VolRetention,VolUseDuration,\
MaxVolJobs,MaxVolFiles,MaxVolBytes,PoolType,LabelFormat) \
struct tm tm;
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT MediaId FROM Media WHERE VolumeName='%s'",
+ Mmsg(mdb->cmd, "SELECT MediaId FROM Media WHERE VolumeName='%s'",
mr->VolumeName);
Dmsg1(300, "selectpool: %s\n", mdb->cmd);
}
/* Must create it */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"INSERT INTO Media (VolumeName,MediaType,PoolId,MaxVolBytes,VolCapacityBytes,"
"Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
"VolStatus,Slot,VolBytes,InChanger,VolReadTime,VolWriteTime) "
char dt[MAX_TIME_LENGTH];
localtime_r(&mr->LabelDate, &tm);
strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
- Mmsg(&mdb->cmd, "UPDATE Media SET LabelDate='%s' "
+ Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
"WHERE MediaId=%d", dt, mr->MediaId);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
}
char ed1[30], ed2[30];
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT ClientId,Uname FROM Client WHERE Name='%s'", cr->Name);
+ Mmsg(mdb->cmd, "SELECT ClientId,Uname FROM Client WHERE Name='%s'", cr->Name);
cr->ClientId = 0;
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
}
/* Must create it */
- Mmsg(&mdb->cmd, "INSERT INTO Client (Name, Uname, AutoPrune, \
+ Mmsg(mdb->cmd, "INSERT INTO Client (Name, Uname, AutoPrune, \
FileRetention, JobRetention) VALUES \
('%s', '%s', %d, %s, %s)", cr->Name, cr->Uname, cr->AutoPrune,
edit_uint64(cr->FileRetention, ed1),
}
/* Must create it */
- Mmsg(&mdb->cmd, "INSERT INTO Counters (Counter,MinValue,MaxValue,CurrentValue,"
+ Mmsg(mdb->cmd, "INSERT INTO Counters (Counter,MinValue,MaxValue,CurrentValue,"
"WrapCounter) VALUES ('%s','%d','%d','%d','%s')",
cr->Counter, cr->MinValue, cr->MaxValue, cr->CurrentValue,
cr->WrapCounter);
db_lock(mdb);
fsr->created = false;
- Mmsg(&mdb->cmd, "SELECT FileSetId,CreateTime FROM FileSet WHERE "
+ Mmsg(mdb->cmd, "SELECT FileSetId,CreateTime FROM FileSet WHERE "
"FileSet='%s' AND MD5='%s'", fsr->FileSet, fsr->MD5);
fsr->FileSetId = 0;
strftime(fsr->cCreateTime, sizeof(fsr->cCreateTime), "%Y-%m-%d %T", &tm);
/* Must create it */
- Mmsg(&mdb->cmd, "INSERT INTO FileSet (FileSet,MD5,CreateTime) "
+ Mmsg(mdb->cmd, "INSERT INTO FileSet (FileSet,MD5,CreateTime) "
"VALUES ('%s','%s','%s')", fsr->FileSet, fsr->MD5, fsr->cCreateTime);
if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
ASSERT(ar->FilenameId);
/* Must create it */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"INSERT INTO File (FileIndex,JobId,PathId,FilenameId,"
"LStat,MD5) VALUES (%u,%u,%u,%u,'%s','0')",
ar->FileIndex, ar->JobId, ar->PathId, ar->FilenameId,
return 1;
}
- Mmsg(&mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
+ Mmsg(mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
sql_free_result(mdb);
}
- Mmsg(&mdb->cmd, "INSERT INTO Path (Path) VALUES ('%s')", mdb->esc_name);
+ Mmsg(mdb->cmd, "INSERT INTO Path (Path) VALUES ('%s')", mdb->esc_name);
if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
Mmsg2(&mdb->errmsg, _("Create db Path record %s failed. ERR=%s\n"),
mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->fnl+2);
db_escape_string(mdb->esc_name, mdb->fname, mdb->fnl);
- Mmsg(&mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
+ Mmsg(mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
sql_free_result(mdb);
}
- Mmsg(&mdb->cmd, "INSERT INTO Filename (Name) VALUES ('%s')", mdb->esc_name);
+ Mmsg(mdb->cmd, "INSERT INTO Filename (Name) VALUES ('%s')", mdb->esc_name);
if (!INSERT_DB(jcr, mdb, mdb->cmd)) {
Mmsg2(&mdb->errmsg, _("Create db Filename record %s failed. ERR=%s\n"),
SQL_ROW row;
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT PoolId FROM Pool WHERE Name='%s'", pr->Name);
+ Mmsg(mdb->cmd, "SELECT PoolId FROM Pool WHERE Name='%s'", pr->Name);
Dmsg1(10, "selectpool: %s\n", mdb->cmd);
pr->PoolId = pr->NumVols = 0;
mdb->num_rows = sql_num_rows(mdb);
if (mdb->num_rows == 0) {
- Mmsg(&mdb->errmsg, _("No pool record %s exists\n"), pr->Name);
+ Mmsg(mdb->errmsg, _("No pool record %s exists\n"), pr->Name);
sql_free_result(mdb);
db_unlock(mdb);
return 0;
} else if (mdb->num_rows != 1) {
- Mmsg(&mdb->errmsg, _("Expecting one pool record, got %d\n"), mdb->num_rows);
+ Mmsg(mdb->errmsg, _("Expecting one pool record, got %d\n"), mdb->num_rows);
sql_free_result(mdb);
db_unlock(mdb);
return 0;
}
/* Delete Media owned by this pool */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"DELETE FROM Media WHERE Media.PoolId = %d", pr->PoolId);
pr->NumVols = DELETE_DB(jcr, mdb, mdb->cmd);
Dmsg1(200, "Deleted %d Media records\n", pr->NumVols);
/* Delete Pool */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"DELETE FROM Pool WHERE Pool.PoolId = %d", pr->PoolId);
pr->PoolId = DELETE_DB(jcr, mdb, mdb->cmd);
Dmsg1(200, "Deleted %d Pool records\n", pr->PoolId);
del.tot_ids = 0;
del.num_del = 0;
del.max_ids = 0;
- Mmsg(&mdb->cmd, "SELECT JobId from JobMedia WHERE MediaId=%d", mr->MediaId);
+ Mmsg(mdb->cmd, "SELECT JobId from JobMedia WHERE MediaId=%d", mr->MediaId);
del.max_ids = mr->VolJobs;
if (del.max_ids < 100) {
del.max_ids = 100;
for (i=0; i < del.num_ids; i++) {
Dmsg1(400, "Delete JobId=%d\n", del.JobId[i]);
- Mmsg(&query, "DELETE FROM Job WHERE JobId=%u", del.JobId[i]);
+ Mmsg(query, "DELETE FROM Job WHERE JobId=%u", del.JobId[i]);
db_sql_query(mdb, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM File WHERE JobId=%u", del.JobId[i]);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%u", del.JobId[i]);
db_sql_query(mdb, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM JobMedia WHERE JobId=%u", del.JobId[i]);
+ Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%u", del.JobId[i]);
db_sql_query(mdb, query, NULL, (void *)NULL);
}
free(del.JobId);
do_media_purge(mdb, mr);
}
- Mmsg(&mdb->cmd, "DELETE FROM Media WHERE MediaId=%d", mr->MediaId);
+ Mmsg(mdb->cmd, "DELETE FROM Media WHERE MediaId=%d", mr->MediaId);
db_sql_query(mdb, mdb->cmd, NULL, (void *)NULL);
db_unlock(mdb);
return 1;
/* If no Id given, we must find corresponding job */
if (jr->JobId == 0) {
/* Differential is since last Full backup */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND "
"Level='%c' AND Name='%s' AND ClientId=%u AND FileSetId=%u "
"ORDER BY StartTime DESC LIMIT 1",
}
if ((row = sql_fetch_row(mdb)) == NULL) {
sql_free_result(mdb);
- Mmsg(&mdb->errmsg, _("No prior Full backup Job record found.\n"));
+ Mmsg(mdb->errmsg, _("No prior Full backup Job record found.\n"));
db_unlock(mdb);
return 0;
}
sql_free_result(mdb);
/* Now edit SQL command for Incremental Job */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT StartTime FROM Job WHERE JobStatus='T' AND Type='%c' AND "
"Level IN ('%c','%c','%c') AND Name='%s' AND ClientId=%u "
"AND FileSetId=%u ORDER BY StartTime DESC LIMIT 1",
}
} else {
Dmsg1(100, "Submitting: %s\n", mdb->cmd);
- Mmsg(&mdb->cmd, "SELECT StartTime FROM Job WHERE Job.JobId=%u", jr->JobId);
+ Mmsg(mdb->cmd, "SELECT StartTime FROM Job WHERE Job.JobId=%u", jr->JobId);
}
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
/* Find last full */
db_lock(mdb);
if (jr->JobLevel == L_VERIFY_CATALOG) {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND "
" JobStatus='T' AND Name='%s' AND "
"ClientId=%u ORDER BY StartTime DESC LIMIT 1",
} else if (jr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
jr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
if (Name) {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
"Name='%s' ORDER BY StartTime DESC LIMIT 1", Name);
} else {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
"ClientId=%u ORDER BY StartTime DESC LIMIT 1", jr->ClientId);
}
db_lock(mdb);
if (item == -1) { /* find oldest volume */
/* Find oldest volume */
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
"VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot,"
"FirstWritten,LastWritten,VolStatus,InChanger "
} else {
order = "ORDER BY LastWritten IS NULL,LastWritten DESC,MediaId"; /* take most recently written */
}
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
"VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot,"
"FirstWritten,LastWritten,VolStatus,InChanger "
int stat = 0;
if (jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT FileId, LStat, MD5 FROM File,Job WHERE "
"File.JobId=Job.JobId AND File.PathId=%u AND "
"File.FilenameId=%u AND Job.Type='B' AND Job.JobSTATUS='T' AND "
"ClientId=%u ORDER BY StartTime DESC LIMIT 1",
fdbr->PathId, fdbr->FilenameId, jr->ClientId);
} else {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT FileId, LStat, MD5 FROM File WHERE File.JobId=%u AND File.PathId=%u AND "
"File.FilenameId=%u", fdbr->JobId, fdbr->PathId, fdbr->FilenameId);
}
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("File record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("File record not found in Catalog.\n"));
}
return stat;
mdb->esc_name = check_pool_memory_size(mdb->esc_name, 2*mdb->fnl+2);
db_escape_string(mdb->esc_name, mdb->fname, mdb->fnl);
- Mmsg(&mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
+ Mmsg(mdb->cmd, "SELECT FilenameId FROM Filename WHERE Name='%s'", mdb->esc_name);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
char ed1[30];
mdb->num_rows = sql_num_rows(mdb);
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Filename record: %s not found in Catalog.\n"), mdb->fname);
+ Mmsg(mdb->errmsg, _("Filename record: %s not found in Catalog.\n"), mdb->fname);
}
return FilenameId;
}
return mdb->cached_path_id;
}
- Mmsg(&mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
+ Mmsg(mdb->cmd, "SELECT PathId FROM Path WHERE Path='%s'", mdb->esc_name);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
char ed1[30];
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Path record: %s not found in Catalog.\n"), mdb->path);
+ Mmsg(mdb->errmsg, _("Path record: %s not found in Catalog.\n"), mdb->path);
}
return PathId;
}
db_lock(mdb);
if (jr->JobId == 0) {
- Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
+ Mmsg(mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
"PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,"
"Type,Level,ClientId "
"FROM Job WHERE Job='%s'", jr->Job);
} else {
- Mmsg(&mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
+ Mmsg(mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
"PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,"
"Type,Level,ClientId "
"FROM Job WHERE JobId=%u", jr->JobId);
db_lock(mdb);
/* Get one entry per VolumeName, but "sort" by VolIndex */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT VolumeName,MAX(VolIndex) FROM JobMedia,Media WHERE "
"JobMedia.JobId=%u AND JobMedia.MediaId=Media.MediaId "
"GROUP BY VolumeName "
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("No Volume for JobId %d found in Catalog.\n"), JobId);
+ Mmsg(mdb->errmsg, _("No Volume for JobId %d found in Catalog.\n"), JobId);
}
db_unlock(mdb);
return stat;
VOL_PARAMS *Vols = NULL;
db_lock(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT VolumeName,FirstIndex,LastIndex,StartFile,EndFile,StartBlock,EndBlock"
" FROM JobMedia,Media WHERE JobMedia.JobId=%u"
" AND JobMedia.MediaId=Media.MediaId ORDER BY VolIndex,JobMediaId", JobId);
int stat = 0;
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT count(*) from Pool");
+ Mmsg(mdb->cmd, "SELECT count(*) from Pool");
stat = get_sql_record_max(jcr, mdb);
db_unlock(mdb);
return stat;
db_lock(mdb);
*ids = NULL;
- Mmsg(&mdb->cmd, "SELECT PoolId FROM Pool");
+ Mmsg(mdb->cmd, "SELECT PoolId FROM Pool");
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
*num_ids = sql_num_rows(mdb);
if (*num_ids > 0) {
sql_free_result(mdb);
stat = 1;
} else {
- Mmsg(&mdb->errmsg, _("Pool id select failed: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Pool id select failed: ERR=%s\n"), sql_strerror(mdb));
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
stat = 0;
}
db_lock(mdb);
*ids = NULL;
- Mmsg(&mdb->cmd, "SELECT ClientId FROM Client");
+ Mmsg(mdb->cmd, "SELECT ClientId FROM Client");
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
*num_ids = sql_num_rows(mdb);
if (*num_ids > 0) {
sql_free_result(mdb);
stat = 1;
} else {
- Mmsg(&mdb->errmsg, _("Client id select failed: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Client id select failed: ERR=%s\n"), sql_strerror(mdb));
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
stat = 0;
}
db_lock(mdb);
if (pdbr->PoolId != 0) { /* find by id */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,\
AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,\
MaxVolBytes,PoolType,LabelFormat FROM Pool WHERE Pool.PoolId=%u", pdbr->PoolId);
} else { /* find by name */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,AcceptAnyVolume,\
AutoPrune,Recycle,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,\
MaxVolBytes,PoolType,LabelFormat FROM Pool WHERE Pool.Name='%s'", pdbr->Name);
stat = pdbr->PoolId;
}
} else {
- Mmsg(&mdb->errmsg, _("Pool record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("Pool record not found in Catalog.\n"));
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Pool record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("Pool record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
db_lock(mdb);
if (cdbr->ClientId != 0) { /* find by id */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT ClientId,Name,Uname,AutoPrune,FileRetention,JobRetention "
"FROM Client WHERE Client.ClientId=%u", cdbr->ClientId);
} else { /* find by name */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT ClientId,Name,Uname,AutoPrune,FileRetention,JobRetention "
"FROM Client WHERE Client.Name='%s'", cdbr->Name);
}
stat = 1;
}
} else {
- Mmsg(&mdb->errmsg, _("Client record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("Client record not found in Catalog.\n"));
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Client record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("Client record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
SQL_ROW row;
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT MinValue,MaxValue,CurrentValue,WrapCounter "
+ Mmsg(mdb->cmd, "SELECT MinValue,MaxValue,CurrentValue,WrapCounter "
"FROM Counters WHERE Counter='%s'", cr->Counter);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Counter record: %s not found in Catalog.\n"), cr->Counter);
+ Mmsg(mdb->errmsg, _("Counter record: %s not found in Catalog.\n"), cr->Counter);
}
db_unlock(mdb);
return 0;
db_lock(mdb);
if (fsr->FileSetId != 0) { /* find by id */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT FileSetId,FileSet,MD5,CreateTime FROM FileSet "
"WHERE FileSetId=%u", fsr->FileSetId);
} else { /* find by name */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT FileSetId,FileSet,CreateTime,MD5 FROM FileSet "
"WHERE FileSet='%s'", fsr->FileSet);
}
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("FileSet record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("FileSet record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
int stat = 0;
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT count(*) from Media");
+ Mmsg(mdb->cmd, "SELECT count(*) from Media");
stat = get_sql_record_max(jcr, mdb);
db_unlock(mdb);
return stat;
db_lock(mdb);
*ids = NULL;
- Mmsg(&mdb->cmd, "SELECT MediaId FROM Media WHERE PoolId=%u", PoolId);
+ Mmsg(mdb->cmd, "SELECT MediaId FROM Media WHERE PoolId=%u", PoolId);
if (QUERY_DB(jcr, mdb, mdb->cmd)) {
*num_ids = sql_num_rows(mdb);
if (*num_ids > 0) {
sql_free_result(mdb);
stat = 1;
} else {
- Mmsg(&mdb->errmsg, _("Media id select failed: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Media id select failed: ERR=%s\n"), sql_strerror(mdb));
Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
stat = 0;
}
db_lock(mdb);
if (mr->MediaId == 0 && mr->VolumeName[0] == 0) {
- Mmsg(&mdb->cmd, "SELECT count(*) from Media");
+ Mmsg(mdb->cmd, "SELECT count(*) from Media");
mr->MediaId = get_sql_record_max(jcr, mdb);
db_unlock(mdb);
return 1;
}
if (mr->MediaId != 0) { /* find by id */
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
"MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
"Recycle,Slot,FirstWritten,LastWritten,InChanger "
"FROM Media WHERE MediaId=%d", mr->MediaId);
} else { /* find by name */
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks,"
"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes,"
"MediaType,VolStatus,PoolId,VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,"
"Recycle,Slot,FirstWritten,LastWritten,InChanger "
}
sql_free_result(mdb);
} else {
- Mmsg(&mdb->errmsg, _("Media record not found in Catalog.\n"));
+ Mmsg(mdb->errmsg, _("Media record not found in Catalog.\n"));
}
db_unlock(mdb);
return stat;
{
db_lock(mdb);
if (sql_query(mdb, query) != 0) {
- Mmsg(&mdb->errmsg, _("Query failed: %s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Query failed: %s\n"), sql_strerror(mdb));
if (verbose) {
sendit(ctx, mdb->errmsg);
}
{
db_lock(mdb);
if (type == VERT_LIST) {
- Mmsg(&mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
+ Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,UseOnce,UseCatalog,"
"AcceptAnyVolume,VolRetention,VolUseDuration,MaxVolJobs,MaxVolBytes,"
"AutoPrune,Recycle,PoolType,LabelFormat,Enabled,ScratchPoolId,"
"RecyclePoolId "
"FROM Pool ORDER BY PoolId");
} else {
- Mmsg(&mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
+ Mmsg(mdb->cmd, "SELECT PoolId,Name,NumVols,MaxVols,PoolType,LabelFormat "
"FROM Pool ORDER BY PoolId");
}
{
db_lock(mdb);
if (type == VERT_LIST) {
- Mmsg(&mdb->cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
+ Mmsg(mdb->cmd, "SELECT ClientId,Name,Uname,AutoPrune,FileRetention,"
"FileRetention,JobRetention "
"FROM Client ORDER BY ClientId");
} else {
- Mmsg(&mdb->cmd, "SELECT ClientId,Name,FileRetention,JobRetention "
+ Mmsg(mdb->cmd, "SELECT ClientId,Name,FileRetention,JobRetention "
"FROM Client ORDER BY ClientId");
}
db_lock(mdb);
if (type == VERT_LIST) {
if (mdbr->VolumeName[0] != 0) {
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
"MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
"VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
"VolCapacityBytes,VolStatus,Recycle,VolRetention,"
"VolUseDuration,MaxVolJobs,MaxVolFiles,MaxVolBytes,InChanger "
"FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
} else {
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,Slot,PoolId,"
"MediaType,FirstWritten,LastWritten,LabelDate,VolJobs,"
"VolFiles,VolBlocks,VolMounts,VolBytes,VolErrors,VolWrites,"
"VolCapacityBytes,VolStatus,Recycle,VolRetention,"
}
} else {
if (mdbr->VolumeName[0] != 0) {
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
"VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
"FROM Media WHERE Media.VolumeName='%s'", mdbr->VolumeName);
} else {
- Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
+ Mmsg(mdb->cmd, "SELECT MediaId,VolumeName,VolStatus,"
"VolBytes,VolFiles,VolRetention,Recycle,Slot,InChanger,MediaType,LastWritten "
"FROM Media WHERE Media.PoolId=%u ORDER BY MediaId", mdbr->PoolId);
}
db_lock(mdb);
if (type == VERT_LIST) {
if (JobId > 0) { /* do by JobId */
- Mmsg(&mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
+ Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
"FirstIndex,LastIndex,StartFile,EndFile,StartBlock,EndBlock "
"FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
"AND JobMedia.JobId=%u", JobId);
} else {
- Mmsg(&mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
+ Mmsg(mdb->cmd, "SELECT JobMediaId,JobId,MediaId,Media.VolumeName,"
"FirstIndex,LastIndex,StartFile,EndFile,StartBlock,EndBlock "
"FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
}
} else {
if (JobId > 0) { /* do by JobId */
- Mmsg(&mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+ Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
"FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId "
"AND JobMedia.JobId=%u", JobId);
} else {
- Mmsg(&mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
+ Mmsg(mdb->cmd, "SELECT JobId,Media.VolumeName,FirstIndex,LastIndex "
"FROM JobMedia,Media WHERE Media.MediaId=JobMedia.MediaId");
}
}
db_lock(mdb);
if (type == VERT_LIST) {
if (jr->JobId == 0 && jr->Job[0] == 0) {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
"Job.ClientId,Client.Name,JobStatus,SchedTime,"
"StartTime,EndTime,JobTDate,"
"Client.ClientId=Job.ClientId AND Pool.PoolId=Job.PoolId "
"AND FileSet.FileSetId=Job.FileSetId ORDER BY StartTime");
} else { /* single record */
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId,Job,Job.Name,PurgedFiles,Type,Level,"
"Job.ClientId,Client.Name,JobStatus,SchedTime,"
"StartTime,EndTime,JobTDate,"
}
} else {
if (jr->JobId == 0 && jr->Job[0] == 0) {
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT JobId,Name,StartTime,Type,Level,JobFiles,JobBytes,JobStatus "
"FROM Job ORDER BY StartTime");
} else { /* single record */
- Mmsg(&mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,"
+ Mmsg(mdb->cmd, "SELECT JobId,Name,StartTime,Type,Level,"
"JobFiles,JobBytes,JobStatus FROM Job WHERE JobId=%u", jr->JobId);
}
}
db_lock(mdb);
/* List by Job */
- Mmsg(&mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) "
+ Mmsg(mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) "
"AS Files,sum(JobBytes) AS Bytes,Name AS Job FROM Job GROUP BY Name");
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
sql_free_result(mdb);
/* Do Grand Total */
- Mmsg(&mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) \
+ Mmsg(mdb->cmd, "SELECT count(*) AS Jobs,sum(JobFiles) \
AS Files,sum(JobBytes) As Bytes FROM Job");
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
{
db_lock(mdb);
- Mmsg(&mdb->cmd, "SELECT " FN " AS Filename FROM File,"
+ Mmsg(mdb->cmd, "SELECT " FN " AS Filename FROM File,"
"Filename,Path WHERE File.JobId=%u AND Filename.FilenameId=File.FilenameId "
"AND Path.PathId=File.PathId",
jobid);
int stat;
db_lock(mdb);
- Mmsg(&mdb->cmd, "UPDATE File SET MD5='%s' WHERE FileId=%u", SIG, FileId);
+ Mmsg(mdb->cmd, "UPDATE File SET MD5='%s' WHERE FileId=%u", SIG, FileId);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
db_unlock(mdb);
return stat;
int stat;
db_lock(mdb);
- Mmsg(&mdb->cmd, "UPDATE File SET MarkId=%u WHERE FileId=%u", JobId, FileId);
+ Mmsg(mdb->cmd, "UPDATE File SET MarkId=%u WHERE FileId=%u", JobId, FileId);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
db_unlock(mdb);
return stat;
JobTDate = (btime_t)stime;
db_lock(mdb);
- Mmsg(&mdb->cmd, "UPDATE Job SET JobStatus='%c',Level='%c',StartTime='%s',"
+ Mmsg(mdb->cmd, "UPDATE Job SET JobStatus='%c',Level='%c',StartTime='%s',"
"ClientId=%u,JobTDate=%s WHERE JobId=%u",
(char)(jcr->JobStatus),
(char)(jr->JobLevel), dt, jr->ClientId, edit_uint64(JobTDate, ed1), jr->JobId);
JobTDate = ttime;
db_lock(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"UPDATE Job SET JobStatus='%c', EndTime='%s', \
ClientId=%s, JobBytes=%s, JobFiles=%u, JobErrors=%u, VolSessionId=%u, \
VolSessionTime=%u, PoolId=%s, FileSetId=%s, JobTDate=%s WHERE JobId=%u",
return 0;
}
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"UPDATE Client SET AutoPrune=%d,FileRetention=%s,JobRetention=%s,"
"Uname='%s' WHERE Name='%s'",
cr->AutoPrune,
{
db_lock(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"UPDATE Counters SET MinValue=%d,MaxValue=%d,CurrentValue=%d,"
"WrapCounter='%s' WHERE Counter='%s'",
cr->MinValue, cr->MaxValue, cr->CurrentValue,
char ed1[50], ed2[50], ed3[50];
db_lock(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"UPDATE Pool SET NumVols=%u,MaxVols=%u,UseOnce=%d,UseCatalog=%d,"
"AcceptAnyVolume=%d,VolRetention='%s',VolUseDuration='%s',"
"MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s,Recycle=%d,"
ttime = mr->FirstWritten;
localtime_r(&ttime, &tm);
strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
- Mmsg(&mdb->cmd, "UPDATE Media SET FirstWritten='%s'\
+ Mmsg(mdb->cmd, "UPDATE Media SET FirstWritten='%s'\
WHERE VolumeName='%s'", dt, mr->VolumeName);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
Dmsg1(400, "Firstwritten stat=%d\n", stat);
}
localtime_r(&ttime, &tm);
strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
- Mmsg(&mdb->cmd, "UPDATE Media SET LabelDate='%s' "
+ Mmsg(mdb->cmd, "UPDATE Media SET LabelDate='%s' "
"WHERE VolumeName='%s'", dt, mr->VolumeName);
stat = UPDATE_DB(jcr, mdb, mdb->cmd);
}
localtime_r(&ttime, &tm);
strftime(dt, sizeof(dt), "%Y-%m-%d %T", &tm);
- Mmsg(&mdb->cmd, "UPDATE Media SET VolJobs=%u,"
+ Mmsg(mdb->cmd, "UPDATE Media SET VolJobs=%u,"
"VolFiles=%u,VolBlocks=%u,VolBytes=%s,VolMounts=%u,VolErrors=%u,"
"VolWrites=%u,MaxVolBytes=%s,LastWritten='%s',VolStatus='%s',"
"Slot=%d,InChanger=%d,VolReadTime=%s,VolWriteTime=%s "
edit_uint64(mr->VolWriteTime, ed4),
mr->VolumeName);
} else {
- Mmsg(&mdb->cmd, "UPDATE Media SET VolJobs=%u,"
+ Mmsg(mdb->cmd, "UPDATE Media SET VolJobs=%u,"
"VolFiles=%u,VolBlocks=%u,VolBytes=%s,VolMounts=%u,VolErrors=%u,"
"VolWrites=%u,MaxVolBytes=%s,VolStatus='%s',"
"Slot=%d,InChanger=%d,VolReadTime=%s,VolWriteTime=%s "
db_lock(mdb);
if (mr->VolumeName[0]) {
- Mmsg(&mdb->cmd, "UPDATE Media SET "
+ Mmsg(mdb->cmd, "UPDATE Media SET "
"Recycle=%d,VolRetention=%s,VolUseDuration=%s,"
"MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s"
" WHERE VolumeName='%s'",
edit_uint64(mr->VolBytes, ed3),
mr->VolumeName);
} else {
- Mmsg(&mdb->cmd, "UPDATE Media SET "
+ Mmsg(mdb->cmd, "UPDATE Media SET "
"Recycle=%d,VolRetention=%s,VolUseDuration=%s,"
"MaxVolJobs=%u,MaxVolFiles=%u,MaxVolBytes=%s"
" WHERE PoolId=%u",
db_make_inchanger_unique(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
{
if (mr->InChanger != 0 && mr->Slot != 0) {
- Mmsg(&mdb->cmd, "UPDATE Media SET InChanger=0 WHERE "
+ Mmsg(mdb->cmd, "UPDATE Media SET InChanger=0 WHERE "
"Slot=%d AND MediaId!=%u", mr->Slot, mr->MediaId);
Dmsg1(400, "%s\n", mdb->cmd);
UPDATE_DB(jcr, mdb, mdb->cmd);
db_lock(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"SELECT id FROM NextId WHERE TableName=\"%s\"", table);
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
- Mmsg(&mdb->errmsg, _("next_index query error: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("next_index query error: ERR=%s\n"), sql_strerror(mdb));
db_unlock(mdb);
return 0;
}
if ((row = sql_fetch_row(mdb)) == NULL) {
- Mmsg(&mdb->errmsg, _("Error fetching index: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Error fetching index: ERR=%s\n"), sql_strerror(mdb));
db_unlock(mdb);
return 0;
}
bstrncpy(index, row[0], 28);
sql_free_result(mdb);
- Mmsg(&mdb->cmd,
+ Mmsg(mdb->cmd,
"UPDATE NextId SET id=id+1 WHERE TableName=\"%s\"", table);
if (!QUERY_DB(jcr, mdb, mdb->cmd)) {
- Mmsg(&mdb->errmsg, _("next_index update error: ERR=%s\n"), sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("next_index update error: ERR=%s\n"), sql_strerror(mdb));
db_unlock(mdb);
return 0;
}
rh_data.ctx = ctx;
stat = sqlite_exec(mdb->db, query, sqlite_result, (void *)&rh_data, &mdb->sqlite_errmsg);
if (stat != 0) {
- Mmsg(&mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
+ Mmsg(mdb->errmsg, _("Query failed: %s: ERR=%s\n"), query, sql_strerror(mdb));
db_unlock(mdb);
return 0;
}
#endif
#include <termios.h>
+#ifdef HAVE_SUN_OS
+extern "C" int tgetent(void *, const char *);
+extern "C" int tgetnum(const char *);
+extern "C" char *tgetstr (const char*, char**);
+extern "C" char *tgoto (const char *, int, int);
+#else
#include <termcap.h>
+#endif
#include "func.h"
POOLMEM *fname = get_pool_memory(PM_MESSAGE);
int stat;
- Mmsg(&fname, "%s/restore.bsr", working_directory);
+ Mmsg(fname, "%s/restore.bsr", working_directory);
fd = fopen(fname, "w+");
if (!fd) {
bsendmsg(ua, _("Unable to create bootstrap file %s. ERR=%s\n"),
char ed1[50], ed2[50], ed3[50], ed4[50], ed5[50];
jcr->MediaId = mr->MediaId;
- pm_strcpy(&jcr->VolumeName, mr->VolumeName);
+ pm_strcpy(jcr->VolumeName, mr->VolumeName);
bash_spaces(mr->VolumeName);
stat = bnet_fsend(sd, OK_media, mr->VolumeName, mr->VolJobs,
mr->VolFiles, mr->VolBlocks, edit_uint64(mr->VolBytes, ed1),
} else {
omsg = get_memory(bs->msglen+1);
- pm_strcpy(&omsg, bs->msg);
+ pm_strcpy(omsg, bs->msg);
bnet_fsend(bs, "1990 Invalid Catalog Request: %s", omsg);
Jmsg1(jcr, M_ERROR, 0, _("Invalid Catalog request: %s"), omsg);
free_memory(omsg);
Dmsg1(500, "Opts=%s\n", buf);
optlen = strlen(buf);
while (fgets(buf+optlen, sizeof(buf)-optlen, bpipe->rfd)) {
- fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ fd->msglen = Mmsg(fd->msg, "%s", buf);
Dmsg2(500, "Inc/exc len=%d: %s", fd->msglen, fd->msg);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
Dmsg1(500, "Opts=%s\n", buf);
optlen = strlen(buf);
while (fgets(buf+optlen, sizeof(buf)-optlen, ffd)) {
- fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ fd->msglen = Mmsg(fd->msg, "%s", buf);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
goto bail_out;
default:
if (ie->num_opts) {
Dmsg2(500, "numopts=%d opts=%s\n", ie->num_opts, NPRT(ie->opts_list[0]->opts));
- pm_strcpy(&fd->msg, ie->opts_list[0]->opts);
- pm_strcat(&fd->msg, " ");
+ pm_strcpy(fd->msg, ie->opts_list[0]->opts);
+ pm_strcat(fd->msg, " ");
} else {
- pm_strcpy(&fd->msg, "0 ");
+ pm_strcpy(fd->msg, "0 ");
}
- fd->msglen = pm_strcat(&fd->msg, p);
+ fd->msglen = pm_strcat(fd->msg, p);
Dmsg1(500, "Inc/Exc name=%s\n", fd->msg);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
Dmsg1(500, "Opts=%s\n", buf);
optlen = strlen(buf);
while (fgets(buf+optlen, sizeof(buf)-optlen, bpipe->rfd)) {
- fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ fd->msglen = Mmsg(fd->msg, "%s", buf);
Dmsg2(500, "Inc/exc len=%d: %s", fd->msglen, fd->msg);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
Dmsg1(500, "Opts=%s\n", buf);
optlen = strlen(buf);
while (fgets(buf+optlen, sizeof(buf)-optlen, ffd)) {
- fd->msglen = Mmsg(&fd->msg, "%s", buf);
+ fd->msglen = Mmsg(fd->msg, "%s", buf);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
goto bail_out;
p++; /* skip over \ */
/* Note, fall through wanted */
default:
- pm_strcpy(&fd->msg, "F ");
- fd->msglen = pm_strcat(&fd->msg, p);
+ pm_strcpy(fd->msg, "F ");
+ fd->msglen = pm_strcat(fd->msg, p);
Dmsg1(500, "Inc/Exc name=%s\n", fd->msg);
if (!bnet_send(fd)) {
Jmsg(jcr, M_FATAL, 0, _(">filed: write error on socket\n"));
POOLMEM *msg = get_pool_memory(PM_FNAME);
BSOCK *fd = jcr->file_bsock;
if (jcr->job->ClientRunBeforeJob) {
- pm_strcpy(&msg, jcr->job->ClientRunBeforeJob);
+ pm_strcpy(msg, jcr->job->ClientRunBeforeJob);
bash_spaces(msg);
bnet_fsend(fd, runbefore, msg);
if (!response(jcr, fd, OKRunBefore, "ClientRunBeforeJob", DISPLAY_ERROR)) {
}
}
if (jcr->job->ClientRunAfterJob) {
- fd->msglen = pm_strcpy(&msg, jcr->job->ClientRunAfterJob);
+ fd->msglen = pm_strcpy(msg, jcr->job->ClientRunAfterJob);
bash_spaces(msg);
bnet_fsend(fd, runafter, msg);
if (!response(jcr, fd, OKRunAfter, "ClientRunAfterJob", DISPLAY_ERROR)) {
if (!jcr->client_name) {
jcr->client_name = get_pool_memory(PM_NAME);
}
- pm_strcpy(&jcr->client_name, jcr->client->hdr.name);
+ pm_strcpy(jcr->client_name, jcr->client->hdr.name);
if (!db_create_client_record(jcr, jcr->db, &cr)) {
Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. ERR=%s\n"),
db_strerror(jcr->db));
if (!jcr->client_uname) {
jcr->client_uname = get_pool_memory(PM_NAME);
}
- pm_strcpy(&jcr->client_uname, cr.Uname);
+ pm_strcpy(jcr->client_uname, cr.Uname);
}
Dmsg2(100, "Created Client %s record %d\n", jcr->client->hdr.name,
jcr->jr.ClientId);
if (!jcr->client_name) {
jcr->client_name = get_pool_memory(PM_NAME);
}
- pm_strcpy(&jcr->client_name, jcr->client->hdr.name);
+ pm_strcpy(jcr->client_name, jcr->client->hdr.name);
jcr->pool = job->pool;
jcr->full_pool = job->full_pool;
jcr->inc_pool = job->inc_pool;
*/
if (jcr->acquired_resource_locks) {
jcr->store->NumConcurrentJobs--;
- if (jcr->JobType == JT_RESTORE) {
+ if (jcr->JobType == JT_RESTORE || jcr->JobType == JT_VERIFY) {
jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;
}
jcr->client->NumConcurrentJobs--;
set_jcr_job_status(jcr, JS_WaitPriority);
break;
}
- if (jcr->JobType == JT_RESTORE) {
- /* Let only one Restore job run at a time regardless of MaxConcurrentJobs */
+ if (jcr->JobType == JT_RESTORE || jcr->JobType == JT_VERIFY) {
+ /* Let only one Restore/verify job run at a time regardless of MaxConcurrentJobs */
if (jcr->store->NumConcurrentJobs == 0) {
jcr->store->NumConcurrentJobs++;
jcr->saveMaxConcurrentJobs = jcr->store->MaxConcurrentJobs;
} else {
/* Back out previous locks */
jcr->store->NumConcurrentJobs--;
- if (jcr->JobType == JT_RESTORE) {
+ if (jcr->JobType == JT_RESTORE || jcr->JobType == JT_VERIFY) {
jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;
}
set_jcr_job_status(jcr, JS_WaitClientRes);
} else {
/* Back out previous locks */
jcr->store->NumConcurrentJobs--;
- if (jcr->JobType == JT_RESTORE) {
+ if (jcr->JobType == JT_RESTORE || jcr->JobType == JT_VERIFY) {
jcr->store->MaxConcurrentJobs = jcr->saveMaxConcurrentJobs;
}
jcr->client->NumConcurrentJobs--;
pool_name = get_pool_memory(PM_NAME);
pool_type = get_pool_memory(PM_NAME);
media_type = get_pool_memory(PM_NAME);
- pm_strcpy(&device_name, storage->dev_name);
- pm_strcpy(&media_type, storage->media_type);
- pm_strcpy(&pool_type, jcr->pool->pool_type);
- pm_strcpy(&pool_name, jcr->pool->hdr.name);
+ pm_strcpy(device_name, storage->dev_name);
+ pm_strcpy(media_type, storage->media_type);
+ pm_strcpy(pool_type, jcr->pool->pool_type);
+ pm_strcpy(pool_name, jcr->pool->hdr.name);
bash_spaces(device_name);
bash_spaces(media_type);
bash_spaces(pool_type);
Dmsg1(110, ">stored: %s", sd->msg);
status = response(jcr, sd, OK_device, "Use Device", NO_DISPLAY);
if (!status) {
- pm_strcpy(&pool_type, sd->msg); /* save message */
+ pm_strcpy(pool_type, sd->msg); /* save message */
Jmsg(jcr, M_FATAL, 0, _("\n"
" Storage daemon didn't accept Device \"%s\" because:\n %s"),
device_name, pool_type/* sd->msg */);
if (db_find_next_volume(jcr, jcr->db, 1, InChanger, mr)) {
jcr->MediaId = mr->MediaId;
Dmsg1(20, "Find_next_vol MediaId=%u\n", jcr->MediaId);
- pm_strcpy(&jcr->VolumeName, mr->VolumeName);
+ pm_strcpy(jcr->VolumeName, mr->VolumeName);
return 1;
}
return 0;
Dmsg0(100, "Enter recycle_oldest_purged_volume\n");
oldest.MediaId = 0;
if (InChanger) {
- Mmsg(&query, select, mr->PoolId, mr->MediaType, "AND InChanger=1 ");
+ Mmsg(query, select, mr->PoolId, mr->MediaType, "AND InChanger=1 ");
} else {
- Mmsg(&query, select, mr->PoolId, mr->MediaType, "");
+ Mmsg(query, select, mr->PoolId, mr->MediaType, "");
}
if (!db_sql_query(jcr->db, query, oldest_handler, (void *)&oldest)) {
bsendmsg(ua, _("Invalid VolStatus specified: %s\n"), val);
} else {
bstrncpy(mr->VolStatus, kw[i], sizeof(mr->VolStatus));
- Mmsg(&query, "UPDATE Media SET VolStatus='%s' WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET VolStatus='%s' WHERE MediaId=%u",
mr->VolStatus, mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return;
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET VolRetention=%s WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET VolRetention=%s WHERE MediaId=%u",
edit_uint64(mr->VolRetention, ed1), mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return;
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET VolUseDuration=%s WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET VolUseDuration=%s WHERE MediaId=%u",
edit_uint64(mr->VolUseDuration, ed1), mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
static void update_volmaxjobs(UAContext *ua, char *val, MEDIA_DBR *mr)
{
POOLMEM *query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET MaxVolJobs=%s WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET MaxVolJobs=%s WHERE MediaId=%u",
val, mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
static void update_volmaxfiles(UAContext *ua, char *val, MEDIA_DBR *mr)
{
POOLMEM *query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET MaxVolFiles=%s WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET MaxVolFiles=%s WHERE MediaId=%u",
val, mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return;
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET MaxVolBytes=%s WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET MaxVolBytes=%s WHERE MediaId=%u",
edit_uint64(maxbytes, ed1), mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return;
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET Recycle=%d WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET Recycle=%d WHERE MediaId=%u",
recycle, mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
*/
query = get_pool_memory(PM_MESSAGE);
db_lock(ua->db);
- Mmsg(&query, "UPDATE Media SET PoolId=%d WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET PoolId=%d WHERE MediaId=%u",
mr->PoolId, mr->MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "UPDATE Media SET VolFiles=%u WHERE MediaId=%u",
+ Mmsg(query, "UPDATE Media SET VolFiles=%u WHERE MediaId=%u",
VolFiles, mr.MediaId);
if (!db_sql_query(ua->db, query, NULL, NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
id, db_strerror(ua->db));
}
query = get_pool_memory(PM_MESSAGE);
- Mmsg(&query, list_pool, pr.PoolId);
+ Mmsg(query, list_pool, pr.PoolId);
db_list_sql_query(ua->jcr, ua->db, query, prtit, ua, 1, HORZ_LIST);
free_pool_memory(query);
bsendmsg(ua, _("Pool DB record updated from resource.\n"));
} else {
JobId = ua->pint32_val;
}
- Mmsg(&query, "DELETE FROM Job WHERE JobId=%u", JobId);
+ Mmsg(query, "DELETE FROM Job WHERE JobId=%u", JobId);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM File WHERE JobId=%u", JobId);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%u", JobId);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM JobMedia WHERE JobId=%u", JobId);
+ Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%u", JobId);
db_sql_query(ua->db, query, NULL, (void *)NULL);
free_pool_memory(query);
bsendmsg(ua, _("Job %u and associated records deleted from the catalog.\n"), JobId);
}
}
if (!found) {
- pm_strcat(&ua->UA_sock->msg, _(": is an illegal command\n"));
+ pm_strcat(ua->UA_sock->msg, _(": is an illegal command\n"));
ua->UA_sock->msglen = strlen(ua->UA_sock->msg);
bnet_send(ua->UA_sock);
}
if (ua->argc == 2 && strcmp(ua->argk[1], "client") != 0) {
return 1;
}
- Mmsg(&ua->cmd, client_backups, ua->argv[1]);
+ Mmsg(ua->cmd, client_backups, ua->argv[1]);
if (!db_sql_query(ua->db, ua->cmd, client_backups_handler, (void *)ua)) {
bsendmsg(ua, _("Query failed: %s. ERR=%s\n"), ua->cmd, db_strerror(ua->db));
return 1;
if (is_bnet_stop(sock)) {
return 0; /* error or terminate */
}
- pm_strcpy(&ua->cmd, sock->msg);
+ pm_strcpy(ua->cmd, sock->msg);
strip_trailing_junk(ua->cmd);
if (strcmp(ua->cmd, ".messages") == 0) {
qmessagescmd(ua, ua->cmd);
/* Check for volume=NewVolume */
i = find_arg_with_value(ua, "volume");
if (i >= 0) {
- pm_strcpy(&ua->cmd, ua->argv[i]);
+ pm_strcpy(ua->cmd, ua->argv[i]);
goto checkName;
}
now = (utime_t)time(NULL);
/* Select Jobs -- for counting */
- Mmsg(&query, select_job, edit_uint64(now - period, ed1), cr.ClientId);
+ Mmsg(query, select_job, edit_uint64(now - period, ed1), cr.ClientId);
Dmsg1(050, "select sql=%s\n", query);
if (!db_sql_query(ua->db, query, file_count_handler, (void *)&del)) {
if (ua->verbose) {
for (i=0; i < del.num_ids; i++) {
struct s_count_ctx cnt;
Dmsg1(050, "Delete JobId=%d\n", del.JobId[i]);
- Mmsg(&query, cnt_File, del.JobId[i]);
+ Mmsg(query, cnt_File, del.JobId[i]);
cnt.count = 0;
db_sql_query(ua->db, query, count_handler, (void *)&cnt);
del.tot_ids += cnt.count;
- Mmsg(&query, del_File, del.JobId[i]);
+ Mmsg(query, del_File, del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
/*
* Now mark Job as having files purged. This is necessary to
* we don't do this, the number of JobId's in our in memory list
* could grow very large.
*/
- Mmsg(&query, upd_Purged, del.JobId[i]);
+ Mmsg(query, upd_Purged, del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
}
{
struct s_job_del_ctx del;
struct s_count_ctx cnt;
- char *query = (char *)get_pool_memory(PM_MESSAGE);
+ POOLMEM *query = (char *)get_pool_memory(PM_MESSAGE);
int i;
utime_t now, period;
CLIENT_DBR cr;
* and stuff them into the "DeletionCandidates" table.
*/
edit_uint64(now - period, ed1);
- Mmsg(&query, insert_delcand, (char)JobType, ed1, cr.ClientId);
+ Mmsg(query, insert_delcand, (char)JobType, ed1, cr.ClientId);
if (!db_sql_query(ua->db, query, NULL, (void *)NULL)) {
if (ua->verbose) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
/* Count Files to be deleted */
- pm_strcpy(&query, cnt_DelCand);
+ pm_strcpy(query, cnt_DelCand);
Dmsg1(100, "select sql=%s\n", query);
cnt.count = 0;
if (!db_sql_query(ua->db, query, count_handler, (void *)&cnt)) {
switch (JobType) {
case JT_BACKUP:
- Mmsg(&query, select_backup_del, ed1, ed1, cr.ClientId);
+ Mmsg(query, select_backup_del, ed1, ed1, cr.ClientId);
break;
case JT_RESTORE:
- Mmsg(&query, select_restore_del, ed1, ed1, cr.ClientId);
+ Mmsg(query, select_restore_del, ed1, ed1, cr.ClientId);
break;
case JT_VERIFY:
- Mmsg(&query, select_verify_del, ed1, ed1, cr.ClientId);
+ Mmsg(query, select_verify_del, ed1, ed1, cr.ClientId);
break;
case JT_ADMIN:
- Mmsg(&query, select_admin_del, ed1, ed1, cr.ClientId);
+ Mmsg(query, select_admin_del, ed1, ed1, cr.ClientId);
break;
}
if (!db_sql_query(ua->db, query, job_delete_handler, (void *)&del)) {
for (i=0; i < del.num_ids; i++) {
Dmsg1(050, "Delete JobId=%d\n", del.JobId[i]);
if (!del.PurgedFiles[i]) {
- Mmsg(&query, del_File, del.JobId[i]);
+ Mmsg(query, del_File, del.JobId[i]);
if (!db_sql_query(ua->db, query, NULL, (void *)NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
Dmsg1(050, "Del sql=%s\n", query);
}
- Mmsg(&query, del_Job, del.JobId[i]);
+ Mmsg(query, del_Job, del.JobId[i]);
if (!db_sql_query(ua->db, query, NULL, (void *)NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
Dmsg1(050, "Del sql=%s\n", query);
- Mmsg(&query, del_JobMedia, del.JobId[i]);
+ Mmsg(query, del_JobMedia, del.JobId[i]);
if (!db_sql_query(ua->db, query, NULL, (void *)NULL)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
*/
int prune_volume(UAContext *ua, MEDIA_DBR *mr)
{
- char *query = (char *)get_pool_memory(PM_MESSAGE);
+ POOLMEM *query = (char *)get_pool_memory(PM_MESSAGE);
struct s_count_ctx cnt;
struct s_file_del_ctx del;
int i, stat = 0;
* counting the JobMedia records.
*/
cnt.count = 0;
- Mmsg(&query, cnt_JobMedia, mr->MediaId);
+ Mmsg(query, cnt_JobMedia, mr->MediaId);
if (!db_sql_query(ua->db, query, count_handler, (void *)&cnt)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
Dmsg0(050, "Count failed\n");
* Could optimize here by adding JobTDate > (now - period).
*/
del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
- Mmsg(&query, sel_JobMedia, mr->MediaId);
+ Mmsg(query, sel_JobMedia, mr->MediaId);
if (!db_sql_query(ua->db, query, file_delete_handler, (void *)&del)) {
if (ua->verbose) {
bsendmsg(ua, "%s", db_strerror(ua->db));
continue;
}
Dmsg2(200, "Delete JobId=%d Job=%s\n", del.JobId[i], jr.Job);
- Mmsg(&query, del_File, del.JobId[i]);
+ Mmsg(query, del_File, del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, del_Job, del.JobId[i]);
+ Mmsg(query, del_Job, del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, del_JobMedia, del.JobId[i]);
+ Mmsg(query, del_JobMedia, del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
del.num_del++;
return 0;
}
bsendmsg(ua, _("Begin purging files for Client \"%s\"\n"), cr.Name);
- Mmsg(&query, select_jobsfiles_from_client, cr.ClientId);
+ Mmsg(query, select_jobsfiles_from_client, cr.ClientId);
Dmsg1(050, "select sql=%s\n", query);
for (i=0; i < del.num_ids; i++) {
Dmsg1(050, "Delete JobId=%d\n", del.JobId[i]);
- Mmsg(&query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
/*
* Now mark Job as having files purged. This is necessary to
* we don't do this, the number of JobId's in our in memory list
* will grow very large.
*/
- Mmsg(&query, "UPDATE Job Set PurgedFiles=1 WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "UPDATE Job Set PurgedFiles=1 WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
}
}
bsendmsg(ua, _("Begin purging jobs from Client \"%s\"\n"), cr.Name);
- Mmsg(&query, select_jobs_from_client, cr.ClientId);
+ Mmsg(query, select_jobs_from_client, cr.ClientId);
Dmsg1(050, "select sql=%s\n", query);
for (i=0; i < del.num_ids; i++) {
Dmsg1(050, "Delete JobId=%d\n", del.JobId[i]);
if (!del.PurgedFiles[i]) {
- Mmsg(&query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
}
- Mmsg(&query, "DELETE FROM Job WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM Job WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
- Mmsg(&query, "DELETE FROM JobMedia WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
}
{
char *query = (char *)get_pool_memory(PM_MESSAGE);
- Mmsg(&query, "DELETE FROM File WHERE JobId=%u", jr->JobId);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%u", jr->JobId);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, "UPDATE Job Set PurgedFiles=1 WHERE JobId=%u", jr->JobId);
+ Mmsg(query, "UPDATE Job Set PurgedFiles=1 WHERE JobId=%u", jr->JobId);
db_sql_query(ua->db, query, NULL, (void *)NULL);
free_pool_memory(query);
memset(&jr, 0, sizeof(jr));
memset(&del, 0, sizeof(del));
cnt.count = 0;
- Mmsg(&query, "SELECT count(*) FROM JobMedia WHERE MediaId=%d", mr->MediaId);
+ Mmsg(query, "SELECT count(*) FROM JobMedia WHERE MediaId=%d", mr->MediaId);
if (!db_sql_query(ua->db, query, count_handler, (void *)&cnt)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
Dmsg0(050, "Count failed\n");
*/
del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids);
- Mmsg(&query, "SELECT JobId FROM JobMedia WHERE MediaId=%d", mr->MediaId);
+ Mmsg(query, "SELECT JobId FROM JobMedia WHERE MediaId=%d", mr->MediaId);
if (!db_sql_query(ua->db, query, file_delete_handler, (void *)&del)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
Dmsg0(050, "Count failed\n");
for (i=0; i < del.num_ids; i++) {
Dmsg1(050, "Delete JobId=%d\n", del.JobId[i]);
- Mmsg(&query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM File WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM Job WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM Job WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
- Mmsg(&query, "DELETE FROM JobMedia WHERE JobId=%d", del.JobId[i]);
+ Mmsg(query, "DELETE FROM JobMedia WHERE JobId=%d", del.JobId[i]);
db_sql_query(ua->db, query, NULL, (void *)NULL);
Dmsg1(050, "Del sql=%s\n", query);
del.num_del++;
/* If purged, mark it so */
cnt.count = 0;
- Mmsg(&query, "SELECT count(*) FROM JobMedia WHERE MediaId=%d", mr->MediaId);
+ Mmsg(query, "SELECT count(*) FROM JobMedia WHERE MediaId=%d", mr->MediaId);
if (!db_sql_query(ua->db, query, count_handler, (void *)&cnt)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
Dmsg0(050, "Count failed\n");
}
}
if (*query != 0) {
- pm_strcat(&query, " ");
+ pm_strcat(query, " ");
}
- pm_strcat(&query, line);
+ pm_strcat(query, line);
if (line[len-1] != ';') {
continue;
}
/* Build run command */
if (rx.where) {
- Mmsg(&ua->cmd,
+ Mmsg(ua->cmd,
"run job=\"%s\" client=\"%s\" storage=\"%s\" bootstrap=\"%s/restore.bsr\""
" where=\"%s\" files=%d",
job->hdr.name, rx.ClientName, rx.store?rx.store->hdr.name:"",
working_directory, rx.where, rx.selected_files);
} else {
- Mmsg(&ua->cmd,
+ Mmsg(ua->cmd,
"run job=\"%s\" client=\"%s\" storage=\"%s\" bootstrap=\"%s/restore.bsr\""
" files=%d",
job->hdr.name, rx.ClientName, rx.store?rx.store->hdr.name:"",
working_directory, rx.selected_files);
}
if (find_arg(ua, _("yes")) > 0) {
- pm_strcat(&ua->cmd, " yes"); /* pass it on to the run command */
+ pm_strcat(ua->cmd, " yes"); /* pass it on to the run command */
}
Dmsg1(400, "Submitting: %s\n", ua->cmd);
parse_ua_args(ua);
switch (j) {
case 0: /* jobid */
if (*rx->JobIds != 0) {
- pm_strcat(&rx->JobIds, ",");
+ pm_strcat(rx->JobIds, ",");
}
- pm_strcat(&rx->JobIds, ua->argv[i]);
+ pm_strcat(rx->JobIds, ua->argv[i]);
done = true;
break;
case 1: /* current */
if (!get_client_name(ua, rx)) {
return 0;
}
- pm_strcpy(&ua->cmd, ua->argv[i]);
+ pm_strcpy(ua->cmd, ua->argv[i]);
insert_one_file(ua, rx, date);
if (rx->name_list.num_ids) {
/* Check MediaType and select storage that corresponds */
len = strlen(ua->cmd);
fname = (char *)malloc(len * 2 + 1);
db_escape_string(fname, ua->cmd, len);
- Mmsg(&rx->query, uar_file, fname);
+ Mmsg(rx->query, uar_file, fname);
free(fname);
gui_save = ua->jcr->gui;
ua->jcr->gui = true;
if (!get_cmd(ua, _("Enter JobId(s), comma separated, to restore: "))) {
return 0;
}
- pm_strcpy(&rx->JobIds, ua->cmd);
+ pm_strcpy(rx->JobIds, ua->cmd);
break;
case 3: /* Enter an SQL list command */
if (!get_cmd(ua, _("Enter SQL list command: "))) {
{
strip_trailing_junk(file);
split_path_and_filename(rx, file);
- Mmsg(&rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName);
+ Mmsg(rx->query, uar_jobid_fileindex, date, rx->path, rx->fname, rx->ClientName);
rx->found = false;
/* Find and insert jobid and File Index */
if (!db_sql_query(ua->db, rx->query, jobid_fileindex_handler, (void *)rx)) {
/*
* Find the MediaTypes for this JobId and add to the name_list
*/
- Mmsg(&rx->query, uar_mediatype, rx->JobId);
+ Mmsg(rx->query, uar_mediatype, rx->JobId);
if (!db_sql_query(ua->db, rx->query, unique_name_list_handler, (void *)&rx->name_list)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
return 0;
tree.FileEstimate = 0;
if (get_next_jobid_from_list(&p, &JobId) > 0) {
/* Use first JobId as estimate of the number of files to restore */
- Mmsg(&rx->query, uar_count_files, JobId);
+ Mmsg(rx->query, uar_count_files, JobId);
if (!db_sql_query(ua->db, rx->query, count_handler, (void *)rx)) {
bsendmsg(ua, "%s\n", db_strerror(ua->db));
}
continue; /* eliminate duplicate JobIds */
}
last_JobId = JobId;
- bsendmsg(ua, _("Building directory tree for JobId %u ...\n"), JobId);
+ bsendmsg(ua, _("\nBuilding directory tree for JobId %u ... "), JobId);
items++;
/*
* Find files for this JobId and insert them in the tree
*/
- Mmsg(&rx->query, uar_sel_files, JobId);
+ Mmsg(rx->query, uar_sel_files, JobId);
if (!db_sql_query(ua->db, rx->query, insert_tree_handler, (void *)&tree)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
/*
* Find the MediaTypes for this JobId and add to the name_list
*/
- Mmsg(&rx->query, uar_mediatype, JobId);
+ Mmsg(rx->query, uar_mediatype, JobId);
if (!db_sql_query(ua->db, rx->query, unique_name_list_handler, (void *)&rx->name_list)) {
bsendmsg(ua, "%s", db_strerror(ua->db));
}
}
}
if (i < 0) { /* fileset not found */
- Mmsg(&rx->query, uar_sel_fileset, cr.ClientId, cr.ClientId);
+ Mmsg(rx->query, uar_sel_fileset, cr.ClientId, cr.ClientId);
start_prompt(ua, _("The defined FileSet resources are:\n"));
if (!db_sql_query(ua->db, rx->query, fileset_handler, (void *)ua)) {
bsendmsg(ua, "%s\n", db_strerror(ua->db));
}
/* Find JobId of last Full backup for this client, fileset */
- Mmsg(&rx->query, uar_last_full, cr.ClientId, cr.ClientId, date, fsr.FileSet,
+ Mmsg(rx->query, uar_last_full, cr.ClientId, cr.ClientId, date, fsr.FileSet,
pool_select);
if (!db_sql_query(ua->db, rx->query, NULL, NULL)) {
bsendmsg(ua, "%s\n", db_strerror(ua->db));
}
/* Now find most recent Differental Job after Full save, if any */
- Mmsg(&rx->query, uar_dif, edit_uint64(rx->JobTDate, ed1), date,
+ Mmsg(rx->query, uar_dif, edit_uint64(rx->JobTDate, ed1), date,
cr.ClientId, fsr.FileSet, pool_select);
if (!db_sql_query(ua->db, rx->query, NULL, NULL)) {
bsendmsg(ua, "%s\n", db_strerror(ua->db));
}
/* Now find all Incremental Jobs after Full/dif save */
- Mmsg(&rx->query, uar_inc, edit_uint64(rx->JobTDate, ed1), date,
+ Mmsg(rx->query, uar_inc, edit_uint64(rx->JobTDate, ed1), date,
cr.ClientId, fsr.FileSet, pool_select);
if (!db_sql_query(ua->db, rx->query, NULL, NULL)) {
bsendmsg(ua, "%s\n", db_strerror(ua->db));
}
bstrncpy(rx->last_jobid, row[0], sizeof(rx->last_jobid));
if (rx->JobIds[0] != 0) {
- pm_strcat(&rx->JobIds, ",");
+ pm_strcat(rx->JobIds, ",");
}
- pm_strcat(&rx->JobIds, row[0]);
+ pm_strcat(rx->JobIds, row[0]);
return 0;
}
while (!ua->quit) {
stat = bnet_recv(ua->UA_sock);
if (stat >= 0) {
- pm_strcpy(&ua->cmd, ua->UA_sock->msg);
+ pm_strcpy(ua->cmd, ua->UA_sock->msg);
parse_ua_args(ua);
if (ua->argc > 0 && ua->argk[0][0] == '.') {
do_a_dot_command(ua, ua->cmd);
break;
case JS_WaitFD:
emsg = (char *) get_pool_memory(PM_FNAME);
- Mmsg(&emsg, _("is waiting on Client %s"), jcr->client->hdr.name);
+ Mmsg(emsg, _("is waiting on Client %s"), jcr->client->hdr.name);
pool_mem = true;
msg = emsg;
break;
case JS_WaitSD:
emsg = (char *) get_pool_memory(PM_FNAME);
- Mmsg(&emsg, _("is waiting on Storage %s"), jcr->store->hdr.name);
+ Mmsg(emsg, _("is waiting on Storage %s"), jcr->store->hdr.name);
pool_mem = true;
msg = emsg;
break;
default:
emsg = (char *) get_pool_memory(PM_FNAME);
- Mmsg(&emsg, _("is in unknown state %c"), jcr->JobStatus);
+ Mmsg(emsg, _("is in unknown state %c"), jcr->JobStatus);
pool_mem = true;
msg = emsg;
break;
emsg = (char *) get_pool_memory(PM_FNAME);
pool_mem = true;
}
- Mmsg(&emsg, _("is waiting for Client %s to connect to Storage %s"),
+ Mmsg(emsg, _("is waiting for Client %s to connect to Storage %s"),
jcr->client->hdr.name, jcr->store->hdr.name);
msg = emsg;
break;
free(jcr->RestoreBootstrap);
}
POOLMEM *fname = get_pool_memory(PM_MESSAGE);
- Mmsg(&fname, "%s/restore.bsr", working_directory);
+ Mmsg(fname, "%s/restore.bsr", working_directory);
jcr->RestoreBootstrap = bstrdup(fname);
free_pool_memory(fname);
decode_stat(attr, &statf, &LinkFIf); /* decode file stat packet */
do_SIG = NO_SIG;
jcr->fn_printed = false;
- pm_strcpy(&jcr->fname, fname); /* move filename into JCR */
+ pm_strcpy(jcr->fname, fname); /* move filename into JCR */
Dmsg2(040, "dird<filed: stream=%d %s\n", stream, jcr->fname);
Dmsg1(020, "dird<filed: attr=%s\n", attr);
unlink(jcr->RestoreBootstrap);
free_pool_memory(jcr->RestoreBootstrap);
}
- Mmsg(&fname, "%s/%s.%s.bootstrap", me->working_directory, me->hdr.name,
+ Mmsg(fname, "%s/%s.%s.bootstrap", me->working_directory, me->hdr.name,
jcr->Job);
Dmsg1(400, "bootstrap=%s\n", fname);
jcr->RestoreBootstrap = fname;
sd->msglen = strlen(sd->msg);
bnet_send(sd);
while (fgets(buf, sizeof(buf), bs)) {
- sd->msglen = Mmsg(&sd->msg, "%s", buf);
+ sd->msglen = Mmsg(sd->msg, "%s", buf);
bnet_send(sd);
}
bnet_sig(sd, BNET_EOD);
msg = (char *)get_pool_memory(PM_MESSAGE);
found = 0;
- len = Mmsg(&msg, "%s Version: " VERSION " (" BDATE ") %s %s %s\n", my_name,
+ len = Mmsg(msg, "%s Version: " VERSION " (" BDATE ") %s %s %s\n", my_name,
HOST_OS, DISTNAME, DISTVER);
sendit(msg, len, arg);
bstrftime_nc(dt, sizeof(dt), daemon_start_time);
- len = Mmsg(&msg, _("Daemon started %s, %d Job%s run since started.\n"),
+ len = Mmsg(msg, _("Daemon started %s, %d Job%s run since started.\n"),
dt, num_jobs_run, num_jobs_run == 1 ? "" : "s");
sendit(msg, len, arg);
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
if (!privs) {
privs = enable_backup_privileges(NULL, 1);
}
- len = Mmsg(&msg,
+ len = Mmsg(msg,
_(" Priv 0x%x APIs=%sOPT,%sATP,%sLPV,%sGFAE,%sBR,%sBW,%sSPSP\n"), privs,
p_OpenProcessToken?"":"!",
p_AdjustTokenPrivileges?"":"!",
}
#endif
if (debug_level > 0) {
- len = Mmsg(&msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
+ len = Mmsg(msg, _(" Heap: bytes=%s max_bytes=%s bufs=%s max_bufs=%s\n"),
edit_uint64_with_commas(sm_bytes, b1),
edit_uint64_with_commas(sm_max_bytes, b2),
edit_uint64_with_commas(sm_buffers, b3),
sendit(msg, len, arg);
}
if (debug_level > 0) {
- len = Mmsg(&msg, _(" Sizeof: off_t=%d size_t=%d\n"), sizeof(off_t),
+ len = Mmsg(msg, _(" Sizeof: off_t=%d size_t=%d\n"), sizeof(off_t),
sizeof(size_t));
sendit(msg, len, arg);
}
* List running jobs
*/
Dmsg0(1000, "Begin status jcr loop.\n");
- len = Mmsg(&msg, _("Running Jobs:\n"));
+ len = Mmsg(msg, _("Running Jobs:\n"));
sendit(msg, len, arg);
lock_jcr_chain();
foreach_jcr(njcr) {
bstrftime_nc(dt, sizeof(dt), njcr->start_time);
if (njcr->JobId == 0) {
- len = Mmsg(&msg, _("Director connected at: %s\n"), dt);
+ len = Mmsg(msg, _("Director connected at: %s\n"), dt);
} else {
- len = Mmsg(&msg, _("JobId %d Job %s is running.\n"),
+ len = Mmsg(msg, _("JobId %d Job %s is running.\n"),
njcr->JobId, njcr->Job);
sendit(msg, len, arg);
- len = Mmsg(&msg, _(" %s Job started: %s\n"),
+ len = Mmsg(msg, _(" %s Job started: %s\n"),
job_type_to_str(njcr->JobType), dt);
}
sendit(msg, len, arg);
sec = 1;
}
bps = (int)(njcr->JobBytes / sec);
- len = Mmsg(&msg, _(" Files=%s Bytes=%s Bytes/sec=%s\n"),
+ len = Mmsg(msg, _(" Files=%s Bytes=%s Bytes/sec=%s\n"),
edit_uint64_with_commas(njcr->JobFiles, b1),
edit_uint64_with_commas(njcr->JobBytes, b2),
edit_uint64_with_commas(bps, b3));
sendit(msg, len, arg);
- len = Mmsg(&msg, _(" Files Examined=%s\n"),
+ len = Mmsg(msg, _(" Files Examined=%s\n"),
edit_uint64_with_commas(njcr->num_files_examined, b1));
sendit(msg, len, arg);
if (njcr->JobFiles > 0) {
P(njcr->mutex);
- len = Mmsg(&msg, _(" Processing file: %s\n"), njcr->last_fname);
+ len = Mmsg(msg, _(" Processing file: %s\n"), njcr->last_fname);
V(njcr->mutex);
sendit(msg, len, arg);
}
found = 1;
if (njcr->store_bsock) {
- len = Mmsg(&msg, " SDReadSeqNo=%" lld " fd=%d\n",
+ len = Mmsg(msg, " SDReadSeqNo=%" lld " fd=%d\n",
njcr->store_bsock->read_seqno, njcr->store_bsock->fd);
sendit(msg, len, arg);
} else {
- len = Mmsg(&msg, _(" SDSocket closed.\n"));
+ len = Mmsg(msg, _(" SDSocket closed.\n"));
sendit(msg, len, arg);
}
free_locked_jcr(njcr);
unlock_jcr_chain();
Dmsg0(1000, "Begin status jcr loop.\n");
if (!found) {
- len = Mmsg(&msg, _("No Jobs running.\n"));
+ len = Mmsg(msg, _("No Jobs running.\n"));
sendit(msg, len, arg);
}
- len = Mmsg(&msg, _("====\n"));
+ len = Mmsg(msg, _("====\n"));
sendit(msg, len, arg);
free_pool_memory(msg);
}
extern JCR *get_jcr_by_partial_name(char *Job);
extern JCR *get_jcr_by_full_name(char *Job);
extern JCR *get_next_jcr(JCR *jcr);
+extern void set_jcr_job_status(JCR *jcr, int JobStatus);
+
+#ifdef TRACE_JCR_CHAIN
+extern void b_lock_jcr_chain(const char *filen, int line);
+extern void b_unlock_jcr_chain(const char *filen, int line);
+#define lock_jcr_chain() b_lock_jcr_chain(__FILE__, __LINE__);
+#define unlock_jcr_chain() b_unlock_jcr_chain(__FILE__, __LINE__);
+#else
extern void lock_jcr_chain();
extern void unlock_jcr_chain();
-extern void set_jcr_job_status(JCR *jcr, int JobStatus);
+#endif
#ifdef DEBUG
extern void b_free_jcr(const char *file, int line, JCR *jcr);
#endif
+ dequeue_messages(jcr);
lock_jcr_chain();
jcr->use_count--; /* decrement use count */
if (jcr->use_count < 0) {
Dmsg2(400, "free_jcr 0x%x use_count=%d\n", jcr, jcr->use_count);
return;
}
- dequeue_messages(jcr);
- remove_jcr(jcr);
+ remove_jcr(jcr); /* remove Jcr from chain */
+ unlock_jcr_chain();
+
job_end_pop(jcr); /* pop and call hooked routines */
Dmsg1(400, "End job=%d\n", jcr->JobId);
if (jcr->daemon_free_jcr) {
jcr->daemon_free_jcr(jcr); /* call daemon free routine */
}
-
free_common_jcr(jcr);
-
close_msg(NULL); /* flush any daemon messages */
- unlock_jcr_chain();
Dmsg0(400, "Exit free_jcr\n");
}
/*
* Lock the chain
*/
+#ifdef TRACE_JCR_CHAIN
+void b_lock_jcr_chain(const char *fname, int line)
+#else
void lock_jcr_chain()
+#endif
{
int errstat;
#ifdef TRACE_JCR_CHAIN
- Dmsg1(000, "Lock jcr chain %d.\n", ++lock_count);
+ Dmsg3(000, "Lock jcr chain %d from %s:%d\n", ++lock_count,
+ fname, line);
#endif
if ((errstat=rwl_writelock(&lock)) != 0) {
Emsg1(M_ABORT, 0, "rwl_writelock failure. ERR=%s\n",
/*
* Unlock the chain
*/
+#ifdef TRACE_JCR_CHAIN
+void b_unlock_jcr_chain(const char *fname, int line)
+#else
void unlock_jcr_chain()
+#endif
{
int errstat;
#ifdef TRACE_JCR_CHAIN
- Dmsg1(000, "Unlock jcr chain %d\n", lock_count--);
+ Dmsg3(000, "Unlock jcr chain %d from %s:%d\n", lock_count--,
+ fname, line);
#endif
if ((errstat=rwl_writeunlock(&lock)) != 0) {
Emsg1(M_ABORT, 0, "rwl_writeunlock failure. ERR=%s\n",
/*
* Create a unique filename for the mail command
*/
-static void make_unique_mail_filename(JCR *jcr, POOLMEM **name, DEST *d)
+static void make_unique_mail_filename(JCR *jcr, POOLMEM *&name, DEST *d)
{
if (jcr) {
Mmsg(name, "%s/%s.mail.%s.%d", working_directory, my_name,
/*
* Open a mail pipe
*/
-static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM **cmd, DEST *d)
+static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM *&cmd, DEST *d)
{
BPIPE *bpipe;
int use_bsmtp = (d->mail_cmd && jcr);
if (use_bsmtp) {
- *cmd = edit_job_codes(jcr, *cmd, d->mail_cmd, d->where);
+ cmd = edit_job_codes(jcr, cmd, d->mail_cmd, d->where);
} else {
#if 1
Mmsg(cmd, "/usr/lib/sendmail -F Bacula %s", d->where);
}
fflush(stdout);
- if (!(bpipe = open_bpipe(*cmd, 120, "rw"))) {
+ if (!(bpipe = open_bpipe(cmd, 120, "rw"))) {
+ berrno be;
Jmsg(jcr, M_ERROR, 0, "open mail pipe %s failed: ERR=%s\n",
- *cmd, strerror(errno));
+ cmd, be.strerror());
}
#if 1
goto rem_temp_file;
}
- if (!(bpipe=open_mail_pipe(jcr, &cmd, d))) {
+ if (!(bpipe=open_mail_pipe(jcr, cmd, d))) {
Pmsg0(000, "open mail pipe failed.\n");
goto rem_temp_file;
}
case MD_OPERATOR:
Dmsg1(800, "OPERATOR for collowing msg: %s\n", msg);
mcmd = get_pool_memory(PM_MESSAGE);
- if ((bpipe=open_mail_pipe(jcr, &mcmd, d))) {
+ if ((bpipe=open_mail_pipe(jcr, mcmd, d))) {
int stat;
fputs(msg, bpipe->wfd);
/* Messages to the operator go one at a time */
Dmsg1(800, "MAIL for following msg: %s", msg);
if (!d->fd) {
POOLMEM *name = get_pool_memory(PM_MESSAGE);
- make_unique_mail_filename(jcr, &mp_chr(name), d);
+ make_unique_mail_filename(jcr, name, d);
d->fd = fopen(mp_chr(name), "w+");
if (!d->fd) {
d->fd = stdout;
POOLMEM *pool_buf;
pool_buf = get_pool_memory(PM_EMSG);
- i = Mmsg(&pool_buf, "%s:%d ", file, line);
+ i = Mmsg(pool_buf, "%s:%d ", file, line);
for (;;) {
maxlen = sizeof_pool_memory(pool_buf) - i - 1;
return len;
}
+int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...)
+{
+ va_list arg_ptr;
+ int i, len, maxlen;
+
+ i = sprintf(pool_buf, "%s:%d ", file, line);
+
+ for (;;) {
+ maxlen = sizeof_pool_memory(pool_buf) - i - 1;
+ va_start(arg_ptr, fmt);
+ len = bvsnprintf(pool_buf+i, maxlen, fmt, arg_ptr);
+ va_end(arg_ptr);
+ if (len < 0 || len >= (maxlen-5)) {
+ pool_buf = realloc_pool_memory(pool_buf, maxlen + i + maxlen/2);
+ continue;
+ }
+ break;
+ }
+ return len;
+}
+
+
/*
* Edit a message into a Pool Memory buffer NO file:lineno
* Returns: string length of what was edited.
return len;
}
+int Mmsg(POOLMEM *&pool_buf, const char *fmt, ...)
+{
+ va_list arg_ptr;
+ int len, maxlen;
+
+ for (;;) {
+ maxlen = sizeof_pool_memory(pool_buf) - 1;
+ va_start(arg_ptr, fmt);
+ len = bvsnprintf(pool_buf, maxlen, fmt, arg_ptr);
+ va_end(arg_ptr);
+ if (len < 0 || len >= (maxlen-5)) {
+ pool_buf = realloc_pool_memory(pool_buf, maxlen + maxlen/2);
+ continue;
+ }
+ break;
+ }
+ return len;
+}
+
+
static pthread_mutex_t msg_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
/*
POOLMEM *pool_buf;
pool_buf = get_pool_memory(PM_EMSG);
- i = Mmsg(&pool_buf, "%s:%d ", file, line);
+ i = Mmsg(pool_buf, "%s:%d ", file, line);
for (;;) {
maxlen = sizeof_pool_memory(pool_buf) - i - 1;
struct JCR;
/* attr.c */
-ATTR *new_attr();
-void free_attr(ATTR *attr);
-int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
-void build_attr_output_fnames(JCR *jcr, ATTR *attr);
-void print_ls_output(JCR *jcr, ATTR *attr);
+ATTR *new_attr();
+void free_attr(ATTR *attr);
+int unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
+void build_attr_output_fnames(JCR *jcr, ATTR *attr);
+void print_ls_output(JCR *jcr, ATTR *attr);
/* base64.c */
-void base64_init (void);
-int to_base64 (intmax_t value, char *where);
-int from_base64 (intmax_t *value, char *where);
-int bin_to_base64 (char *buf, char *bin, int len);
+void base64_init (void);
+int to_base64 (intmax_t value, char *where);
+int from_base64 (intmax_t *value, char *where);
+int bin_to_base64 (char *buf, char *bin, int len);
/* bsys.c */
-char *bstrncpy (char *dest, const char *src, int maxlen);
-char *bstrncat (char *dest, const char *src, int maxlen);
-void *b_malloc (const char *file, int line, size_t size);
+char *bstrncpy (char *dest, const char *src, int maxlen);
+char *bstrncat (char *dest, const char *src, int maxlen);
+void *b_malloc (const char *file, int line, size_t size);
#ifndef DEBUG
-void *bmalloc (size_t size);
+void *bmalloc (size_t size);
#endif
-void *brealloc (void *buf, size_t size);
-void *bcalloc (size_t size1, size_t size2);
-int bsnprintf (char *str, int32_t size, const char *format, ...);
-int bvsnprintf (char *str, int32_t size, const char *format, va_list ap);
-int pool_sprintf (char *pool_buf, const char *fmt, ...);
-void create_pid_file (char *dir, const char *progname, int port);
-int delete_pid_file (char *dir, const char *progname, int port);
-void drop (char *uid, char *gid);
-int bmicrosleep (time_t sec, long usec);
-char *bfgets (char *s, int size, FILE *fd);
-void make_unique_filename (POOLMEM **name, int Id, char *what);
+void *brealloc (void *buf, size_t size);
+void *bcalloc (size_t size1, size_t size2);
+int bsnprintf (char *str, int32_t size, const char *format, ...);
+int bvsnprintf (char *str, int32_t size, const char *format, va_list ap);
+int pool_sprintf (char *pool_buf, const char *fmt, ...);
+void create_pid_file (char *dir, const char *progname, int port);
+int delete_pid_file (char *dir, const char *progname, int port);
+void drop (char *uid, char *gid);
+int bmicrosleep (time_t sec, long usec);
+char *bfgets (char *s, int size, FILE *fd);
+void make_unique_filename (POOLMEM **name, int Id, char *what);
#ifndef HAVE_STRTOLL
-long long int strtoll (const char *ptr, char **endptr, int base);
+long long int strtoll (const char *ptr, char **endptr, int base);
#endif
-void read_state_file(char *dir, const char *progname, int port);
-int bstrerror(int errnum, char *buf, size_t bufsiz);
+void read_state_file(char *dir, const char *progname, int port);
+int bstrerror(int errnum, char *buf, size_t bufsiz);
/* bnet.c */
-int32_t bnet_recv (BSOCK *bsock);
-bool bnet_send (BSOCK *bsock);
-bool bnet_fsend (BSOCK *bs, const char *fmt, ...);
-bool bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
-bool bnet_sig (BSOCK *bs, int sig);
-int bnet_ssl_server (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
-int bnet_ssl_client (BSOCK *bsock, char *password, int ssl_need);
-BSOCK * bnet_connect (JCR *jcr, int retry_interval,
- int max_retry_time, const char *name, char *host, char *service,
- int port, int verbose);
-void bnet_close (BSOCK *bsock);
-BSOCK * init_bsock (JCR *jcr, int sockfd, const char *who, const char *ip,
- int port, struct sockaddr *client_addr);
-BSOCK * dup_bsock (BSOCK *bsock);
-void term_bsock (BSOCK *bsock);
-char * bnet_strerror (BSOCK *bsock);
-const char *bnet_sig_to_ascii (BSOCK *bsock);
-int bnet_wait_data (BSOCK *bsock, int sec);
-int bnet_wait_data_intr (BSOCK *bsock, int sec);
-int bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
-bool is_bnet_stop (BSOCK *bsock);
-int is_bnet_error (BSOCK *bsock);
-void bnet_suppress_error_messages(BSOCK *bsock, bool flag);
+int32_t bnet_recv (BSOCK *bsock);
+bool bnet_send (BSOCK *bsock);
+bool bnet_fsend (BSOCK *bs, const char *fmt, ...);
+bool bnet_set_buffer_size (BSOCK *bs, uint32_t size, int rw);
+bool bnet_sig (BSOCK *bs, int sig);
+int bnet_ssl_server (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
+int bnet_ssl_client (BSOCK *bsock, char *password, int ssl_need);
+BSOCK * bnet_connect (JCR *jcr, int retry_interval,
+ int max_retry_time, const char *name, char *host, char *service,
+ int port, int verbose);
+void bnet_close (BSOCK *bsock);
+BSOCK * init_bsock (JCR *jcr, int sockfd, const char *who, const char *ip,
+ int port, struct sockaddr *client_addr);
+BSOCK * dup_bsock (BSOCK *bsock);
+void term_bsock (BSOCK *bsock);
+char * bnet_strerror (BSOCK *bsock);
+const char *bnet_sig_to_ascii (BSOCK *bsock);
+int bnet_wait_data (BSOCK *bsock, int sec);
+int bnet_wait_data_intr (BSOCK *bsock, int sec);
+int bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
+bool is_bnet_stop (BSOCK *bsock);
+int is_bnet_error (BSOCK *bsock);
+void bnet_suppress_error_messages(BSOCK *bsock, bool flag);
dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr);
/* bget_msg.c */
-int bget_msg(BSOCK *sock);
+int bget_msg(BSOCK *sock);
/* bpipe.c */
-BPIPE * open_bpipe(char *prog, int wait, const char *mode);
-int close_wpipe(BPIPE *bpipe);
-int close_bpipe(BPIPE *bpipe);
+BPIPE * open_bpipe(char *prog, int wait, const char *mode);
+int close_wpipe(BPIPE *bpipe);
+int close_bpipe(BPIPE *bpipe);
/* cram-md5.c */
int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need);
int cram_md5_auth(BSOCK *bs, char *password, int ssl_need);
void hmac_md5(uint8_t* text, int text_len, uint8_t* key,
- int key_len, uint8_t *hmac);
+ int key_len, uint8_t *hmac);
/* crc32.c */
uint32_t bcrc32(uint8_t *buf, int len);
/* daemon.c */
-void daemon_start ();
+void daemon_start ();
/* edit.c */
-uint64_t str_to_uint64(char *str);
-int64_t str_to_int64(char *str);
-char * edit_uint64_with_commas (uint64_t val, char *buf);
-char * add_commas (char *val, char *buf);
-char * edit_uint64 (uint64_t val, char *buf);
-int duration_to_utime (char *str, utime_t *value);
-int size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
-char *edit_utime (utime_t val, char *buf, int buf_len);
-bool is_a_number (const char *num);
-bool is_an_integer (const char *n);
-bool is_name_valid (char *name, POOLMEM **msg);
+uint64_t str_to_uint64(char *str);
+int64_t str_to_int64(char *str);
+char * edit_uint64_with_commas (uint64_t val, char *buf);
+char * add_commas (char *val, char *buf);
+char * edit_uint64 (uint64_t val, char *buf);
+int duration_to_utime (char *str, utime_t *value);
+int size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
+char *edit_utime (utime_t val, char *buf, int buf_len);
+bool is_a_number (const char *num);
+bool is_an_integer (const char *n);
+bool is_name_valid (char *name, POOLMEM **msg);
/* jcr.c (most definitions are in src/jcr.h) */
void init_last_jobs_list();
/* lex.c */
-LEX * lex_close_file (LEX *lf);
-LEX * lex_open_file (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
-int lex_get_char (LEX *lf);
-void lex_unget_char (LEX *lf);
-const char * lex_tok_to_str (int token);
-int lex_get_token (LEX *lf, int expect);
+LEX * lex_close_file (LEX *lf);
+LEX * lex_open_file (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
+int lex_get_char (LEX *lf);
+void lex_unget_char (LEX *lf);
+const char * lex_tok_to_str (int token);
+int lex_get_token (LEX *lf, int expect);
/* message.c */
-void my_name_is (int argc, char *argv[], const char *name);
-void init_msg (JCR *jcr, MSGS *msg);
-void term_msg (void);
-void close_msg (JCR *jcr);
-void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
-void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
-void Jmsg (JCR *jcr, int type, int level, const char *fmt, ...);
-void dispatch_message (JCR *jcr, int type, int level, char *buf);
-void init_console_msg (const char *wd);
-void free_msgs_res (MSGS *msgs);
-void dequeue_messages (JCR *jcr);
-void set_trace (int trace_flag);
-void set_exit_on_error (int value);
+void my_name_is (int argc, char *argv[], const char *name);
+void init_msg (JCR *jcr, MSGS *msg);
+void term_msg (void);
+void close_msg (JCR *jcr);
+void add_msg_dest (MSGS *msg, int dest, int type, char *where, char *dest_code);
+void rem_msg_dest (MSGS *msg, int dest, int type, char *where);
+void Jmsg (JCR *jcr, int type, int level, const char *fmt, ...);
+void dispatch_message (JCR *jcr, int type, int level, char *buf);
+void init_console_msg (const char *wd);
+void free_msgs_res (MSGS *msgs);
+void dequeue_messages (JCR *jcr);
+void set_trace (int trace_flag);
+void set_exit_on_error (int value);
/* bnet_server.c */
-void bnet_thread_server(dlist *addr, int max_clients, workq_t *client_wq,
- void *handle_client_request(void *bsock));
-void bnet_stop_thread_server(pthread_t tid);
-void bnet_server (int port, void handle_client_request(BSOCK *bsock));
-int net_connect (int port);
-BSOCK * bnet_bind (int port);
-BSOCK * bnet_accept (BSOCK *bsock, char *who);
+void bnet_thread_server(dlist *addr, int max_clients, workq_t *client_wq,
+ void *handle_client_request(void *bsock));
+void bnet_stop_thread_server(pthread_t tid);
+void bnet_server (int port, void handle_client_request(BSOCK *bsock));
+int net_connect (int port);
+BSOCK * bnet_bind (int port);
+BSOCK * bnet_accept (BSOCK *bsock, char *who);
/* idcache.c */
char *getuser(uid_t uid);
/* signal.c */
-void init_signals (void terminate(int sig));
-void init_stack_dump (void);
+void init_signals (void terminate(int sig));
+void init_stack_dump (void);
/* scan.c */
-void strip_trailing_junk (char *str);
-void strip_trailing_slashes (char *dir);
-bool skip_spaces (char **msg);
-bool skip_nonspaces (char **msg);
-int fstrsch (const char *a, const char *b);
-char *next_arg(char **s);
-int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc,
- char **argk, char **argv, int max_args);
-void split_path_and_filename(const char *fname, POOLMEM **path,
- int *pnl, POOLMEM **file, int *fnl);
-int bsscanf(const char *buf, const char *fmt, ...);
+void strip_trailing_junk (char *str);
+void strip_trailing_slashes (char *dir);
+bool skip_spaces (char **msg);
+bool skip_nonspaces (char **msg);
+int fstrsch (const char *a, const char *b);
+char *next_arg(char **s);
+int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc,
+ char **argk, char **argv, int max_args);
+void split_path_and_filename(const char *fname, POOLMEM **path,
+ int *pnl, POOLMEM **file, int *fnl);
+int bsscanf(const char *buf, const char *fmt, ...);
/* util.c */
-int is_buf_zero (char *buf, int len);
-void lcase (char *str);
-void bash_spaces (char *str);
-void unbash_spaces (char *str);
-char * encode_time (time_t time, char *buf);
-char * encode_mode (mode_t mode, char *buf);
-int do_shell_expansion (char *name, int name_len);
-void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
-int pm_strcat (POOLMEM **pm, const char *str);
-int pm_strcpy (POOLMEM **pm, const char *str);
-int run_program (char *prog, int wait, POOLMEM *results);
-const char * job_type_to_str (int type);
-const char * job_status_to_str (int stat);
-const char * job_level_to_str (int level);
-void make_session_key (char *key, char *seed, int mode);
-POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
-void set_working_directory(char *wd);
+int is_buf_zero (char *buf, int len);
+void lcase (char *str);
+void bash_spaces (char *str);
+void unbash_spaces (char *str);
+char * encode_time (time_t time, char *buf);
+char * encode_mode (mode_t mode, char *buf);
+int do_shell_expansion (char *name, int name_len);
+void jobstatus_to_ascii (int JobStatus, char *msg, int maxlen);
+int pm_strcat (POOLMEM **pm, const char *str);
+int pm_strcat (POOLMEM *&pm, const char *str);
+int pm_strcpy (POOLMEM **pm, const char *str);
+int pm_strcpy (POOLMEM *&pm, const char *str);
+int run_program (char *prog, int wait, POOLMEM *results);
+const char * job_type_to_str (int type);
+const char * job_status_to_str (int stat);
+const char * job_level_to_str (int level);
+void make_session_key (char *key, char *seed, int mode);
+POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
+void set_working_directory(char *wd);
/* watchdog.c */
return pmlen + len - 1;
}
+int pm_strcat(POOLMEM *&pm, const char *str)
+{
+ int pmlen = strlen(pm);
+ int len = strlen(str) + 1;
+
+ pm = check_pool_memory_size(pm, pmlen + len);
+ memcpy(pm+pmlen, str, len);
+ return pmlen + len - 1;
+}
+
+
/*
* Copy a string (str) into a pool memory buffer pm
return len - 1;
}
+int pm_strcpy(POOLMEM *&pm, const char *str)
+{
+ int len = strlen(str) + 1;
+
+ pm = check_pool_memory_size(pm, len);
+ memcpy(pm, str, len);
+ return len - 1;
+}
+
+
+
+
/*
* Convert a JobStatus code into a human readable form
for (i=0; i<5; i++) {
if (job_canceled(jcr)) {
- Mmsg1(&dev->errmsg, _("Job %d canceled.\n"), jcr->JobId);
+ Mmsg1(dev->errmsg, _("Job %d canceled.\n"), jcr->JobId);
goto get_out; /* error return */
}
/*
dcr->VolumeName[0] = 0; /* No volume */
if (bnet_recv(dir) <= 0) {
Dmsg0(200, "getvolname error bnet_recv\n");
- Mmsg(&jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
+ Mmsg(jcr->errmsg, _("Network error on bnet_recv in req_vol_info.\n"));
return false;
}
memset(&vol, 0, sizeof(vol));
&InChanger, &vol.VolReadTime, &vol.VolWriteTime);
if (n != 17) {
Dmsg2(100, "Bad response from Dir fields=%d: %s\n", n, dir->msg);
- Mmsg(&jcr->errmsg, _("Error getting Volume info: %s\n"), dir->msg);
+ Mmsg(jcr->errmsg, _("Error getting Volume info: %s\n"), dir->msg);
return false;
}
vol.InChanger = InChanger; /* bool in structure */
ASSERT(dev->dev_blocked);
for ( ;; ) {
if (job_canceled(jcr)) {
- Mmsg(&dev->errmsg,
+ Mmsg(dev->errmsg,
_("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"),
jcr->Job, jcr->dev_name);
Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
if (stat == ETIMEDOUT) {
if (!double_dev_wait_time(dev)) {
- Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
+ Mmsg(dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
dev_name(dev), jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
Dmsg1(190, "Gave up waiting on device %s\n", dev_name(dev));
continue;
}
if (stat == EINVAL) {
- Mmsg2(&dev->errmsg, _("pthread error in mount_next_volume stat=%d ERR=%s\n"),
+ Mmsg2(dev->errmsg, _("pthread error in mount_next_volume stat=%d ERR=%s\n"),
stat, strerror(stat));
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
return false;
Dmsg0(130, "enter dir_ask_sysop_to_mount_volume\n");
if (!jcr->VolumeName[0]) {
- Mmsg0(&dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
+ Mmsg0(dev->errmsg, _("Cannot request another volume: no volume name given.\n"));
return 0;
}
ASSERT(dev->dev_blocked);
for ( ;; ) {
if (job_canceled(jcr)) {
- Mmsg(&dev->errmsg, _("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"),
+ Mmsg(dev->errmsg, _("Job %s canceled while waiting for mount on Storage Device \"%s\".\n"),
jcr->Job, jcr->dev_name);
return false;
}
if (stat == ETIMEDOUT) {
if (!double_dev_wait_time(dev)) {
- Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
+ Mmsg(dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"),
dev_name(dev), jcr->Job);
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
Dmsg1(190, "Gave up waiting on device %s\n", dev_name(dev));
continue;
}
if (stat == EINVAL) {
- Mmsg2(&dev->errmsg, _("pthread error in mount_volume stat=%d ERR=%s\n"),
+ Mmsg2(dev->errmsg, _("pthread error in mount_volume stat=%d ERR=%s\n"),
stat, strerror(stat));
Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg);
return false;
block->bufp = block->buf + bhl;
if (strncmp(Id, BLKHDR1_ID, BLKHDR_ID_LENGTH) != 0) {
dev->dev_errno = EIO;
- Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
+ Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
dev->file, dev->block_num, BLKHDR1_ID, Id);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
block->bufp = block->buf + bhl;
if (strncmp(Id, BLKHDR2_ID, BLKHDR_ID_LENGTH) != 0) {
dev->dev_errno = EIO;
- Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
+ Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
dev->file, dev->block_num, BLKHDR2_ID, Id);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
} else {
dev->dev_errno = EIO;
- Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
+ Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
dev->file, dev->block_num, BLKHDR2_ID, Id);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
/* Sanity check */
if (block_len > MAX_BLOCK_LENGTH) {
dev->dev_errno = EIO;
- Mmsg3(&dev->errmsg, _("Volume data error at %u:%u! Block length %u is insane (too large), probably due to a bad archive.\n"),
+ Mmsg3(dev->errmsg, _("Volume data error at %u:%u! Block length %u is insane (too large), probably due to a bad archive.\n"),
dev->file, dev->block_num, block_len);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
block_len-BLKHDR_CS_LENGTH);
if (BlockCheckSum != CheckSum) {
dev->dev_errno = EIO;
- Mmsg5(&dev->errmsg, _("Volume data error at %u:%u! Block checksum mismatch in block %u: calc=%x blk=%x\n"),
+ Mmsg5(dev->errmsg, _("Volume data error at %u:%u! Block checksum mismatch in block %u: calc=%x blk=%x\n"),
dev->file, dev->block_num, (unsigned)BlockNumber, BlockCheckSum, CheckSum);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
reread:
if (looping > 1) {
dev->dev_errno = EIO;
- Mmsg1(&dev->errmsg, _("Block buffer size looping problem on device %s\n"),
+ Mmsg1(dev->errmsg, _("Block buffer size looping problem on device %s\n"),
dev->dev_name);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
block->read_len = 0;
clrerror_dev(dev, -1);
Dmsg1(90, "Read device got: ERR=%s\n", strerror(errno));
block->read_len = 0;
- Mmsg4(&dev->errmsg, _("Read error at file:blk %u:%u on device %s. ERR=%s.\n"),
+ Mmsg4(dev->errmsg, _("Read error at file:blk %u:%u on device %s. ERR=%s.\n"),
dev->file, dev->block_num, dev->dev_name, strerror(dev->dev_errno));
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
if (dev->state & ST_EOF) { /* EOF just seen? */
Dmsg1(90, "Read device got %d bytes\n", stat);
if (stat == 0) { /* Got EOF ! */
dev->block_num = block->read_len = 0;
- Mmsg3(&dev->errmsg, _("Read zero bytes at %u:%u on device %s.\n"),
+ Mmsg3(dev->errmsg, _("Read zero bytes at %u:%u on device %s.\n"),
dev->file, dev->block_num, dev->dev_name);
if (dev->state & ST_EOF) { /* EOF already read? */
dev->state |= ST_EOT; /* yes, 2 EOFs => EOT */
block->read_len = stat; /* save length read */
if (block->read_len < BLKHDR2_LENGTH) {
dev->dev_errno = EIO;
- Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Very short block of %d bytes on device %s discarded.\n"),
+ Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Very short block of %d bytes on device %s discarded.\n"),
dev->file, dev->block_num, block->read_len, dev->dev_name);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
dev->state |= ST_SHORT; /* set short block */
*/
if (block->block_len > block->buf_len) {
dev->dev_errno = EIO;
- Mmsg2(&dev->errmsg, _("Block length %u is greater than buffer %u. Attempting recovery.\n"),
+ Mmsg2(dev->errmsg, _("Block length %u is greater than buffer %u. Attempting recovery.\n"),
block->block_len, block->buf_len);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
Pmsg1(000, "%s", dev->errmsg);
lseek(dev->fd, pos, SEEK_SET);
dev->file_addr = pos;
}
- Mmsg1(&dev->errmsg, _("Setting block buffer size to %u bytes.\n"), block->block_len);
+ Mmsg1(dev->errmsg, _("Setting block buffer size to %u bytes.\n"), block->block_len);
Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
Pmsg1(000, "%s", dev->errmsg);
/* Set new block length */
if (block->block_len > block->read_len) {
dev->dev_errno = EIO;
- Mmsg4(&dev->errmsg, _("Volume data error at %u:%u! Short block of %d bytes on device %s discarded.\n"),
+ Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Short block of %d bytes on device %s discarded.\n"),
dev->file, dev->block_num, block->read_len, dev->dev_name);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
dev->state |= ST_SHORT; /* set short block */
for (;;) {
if ((stat = read(dev->fd, buf, sizeof(buf))) < 0) {
clrerror_dev(dev, -1);
- Mmsg2(&dev->errmsg, "read error on %s. ERR=%s.\n",
+ Mmsg2(dev->errmsg, "read error on %s. ERR=%s.\n",
dev->dev_name, strerror(dev->dev_errno));
Pmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev));
if (blocks > 0)
* Handle opening of File Archive (not a tape)
*/
if (VolName == NULL || *VolName == 0) {
- Mmsg(&dev->errmsg, _("Could not open file device %s. No Volume name given.\n"),
+ Mmsg(dev->errmsg, _("Could not open file device %s. No Volume name given.\n"),
dev->dev_name);
return -1;
}
/*
* Return string message with last error in English
* Be careful not to call this routine from within dev.c
- * while editing an Mmsg(&) or you will end up in a recursive
+ * while editing an Mmsg() or you will end up in a recursive
* loop creating a Segmentation Violation.
*/
char *
unlink(jcr->RestoreBootstrap);
free_pool_memory(jcr->RestoreBootstrap);
}
- Mmsg(&fname, "%s/%s.%s.bootstrap", me->working_directory, me->hdr.name,
+ Mmsg(fname, "%s/%s.%s.bootstrap", me->working_directory, me->hdr.name,
jcr->Job);
Dmsg1(400, "bootstrap=%s\n", fname);
jcr->RestoreBootstrap = fname;
if (dev_state(dev, ST_LABEL)) { /* did we already read label? */
/* Compare Volume Names allow special wild card */
if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
- Mmsg(&jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
+ Mmsg(jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
dev_name(dev), VolName, dev->VolHdr.VolName);
/*
* Cancel Job if too many label errors
dev->state &= ~(ST_LABEL|ST_APPEND|ST_READ); /* set no label, no append */
if (!rewind_dev(dev)) {
- Mmsg(&jcr->errmsg, _("Couldn't rewind device %s ERR=%s\n"), dev_name(dev),
+ Mmsg(jcr->errmsg, _("Couldn't rewind device %s ERR=%s\n"), dev_name(dev),
strerror_dev(dev));
return jcr->label_status = VOL_NO_MEDIA;
}
record = new_record();
Dmsg0(90, "Big if statement in read_volume_label\n");
if (!read_block_from_dev(dcr, block, NO_BLOCK_NUMBER_CHECK)) {
- Mmsg(&jcr->errmsg, _("Requested Volume \"%s\" on %s is not a Bacula "
+ Mmsg(jcr->errmsg, _("Requested Volume \"%s\" on %s is not a Bacula "
"labeled Volume, because: ERR=%s"), NPRT(VolName), dev_name(dev),
strerror_dev(dev));
} else if (!read_record_from_block(block, record)) {
- Mmsg(&jcr->errmsg, _("Could not read Volume label from block.\n"));
+ Mmsg(jcr->errmsg, _("Could not read Volume label from block.\n"));
} else if (!unser_volume_label(dev, record)) {
- Mmsg(&jcr->errmsg, _("Could not unserialize Volume label: ERR=%s\n"),
+ Mmsg(jcr->errmsg, _("Could not unserialize Volume label: ERR=%s\n"),
strerror_dev(dev));
} else if (strcmp(dev->VolHdr.Id, BaculaId) != 0 &&
strcmp(dev->VolHdr.Id, OldBaculaId) != 0) {
- Mmsg(&jcr->errmsg, _("Volume Header Id bad: %s\n"), dev->VolHdr.Id);
+ Mmsg(jcr->errmsg, _("Volume Header Id bad: %s\n"), dev->VolHdr.Id);
} else {
ok = true;
}
if (dev->VolHdr.VerNum != BaculaTapeVersion &&
dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion1 &&
dev->VolHdr.VerNum != OldCompatibleBaculaTapeVersion2) {
- Mmsg(&jcr->errmsg, _("Volume on %s has wrong Bacula version. Wanted %d got %d\n"),
+ Mmsg(jcr->errmsg, _("Volume on %s has wrong Bacula version. Wanted %d got %d\n"),
dev_name(dev), BaculaTapeVersion, dev->VolHdr.VerNum);
return jcr->label_status = VOL_VERSION_ERROR;
}
* a Bacula volume label (VOL_LABEL)
*/
if (dev->VolHdr.LabelType != PRE_LABEL && dev->VolHdr.LabelType != VOL_LABEL) {
- Mmsg(&jcr->errmsg, _("Volume on %s has bad Bacula label type: %x\n"),
+ Mmsg(jcr->errmsg, _("Volume on %s has bad Bacula label type: %x\n"),
dev_name(dev), dev->VolHdr.LabelType);
return jcr->label_status = VOL_LABEL_ERROR;
}
/* Compare Volume Names */
Dmsg2(30, "Compare Vol names: VolName=%s hdr=%s\n", VolName?VolName:"*", dev->VolHdr.VolName);
if (VolName && *VolName && *VolName != '*' && strcmp(dev->VolHdr.VolName, VolName) != 0) {
- Mmsg(&jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
+ Mmsg(jcr->errmsg, _("Wrong Volume mounted on device %s: Wanted %s have %s\n"),
dev_name(dev), VolName, dev->VolHdr.VolName);
/*
* Cancel Job if too many label errors
ser_declare;
if (rec->FileIndex != VOL_LABEL && rec->FileIndex != PRE_LABEL) {
- Mmsg3(&dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
+ Mmsg3(dev->errmsg, _("Expecting Volume Label, got FI=%s Stream=%s len=%d\n"),
FI_to_ascii(rec->FileIndex),
stream_to_ascii(rec->Stream, rec->FileIndex),
rec->data_len);