+/* Persistent mount data is stored in these user attributes */
+#define LDD_PREFIX "lustre:"
+#define LDD_VERSION_PROP LDD_PREFIX "version"
+#define LDD_FLAGS_PROP LDD_PREFIX "flags"
+#define LDD_INDEX_PROP LDD_PREFIX "index"
+#define LDD_FSNAME_PROP LDD_PREFIX "fsname"
+#define LDD_SVNAME_PROP LDD_PREFIX "svname"
+#define LDD_UUID_PROP LDD_PREFIX "uuid"
+#define LDD_USERDATA_PROP LDD_PREFIX "userdata"
+#define LDD_MOUNTOPTS_PROP LDD_PREFIX "mountopts"
+
+/* This structure is used to help bridge the gap between the ZFS
+ * properties Lustre uses and their corresponding internal LDD fields.
+ * It is meant to be used internally by the mount utility only. */
+struct zfs_ldd_prop_bridge {
+ /* Contains the publicly visible name for the property
+ * (i.e. what is shown when running "zfs get") */
+ char *zlpb_prop_name;
+ /* Contains the offset into the lustre_disk_data structure where
+ * the value of this property is or will be stored. (i.e. the
+ * property is read from and written to this offset within ldd) */
+ int zlpb_ldd_offset;
+ /* Function pointer responsible for reading in the @prop
+ * property from @zhp and storing it in @ldd_field */
+ int (*zlpb_get_prop_fn)(zfs_handle_t *zhp, char *prop, void *ldd_field);
+ /* Function pointer responsible for writing the value of @ldd_field
+ * into the @prop dataset property in @zhp */
+ int (*zlpb_set_prop_fn)(zfs_handle_t *zhp, char *prop, void *ldd_field);
+};
+
+/* Forward declarations needed to initialize the ldd prop bridge list */
+static int zfs_get_prop_int(zfs_handle_t *, char *, void *);
+static int zfs_set_prop_int(zfs_handle_t *, char *, void *);
+static int zfs_get_prop_str(zfs_handle_t *, char *, void *);
+static int zfs_set_prop_str(zfs_handle_t *, char *, void *);
+
+/* Helper for initializing the entries in the special_ldd_prop_params list.
+ * - @name: stored directly in the zlpb_prop_name field
+ * (e.g. lustre:fsname, lustre:version, etc.)
+ * - @field: the field in the lustre_disk_data which directly maps to
+ * the @name property. (e.g. ldd_fsname, ldd_config_ver, etc.)
+ * - @type: The type of @field. Only "int" and "str" are supported.
+ */
+#define ZLB_INIT(name, field, type) \
+{ \
+ name, offsetof(struct lustre_disk_data, field), \
+ zfs_get_prop_ ## type, zfs_set_prop_ ## type \
+}
+
+/* These ldd properties are special because they all have their own
+ * individual fields in the lustre_disk_data structure, as opposed to
+ * being globbed into the ldd_params field. As such, these need special
+ * handling when reading/writing the ldd structure to/from persistent
+ * storage. */
+struct zfs_ldd_prop_bridge special_ldd_prop_params[] = {
+ ZLB_INIT(LDD_VERSION_PROP, ldd_config_ver, int),
+ ZLB_INIT(LDD_FLAGS_PROP, ldd_flags, int),
+ ZLB_INIT(LDD_INDEX_PROP, ldd_svindex, int),
+ ZLB_INIT(LDD_FSNAME_PROP, ldd_fsname, str),
+ ZLB_INIT(LDD_SVNAME_PROP, ldd_svname, str),
+ ZLB_INIT(LDD_UUID_PROP, ldd_uuid, str),
+ ZLB_INIT(LDD_USERDATA_PROP, ldd_userdata, str),
+ ZLB_INIT(LDD_MOUNTOPTS_PROP, ldd_mount_opts, str),
+ { NULL }
+};