#include "glib-util.h"
#include "device.h"
#include "fileheader.h"
-#include "semaphore.h"
+#include "amsemaphore.h"
/* Just a note about the failure mode of different operations:
- Recovers from a failure (enters degraded mode)
/* value of this semaphore is the number of threaded operations
* in progress */
- semaphore_t *threads_sem;
+ amsemaphore_t *threads_sem;
#endif
} RaitDevicePrivate;
}
if (PRIVATE(self)->threads_sem)
- semaphore_free(PRIVATE(self)->threads_sem);
+ amsemaphore_free(PRIVATE(self)->threads_sem);
#endif
amfree(self->private);
}
inf->data = NULL;
/* indicate that we're finished; will not block */
- semaphore_down(inf->private->threads_sem);
+ amsemaphore_down(inf->private->threads_sem);
}
}
g_mutex_unlock(inf->mutex);
guint i;
if (PRIVATE(self)->threads_sem == NULL)
- PRIVATE(self)->threads_sem = semaphore_new_with_value(0);
+ PRIVATE(self)->threads_sem = amsemaphore_new_with_value(0);
if (PRIVATE(self)->threads == NULL)
PRIVATE(self)->threads = g_array_sized_new(FALSE, TRUE,
g_array_set_size(PRIVATE(self)->threads, ops->len);
/* the semaphore will hit zero when each thread has decremented it */
- semaphore_force_set(PRIVATE(self)->threads_sem, ops->len);
+ amsemaphore_force_set(PRIVATE(self)->threads_sem, ops->len);
for (i = 0; i < ops->len; i++) {
ThreadInfo *inf = &g_array_index(PRIVATE(self)->threads, ThreadInfo, i);
}
/* wait until semaphore hits zero */
- semaphore_wait_empty(PRIVATE(self)->threads_sem);
+ amsemaphore_wait_empty(PRIVATE(self)->threads_sem);
}
#else /* USE_INTERNAL_THREADPOOL */
if (first_success->volume_header != NULL) {
dself->volume_header = dumpfile_copy(first_success->volume_header);
}
+ dself->header_block_size = first_success->header_block_size;
}
g_ptr_array_free_full(ops);
}
}
+ if (total_status == DEVICE_STATUS_SUCCESS) {
+ StartOp * op = g_ptr_array_index(ops, 0);
+ Device *child = op->base.child;
+ dself->header_block_size = child->header_block_size;
+ }
+
amfree(label_from_device);
g_ptr_array_free_full(ops);
device_set_error(dself, failure_errmsgs, total_status);
return FALSE;
}
-
amfree(failure_errmsgs);
return TRUE;
}