Lines Matching defs:copy
27 // access to lazily-allocated/copy-on-write blocks
58 // rc > 1? need to create a copy
616 int lfs_emubd_copy(const struct lfs_config *cfg, lfs_emubd_t *copy) {
617 LFS_EMUBD_TRACE("lfs_emubd_copy(%p, %p)", (void*)cfg, (void*)copy);
620 // lazily copy over our block array
621 copy->blocks = malloc(bd->cfg->erase_count * sizeof(lfs_emubd_block_t*));
622 if (!copy->blocks) {
628 copy->blocks[i] = lfs_emubd_incblock(bd->blocks[i]);
632 copy->readed = bd->readed;
633 copy->proged = bd->proged;
634 copy->erased = bd->erased;
635 copy->power_cycles = bd->power_cycles;
636 copy->disk = bd->disk;
637 if (copy->disk) {
638 copy->disk->rc += 1;
640 copy->cfg = bd->cfg;