Subversion Repositories shark

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed


#include <fs/types.h>
#include <fs/errno.h>
#include <fs/task.h>
#include <fs/maccess.h>

#include "file.h"
#include "inode.h"
#include "fileop.h"
#include "fs.h"

__off_t k_lseek(int fd, __off_t off, int whence)
{
  __pid_t pid;

  call_to_fs();
 
  /* don't try to use a bad file descriptor */
  pid=__get_pid();
  if (check_fd(pid,fd)) {
    printk(KERN_INFO "k_lseek: using bad file descriptor");
    return_from_fs(-EBADF);
  }

  /* seek on a directory not permitted! */
  if (file_ptr(pid,fd)->f_flag_isdir) return_from_fs(-EBADF);
 
  return_from_fs(file_ptr(pid,fd)->f_op->lseek(file_ptr(pid,fd),off,whence));
}