Changeset 7bdcc45 in mainline for uspace/srv/bd


Ignore:
Timestamp:
2010-12-16T16:38:49Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7837101
Parents:
8e58f94 (diff), eb221e5 (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.

Location:
uspace/srv/bd
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/ata_bd/ata_bd.c

    r8e58f94 r7bdcc45  
    113113        printf(NAME ": ATA disk driver\n");
    114114
    115         printf("I/O address %p/%p\n", ctl_physical, cmd_physical);
     115        printf("I/O address %p/%p\n", (void *) ctl_physical,
     116            (void *) cmd_physical);
    116117
    117118        if (ata_bd_init() != EOK)
     
    181182        }
    182183
    183         printf(" %" PRIu64 " blocks", d->blocks, d->blocks / (2 * 1024));
     184        printf(" %" PRIu64 " blocks", d->blocks);
    184185
    185186        mbytes = d->blocks / (2 * 1024);
     
    228229        ipc_callid_t callid;
    229230        ipc_call_t call;
    230         ipcarg_t method;
     231        sysarg_t method;
    231232        devmap_handle_t dh;
    232233        int flags;
     
    268269        while (1) {
    269270                callid = async_get_call(&call);
    270                 method = IPC_GET_METHOD(call);
     271                method = IPC_GET_IMETHOD(call);
    271272                switch (method) {
    272273                case IPC_M_PHONE_HUNGUP:
  • uspace/srv/bd/file_bd/file_bd.c

    r8e58f94 r7bdcc45  
    5656#define NAME "file_bd"
    5757
    58 static const size_t block_size = 512;
     58#define DEFAULT_BLOCK_SIZE 512
     59
     60static size_t block_size;
    5961static aoff64_t num_blocks;
    6062static FILE *img;
     
    6365static fibril_mutex_t dev_lock;
    6466
     67static void print_usage(void);
    6568static int file_bd_init(const char *fname);
    6669static void file_bd_connection(ipc_callid_t iid, ipc_call_t *icall);
     
    7174{
    7275        int rc;
     76        char *image_name;
     77        char *device_name;
    7378
    7479        printf(NAME ": File-backed block device driver\n");
    7580
    76         if (argc != 3) {
    77                 printf("Expected two arguments (image name, device name).\n");
     81        block_size = DEFAULT_BLOCK_SIZE;
     82
     83        ++argv; --argc;
     84        while (*argv != NULL && (*argv)[0] == '-') {
     85                /* Option */
     86                if (str_cmp(*argv, "-b") == 0) {
     87                        if (argc < 2) {
     88                                printf("Argument missing.\n");
     89                                print_usage();
     90                                return -1;
     91                        }
     92
     93                        rc = str_size_t(argv[1], NULL, 10, true, &block_size);
     94                        if (rc != EOK || block_size == 0) {
     95                                printf("Invalid block size '%s'.\n", argv[1]);
     96                                print_usage();
     97                                return -1;
     98                        }
     99                        ++argv; --argc;
     100                } else {
     101                        printf("Invalid option '%s'.\n", *argv);
     102                        print_usage();
     103                        return -1;
     104                }
     105                ++argv; --argc;
     106        }
     107
     108        if (argc < 2) {
     109                printf("Missing arguments.\n");
     110                print_usage();
    78111                return -1;
    79112        }
    80113
    81         if (file_bd_init(argv[1]) != EOK)
     114        image_name = argv[0];
     115        device_name = argv[1];
     116
     117        if (file_bd_init(image_name) != EOK)
    82118                return -1;
    83119
    84         rc = devmap_device_register(argv[2], &devmap_handle);
     120        rc = devmap_device_register(device_name, &devmap_handle);
    85121        if (rc != EOK) {
    86122                devmap_hangup_phone(DEVMAP_DRIVER);
    87                 printf(NAME ": Unable to register device %s.\n",
    88                         argv[2]);
     123                printf(NAME ": Unable to register device '%s'.\n",
     124                        device_name);
    89125                return rc;
    90126        }
     
    96132        /* Not reached */
    97133        return 0;
     134}
     135
     136static void print_usage(void)
     137{
     138        printf("Usage: " NAME " [-b <block_size>] <image_file> <device_name>\n");
    98139}
    99140
     
    136177        ipc_callid_t callid;
    137178        ipc_call_t call;
    138         ipcarg_t method;
     179        sysarg_t method;
    139180        size_t comm_size;
    140181        int flags;
     
    161202        while (1) {
    162203                callid = async_get_call(&call);
    163                 method = IPC_GET_METHOD(call);
     204                method = IPC_GET_IMETHOD(call);
    164205                switch (method) {
    165206                case IPC_M_PHONE_HUNGUP:
  • uspace/srv/bd/gxe_bd/gxe_bd.c

    r8e58f94 r7bdcc45  
    160160        ipc_callid_t callid;
    161161        ipc_call_t call;
    162         ipcarg_t method;
     162        sysarg_t method;
    163163        devmap_handle_t dh;
    164164        int flags;
     
    205205        while (1) {
    206206                callid = async_get_call(&call);
    207                 method = IPC_GET_METHOD(call);
     207                method = IPC_GET_IMETHOD(call);
    208208                switch (method) {
    209209                case IPC_M_PHONE_HUNGUP:
  • uspace/srv/bd/part/guid_part/guid_part.c

    r8e58f94 r7bdcc45  
    155155
    156156        if (block_size < 512 || (block_size % 512) != 0) {
    157                 printf(NAME ": invalid block size %d.\n");
     157                printf(NAME ": invalid block size %zu.\n", block_size);
    158158                return ENOTSUP;
    159159        }
     
    315315        ipc_callid_t callid;
    316316        ipc_call_t call;
    317         ipcarg_t method;
     317        sysarg_t method;
    318318        devmap_handle_t dh;
    319319        int flags;
     
    360360        while (1) {
    361361                callid = async_get_call(&call);
    362                 method = IPC_GET_METHOD(call);
     362                method = IPC_GET_IMETHOD(call);
    363363                switch (method) {
    364364                case IPC_M_PHONE_HUNGUP:
  • uspace/srv/bd/part/mbr_part/mbr_part.c

    r8e58f94 r7bdcc45  
    206206
    207207        if (block_size < 512 || (block_size % 512) != 0) {
    208                 printf(NAME ": invalid block size %d.\n");
     208                printf(NAME ": invalid block size %zu.\n", block_size);
    209209                return ENOTSUP;
    210210        }
     
    393393        ipc_callid_t callid;
    394394        ipc_call_t call;
    395         ipcarg_t method;
     395        sysarg_t method;
    396396        devmap_handle_t dh;
    397397        int flags;
     
    438438        while (1) {
    439439                callid = async_get_call(&call);
    440                 method = IPC_GET_METHOD(call);
     440                method = IPC_GET_IMETHOD(call);
    441441                switch (method) {
    442442                case IPC_M_PHONE_HUNGUP:
  • uspace/srv/bd/rd/rd.c

    r8e58f94 r7bdcc45  
    124124        while (true) {
    125125                callid = async_get_call(&call);
    126                 switch (IPC_GET_METHOD(call)) {
     126                switch (IPC_GET_IMETHOD(call)) {
    127127                case IPC_M_PHONE_HUNGUP:
    128128                        /*
     
    230230        }
    231231       
    232         printf("%s: Found RAM disk at %p, %d bytes\n", NAME, rd_ph_addr, rd_size);
     232        printf("%s: Found RAM disk at %p, %zu bytes\n", NAME,
     233            (void *) rd_ph_addr, rd_size);
    233234       
    234235        int rc = devmap_driver_register(NAME, rd_connection);
Note: See TracChangeset for help on using the changeset viewer.