Changeset 1d2a1a9 in mainline for uspace/app/mkfat/mkfat.c
- Timestamp:
- 2011-08-17T20:44:32Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0cc32f2
- Parents:
- bb285b4 (diff), c53a705 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/mkfat/mkfat.c
rbb285b4 r1d2a1a9 42 42 #include <libblock.h> 43 43 #include <mem.h> 44 #include < devmap.h>44 #include <loc.h> 45 45 #include <byteorder.h> 46 46 #include <sys/types.h> … … 85 85 struct fat_params *par); 86 86 static int fat_blocks_write(struct fat_params const *par, 87 devmap_handle_t handle);87 service_id_t service_id); 88 88 static void fat_bootsec_create(struct fat_params const *par, struct fat_bs *bs); 89 89 … … 95 95 int rc; 96 96 char *dev_path; 97 devmap_handle_t handle;97 service_id_t service_id; 98 98 size_t block_size; 99 99 char *endptr; … … 138 138 dev_path = *argv; 139 139 140 rc = devmap_device_get_handle(dev_path, &handle, 0);140 rc = loc_service_get_id(dev_path, &service_id, 0); 141 141 if (rc != EOK) { 142 142 printf(NAME ": Error resolving device `%s'.\n", dev_path); … … 144 144 } 145 145 146 rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);146 rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048); 147 147 if (rc != EOK) { 148 148 printf(NAME ": Error initializing libblock.\n"); … … 150 150 } 151 151 152 rc = block_get_bsize( handle, &block_size);152 rc = block_get_bsize(service_id, &block_size); 153 153 if (rc != EOK) { 154 154 printf(NAME ": Error determining device block size.\n"); … … 156 156 } 157 157 158 rc = block_get_nblocks( handle, &dev_nblocks);158 rc = block_get_nblocks(service_id, &dev_nblocks); 159 159 if (rc != EOK) { 160 160 printf(NAME ": Warning, failed to obtain block device size.\n"); … … 183 183 } 184 184 185 rc = fat_blocks_write(&par, handle);185 rc = fat_blocks_write(&par, service_id); 186 186 if (rc != EOK) { 187 187 printf(NAME ": Error writing device.\n"); … … 189 189 } 190 190 191 block_fini( handle);191 block_fini(service_id); 192 192 printf("Success.\n"); 193 193 … … 234 234 235 235 /** Create file system with the given parameters. */ 236 static int fat_blocks_write(struct fat_params const *par, devmap_handle_t handle)236 static int fat_blocks_write(struct fat_params const *par, service_id_t service_id) 237 237 { 238 238 aoff64_t addr; … … 245 245 fat_bootsec_create(par, &bs); 246 246 247 rc = block_write_direct( handle, BS_BLOCK, 1, &bs);247 rc = block_write_direct(service_id, BS_BLOCK, 1, &bs); 248 248 if (rc != EOK) 249 249 return EIO; … … 257 257 /* Reserved sectors */ 258 258 for (i = 0; i < par->reserved_sectors - 1; ++i) { 259 rc = block_write_direct( handle, addr, 1, buffer);259 rc = block_write_direct(service_id, addr, 1, buffer); 260 260 if (rc != EOK) 261 261 return EIO; … … 277 277 } 278 278 279 rc = block_write_direct( handle, addr, 1, buffer);279 rc = block_write_direct(service_id, addr, 1, buffer); 280 280 if (rc != EOK) 281 281 return EIO; … … 291 291 /* Root directory */ 292 292 for (i = 0; i < par->rootdir_sectors; ++i) { 293 rc = block_write_direct( handle, addr, 1, buffer);293 rc = block_write_direct(service_id, addr, 1, buffer); 294 294 if (rc != EOK) 295 295 return EIO;
Note:
See TracChangeset
for help on using the changeset viewer.