Subversion Repositories HelenOS

Rev

Rev 3425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3425 Rev 4377
Line 101... Line 101...
101
 * @return      EOK on success or EBADF if fd is an invalid file
101
 * @return      EOK on success or EBADF if fd is an invalid file
102
 *          descriptor.
102
 *          descriptor.
103
 */
103
 */
104
int vfs_fd_free(int fd)
104
int vfs_fd_free(int fd)
105
{
105
{
106
    if ((fd >= MAX_OPEN_FILES) || (files[fd] == NULL))
106
    if ((fd < 0) || (fd >= MAX_OPEN_FILES) || (files[fd] == NULL))
107
        return EBADF;
107
        return EBADF;
108
    vfs_file_delref(files[fd]);
108
    vfs_file_delref(files[fd]);
109
    files[fd] = NULL;
109
    files[fd] = NULL;
110
    return EOK;
110
    return EOK;
111
}
111
}
Line 148... Line 148...
148
 *
148
 *
149
 * @return      VFS file structure corresponding to fd.
149
 * @return      VFS file structure corresponding to fd.
150
 */
150
 */
151
vfs_file_t *vfs_file_get(int fd)
151
vfs_file_t *vfs_file_get(int fd)
152
{
152
{
153
    if (fd < MAX_OPEN_FILES)
153
    if ((fd >= 0) && (fd < MAX_OPEN_FILES))
154
        return files[fd];
154
        return files[fd];
155
    return NULL;
155
    return NULL;
156
}
156
}
157
 
157
 
158
/**
158
/**