Esempio n. 1
0
void setup_this(void){

   lookup = (t_lookup *)lookup_init(1);
   table = (t_table *)table_init(1000, 1);
   diff = (t_diff *)diff_init(1, 1);

   rk_circuit = (t_rk_circuit *)rk_mother_init(&rk_circuit_func,
					       2,
					       0,
					       1,
					       1);

   install_obj(&lookup->od);
   install_obj(&table->od);
   install_obj(&rk_circuit->od);
   install_obj(&diff->od);

   c_sig_freq  = init_lin_ctl(0, CTL_T_LIN, 1);
   c_sig_level = init_lin_ctl(1, CTL_T_LIN, 1);
   c_out_level = init_lin_ctl(2, CTL_T_LIN, 1);
   c_fb_in     = init_lin_ctl(3, CTL_T_LIN, 1);
   c_fb_out    = init_lin_ctl(4, CTL_T_LIN, 1);

   level_lin_ctl(c_sig_freq, sig_freq);
   level_lin_ctl(c_sig_level, sig_level);
   level_lin_ctl(c_out_level, out_level);
   level_lin_ctl(c_fb_in, fb_in);
   level_lin_ctl(c_fb_in, fb_out);

}
Esempio n. 2
0
void
verify_volume (void)
{
  int status;
#ifdef MTIOCTOP
  struct mtop t;
  int er;
#endif

  if (!diff_buf)
    diff_init ();
#ifdef MTIOCTOP
  t.mt_op = MTBSF;
  t.mt_count = 1;
  if (er = rmtioctl (archive, MTIOCTOP, (char *) &t), er < 0)
    {
      if (errno != EIO
	  || (er = rmtioctl (archive, MTIOCTOP, (char *) &t), er < 0))
	{
#endif
	  if (rmtlseek (archive, 0L, 0) != 0)
	    {

	      /* Lseek failed.  Try a different method.  */

	      WARN ((0, errno, _("Could not rewind archive file for verify")));
	      return;
	    }
#ifdef MTIOCTOP
	}
    }
#endif
  ar_reading = 1;
  now_verifying = 1;
  fl_read ();
  while (1)
    {
      status = read_header ();
      if (status == 0)
	{
	  unsigned n;

	  n = 0;
	  do
	    {
	      n++;
	      status = read_header ();
	    }
	  while (status == 0);
	  ERROR ((0, 0,
		  _("VERIFY FAILURE: %d invalid header(s) detected"), n));
	}
      if (status == 2 || status == EOF)
	break;
      diff_archive ();
    }
  ar_reading = 0;
  now_verifying = 0;

}
Esempio n. 3
0
void
verify_volume (void)
{
  if (!diff_buffer)
    diff_init ();

  /* Verifying an archive is meant to check if the physical media got it
     correctly, so try to defeat clever in-memory buffering pertaining to
     this particular media.  On Linux, for example, the floppy drive would
     not even be accessed for the whole verification.

     The code was using fsync only when the ioctl is unavailable, but
     Marty Leisner says that the ioctl does not work when not preceded by
     fsync.  So, until we know better, or maybe to please Marty, let's do it
     the unbelievable way :-).  */

#if HAVE_FSYNC
  fsync (archive);
#endif
#ifdef FDFLUSH
  ioctl (archive, FDFLUSH);
#endif

#ifdef MTIOCTOP
  {
    struct mtop operation;
    int status;

    operation.mt_op = MTBSF;
    operation.mt_count = 1;
    if (status = rmtioctl (archive, MTIOCTOP, (char *) &operation), status < 0)
      {
	if (errno != EIO
	    || (status = rmtioctl (archive, MTIOCTOP, (char *) &operation),
		status < 0))
	  {
#endif
	    if (rmtlseek (archive, 0L, 0) != 0)
	      {
		/* Lseek failed.  Try a different method.  */

		WARN ((0, errno,
		       _("Could not rewind archive file for verify")));
		return;
	      }
#ifdef MTIOCTOP
	  }
      }
  }
#endif

  access_mode = ACCESS_READ;
  now_verifying = 1;

  flush_read ();
  while (1)
    {
      enum read_header status = read_header ();

      if (status == HEADER_FAILURE)
	{
	  int counter = 0;

	  while (status == HEADER_FAILURE);
	    {
	      counter++;
	      status = read_header ();
	    }
	  ERROR ((0, 0,
		  _("VERIFY FAILURE: %d invalid header(s) detected"), counter));
	}
      if (status == HEADER_ZERO_BLOCK || status == HEADER_END_OF_FILE)
	break;

      diff_archive ();
    }

  access_mode = ACCESS_WRITE;
  now_verifying = 0;
}