예제 #1
0
파일: ld_iscsi.c 프로젝트: agrare/libiscsi
off_t lseek(int fd, off_t offset, int whence) {
	if (iscsi_fd_list[fd].is_iscsi == 1) {
		off_t new_offset;
		off_t size = iscsi_fd_list[fd].num_blocks*iscsi_fd_list[fd].block_size;
		switch (whence) {
			case SEEK_SET:
				new_offset = offset;
				break;
			case SEEK_CUR:
				new_offset = iscsi_fd_list[fd].offset+offset;
				break;
			case SEEK_END:
				new_offset = size + offset;
				break;
			default:
				errno = EINVAL;
				return -1;
		}
		if (new_offset < 0 || new_offset > size) {
			errno = EINVAL;
			return -1;
		}
		iscsi_fd_list[fd].offset=new_offset;
		return iscsi_fd_list[fd].offset;
	}

	return real_lseek(fd, offset, whence);
}
예제 #2
0
파일: wrapped.c 프로젝트: hynnet/ralink_sdk
off_t lseek(int fd, off_t offset, int whence)
{
    if (smbw_fd(fd)) {
        return smbw_lseek(fd, offset, whence);
    }

    return real_lseek(fd, offset, whence);
}