Changeset e6a78b9 in mainline for uspace/srv/bd/file_bd/file_bd.c


Ignore:
Timestamp:
2012-06-29T15:31:44Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9432f08
Parents:
34ab31c (diff), 0bbd13e (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/srv/bd/file_bd/file_bd.c

    r34ab31c re6a78b9  
    119119        rc = loc_service_register(device_name, &service_id);
    120120        if (rc != EOK) {
    121                 printf(NAME ": Unable to register device '%s'.\n",
    122                         device_name);
     121                printf("%s: Unable to register device '%s'.\n",
     122                    NAME, device_name);
    123123                return rc;
    124124        }
    125 
    126         printf(NAME ": Accepting connections\n");
     125       
     126        printf("%s: Accepting connections\n", NAME);
    127127        task_retval(0);
    128128        async_manager();
    129 
     129       
    130130        /* Not reached */
    131131        return 0;
     
    139139static int file_bd_init(const char *fname)
    140140{
    141         int rc;
    142         long img_size;
    143        
    144141        async_set_client_connection(file_bd_connection);
    145         rc = loc_server_register(NAME);
    146         if (rc < 0) {
    147                 printf(NAME ": Unable to register driver.\n");
     142        int rc = loc_server_register(NAME);
     143        if (rc != EOK) {
     144                printf("%s: Unable to register driver.\n", NAME);
    148145                return rc;
    149146        }
    150 
     147       
    151148        img = fopen(fname, "rb+");
    152149        if (img == NULL)
    153150                return EINVAL;
    154 
     151       
    155152        if (fseek(img, 0, SEEK_END) != 0) {
    156153                fclose(img);
    157154                return EIO;
    158155        }
    159 
    160         img_size = ftell(img);
     156       
     157        off64_t img_size = ftell(img);
    161158        if (img_size < 0) {
    162159                fclose(img);
    163160                return EIO;
    164161        }
    165 
     162       
    166163        num_blocks = img_size / block_size;
    167 
     164       
    168165        fibril_mutex_initialize(&dev_lock);
    169 
     166       
    170167        return EOK;
    171168}
     
    192189
    193190        (void) async_share_out_finalize(callid, &fs_va);
    194         if (fs_va == (void *) -1) {
     191        if (fs_va == AS_MAP_FAILED) {
    195192                async_answer_0(callid, EHANGUP);
    196193                return;
Note: See TracChangeset for help on using the changeset viewer.