]> git.sur5r.net Git - bacula/bacula/commitdiff
change all void *jcr into JCR *jcr
authorKern Sibbald <kern@sibbald.com>
Thu, 22 May 2003 15:51:50 +0000 (15:51 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 22 May 2003 15:51:50 +0000 (15:51 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@531 91ce42f0-d328-0410-95d8-f526ca767f89

29 files changed:
bacula/kernstodo
bacula/src/baconfig.h
bacula/src/cats/mysql.c
bacula/src/cats/protos.h
bacula/src/cats/sql.c
bacula/src/cats/sql_create.c
bacula/src/cats/sql_delete.c
bacula/src/cats/sql_find.c
bacula/src/cats/sql_get.c
bacula/src/cats/sql_list.c
bacula/src/cats/sql_update.c
bacula/src/cats/sqlite.c
bacula/src/dird/dird.c
bacula/src/filed/job.c
bacula/src/findlib/attribs.c
bacula/src/findlib/create_file.c
bacula/src/findlib/makepath.c
bacula/src/findlib/protos.h
bacula/src/jcr.h
bacula/src/lib/bnet.c
bacula/src/lib/bsock.h
bacula/src/lib/message.c
bacula/src/lib/message.h
bacula/src/lib/protos.h
bacula/src/lib/util.c
bacula/src/stored/block.c
bacula/src/stored/fd_cmds.c
bacula/src/stored/job.c
bacula/src/stored/label.c

index 2f86dc967ac0182bd606b64487dae03353289a97..299e2ca95dd4e17e0b2e79e0df3196e39834be39 100644 (file)
@@ -25,7 +25,11 @@ Testing to do: (painful)
 - Figure out how to use ssh or stunnel to protect Bacula communications.
 
 For 1.31 release:
+- Look at ALL higher level routines that call block.c to be sure
+  they don't expect something in errmsg.
+- Fix Verify VolumeToCatalog to use BSRs -- it is broken.
 - Use switch() in backup.c and restore.c in FD instead of giant if statement.
+- Replace do_shell_expansion() with bpipe code.
 - Investigate doing RAW backup of Win32 partition.
 - Add JobName= to VerifyToCatalog so that all verifies can be done at the end.
 - Add thread specific data to hold the jcr -- send error messages from
index 5fb2ff5c99d7176691becb06b0e89fbcb93b557a..ee58dbf3c028c52f18269f4f5b73e96219c5ba42 100644 (file)
@@ -336,9 +336,10 @@ extern void _v(char *file, int line, pthread_mutex_t *m);
 int  Mmsg(char **msgbuf, char *fmt,...);
 
 
+struct JCR;
 void d_msg(char *file, int line, int level, char *fmt,...);
 void e_msg(char *file, int line, int type, int level, char *fmt,...);
-void j_msg(char *file, int line, void *vjcr, int type, int level, char *fmt,...);
+void j_msg(char *file, int line, JCR *jcr, int type, int level, char *fmt,...);
 int  m_msg(char *file, int line, char **msgbuf, char *fmt,...);
 
 
index afa55b9f2cf8d15d2c9466e7802f4cec65a0a8ef..2a860263400016201376272457a53d85528f5c2c 100644 (file)
@@ -56,7 +56,7 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
  * never have errors, or it is really fatal.
  */
 B_DB *
-db_init_database(void *jcr, char *db_name, char *db_user, char *db_password, 
+db_init_database(JCR *jcr, char *db_name, char *db_user, char *db_password, 
                 char *db_address, int db_port, char *db_socket) 
 {
    B_DB *mdb;
@@ -104,7 +104,7 @@ db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
  * which are returned in the errmsg
  */
 int
-db_open_database(void *jcr, B_DB *mdb)
+db_open_database(JCR *jcr, B_DB *mdb)
 {
    int errstat;
 
@@ -178,7 +178,7 @@ It is probably not running or your password is incorrect.\n"),
 }
 
 void
-db_close_database(void *jcr, B_DB *mdb)
+db_close_database(JCR *jcr, B_DB *mdb)
 {
    P(mutex);
    mdb->ref_count--;
@@ -225,7 +225,7 @@ db_close_database(void *jcr, B_DB *mdb)
  * For MySQL, NULL causes the auto-increment value
  *  to be updated.
  */
-int db_next_index(void *jcr, B_DB *mdb, char *table, char *index)
+int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index)
 {
    strcpy(index, "NULL");
    return 1;
index 71fe9fccdd51ebee352df0de16289b5e7475367d..1f292d364d091ce890f159aeabef7fdfab6452df 100644 (file)
 /* Database prototypes */
 
 /* sql.c */
-B_DB *db_init_database(void *jcr, char *db_name, char *db_user, char *db_password, 
+B_DB *db_init_database(JCR *jcr, char *db_name, char *db_user, char *db_password, 
                        char *db_address, int db_port, char *db_socket);
-int db_open_database(void *jcr, B_DB *db);
-void db_close_database(void *jcr, B_DB *db);
+int db_open_database(JCR *jcr, B_DB *db);
+void db_close_database(JCR *jcr, B_DB *db);
 void db_escape_string(char *snew, char *old, int len);
 char *db_strerror(B_DB *mdb);
-int get_sql_record_max(void *jcr, B_DB *mdb);
-int db_next_index(void *jcr, B_DB *mdb, char *table, char *index);
+int get_sql_record_max(JCR *jcr, B_DB *mdb);
+int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index);
 int db_sql_query(B_DB *mdb, char *cmd, DB_RESULT_HANDLER *result_handler, void *ctx);
-int check_tables_version(void *jcr, B_DB *mdb);
+int check_tables_version(JCR *jcr, B_DB *mdb);
 void _db_unlock(char *file, int line, B_DB *mdb);
 void _db_lock(char *file, int line, B_DB *mdb);
-void db_start_transaction(void *jcr, B_DB *mdb);
-void db_end_transaction(void *jcr, B_DB *mdb);
+void db_start_transaction(JCR *jcr, B_DB *mdb);
+void db_end_transaction(JCR *jcr, B_DB *mdb);
 
 /* create.c */
-int db_create_file_attributes_record(void *jcr, B_DB *mdb, ATTR_DBR *ar);
-int db_create_job_record(void *jcr, B_DB *db, JOB_DBR *jr);
-int db_create_media_record(void *jcr, B_DB *db, MEDIA_DBR *media_dbr);
-int db_create_client_record(void *jcr, B_DB *db, CLIENT_DBR *cr);
-int db_create_fileset_record(void *jcr, B_DB *db, FILESET_DBR *fsr);
-int db_create_pool_record(void *jcr, B_DB *db, POOL_DBR *pool_dbr);          
-int db_create_jobmedia_record(void *jcr, B_DB *mdb, JOBMEDIA_DBR *jr);
+int db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
+int db_create_job_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
+int db_create_media_record(JCR *jcr, B_DB *db, MEDIA_DBR *media_dbr);
+int db_create_client_record(JCR *jcr, B_DB *db, CLIENT_DBR *cr);
+int db_create_fileset_record(JCR *jcr, B_DB *db, FILESET_DBR *fsr);
+int db_create_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pool_dbr);          
+int db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jr);
 
 /* delete.c */
-int db_delete_pool_record(void *jcr, B_DB *db, POOL_DBR *pool_dbr);
-int db_delete_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr);
+int db_delete_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pool_dbr);
+int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
 
 /* find.c */
-int db_find_job_start_time(void *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime);
-int db_find_last_jobid(void *jcr, B_DB *mdb, JOB_DBR *jr);
-int db_find_next_volume(void *jcr, B_DB *mdb, int index, MEDIA_DBR *mr);
+int db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime);
+int db_find_last_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr);
+int db_find_next_volume(JCR *jcr, B_DB *mdb, int index, MEDIA_DBR *mr);
 
 /* get.c */
-int db_get_pool_record(void *jcr, B_DB *db, POOL_DBR *pdbr);
-int db_get_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr);
-int db_get_job_record(void *jcr, B_DB *mdb, JOB_DBR *jr);
-int db_get_job_volume_names(void *jcr, B_DB *mdb, uint32_t JobId, POOLMEM **VolumeNames);
-int db_get_file_attributes_record(void *jcr, B_DB *mdb, char *fname, FILE_DBR *fdbr);
-int db_get_fileset_record(void *jcr, B_DB *mdb, FILESET_DBR *fsr);
-int db_get_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr);
-int db_get_num_media_records(void *jcr, B_DB *mdb);
-int db_get_num_pool_records(void *jcr, B_DB *mdb);
-int db_get_pool_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
-int db_get_client_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
-int db_get_media_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
-int db_get_job_volume_parameters(void *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS **VolParams);
-int db_get_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cdbr);
+int db_get_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pdbr);
+int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr);
+int db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr);
+int db_get_job_volume_names(JCR *jcr, B_DB *mdb, uint32_t JobId, POOLMEM **VolumeNames);
+int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, FILE_DBR *fdbr);
+int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr);
+int db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr);
+int db_get_num_media_records(JCR *jcr, B_DB *mdb);
+int db_get_num_pool_records(JCR *jcr, B_DB *mdb);
+int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
+int db_get_client_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
+int db_get_media_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t **ids);
+int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS **VolParams);
+int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr);
 
 
 /* list.c */
-void db_list_pool_records(void *jcr, B_DB *db, DB_LIST_HANDLER sendit, void *ctx, int full);
-void db_list_job_records(void *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx, int full);
-void db_list_job_totals(void *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx);
-void db_list_files_for_job(void *jcr, B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
-void db_list_media_records(void *jcr, B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx, int full);
-void db_list_jobmedia_records(void *jcr, B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx, int full);
-int  db_list_sql_query(void *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, int full);
-void db_list_client_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full);
+void db_list_pool_records(JCR *jcr, B_DB *db, DB_LIST_HANDLER sendit, void *ctx, int full);
+void db_list_job_records(JCR *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx, int full);
+void db_list_job_totals(JCR *jcr, B_DB *db, JOB_DBR *jr, DB_LIST_HANDLER sendit, void *ctx);
+void db_list_files_for_job(JCR *jcr, B_DB *db, uint32_t jobid, DB_LIST_HANDLER sendit, void *ctx);
+void db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr, DB_LIST_HANDLER *sendit, void *ctx, int full);
+void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, uint32_t JobId, DB_LIST_HANDLER *sendit, void *ctx, int full);
+int  db_list_sql_query(JCR *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, void *ctx, int verbose, int full);
+void db_list_client_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full);
 
 /* update.c */
-int  db_update_job_start_record(void *jcr, B_DB *db, JOB_DBR *jr);
-int  db_update_job_end_record(void *jcr, B_DB *db, JOB_DBR *jr);
-int  db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr);
-int  db_update_pool_record(void *jcr, B_DB *db, POOL_DBR *pr);
-int  db_update_media_record(void *jcr, B_DB *db, MEDIA_DBR *mr);
-int  db_add_SIG_to_file_record(void *jcr, B_DB *mdb, FileId_t FileId, char *SIG, int type);  
-int  db_mark_file_record(void *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId);
+int  db_update_job_start_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
+int  db_update_job_end_record(JCR *jcr, B_DB *db, JOB_DBR *jr);
+int  db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr);
+int  db_update_pool_record(JCR *jcr, B_DB *db, POOL_DBR *pr);
+int  db_update_media_record(JCR *jcr, B_DB *db, MEDIA_DBR *mr);
+int  db_add_SIG_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *SIG, int type);  
+int  db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId);
 
 #endif /* __SQL_PROTOS_H */
index 55a168ac654734984dc18461cd4867a788f14c55..cf2dd5792dd4a3c86ab9b8c0313a531c21f51dcd 100644 (file)
@@ -71,7 +71,7 @@ static int int_handler(void *ctx, int num_fields, char **row)
  */
 
 /* Check that the tables correspond to the version we want */
-int check_tables_version(void *jcr, B_DB *mdb)
+int check_tables_version(JCR *jcr, B_DB *mdb)
 {
    uint32_t version;
    char *query = "SELECT VersionId FROM Version";
@@ -89,7 +89,7 @@ int check_tables_version(void *jcr, B_DB *mdb)
 
 /* Utility routine for queries. The database MUST be locked before calling here. */
 int
-QueryDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
+QueryDB(char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
 {
    int status;
    if ((status=sql_query(mdb, cmd)) != 0) {
@@ -112,7 +112,7 @@ QueryDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
  *         1 on success
  */
 int
-InsertDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
+InsertDB(char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
 {
    if (sql_query(mdb, cmd)) {
       m_msg(file, line, &mdb->errmsg,  _("insert %s failed:\n%s\n"), cmd, sql_strerror(mdb));
@@ -145,7 +145,7 @@ InsertDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
  *          1 on success  
  */
 int
-UpdateDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
+UpdateDB(char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
 {
 
    if (sql_query(mdb, cmd)) {
@@ -176,7 +176,7 @@ UpdateDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
  *          n number of rows affected
  */
 int
-DeleteDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
+DeleteDB(char *file, int line, JCR *jcr, B_DB *mdb, char *cmd)
 {
 
    if (sql_query(mdb, cmd)) {
@@ -199,7 +199,7 @@ DeleteDB(char *file, int line, void *jcr, B_DB *mdb, char *cmd)
  * Returns: -1 on failure
  *         count on success
  */
-int get_sql_record_max(void *jcr, B_DB *mdb)
+int get_sql_record_max(JCR *jcr, B_DB *mdb)
 {
    SQL_ROW row;
    int stat = 0;
@@ -247,7 +247,7 @@ void _db_unlock(char *file, int line, B_DB *mdb)
  *  much more efficient. Usually started when inserting 
  *  file attributes.
  */
-void db_start_transaction(void *jcr, B_DB *mdb)
+void db_start_transaction(JCR *jcr, B_DB *mdb)
 {
 #ifdef xAVE_SQLITE
    db_lock(mdb);
@@ -265,7 +265,7 @@ void db_start_transaction(void *jcr, B_DB *mdb)
 
 }
 
-void db_end_transaction(void *jcr, B_DB *mdb)
+void db_end_transaction(JCR *jcr, B_DB *mdb)
 {
 #ifdef xAVE_SQLITE
    db_lock(mdb);
@@ -284,7 +284,7 @@ void db_end_transaction(void *jcr, B_DB *mdb)
  *  and filename parts. They are returned in pool memory
  *  in the mdb structure.
  */
-void split_path_and_filename(void *jcr, B_DB *mdb, char *fname)
+void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname)
 {
    char *p, *f;
 
index a5bce1cd153a7ba3e8310ff52a1df7bfe4bbb515..55b7eb13a571c06e6fbc568758a5607b84b1282d 100644 (file)
  */
 
 /* Forward referenced subroutines */
-static int db_create_file_record(void *jcr, B_DB *mdb, ATTR_DBR *ar);
-static int db_create_filename_record(void *jcr, B_DB *mdb, ATTR_DBR *ar);
-static int db_create_path_record(void *jcr, B_DB *mdb, ATTR_DBR *ar);
+static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
+static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
+static int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar);
 
 
 /* Imported subroutines */
 extern void print_dashes(B_DB *mdb);
 extern void print_result(B_DB *mdb);
-extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
-extern int InsertDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
-extern void split_path_and_filename(void *jcr, B_DB *mdb, char *fname);
+extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
+extern int InsertDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
+extern void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname);
 
 
 /* Create a new record for the Job
@@ -62,7 +62,7 @@ extern void split_path_and_filename(void *jcr, B_DB *mdb, char *fname);
  *         1 on success
  */
 int
-db_create_job_record(void *jcr, B_DB *mdb, JOB_DBR *jr)
+db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    char dt[MAX_TIME_LENGTH];
    time_t stime;
@@ -111,7 +111,7 @@ db_create_job_record(void *jcr, B_DB *mdb, JOB_DBR *jr)
  *         1 on success
  */
 int
-db_create_jobmedia_record(void *jcr, B_DB *mdb, JOBMEDIA_DBR *jm)
+db_create_jobmedia_record(JCR *jcr, B_DB *mdb, JOBMEDIA_DBR *jm)
 {
    int stat;
 
@@ -160,7 +160,7 @@ VALUES (%u,%u,%u,%u,%u,%u,%u,%u)",
  *         1 on success
  */
 int
-db_create_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pr)
+db_create_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
 {
    int stat;
    char ed1[30], ed2[30], ed3[50];
@@ -221,7 +221,7 @@ VALUES ('%s',%u,%u,%d,%d,%d,%d,%d,%s,%s,%u,%u,%s,'%s','%s')",
  *         1 on success
  */ 
 int
-db_create_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
+db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 {
    int stat;
    char ed1[30], ed2[30], ed3[30], ed4[30];
@@ -288,7 +288,7 @@ db_create_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
  * Returns: 0 on failure
  *         1 on success with id in cr->ClientId
  */
-int db_create_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr)
+int db_create_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
 {
    SQL_ROW row;
    int stat;
@@ -356,7 +356,7 @@ FileRetention, JobRetention) VALUES \
  *  Returns: 0 on failure
  *          1 on success with FileSetId in record
  */
-int db_create_fileset_record(void *jcr, B_DB *mdb, FILESET_DBR *fsr)
+int db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
 {
    SQL_ROW row;
    int stat;
@@ -440,7 +440,7 @@ FileSet='%s' and MD5='%s'", fsr->FileSet, fsr->MD5);
  *  how many times it occurs.  This is this subroutine, we separate
  *  the file and the path and create three database records.
  */
-int db_create_file_attributes_record(void *jcr, B_DB *mdb, ATTR_DBR *ar)
+int db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 {
 
    Dmsg1(100, "Fname=%s\n", ar->fname);
@@ -487,7 +487,7 @@ int db_create_file_attributes_record(void *jcr, B_DB *mdb, ATTR_DBR *ar)
  * This is the master File entry containing the attributes.
  *  The filename and path records have already been created.
  */
-static int db_create_file_record(void *jcr, B_DB *mdb, ATTR_DBR *ar)
+static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 {
    int stat;
 
@@ -516,7 +516,7 @@ LStat, MD5) VALUES (%u, %u, %u, %u, '%s', '0')",
 }
 
 /* Create a Unique record for the Path -- no duplicates */
-static int db_create_path_record(void *jcr, B_DB *mdb, ATTR_DBR *ar)
+static int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
 {
    SQL_ROW row;
    int stat;
@@ -588,7 +588,7 @@ static int db_create_path_record(void *jcr, B_DB *mdb, ATTR_DBR *ar)
 }
 
 /* Create a Unique record for the filename -- no duplicates */
-static int db_create_filename_record(void *jcr, B_DB *mdb, ATTR_DBR *ar) 
+static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) 
 {
    SQL_ROW row;
 
index e5961e9ab23668a7af2c045d6f22cc947d5aeb65..45de5dc65cd995d97ed756c9bc940b526db7dd2d 100644 (file)
@@ -48,8 +48,8 @@
 /* Imported subroutines */
 extern void print_dashes(B_DB *mdb);
 extern void print_result(B_DB *mdb);
-extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
-extern int DeleteDB(char *file, int line, void *jcr, B_DB *db, char *delete_cmd);
+extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
+extern int DeleteDB(char *file, int line, JCR *jcr, B_DB *db, char *delete_cmd);
        
 /*
  * Delete Pool record, must also delete all associated
@@ -61,7 +61,7 @@ extern int DeleteDB(char *file, int line, void *jcr, B_DB *db, char *delete_cmd)
  *          NumVols = number of Media records deleted
  */
 int
-db_delete_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pr)
+db_delete_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
 {
    SQL_ROW row;
 
@@ -188,7 +188,7 @@ static int do_media_purge(B_DB *mdb, MEDIA_DBR *mr)
 /* Delete Media record and all records that
  * are associated with it.
  */
-int db_delete_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int db_delete_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 {
    db_lock(mdb);
    if (mr->MediaId == 0 && !db_get_media_record(jcr, mdb, mr)) {
@@ -213,7 +213,7 @@ int db_delete_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
  * media record itself. But the media status
  * is changed to "Purged".
  */
-int db_purge_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int db_purge_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 {
    db_lock(mdb);
    if (mr->MediaId == 0 && !db_get_media_record(jcr, mdb, mr)) {
index 159a9b365fc24b1625468af2f9aabb65ad082e77..1f7f8e12eb24290cbd5657425e3d10d485cd6fc9 100644 (file)
@@ -50,7 +50,7 @@
 
 /* Imported subroutines */
 extern void print_result(B_DB *mdb);
-extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
+extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
 
 /*
  * Find job start time. Used to find last full save
@@ -60,7 +60,7 @@ extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
  *         1 on success, jr is unchanged, but stime is set
  */
 int
-db_find_job_start_time(void *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
+db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
 {
    SQL_ROW row;
    int JobId;
@@ -141,7 +141,7 @@ ORDER BY StartTime DESC LIMIT 1",
  *         0 on failure
  */
 int
-db_find_last_jobid(void *jcr, B_DB *mdb, JOB_DBR *jr)
+db_find_last_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    SQL_ROW row;
 
@@ -197,7 +197,7 @@ ClientId=%d ORDER BY StartTime DESC LIMIT 1",
  *         numrows on success
  */
 int
-db_find_next_volume(void *jcr, B_DB *mdb, int item, MEDIA_DBR *mr) 
+db_find_next_volume(JCR *jcr, B_DB *mdb, int item, MEDIA_DBR *mr) 
 {
    SQL_ROW row;
    int numrows;
index 0cac11d31ac81b437199c8a0a39c5676b162e43d..a9aefa16c48fd915242ebc649f9edb4e16ceb142 100644 (file)
  */
 
 /* Forward referenced functions */
-static int db_get_file_record(void *jcr, B_DB *mdb, FILE_DBR *fdbr);
-static int db_get_filename_record(void *jcr, B_DB *mdb);
-static int db_get_path_record(void *jcr, B_DB *mdb);
+static int db_get_file_record(JCR *jcr, B_DB *mdb, FILE_DBR *fdbr);
+static int db_get_filename_record(JCR *jcr, B_DB *mdb);
+static int db_get_path_record(JCR *jcr, B_DB *mdb);
 
 
 /* Imported subroutines */
 extern void print_result(B_DB *mdb);
-extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
-extern void split_path_and_filename(void *jcr, B_DB *mdb, char *fname);
+extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
+extern void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname);
 
 
 
@@ -67,7 +67,7 @@ extern void split_path_and_filename(void *jcr, B_DB *mdb, char *fname);
  *  Returns: 0 on failure
  *          1 on success with the File record in FILE_DBR
  */
-int db_get_file_attributes_record(void *jcr, B_DB *mdb, char *fname, FILE_DBR *fdbr)
+int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, FILE_DBR *fdbr)
 {
    int stat;
    Dmsg1(20, "Enter get_file_from_catalog fname=%s \n", fname);
@@ -99,7 +99,7 @@ int db_get_file_attributes_record(void *jcr, B_DB *mdb, char *fname, FILE_DBR *f
  *    "normal" if a new file is found during Verify.
  */
 static
-int db_get_file_record(void *jcr, B_DB *mdb, FILE_DBR *fdbr)
+int db_get_file_record(JCR *jcr, B_DB *mdb, FILE_DBR *fdbr)
 {
    SQL_ROW row;
    int stat = 0;
@@ -147,7 +147,7 @@ File.FilenameId=%u", fdbr->JobId, fdbr->PathId, fdbr->FilenameId);
  *
  *   DO NOT use Jmsg in this routine (see notes for get_file_record)
  */
-static int db_get_filename_record(void *jcr, B_DB *mdb)
+static int db_get_filename_record(JCR *jcr, B_DB *mdb)
 {
    SQL_ROW row;
    int FilenameId = 0;
@@ -191,7 +191,7 @@ static int db_get_filename_record(void *jcr, B_DB *mdb)
  *
  *   DO NOT use Jmsg in this routine (see notes for get_file_record)
  */
-static int db_get_path_record(void *jcr, B_DB *mdb)
+static int db_get_path_record(JCR *jcr, B_DB *mdb)
 {
    SQL_ROW row;
    uint32_t PathId = 0;
@@ -248,7 +248,7 @@ static int db_get_path_record(void *jcr, B_DB *mdb)
  * Returns: 0 on failure
  *         1 on success
  */
-int db_get_job_record(void *jcr, B_DB *mdb, JOB_DBR *jr)
+int db_get_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    SQL_ROW row;
 
@@ -303,7 +303,7 @@ FROM Job WHERE JobId=%u", jr->JobId);
  *
  *  Returns: number of volumes on success
  */
-int db_get_job_volume_names(void *jcr, B_DB *mdb, uint32_t JobId, POOLMEM **VolumeNames)
+int db_get_job_volume_names(JCR *jcr, B_DB *mdb, uint32_t JobId, POOLMEM **VolumeNames)
 {
    SQL_ROW row;
    int stat = 0;
@@ -352,7 +352,7 @@ AND JobMedia.MediaId=Media.MediaId", JobId);
  *
  *  Returns: number of volumes on success
  */
-int db_get_job_volume_parameters(void *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS **VolParams)
+int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAMS **VolParams)
 {
    SQL_ROW row;
    int stat = 0;
@@ -408,7 +408,7 @@ int db_get_job_volume_parameters(void *jcr, B_DB *mdb, uint32_t JobId, VOL_PARAM
  * Returns: -1 on failure
  *         number on success
  */
-int db_get_num_pool_records(void *jcr, B_DB *mdb)
+int db_get_num_pool_records(JCR *jcr, B_DB *mdb)
 {
    int stat = 0;
 
@@ -426,7 +426,7 @@ int db_get_num_pool_records(void *jcr, B_DB *mdb)
  *  Returns 0: on failure
  *         1: on success
  */
-int db_get_pool_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
+int db_get_pool_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int stat = 0;
@@ -463,7 +463,7 @@ int db_get_pool_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
  *  Returns 0: on failure
  *         1: on success
  */
-int db_get_client_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
+int db_get_client_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int stat = 0;
@@ -502,7 +502,7 @@ int db_get_client_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
  * Returns: 0 on failure
  *         id on success 
  */
-int db_get_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pdbr)
+int db_get_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pdbr)
 {
    SQL_ROW row;
    int stat = 0;
@@ -564,7 +564,7 @@ MaxVolBytes,PoolType,LabelFormat FROM Pool WHERE Pool.Name='%s'", pdbr->Name);
  * Returns: 0 on failure
  *         1 on success 
  */
-int db_get_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
+int db_get_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
 {
    SQL_ROW row;
    int stat = 0;
@@ -615,7 +615,7 @@ int db_get_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cdbr)
  * Returns: 0 on failure
  *         id on success 
  */
-int db_get_fileset_record(void *jcr, B_DB *mdb, FILESET_DBR *fsr)
+int db_get_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
 {
    SQL_ROW row;
    int stat = 0;
@@ -660,7 +660,7 @@ int db_get_fileset_record(void *jcr, B_DB *mdb, FILESET_DBR *fsr)
  * Returns: -1 on failure
  *         number on success
  */
-int db_get_num_media_records(void *jcr, B_DB *mdb)
+int db_get_num_media_records(JCR *jcr, B_DB *mdb)
 {
    int stat = 0;
 
@@ -679,7 +679,7 @@ int db_get_num_media_records(void *jcr, B_DB *mdb)
  *  Returns 0: on failure
  *         1: on success
  */
-int db_get_media_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
+int db_get_media_ids(JCR *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
 {
    SQL_ROW row;
    int stat = 0;
@@ -715,7 +715,7 @@ int db_get_media_ids(void *jcr, B_DB *mdb, int *num_ids, uint32_t *ids[])
  * Returns: 0 on failure
  *         id on success 
  */
-int db_get_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr)
+int db_get_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
 {
    SQL_ROW row;
    int stat = 0;
index fce05c699783d48fb9e76c0c0684354c6e45b6fb..7cf72d8209aeb3b8f24930e1e17b3a48c415c706 100644 (file)
 
 /* Imported subroutines */
 extern void list_result(B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full_list);
-extern int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
+extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
 
 
 /* 
  * Submit general SQL query
  */
-int db_list_sql_query(void *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, 
+int db_list_sql_query(JCR *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit, 
                      void *ctx, int verbose, int full)
 {
    db_lock(mdb);
@@ -75,7 +75,7 @@ int db_list_sql_query(void *jcr, B_DB *mdb, char *query, DB_LIST_HANDLER *sendit
 }
 
 void
-db_list_pool_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full) 
+db_list_pool_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full) 
 {
    db_lock(mdb);
    if (full) {
@@ -100,7 +100,7 @@ db_list_pool_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, i
 }
 
 void
-db_list_client_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full)
+db_list_client_records(JCR *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx, int full)
 {
    db_lock(mdb);
    if (full) {
@@ -129,7 +129,7 @@ db_list_client_records(void *jcr, B_DB *mdb, DB_LIST_HANDLER *sendit, void *ctx,
  *   otherwise, list the Volumes in the Pool specified by PoolId
  */
 void
-db_list_media_records(void *jcr, B_DB *mdb, MEDIA_DBR *mdbr, 
+db_list_media_records(JCR *jcr, B_DB *mdb, MEDIA_DBR *mdbr, 
                      DB_LIST_HANDLER *sendit, void *ctx, int full)
 {
    db_lock(mdb);
@@ -172,7 +172,7 @@ db_list_media_records(void *jcr, B_DB *mdb, MEDIA_DBR *mdbr,
    db_unlock(mdb);
 }
 
-void db_list_jobmedia_records(void *jcr, B_DB *mdb, uint32_t JobId, 
+void db_list_jobmedia_records(JCR *jcr, B_DB *mdb, uint32_t JobId, 
                              DB_LIST_HANDLER *sendit, void *ctx, int full)
 {
    db_lock(mdb);
@@ -218,7 +218,7 @@ void db_list_jobmedia_records(void *jcr, B_DB *mdb, uint32_t JobId,
  *  only the job with the specified id.
  */
 void
-db_list_job_records(void *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, 
+db_list_job_records(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, 
                    void *ctx, int full)
 {
    db_lock(mdb);
@@ -269,7 +269,7 @@ db_list_job_records(void *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit,
  *
  */
 void
-db_list_job_totals(void *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx)
+db_list_job_totals(JCR *jcr, B_DB *mdb, JOB_DBR *jr, DB_LIST_HANDLER *sendit, void *ctx)
 {
    db_lock(mdb);
 
@@ -303,7 +303,7 @@ AS Files,sum(JobBytes) As Bytes FROM Job");
 
 
 void
-db_list_files_for_job(void *jcr, B_DB *mdb, uint32_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
+db_list_files_for_job(JCR *jcr, B_DB *mdb, uint32_t jobid, DB_LIST_HANDLER *sendit, void *ctx)
 {
    db_lock(mdb);
 
index 4bda78419de275623dca7b9c0c29aa2e6dbb39f9..5006b668801a858195851dff19e43d5882b9dcc9 100644 (file)
@@ -45,7 +45,7 @@
 
 /* Imported subroutines */
 extern void print_result(B_DB *mdb);
-extern int UpdateDB(char *file, int line, void *jcr, B_DB *db, char *update_cmd);
+extern int UpdateDB(char *file, int line, JCR *jcr, B_DB *db, char *update_cmd);
 
 /* -----------------------------------------------------------------------
  *
@@ -55,7 +55,7 @@ extern int UpdateDB(char *file, int line, void *jcr, B_DB *db, char *update_cmd)
  */
 /* Update the attributes record by adding the MD5 signature */
 int
-db_add_SIG_to_file_record(void *jcr, B_DB *mdb, FileId_t FileId, char *SIG,
+db_add_SIG_to_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, char *SIG,
                          int type)
 {
    int stat;
@@ -70,7 +70,7 @@ db_add_SIG_to_file_record(void *jcr, B_DB *mdb, FileId_t FileId, char *SIG,
 /* Mark the file record as being visited during database
  * verify compare. Stuff JobId into MarkedId field
  */
-int db_mark_file_record(void *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId) 
+int db_mark_file_record(JCR *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId) 
 {
    int stat;
 
@@ -88,7 +88,7 @@ int db_mark_file_record(void *jcr, B_DB *mdb, FileId_t FileId, JobId_t JobId)
  *          1 on success
  */
 int
-db_update_job_start_record(void *jcr, B_DB *mdb, JOB_DBR *jr)
+db_update_job_start_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    char dt[MAX_TIME_LENGTH];
    time_t stime;
@@ -121,7 +121,7 @@ ClientId=%u, JobTDate=%s WHERE JobId=%u",
  *          1 on success
  */
 int
-db_update_job_end_record(void *jcr, B_DB *mdb, JOB_DBR *jr)
+db_update_job_end_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
 {
    char dt[MAX_TIME_LENGTH];
    time_t ttime;
@@ -151,7 +151,7 @@ VolSessionTime=%u, PoolId=%u, FileSetId=%u, JobTDate=%s WHERE JobId=%u",
 
 
 int
-db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr)
+db_update_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
 {
    int stat;
    char ed1[50], ed2[50];
@@ -179,7 +179,7 @@ db_update_client_record(void *jcr, B_DB *mdb, CLIENT_DBR *cr)
 
 
 int
-db_update_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pr)
+db_update_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
 {
    int stat;
    char ed1[50], ed2[50], ed3[50];
@@ -210,7 +210,7 @@ db_update_pool_record(void *jcr, B_DB *mdb, POOL_DBR *pr)
  *         numrows on success
  */
 int
-db_update_media_record(void *jcr, B_DB *mdb, MEDIA_DBR *mr) 
+db_update_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr) 
 {
    char dt[MAX_TIME_LENGTH];
    time_t ttime;
index acf91cde323c98d503c79bdb475193eded1195be..d0bc1144db98aafb17af46766423e25c3f4443b2 100644 (file)
@@ -51,7 +51,7 @@ static BQUEUE db_list = {&db_list, &db_list};
 
 static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
+int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd);
 
 
 /*
@@ -59,7 +59,7 @@ int QueryDB(char *file, int line, void *jcr, B_DB *db, char *select_cmd);
  * never have errors, or it is really fatal.
  */
 B_DB *
-db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
+db_init_database(JCR *jcr, char *db_name, char *db_user, char *db_password,
                 char *db_address, int db_port, char *db_socket) 
 {
    B_DB *mdb;
@@ -98,7 +98,7 @@ db_init_database(void *jcr, char *db_name, char *db_user, char *db_password,
  * which are returned in the errmsg
  */
 int
-db_open_database(void *jcr, B_DB *mdb)
+db_open_database(JCR *jcr, B_DB *mdb)
 {
    char *db_name;
    int len;
@@ -159,7 +159,7 @@ db_open_database(void *jcr, B_DB *mdb)
 }
 
 void
-db_close_database(void *jcr, B_DB *mdb)
+db_close_database(JCR *jcr, B_DB *mdb)
 {
    P(mutex);
    mdb->ref_count--;
@@ -187,7 +187,7 @@ db_close_database(void *jcr, B_DB *mdb)
  * Return the next unique index (auto-increment) for
  * the given table.  Return 0 on error.
  */
-int db_next_index(void *jcr, B_DB *mdb, char *table, char *index)
+int db_next_index(JCR *jcr, B_DB *mdb, char *table, char *index)
 {
    SQL_ROW row;
 
index a0da2955fb14cdd347ae4b7842a7160a624d6ee9..ae26f68e16ca32e9f7a0ddbb79527a7aac89a139 100644 (file)
@@ -183,7 +183,7 @@ int main (int argc, char *argv[])
    parse_config(configfile);
 
    if (!check_resources()) {
-      Jmsg(NULL, M_ERROR_TERM, 0, "Please correct configuration file: %s\n", configfile);
+      Jmsg((JCR *)NULL, M_ERROR_TERM, 0, _("Please correct configuration file: %s\n"), configfile);
    }
 
    if (test_config) {
index a3bb4830346b4c80c196031e544b17fad8e0edc2..2b9a8a85d9aa853c5856facd788ef326b2edab4c 100644 (file)
@@ -162,7 +162,7 @@ void *handle_client_request(void *dirp)
    jcr->last_fname[0] = 0;
    jcr->client_name = get_memory(strlen(my_name) + 1);
    pm_strcpy(&jcr->client_name, my_name);
-   dir->jcr = (void *)jcr;
+   dir->jcr = jcr;
    get_backup_privileges(NULL, 1 /* ignore_errors */);
 
    /**********FIXME******* add command handler error code */
index c8e91655d0a96165004dd94c5cf6dfe815c8160e..07f9092e47cd0e0451b1fcf293b53551d7a207d8 100755 (executable)
 
 /* Forward referenced subroutines */
 static
-int set_win32_attributes(void *jcr, char *fname, char *ofile, char *lname, 
+int set_win32_attributes(JCR *jcr, char *fname, char *ofile, char *lname, 
                         int type, int stream, struct stat *statp,
                         char *attribsEx, BFILE *ofd);
 void unix_name_to_win32(POOLMEM **win32_name, char *name);
-void win_error(void *jcr, char *prefix, POOLMEM *ofile);
+void win_error(JCR *jcr, char *prefix, POOLMEM *ofile);
 HANDLE bget_handle(BFILE *bfd);
 #endif
 
@@ -180,7 +180,7 @@ decode_stat(char *buf, struct stat *statp, uint32_t *LinkFI)
  * Returns:  1 on success
  *          0 on failure
  */
-int set_attributes(void *jcr, char *fname, char *ofile, char *lname, 
+int set_attributes(JCR *jcr, char *fname, char *ofile, char *lname, 
                   int type, int stream, struct stat *statp,
                   char *attribsEx, BFILE *ofd)
 {
@@ -266,7 +266,7 @@ int set_attributes(void *jcr, char *fname, char *ofile, char *lname,
  * If you have a Unix system with extended attributes (e.g.
  *  ACLs for Solaris, do it here.
  */
-int encode_attribsEx(void *jcr, char *attribsEx, FF_PKT *ff_pkt)
+int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 {
    *attribsEx = 0;                   /* no extended attributes */
    return STREAM_UNIX_ATTRIBUTES;
@@ -284,7 +284,7 @@ int encode_attribsEx(void *jcr, char *attribsEx, FF_PKT *ff_pkt)
 
 #ifdef HAVE_CYGWIN
 
-int encode_attribsEx(void *jcr, char *attribsEx, FF_PKT *ff_pkt)
+int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
 {
    char *p = attribsEx;
    WIN32_FILE_ATTRIBUTE_DATA atts;
@@ -346,7 +346,7 @@ int encode_attribsEx(void *jcr, char *attribsEx, FF_PKT *ff_pkt)
  *          0 on failure
  */
 static
-int set_win32_attributes(void *jcr, char *fname, char *ofile, char *lname, 
+int set_win32_attributes(JCR *jcr, char *fname, char *ofile, char *lname, 
                         int type, int stream, struct stat *statp,
                         char *attribsEx, BFILE *ofd)
 {
@@ -425,9 +425,8 @@ int set_win32_attributes(void *jcr, char *fname, char *ofile, char *lname,
    return 1;
 }
 
-void win_error(void *vjcr, char *prefix, POOLMEM *win32_ofile)
+void win_error(JCR *jcr, char *prefix, POOLMEM *win32_ofile)
 {
-   JCR *jcr = (JCR *)vjcr; 
    DWORD lerror = GetLastError();
    LPTSTR msg;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
@@ -444,9 +443,8 @@ void win_error(void *vjcr, char *prefix, POOLMEM *win32_ofile)
    LocalFree(msg);
 }
 
-void win_error(void *vjcr, char *prefix, DWORD lerror)
+void win_error(JCR *jcr, char *prefix, DWORD lerror)
 {
-   JCR *jcr = (JCR *)vjcr; 
    LPTSTR msg;
    FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
                 FORMAT_MESSAGE_FROM_SYSTEM,
index 88ec8ee1c33c55572d611b5c401e53c13e5cc0b8..f231553c361274cd7edbdb54c724ea0052dc4d3a 100644 (file)
@@ -38,7 +38,7 @@
 #define O_CTG 0
 #endif
 
-static int separate_path_and_file(void *jcr, char *fname, char *ofile);
+static int separate_path_and_file(JCR *jcr, char *fname, char *ofile);
 static int path_already_seen(char *path, int pnl);
 
 
@@ -61,7 +61,7 @@ static int path_already_seen(char *path, int pnl);
  *     files.
  *
  */
-int create_file(void *jcr, char *fname, char *ofile, char *lname,
+int create_file(JCR *jcr, char *fname, char *ofile, char *lname,
                int type, int stream, struct stat *statp, 
                char *attribsEx, BFILE *ofd, int replace)
 {
@@ -264,7 +264,7 @@ int create_file(void *jcr, char *fname, char *ofile, char *lname,
  *          0  no path
  *          -1 filename is zero length
  */ 
-static int separate_path_and_file(void *jcr, char *fname, char *ofile)
+static int separate_path_and_file(JCR *jcr, char *fname, char *ofile)
 {
    char *f, *p;
    int fnl, pnl;
index 74324fc108a32682741d3a7e96fc61fcea38b82e..87e17412267083dff5cf7a8198b9961b011410d3 100644 (file)
@@ -90,7 +90,7 @@ cleanup(struct saved_cwd *cwd)
    (indicating success) and will set *CREATED_DIR_P to zero.  */
 
 static int
-make_dir(void *jcr, const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
+make_dir(JCR *jcr, const char *dir, const char *dirpath, mode_t mode, int *created_dir_p)
 {
   int fail = 0;
   int created_dir;
@@ -154,7 +154,7 @@ make_dir(void *jcr, const char *dir, const char *dirpath, mode_t mode, int *crea
 
 int
 make_path(
-          void *jcr,
+          JCR *jcr,
           const char *argpath,
           int mode,
           int parent_mode,
index f34f33b376cf7fd4e648d829a3c40dacd4622c74..bab7afd7d01b320d138e6393892ad6d194ee747c 100644 (file)
 /* from attribs.c */
 void      encode_stat            (char *buf, struct stat *statp, uint32_t LinkFI);
 void      decode_stat            (char *buf, struct stat *statp, uint32_t *LinkFI);
-int       encode_attribsEx       (void *jcr, char *attribsEx, FF_PKT *ff_pkt);
-int set_attributes(void *jcr, char *fname, char *ofile, char *lname,
+int       encode_attribsEx       (JCR *jcr, char *attribsEx, FF_PKT *ff_pkt);
+int set_attributes(JCR *jcr, char *fname, char *ofile, char *lname,
                    int type, int stream, struct stat *statp, 
                    char *attribsEx, BFILE *ofd);
 
 /* from create_file.c */
-int create_file(void *jcr, char *fname, char *ofile, char *lname,
+int create_file(JCR *jcr, char *fname, char *ofile, char *lname,
                 int type, int stream, struct stat *statp, 
                 char *attribsEx, BFILE *ofd, int replace);
 
@@ -59,11 +59,11 @@ int term_find_one(FF_PKT *ff);
 
 
 /* From get_priv.c */
-int get_backup_privileges(void *jcr, int ignore_errors);
+int get_backup_privileges(JCR *jcr, int ignore_errors);
 
 
 /* from makepath.c */
-int make_path(void *jcr, const char *argpath, int mode,
+int make_path(JCR *jcr, const char *argpath, int mode,
            int parent_mode, uid_t owner, gid_t group,
            int preserve_existing, char *verbose_fmt_string);
 
index 1b6a28858bb5101ad6f5f7d1370637754a13ee4d..4a2d72b174be030163ab9686be2f30a010609437 100644 (file)
    jcr->JobStatus == JS_FatalError)
 
 
-typedef void (JCR_free_HANDLER)(struct s_jcr *jcr);
+struct JCR;
+typedef void (JCR_free_HANDLER)(JCR *jcr);
 
 /* Job Control Record (JCR) */
-struct s_jcr {
+struct JCR {
    /* Global part of JCR common to all daemons */
-   struct s_jcr *next;
-   struct s_jcr *prev;
+   JCR *next;
+   JCR *prev;
    pthread_t my_thread_id;            /* id of thread controlling jcr */
    pthread_mutex_t mutex;             /* jcr mutex */
    BSOCK *dir_bsock;                  /* Director bsock or NULL if we are him */
@@ -185,8 +186,8 @@ struct s_jcr {
 
 #ifdef STORAGE_DAEMON
    /* Storage Daemon specific part of JCR */
-   struct s_jcr *next_dev;            /* next JCR attached to device */
-   struct s_jcr *prev_dev;            /* previous JCR attached to device */
+   JCR *next_dev;                     /* next JCR attached to device */
+   JCR *prev_dev;                     /* previous JCR attached to device */
    pthread_cond_t job_start_wait;     /* Wait for FD to start Job */
    int type;
    DEVRES *device;                    /* device to use */
@@ -252,9 +253,6 @@ struct s_last_job {
 
 extern struct s_last_job last_job;
 
-#undef JCR
-typedef struct s_jcr JCR;
-
 
 /* The following routines are found in lib/jcr.c */
 extern JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr);
index 22b9af1b018394418474fa431a74bcd9de4f9bfb..fdc37d8c0d1cf549969c2fc63b7eb778fa2f1ae8 100644 (file)
@@ -448,7 +448,7 @@ static pthread_mutex_t ip_mutex = PTHREAD_MUTEX_INITIALIZER;
  * Convert a hostname or dotted IP address into   
  * a s_addr.  We handle only IPv4.
  */
-static uint32_t *bget_host_ip(void *jcr, char *host)
+static uint32_t *bget_host_ip(JCR *jcr, char *host)
 {
    struct in_addr inaddr;
    uint32_t *addr_list;              /* this really should be struct in_addr */
@@ -498,7 +498,7 @@ Wanted %d got %d bytes for s_addr.\n"), sizeof(inaddr.s_addr), hp->h_length);
  *  ***FIXME*** implement service from /etc/services
  */
 static BSOCK *
-bnet_open(void *jcr, char *name, char *host, char *service, int port, int *fatal)
+bnet_open(JCR *jcr, char *name, char *host, char *service, int port, int *fatal)
 {
    int sockfd;
    struct sockaddr_in tcp_serv_addr;    /* socket information */
@@ -555,12 +555,11 @@ bnet_open(void *jcr, char *name, char *host, char *service, int port, int *fatal
  * Try to connect to host for max_retry_time at retry_time intervals.
  */
 BSOCK *
-bnet_connect(void *vjcr, int retry_interval, int max_retry_time, char *name,
+bnet_connect(JCR *jcr, int retry_interval, int max_retry_time, char *name,
             char *host, char *service, int port, int verbose)
 {
    int i;
    BSOCK *bsock;
-   JCR *jcr = (JCR *)vjcr;
    int fatal = 0;
 
    for (i=0; (bsock = bnet_open(jcr, name, host, service, port, &fatal)) == NULL; i -= retry_interval) {
@@ -728,7 +727,7 @@ char *bnet_sig_to_ascii(BSOCK *bs)
  *  This probably should be done in net_open
  */
 BSOCK *
-init_bsock(void *jcr, int sockfd, char *who, char *host, int port) 
+init_bsock(JCR *jcr, int sockfd, char *who, char *host, int port) 
 {
    BSOCK *bsock = (BSOCK *)malloc(sizeof(BSOCK));
    memset(bsock, 0, sizeof(BSOCK));
index 1219921d6d87e5f69134f180a3c2edcb2def319a..5ca7d1ad7ec34dc70d434aa35d982bae38344205 100644 (file)
@@ -54,7 +54,7 @@ typedef struct s_bsock {
    struct s_bsock *next;              /* next BSOCK if duped */
    int spool;                         /* set for spooling */
    FILE *spool_fd;                    /* spooling file */
-   void *jcr;                         /* jcr or NULL for error msgs */
+   JCR *jcr;                          /* jcr or NULL for error msgs */
 } BSOCK;
 
 /* Signal definitions for use in bnet_sig() */
index 83283a52ceb97b92c526ccec8246aa56ab3ab713..05ea5008461773491c82d9aa3d5213f4af505c2a 100755 (executable)
@@ -139,10 +139,9 @@ void my_name_is(int argc, char *argv[], char *name)
  *   non-NULL    -> initialize jcr using Message resource
  */
 void
-init_msg(void *vjcr, MSGS *msg)
+init_msg(JCR *jcr, MSGS *msg)
 {
    DEST *d, *dnew, *temp_chain = NULL;
-   JCR *jcr = (JCR *)vjcr;
 
    /*
     * If msg is NULL, initialize global chain for STDOUT and syslog
@@ -298,10 +297,9 @@ static void make_unique_spool_filename(JCR *jcr, POOLMEM **name, int fd)
       jcr->Job, fd);
 }
 
-int open_spool_file(void *vjcr, BSOCK *bs)
+int open_spool_file(JCR *jcr, BSOCK *bs)
 {
     POOLMEM *name  = get_pool_memory(PM_MESSAGE);
-    JCR *jcr = (JCR *)vjcr;
 
     make_unique_spool_filename(jcr, &name, bs->fd);
     bs->spool_fd = fopen(name, "w+");
@@ -314,10 +312,9 @@ int open_spool_file(void *vjcr, BSOCK *bs)
     return 1;
 }
 
-int close_spool_file(void *vjcr, BSOCK *bs)
+int close_spool_file(JCR *jcr, BSOCK *bs)
 {
     POOLMEM *name  = get_pool_memory(PM_MESSAGE);
-    JCR *jcr = (JCR *)vjcr;
 
     make_unique_spool_filename(jcr, &name, bs->fd);
     fclose(bs->spool_fd);
@@ -367,10 +364,9 @@ static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM **cmd, DEST *d)
  * Close the messages for this Messages resource, which means to close
  *  any open files, and dispatch any pending email messages.
  */
-void close_msg(void *vjcr)
+void close_msg(JCR *jcr)
 {
    MSGS *msgs;
-   JCR *jcr = (JCR *)vjcr;
    DEST *d;
    BPIPE *bpipe;
    POOLMEM *cmd, *line;
@@ -528,12 +524,11 @@ void term_msg()
 /*
  * Handle sending the message to the appropriate place
  */
-void dispatch_message(void *vjcr, int type, int level, char *msg)
+void dispatch_message(JCR *jcr, int type, int level, char *msg)
 {
     DEST *d;   
     char dt[MAX_TIME_LENGTH];
     POOLMEM *mcmd;
-    JCR *jcr = (JCR *) vjcr;
     int len;
     MSGS *msgs;
     BPIPE *bpipe;
@@ -863,12 +858,11 @@ e_msg(char *file, int line, int type, int level, char *fmt,...)
  *
  */
 void 
-Jmsg(void *vjcr, int type, int level, char *fmt,...)
+Jmsg(JCR *jcr, int type, int level, char *fmt,...)
 {
     char     rbuf[5000];
     va_list   arg_ptr;
     int len;
-    JCR *jcr = (JCR *)vjcr;
     MSGS *msgs;
     char *job;
 
@@ -999,7 +993,7 @@ again:
  * If we come here, prefix the message with the file:line-number,
  *  then pass it on to the normal Jmsg routine.
  */
-void j_msg(char *file, int line, void *jcr, int type, int level, char *fmt,...)
+void j_msg(char *file, int line, JCR *jcr, int type, int level, char *fmt,...)
 {
    va_list   arg_ptr;
    int i, len, maxlen;
index 890594d6c2198bd91da8a427e20f88f620b791e4..17315c20629deb62f57052e48e81898d5df6e2c0 100644 (file)
 
 #include "bits.h"
 
-#undef M_DEBUG
-#undef M_ABORT
-#undef M_FATAL
-#undef M_ERROR
-#undef M_WARNING
-#undef M_INFO
-#undef M_MOUNT
-#undef M_ERROR_TERM
-#undef M_TERM
-#undef M_RESTORED
+#undef  M_DEBUG
+#undef  M_ABORT
+#undef  M_FATAL
+#undef  M_ERROR
+#undef  M_WARNING
+#undef  M_INFO
+#undef  M_MOUNT
+#undef  M_ERROR_TERM
+#undef  M_TERM
+#undef  M_RESTORED
 
 /*
  * Most of these message levels are more or less obvious. 
  * and here are some of the details of where I am trying to
  * head (in the process of changing the code) as of 15 June 2002.
  *
- *  M_ABORT      Bacula immediately aborts and tries to produce a traceback
- *                 This is for really serious errors like segmentation fault.
+ *  M_ABORT       Bacula immediately aborts and tries to produce a traceback
+ *                  This is for really serious errors like segmentation fault.
  *  M_ERROR_TERM  Bacula immediately terminates but no dump. This is for
  *                  "obvious" serious errors like daemon already running or
- *                  cannot open critical file, ... where a dump is not wanted.
- *  M_TERM       Bacula daemon shutting down because of request (SIGTERM).
+ *                   cannot open critical file, ... where a dump is not wanted.
+ *  M_TERM        Bacula daemon shutting down because of request (SIGTERM).
  *
  * The remaining apply to Jobs rather than the daemon.
  *
- *  M_FATAL      Bacula detected a fatal Job error. The Job will be killed,
- *                 but Bacula continues running.
- *  M_ERROR      Bacula detected a Job error. The Job will continue running
- *                 but the termination status will be error. 
- *  M_WARNING    Job warning message.
- *  M_INFO       Job information message.
+ *  M_FATAL       Bacula detected a fatal Job error. The Job will be killed,
+ *                  but Bacula continues running.
+ *  M_ERROR       Bacula detected a Job error. The Job will continue running
+ *                  but the termination status will be error. 
+ *  M_WARNING     Job warning message.
+ *  M_INFO        Job information message.
  *
- *  M_RESTORED   An ls -l of each restored file.
+ *  M_RESTORED    An ls -l of each restored file.
  *
  */
 
-#define M_DEBUG       1              /* debug message */
-#define M_ABORT       2              /* MUST abort immediately */
-#define M_FATAL       3              /* Fatal error, stopping job */
-#define M_ERROR       4              /* Error, but recoverable */
-#define M_WARNING     5              /* Warning message */
-#define M_INFO       6               /* Informational message */
-#define M_SAVED       7              /* Info on saved file */
-#define M_NOTSAVED    8              /* Info on notsaved file */
-#define M_SKIPPED     9              /* File skipped by option setting */
-#define M_MOUNT      10              /* Mount requests */
-#define M_ERROR_TERM 11              /* Error termination request (no dump) */
-#define M_TERM      12               /* Terminating daemon */
-#define M_RESTORED   13              /* ls -l of restored files */
+#define M_DEBUG       1               /* debug message */
+#define M_ABORT       2               /* MUST abort immediately */
+#define M_FATAL       3               /* Fatal error, stopping job */
+#define M_ERROR       4               /* Error, but recoverable */
+#define M_WARNING     5               /* Warning message */
+#define M_INFO        6               /* Informational message */
+#define M_SAVED       7               /* Info on saved file */
+#define M_NOTSAVED    8               /* Info on notsaved file */
+#define M_SKIPPED     9               /* File skipped by option setting */
+#define M_MOUNT      10               /* Mount requests */
+#define M_ERROR_TERM 11               /* Error termination request (no dump) */
+#define M_TERM       12               /* Terminating daemon */
+#define M_RESTORED   13               /* ls -l of restored files */
 
-#define M_MAX     M_RESTORED         /* keep this updated ! */
+#define M_MAX      M_RESTORED         /* keep this updated ! */
 
 /* Define message destination structure */
 /* *** FIXME **** where should be extended to handle multiple values */
 typedef struct s_dest {
    struct s_dest *next;
-   int dest_code;                    /* destination (one of the MD_ codes) */
-   int max_len;                      /* max mail line length */
-   FILE *fd;                         /* file descriptor */
+   int dest_code;                     /* destination (one of the MD_ codes) */
+   int max_len;                       /* max mail line length */
+   FILE *fd;                          /* file descriptor */
    char msg_types[nbytes_for_bits(M_MAX+1)]; /* message type mask */
-   char *where;                      /* filename/program name */
-   char *mail_cmd;                   /* mail command */
-   POOLMEM *mail_filename;           /* unique mail filename */
+   char *where;                       /* filename/program name */
+   char *mail_cmd;                    /* mail command */
+   POOLMEM *mail_filename;            /* unique mail filename */
 } DEST;
 
 /* Message Destination values for dest field of DEST */
-#define MD_SYSLOG    1               /* send msg to syslog */
-#define MD_MAIL      2               /* email group of messages */
-#define MD_FILE      3               /* write messages to a file */
-#define MD_APPEND    4               /* append messages to a file */
-#define MD_STDOUT    5               /* print messages */
-#define MD_STDERR    6               /* print messages to stderr */
-#define MD_DIRECTOR  7               /* send message to the Director */
-#define MD_OPERATOR  8               /* email a single message to the operator */
-#define MD_CONSOLE   9               /* send msg to UserAgent or console */
-#define MD_MAIL_ON_ERROR 10          /* email messages if job errors */
+#define MD_SYSLOG    1                /* send msg to syslog */
+#define MD_MAIL      2                /* email group of messages */
+#define MD_FILE      3                /* write messages to a file */
+#define MD_APPEND    4                /* append messages to a file */
+#define MD_STDOUT    5                /* print messages */
+#define MD_STDERR    6                /* print messages to stderr */
+#define MD_DIRECTOR  7                /* send message to the Director */
+#define MD_OPERATOR  8                /* email a single message to the operator */
+#define MD_CONSOLE   9                /* send msg to UserAgent or console */
+#define MD_MAIL_ON_ERROR 10           /* email messages if job errors */
 
 
 void d_msg(char *file, int line, int level, char *fmt,...);
 void e_msg(char *file, int line, int type, int level, char *fmt,...);
-void Jmsg(void *vjcr, int type, int level, char *fmt,...);
+void Jmsg(JCR *jcr, int type, int level, char *fmt,...);
 
 extern int debug_level;
 extern int verbose;
index 24a617e77cefbfbf45443f2c1d33767be5803f4e..513bd45e8ee4a5edab58cd06391ae145ce59eca8 100644 (file)
 
  */
 
+struct JCR;
+
 /* 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);
 
 /* bmisc.c */
-char    *bstrncpy               (char *dest, const char *src, int maxlen);
-char    *bstrncat               (char *dest, const char *src, int maxlen);
-void    *b_malloc               (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               (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, size_t size, const  char  *format, ...);
-int      bvsnprintf             (char *str, size_t size, const char  *format, va_list ap);
-int      pool_sprintf           (char *pool_buf, char *fmt, ...);
-void     create_pid_file        (char *dir, char *progname, int port);
-int      delete_pid_file        (char *dir, char *progname, int port);
-void     drop                   (char *uid, char *gid);
-int      bmicrosleep            (time_t sec, long msec);
+void     *brealloc               (void *buf, size_t size);
+void     *bcalloc                (size_t size1, size_t size2);
+int       bsnprintf              (char *str, size_t size, const  char  *format, ...);
+int       bvsnprintf             (char *str, size_t size, const char  *format, va_list ap);
+int       pool_sprintf           (char *pool_buf, char *fmt, ...);
+void      create_pid_file        (char *dir, char *progname, int port);
+int       delete_pid_file        (char *dir, char *progname, int port);
+void      drop                   (char *uid, char *gid);
+int       bmicrosleep            (time_t sec, long msec);
 #ifndef HAVE_STRTOLL
 long long int strtoll(const char *ptr, char **endptr, int base);
 #endif
 
 /* bnet.c */
-int32_t    bnet_recv            (BSOCK *bsock);
-int       bnet_send             (BSOCK *bsock);
-int       bnet_fsend            (BSOCK *bs, char *fmt, ...);
-int       bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
-int       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           (void *jcr, int retry_interval,
-              int max_retry_time, char *name, char *host, char *service, 
-              int port, int verbose);
-void      bnet_close            (BSOCK *bsock);
-BSOCK *    init_bsock           (void *jcr, int sockfd, char *who, char *ip, int port);
-BSOCK *    dup_bsock            (BSOCK *bsock);
-void      term_bsock            (BSOCK *bsock);
-char *    bnet_strerror         (BSOCK *bsock);
-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          (BSOCK *bsock);
-int       is_bnet_stop          (BSOCK *bsock);
-int       is_bnet_error         (BSOCK *bsock);
-void      bnet_suppress_error_messages(BSOCK *bsock, int flag);
+int32_t    bnet_recv             (BSOCK *bsock);
+int        bnet_send             (BSOCK *bsock);
+int        bnet_fsend            (BSOCK *bs, char *fmt, ...);
+int        bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
+int        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, char *name, char *host, char *service, 
+               int port, int verbose);
+void       bnet_close            (BSOCK *bsock);
+BSOCK *    init_bsock            (JCR *jcr, int sockfd, char *who, char *ip, int port);
+BSOCK *    dup_bsock             (BSOCK *bsock);
+void       term_bsock            (BSOCK *bsock);
+char *     bnet_strerror         (BSOCK *bsock);
+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          (BSOCK *bsock);
+int        is_bnet_stop          (BSOCK *bsock);
+int        is_bnet_error         (BSOCK *bsock);
+void       bnet_suppress_error_messages(BSOCK *bsock, int flag);
 
 /* bget_msg.c */
-int     bget_msg(BSOCK *sock);
+int      bget_msg(BSOCK *sock);
 
 /* 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             is_a_number             (const char *num);
-int             is_an_integer           (const char *n);
+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              is_a_number             (const char *num);
+int              is_an_integer           (const char *n);
 
 /* lex.c */
-LEX *    lex_close_file         (LEX *lf);
-LEX *    lex_open_file          (LEX *lf, char *fname, LEX_ERROR_HANDLER *scan_error);
-int      lex_get_char           (LEX *lf);
-void     lex_unget_char         (LEX *lf);
-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, char *fname, LEX_ERROR_HANDLER *scan_error);
+int       lex_get_char           (LEX *lf);
+void      lex_unget_char         (LEX *lf);
+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[], char *name);
-void      init_msg              (void *jcr, MSGS *msg);
-void      term_msg              (void);
-void      close_msg             (void *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                  (void *jcr, int type, int level, char *fmt, ...);
-void      dispatch_message      (void *jcr, int type, int level, char *buf);
-void      init_console_msg      (char *wd);
-void      free_msgs_res         (MSGS *msgs);
-int       open_spool_file       (void *jcr, BSOCK *bs);
-int       close_spool_file      (void *vjcr, BSOCK *bs);
+void       my_name_is            (int argc, char *argv[], 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, char *fmt, ...);
+void       dispatch_message      (JCR *jcr, int type, int level, char *buf);
+void       init_console_msg      (char *wd);
+void       free_msgs_res         (MSGS *msgs);
+int        open_spool_file       (JCR *jcr, BSOCK *bs);
+int        close_spool_file      (JCR *jcr, BSOCK *bs);
 
 
 /* bnet_server.c */
-void      bnet_thread_server(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
-                  void *handle_client_request(void *bsock));
-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(char *bind_addr, int port, int max_clients, workq_t *client_wq, 
+                   void *handle_client_request(void *bsock));
+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);
 
 /* 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);
 
 /* util.c */
-void            lcase                   (char *str);
-void            bash_spaces             (char *str);
-void            unbash_spaces           (char *str);
-void            strip_trailing_junk     (char *str);
-void            strip_trailing_slashes  (char *dir);
-int             skip_spaces             (char **msg);
-int             skip_nonspaces          (char **msg);
-int             fstrsch                 (char *a, char *b);
-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);
-int             is_buf_zero             (char *buf, int len);
-void            jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
-void            pm_strcat               (POOLMEM **pm, char *str);
-void            pm_strcpy               (POOLMEM **pm, char *str);
-int             run_program             (char *prog, int wait, POOLMEM *results);
-char *          job_type_to_str         (int type);
-char *          job_status_to_str       (int stat);
-char *          job_level_to_str        (int level);
-void            makeSessionKey          (char *key, char *seed, int mode);
-BPIPE *         open_bpipe(char *prog, int wait, char *mode);
-int             close_wpipe(BPIPE *bpipe);
-int             close_bpipe(BPIPE *bpipe);
-POOLMEM        *edit_job_codes(void *jcr, char *omsg, char *imsg, char *to);  
-void            parse_command_args(POOLMEM *cmd, POOLMEM *args, int *argc, 
-                       char **argk, char **argv);
-char           *next_arg(char **s);
-void            set_working_directory(char *wd);
+void             lcase                   (char *str);
+void             bash_spaces             (char *str);
+void             unbash_spaces           (char *str);
+void             strip_trailing_junk     (char *str);
+void             strip_trailing_slashes  (char *dir);
+int              skip_spaces             (char **msg);
+int              skip_nonspaces          (char **msg);
+int              fstrsch                 (char *a, char *b);
+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);
+int              is_buf_zero             (char *buf, int len);
+void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
+void             pm_strcat               (POOLMEM **pm, char *str);
+void             pm_strcpy               (POOLMEM **pm, char *str);
+int              run_program             (char *prog, int wait, POOLMEM *results);
+char *           job_type_to_str         (int type);
+char *           job_status_to_str       (int stat);
+char *           job_level_to_str        (int level);
+void             makeSessionKey          (char *key, char *seed, int mode);
+BPIPE *          open_bpipe(char *prog, int wait, char *mode);
+int              close_wpipe(BPIPE *bpipe);
+int              close_bpipe(BPIPE *bpipe);
+POOLMEM         *edit_job_codes(JCR *jcr, char *omsg, char *imsg, char *to);  
+void             parse_command_args(POOLMEM *cmd, POOLMEM *args, int *argc, 
+                        char **argk, char **argv);
+char            *next_arg(char **s);
+void             set_working_directory(char *wd);
 
 /* watchdog.c */
 int start_watchdog(void);
index b1e9e411a94cf307c152e409ac95390fa0996ac4..1d1b5258172a5a2f673146cd22940a517093b260 100644 (file)
@@ -589,11 +589,10 @@ void makeSessionKey(char *key, char *seed, int mode)
  *  to = recepients list 
  *
  */
-POOLMEM *edit_job_codes(void *mjcr, char *omsg, char *imsg, char *to)  
+POOLMEM *edit_job_codes(JCR *jcr, char *omsg, char *imsg, char *to)   
 {
    char *p, *str;
    char add[20];
-   JCR *jcr = (JCR *)mjcr;
 
    *omsg = 0;
    Dmsg1(200, "edit_job_codes: %s\n", imsg);
index 7341c79db36621c82559548030dea111927f3bac..c95096aa0f9e1cf036dc47ca400746849bf85621 100644 (file)
@@ -304,7 +304,7 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    /* dump_block(block, "before write"); */
    if (dev->state & ST_WEOT) {
       Dmsg0(100, "return write_block_to_dev with ST_WEOT\n");
-      Jmsg(&dev->errmsg, M_FATAL, 0,  _("Cannot write block. Device at EOM.\n"));
+      Jmsg(jcr, M_FATAL, 0,  _("Cannot write block. Device at EOM.\n"));
       return 0;
    }
    wlen = block->binbuf;
@@ -349,10 +349,10 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       dev->state |= ST_WEOT;
       Dmsg0(10, "==== Output bytes Triggered medium max capacity.\n");
       if (hit_max1) {
-         Jmsg(&dev->errmsg, M_INFO, 0, _("Max. Volume capacity %s exceeded on device %s.\n"),
+         Jmsg(jcr, M_INFO, 0, _("Max. Volume capacity %s exceeded on device %s.\n"),
            edit_uint64(dev->max_volume_size, ed1),  dev->dev_name);
       } else {
-         Jmsg(&dev->errmsg, M_INFO, 0,  _("Max. Volume capacity %s exceeded on device %s.\n"),
+         Jmsg(jcr, M_INFO, 0,  _("Max. Volume capacity %s exceeded on device %s.\n"),
            edit_uint64(dev->VolCatInfo.VolCatMaxBytes, ed1),  dev->dev_name);
       }
       block->failed_write = TRUE;
@@ -395,10 +395,10 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
         wlen, stat, dev->dev_errno, strerror(dev->dev_errno));
 
       if (stat == -1) {
-         Jmsg2(&dev->errmsg, M_ERROR, 0, _("Write error on device %s. ERR=%s.\n"), 
+         Jmsg2(jcr, M_ERROR, 0, _("Write error on device %s. ERR=%s.\n"), 
            dev->dev_name, strerror(dev->dev_errno));
       } else {
-         Jmsg3(&dev->errmsg, M_INFO, 0, _("End of media on device %s. Write of %u bytes got %d.\n"), 
+         Jmsg3(jcr, M_INFO, 0, _("End of media on device %s. Write of %u bytes got %d.\n"), 
            dev->dev_name, wlen, stat);
       }  
       block->failed_write = TRUE;
index 9987753720eef5babe33449bc702771dcc52936a..813b43d2d43b02bab85d6c1a20bbd863ce427938 100644 (file)
@@ -111,8 +111,8 @@ void run_job(JCR *jcr)
    char ec1[30];
 
 
-   fd->jcr = (void *)jcr;
-   dir->jcr = (void *)jcr;
+   fd->jcr = jcr;
+   dir->jcr = jcr;
    Dmsg1(120, "Start run Job=%s\n", jcr->Job);
    bnet_fsend(dir, Job_start, jcr->Job); 
    jcr->start_time = time(NULL);
index 8eeecc94580fa997d3c78e5921e7542ca8d08511..e0846894e5c9c02d3fea64815edeac6930df0f1e 100644 (file)
@@ -214,7 +214,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name)
    }
 
    jcr->file_bsock = fd;
-   jcr->file_bsock->jcr = (void *)jcr;
+   jcr->file_bsock->jcr = jcr;
 
    Dmsg1(110, "Found Job %s\n", job_name);
 
index a99b9188e1083366b151cfd9222d485cf08feaa8..086acff086703ab8743847ed88f3e0ff1e1515c0 100644 (file)
@@ -74,8 +74,7 @@ int read_dev_volume_label(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
          * Cancel Job if too many label errors
          *  => we are in a loop
          */
-        if (jcr->label_errors > 100) {
-           set_jcr_job_status(jcr, JS_ErrorTerminated);
+        if (jcr->label_errors++ > 100) {
             Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
         }
         return jcr->label_status = VOL_NAME_ERROR;
@@ -141,8 +140,7 @@ because:\n   %s"), dev_name(dev), strerror_dev(dev));
        * Cancel Job if too many label errors
        *  => we are in a loop
        */
-      if (jcr->label_errors > 100) {
-        set_jcr_job_status(jcr, JS_ErrorTerminated);
+      if (jcr->label_errors++ > 100) {
          Jmsg(jcr, M_FATAL, 0, "%s", jcr->errmsg);
       }
       return jcr->label_status = VOL_NAME_ERROR;