Changeset a46e56b in mainline for uspace/srv/fs


Ignore:
Timestamp:
2018-03-22T06:49:35Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77f0a1d
Parents:
3e242d2
git-author:
Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
git-committer:
Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
Message:

Prefer handle over ID in naming handle variables

Location:
uspace/srv/fs
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/cdfs/cdfs_ops.c

    r3e242d2 ra46e56b  
    12711271        }
    12721272
    1273         cap_call_handle_t callid;
     1273        cap_call_handle_t chandle;
    12741274        size_t len;
    1275         if (!async_data_read_receive(&callid, &len)) {
    1276                 async_answer_0(callid, EINVAL);
     1275        if (!async_data_read_receive(&chandle, &len)) {
     1276                async_answer_0(chandle, EINVAL);
    12771277                return EINVAL;
    12781278        }
     
    12811281                if (pos >= node->size) {
    12821282                        *rbytes = 0;
    1283                         async_data_read_finalize(callid, NULL, 0);
     1283                        async_data_read_finalize(chandle, NULL, 0);
    12841284                } else {
    12851285                        cdfs_lba_t lba = pos / BLOCK_SIZE;
     
    12931293                            BLOCK_FLAGS_NONE);
    12941294                        if (rc != EOK) {
    1295                                 async_answer_0(callid, rc);
     1295                                async_answer_0(chandle, rc);
    12961296                                return rc;
    12971297                        }
    12981298
    1299                         async_data_read_finalize(callid, block->data + offset,
     1299                        async_data_read_finalize(chandle, block->data + offset,
    13001300                            *rbytes);
    13011301                        rc = block_put(block);
     
    13061306                link_t *link = list_nth(&node->cs_list, pos);
    13071307                if (link == NULL) {
    1308                         async_answer_0(callid, ENOENT);
     1308                        async_answer_0(chandle, ENOENT);
    13091309                        return ENOENT;
    13101310                }
     
    13141314
    13151315                *rbytes = 1;
    1316                 async_data_read_finalize(callid, dentry->name,
     1316                async_data_read_finalize(chandle, dentry->name,
    13171317                    str_size(dentry->name) + 1);
    13181318        }
  • uspace/srv/fs/exfat/exfat_ops.c

    r3e242d2 ra46e56b  
    13371337        nodep = EXFAT_NODE(fn);
    13381338
    1339         cap_call_handle_t callid;
     1339        cap_call_handle_t chandle;
    13401340        size_t len;
    1341         if (!async_data_read_receive(&callid, &len)) {
     1341        if (!async_data_read_receive(&chandle, &len)) {
    13421342                exfat_node_put(fn);
    1343                 async_answer_0(callid, EINVAL);
     1343                async_answer_0(chandle, EINVAL);
    13441344                return EINVAL;
    13451345        }
     
    13561356                        /* reading beyond the EOF */
    13571357                        bytes = 0;
    1358                         (void) async_data_read_finalize(callid, NULL, 0);
     1358                        (void) async_data_read_finalize(chandle, NULL, 0);
    13591359                } else {
    13601360                        bytes = min(len, BPS(bs) - pos % BPS(bs));
     
    13641364                        if (rc != EOK) {
    13651365                                exfat_node_put(fn);
    1366                                 async_answer_0(callid, rc);
     1366                                async_answer_0(chandle, rc);
    13671367                                return rc;
    13681368                        }
    1369                         (void) async_data_read_finalize(callid,
     1369                        (void) async_data_read_finalize(chandle,
    13701370                            b->data + pos % BPS(bs), bytes);
    13711371                        rc = block_put(b);
     
    13771377        } else {
    13781378                if (nodep->type != EXFAT_DIRECTORY) {
    1379                         async_answer_0(callid, ENOTSUP);
     1379                        async_answer_0(chandle, ENOTSUP);
    13801380                        return ENOTSUP;
    13811381                }
     
    14111411err:
    14121412                (void) exfat_node_put(fn);
    1413                 async_answer_0(callid, rc);
     1413                async_answer_0(chandle, rc);
    14141414                return rc;
    14151415
     
    14191419                        goto err;
    14201420                rc = exfat_node_put(fn);
    1421                 async_answer_0(callid, rc != EOK ? rc : ENOENT);
     1421                async_answer_0(chandle, rc != EOK ? rc : ENOENT);
    14221422                *rbytes = 0;
    14231423                return rc != EOK ? rc : ENOENT;
     
    14281428                if (rc != EOK)
    14291429                        goto err;
    1430                 (void) async_data_read_finalize(callid, name,
     1430                (void) async_data_read_finalize(chandle, name,
    14311431                    str_size(name) + 1);
    14321432                bytes = (pos - spos) + 1;
     
    14811481        nodep = EXFAT_NODE(fn);
    14821482
    1483         cap_call_handle_t callid;
     1483        cap_call_handle_t chandle;
    14841484        size_t len;
    1485         if (!async_data_write_receive(&callid, &len)) {
     1485        if (!async_data_write_receive(&chandle, &len)) {
    14861486                (void) exfat_node_put(fn);
    1487                 async_answer_0(callid, EINVAL);
     1487                async_answer_0(chandle, EINVAL);
    14881488                return EINVAL;
    14891489        }
     
    15101510                        /* could not expand node */
    15111511                        (void) exfat_node_put(fn);
    1512                         async_answer_0(callid, rc);
     1512                        async_answer_0(chandle, rc);
    15131513                        return rc;
    15141514                }
     
    15291529        if (rc != EOK) {
    15301530                (void) exfat_node_put(fn);
    1531                 async_answer_0(callid, rc);
    1532                 return rc;
    1533         }
    1534 
    1535         (void) async_data_write_finalize(callid,
     1531                async_answer_0(chandle, rc);
     1532                return rc;
     1533        }
     1534
     1535        (void) async_data_write_finalize(chandle,
    15361536            b->data + pos % BPS(bs), bytes);
    15371537        b->dirty = true;                /* need to sync block */
  • uspace/srv/fs/fat/fat_ops.c

    r3e242d2 ra46e56b  
    12261226        nodep = FAT_NODE(fn);
    12271227
    1228         cap_call_handle_t callid;
     1228        cap_call_handle_t chandle;
    12291229        size_t len;
    1230         if (!async_data_read_receive(&callid, &len)) {
     1230        if (!async_data_read_receive(&chandle, &len)) {
    12311231                fat_node_put(fn);
    1232                 async_answer_0(callid, EINVAL);
     1232                async_answer_0(chandle, EINVAL);
    12331233                return EINVAL;
    12341234        }
     
    12451245                        /* reading beyond the EOF */
    12461246                        bytes = 0;
    1247                         (void) async_data_read_finalize(callid, NULL, 0);
     1247                        (void) async_data_read_finalize(chandle, NULL, 0);
    12481248                } else {
    12491249                        bytes = min(len, BPS(bs) - pos % BPS(bs));
     
    12531253                        if (rc != EOK) {
    12541254                                fat_node_put(fn);
    1255                                 async_answer_0(callid, rc);
     1255                                async_answer_0(chandle, rc);
    12561256                                return rc;
    12571257                        }
    1258                         (void) async_data_read_finalize(callid,
     1258                        (void) async_data_read_finalize(chandle,
    12591259                            b->data + pos % BPS(bs), bytes);
    12601260                        rc = block_put(b);
     
    12911291err:
    12921292                (void) fat_node_put(fn);
    1293                 async_answer_0(callid, rc);
     1293                async_answer_0(chandle, rc);
    12941294                return rc;
    12951295
     
    12991299                        goto err;
    13001300                rc = fat_node_put(fn);
    1301                 async_answer_0(callid, rc != EOK ? rc : ENOENT);
     1301                async_answer_0(chandle, rc != EOK ? rc : ENOENT);
    13021302                *rbytes = 0;
    13031303                return rc != EOK ? rc : ENOENT;
     
    13081308                if (rc != EOK)
    13091309                        goto err;
    1310                 (void) async_data_read_finalize(callid, name,
     1310                (void) async_data_read_finalize(chandle, name,
    13111311                    str_size(name) + 1);
    13121312                bytes = (pos - spos) + 1;
     
    13381338        nodep = FAT_NODE(fn);
    13391339
    1340         cap_call_handle_t callid;
     1340        cap_call_handle_t chandle;
    13411341        size_t len;
    1342         if (!async_data_write_receive(&callid, &len)) {
     1342        if (!async_data_write_receive(&chandle, &len)) {
    13431343                (void) fat_node_put(fn);
    1344                 async_answer_0(callid, EINVAL);
     1344                async_answer_0(chandle, EINVAL);
    13451345                return EINVAL;
    13461346        }
     
    13701370                if (rc != EOK) {
    13711371                        (void) fat_node_put(fn);
    1372                         async_answer_0(callid, rc);
     1372                        async_answer_0(chandle, rc);
    13731373                        return rc;
    13741374                }
     
    13761376                if (rc != EOK) {
    13771377                        (void) fat_node_put(fn);
    1378                         async_answer_0(callid, rc);
     1378                        async_answer_0(chandle, rc);
    13791379                        return rc;
    13801380                }
    1381                 (void) async_data_write_finalize(callid,
     1381                (void) async_data_write_finalize(chandle,
    13821382                    b->data + pos % BPS(bs), bytes);
    13831383                b->dirty = true;                /* need to sync block */
     
    14091409                        /* could not allocate a chain of nclsts clusters */
    14101410                        (void) fat_node_put(fn);
    1411                         async_answer_0(callid, rc);
     1411                        async_answer_0(chandle, rc);
    14121412                        return rc;
    14131413                }
     
    14171417                        (void) fat_free_clusters(bs, service_id, mcl);
    14181418                        (void) fat_node_put(fn);
    1419                         async_answer_0(callid, rc);
     1419                        async_answer_0(chandle, rc);
    14201420                        return rc;
    14211421                }
     
    14251425                        (void) fat_free_clusters(bs, service_id, mcl);
    14261426                        (void) fat_node_put(fn);
    1427                         async_answer_0(callid, rc);
     1427                        async_answer_0(chandle, rc);
    14281428                        return rc;
    14291429                }
    1430                 (void) async_data_write_finalize(callid,
     1430                (void) async_data_write_finalize(chandle,
    14311431                    b->data + pos % BPS(bs), bytes);
    14321432                b->dirty = true;                /* need to sync block */
  • uspace/srv/fs/locfs/locfs_ops.c

    r3e242d2 ra46e56b  
    478478{
    479479        if (index == 0) {
    480                 cap_call_handle_t callid;
     480                cap_call_handle_t chandle;
    481481                size_t size;
    482                 if (!async_data_read_receive(&callid, &size)) {
    483                         async_answer_0(callid, EINVAL);
     482                if (!async_data_read_receive(&chandle, &size)) {
     483                        async_answer_0(chandle, EINVAL);
    484484                        return EINVAL;
    485485                }
     
    500500
    501501                if (pos < count) {
    502                         async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
     502                        async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
    503503                        free(desc);
    504504                        *rbytes = 1;
     
    515515
    516516                        if (pos < count) {
    517                                 async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
     517                                async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
    518518                                free(desc);
    519519                                *rbytes = 1;
     
    524524                }
    525525
    526                 async_answer_0(callid, ENOENT);
     526                async_answer_0(chandle, ENOENT);
    527527                return ENOENT;
    528528        }
     
    532532        if (type == LOC_OBJECT_NAMESPACE) {
    533533                /* Namespace directory */
    534                 cap_call_handle_t callid;
     534                cap_call_handle_t chandle;
    535535                size_t size;
    536                 if (!async_data_read_receive(&callid, &size)) {
    537                         async_answer_0(callid, EINVAL);
     536                if (!async_data_read_receive(&chandle, &size)) {
     537                        async_answer_0(chandle, EINVAL);
    538538                        return EINVAL;
    539539                }
     
    543543
    544544                if (pos < count) {
    545                         async_data_read_finalize(callid, desc[pos].name, str_size(desc[pos].name) + 1);
     545                        async_data_read_finalize(chandle, desc[pos].name, str_size(desc[pos].name) + 1);
    546546                        free(desc);
    547547                        *rbytes = 1;
     
    550550
    551551                free(desc);
    552                 async_answer_0(callid, ENOENT);
     552                async_answer_0(chandle, ENOENT);
    553553                return ENOENT;
    554554        }
     
    568568                assert(dev->sess);
    569569
    570                 cap_call_handle_t callid;
    571                 if (!async_data_read_receive(&callid, NULL)) {
     570                cap_call_handle_t chandle;
     571                if (!async_data_read_receive(&chandle, NULL)) {
    572572                        fibril_mutex_unlock(&services_mutex);
    573                         async_answer_0(callid, EINVAL);
     573                        async_answer_0(chandle, EINVAL);
    574574                        return EINVAL;
    575575                }
     
    583583
    584584                /* Forward the IPC_M_DATA_READ request to the driver */
    585                 async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     585                async_forward_fast(chandle, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    586586
    587587                async_exchange_end(exch);
     
    632632                assert(dev->sess);
    633633
    634                 cap_call_handle_t callid;
    635                 if (!async_data_write_receive(&callid, NULL)) {
     634                cap_call_handle_t chandle;
     635                if (!async_data_write_receive(&chandle, NULL)) {
    636636                        fibril_mutex_unlock(&services_mutex);
    637                         async_answer_0(callid, EINVAL);
     637                        async_answer_0(chandle, EINVAL);
    638638                        return EINVAL;
    639639                }
     
    647647
    648648                /* Forward the IPC_M_DATA_WRITE request to the driver */
    649                 async_forward_fast(callid, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
     649                async_forward_fast(chandle, exch, 0, 0, 0, IPC_FF_ROUTE_FROM_ME);
    650650
    651651                async_exchange_end(exch);
  • uspace/srv/fs/mfs/mfs_ops.c

    r3e242d2 ra46e56b  
    837837        struct mfs_ino_info *ino_i;
    838838        size_t len, bytes = 0;
    839         cap_call_handle_t callid;
     839        cap_call_handle_t chandle;
    840840
    841841        mnode = fn->data;
    842842        ino_i = mnode->ino_i;
    843843
    844         if (!async_data_read_receive(&callid, &len)) {
     844        if (!async_data_read_receive(&chandle, &len)) {
    845845                rc = EINVAL;
    846846                goto out_error;
     
    869869
    870870                rc = mfs_node_put(fn);
    871                 async_answer_0(callid, rc != EOK ? rc : ENOENT);
     871                async_answer_0(chandle, rc != EOK ? rc : ENOENT);
    872872                return rc;
    873873found:
    874                 async_data_read_finalize(callid, d_info.d_name,
     874                async_data_read_finalize(chandle, d_info.d_name,
    875875                    str_size(d_info.d_name) + 1);
    876876                bytes = ((pos - spos) + 1);
     
    881881                        /* Trying to read beyond the end of file */
    882882                        bytes = 0;
    883                         (void) async_data_read_finalize(callid, NULL, 0);
     883                        (void) async_data_read_finalize(chandle, NULL, 0);
    884884                        goto out_success;
    885885                }
     
    903903                        }
    904904                        memset(buf, 0, sizeof(sbi->block_size));
    905                         async_data_read_finalize(callid,
     905                        async_data_read_finalize(chandle,
    906906                            buf + pos % sbi->block_size, bytes);
    907907                        free(buf);
     
    913913                        goto out_error;
    914914
    915                 async_data_read_finalize(callid, b->data +
     915                async_data_read_finalize(chandle, b->data +
    916916                    pos % sbi->block_size, bytes);
    917917
     
    928928out_error:
    929929        tmp = mfs_node_put(fn);
    930         async_answer_0(callid, tmp != EOK ? tmp : rc);
     930        async_answer_0(chandle, tmp != EOK ? tmp : rc);
    931931        return tmp != EOK ? tmp : rc;
    932932}
     
    946946                return ENOENT;
    947947
    948         cap_call_handle_t callid;
     948        cap_call_handle_t chandle;
    949949        size_t len;
    950950
    951         if (!async_data_write_receive(&callid, &len)) {
     951        if (!async_data_write_receive(&chandle, &len)) {
    952952                r = EINVAL;
    953953                goto out_err;
     
    992992                memset(b->data, 0, sbi->block_size);
    993993
    994         async_data_write_finalize(callid, b->data + (pos % bs), bytes);
     994        async_data_write_finalize(chandle, b->data + (pos % bs), bytes);
    995995        b->dirty = true;
    996996
     
    10121012out_err:
    10131013        mfs_node_put(fn);
    1014         async_answer_0(callid, r);
     1014        async_answer_0(chandle, r);
    10151015        return r;
    10161016}
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    r3e242d2 ra46e56b  
    484484         * Receive the read request.
    485485         */
    486         cap_call_handle_t callid;
     486        cap_call_handle_t chandle;
    487487        size_t size;
    488         if (!async_data_read_receive(&callid, &size)) {
    489                 async_answer_0(callid, EINVAL);
     488        if (!async_data_read_receive(&chandle, &size)) {
     489                async_answer_0(chandle, EINVAL);
    490490                return EINVAL;
    491491        }
     
    494494        if (nodep->type == TMPFS_FILE) {
    495495                bytes = min(nodep->size - pos, size);
    496                 (void) async_data_read_finalize(callid, nodep->data + pos,
     496                (void) async_data_read_finalize(chandle, nodep->data + pos,
    497497                    bytes);
    498498        } else {
     
    510510
    511511                if (lnk == NULL) {
    512                         async_answer_0(callid, ENOENT);
     512                        async_answer_0(chandle, ENOENT);
    513513                        return ENOENT;
    514514                }
     
    516516                dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
    517517
    518                 (void) async_data_read_finalize(callid, dentryp->name,
     518                (void) async_data_read_finalize(chandle, dentryp->name,
    519519                    str_size(dentryp->name) + 1);
    520520                bytes = 1;
     
    547547         * Receive the write request.
    548548         */
    549         cap_call_handle_t callid;
     549        cap_call_handle_t chandle;
    550550        size_t size;
    551         if (!async_data_write_receive(&callid, &size)) {
    552                 async_answer_0(callid, EINVAL);
     551        if (!async_data_write_receive(&chandle, &size)) {
     552                async_answer_0(chandle, EINVAL);
    553553                return EINVAL;
    554554        }
     
    559559        if (pos + size <= nodep->size) {
    560560                /* The file size is not changing. */
    561                 (void) async_data_write_finalize(callid, nodep->data + pos,
     561                (void) async_data_write_finalize(chandle, nodep->data + pos,
    562562                    size);
    563563                goto out;
     
    573573        void *newdata = realloc(nodep->data, nodep->size + delta);
    574574        if (!newdata) {
    575                 async_answer_0(callid, ENOMEM);
     575                async_answer_0(chandle, ENOMEM);
    576576                size = 0;
    577577                goto out;
     
    581581        nodep->size += delta;
    582582        nodep->data = newdata;
    583         (void) async_data_write_finalize(callid, nodep->data + pos, size);
     583        (void) async_data_write_finalize(chandle, nodep->data + pos, size);
    584584
    585585out:
  • uspace/srv/fs/udf/udf_file.c

    r3e242d2 ra46e56b  
    568568 *
    569569 * @param read_len Returned value. Length file or part file which we could read.
    570  * @param callid
     570 * @param chandle
    571571 * @param node     UDF node
    572572 * @param pos      Position in file since we have to read.
     
    576576 *
    577577 */
    578 errno_t udf_read_file(size_t *read_len, cap_call_handle_t callid, udf_node_t *node,
     578errno_t udf_read_file(size_t *read_len, cap_call_handle_t chandle, udf_node_t *node,
    579579    aoff64_t pos, size_t len)
    580580{
     
    598598            BLOCK_FLAGS_NONE);
    599599        if (rc != EOK) {
    600                 async_answer_0(callid, rc);
     600                async_answer_0(chandle, rc);
    601601                return rc;
    602602        }
     
    619619        }
    620620
    621         async_data_read_finalize(callid, block->data + sector_pos, *read_len);
     621        async_data_read_finalize(chandle, block->data + sector_pos, *read_len);
    622622        return block_put(block);
    623623}
  • uspace/srv/fs/udf/udf_ops.c

    r3e242d2 ra46e56b  
    464464        udf_node_t *node = UDF_NODE(rfn);
    465465
    466         cap_call_handle_t callid;
     466        cap_call_handle_t chandle;
    467467        size_t len = 0;
    468         if (!async_data_read_receive(&callid, &len)) {
    469                 async_answer_0(callid, EINVAL);
     468        if (!async_data_read_receive(&chandle, &len)) {
     469                async_answer_0(chandle, EINVAL);
    470470                udf_node_put(rfn);
    471471                return EINVAL;
     
    475475                if (pos >= node->data_size) {
    476476                        *rbytes = 0;
    477                         async_data_read_finalize(callid, NULL, 0);
     477                        async_data_read_finalize(chandle, NULL, 0);
    478478                        udf_node_put(rfn);
    479479                        return EOK;
     
    482482                size_t read_len = 0;
    483483                if (node->data == NULL)
    484                         rc = udf_read_file(&read_len, callid, node, pos, len);
     484                        rc = udf_read_file(&read_len, chandle, node, pos, len);
    485485                else {
    486486                        /* File in allocation descriptors area */
    487487                        read_len = (len < node->data_size) ? len : node->data_size;
    488                         async_data_read_finalize(callid, node->data + pos, read_len);
     488                        async_data_read_finalize(chandle, node->data + pos, read_len);
    489489                        rc = EOK;
    490490                }
     
    505505                            fid->lenght_file_id, &node->instance->charset);
    506506
    507                         async_data_read_finalize(callid, name, str_size(name) + 1);
     507                        async_data_read_finalize(chandle, name, str_size(name) + 1);
    508508                        *rbytes = 1;
    509509                        free(name);
     
    517517                        *rbytes = 0;
    518518                        udf_node_put(rfn);
    519                         async_answer_0(callid, ENOENT);
     519                        async_answer_0(chandle, ENOENT);
    520520                        return ENOENT;
    521521                }
Note: See TracChangeset for help on using the changeset viewer.