Changeset 08f747e in mainline for uspace/srv
- Timestamp:
- 2010-11-26T21:49:30Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e423a2d, dac43be
- Parents:
- e4dbfda (diff), da55d5b (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. - Location:
- uspace/srv
- Files:
-
- 26 edited
-
bd/ata_bd/ata_bd.c (modified) (2 diffs)
-
bd/part/guid_part/guid_part.c (modified) (1 diff)
-
bd/part/mbr_part/mbr_part.c (modified) (1 diff)
-
bd/rd/rd.c (modified) (1 diff)
-
clip/clip.c (modified) (1 diff)
-
devman/devman.c (modified) (2 diffs)
-
devman/main.c (modified) (5 diffs)
-
devman/match.c (modified) (2 diffs)
-
devmap/devmap.c (modified) (3 diffs)
-
hid/console/console.c (modified) (2 diffs)
-
hid/console/gcons.c (modified) (1 diff)
-
hid/fb/serial_console.c (modified) (3 diffs)
-
hid/s3c24xx_ts/s3c24xx_ts.c (modified) (2 diffs)
-
hw/char/i8042/i8042.c (modified) (3 diffs)
-
hw/char/s3c24xx_uart/s3c24xx_uart.c (modified) (4 diffs)
-
hw/cir/fhc/fhc.c (modified) (1 diff)
-
hw/netif/dp8390/dp8390.c (modified) (1 diff)
-
hw/netif/dp8390/ne2000.c (modified) (1 diff)
-
loader/main.c (modified) (1 diff)
-
net/il/arp/arp.c (modified) (1 diff)
-
net/il/ip/ip.c (modified) (2 diffs)
-
net/nil/eth/eth.c (modified) (2 diffs)
-
net/nil/nildummy/nildummy.c (modified) (2 diffs)
-
ns/task.c (modified) (1 diff)
-
taskmon/taskmon.c (modified) (2 diffs)
-
vfs/vfs_ops.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
re4dbfda r08f747e 113 113 printf(NAME ": ATA disk driver\n"); 114 114 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); 116 117 117 118 if (ata_bd_init() != EOK) … … 181 182 } 182 183 183 printf(" %" PRIu64 " blocks", d->blocks , d->blocks / (2 * 1024));184 printf(" %" PRIu64 " blocks", d->blocks); 184 185 185 186 mbytes = d->blocks / (2 * 1024); -
uspace/srv/bd/part/guid_part/guid_part.c
re4dbfda r08f747e 155 155 156 156 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); 158 158 return ENOTSUP; 159 159 } -
uspace/srv/bd/part/mbr_part/mbr_part.c
re4dbfda r08f747e 206 206 207 207 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); 209 209 return ENOTSUP; 210 210 } -
uspace/srv/bd/rd/rd.c
re4dbfda r08f747e 230 230 } 231 231 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); 233 234 234 235 int rc = devmap_driver_register(NAME, rd_connection); -
uspace/srv/clip/clip.c
re4dbfda r08f747e 172 172 break; 173 173 default: 174 if (!(callid & IPC_CALLID_NOTIFICATION)) 175 ipc_answer_0(callid, ENOENT); 174 ipc_answer_0(callid, ENOENT); 176 175 } 177 176 } -
uspace/srv/devman/devman.c
re4dbfda r08f747e 651 651 652 652 /* Send the device to the driver. */ 653 aid_t req = async_send_1(phone, DRIVER_ADD_DEVICE, node->handle, 654 &answer); 653 devman_handle_t parent_handle; 654 if (node->parent) { 655 parent_handle = node->parent->handle; 656 } else { 657 parent_handle = 0; 658 } 659 aid_t req = async_send_2(phone, DRIVER_ADD_DEVICE, node->handle, 660 parent_handle, &answer); 655 661 656 662 /* Send the device's name to the driver. */ … … 1022 1028 1023 1029 size_t idx = get_new_class_dev_idx(cl); 1024 asprintf(&dev_name, "%s% d", base_name, idx);1030 asprintf(&dev_name, "%s%zu", base_name, idx); 1025 1031 1026 1032 return dev_name; -
uspace/srv/devman/main.c
re4dbfda r08f747e 36 36 */ 37 37 38 #include <inttypes.h> 38 39 #include <assert.h> 39 40 #include <ipc/services.h> … … 405 406 break; 406 407 default: 407 if (!(callid & IPC_CALLID_NOTIFICATION)) 408 ipc_answer_0(callid, ENOENT); 408 ipc_answer_0(callid, ENOENT); 409 409 } 410 410 } … … 418 418 node_t *dev = find_dev_node(&device_tree, handle); 419 419 if (dev == NULL) { 420 printf(NAME ": devman_forward error - no device with handle % x "421 " was found.\n", handle);420 printf(NAME ": devman_forward error - no device with handle %" PRIun 421 " was found.\n", handle); 422 422 ipc_answer_0(iid, ENOENT); 423 423 return; … … 435 435 436 436 if (driver == NULL) { 437 printf(NAME ": devman_forward error - the device is not in "438 " usable state.\n", handle);437 printf(NAME ": devman_forward error - the device is not in %" PRIun 438 " usable state.\n", handle); 439 439 ipc_answer_0(iid, ENOENT); 440 440 return; … … 450 450 printf(NAME ": devman_forward: cound not forward to driver %s ", 451 451 driver->name); 452 printf("the driver's phone is % x).\n", driver->phone);452 printf("the driver's phone is %" PRIun ").\n", driver->phone); 453 453 ipc_answer_0(iid, EINVAL); 454 454 return; -
uspace/srv/devman/match.c
re4dbfda r08f747e 35 35 #include "devman.h" 36 36 37 /** Compute compound score of driver and device. 38 * 39 * @param driver Match id of the driver. 40 * @param device Match id of the device. 41 * @return Compound score. 42 * @retval 0 No match at all. 43 */ 44 static int compute_match_score(match_id_t *driver, match_id_t *device) 45 { 46 if (str_cmp(driver->id, device->id) == 0) { 47 /* 48 * The strings matches, return their score multiplied. 49 */ 50 return driver->score * device->score; 51 } else { 52 /* 53 * Different strings, return zero. 54 */ 55 return 0; 56 } 57 } 58 37 59 int get_match_score(driver_t *drv, node_t *dev) 38 60 { … … 44 66 45 67 /* 46 * Find first matching pair.68 * Go through all pairs, return the highest score obtainetd. 47 69 */ 70 int highest_score = 0; 71 48 72 link_t *drv_link = drv->match_ids.ids.next; 49 73 while (drv_link != drv_head) { 50 link_t *dev_link = dev ->match_ids.ids.next;74 link_t *dev_link = dev_head->next; 51 75 while (dev_link != dev_head) { 52 76 match_id_t *drv_id = list_get_instance(drv_link, match_id_t, link); 53 77 match_id_t *dev_id = list_get_instance(dev_link, match_id_t, link); 54 55 if (str_cmp(drv_id->id, dev_id->id) == 0) { 56 /* 57 * We found a match. 58 * Return the score of the match. 59 */ 60 return drv_id->score * dev_id->score; 78 79 int score = compute_match_score(drv_id, dev_id); 80 if (score > highest_score) { 81 highest_score = score; 61 82 } 62 83 63 84 dev_link = dev_link->next; 64 85 } 86 65 87 drv_link = drv_link->next; 66 88 } 67 89 68 return 0;90 return highest_score; 69 91 } 70 92 -
uspace/srv/devmap/devmap.c
re4dbfda r08f747e 555 555 if (devmap_device_find_name(namespace->name, device->name) != NULL) { 556 556 printf("%s: Device '%s/%s' already registered\n", NAME, 557 device->namespace , device->name);557 device->namespace->name, device->name); 558 558 devmap_namespace_destroy(namespace); 559 559 fibril_mutex_unlock(&devices_list_mutex); … … 1052 1052 break; 1053 1053 default: 1054 if (!(callid & IPC_CALLID_NOTIFICATION)) 1055 ipc_answer_0(callid, ENOENT); 1054 ipc_answer_0(callid, ENOENT); 1056 1055 } 1057 1056 } … … 1111 1110 break; 1112 1111 default: 1113 if (!(callid & IPC_CALLID_NOTIFICATION)) 1114 ipc_answer_0(callid, ENOENT); 1112 ipc_answer_0(callid, ENOENT); 1115 1113 } 1116 1114 } -
uspace/srv/hid/console/console.c
re4dbfda r08f747e 804 804 if (screenbuffer_init(&consoles[i].scr, 805 805 fb_info.cols, fb_info.rows) == NULL) { 806 printf(NAME ": Unable to allocate screen buffer % u\n", i);806 printf(NAME ": Unable to allocate screen buffer %zu\n", i); 807 807 return false; 808 808 } … … 813 813 814 814 char vc[DEVMAP_NAME_MAXLEN + 1]; 815 snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc% u", NAMESPACE, i);815 snprintf(vc, DEVMAP_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i); 816 816 817 817 if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) { -
uspace/srv/hid/console/gcons.c
re4dbfda r08f747e 157 157 158 158 char data[5]; 159 snprintf(data, 5, "% u", index + 1);159 snprintf(data, 5, "%zu", index + 1); 160 160 161 161 size_t i; -
uspace/srv/hid/fb/serial_console.c
re4dbfda r08f747e 47 47 #include <io/style.h> 48 48 #include <str.h> 49 #include <inttypes.h> 49 50 #include <io/screenbuffer.h> 50 51 … … 135 136 136 137 char control[MAX_CONTROL]; 137 snprintf(control, MAX_CONTROL, "\033[%u;%uf", row + 1, col + 1); 138 snprintf(control, MAX_CONTROL, "\033[%" PRIun ";%" PRIun "f", 139 row + 1, col + 1); 138 140 serial_puts(control); 139 141 } … … 253 255 { 254 256 char control[MAX_CONTROL]; 255 snprintf(control, MAX_CONTROL, "\033[0;% ur", last_row);257 snprintf(control, MAX_CONTROL, "\033[0;%" PRIun "r", last_row); 256 258 serial_puts(control); 257 259 } -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
re4dbfda r08f747e 50 50 #include <sysinfo.h> 51 51 #include <errno.h> 52 #include <inttypes.h> 52 53 53 54 #include "s3c24xx_ts.h" … … 136 137 ts->last_y = 0; 137 138 138 printf(NAME ": device at physical address 0x%x, inr %d.\n",139 ts->paddr, inr);139 printf(NAME ": device at physical address %p, inr %" PRIun ".\n", 140 (void *) ts->paddr, inr); 140 141 141 142 async_set_interrupt_received(s3c24xx_ts_irq_handler); -
uspace/srv/hw/char/i8042/i8042.c
re4dbfda r08f747e 46 46 #include <stdio.h> 47 47 #include <errno.h> 48 #include <inttypes.h> 48 49 49 50 #include "i8042.h" … … 201 202 ipc_register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd); 202 203 ipc_register_irq(inr_b, device_assign_devno(), 0, &i8042_kbd); 203 printf("%s: registered for interrupts %d and %d\n", NAME, inr_a, inr_b); 204 printf("%s: registered for interrupts %" PRIun " and %" PRIun "\n", 205 NAME, inr_a, inr_b); 204 206 205 207 wait_ready(); … … 262 264 break; 263 265 case IPC_FIRST_USER_METHOD: 264 printf(NAME ": write % dto devid %d\n",266 printf(NAME ": write %" PRIun " to devid %d\n", 265 267 IPC_GET_ARG1(call), dev_id); 266 268 i8042_port_write(dev_id, IPC_GET_ARG1(call)); -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
re4dbfda r08f747e 48 48 #include <sysinfo.h> 49 49 #include <errno.h> 50 #include <inttypes.h> 50 51 51 52 #include "s3c24xx_uart.h" … … 95 96 if (rc != EOK) { 96 97 devmap_hangup_phone(DEVMAP_DRIVER); 97 printf(NAME ": Unable to register device %s.\n"); 98 printf(NAME ": Unable to register device %s.\n", 99 NAMESPACE "/" NAME); 98 100 return -1; 99 101 } … … 134 136 break; 135 137 case CHAR_WRITE_BYTE: 136 printf(NAME ": write % dto device\n",138 printf(NAME ": write %" PRIun " to device\n", 137 139 IPC_GET_ARG1(call)); 138 140 s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call)); … … 185 187 uart->client_phone = -1; 186 188 187 printf(NAME ": device at physical address 0x%x, inr %d.\n",188 uart->paddr, inr);189 printf(NAME ": device at physical address %p, inr %" PRIun ".\n", 190 (void *) uart->paddr, inr); 189 191 190 192 async_set_interrupt_received(s3c24xx_uart_irq_handler); -
uspace/srv/hw/cir/fhc/fhc.c
re4dbfda r08f747e 129 129 } 130 130 131 printf(NAME ": FHC UART registers at %p, % dbytes\n", fhc_uart_phys,131 printf(NAME ": FHC UART registers at %p, %zu bytes\n", fhc_uart_phys, 132 132 fhc_uart_size); 133 133 -
uspace/srv/hw/netif/dp8390/dp8390.c
re4dbfda r08f747e 1516 1516 if (!wdeth_probe(dep) && !ne_probe(dep) && !el2_probe(dep)) 1517 1517 { 1518 printf("%s: No ethernet card found at 0x%x\n",1519 dep->de_name, dep->de_base_port);1518 printf("%s: No ethernet card found at %#lx\n", 1519 dep->de_name, dep->de_base_port); 1520 1520 dep->de_mode= DEM_DISABLED; 1521 1521 return; -
uspace/srv/hw/netif/dp8390/ne2000.c
re4dbfda r08f747e 267 267 if (!debug) 268 268 { 269 printf("%s: NE%d000 at % X:%d\n",270 dep->de_name, dep->de_16bit ? 2 : 1,271 dep->de_base_port, dep->de_irq);269 printf("%s: NE%d000 at %#lx:%d\n", 270 dep->de_name, dep->de_16bit ? 2 : 1, 271 dep->de_base_port, dep->de_irq); 272 272 } 273 273 else 274 274 { 275 275 printf("%s: Novell NE%d000 ethernet card at I/O address " 276 "0x%X, memory size 0x%X, irq %d\n",277 dep->de_name, dep->de_16bit ? 2 : 1,278 dep->de_base_port, dep->de_ramsize, dep->de_irq);276 "%#lx, memory size %#lx, irq %d\n", 277 dep->de_name, dep->de_16bit ? 2 : 1, 278 dep->de_base_port, dep->de_ramsize, dep->de_irq); 279 279 } 280 280 } -
uspace/srv/loader/main.c
re4dbfda r08f747e 411 411 break; 412 412 } 413 if ((callid & IPC_CALLID_NOTIFICATION) == 0 && 414 IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) { 413 if (IPC_GET_METHOD(call) != IPC_M_PHONE_HUNGUP) { 415 414 DPRINTF("Responding EINVAL to method %d.\n", 416 415 IPC_GET_METHOD(call)); -
uspace/srv/net/il/arp/arp.c
re4dbfda r08f747e 391 391 device->packet_dimension.content = mtu; 392 392 fibril_rwlock_write_unlock(&arp_globals.lock); 393 printf("arp - device %d changed mtu to % d\n\n", device_id, mtu);393 printf("arp - device %d changed mtu to %zu\n\n", device_id, mtu); 394 394 return EOK; 395 395 } -
uspace/srv/net/il/ip/ip.c
re4dbfda r08f747e 461 461 462 462 if (ip_netif->packet_dimension.content < IP_MIN_CONTENT) { 463 printf("Maximum transmission unit % dbytes is too small, at "463 printf("Maximum transmission unit %zu bytes is too small, at " 464 464 "least %d bytes are needed\n", 465 465 ip_netif->packet_dimension.content, IP_MIN_CONTENT); … … 502 502 fibril_rwlock_write_unlock(&ip_globals.netifs_lock); 503 503 504 printf("%s: Device %d changed MTU to % d\n", NAME, device_id, mtu);504 printf("%s: Device %d changed MTU to %zu\n", NAME, device_id, mtu); 505 505 506 506 return EOK; -
uspace/srv/net/nil/eth/eth.c
re4dbfda r08f747e 315 315 device->mtu = ETH_MAX_TAGGED_CONTENT(device->flags); 316 316 317 printf("Device %d already exists:\tMTU\t= % d\n",317 printf("Device %d already exists:\tMTU\t= %zu\n", 318 318 device->device_id, device->mtu); 319 319 fibril_rwlock_write_unlock(ð_globals.devices_lock); … … 407 407 } 408 408 409 printf("%s: Device registered (id: %d, service: %d: mtu: % d, "409 printf("%s: Device registered (id: %d, service: %d: mtu: %zu, " 410 410 "mac: %x:%x:%x:%x:%x:%x, flags: 0x%x)\n", 411 411 NAME, device->device_id, device->service, device->mtu, -
uspace/srv/net/nil/nildummy/nildummy.c
re4dbfda r08f747e 175 175 device->mtu = NET_DEFAULT_MTU; 176 176 177 printf("Device %d already exists:\tMTU\t= % d\n",177 printf("Device %d already exists:\tMTU\t= %zu\n", 178 178 device->device_id, device->mtu); 179 179 fibril_rwlock_write_unlock(&nildummy_globals.devices_lock); … … 232 232 } 233 233 234 printf("%s: Device registered (id: %d, service: %d, mtu: % d)\n",234 printf("%s: Device registered (id: %d, service: %d, mtu: %zu)\n", 235 235 NAME, device->device_id, device->service, device->mtu); 236 236 fibril_rwlock_write_unlock(&nildummy_globals.devices_lock); -
uspace/srv/ns/task.c
re4dbfda r08f747e 262 262 if (ht == NULL) { 263 263 /* No such task exists. */ 264 retval = ENOENT;265 goto out;264 ipc_answer_0(callid, ENOENT); 265 return; 266 266 } 267 267 -
uspace/srv/taskmon/taskmon.c
re4dbfda r08f747e 60 60 thread = IPC_GET_ARG3(*call); 61 61 62 if (asprintf(&s_taskid, "%" PRIu TASKID, taskid) < 0) {62 if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) { 63 63 printf("Memory allocation failed.\n"); 64 64 return; 65 65 } 66 66 67 printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread); 67 printf(NAME ": Task %" PRIu64 " fault in thread %p.\n", taskid, 68 (void *) thread); 68 69 69 70 fname = "/app/taskdump"; … … 72 73 char *dump_fname; 73 74 74 if (asprintf(&dump_fname, "/data/core%" PRIu TASKID, taskid) < 0) {75 if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) { 75 76 printf("Memory allocation failed.\n"); 76 77 return; 77 78 } 78 79 79 printf(NAME ": Executing %s -c %s -t %s\n", dump_fname, s_taskid);80 printf(NAME ": Executing %s -c %s -t %s\n", fname, dump_fname, s_taskid); 80 81 rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid, 81 82 NULL); 82 83 #else 83 printf(NAME ": Executing %s -t %s\n", s_taskid);84 printf(NAME ": Executing %s -t %s\n", fname, s_taskid); 84 85 rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL); 85 86 #endif -
uspace/srv/vfs/vfs_ops.c
re4dbfda r08f747e 55 55 56 56 /* Forward declarations of static functions. */ 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t); 57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, 58 aoff64_t); 58 59 59 60 /** … … 250 251 void vfs_mount(ipc_callid_t rid, ipc_call_t *request) 251 252 { 253 devmap_handle_t devmap_handle; 254 252 255 /* 253 256 * We expect the library to do the device-name to device-handle … … 255 258 * in the request. 256 259 */ 257 devmap_handle _t devmap_handle= (devmap_handle_t) IPC_GET_ARG1(*request);260 devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 258 261 259 262 /* … … 291 294 */ 292 295 char *fs_name; 293 rc = async_data_write_accept((void **) &fs_name, true, 0, FS_NAME_MAXLEN,294 0, NULL);296 rc = async_data_write_accept((void **) &fs_name, true, 0, 297 FS_NAME_MAXLEN, 0, NULL); 295 298 if (rc != EOK) { 296 299 free(mp); … … 458 461 459 462 phone = vfs_grab_phone(mp_node->fs_handle); 460 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, mp_node->devmap_handle,461 mp_node-> index);463 rc = async_req_2_0(phone, VFS_OUT_UNMOUNT, 464 mp_node->devmap_handle, mp_node->index); 462 465 vfs_release_phone(mp_node->fs_handle, phone); 463 466 if (rc != EOK) { … … 740 743 aid_t msg; 741 744 ipc_call_t answer; 742 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, file->node->devmap_handle,743 file->node-> index, &answer);745 msg = async_send_2(fs_phone, VFS_OUT_CLOSE, 746 file->node->devmap_handle, file->node->index, &answer); 744 747 745 748 /* Wait for reply from the FS server. */ … … 834 837 ipc_call_t answer; 835 838 if (read) { 836 if (file->append)837 file->pos = file->node->size;838 839 839 rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ, 840 840 file->node->devmap_handle, file->node->index, file->pos, 841 841 &answer); 842 842 } else { 843 if (file->append) 844 file->pos = file->node->size; 845 843 846 rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE, 844 847 file->node->devmap_handle, file->node->index, file->pos, … … 888 891 { 889 892 int fd = (int) IPC_GET_ARG1(*request); 890 off64_t off = 891 (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),IPC_GET_ARG3(*request));893 off64_t off = (off64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), 894 IPC_GET_ARG3(*request)); 892 895 int whence = (int) IPC_GET_ARG4(*request); 893 896 … … 903 906 off64_t newoff; 904 907 switch (whence) { 905 case SEEK_SET: 906 if (off >= 0) { 907 file->pos = (aoff64_t) off; 908 fibril_mutex_unlock(&file->lock); 909 ipc_answer_1(rid, EOK, off); 910 return; 911 } 912 break; 913 case SEEK_CUR: 914 if ((off >= 0) && (file->pos + off < file->pos)) { 915 fibril_mutex_unlock(&file->lock); 916 ipc_answer_0(rid, EOVERFLOW); 917 return; 918 } 919 920 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 921 fibril_mutex_unlock(&file->lock); 922 ipc_answer_0(rid, EOVERFLOW); 923 return; 924 } 925 926 file->pos += off; 927 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 928 908 case SEEK_SET: 909 if (off >= 0) { 910 file->pos = (aoff64_t) off; 929 911 fibril_mutex_unlock(&file->lock); 930 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 931 return; 932 case SEEK_END: 933 fibril_rwlock_read_lock(&file->node->contents_rwlock); 934 aoff64_t size = file->node->size; 935 936 if ((off >= 0) && (size + off < size)) { 937 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 938 fibril_mutex_unlock(&file->lock); 939 ipc_answer_0(rid, EOVERFLOW); 940 return; 941 } 942 943 if ((off < 0) && (size < (aoff64_t) -off)) { 944 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 945 fibril_mutex_unlock(&file->lock); 946 ipc_answer_0(rid, EOVERFLOW); 947 return; 948 } 949 950 file->pos = size + off; 951 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 952 912 ipc_answer_1(rid, EOK, off); 913 return; 914 } 915 break; 916 case SEEK_CUR: 917 if ((off >= 0) && (file->pos + off < file->pos)) { 918 fibril_mutex_unlock(&file->lock); 919 ipc_answer_0(rid, EOVERFLOW); 920 return; 921 } 922 923 if ((off < 0) && (file->pos < (aoff64_t) -off)) { 924 fibril_mutex_unlock(&file->lock); 925 ipc_answer_0(rid, EOVERFLOW); 926 return; 927 } 928 929 file->pos += off; 930 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 931 932 fibril_mutex_unlock(&file->lock); 933 ipc_answer_2(rid, EOK, LOWER32(newoff), 934 UPPER32(newoff)); 935 return; 936 case SEEK_END: 937 fibril_rwlock_read_lock(&file->node->contents_rwlock); 938 aoff64_t size = file->node->size; 939 940 if ((off >= 0) && (size + off < size)) { 953 941 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 954 942 fibril_mutex_unlock(&file->lock); 955 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 956 return; 943 ipc_answer_0(rid, EOVERFLOW); 944 return; 945 } 946 947 if ((off < 0) && (size < (aoff64_t) -off)) { 948 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 949 fibril_mutex_unlock(&file->lock); 950 ipc_answer_0(rid, EOVERFLOW); 951 return; 952 } 953 954 file->pos = size + off; 955 newoff = (file->pos > OFF64_MAX) ? OFF64_MAX : file->pos; 956 957 fibril_rwlock_read_unlock(&file->node->contents_rwlock); 958 fibril_mutex_unlock(&file->lock); 959 ipc_answer_2(rid, EOK, LOWER32(newoff), UPPER32(newoff)); 960 return; 957 961 } 958 962 … … 977 981 { 978 982 int fd = IPC_GET_ARG1(*request); 979 aoff64_t size = 980 (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request),IPC_GET_ARG3(*request));983 aoff64_t size = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(*request), 984 IPC_GET_ARG3(*request)); 981 985 int rc; 982 986
Note:
See TracChangeset
for help on using the changeset viewer.
