Changeset 92fd52d7 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2009-04-09T21:16:50Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7afb4a5
Parents:
a2c58f6
Message:

Nuke strcpy() and strcmp().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    ra2c58f6 r92fd52d7  
    256256        assert(hlp);
    257257        tmpfs_name_t *namep = hash_table_get_instance(hlp, tmpfs_name_t, link);
    258         return !strcmp(namep->name, component);
     258        return !str_cmp(namep->name, component);
    259259}
    260260
     
    320320                return ENOMEM;
    321321        tmpfs_name_initialize(namep);
    322         size_t len = strlen(nm);
    323         namep->name = malloc(len + 1);
     322        size_t size = str_size(nm);
     323        namep->name = malloc(size + 1);
    324324        if (!namep->name) {
    325325                free(namep);
     
    455455         */
    456456        ipc_callid_t callid;
    457         size_t len;
    458         if (!ipc_data_read_receive(&callid, &len)) {
     457        size_t size;
     458        if (!ipc_data_read_receive(&callid, &size)) {
    459459                ipc_answer_0(callid, EINVAL);   
    460460                ipc_answer_0(rid, EINVAL);
     
    464464        size_t bytes;
    465465        if (dentry->type == TMPFS_FILE) {
    466                 bytes = max(0, min(dentry->size - pos, len));
     466                bytes = max(0, min(dentry->size - pos, size));
    467467                (void) ipc_data_read_finalize(callid, dentry->data + pos,
    468468                    bytes);
     
    495495
    496496                (void) ipc_data_read_finalize(callid, namep->name,
    497                     strlen(namep->name) + 1);
     497                    str_size(namep->name) + 1);
    498498                bytes = 1;
    499499        }
     
    528528         */
    529529        ipc_callid_t callid;
    530         size_t len;
    531         if (!ipc_data_write_receive(&callid, &len)) {
     530        size_t size;
     531        if (!ipc_data_write_receive(&callid, &size)) {
    532532                ipc_answer_0(callid, EINVAL);   
    533533                ipc_answer_0(rid, EINVAL);
     
    538538         * Check whether the file needs to grow.
    539539         */
    540         if (pos + len <= dentry->size) {
     540        if (pos + size <= dentry->size) {
    541541                /* The file size is not changing. */
    542                 (void) ipc_data_write_finalize(callid, dentry->data + pos, len);
    543                 ipc_answer_2(rid, EOK, len, dentry->size);
    544                 return;
    545         }
    546         size_t delta = (pos + len) - dentry->size;
     542                (void) ipc_data_write_finalize(callid, dentry->data + pos, size);
     543                ipc_answer_2(rid, EOK, size, dentry->size);
     544                return;
     545        }
     546        size_t delta = (pos + size) - dentry->size;
    547547        /*
    548548         * At this point, we are deliberately extremely straightforward and
     
    562562        dentry->size += delta;
    563563        dentry->data = newdata;
    564         (void) ipc_data_write_finalize(callid, dentry->data + pos, len);
    565         ipc_answer_2(rid, EOK, len, dentry->size);
     564        (void) ipc_data_write_finalize(callid, dentry->data + pos, size);
     565        ipc_answer_2(rid, EOK, size, dentry->size);
    566566}
    567567
Note: See TracChangeset for help on using the changeset viewer.