return NULL;
}
- jobs->ojs_cntr_init_fn(job->js_stats);
+ jobs->ojs_cntr_init_fn(job->js_stats, 0);
memcpy(job->js_jobid, jobid, sizeof(job->js_jobid));
job->js_timestamp = ktime_get_real_seconds();
seq_printf(p, ", unit: %5s", cntr_header->lc_units);
if (cntr_header->lc_config & LPROCFS_CNTR_AVGMINMAX) {
- seq_printf(p, ", min:%8llu, max:%8llu,"
- " sum:%16llu",
+ seq_printf(p, ", min: %8llu, max: %8llu, sum: %16llu",
ret.lc_count ? ret.lc_min : 0,
ret.lc_count ? ret.lc_max : 0,
ret.lc_count ? ret.lc_sum : 0);
struct seq_file *seq;
int rc;
- rc = LPROCFS_ENTRY_CHECK(inode);
- if (rc < 0)
- return rc;
-
rc = seq_open(file, &lprocfs_jobstats_seq_sops);
if (rc)
return rc;
return lprocfs_seq_release(inode, file);
}
-static const struct file_operations lprocfs_jobstats_seq_fops = {
- .owner = THIS_MODULE,
- .open = lprocfs_jobstats_seq_open,
- .read = seq_read,
- .write = lprocfs_jobstats_seq_write,
- .llseek = seq_lseek,
- .release = lprocfs_jobstats_seq_release,
+static const struct proc_ops lprocfs_jobstats_seq_fops = {
+ PROC_OWNER(THIS_MODULE)
+ .proc_open = lprocfs_jobstats_seq_open,
+ .proc_read = seq_read,
+ .proc_write = lprocfs_jobstats_seq_write,
+ .proc_lseek = seq_lseek,
+ .proc_release = lprocfs_jobstats_seq_release,
};
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
RETURN(0);
}
EXPORT_SYMBOL(lprocfs_job_stats_init);
+#endif /* CONFIG_PROC_FS*/
-int lprocfs_job_interval_seq_show(struct seq_file *m, void *data)
+ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
{
- struct obd_device *obd = m->private;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct obd_job_stats *stats;
- if (obd == NULL)
- return -ENODEV;
-
stats = &obd->u.obt.obt_jobstats;
- seq_printf(m, "%d\n", stats->ojs_cleanup_interval);
- return 0;
+ return scnprintf(buf, PAGE_SIZE, "%d\n", stats->ojs_cleanup_interval);
}
-EXPORT_SYMBOL(lprocfs_job_interval_seq_show);
+EXPORT_SYMBOL(job_cleanup_interval_show);
-ssize_t
-lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
+ssize_t job_cleanup_interval_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
{
- struct obd_device *obd;
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
struct obd_job_stats *stats;
unsigned int val;
int rc;
- obd = ((struct seq_file *)file->private_data)->private;
- if (obd == NULL)
- return -ENODEV;
-
stats = &obd->u.obt.obt_jobstats;
- rc = kstrtouint_from_user(buffer, count, 0, &val);
+ rc = kstrtouint(buffer, 0, &val);
if (rc)
return rc;
lprocfs_job_cleanup(stats, stats->ojs_cleanup_interval);
return count;
}
-EXPORT_SYMBOL(lprocfs_job_interval_seq_write);
-#endif /* CONFIG_PROC_FS*/
+EXPORT_SYMBOL(job_cleanup_interval_store);