Changeset ab3a851 in mainline for uspace/srv


Ignore:
Timestamp:
2010-11-30T00:50:25Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b2981aa
Parents:
178673c (diff), 41a7f62 (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

Local changes: fixed printf related warnings

Location:
uspace/srv
Files:
26 edited

Legend:

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

    r178673c rab3a851  
    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);
  • uspace/srv/bd/file_bd/file_bd.c

    r178673c rab3a851  
    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
  • uspace/srv/bd/part/guid_part/guid_part.c

    r178673c rab3a851  
    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        }
  • uspace/srv/bd/part/mbr_part/mbr_part.c

    r178673c rab3a851  
    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        }
  • uspace/srv/bd/rd/rd.c

    r178673c rab3a851  
    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);
  • uspace/srv/clip/clip.c

    r178673c rab3a851  
    172172                        break;
    173173                default:
    174                         if (!(callid & IPC_CALLID_NOTIFICATION))
    175                                 ipc_answer_0(callid, ENOENT);
     174                        ipc_answer_0(callid, ENOENT);
    176175                }
    177176        }
  • uspace/srv/devman/devman.c

    r178673c rab3a851  
    10201020       
    10211021        size_t idx = get_new_class_dev_idx(cl);
    1022         asprintf(&dev_name, "%s%d", base_name, idx);
     1022        asprintf(&dev_name, "%s%zu", base_name, idx);
    10231023       
    10241024        return dev_name;
  • uspace/srv/devman/main.c

    r178673c rab3a851  
    3636 */
    3737
     38#include <inttypes.h>
    3839#include <assert.h>
    3940#include <ipc/services.h>
     
    405406                        break;
    406407                default:
    407                         if (!(callid & IPC_CALLID_NOTIFICATION))
    408                                 ipc_answer_0(callid, ENOENT);
     408                        ipc_answer_0(callid, ENOENT);
    409409                }
    410410        }
     
    418418        node_t *dev = find_dev_node(&device_tree, handle);
    419419        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);
    422422                ipc_answer_0(iid, ENOENT);
    423423                return;
     
    435435       
    436436        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);
    439439                ipc_answer_0(iid, ENOENT);
    440440                return;
     
    450450                printf(NAME ": devman_forward: cound not forward to driver %s ",
    451451                    driver->name);
    452                 printf("the driver's phone is %x).\n", driver->phone);
     452                printf("the driver's phone is %" PRIun ").\n", driver->phone);
    453453                ipc_answer_0(iid, EINVAL);
    454454                return;
  • uspace/srv/devmap/devmap.c

    r178673c rab3a851  
    555555        if (devmap_device_find_name(namespace->name, device->name) != NULL) {
    556556                printf("%s: Device '%s/%s' already registered\n", NAME,
    557                     device->namespace, device->name);
     557                    device->namespace->name, device->name);
    558558                devmap_namespace_destroy(namespace);
    559559                fibril_mutex_unlock(&devices_list_mutex);
     
    10521052                        break;
    10531053                default:
    1054                         if (!(callid & IPC_CALLID_NOTIFICATION))
    1055                                 ipc_answer_0(callid, ENOENT);
     1054                        ipc_answer_0(callid, ENOENT);
    10561055                }
    10571056        }
     
    11111110                        break;
    11121111                default:
    1113                         if (!(callid & IPC_CALLID_NOTIFICATION))
    1114                                 ipc_answer_0(callid, ENOENT);
     1112                        ipc_answer_0(callid, ENOENT);
    11151113                }
    11161114        }
  • uspace/srv/hid/console/console.c

    r178673c rab3a851  
    804804                        if (screenbuffer_init(&consoles[i].scr,
    805805                            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);
    807807                                return false;
    808808                        }
     
    813813                       
    814814                        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);
    816816                       
    817817                        if (devmap_device_register(vc, &consoles[i].devmap_handle) != EOK) {
  • uspace/srv/hid/console/gcons.c

    r178673c rab3a851  
    157157               
    158158                char data[5];
    159                 snprintf(data, 5, "%u", index + 1);
     159                snprintf(data, 5, "%zu", index + 1);
    160160               
    161161                size_t i;
  • uspace/srv/hid/fb/serial_console.c

    r178673c rab3a851  
    4747#include <io/style.h>
    4848#include <str.h>
     49#include <inttypes.h>
    4950#include <io/screenbuffer.h>
    5051
     
    135136       
    136137        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);
    138140        serial_puts(control);
    139141}
     
    253255{
    254256        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);
    256258        serial_puts(control);
    257259}
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    r178673c rab3a851  
    5050#include <sysinfo.h>
    5151#include <errno.h>
     52#include <inttypes.h>
    5253
    5354#include "s3c24xx_ts.h"
     
    136137        ts->last_y = 0;
    137138
    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);
    140141
    141142        async_set_interrupt_received(s3c24xx_ts_irq_handler);
  • uspace/srv/hw/char/i8042/i8042.c

    r178673c rab3a851  
    4646#include <stdio.h>
    4747#include <errno.h>
     48#include <inttypes.h>
    4849
    4950#include "i8042.h"
     
    201202        ipc_register_irq(inr_a, device_assign_devno(), 0, &i8042_kbd);
    202203        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);
    204206
    205207        wait_ready();
     
    262264                        break;
    263265                case IPC_FIRST_USER_METHOD:
    264                         printf(NAME ": write %d to devid %d\n",
     266                        printf(NAME ": write %" PRIun " to devid %d\n",
    265267                            IPC_GET_ARG1(call), dev_id);
    266268                        i8042_port_write(dev_id, IPC_GET_ARG1(call));
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c

    r178673c rab3a851  
    4848#include <sysinfo.h>
    4949#include <errno.h>
     50#include <inttypes.h>
    5051
    5152#include "s3c24xx_uart.h"
     
    9596        if (rc != EOK) {
    9697                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);
    98100                return -1;
    99101        }
     
    134136                        break;
    135137                case CHAR_WRITE_BYTE:
    136                         printf(NAME ": write %d to device\n",
     138                        printf(NAME ": write %" PRIun " to device\n",
    137139                            IPC_GET_ARG1(call));
    138140                        s3c24xx_uart_sendb(uart, (uint8_t) IPC_GET_ARG1(call));
     
    185187        uart->client_phone = -1;
    186188
    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);
    189191
    190192        async_set_interrupt_received(s3c24xx_uart_irq_handler);
  • uspace/srv/hw/cir/fhc/fhc.c

    r178673c rab3a851  
    129129        }
    130130       
    131         printf(NAME ": FHC UART registers at %p, %d bytes\n", fhc_uart_phys,
     131        printf(NAME ": FHC UART registers at %p, %zu bytes\n", fhc_uart_phys,
    132132            fhc_uart_size);
    133133       
  • uspace/srv/hw/netif/dp8390/dp8390.c

    r178673c rab3a851  
    15161516        if (!wdeth_probe(dep) && !ne_probe(dep) && !el2_probe(dep))
    15171517        {
    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);
    15201520                dep->de_mode= DEM_DISABLED;
    15211521                return;
  • uspace/srv/hw/netif/dp8390/ne2000.c

    r178673c rab3a851  
    267267        if (!debug)
    268268        {
    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);
    272272        }
    273273        else
    274274        {
    275275                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);
    279279        }
    280280}
  • uspace/srv/loader/main.c

    r178673c rab3a851  
    411411                        break;
    412412                }
    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) {
    415414                        DPRINTF("Responding EINVAL to method %d.\n",
    416415                            IPC_GET_METHOD(call));
  • uspace/srv/net/il/arp/arp.c

    r178673c rab3a851  
    391391        device->packet_dimension.content = mtu;
    392392        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);
    394394        return EOK;
    395395}
  • uspace/srv/net/il/ip/ip.c

    r178673c rab3a851  
    461461       
    462462        if (ip_netif->packet_dimension.content < IP_MIN_CONTENT) {
    463                 printf("Maximum transmission unit %d bytes is too small, at "
     463                printf("Maximum transmission unit %zu bytes is too small, at "
    464464                    "least %d bytes are needed\n",
    465465                    ip_netif->packet_dimension.content, IP_MIN_CONTENT);
     
    502502        fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
    503503
    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);
    505505
    506506        return EOK;
  • uspace/srv/net/nil/eth/eth.c

    r178673c rab3a851  
    315315                        device->mtu = ETH_MAX_TAGGED_CONTENT(device->flags);
    316316               
    317                 printf("Device %d already exists:\tMTU\t= %d\n",
     317                printf("Device %d already exists:\tMTU\t= %zu\n",
    318318                    device->device_id, device->mtu);
    319319                fibril_rwlock_write_unlock(&eth_globals.devices_lock);
     
    407407        }
    408408       
    409         printf("%s: Device registered (id: %d, service: %d: mtu: %d, "
     409        printf("%s: Device registered (id: %d, service: %d: mtu: %zu, "
    410410            "mac: %x:%x:%x:%x:%x:%x, flags: 0x%x)\n",
    411411            NAME, device->device_id, device->service, device->mtu,
  • uspace/srv/net/nil/nildummy/nildummy.c

    r178673c rab3a851  
    175175                        device->mtu = NET_DEFAULT_MTU;
    176176               
    177                 printf("Device %d already exists:\tMTU\t= %d\n",
     177                printf("Device %d already exists:\tMTU\t= %zu\n",
    178178                    device->device_id, device->mtu);
    179179                fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
     
    232232        }
    233233       
    234         printf("%s: Device registered (id: %d, service: %d, mtu: %d)\n",
     234        printf("%s: Device registered (id: %d, service: %d, mtu: %zu)\n",
    235235            NAME, device->device_id, device->service, device->mtu);
    236236        fibril_rwlock_write_unlock(&nildummy_globals.devices_lock);
  • uspace/srv/ns/task.c

    r178673c rab3a851  
    262262        if (ht == NULL) {
    263263                /* No such task exists. */
    264                 retval = ENOENT;
    265                 goto out;
     264                ipc_answer_0(callid, ENOENT);
     265                return;
    266266        }
    267267
  • uspace/srv/taskmon/taskmon.c

    r178673c rab3a851  
    6060        thread = IPC_GET_ARG3(*call);
    6161
    62         if (asprintf(&s_taskid, "%" PRIuTASKID, taskid) < 0) {
     62        if (asprintf(&s_taskid, "%" PRIu64, taskid) < 0) {
    6363                printf("Memory allocation failed.\n");
    6464                return;
    6565        }
    6666
    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);
    6869
    6970        fname = "/app/taskdump";
     
    7273        char *dump_fname;
    7374
    74         if (asprintf(&dump_fname, "/data/core%" PRIuTASKID, taskid) < 0) {
     75        if (asprintf(&dump_fname, "/data/core%" PRIu64, taskid) < 0) {
    7576                printf("Memory allocation failed.\n");
    7677                return;
    7778        }
    7879
    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);
    8081        rc = task_spawnl(NULL, fname, fname, "-c", dump_fname, "-t", s_taskid,
    8182            NULL);
    8283#else
    83         printf(NAME ": Executing %s -t %s\n", s_taskid);
     84        printf(NAME ": Executing %s -t %s\n", fname, s_taskid);
    8485        rc = task_spawnl(NULL, fname, fname, "-t", s_taskid, NULL);
    8586#endif
  • uspace/srv/vfs/vfs_ops.c

    r178673c rab3a851  
    5555
    5656/* Forward declarations of static functions. */
    57 static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t, aoff64_t);
     57static int vfs_truncate_internal(fs_handle_t, devmap_handle_t, fs_index_t,
     58    aoff64_t);
    5859
    5960/**
     
    250251void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
    251252{
     253        devmap_handle_t devmap_handle;
     254
    252255        /*
    253256         * We expect the library to do the device-name to device-handle
     
    255258         * in the request.
    256259         */
    257         devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
     260        devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
    258261       
    259262        /*
     
    291294         */
    292295        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);
    295298        if (rc != EOK) {
    296299                free(mp);
     
    458461
    459462                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);
    462465                vfs_release_phone(mp_node->fs_handle, phone);
    463466                if (rc != EOK) {
     
    740743                aid_t msg;
    741744                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);
    744747               
    745748                /* Wait for reply from the FS server. */
     
    834837        ipc_call_t answer;
    835838        if (read) {
    836                 if (file->append)
    837                         file->pos = file->node->size;
    838                
    839839                rc = async_data_read_forward_3_1(fs_phone, VFS_OUT_READ,
    840840                    file->node->devmap_handle, file->node->index, file->pos,
    841841                    &answer);
    842842        } else {
     843                if (file->append)
     844                        file->pos = file->node->size;
     845               
    843846                rc = async_data_write_forward_3_1(fs_phone, VFS_OUT_WRITE,
    844847                    file->node->devmap_handle, file->node->index, file->pos,
     
    888891{
    889892        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));
    892895        int whence = (int) IPC_GET_ARG4(*request);
    893896       
     
    903906        off64_t newoff;
    904907        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;
    929911                        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)) {
    953941                        fibril_rwlock_read_unlock(&file->node->contents_rwlock);
    954942                        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;
    957961        }
    958962       
     
    977981{
    978982        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));
    981985        int rc;
    982986
Note: See TracChangeset for help on using the changeset viewer.