Changeset 9f98578 in mainline for uspace/srv/fs/exfat/exfat_fat.c
- Timestamp:
- 2011-07-14T07:03:17Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e584623
- Parents:
- af4dec0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/exfat/exfat_fat.c
raf4dec0 r9f98578 59 59 60 60 61 /** Get cluster from the FAT. 62 * 63 * @param bs Buffer holding the boot sector for the file system. 64 * @param devmap_handle Device handle for the file system. 65 * @param clst Cluster which to get. 66 * @param value Output argument holding the value of the cluster. 67 * 68 * @return EOK or a negative error code. 69 */ 70 int 71 fat_get_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle, 72 exfat_cluster_t clst, exfat_cluster_t *value) 73 { 74 block_t *b; 75 aoff64_t offset; 76 int rc; 77 78 offset = clst * sizeof(exfat_cluster_t); 79 80 rc = block_get(&b, devmap_handle, FAT_FS(bs) + offset / BPS(bs), BLOCK_FLAGS_NONE); 81 if (rc != EOK) 82 return rc; 83 84 *value = uint32_t_le2host(*(uint32_t *)(b->data + offset % BPS(bs))); 85 86 rc = block_put(b); 87 88 return rc; 89 } 90 91 /** Set cluster in FAT. 92 * 93 * @param bs Buffer holding the boot sector for the file system. 94 * @param devmap_handle Device handle for the file system. 95 * @param clst Cluster which is to be set. 96 * @param value Value to set the cluster with. 97 * 98 * @return EOK on success or a negative error code. 99 */ 100 int 101 fat_set_cluster(exfat_bs_t *bs, devmap_handle_t devmap_handle, 102 exfat_cluster_t clst, exfat_cluster_t value) 103 { 104 block_t *b; 105 aoff64_t offset; 106 int rc; 107 108 offset = clst * sizeof(exfat_cluster_t); 109 110 rc = block_get(&b, devmap_handle, FAT_FS(bs) + offset / BPS(bs), BLOCK_FLAGS_NONE); 111 if (rc != EOK) 112 return rc; 113 114 *(uint32_t *)(b->data + offset % BPS(bs)) = host2uint32_t_le(value); 115 116 b->dirty = true; /* need to sync block */ 117 rc = block_put(b); 118 return rc; 119 } 61 120 62 121 /** Perform basic sanity checks on the file system.
Note:
See TracChangeset
for help on using the changeset viewer.