コード例 #1
0
static void fd_calibrate_done(int status)
{
	DPRINT(("fd_calibrate_done()\n"));
	STOP_TIMEOUT();

	/* set the correct speed now */
	if (status & FDC1772STAT_RECNF) {
		printk("fd%d: restore failed\n", SelectedDrive);
		fd_error();
	} else {
		unit[SelectedDrive].track = 0;
		fd_seek();
	}
}
コード例 #2
0
ファイル: fd_dup.c プロジェクト: rsenn/shish
/* make an (fd) entry a duplicate of another
 * ----------------------------------------------------------------------- */
int fd_dup(struct fd *fd, int n) {
  struct fd *dupe;

  /* search the (fd) to be duplicated and 
     output error message and return if not found */
  if((dupe = fdtable[n]) == NULL)
    return fd_error(n, strerror(EBADF));

  while(dupe->dup) dupe = dupe->dup;
  
  if(dupe == fd)
    return fd_error(n, "we cannot duplicate ourselves");
  
  /* redirect buffer pointers */
  if(FD_ISRD(fd)) {
    if(!FD_ISRD(dupe))
      return fd_error(n, "not opened for reading");
  }
  
  if(FD_ISWR(fd)) {
    if(!FD_ISWR(dupe))
      return fd_error(n, "not opened for writing");
  }  

  fd->r = dupe->r;
  fd->w = dupe->w;
  
  /* copy the name and set up the mode of the duplicate */
  fd->name = dupe->name;
  fd->dup = dupe;
  fd->e = dupe->e;
  fd->mode |= (dupe->mode & FD_TYPE)|FD_DUP;
  fd->dev = dupe->dev;
  
  return 0;
}
コード例 #3
0
static void fd_seek_done(int status)
{
	DPRINT(("fd_seek_done()\n"));
	STOP_TIMEOUT();

	/* set the correct speed */
	if (status & FDC1772STAT_RECNF) {
		printk("fd%d: seek error (to track %d)\n",
		       SelectedDrive, ReqTrack);
		/* we don't know exactly which track we are on now! */
		unit[SelectedDrive].track = -1;
		fd_error();
	} else {
		unit[SelectedDrive].track = ReqTrack <<
		    unit[SelectedDrive].disktype->stretch;
		NeedSeek = 0;
		fd_rwsec();
	}
}