+static brwlock_t reservation_lock;
+
+void init_reservations_lock()
+{
+ int errstat;
+ if ((errstat=rwl_init(&reservation_lock)) != 0) {
+ berrno be;
+ Emsg1(M_ABORT, 0, _("Unable to initialize reservation lock. ERR=%s\n"),
+ be.strerror(errstat));
+ }
+
+}
+
+void term_reservations_lock()
+{
+ rwl_destroy(&reservation_lock);
+}
+
+/* This applies to a drive and to Volumes */
+void lock_reservations()
+{
+ int errstat;
+ if ((errstat=rwl_writelock(&reservation_lock)) != 0) {
+ berrno be;
+ Emsg2(M_ABORT, 0, "rwl_writelock failure. stat=%d: ERR=%s\n",
+ errstat, be.strerror(errstat));
+ }
+}
+
+void unlock_reservations()
+{
+ int errstat;
+ if ((errstat=rwl_writeunlock(&reservation_lock)) != 0) {
+ berrno be;
+ Emsg2(M_ABORT, 0, "rwl_writeunlock failure. stat=%d: ERR=%s\n",
+ errstat, be.strerror(errstat));
+ }
+}
+