Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset db6e419 in mainline for uspace/app/mkfat/mkfat.c


Ignore:
Timestamp:
2011-08-16T18:53:00Z (10 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master
Children:
49160c4
Parents:
e0e922d (diff), 45058baa (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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/mkfat/mkfat.c

    re0e922d rdb6e419  
    4242#include <libblock.h>
    4343#include <mem.h>
    44 #include <devmap.h>
     44#include <loc.h>
    4545#include <byteorder.h>
    4646#include <sys/types.h>
     
    8585    struct fat_params *par);
    8686static int fat_blocks_write(struct fat_params const *par,
    87     devmap_handle_t handle);
     87    service_id_t service_id);
    8888static void fat_bootsec_create(struct fat_params const *par, struct fat_bs *bs);
    8989
     
    9595        int rc;
    9696        char *dev_path;
    97         devmap_handle_t handle;
     97        service_id_t service_id;
    9898        size_t block_size;
    9999        char *endptr;
     
    138138        dev_path = *argv;
    139139
    140         rc = devmap_device_get_handle(dev_path, &handle, 0);
     140        rc = loc_service_get_id(dev_path, &service_id, 0);
    141141        if (rc != EOK) {
    142142                printf(NAME ": Error resolving device `%s'.\n", dev_path);
     
    144144        }
    145145
    146         rc = block_init(EXCHANGE_SERIALIZE, handle, 2048);
     146        rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048);
    147147        if (rc != EOK)  {
    148148                printf(NAME ": Error initializing libblock.\n");
     
    150150        }
    151151
    152         rc = block_get_bsize(handle, &block_size);
     152        rc = block_get_bsize(service_id, &block_size);
    153153        if (rc != EOK) {
    154154                printf(NAME ": Error determining device block size.\n");
     
    156156        }
    157157
    158         rc = block_get_nblocks(handle, &dev_nblocks);
     158        rc = block_get_nblocks(service_id, &dev_nblocks);
    159159        if (rc != EOK) {
    160160                printf(NAME ": Warning, failed to obtain block device size.\n");
     
    183183        }
    184184
    185         rc = fat_blocks_write(&par, handle);
     185        rc = fat_blocks_write(&par, service_id);
    186186        if (rc != EOK) {
    187187                printf(NAME ": Error writing device.\n");
     
    189189        }
    190190
    191         block_fini(handle);
     191        block_fini(service_id);
    192192        printf("Success.\n");
    193193
     
    234234
    235235/** Create file system with the given parameters. */
    236 static int fat_blocks_write(struct fat_params const *par, devmap_handle_t handle)
     236static int fat_blocks_write(struct fat_params const *par, service_id_t service_id)
    237237{
    238238        aoff64_t addr;
     
    245245        fat_bootsec_create(par, &bs);
    246246
    247         rc = block_write_direct(handle, BS_BLOCK, 1, &bs);
     247        rc = block_write_direct(service_id, BS_BLOCK, 1, &bs);
    248248        if (rc != EOK)
    249249                return EIO;
     
    257257        /* Reserved sectors */
    258258        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);
    260260                if (rc != EOK)
    261261                        return EIO;
     
    277277                        }
    278278
    279                         rc = block_write_direct(handle, addr, 1, buffer);
     279                        rc = block_write_direct(service_id, addr, 1, buffer);
    280280                        if (rc != EOK)
    281281                                return EIO;
     
    291291        /* Root directory */
    292292        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);
    294294                if (rc != EOK)
    295295                        return EIO;
Note: See TracChangeset for help on using the changeset viewer.