src/stored/os.c
uint32_t status_dev(DEVICE *dev)
{
   struct mtget mt_stat;
   uint32_t stat = 0;

   if (dev->state & (ST_EOT | ST_WEOT)) {
      stat |= BMT_EOD;
      Pmsg0(-20, " EOD");
   }
   if (dev->state & ST_EOF) {
      stat |= BMT_EOF;
      Pmsg0(-20, " EOF");
   }
   if (dev->is_tape()) {
      stat |= BMT_TAPE;
      Pmsg0(-20,_(" Bacula status:"));
      Pmsg2(-20,_(" file=%d block=%d\n"), dev->file, dev->block_num);
      if (dev->d_ioctl(dev->fd(), MTIOCGET, (char *)&mt_stat) < 0) {
         berrno be;
         dev->dev_errno = errno;
         Mmsg2(dev->errmsg, _("ioctl MTIOCGET error on %s. ERR=%s.\n"),
            dev->print_name(), be.bstrerror());
         return 0;
      }
      Pmsg0(-20, _(" Device status:"));

#if defined(HAVE_LINUX_OS)
      if (GMT_EOF(mt_stat.mt_gstat)) {
         stat |= BMT_EOF;
         Pmsg0(-20, " EOF");
      }
      if (GMT_BOT(mt_stat.mt_gstat)) {
         stat |= BMT_BOT;
         Pmsg0(-20, " BOT");
      }
      if (GMT_EOT(mt_stat.mt_gstat)) {
         stat |= BMT_EOT;
         Pmsg0(-20, " EOT");
      }
      if (GMT_SM(mt_stat.mt_gstat)) {
         stat |= BMT_SM;
         Pmsg0(-20, " SM");
      }
      if (GMT_EOD(mt_stat.mt_gstat)) {
         stat |= BMT_EOD;
         Pmsg0(-20, " EOD");
      }
      if (GMT_WR_PROT(mt_stat.mt_gstat)) {
         stat |= BMT_WR_PROT;
         Pmsg0(-20, " WR_PROT");
      }
      if (GMT_ONLINE(mt_stat.mt_gstat)) {
         stat |= BMT_ONLINE;
         Pmsg0(-20, " ONLINE");
      }
      if (GMT_DR_OPEN(mt_stat.mt_gstat)) {
         stat |= BMT_DR_OPEN;
         Pmsg0(-20, " DR_OPEN");
      }
      if (GMT_IM_REP_EN(mt_stat.mt_gstat)) {
         stat |= BMT_IM_REP_EN;
         Pmsg0(-20, " IM_REP_EN");
      }
#elif defined(HAVE_WIN32)
      if (GMT_EOF(mt_stat.mt_gstat)) {
         stat |= BMT_EOF;
         Pmsg0(-20, " EOF");
      }
      if (GMT_BOT(mt_stat.mt_gstat)) {
         stat |= BMT_BOT;
         Pmsg0(-20, " BOT");
      }
      if (GMT_EOT(mt_stat.mt_gstat)) {
         stat |= BMT_EOT;
         Pmsg0(-20, " EOT");
      }
      if (GMT_EOD(mt_stat.mt_gstat)) {
         stat |= BMT_EOD;
         Pmsg0(-20, " EOD");
      }
      if (GMT_WR_PROT(mt_stat.mt_gstat)) {
         stat |= BMT_WR_PROT;
         Pmsg0(-20, " WR_PROT");
      }
      if (GMT_ONLINE(mt_stat.mt_gstat)) {
         stat |= BMT_ONLINE;
         Pmsg0(-20, " ONLINE");
      }
      if (GMT_DR_OPEN(mt_stat.mt_gstat)) {
         stat |= BMT_DR_OPEN;
         Pmsg0(-20, " DR_OPEN");
      }
      if (GMT_IM_REP_EN(mt_stat.mt_gstat)) {
         stat |= BMT_IM_REP_EN;
         Pmsg0(-20, " IM_REP_EN");
      }

#endif /* !SunOS && !OSF */
      if (dev->has_cap(CAP_MTIOCGET)) {
         Pmsg2(-20, _(" file=%d block=%d\n"), mt_stat.mt_fileno, mt_stat.mt_blkno);
      } else {
         Pmsg2(-20, _(" file=%d block=%d\n"), -1, -1);
      }
   } else {
      stat |= BMT_ONLINE | BMT_BOT;
   }
   return stat;
}
/*
 * Return the status of the device.  This was meant
 * to be a generic routine. Unfortunately, it doesn't
 * seem possible (at least I do not know how to do it
 * currently), which means that for the moment, this
 * routine has very little value.
 *
 *   Returns: status
 */
Return the status of the device.  This was meant
to be a generic routine. Unfortunately, it doesn't
seem possible (at least I do not know how to do it
currently), which means that for the moment, this
routine has very little value.

status
Return the status of the device . This was meant to be a generic routine . Unfortunately it doesn ' t seem possible ( at least I do not know how to do it currently ) which means that for the moment this routine has very little value . status
uint32_t status_dev(DEVICE *dev)
{
   struct mtget mt_stat;
   uint32_t stat = 0;
   if (dev->state & (ST_EOT | ST_WEOT)) {
      stat |= BMT_EOD;
      Pmsg0(-20, " EOD");
   }
   if (dev->state & ST_EOF) {
      stat |= BMT_EOF;
      Pmsg0(-20, " EOF");
   }
   if (dev->is_tape()) {
      stat |= BMT_TAPE;
      Pmsg0(-20,_(" Bacula status:"));
      Pmsg2(-20,_(" file=%d block=%d\n"), dev->file, dev->block_num);
      if (dev->d_ioctl(dev->fd(), MTIOCGET, (char *)&mt_stat) < 0) {
         berrno be;
         dev->dev_errno = errno;
         Mmsg2(dev->errmsg, _("ioctl MTIOCGET error on %s. ERR=%s.\n"),
            dev->print_name(), be.bstrerror());
         return 0;
      }
      Pmsg0(-20, _(" Device status:"));
#if defined(HAVE_LINUX_OS)
      if (GMT_EOF(mt_stat.mt_gstat)) {
         stat |= BMT_EOF;
         Pmsg0(-20, " EOF");
      }
      if (GMT_BOT(mt_stat.mt_gstat)) {
         stat |= BMT_BOT;
         Pmsg0(-20, " BOT");
      }
      if (GMT_EOT(mt_stat.mt_gstat)) {
         stat |= BMT_EOT;
         Pmsg0(-20, " EOT");
      }
      if (GMT_SM(mt_stat.mt_gstat)) {
         stat |= BMT_SM;
         Pmsg0(-20, " SM");
      }
      if (GMT_EOD(mt_stat.mt_gstat)) {
         stat |= BMT_EOD;
         Pmsg0(-20, " EOD");
      }
      if (GMT_WR_PROT(mt_stat.mt_gstat)) {
         stat |= BMT_WR_PROT;
         Pmsg0(-20, " WR_PROT");
      }
      if (GMT_ONLINE(mt_stat.mt_gstat)) {
         stat |= BMT_ONLINE;
         Pmsg0(-20, " ONLINE");
      }
      if (GMT_DR_OPEN(mt_stat.mt_gstat)) {
         stat |= BMT_DR_OPEN;
         Pmsg0(-20, " DR_OPEN");
      }
      if (GMT_IM_REP_EN(mt_stat.mt_gstat)) {
         stat |= BMT_IM_REP_EN;
         Pmsg0(-20, " IM_REP_EN");
      }
#elif defined(HAVE_WIN32)
      if (GMT_EOF(mt_stat.mt_gstat)) {
         stat |= BMT_EOF;
         Pmsg0(-20, " EOF");
      }
      if (GMT_BOT(mt_stat.mt_gstat)) {
         stat |= BMT_BOT;
         Pmsg0(-20, " BOT");
      }
      if (GMT_EOT(mt_stat.mt_gstat)) {
         stat |= BMT_EOT;
         Pmsg0(-20, " EOT");
      }
      if (GMT_EOD(mt_stat.mt_gstat)) {
         stat |= BMT_EOD;
         Pmsg0(-20, " EOD");
      }
      if (GMT_WR_PROT(mt_stat.mt_gstat)) {
         stat |= BMT_WR_PROT;
         Pmsg0(-20, " WR_PROT");
      }
      if (GMT_ONLINE(mt_stat.mt_gstat)) {
         stat |= BMT_ONLINE;
         Pmsg0(-20, " ONLINE");
      }
      if (GMT_DR_OPEN(mt_stat.mt_gstat)) {
         stat |= BMT_DR_OPEN;
         Pmsg0(-20, " DR_OPEN");
      }
      if (GMT_IM_REP_EN(mt_stat.mt_gstat)) {
         stat |= BMT_IM_REP_EN;
         Pmsg0(-20, " IM_REP_EN");
      }
#endif 
      if (dev->has_cap(CAP_MTIOCGET)) {
         Pmsg2(-20, _(" file=%d block=%d\n"), mt_stat.mt_fileno, mt_stat.mt_blkno);
      } else {
         Pmsg2(-20, _(" file=%d block=%d\n"), -1, -1);
      }
   } else {
      stat |= BMT_ONLINE | BMT_BOT;
   }
   return stat;
}
uint32_t status_dev ( DEVICE * dev ) { struct mtget mt_stat ; uint32_t stat = 0 ; if ( dev -> state & ( ST_EOT | ST_WEOT ) ) { stat |= BMT_EOD ; Pmsg0 ( -20 , " " ) ; } if ( dev -> state & ST_EOF ) { stat |= BMT_EOF ; Pmsg0 ( -20 , " " ) ; } if ( dev -> is_tape ( ) ) { stat |= BMT_TAPE ; Pmsg0 ( -20 , _ ( " " ) ) ; Pmsg2 ( -20 , _ ( " \n " ) , dev -> file , dev -> block_num ) ; if ( dev -> d_ioctl ( dev -> fd ( ) , MTIOCGET , ( char * ) & mt_stat ) < 0 ) { berrno be ; dev -> dev_errno = errno ; Mmsg2 ( dev -> errmsg , _ ( " \n " ) , dev -> print_name ( ) , be . bstrerror ( ) ) ; return 0 ; } Pmsg0 ( -20 , _ ( " " ) ) ; #if defined ( HAVE_LINUX_OS ) if ( GMT_EOF ( mt_stat . mt_gstat ) ) { stat |= BMT_EOF ; Pmsg0 ( -20 , " " ) ; } if ( GMT_BOT ( mt_stat . mt_gstat ) ) { stat |= BMT_BOT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_EOT ( mt_stat . mt_gstat ) ) { stat |= BMT_EOT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_SM ( mt_stat . mt_gstat ) ) { stat |= BMT_SM ; Pmsg0 ( -20 , " " ) ; } if ( GMT_EOD ( mt_stat . mt_gstat ) ) { stat |= BMT_EOD ; Pmsg0 ( -20 , " " ) ; } if ( GMT_WR_PROT ( mt_stat . mt_gstat ) ) { stat |= BMT_WR_PROT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_ONLINE ( mt_stat . mt_gstat ) ) { stat |= BMT_ONLINE ; Pmsg0 ( -20 , " " ) ; } if ( GMT_DR_OPEN ( mt_stat . mt_gstat ) ) { stat |= BMT_DR_OPEN ; Pmsg0 ( -20 , " " ) ; } if ( GMT_IM_REP_EN ( mt_stat . mt_gstat ) ) { stat |= BMT_IM_REP_EN ; Pmsg0 ( -20 , " " ) ; } #elif defined ( HAVE_WIN32 ) if ( GMT_EOF ( mt_stat . mt_gstat ) ) { stat |= BMT_EOF ; Pmsg0 ( -20 , " " ) ; } if ( GMT_BOT ( mt_stat . mt_gstat ) ) { stat |= BMT_BOT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_EOT ( mt_stat . mt_gstat ) ) { stat |= BMT_EOT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_EOD ( mt_stat . mt_gstat ) ) { stat |= BMT_EOD ; Pmsg0 ( -20 , " " ) ; } if ( GMT_WR_PROT ( mt_stat . mt_gstat ) ) { stat |= BMT_WR_PROT ; Pmsg0 ( -20 , " " ) ; } if ( GMT_ONLINE ( mt_stat . mt_gstat ) ) { stat |= BMT_ONLINE ; Pmsg0 ( -20 , " " ) ; } if ( GMT_DR_OPEN ( mt_stat . mt_gstat ) ) { stat |= BMT_DR_OPEN ; Pmsg0 ( -20 , " " ) ; } if ( GMT_IM_REP_EN ( mt_stat . mt_gstat ) ) { stat |= BMT_IM_REP_EN ; Pmsg0 ( -20 , " " ) ; } #endif if ( dev -> has_cap ( CAP_MTIOCGET ) ) { Pmsg2 ( -20 , _ ( " \n " ) , mt_stat . mt_fileno , mt_stat . mt_blkno ) ; } else { Pmsg2 ( -20 , _ ( " \n " ) , -1 , -1 ) ; } } else { stat |= BMT_ONLINE | BMT_BOT ; } return stat ; }
Return the status of the device.
Return the status of the device .
/* !SunOS && !OSF */