Changeset 116cb91 in mainline


Ignore:
Timestamp:
2012-02-14T21:33:55Z (13 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
acb866ae
Parents:
dd22cc4
Message:

mkexfat: get the service id and read the device sector size.

File:
1 edited

Legend:

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

    rdd22cc4 r116cb91  
    4242#define NAME    "mkexfat"
    4343
     44static void usage(void)
     45{
     46        printf("Usage: mkexfat <device>\n");
     47}
     48
    4449int main (int argc, char **argv)
    4550{
     51        aoff64_t dev_nblocks;
     52        char *dev_path;
     53        service_id_t service_id;
     54        size_t sector_size;
     55        int rc;
     56
     57        if (argc < 2) {
     58                printf(NAME ": Error, argument missing\n");
     59                usage();
     60                return 1;
     61        }
     62
     63        /* TODO: Add parameters */
     64
     65        ++argv;
     66        dev_path = *argv;
     67
     68        printf(NAME ": Device = %s\n", dev_path);
     69
     70        rc = loc_service_get_id(dev_path, &service_id, 0);
     71        if (rc != EOK) {
     72                printf(NAME ": Error resolving device `%s'.\n");
     73                return 2;
     74        }
     75
     76        rc = block_init(EXCHANGE_SERIALIZE, service_id, 2048);
     77        if (rc != EOK) {
     78                printf(NAME ": Error initializing libblock.\n");
     79                return 2;
     80        }
     81
     82        rc = block_get_bsize(service_id, &sector_size);
     83        if (rc != EOK) {
     84                printf(NAME ": Error determining device block size.\n");
     85                return 2;
     86        }
     87
     88
    4689        return 0;
    4790}
Note: See TracChangeset for help on using the changeset viewer.