diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-24 04:23:23 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-01-25 09:41:25 -0500 |
commit | 91f2d53cd75a8fa3557246af965155208c4c69a7 (patch) | |
tree | a428ac05cb6998e97df0e7894a51ec6a0db45920 | |
parent | c18a84186cc05bee19d55823f1a35f4ea91a92d6 (diff) |
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: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | drivers/mtd/ubi/eba.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ubi/scan.c | 2 | ||||
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 10 | ||||
-rw-r--r-- | include/mtd/ubi-header.h | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 1f951e39c535..1f7375e2ffb8 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -78,7 +78,7 @@ static unsigned long long next_sqnum(struct ubi_device *ubi) | |||
78 | */ | 78 | */ |
79 | static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) | 79 | static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) |
80 | { | 80 | { |
81 | if (vol_id == UBI_LAYOUT_VOL_ID) | 81 | if (vol_id == UBI_LAYOUT_VOLUME_ID) |
82 | return UBI_LAYOUT_VOLUME_COMPAT; | 82 | return UBI_LAYOUT_VOLUME_COMPAT; |
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 6f2680f423fe..05aa3e7daba1 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -858,7 +858,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, int pnum | |||
858 | } | 858 | } |
859 | 859 | ||
860 | vol_id = be32_to_cpu(vidh->vol_id); | 860 | vol_id = be32_to_cpu(vidh->vol_id); |
861 | if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOL_ID) { | 861 | if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) { |
862 | int lnum = be32_to_cpu(vidh->lnum); | 862 | int lnum = be32_to_cpu(vidh->lnum); |
863 | 863 | ||
864 | /* Unsupported internal volume */ | 864 | /* Unsupported internal volume */ |
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 2fd9cf4cea7e..d8222db4754b 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -89,7 +89,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, | |||
89 | struct ubi_volume *layout_vol; | 89 | struct ubi_volume *layout_vol; |
90 | 90 | ||
91 | ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); | 91 | ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); |
92 | layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOL_ID)]; | 92 | layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)]; |
93 | 93 | ||
94 | if (!vtbl_rec) | 94 | if (!vtbl_rec) |
95 | vtbl_rec = &empty_vtbl_record; | 95 | vtbl_rec = &empty_vtbl_record; |
@@ -269,7 +269,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
269 | * this volume table copy was found during scanning. It has to be wiped | 269 | * this volume table copy was found during scanning. It has to be wiped |
270 | * out. | 270 | * out. |
271 | */ | 271 | */ |
272 | sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOL_ID); | 272 | sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOLUME_ID); |
273 | if (sv) | 273 | if (sv) |
274 | old_seb = ubi_scan_find_seb(sv, copy); | 274 | old_seb = ubi_scan_find_seb(sv, copy); |
275 | 275 | ||
@@ -281,7 +281,7 @@ retry: | |||
281 | } | 281 | } |
282 | 282 | ||
283 | vid_hdr->vol_type = UBI_VID_DYNAMIC; | 283 | vid_hdr->vol_type = UBI_VID_DYNAMIC; |
284 | vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOL_ID); | 284 | vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOLUME_ID); |
285 | vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT; | 285 | vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT; |
286 | vid_hdr->data_size = vid_hdr->used_ebs = | 286 | vid_hdr->data_size = vid_hdr->used_ebs = |
287 | vid_hdr->data_pad = cpu_to_be32(0); | 287 | 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 | vol->last_eb_bytes = vol->reserved_pebs; | 590 | vol->last_eb_bytes = vol->reserved_pebs; |
591 | vol->used_bytes = | 591 | vol->used_bytes = |
592 | (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad); | 592 | (long long)vol->used_ebs * (ubi->leb_size - vol->data_pad); |
593 | vol->vol_id = UBI_LAYOUT_VOL_ID; | 593 | vol->vol_id = UBI_LAYOUT_VOLUME_ID; |
594 | vol->ref_count = 1; | 594 | vol->ref_count = 1; |
595 | 595 | ||
596 | ubi_assert(!ubi->volumes[i]); | 596 | ubi_assert(!ubi->volumes[i]); |
@@ -743,7 +743,7 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_scan_info *si) | |||
743 | ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE; | 743 | ubi->vtbl_size = ubi->vtbl_slots * UBI_VTBL_RECORD_SIZE; |
744 | ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size); | 744 | ubi->vtbl_size = ALIGN(ubi->vtbl_size, ubi->min_io_size); |
745 | 745 | ||
746 | sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOL_ID); | 746 | sv = ubi_scan_find_sv(si, UBI_LAYOUT_VOLUME_ID); |
747 | if (!sv) { | 747 | if (!sv) { |
748 | /* | 748 | /* |
749 | * No logical eraseblocks belonging to the layout volume were | 749 | * No logical eraseblocks belonging to the layout volume were |
diff --git a/include/mtd/ubi-header.h b/include/mtd/ubi-header.h index 69d5d7e22899..292f916ea564 100644 --- a/include/mtd/ubi-header.h +++ b/include/mtd/ubi-header.h | |||
@@ -299,7 +299,9 @@ struct ubi_vid_hdr { | |||
299 | 299 | ||
300 | /* The layout volume contains the volume table */ | 300 | /* The layout volume contains the volume table */ |
301 | 301 | ||
302 | #define UBI_LAYOUT_VOL_ID UBI_INTERNAL_VOL_START | 302 | #define UBI_LAYOUT_VOLUME_ID UBI_INTERNAL_VOL_START |
303 | #define UBI_LAYOUT_VOLUME_TYPE UBI_VID_DYNAMIC | ||
304 | #define UBI_LAYOUT_VOLUME_ALIGN 1 | ||
303 | #define UBI_LAYOUT_VOLUME_EBS 2 | 305 | #define UBI_LAYOUT_VOLUME_EBS 2 |
304 | #define UBI_LAYOUT_VOLUME_NAME "layout volume" | 306 | #define UBI_LAYOUT_VOLUME_NAME "layout volume" |
305 | #define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT | 307 | #define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT |