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.
99 static void appldata_timer_function(unsigned long data) in appldata_timer_function() argument
101 queue_work(appldata_wq, (struct work_struct *) data); in appldata_timer_function()
107 * call data gathering function for each (active) module
117 if (ops->active == 1) { in appldata_work_fn()
118 ops->callback(ops->data); in appldata_work_fn()
146 rc = -ENOMEM; in appldata_diag()
148 id->record_nr = record_nr; in appldata_diag()
149 id->mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; in appldata_diag()
200 * Start/Stop timer, show status of timer (0 = not active, 1 = active)
209 .procname = ctl->procname, in appldata_timer_handler()
210 .data = &timer_active, in appldata_timer_handler()
232 * Set (CPU) timer interval for collection of data (in milliseconds), show
242 .procname = ctl->procname, in appldata_interval_handler()
243 .data = &interval, in appldata_interval_handler()
272 int active; in appldata_generic_handler() local
274 .data = &active, in appldata_generic_handler()
284 if (&tmp_ops->ctl_table[0] == ctl) { in appldata_generic_handler()
290 return -ENODEV; in appldata_generic_handler()
292 ops = ctl->data; in appldata_generic_handler()
293 if (!try_module_get(ops->owner)) { // protect this function in appldata_generic_handler()
295 return -ENODEV; in appldata_generic_handler()
299 active = ops->active; in appldata_generic_handler()
302 module_put(ops->owner); in appldata_generic_handler()
307 if (active && (ops->active == 0)) { in appldata_generic_handler()
309 if (!try_module_get(ops->owner)) { in appldata_generic_handler()
311 module_put(ops->owner); in appldata_generic_handler()
312 return -ENODEV; in appldata_generic_handler()
314 ops->callback(ops->data); // init record in appldata_generic_handler()
315 rc = appldata_diag(ops->record_nr, in appldata_generic_handler()
317 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
318 ops->mod_lvl); in appldata_generic_handler()
320 pr_err("Starting the data collection for %s " in appldata_generic_handler()
321 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
322 module_put(ops->owner); in appldata_generic_handler()
324 ops->active = 1; in appldata_generic_handler()
325 } else if (!active && (ops->active == 1)) { in appldata_generic_handler()
326 ops->active = 0; in appldata_generic_handler()
327 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_generic_handler()
328 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
329 ops->mod_lvl); in appldata_generic_handler()
331 pr_err("Stopping the data collection for %s " in appldata_generic_handler()
332 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
333 module_put(ops->owner); in appldata_generic_handler()
336 module_put(ops->owner); in appldata_generic_handler()
343 /************************* module-ops management *****************************/
351 if (ops->size > APPLDATA_MAX_REC_SIZE) in appldata_register_ops()
352 return -EINVAL; in appldata_register_ops()
355 ops->ctl_table = kcalloc(2, sizeof(struct ctl_table), GFP_KERNEL); in appldata_register_ops()
356 if (!ops->ctl_table) in appldata_register_ops()
357 return -ENOMEM; in appldata_register_ops()
360 list_add(&ops->list, &appldata_ops_list); in appldata_register_ops()
363 ops->ctl_table[0].procname = ops->name; in appldata_register_ops()
364 ops->ctl_table[0].mode = S_IRUGO | S_IWUSR; in appldata_register_ops()
365 ops->ctl_table[0].proc_handler = appldata_generic_handler; in appldata_register_ops()
366 ops->ctl_table[0].data = ops; in appldata_register_ops()
368 ops->sysctl_header = register_sysctl_sz(appldata_proc_name, ops->ctl_table, 1); in appldata_register_ops()
369 if (!ops->sysctl_header) in appldata_register_ops()
374 list_del(&ops->list); in appldata_register_ops()
376 kfree(ops->ctl_table); in appldata_register_ops()
377 return -ENOMEM; in appldata_register_ops()
388 list_del(&ops->list); in appldata_unregister_ops()
390 unregister_sysctl_table(ops->sysctl_header); in appldata_unregister_ops()
391 kfree(ops->ctl_table); in appldata_unregister_ops()
393 /********************** module-ops management <END> **************************/
407 appldata_timer.data = (unsigned long) &appldata_work; in appldata_init()
410 return -ENOMEM; in appldata_init()