Commit 91f2d53c authored by Artem Bityutskiy's avatar Artem Bityutskiy

UBI: add layout volume information

Add more information about layout volume to make userspace tools
use the macros instead of constants. Also rename UBI_LAYOUT_VOL_ID
to make it consistent with other macros.
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
parent c18a8418
...@@ -78,7 +78,7 @@ static unsigned long long next_sqnum(struct ubi_device *ubi) ...@@ -78,7 +78,7 @@ static unsigned long long next_sqnum(struct ubi_device *ubi)
*/ */
static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) static int ubi_get_compat(const struct ubi_device *ubi, int vol_id)
{ {
if (vol_id == UBI_LAYOUT_VOL_ID) if (vol_id == UBI_LAYOUT_VOLUME_ID)
return UBI_LAYOUT_VOLUME_COMPAT; return UBI_LAYOUT_VOLUME_COMPAT;
return 0; return 0;
} }
......
...@@ -858,7 +858,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, int pnum ...@@ -858,7 +858,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, int pnum
} }
vol_id = be32_to_cpu(vidh->vol_id); vol_id = be32_to_cpu(vidh->vol_id);
if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOL_ID) { if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) {
int lnum = be32_to_cpu(vidh->lnum); int lnum = be32_to_cpu(vidh->lnum);
/* Unsupported internal volume */ /* Unsupported internal volume */
......
...@@ -89,7 +89,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, ...@@ -89,7 +89,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
struct ubi_volume *layout_vol; struct ubi_volume *layout_vol;
ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); ubi_assert(idx >= 0 && idx < ubi->vtbl_slots);
layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOL_ID)]; layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)];
if (!vtbl_rec) if (!vtbl_rec)
vtbl_rec = &empty_vtbl_record; vtbl_rec = &empty_vtbl_record;
...@@ -269,7 +269,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si, ...@@ -269,7 +269,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
* this volume table copy was found during scanning. It has to be wiped * this volume table copy was found during scanning. It has to be wiped
* out. * out.
*/ */
sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOL_ID); sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOLUME_ID);
if (sv) if (sv)
old_seb = ubi_scan_find_seb(sv, copy); old_seb = ubi_scan_find_seb(sv, copy);
...@@ -281,7 +281,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si, ...@@ -281,7 +281,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
} }
vid_hdr->vol_type = UBI_VID_DYNAMIC; vid_hdr->vol_type = UBI_VID_DYNAMIC;
vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOL_ID); vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOLUME_ID);
vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT; vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT;
vid_hdr->data_size = vid_hdr->used_ebs = vid_hdr->data_size = vid_hdr->used_ebs =
vid_hdr->data_pad = cpu_to_be32(0); vid_hdr->data_pad = cpu_to_be32(0);
...@@ -590,7 +590,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si, ...@@ -590,7 +590,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
vol->last_eb_bytes = vol->reserved_pebs; vol->last_eb_bytes = vol->reserved_pebs;
vol->used_bytes = vol->used_bytes =
(long long)vol->used_ebs * (ubi->leb_size - vol->data_pad); (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad);
vol->vol_id = UBI_LAYOUT_VOL_ID; vol->vol_id = UBI_LAYOUT_VOLUME_ID;
vol->ref_count = 1; vol->ref_count = 1;
ubi_assert(!ubi->volumes[i]); ubi_assert(!ubi->volumes[i]);
...@@ -743,7 +743,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si) ...@@ -743,7 +743,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si)
ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE; ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE;
ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size); ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size);
sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOL_ID); sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOLUME_ID);
if (!sv) { if (!sv) {
/* /*
* No logical eraseblocks belonging to the layout volume were * No logical eraseblocks belonging to the layout volume were
......
...@@ -299,7 +299,9 @@ struct ubi_vid_hdr { ...@@ -299,7 +299,9 @@ struct ubi_vid_hdr {
/* The layout volume contains the volume table */ /* The layout volume contains the volume table */
#define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START #define UBI_LAYOUT_VOLUME_ID UBI_INTERNAL_VOL_START
#define UBI_LAYOUT_VOLUME_TYPE UBI_VID_DYNAMIC
#define UBI_LAYOUT_VOLUME_ALIGN 1
#define UBI_LAYOUT_VOLUME_EBS 2 #define UBI_LAYOUT_VOLUME_EBS 2
#define UBI_LAYOUT_VOLUME_NAME "layout volume" #define UBI_LAYOUT_VOLUME_NAME "layout volume"
#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT #define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment