Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61215
b: refs/heads/master
c: 941dfb0
h: refs/heads/master
i:
  61213: 5b2f61b
  61211: 0dd0a67
  61207: 1d1f385
  61199: d42d4a5
  61183: 29b487e
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jul 18, 2007
1 parent a7fb284 commit c369ba9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 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: 4ab60a0d7c92cab16f7e470f80ea039a0b174bce
refs/heads/master: 941dfb07ed91451b1c58626a0d258dfdf468b593
1 change: 1 addition & 0 deletions trunk/drivers/mtd/ubi/cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ static ssize_t vol_cdev_write(struct file *file, const char __user *buf,
vol->corrupted = 1;
}
vol->checked = 1;
ubi_gluebi_updated(vol);
revoke_exclusive(desc, UBI_READWRITE);
}

Expand Down
27 changes: 26 additions & 1 deletion trunk/drivers/mtd/ubi/gluebi.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,22 @@ int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol)
mtd->flags = MTD_WRITEABLE;
mtd->writesize = ubi->min_io_size;
mtd->owner = THIS_MODULE;
mtd->size = vol->usable_leb_size * vol->reserved_pebs;
mtd->erasesize = vol->usable_leb_size;
mtd->read = gluebi_read;
mtd->write = gluebi_write;
mtd->erase = gluebi_erase;
mtd->get_device = gluebi_get_device;
mtd->put_device = gluebi_put_device;

/*
* In case of dynamic volume, MTD device size is just volume size. In
* case of a static volume the size is equivalent to the amount of data
* bytes, which is zero at this moment and will be changed after volume
* update.
*/
if (vol->vol_type == UBI_DYNAMIC_VOLUME)
mtd->size = vol->usable_leb_size * vol->reserved_pebs;

if (add_mtd_device(mtd)) {
ubi_err("cannot not add MTD device\n");
kfree(mtd->name);
Expand Down Expand Up @@ -321,3 +329,20 @@ int ubi_destroy_gluebi(struct ubi_volume *vol)
kfree(mtd->name);
return 0;
}

/**
* ubi_gluebi_updated - UBI volume was updated notifier.
* @vol: volume description object
*
* This function is called every time an UBI volume is updated. This function
* does nothing if volume @vol is dynamic, and changes MTD device size if the
* volume is static. This is needed because static volumes cannot be read past
* data they contain.
*/
void ubi_gluebi_updated(struct ubi_volume *vol)
{
struct mtd_info *mtd = &vol->gluebi_mtd;

if (vol->vol_type == UBI_STATIC_VOLUME)
mtd->size = vol->used_bytes;
}
2 changes: 1 addition & 1 deletion trunk/drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int paranoid_check_si(const struct ubi_device *ubi,
static struct ubi_ec_hdr *ech;
static struct ubi_vid_hdr *vidh;

/*
/**
* add_to_list - add physical eraseblock to a list.
* @si: scanning information
* @pnum: physical eraseblock number to add
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/mtd/ubi/ubi.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ void ubi_calculate_reserved(struct ubi_device *ubi);
#ifdef CONFIG_MTD_UBI_GLUEBI
int ubi_create_gluebi(struct ubi_device *ubi, struct ubi_volume *vol);
int ubi_destroy_gluebi(struct ubi_volume *vol);
void ubi_gluebi_updated(struct ubi_volume *vol);
#else
#define ubi_create_gluebi(ubi, vol) 0
#define ubi_destroy_gluebi(vol) 0
#define ubi_gluebi_updated(vol)
#endif

/* eba.c */
Expand Down

0 comments on commit c369ba9

Please sign in to comment.