Patchwork ubi: Use UBI_LAYOUT_VOLUME_{TYPE, ALIGN}

login
register
mail settings
Submitter Richard Weinberger
Date Jan. 10, 2012, 4:57 p.m.
Message ID <1326214623-15938-1-git-send-email-richard@nod.at>
Download mbox | patch
Permalink /patch/135266/
State Accepted
Commit 1f4f43475f1295dc41c18684e59deea9b6d46045
Headers show

Comments

Richard Weinberger - Jan. 10, 2012, 4:57 p.m.
UBI_LAYOUT_VOLUME_TYPE and UBI_LAYOUT_VOLUME_ALIGN are currently
defined but not used.
Use them at least once. 8-)

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/vtbl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Artem Bityutskiy - Jan. 14, 2012, 3:11 p.m.
On Tue, 2012-01-10 at 17:57 +0100, Richard Weinberger wrote:
> UBI_LAYOUT_VOLUME_TYPE and UBI_LAYOUT_VOLUME_ALIGN are currently
> defined but not used.
> Use them at least once. 8-)
> 
> Signed-off-by: Richard Weinberger <richard@nod.at>

Hi Richard,

This will break backward compatibility - older and current kernels which
do not have this patch will error out when the find a volume without a
name. The right way to do this would be to change the UBI format
version, but you would need a really strong reason for this.
Richard Weinberger - Jan. 14, 2012, 3:34 p.m.
Am 14.01.2012 16:11, schrieb Artem Bityutskiy:
> On Tue, 2012-01-10 at 17:57 +0100, Richard Weinberger wrote:
>> UBI_LAYOUT_VOLUME_TYPE and UBI_LAYOUT_VOLUME_ALIGN are currently
>> defined but not used.
>> Use them at least once. 8-)
>>
>> Signed-off-by: Richard Weinberger <richard@nod.at>
> 
> Hi Richard,
> 
> This will break backward compatibility - older and current kernels which
> do not have this patch will error out when the find a volume without a
> name. The right way to do this would be to change the UBI format
> version, but you would need a really strong reason for this.
> 

Sorry, this comment makes absolutely no sense.

Did you mean my other patch?
But still, the other patch also does *not* allow volumes without names.

Confused,
//richard
Artem Bityutskiy - Jan. 14, 2012, 3:38 p.m.
On Sat, 2012-01-14 at 16:34 +0100, Richard Weinberger wrote:
> Am 14.01.2012 16:11, schrieb Artem Bityutskiy:
> > On Tue, 2012-01-10 at 17:57 +0100, Richard Weinberger wrote:
> >> UBI_LAYOUT_VOLUME_TYPE and UBI_LAYOUT_VOLUME_ALIGN are currently
> >> defined but not used.
> >> Use them at least once. 8-)
> >>
> >> Signed-off-by: Richard Weinberger <richard@nod.at>
> > 
> > Hi Richard,
> > 
> > This will break backward compatibility - older and current kernels which
> > do not have this patch will error out when the find a volume without a
> > name. The right way to do this would be to change the UBI format
> > version, but you would need a really strong reason for this.
> > 
> 
> Sorry, this comment makes absolutely no sense.
> 
> Did you mean my other patch?
> But still, the other patch also does *not* allow volumes without names.

Yes, sorry, ignore this one - I've pushed your patch.

(Embarrassed)

Patch

diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 9ad18da..93cb2f1 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -322,7 +322,7 @@  retry:
 		goto out_free;
 	}
 
-	vid_hdr->vol_type = UBI_VID_DYNAMIC;
+	vid_hdr->vol_type = UBI_LAYOUT_VOLUME_TYPE;
 	vid_hdr->vol_id = cpu_to_be32(UBI_LAYOUT_VOLUME_ID);
 	vid_hdr->compat = UBI_LAYOUT_VOLUME_COMPAT;
 	vid_hdr->data_size = vid_hdr->used_ebs =
@@ -632,7 +632,7 @@  static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
 		return -ENOMEM;
 
 	vol->reserved_pebs = UBI_LAYOUT_VOLUME_EBS;
-	vol->alignment = 1;
+	vol->alignment = UBI_LAYOUT_VOLUME_ALIGN;
 	vol->vol_type = UBI_DYNAMIC_VOLUME;
 	vol->name_len = sizeof(UBI_LAYOUT_VOLUME_NAME) - 1;
 	memcpy(vol->name, UBI_LAYOUT_VOLUME_NAME, vol->name_len + 1);