Changeset f77c1c9 in mainline for uspace/srv


Ignore:
Timestamp:
2017-12-08T21:03:35Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c19a5a59
Parents:
c1694b6b
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-07 19:44:55)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
Message:

Return VFS handles separately from error codes.

Location:
uspace/srv
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/match.c

    rc1694b6b rf77c1c9  
    202202        struct stat st;
    203203       
    204         fd = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ);
    205         if (fd < 0) {
     204        int rc = vfs_lookup_open(conf_path, WALK_REGULAR, MODE_READ, &fd);
     205        if (rc != EOK) {
    206206                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to open `%s' for reading: %s.",
    207                     conf_path, str_error(errno));
     207                    conf_path, str_error(rc));
    208208                goto cleanup;
    209209        }
    210210        opened = true;
    211211       
    212         if (vfs_stat(fd, &st) != EOK) {
     212        rc = vfs_stat(fd, &st);
     213        if (rc != EOK) {
    213214                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to fstat %d: %s.", fd,
    214                     str_error(errno));
     215                    str_error(rc));
    215216                goto cleanup;
    216217        }
     
    230231       
    231232        size_t read_bytes;
    232         int rc = vfs_read(fd, (aoff64_t []) {0}, buf, len, &read_bytes);
     233        rc = vfs_read(fd, (aoff64_t []) {0}, buf, len, &read_bytes);
    233234        if (rc != EOK) {
    234235                log_msg(LOG_DEFAULT, LVL_ERROR, "Unable to read file '%s': %s.", conf_path,
    235                     str_error(errno));
     236                    str_error(rc));
    236237                goto cleanup;
    237238        }
  • uspace/srv/loader/main.c

    rc1694b6b rf77c1c9  
    152152        }
    153153
    154         int file = vfs_receive_handle(true);
    155         if (file < 0) {
     154        int file;
     155        rc = vfs_receive_handle(true, &file);
     156        if (rc != EOK) {
    156157                async_answer_0(rid, EINVAL);
    157158                return;
     
    254255        }
    255256
    256         int file = vfs_receive_handle(true);
    257         if (file < 0) {
     257        int file;
     258        rc = vfs_receive_handle(true, &file);
     259        if (rc != EOK) {
    258260                async_answer_0(rid, EINVAL);
    259261                return;
  • uspace/srv/logger/ctl.c

    rc1694b6b rf77c1c9  
    8787                }
    8888                case LOGGER_CONTROL_SET_ROOT: {
    89                         int fd = vfs_receive_handle(true);
    90                         vfs_root_set(fd);
    91                         async_answer_0(callid, fd >= 0 ? EOK : fd);
     89                        int fd;
     90                        int rc = vfs_receive_handle(true, &fd);
     91                        if (rc == EOK) {
     92                                rc = vfs_root_set(fd);
     93                                vfs_put(fd);
     94                        }
     95                        async_answer_0(callid, rc);
    9296                        break;
    9397                }
  • uspace/srv/vfs/vfs.h

    rc1694b6b rf77c1c9  
    206206extern int vfs_open_node_remote(vfs_node_t *);
    207207
    208 extern int vfs_op_clone(int oldfd, int newfd, bool desc);
     208extern int vfs_op_clone(int oldfd, int newfd, bool desc, int *);
    209209extern int vfs_op_fsprobe(const char *, service_id_t, vfs_fs_probe_info_t *);
    210210extern int vfs_op_mount(int mpfd, unsigned servid, unsigned flags, unsigned instance, const char *opts, const char *fsname, int *outfd);
  • uspace/srv/vfs/vfs_ipc.c

    rc1694b6b rf77c1c9  
    4141        bool desc = IPC_GET_ARG3(*request);
    4242       
    43         int ret = vfs_op_clone(oldfd, newfd, desc);
    44         async_answer_0(rid, ret);
     43        int outfd = -1;
     44        int rc = vfs_op_clone(oldfd, newfd, desc, &outfd);
     45        async_answer_1(rid, rc, outfd);
    4546}
    4647
  • uspace/srv/vfs/vfs_ops.c

    rc1694b6b rf77c1c9  
    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;
     
    118118        vfs_file_put(oldfile);
    119119       
    120         return rc;
     120        if (rc < 0) {
     121                return rc;
     122        }
     123       
     124        *out_fd = rc;
     125        return EOK;
    121126}
    122127
Note: See TracChangeset for help on using the changeset viewer.