Ignore:
File:
1 edited

Legend:

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

    rb7fd2a0 r40feeac  
    6464} vfs_boxed_handle_t;
    6565
    66 static errno_t _vfs_fd_free(vfs_client_data_t *, int);
     66static int _vfs_fd_free(vfs_client_data_t *, int);
    6767
    6868/** Initialize the table of open files. */
     
    133133
    134134/** Close the file in the endpoint FS server. */
    135 static errno_t vfs_file_close_remote(vfs_file_t *file)
     135static int vfs_file_close_remote(vfs_file_t *file)
    136136{
    137137        assert(!file->refcnt);
     
    145145        vfs_exchange_release(exch);
    146146       
    147         errno_t rc;
     147        sysarg_t rc;
    148148        async_wait_for(msg, &rc);
    149149       
    150         return IPC_GET_RETVAL(answer);
     150        return IPC_GET_ARG1(answer);
    151151}
    152152
     
    168168 *                      decremented.
    169169 */
    170 static errno_t vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)
    171 {
    172         errno_t rc = EOK;
     170static int vfs_file_delref(vfs_client_data_t *vfs_data, vfs_file_t *file)
     171{
     172        int rc = EOK;
    173173
    174174        assert(fibril_mutex_is_locked(&vfs_data->lock));
     
    192192}
    193193
    194 static errno_t _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc, int *out_fd)
     194static int _vfs_fd_alloc(vfs_client_data_t *vfs_data, vfs_file_t **file, bool desc)
    195195{
    196196        if (!vfs_files_init(vfs_data))
     
    223223                       
    224224                        fibril_mutex_unlock(&vfs_data->lock);
    225                         *out_fd = (int) i;
    226                         return EOK;
     225                        return (int) i;
    227226                }
    228227               
     
    250249 *             in a descending order.
    251250 *
    252  * @param[out] out_fd  First available file descriptor
    253  *
    254  * @return Error code.
    255  */
    256 errno_t vfs_fd_alloc(vfs_file_t **file, bool desc, int *out_fd)
    257 {
    258         return _vfs_fd_alloc(VFS_DATA, file, desc, out_fd);
    259 }
    260 
    261 static errno_t _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd)
     251 * @return First available file descriptor or a negative error
     252 *         code.
     253 */
     254int vfs_fd_alloc(vfs_file_t **file, bool desc)
     255{
     256        return _vfs_fd_alloc(VFS_DATA, file, desc);
     257}
     258
     259static int _vfs_fd_free_locked(vfs_client_data_t *vfs_data, int fd)
    262260{
    263261        if ((fd < 0) || (fd >= MAX_OPEN_FILES) || !vfs_data->files[fd]) {
     
    265263        }
    266264
    267         errno_t rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);
     265        int rc = vfs_file_delref(vfs_data, vfs_data->files[fd]);
    268266        vfs_data->files[fd] = NULL;
    269267        return rc;
    270268}
    271269
    272 static errno_t _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)
    273 {
    274         errno_t rc;
     270static int _vfs_fd_free(vfs_client_data_t *vfs_data, int fd)
     271{
     272        int rc;
    275273
    276274        if (!vfs_files_init(vfs_data))
     
    291289 *                      descriptor.
    292290 */
    293 errno_t vfs_fd_free(int fd)
     291int vfs_fd_free(int fd)
    294292{
    295293        return _vfs_fd_free(VFS_DATA, fd);
     
    305303 *
    306304 */
    307 errno_t vfs_fd_assign(vfs_file_t *file, int fd)
     305int vfs_fd_assign(vfs_file_t *file, int fd)
    308306{
    309307        if (!vfs_files_init(VFS_DATA))
     
    429427}
    430428
    431 errno_t vfs_wait_handle_internal(bool high_fd, int *out_fd)
     429int vfs_wait_handle_internal(bool high_fd)
    432430{
    433431        vfs_client_data_t *vfs_data = VFS_DATA;
     
    443441
    444442        vfs_file_t *file;
    445         errno_t rc = _vfs_fd_alloc(vfs_data, &file, high_fd, out_fd);
    446         if (rc != EOK) {
     443        int fd = _vfs_fd_alloc(vfs_data, &file, high_fd);
     444        if (fd < 0) {
    447445                vfs_node_delref(bh->node);
    448446                free(bh);
    449                 return rc;
     447                return fd;
    450448        }
    451449       
     
    454452        vfs_file_put(file);
    455453        free(bh);
    456         return EOK;
     454        return fd;
    457455}
    458456
Note: See TracChangeset for help on using the changeset viewer.