return ok;
}
-void release_msgs(JCR *jcr)
-{
- alist *msgs = jcr->reserve_msgs;
- char *msg;
-
- if (!msgs) {
- return;
- }
- lock_reservations();
- while ((msg = (char *)msgs->pop())) {
- free(msg);
- }
- delete msgs;
- jcr->reserve_msgs = NULL;
- unlock_reservations();
-}
/*
* Walk through the autochanger resources and check if
return 0;
}
+
+
+
/*
- * search_lock is already set on entering this routine
+ * Queue a reservation error or failure message for this jcr
*/
static void queue_reserve_message(JCR *jcr)
{
int i;
- alist *msgs = jcr->reserve_msgs;
+ alist *msgs;
char *msg;
+ jcr->lock();
+
+ msgs = jcr->reserve_msgs;
if (!msgs) {
- return;
+ goto bail_out;
}
/*
* Look for duplicate message. If found, do
for (i=msgs->size()-1; i >= 0; i--) {
msg = (char *)msgs->get(i);
if (!msg) {
- return;
+ goto bail_out;
}
/* Comparison based on 4 digit message number */
if (strncmp(msg, jcr->errmsg, 4) == 0) {
}
/* Message unique, so insert it */
jcr->reserve_msgs->push(bstrdup(jcr->errmsg));
+
+bail_out:
+ jcr->unlock();
}
/*
alist *msgs;
char *msg;
- lock_reservations();
+ jcr->lock();
msgs = jcr->reserve_msgs;
if (!msgs || msgs->size() == 0) {
goto bail_out;
}
bail_out:
- unlock_reservations();
+ jcr->unlock();
+}
+
+void release_msgs(JCR *jcr)
+{
+ alist *msgs;
+ char *msg;
+
+ jcr->lock();
+ msgs = jcr->reserve_msgs;
+ if (!msgs) {
+ goto bail_out;
+ }
+ while ((msg = (char *)msgs->pop())) {
+ free(msg);
+ }
+ delete msgs;
+ jcr->reserve_msgs = NULL;
+
+bail_out:
+ jcr->unlock();
}