Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68644
b: refs/heads/master
c: 8bc2296
h: refs/heads/master
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Oct 14, 2007
1 parent ae4b49e commit f762a97
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dcec4c3bdc4d5f4bd2d858ee1ce11e3424cbaed7
refs/heads/master: 8bc22961966b845aa5f965be30771902146c2fcc
16 changes: 8 additions & 8 deletions trunk/drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int compare_lebs(const struct ubi_device *ubi,
void *buf;
int len, err, second_is_newer, bitflips = 0, corrupted = 0;
uint32_t data_crc, crc;
struct ubi_vid_hdr *vidh = NULL;
struct ubi_vid_hdr *vh = NULL;
unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum);

if (seb->sqnum == 0 && sqnum2 == 0) {
Expand Down Expand Up @@ -323,11 +323,11 @@ static int compare_lebs(const struct ubi_device *ubi,
} else {
pnum = seb->pnum;

vidh = ubi_zalloc_vid_hdr(ubi);
if (!vidh)
vh = ubi_zalloc_vid_hdr(ubi);
if (!vh)
return -ENOMEM;

err = ubi_io_read_vid_hdr(ubi, pnum, vidh, 0);
err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
if (err) {
if (err == UBI_IO_BITFLIPS)
bitflips = 1;
Expand All @@ -341,15 +341,15 @@ static int compare_lebs(const struct ubi_device *ubi,
}
}

if (!vidh->copy_flag) {
if (!vh->copy_flag) {
/* It is not a copy, so it is newer */
dbg_bld("first PEB %d is newer, copy_flag is unset",
pnum);
err = bitflips << 1;
goto out_free_vidh;
}

vid_hdr = vidh;
vid_hdr = vh;
}

/* Read the data of the copy and check the CRC */
Expand Down Expand Up @@ -379,7 +379,7 @@ static int compare_lebs(const struct ubi_device *ubi,
}

vfree(buf);
ubi_free_vid_hdr(ubi, vidh);
ubi_free_vid_hdr(ubi, vh);

if (second_is_newer)
dbg_bld("second PEB %d is newer, copy_flag is set", pnum);
Expand All @@ -391,7 +391,7 @@ static int compare_lebs(const struct ubi_device *ubi,
out_free_buf:
vfree(buf);
out_free_vidh:
ubi_free_vid_hdr(ubi, vidh);
ubi_free_vid_hdr(ubi, vh);
ubi_assert(err < 0);
return err;
}
Expand Down
70 changes: 37 additions & 33 deletions trunk/drivers/mtd/ubi/vmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ static ssize_t vol_attribute_show(struct device *dev,
struct device_attribute *attr, char *buf);

/* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */
static struct device_attribute vol_reserved_ebs =
static struct device_attribute attr_vol_reserved_ebs =
__ATTR(reserved_ebs, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_type =
static struct device_attribute attr_vol_type =
__ATTR(type, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_name =
static struct device_attribute attr_vol_name =
__ATTR(name, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_corrupted =
static struct device_attribute attr_vol_corrupted =
__ATTR(corrupted, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_alignment =
static struct device_attribute attr_vol_alignment =
__ATTR(alignment, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_usable_eb_size =
static struct device_attribute attr_vol_usable_eb_size =
__ATTR(usable_eb_size, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_data_bytes =
static struct device_attribute attr_vol_data_bytes =
__ATTR(data_bytes, S_IRUGO, vol_attribute_show, NULL);
static struct device_attribute vol_upd_marker =
static struct device_attribute attr_vol_upd_marker =
__ATTR(upd_marker, S_IRUGO, vol_attribute_show, NULL);

/*
Expand All @@ -78,23 +78,27 @@ static ssize_t vol_attribute_show(struct device *dev,
spin_unlock(&vol->ubi->volumes_lock);
return -ENODEV;
}
if (attr == &vol_reserved_ebs)
if (attr == &attr_vol_reserved_ebs)
ret = sprintf(buf, "%d\n", vol->reserved_pebs);
else if (attr == &vol_type) {
else if (attr == &attr_vol_type) {
const char *tp;
tp = vol->vol_type == UBI_DYNAMIC_VOLUME ? "dynamic" : "static";

if (vol->vol_type == UBI_DYNAMIC_VOLUME)
tp = "dynamic";
else
tp = "static";
ret = sprintf(buf, "%s\n", tp);
} else if (attr == &vol_name)
} else if (attr == &attr_vol_name)
ret = sprintf(buf, "%s\n", vol->name);
else if (attr == &vol_corrupted)
else if (attr == &attr_vol_corrupted)
ret = sprintf(buf, "%d\n", vol->corrupted);
else if (attr == &vol_alignment)
else if (attr == &attr_vol_alignment)
ret = sprintf(buf, "%d\n", vol->alignment);
else if (attr == &vol_usable_eb_size) {
else if (attr == &attr_vol_usable_eb_size) {
ret = sprintf(buf, "%d\n", vol->usable_leb_size);
} else if (attr == &vol_data_bytes)
} else if (attr == &attr_vol_data_bytes)
ret = sprintf(buf, "%lld\n", vol->used_bytes);
else if (attr == &vol_upd_marker)
else if (attr == &attr_vol_upd_marker)
ret = sprintf(buf, "%d\n", vol->upd_marker);
else
BUG();
Expand Down Expand Up @@ -126,28 +130,28 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
{
int err;

err = device_create_file(&vol->dev, &vol_reserved_ebs);
err = device_create_file(&vol->dev, &attr_vol_reserved_ebs);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_type);
err = device_create_file(&vol->dev, &attr_vol_type);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_name);
err = device_create_file(&vol->dev, &attr_vol_name);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_corrupted);
err = device_create_file(&vol->dev, &attr_vol_corrupted);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_alignment);
err = device_create_file(&vol->dev, &attr_vol_alignment);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_usable_eb_size);
err = device_create_file(&vol->dev, &attr_vol_usable_eb_size);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_data_bytes);
err = device_create_file(&vol->dev, &attr_vol_data_bytes);
if (err)
return err;
err = device_create_file(&vol->dev, &vol_upd_marker);
err = device_create_file(&vol->dev, &attr_vol_upd_marker);
if (err)
return err;
return 0;
Expand All @@ -159,14 +163,14 @@ static int volume_sysfs_init(struct ubi_device *ubi, struct ubi_volume *vol)
*/
static void volume_sysfs_close(struct ubi_volume *vol)
{
device_remove_file(&vol->dev, &vol_upd_marker);
device_remove_file(&vol->dev, &vol_data_bytes);
device_remove_file(&vol->dev, &vol_usable_eb_size);
device_remove_file(&vol->dev, &vol_alignment);
device_remove_file(&vol->dev, &vol_corrupted);
device_remove_file(&vol->dev, &vol_name);
device_remove_file(&vol->dev, &vol_type);
device_remove_file(&vol->dev, &vol_reserved_ebs);
device_remove_file(&vol->dev, &attr_vol_upd_marker);
device_remove_file(&vol->dev, &attr_vol_data_bytes);
device_remove_file(&vol->dev, &attr_vol_usable_eb_size);
device_remove_file(&vol->dev, &attr_vol_alignment);
device_remove_file(&vol->dev, &attr_vol_corrupted);
device_remove_file(&vol->dev, &attr_vol_name);
device_remove_file(&vol->dev, &attr_vol_type);
device_remove_file(&vol->dev, &attr_vol_reserved_ebs);
device_unregister(&vol->dev);
}

Expand Down

0 comments on commit f762a97

Please sign in to comment.