Lines Matching refs:ops
128 struct appldata_ops *ops; in appldata_work_fn() local
132 ops = list_entry(lh, struct appldata_ops, list); in appldata_work_fn()
133 if (ops->active == 1) { in appldata_work_fn()
134 ops->callback(ops->data); in appldata_work_fn()
275 struct appldata_ops *ops = NULL, *tmp_ops; in appldata_generic_handler() local
300 ops = ctl->data; in appldata_generic_handler()
301 if (!try_module_get(ops->owner)) { // protect this function in appldata_generic_handler()
307 active = ops->active; in appldata_generic_handler()
310 module_put(ops->owner); in appldata_generic_handler()
315 if (active && (ops->active == 0)) { in appldata_generic_handler()
317 if (!try_module_get(ops->owner)) { in appldata_generic_handler()
319 module_put(ops->owner); in appldata_generic_handler()
322 ops->callback(ops->data); // init record in appldata_generic_handler()
323 rc = appldata_diag(ops->record_nr, in appldata_generic_handler()
325 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
326 ops->mod_lvl); in appldata_generic_handler()
329 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
330 module_put(ops->owner); in appldata_generic_handler()
332 ops->active = 1; in appldata_generic_handler()
333 } else if (!active && (ops->active == 1)) { in appldata_generic_handler()
334 ops->active = 0; in appldata_generic_handler()
335 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_generic_handler()
336 (unsigned long) ops->data, ops->size, in appldata_generic_handler()
337 ops->mod_lvl); in appldata_generic_handler()
340 "failed with rc=%d\n", ops->name, rc); in appldata_generic_handler()
341 module_put(ops->owner); in appldata_generic_handler()
344 module_put(ops->owner); in appldata_generic_handler()
357 int appldata_register_ops(struct appldata_ops *ops) in appldata_register_ops() argument
359 if (ops->size > APPLDATA_MAX_REC_SIZE) in appldata_register_ops()
362 ops->ctl_table = kcalloc(4, sizeof(struct ctl_table), GFP_KERNEL); in appldata_register_ops()
363 if (!ops->ctl_table) in appldata_register_ops()
367 list_add(&ops->list, &appldata_ops_list); in appldata_register_ops()
370 ops->ctl_table[0].procname = appldata_proc_name; in appldata_register_ops()
371 ops->ctl_table[0].maxlen = 0; in appldata_register_ops()
372 ops->ctl_table[0].mode = S_IRUGO | S_IXUGO; in appldata_register_ops()
373 ops->ctl_table[0].child = &ops->ctl_table[2]; in appldata_register_ops()
375 ops->ctl_table[2].procname = ops->name; in appldata_register_ops()
376 ops->ctl_table[2].mode = S_IRUGO | S_IWUSR; in appldata_register_ops()
377 ops->ctl_table[2].proc_handler = appldata_generic_handler; in appldata_register_ops()
378 ops->ctl_table[2].data = ops; in appldata_register_ops()
380 ops->sysctl_header = register_sysctl_table(ops->ctl_table); in appldata_register_ops()
381 if (!ops->sysctl_header) in appldata_register_ops()
386 list_del(&ops->list); in appldata_register_ops()
388 kfree(ops->ctl_table); in appldata_register_ops()
397 void appldata_unregister_ops(struct appldata_ops *ops) in appldata_unregister_ops() argument
400 list_del(&ops->list); in appldata_unregister_ops()
402 unregister_sysctl_table(ops->sysctl_header); in appldata_unregister_ops()
403 kfree(ops->ctl_table); in appldata_unregister_ops()
411 struct appldata_ops *ops; in appldata_freeze() local
424 ops = list_entry(lh, struct appldata_ops, list); in appldata_freeze()
425 if (ops->active == 1) { in appldata_freeze()
426 rc = appldata_diag(ops->record_nr, APPLDATA_STOP_REC, in appldata_freeze()
427 (unsigned long) ops->data, ops->size, in appldata_freeze()
428 ops->mod_lvl); in appldata_freeze()
431 "failed with rc=%d\n", ops->name, rc); in appldata_freeze()
440 struct appldata_ops *ops; in appldata_restore() local
453 ops = list_entry(lh, struct appldata_ops, list); in appldata_restore()
454 if (ops->active == 1) { in appldata_restore()
455 ops->callback(ops->data); // init record in appldata_restore()
456 rc = appldata_diag(ops->record_nr, in appldata_restore()
458 (unsigned long) ops->data, ops->size, in appldata_restore()
459 ops->mod_lvl); in appldata_restore()
462 "failed with rc=%d\n", ops->name, rc); in appldata_restore()