return 0;
}
+#ifndef CONFIG_RBD_POLL
static inline int rbd_io_u_seen(struct io_u *io_u)
{
struct fio_rbd_iou *fri = io_u->engine_data;
return fri->io_seen;
}
+#endif
static void rbd_io_u_wait_complete(struct io_u *io_u)
{
static unsigned long long disp_io_iops[DDIR_RWDIR_CNT];
static struct timespec rate_prev_time, disp_prev_time;
+ void *je_rate = (void *) je->rate;
+ void *je_iops = (void *) je->iops;
+
if (!force) {
if (!(output_format & FIO_OUTPUT_NORMAL) &&
f_out == stdout)
if (write_bw_log && rate_time > bw_avg_time && !in_ramp_time(td)) {
calc_rate(unified_rw_rep, rate_time, io_bytes, rate_io_bytes,
- je->rate);
+ je_rate);
memcpy(&rate_prev_time, &now, sizeof(now));
add_agg_sample(sample_val(je->rate[DDIR_READ]), DDIR_READ, 0);
add_agg_sample(sample_val(je->rate[DDIR_WRITE]), DDIR_WRITE, 0);
if (!force && !eta_time_within_slack(disp_time))
return false;
- calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je->rate);
- calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je->iops);
+ calc_rate(unified_rw_rep, disp_time, io_bytes, disp_io_bytes, je_rate);
+ calc_iops(unified_rw_rep, disp_time, io_iops, disp_io_iops, je_iops);
memcpy(&disp_prev_time, &now, sizeof(now));
{
unsigned int len;
- len = strlen(string);
- if (len > sizeof(lexer_input_buffer) - 3)
- len = sizeof(lexer_input_buffer) - 3;
+ len = sizeof(lexer_input_buffer) - 3;
+ if (len > strlen(string))
+ len = strlen(string);
strncpy(lexer_input_buffer, string, len);
lexer_input_buffer[len] = '\0';
continue;
fm = calloc(1, sizeof(*fm));
- strncpy(fm->__base, buf, sizeof(fm->__base) - 1);
+ strncpy(fm->__base, buf, sizeof(fm->__base));
+ fm->__base[255] = '\0';
fm->base = basename(fm->__base);
fm->key = sb.st_dev;
flist_add(&fm->list, &list);
int recursed, int client_type)
{
unsigned int i;
- char fname[PATH_MAX];
+ char fname[PATH_MAX + 1];
int numjobs, file_alloced;
struct thread_options *o = &td->o;
char logname[PATH_MAX + 32];
strncpy(full_fn,
file, (ts - file) + 1);
strncpy(full_fn + (ts - file) + 1,
- filename, strlen(filename));
+ filename,
+ len - (ts - file) - 1);
full_fn[len - 1] = 0;
filename = full_fn;
}
memset(&p, 0, sizeof(p));
- strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE - 1);
- strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE - 1);
- strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE - 1);
+ strncpy(p.ts.name, ts->name, FIO_JOBNAME_SIZE);
+ p.ts.name[FIO_JOBNAME_SIZE - 1] = '\0';
+ strncpy(p.ts.verror, ts->verror, FIO_VERROR_SIZE);
+ p.ts.verror[FIO_VERROR_SIZE - 1] = '\0';
+ strncpy(p.ts.description, ts->description, FIO_JOBDESC_SIZE);
+ p.ts.description[FIO_JOBDESC_SIZE - 1] = '\0';
p.ts.error = cpu_to_le32(ts->error);
p.ts.thread_number = cpu_to_le32(ts->thread_number);