Lines Matching +full:data +full:- +full:active
1 // SPDX-License-Identifier: GPL-2.0
3 * Base infrastructure for Linux-z/VM Monitor Stream, Stage 1.
5 * data gathering modules.
98 static void appldata_timer_function(unsigned long data) in appldata_timer_function() argument
100 queue_work(appldata_wq, (struct work_struct *) data); in appldata_timer_function()
106 * call data gathering function for each (active) module
116 if (ops->active == 1) { in appldata_work_fn()
117 ops->callback(ops->data); in appldata_work_fn()
145 rc = -ENOMEM; in appldata_diag()
147 id->record_nr = record_nr; in appldata_diag()
148 id->mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; in appldata_diag()
199 * Start/Stop timer, show status of timer (0 = not active, 1 = active)
208 .procname = ctl->procname, in appldata_timer_handler()
209 .data = &timer_active, in appldata_timer_handler()
231 * Set (CPU) timer interval for collection of data (in milliseconds), show
241 .procname = ctl->procname, in appldata_interval_handler()
242 .data = &interval, in appldata_interval_handler()
271 int active; in appldata_generic_handler() local
273 .data = &active, in appldata_generic_handler()
283 if (&tmp_ops->ctl_table[0] == ctl) { in appldata_generic_handler()
289 return -ENODEV; in appldata_generic_handler()
291 ops = ctl->data; in appldata_generic_handler()
292 if (!try_module_get(ops->owner)) { // protect this function in appldata_generic_handler()
294 return -ENODEV; in appldata_generic_handler()
298 active = ops->active; in appldata_generic_handler()
301 module_put(ops->owner); in appldata_generic_handler()
306 if (active && (ops->active == 0)) { in appldata_generic_handler()
308 if (!try_module_get(ops->owner)) { in appldata_generic_handler()
310 module_put(ops->owner); in appldata_generic_handler()
311 return -ENODEV; in appldata_generic_handler()
313 ops->callback(ops->data); // init record in appldata_generic_handler()
314 rc = appldata_diag(ops->record_nr, in appldata_generic_handler()
316 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
317 ops->mod_lvl); in appldata_generic_handler()
319 pr_err("Starting the data collection for %s " in appldata_generic_handler()
320 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
321 module_put(ops->owner); in appldata_generic_handler()
323 ops->active = 1; in appldata_generic_handler()
324 } else if (!active && (ops->active == 1)) { in appldata_generic_handler()
325 ops->active = 0; in appldata_generic_handler()
326 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_generic_handler()
327 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
328 ops->mod_lvl); in appldata_generic_handler()
330 pr_err("Stopping the data collection for %s " in appldata_generic_handler()
331 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
332 module_put(ops->owner); in appldata_generic_handler()
335 module_put(ops->owner); in appldata_generic_handler()
342 /************************* module-ops management *****************************/
350 if (ops->size > APPLDATA_MAX_REC_SIZE) in appldata_register_ops()
351 return -EINVAL; in appldata_register_ops()
353 ops->ctl_table = kcalloc(1, sizeof(struct ctl_table), GFP_KERNEL); in appldata_register_ops()
354 if (!ops->ctl_table) in appldata_register_ops()
355 return -ENOMEM; in appldata_register_ops()
358 list_add(&ops->list, &appldata_ops_list); in appldata_register_ops()
361 ops->ctl_table[0].procname = ops->name; in appldata_register_ops()
362 ops->ctl_table[0].mode = S_IRUGO | S_IWUSR; in appldata_register_ops()
363 ops->ctl_table[0].proc_handler = appldata_generic_handler; in appldata_register_ops()
364 ops->ctl_table[0].data = ops; in appldata_register_ops()
366 ops->sysctl_header = register_sysctl_sz(appldata_proc_name, ops->ctl_table, 1); in appldata_register_ops()
367 if (!ops->sysctl_header) in appldata_register_ops()
372 list_del(&ops->list); in appldata_register_ops()
374 kfree(ops->ctl_table); in appldata_register_ops()
375 return -ENOMEM; in appldata_register_ops()
386 list_del(&ops->list); in appldata_unregister_ops()
388 unregister_sysctl_table(ops->sysctl_header); in appldata_unregister_ops()
389 kfree(ops->ctl_table); in appldata_unregister_ops()
391 /********************** module-ops management <END> **************************/
405 appldata_timer.data = (unsigned long) &appldata_work; in appldata_init()
408 return -ENOMEM; in appldata_init()