Changeset 6843a9c in mainline for uspace/srv/bd/file_bd/file_bd.c
- Timestamp:
- 2012-06-29T13:02:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 722912e
- Parents:
- ba72f2b (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/file_bd/file_bd.c
rba72f2b r6843a9c 119 119 rc = loc_service_register(device_name, &service_id); 120 120 if (rc != EOK) { 121 printf( NAME ": Unable to register device '%s'.\n",122 121 printf("%s: Unable to register device '%s'.\n", 122 NAME, device_name); 123 123 return rc; 124 124 } 125 126 printf( NAME ": Accepting connections\n");125 126 printf("%s: Accepting connections\n", NAME); 127 127 task_retval(0); 128 128 async_manager(); 129 129 130 130 /* Not reached */ 131 131 return 0; … … 139 139 static int file_bd_init(const char *fname) 140 140 { 141 int rc; 142 long img_size; 143 144 rc = loc_server_register(NAME, file_bd_connection); 145 if (rc < 0) { 146 printf(NAME ": Unable to register driver.\n"); 141 async_set_client_connection(file_bd_connection); 142 int rc = loc_server_register(NAME); 143 if (rc != EOK) { 144 printf("%s: Unable to register driver.\n", NAME); 147 145 return rc; 148 146 } 149 147 150 148 img = fopen(fname, "rb+"); 151 149 if (img == NULL) 152 150 return EINVAL; 153 151 154 152 if (fseek(img, 0, SEEK_END) != 0) { 155 153 fclose(img); 156 154 return EIO; 157 155 } 158 159 img_size = ftell(img);156 157 off64_t img_size = ftell(img); 160 158 if (img_size < 0) { 161 159 fclose(img); 162 160 return EIO; 163 161 } 164 162 165 163 num_blocks = img_size / block_size; 166 164 167 165 fibril_mutex_initialize(&dev_lock); 168 166 169 167 return EOK; 170 168 } … … 190 188 } 191 189 192 fs_va = as_get_mappable_page(comm_size);193 if (fs_va == NULL) {190 (void) async_share_out_finalize(callid, &fs_va); 191 if (fs_va == AS_MAP_FAILED) { 194 192 async_answer_0(callid, EHANGUP); 195 193 return; 196 194 } 197 198 (void) async_share_out_finalize(callid, fs_va);199 195 200 196 while (true) {
Note:
See TracChangeset
for help on using the changeset viewer.