for (rc = 0; rc < archive_count; rc++) {
if (archives[rc] > 8 * sizeof(ct->archives)) {
llapi_err_noerrno(LLAPI_MSG_ERROR,
- "Maximum of %d archives supported",
+ "maximum of %zu archives supported",
8 * sizeof(ct->archives));
goto out_err;
}
/* Only the kernel reference keeps the write side open */
close(ct->kuc.lk_wfd);
- ct->kuc.lk_wfd = 0;
+ ct->kuc.lk_wfd = LK_NOFD;
if (rc < 0)
goto out_kuc;
/** Create the destination volatile file for a restore operation.
*
- * \param hcp Private copyaction handle.
+ * \param hcp Private copyaction handle.
+ * \param mdt_index MDT index where to create the volatile file.
+ * \param flags Volatile file creation flags.
* \return 0 on success.
*/
-static int create_restore_volatile(struct hsm_copyaction_private *hcp)
+static int create_restore_volatile(struct hsm_copyaction_private *hcp,
+ int mdt_index, int flags)
{
int rc;
int fd;
snprintf(parent, sizeof(parent), "%s", mnt);
}
- fd = llapi_create_volatile_idx(parent, 0, O_LOV_DELAY_CREATE);
+ fd = llapi_create_volatile_idx(parent, mdt_index, flags);
if (fd < 0)
return fd;
* It could be skipped if copytool only want to directly report an error,
* \see llapi_hsm_action_end().
*
- * \param hcp Opaque action handle to be passed to
- * llapi_hsm_action_progress and llapi_hsm_action_end.
- * \param ct Copytool handle acquired at registration.
- * \param hai The hsm_action_item describing the request.
- * \param is_error Whether this call is just to report an error.
+ * \param hcp Opaque action handle to be passed to
+ * llapi_hsm_action_progress and llapi_hsm_action_end.
+ * \param ct Copytool handle acquired at registration.
+ * \param hai The hsm_action_item describing the request.
+ * \param restore_mdt_index On restore: MDT index where to create the volatile
+ * file. Use -1 for default.
+ * \param restore_open_flags On restore: volatile file creation mode. Use
+ * O_LOV_DELAY_CREATE to manually set the LOVEA
+ * afterwards.
+ * \param is_error Whether this call is just to report an error.
*
* \return 0 on success.
*/
int llapi_hsm_action_begin(struct hsm_copyaction_private **phcp,
const struct hsm_copytool_private *ct,
- const struct hsm_action_item *hai, bool is_error)
+ const struct hsm_action_item *hai,
+ int restore_mdt_index, int restore_open_flags,
+ bool is_error)
{
struct hsm_copyaction_private *hcp;
int rc;
goto ok_out;
if (hai->hai_action == HSMA_RESTORE) {
- rc = create_restore_volatile(hcp);
+ rc = create_restore_volatile(hcp, restore_mdt_index,
+ restore_open_flags);
if (rc < 0)
goto err_out;
}