Changeset 25c60f4 in mainline
- Timestamp:
- 2011-08-14T09:32:44Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f061de75
- Parents:
- 5d5863c
- Location:
- uspace/srv/fs/exfat
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_bitmap.c
r5d5863c r25c60f4 52 52 exfat_cluster_t clst) 53 53 { 54 /* TODO */55 return EOK;56 }57 58 int bitmap_set_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle,59 exfat_cluster_t firstc)60 {61 54 fs_node_t *fn; 62 55 block_t *b=NULL; … … 64 57 uint8_t *bitmap; 65 58 int rc; 66 67 firstc -= EXFAT_CLST_FIRST; 68 69 /* rc = exfat_node_get(&fn, devmap_handle, EXFAT_BITMAP_IDX); */59 bool alloc; 60 61 clst -= EXFAT_CLST_FIRST; 62 70 63 rc = exfat_bitmap_get(&fn, devmap_handle); 71 64 if (rc != EOK) … … 73 66 bitmapp = EXFAT_NODE(fn); 74 67 75 aoff64_t offset = firstc/ 8;68 aoff64_t offset = clst / 8; 76 69 rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs), BLOCK_FLAGS_NONE); 77 70 if (rc != EOK) { … … 80 73 } 81 74 bitmap = (uint8_t *)b->data; 82 bitmap[offset % BPS(bs)] |= (1 << (firstc % 8)); 75 alloc = bitmap[offset % BPS(bs)] & (1 << (clst % 8)); 76 77 rc = block_put(b); 78 if (rc != EOK) { 79 (void) exfat_node_put(fn); 80 return rc; 81 } 82 rc = exfat_node_put(fn); 83 if (rc != EOK) 84 return rc; 85 86 if (alloc) 87 return ENOENT; 88 89 return EOK; 90 } 91 92 int bitmap_set_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle, 93 exfat_cluster_t clst) 94 { 95 fs_node_t *fn; 96 block_t *b=NULL; 97 exfat_node_t *bitmapp; 98 uint8_t *bitmap; 99 int rc; 100 101 clst -= EXFAT_CLST_FIRST; 102 103 rc = exfat_bitmap_get(&fn, devmap_handle); 104 if (rc != EOK) 105 return rc; 106 bitmapp = EXFAT_NODE(fn); 107 108 aoff64_t offset = clst / 8; 109 rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs), BLOCK_FLAGS_NONE); 110 if (rc != EOK) { 111 (void) exfat_node_put(fn); 112 return rc; 113 } 114 bitmap = (uint8_t *)b->data; 115 bitmap[offset % BPS(bs)] |= (1 << (clst % 8)); 83 116 84 117 b->dirty = true; … … 93 126 94 127 int bitmap_clear_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle, 95 exfat_cluster_t firstc) 96 { 97 /* TODO */ 98 return EOK; 128 exfat_cluster_t clst) 129 { 130 fs_node_t *fn; 131 block_t *b=NULL; 132 exfat_node_t *bitmapp; 133 uint8_t *bitmap; 134 int rc; 135 136 clst -= EXFAT_CLST_FIRST; 137 138 rc = exfat_bitmap_get(&fn, devmap_handle); 139 if (rc != EOK) 140 return rc; 141 bitmapp = EXFAT_NODE(fn); 142 143 aoff64_t offset = clst / 8; 144 rc = exfat_block_get(&b, bs, bitmapp, offset / BPS(bs), BLOCK_FLAGS_NONE); 145 if (rc != EOK) { 146 (void) exfat_node_put(fn); 147 return rc; 148 } 149 bitmap = (uint8_t *)b->data; 150 bitmap[offset % BPS(bs)] &= ~(1 << (clst % 8)); 151 152 b->dirty = true; 153 rc = block_put(b); 154 if (rc != EOK) { 155 (void) exfat_node_put(fn); 156 return rc; 157 } 158 159 return exfat_node_put(fn); 99 160 } 100 161 -
uspace/srv/fs/exfat/exfat_bitmap.h
r5d5863c r25c60f4 53 53 exfat_cluster_t clst); 54 54 extern int bitmap_set_cluster(struct exfat_bs *bs, devmap_handle_t devmap_handle, 55 exfat_cluster_t firstc);55 exfat_cluster_t clst); 56 56 extern int bitmap_clear_cluster(struct exfat_bs *bs, devmap_handle_t devmap_handle, 57 exfat_cluster_t firstc); 57 exfat_cluster_t clst); 58 58 59 extern int bitmap_set_clusters(struct exfat_bs *bs, devmap_handle_t devmap_handle, 59 60 exfat_cluster_t firstc, exfat_cluster_t count);
Note:
See TracChangeset
for help on using the changeset viewer.