*/
/*
- Copyright (C) 2001, 2002 Kern Sibbald and John Walker
+ Copyright (C) 2001-2003 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
#ifdef HAVE_BACULA_DB
/* Forward referenced functions */
-int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime);
/* -----------------------------------------------------------------------
*
* Returns: 0 on failure
* 1 on success, jr unchanged, but stime set
*/
-int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime)
+int db_find_job_start_time(JCR *jcr, B_DB *mdb, JOB_DBR *jr, POOLMEM **stime)
{
char cmd[MAXSTRING], Name[MAX_NAME_LENGTH], StartTime[MAXSTRING];
int Type, Level;
int found;
long addr;
- strcpy(stime, "0000-00-00 00:00:00"); /* default */
- P(mdb->mutex);
+ db_lock(mdb);
+ pm_strcpy(stime, "0000-00-00 00:00:00"); /* default */
if (!bdb_open_jobs_file(mdb)) {
- V(mdb->mutex);
+ db_unlock(mdb);
return 0;
}
fseek(mdb->jobfd, 0L, SEEK_SET); /* rewind file */
/* Reset for next read */
fseek(mdb->jobfd, addr, SEEK_SET);
if (found) {
- strcpy(stime, StartTime);
+ pm_strcpy(stime, StartTime);
stat = 1; /* Got a candidate */
Dmsg5(200, "Got candidate JobId=%d Type=%c Level=%c Name=%s StartTime=%s\n",
JobId, Type, Level, Name, StartTime);
}
}
}
- V(mdb->mutex);
+ db_unlock(mdb);
return stat;
}
* Returns: 0 on failure
* numrows on success
*/
-int db_find_next_volume(B_DB *mdb, int item, MEDIA_DBR *mr)
+int db_find_next_volume(JCR *jcr, B_DB *mdb, int item, MEDIA_DBR *mr)
{
MEDIA_DBR omr;
int stat = 0;
int index = 0;
int len;
- P(mdb->mutex);
+ db_lock(mdb);
if (!bdb_open_media_file(mdb)) {
- V(mdb->mutex);
+ db_unlock(mdb);
return 0;
}
fseek(mdb->mediafd, 0L, SEEK_SET); /* rewind file */
break; /* found it */
}
}
- V(mdb->mutex);
+ db_unlock(mdb);
return stat;
}
-int db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr) { return 0; }
+int db_find_last_jobid(JCR *jcr, B_DB *mdb, JOB_DBR *jr) { return 0; }
#endif /* HAVE_BACULA_DB */