Changeset 132ab5d1 in mainline for uspace/srv/vfs/vfs_ops.c


Ignore:
Timestamp:
2018-01-30T03:20:45Z (8 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5a6cc679
Parents:
8bfb163 (diff), 6a5d05b (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 commit '6a5d05bd2551e64111bea4f9332dd7448c26ce84' into forwardport

Separate return value from error code in gen_irq_code*().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/vfs/vfs_ops.c

    r8bfb163 r132ab5d1  
    8686}
    8787
    88 int vfs_op_clone(int oldfd, int newfd, bool desc)
     88int vfs_op_clone(int oldfd, int newfd, bool desc, int *out_fd)
    8989{
    9090        int rc;
     
    102102
    103103        if (newfd != -1) {
    104                 /* Make sure newfd is closed. */
    105                 (void) vfs_fd_free(newfd);
    106104                /* Assign the old file to newfd. */
    107105                rc = vfs_fd_assign(oldfile, newfd);
     106                *out_fd = newfd;
    108107        } else {
    109108                vfs_file_t *newfile;
    110                 int newfd = vfs_fd_alloc(&newfile, desc);
    111                 if (newfd >= 0) {
     109                rc = vfs_fd_alloc(&newfile, desc, out_fd);
     110                if (rc == EOK) {
    112111                        newfile->node = oldfile->node;
    113112                        newfile->permissions = oldfile->permissions;
     
    116115                        vfs_file_put(newfile);
    117116                }
    118                 rc = newfd;
    119117        }
    120118        vfs_file_put(oldfile);
     
    154152            &answer);
    155153        /* Send the mount options */
    156         sysarg_t rc = async_data_write_start(exch, options, str_size(options));
     154        int rc = async_data_write_start(exch, options, str_size(options));
    157155        if (rc != EOK) {
    158156                async_forget(msg);
     
    194192{
    195193        fs_handle_t fs_handle = 0;
    196         sysarg_t rc;
     194        int rc;
    197195        int retval;
    198196       
     
    225223
    226224int vfs_op_mount(int mpfd, unsigned service_id, unsigned flags,
    227     unsigned instance, const char *opts, const char *fs_name, int *outfd)
     225    unsigned instance, const char *opts, const char *fs_name, int *out_fd)
    228226{
    229227        int rc;
    230228        vfs_file_t *mp = NULL;
    231229        vfs_file_t *file = NULL;
    232         int fd = -1;
     230        *out_fd = -1;
    233231       
    234232        if (!(flags & VFS_MOUNT_CONNECT_ONLY)) {
     
    256254       
    257255        if (!(flags & VFS_MOUNT_NO_REF)) {
    258                 fd = vfs_fd_alloc(&file, false);
    259                 if (fd < 0) {
    260                         rc = fd;
     256                rc = vfs_fd_alloc(&file, false, out_fd);
     257                if (rc != EOK) {
    261258                        goto out;
    262259                }
     
    297294                vfs_file_put(file);
    298295
    299         if (rc != EOK && fd >= 0) {
    300                 vfs_fd_free(fd);
    301                 fd = 0;
    302         }
    303        
    304         *outfd = fd;
     296        if (rc != EOK && *out_fd >= 0) {
     297                vfs_fd_free(*out_fd);
     298                *out_fd = -1;
     299        }
     300       
    305301        return rc;
    306302}
     
    402398        }
    403399       
    404         sysarg_t rc;
     400        int rc;
    405401        async_wait_for(msg, &rc);
    406402       
     
    681677        vfs_exchange_release(fs_exch);
    682678       
    683         sysarg_t rc;
     679        int rc;
    684680        async_wait_for(msg, &rc);
    685681       
     
    693689{
    694690        async_exch_t *exch = vfs_exchange_grab(fs_handle);
    695         sysarg_t rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
     691        int rc = async_req_4_0(exch, VFS_OUT_TRUNCATE,
    696692            (sysarg_t) service_id, (sysarg_t) index, LOWER32(size),
    697693            UPPER32(size));
     
    830826}
    831827
    832 int vfs_op_wait_handle(bool high_fd)
    833 {
    834         return vfs_wait_handle_internal(high_fd);
     828int vfs_op_wait_handle(bool high_fd, int *out_fd)
     829{
     830        return vfs_wait_handle_internal(high_fd, out_fd);
    835831}
    836832
     
    894890       
    895891        vfs_file_t *file;
    896         int fd = vfs_fd_alloc(&file, false);
    897         if (fd < 0) {
     892        rc = vfs_fd_alloc(&file, false, out_fd);
     893        if (rc != EOK) {
    898894                vfs_node_put(node);
    899895                vfs_file_put(parent);
    900                 return fd;
     896                return rc;
    901897        }
    902898        assert(file != NULL);
     
    912908        fibril_rwlock_read_unlock(&namespace_rwlock);
    913909
    914         *out_fd = fd;
    915910        return EOK;
    916911}
Note: See TracChangeset for help on using the changeset viewer.