Changeset b6035ba in mainline for uspace/srv/fs/tmpfs/tmpfs_dump.c
- Timestamp:
- 2009-05-05T22:09:13Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 770d281
- Parents:
- c852f4be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_dump.c
rc852f4be rb6035ba 56 56 static bool 57 57 tmpfs_restore_recursion(int dev, off_t *bufpos, size_t *buflen, off_t *pos, 58 tmpfs_dentry_t *parent)58 fs_node_t *pfn) 59 59 { 60 60 struct rdentry entry; … … 64 64 do { 65 65 char *fname; 66 tmpfs_dentry_t *node; 66 fs_node_t *fn; 67 tmpfs_dentry_t *nodep; 67 68 uint32_t size; 68 69 … … 81 82 return false; 82 83 83 node = (tmpfs_dentry_t *)ops->create(dev, L_FILE);84 if ( node== NULL) {84 fn = ops->create(dev, L_FILE); 85 if (fn == NULL) { 85 86 free(fname); 86 87 return false; … … 89 90 if (block_read(dev, bufpos, buflen, pos, fname, 90 91 entry.len, TMPFS_BLOCK_SIZE) != EOK) { 91 ops->destroy( (void *) node);92 ops->destroy(fn); 92 93 free(fname); 93 94 return false; … … 95 96 fname[entry.len] = 0; 96 97 97 rc = ops->link( (void *) parent, (void *) node, fname);98 rc = ops->link(pfn, fn, fname); 98 99 if (rc != EOK) { 99 ops->destroy( (void *) node);100 ops->destroy(fn); 100 101 free(fname); 101 102 return false; … … 109 110 size = uint32_t_le2host(size); 110 111 111 node->data = malloc(size); 112 if (node->data == NULL) 112 nodep = TMPFS_NODE(fn); 113 nodep->data = malloc(size); 114 if (nodep->data == NULL) 113 115 return false; 114 116 115 node ->size = size;116 if (block_read(dev, bufpos, buflen, pos, node ->data,117 nodep->size = size; 118 if (block_read(dev, bufpos, buflen, pos, nodep->data, 117 119 size, TMPFS_BLOCK_SIZE) != EOK) 118 120 return false; … … 124 126 return false; 125 127 126 node = (tmpfs_dentry_t *)ops->create(dev, L_DIRECTORY);127 if ( node== NULL) {128 fn = ops->create(dev, L_DIRECTORY); 129 if (fn == NULL) { 128 130 free(fname); 129 131 return false; … … 132 134 if (block_read(dev, bufpos, buflen, pos, fname, 133 135 entry.len, TMPFS_BLOCK_SIZE) != EOK) { 134 ops->destroy( (void *) node);136 ops->destroy(fn); 135 137 free(fname); 136 138 return false; … … 138 140 fname[entry.len] = 0; 139 141 140 rc = ops->link( (void *) parent, (void *) node, fname);142 rc = ops->link(pfn, fn, fname); 141 143 if (rc != EOK) { 142 ops->destroy( (void *) node);144 ops->destroy(fn); 143 145 free(fname); 144 146 return false; … … 147 149 148 150 if (!tmpfs_restore_recursion(dev, bufpos, buflen, pos, 149 node))151 fn)) 150 152 return false; 151 153
Note:
See TracChangeset
for help on using the changeset viewer.