#define __BTRFS_CONVERT_SOURCE_FS_H__
#include "kerncompat.h"
+#include <linux/kdev_t.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <sys/types.h>
#define CONV_IMAGE_SUBVOL_OBJECTID BTRFS_FIRST_FREE_OBJECTID
+/*
+ * Reresents a simple contiguous range.
+ *
+ * For multiple or non-contiguous ranges, use extent_cache_tree from
+ * extent-cache.c
+ */
+struct simple_range {
+ u64 start;
+ u64 len;
+};
+
+extern const struct simple_range btrfs_reserved_ranges[3];
+
struct task_info;
struct task_ctx {
+ pthread_mutex_t mutex;
u64 max_copy_inodes;
u64 cur_copy_inodes;
struct task_info *info;
#define SOURCE_FS_NAME_LEN (16)
+#define CONVERT_FLAG_DATACSUM (1U << 0)
+#define CONVERT_FLAG_INLINE_DATA (1U << 1)
+#define CONVERT_FLAG_XATTR (1U << 2)
+#define CONVERT_FLAG_COPY_LABEL (1U << 3)
+#define CONVERT_FLAG_SET_LABEL (1U << 4)
+
+/* 23.2.5 acl_tag_t values */
+
+#define ACL_UNDEFINED_TAG (0x00)
+#define ACL_USER_OBJ (0x01)
+#define ACL_USER (0x02)
+#define ACL_GROUP_OBJ (0x04)
+#define ACL_GROUP (0x08)
+#define ACL_MASK (0x10)
+#define ACL_OTHER (0x20)
+
+/* 23.2.7 ACL qualifier constants */
+
+#define ACL_UNDEFINED_ID ((id_t)-1)
+
+#define ACL_EA_VERSION 0x0002
+
+typedef struct {
+ __le16 e_tag;
+ __le16 e_perm;
+ __le32 e_id;
+} acl_ea_entry;
+
+typedef struct {
+ __le32 a_version;
+ acl_ea_entry a_entries[0];
+} acl_ea_header;
+
+typedef struct {
+ __le16 e_tag;
+ __le16 e_perm;
+ __le32 e_id;
+} ext2_acl_entry;
+
+typedef struct {
+ __le16 e_tag;
+ __le16 e_perm;
+} ext2_acl_entry_short;
+
+typedef struct {
+ __le32 a_version;
+} ext2_acl_header;
+
+static inline size_t acl_ea_size(int count)
+{
+ return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
+}
+
+int ext2_acl_count(size_t size);
+
+#ifndef MKDEV
+#define MINORBITS 20
+#define MKDEV(ma, mi) (((ma) << MINORBITS) | (mi))
+#endif
+
+dev_t decode_dev(u32 dev);
+
struct btrfs_convert_operations {
const char name[SOURCE_FS_NAME_LEN];
int (*open_fs)(struct btrfs_convert_context *cctx, const char *devname);
int (*read_used_space)(struct btrfs_convert_context *cctx);
int (*copy_inodes)(struct btrfs_convert_context *cctx,
- struct btrfs_root *root, int datacsum,
- int packing, int noxattr, struct task_ctx *p);
+ struct btrfs_root *root, u32 covert_flags,
+ struct task_ctx *p);
void (*close_fs)(struct btrfs_convert_context *cctx);
int (*check_state)(struct btrfs_convert_context *cctx);
};
int record_file_blocks(struct blk_iterate_data *data,
u64 file_block, u64 disk_block, u64 num_blocks);
+/*
+ * Simple range functions
+ *
+ * Get range end (exclusive)
+ */
+static inline u64 range_end(const struct simple_range *range)
+{
+ return (range->start + range->len);
+}
+
#endif