int llapi_layout_file_comp_set(const char *path,
const struct llapi_layout *comp,
uint32_t valid);
+/**
+ * Check if the file layout is composite.
+ */
+bool llapi_layout_is_composite(struct llapi_layout *layout);
/** @} llapi */
* into a component-create. */
llapi_layout_free(head);
return -ENODATA;
- } else {
- /* Current component of 'head' should be tail of component
- * list by default, but we do an extra move cursor operation
- * here to test if the layout is non-composite. */
- rc = llapi_layout_comp_use(head, LLAPI_LAYOUT_COMP_USE_LAST);
- if (rc < 0) {
- fprintf(stderr, "'%s' isn't a composite file?\n",
- fname);
- llapi_layout_free(head);
- return rc;
- }
+ } else if (!llapi_layout_is_composite(head)) {
+ fprintf(stderr, "'%s' isn't a composite file.\n",
+ fname);
+ llapi_layout_free(head);
+ return -EINVAL;
}
rc = llapi_layout_comp_extent_get(head, &start, &prev_end);
errno = EOPNOTSUPP;
return -1;
}
+
+/**
+ * Check if the file layout is composite.
+ *
+ * \param[in] layout the file layout to check
+ *
+ * \retval true composite
+ * \retval false not composite
+ */
+bool llapi_layout_is_composite(struct llapi_layout *layout)
+{
+ return layout->llot_is_composite;
+}