struct hlist_node js_hash; /* hash struct for this jobid */
struct list_head js_list; /* on ojs_list, with ojs_lock */
atomic_t js_refcount; /* num users of this struct */
- char js_jobid[LUSTRE_JOBID_SIZE]; /* job name */
+ char js_jobid[LUSTRE_JOBID_SIZE]; /* job name + NUL*/
time64_t js_timestamp; /* seconds of most recent stat*/
struct lprocfs_stats *js_stats; /* per-job statistics */
struct obd_job_stats *js_jobstats; /* for accessing ojs_lock */
jobs->ojs_cntr_init_fn(job->js_stats);
- memcpy(job->js_jobid, jobid, LUSTRE_JOBID_SIZE);
+ memcpy(job->js_jobid, jobid, sizeof(job->js_jobid));
job->js_timestamp = ktime_get_real_seconds();
job->js_jobstats = jobs;
INIT_HLIST_NODE(&job->js_hash);
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);