DEVRES *device = NULL;
int exit_code = 0;
+#define REC_SIZE 32768
/* Forward referenced subroutines */
static void do_tape_cmds();
char buf1[100], buf2[100];
int fd;
uint32_t i;
+ uint64_t write_eof;
uint32_t min_block_size;
struct tm tm;
BlockNumber = 0;
exit_code = 0;
- Pmsg0(-1, _("\n"
+ Pmsg1(-1, _("\n"
"This command simulates Bacula writing to a tape.\n"
"It requires either one or two blank tapes, which it\n"
"will label and write.\n\n"
"the tapes that are in slots 1 and 2, otherwise, you will\n"
"be prompted to insert the tapes when necessary.\n\n"
"It will print a status approximately\n"
-"every 322 MB, and write an EOF every 3.2 GB. If you have\n"
+"every 322 MB, and write an EOF every %s. If you have\n"
"selected the simple test option, after writing the first tape\n"
"it will rewind it and re-read the last block written.\n\n"
"If you have selected the multiple tape test, when the first tape\n"
"fills, it will ask for a second, and after writing a few more \n"
"blocks, it will stop. Then it will begin re-reading the\n"
"two tapes.\n\n"
-"This may take a long time -- hours! ...\n\n"));
+"This may take a long time -- hours! ...\n\n"),
+ edit_uint64_with_suffix(dev->max_file_size, buf1));
get_cmd(_("Do you want to run the simplified test (s) with one tape\n"
"or the complete multiple tape (m) test: (s/m) "));
/* Use fixed block size to simplify read back */
min_block_size = dev->min_block_size;
dev->min_block_size = dev->max_block_size;
+ write_eof = dev->max_file_size / REC_SIZE; /*compute when we add EOF*/
set_volume_name("TestVolume1", 1);
dir_ask_sysop_to_create_appendable_volume(dcr);
dev->set_append(); /* force volume to be relabeled */
memset(&rec, 0, sizeof(rec));
rec.data = get_memory(100000); /* max record size */
-
-#define REC_SIZE 32768
rec.data_len = REC_SIZE;
/*
/* Mix up the data just a bit */
uint32_t *lp = (uint32_t *)rec.data;
lp[0] += lp[13];
- for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) {
- lp[i] += lp[i-1];
+ for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i+=100) {
+ lp[i] += lp[0];
}
Dmsg4(250, "before write_rec FI=%d SessId=%d Strm=%s len=%d\n",
block->BlockNumber, dev->file, dev->block_num,
edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), (float)kbs);
}
- /* Every 32000 blocks (approx 2GB) write an EOF.
+ /* Every X blocks (dev->max_file_size) write an EOF.
*/
- if ((block->BlockNumber % 32000) == 0) {
+ if ((block->BlockNumber % write_eof) == 0) {
now = time(NULL);
(void)localtime_r(&now, &tm);
strftime(buf1, sizeof(buf1), "%H:%M:%S", &tm);
fflush(stdout);
}
p[0] += p[13];
- for (i=1; i<(block->buf_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) {
- p[i] += p[i-1];
+ for (i=1; i<(block->buf_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i+=100) {
+ p[i] += p[0];
}
continue;
}