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.
114 static void appldata_timer_function(unsigned long data) in appldata_timer_function() argument
116 queue_work(appldata_wq, (struct work_struct *) data); in appldata_timer_function()
122 * call data gathering function for each (active) module
132 if (ops->active == 1) { in appldata_work_fn()
133 ops->callback(ops->data); in appldata_work_fn()
161 rc = -ENOMEM; in appldata_diag()
163 id->record_nr = record_nr; in appldata_diag()
164 id->mod_lvl = (mod_lvl[0]) << 8 | mod_lvl[1]; in appldata_diag()
215 * Start/Stop timer, show status of timer (0 = not active, 1 = active)
224 .procname = ctl->procname, in appldata_timer_handler()
225 .data = &timer_active, in appldata_timer_handler()
247 * Set (CPU) timer interval for collection of data (in milliseconds), show
257 .procname = ctl->procname, in appldata_interval_handler()
258 .data = &interval, in appldata_interval_handler()
287 int active; in appldata_generic_handler() local
289 .data = &active, in appldata_generic_handler()
299 if (&tmp_ops->ctl_table[2] == ctl) { in appldata_generic_handler()
305 return -ENODEV; in appldata_generic_handler()
307 ops = ctl->data; in appldata_generic_handler()
308 if (!try_module_get(ops->owner)) { // protect this function in appldata_generic_handler()
310 return -ENODEV; in appldata_generic_handler()
314 active = ops->active; in appldata_generic_handler()
317 module_put(ops->owner); in appldata_generic_handler()
322 if (active && (ops->active == 0)) { in appldata_generic_handler()
324 if (!try_module_get(ops->owner)) { in appldata_generic_handler()
326 module_put(ops->owner); in appldata_generic_handler()
327 return -ENODEV; in appldata_generic_handler()
329 ops->callback(ops->data); // init record in appldata_generic_handler()
330 rc = appldata_diag(ops->record_nr, in appldata_generic_handler()
332 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
333 ops->mod_lvl); in appldata_generic_handler()
335 pr_err("Starting the data collection for %s " in appldata_generic_handler()
336 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
337 module_put(ops->owner); in appldata_generic_handler()
339 ops->active = 1; in appldata_generic_handler()
340 } else if (!active && (ops->active == 1)) { in appldata_generic_handler()
341 ops->active = 0; in appldata_generic_handler()
342 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_generic_handler()
343 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
344 ops->mod_lvl); in appldata_generic_handler()
346 pr_err("Stopping the data collection for %s " in appldata_generic_handler()
347 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
348 module_put(ops->owner); in appldata_generic_handler()
351 module_put(ops->owner); in appldata_generic_handler()
358 /************************* module-ops management *****************************/
366 if (ops->size > APPLDATA_MAX_REC_SIZE) in appldata_register_ops()
367 return -EINVAL; in appldata_register_ops()
369 ops->ctl_table = kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL); in appldata_register_ops()
370 if (!ops->ctl_table) in appldata_register_ops()
371 return -ENOMEM; in appldata_register_ops()
374 list_add(&ops->list, &appldata_ops_list); in appldata_register_ops()
377 ops->ctl_table[0].procname = appldata_proc_name; in appldata_register_ops()
378 ops->ctl_table[0].maxlen = 0; in appldata_register_ops()
379 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; in appldata_register_ops()
380 ops->ctl_table[0].child = &ops->ctl_table[2]; in appldata_register_ops()
382 ops->ctl_table[2].procname = ops->name; in appldata_register_ops()
383 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; in appldata_register_ops()
384 ops->ctl_table[2].proc_handler = appldata_generic_handler; in appldata_register_ops()
385 ops->ctl_table[2].data = ops; in appldata_register_ops()
387 ops->sysctl_header = register_sysctl_table(ops->ctl_table); in appldata_register_ops()
388 if (!ops->sysctl_header) in appldata_register_ops()
393 list_del(&ops->list); in appldata_register_ops()
395 kfree(ops->ctl_table); in appldata_register_ops()
396 return -ENOMEM; in appldata_register_ops()
407 list_del(&ops->list); in appldata_unregister_ops()
409 unregister_sysctl_table(ops->sysctl_header); in appldata_unregister_ops()
410 kfree(ops->ctl_table); in appldata_unregister_ops()
412 /********************** module-ops management <END> **************************/
432 if (ops->active == 1) { in appldata_freeze()
433 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_freeze()
434 (unsigned long) ops->data, ops->size, in appldata_freeze()
435 ops->mod_lvl); in appldata_freeze()
437 pr_err("Stopping the data collection for %s " in appldata_freeze()
438 "failed with rc=%d\n", ops->name, rc); in appldata_freeze()
461 if (ops->active == 1) { in appldata_restore()
462 ops->callback(ops->data); // init record in appldata_restore()
463 rc = appldata_diag(ops->record_nr, in appldata_restore()
465 (unsigned long) ops->data, ops->size, in appldata_restore()
466 ops->mod_lvl); in appldata_restore()
468 pr_err("Starting the data collection for %s " in appldata_restore()
469 "failed with rc=%d\n", ops->name, rc); in appldata_restore()
510 appldata_timer.data = (unsigned long) &appldata_work; in appldata_init()
516 appldata_pdev = platform_device_register_simple("appldata", -1, NULL, in appldata_init()
524 rc = -ENOMEM; in appldata_init()