Home | History | Annotate | Download | only in mtdutils

Lines Matching refs:partition

39     const MtdPartition *partition;
46 const MtdPartition *partition;
193 mtd_mount_partition(const MtdPartition *partition, const char *mount_point,
200 sprintf(devname, "/dev/block/mtdblock%d", partition->device_index);
238 mtd_partition_info(const MtdPartition *partition,
242 sprintf(mtddevname, "/dev/mtd/mtd%d", partition->device_index);
257 MtdReadContext *mtd_read_partition(const MtdPartition *partition)
262 ctx->buffer = malloc(partition->erase_size);
269 sprintf(mtddevname, "/dev/mtd/mtd%d", partition->device_index);
277 ctx->partition = partition;
278 ctx->consumed = partition->erase_size;
282 // Seeks to a location in the partition. Don't mix with reads of
288 static int read_block(const MtdPartition *partition, int fd, char *data)
298 ssize_t size = partition->erase_size;
301 while (pos + size <= (int) partition->size) {
322 pos += partition->erase_size;
333 if (ctx->consumed < ctx->partition->erase_size) {
334 size_t avail = ctx->partition->erase_size - ctx->consumed;
342 while (ctx->consumed == ctx->partition->erase_size &&
343 len - read >= ctx->partition->erase_size) {
344 if (read_block(ctx->partition, ctx->fd, data + read)) return -1;
345 read += ctx->partition->erase_size;
353 if (ctx->consumed == ctx->partition->erase_size && read < len) {
354 if (read_block(ctx->partition, ctx->fd, ctx->buffer)) return -1;
369 MtdWriteContext *mtd_write_partition(const MtdPartition *partition)
378 ctx->buffer = malloc(partition->erase_size);
385 sprintf(mtddevname, "/dev/mtd/mtd%d", partition->device_index);
393 ctx->partition = partition;
409 const MtdPartition *partition = ctx->partition;
415 ssize_t size = partition->erase_size;
416 while (pos + size <= (int) partition->size) {
424 pos += partition->erase_size;
468 pos += partition->erase_size;
481 if (ctx->stored > 0 || len - wrote < ctx->partition->erase_size) {
482 size_t avail = ctx->partition->erase_size - ctx->stored;
490 if (ctx->stored == ctx->partition->erase_size) {
496 while (ctx->stored == 0 && len - wrote >= ctx->partition->erase_size) {
498 wrote += ctx->partition->erase_size;
509 size_t zero = ctx->partition->erase_size - ctx->stored;
518 const int total = (ctx->partition->size - pos) / ctx->partition->erase_size;
530 pos += ctx->partition->erase_size;
536 erase_info.length = ctx->partition->erase_size;
540 pos += ctx->partition->erase_size;
565 pos += ctx->partition->erase_size;