static int oo_ioctl_debug_op(ci_private_t *priv, void *arg) { ci_debug_onload_op_t *op = arg; int rc; if( !ci_is_sysadmin() ) return -EPERM; switch( op->what ) { case __CI_DEBUG_OP_DUMP_INODE__: rc = efab_linux_dump_inode(op->u.fd); break; case __CI_DEBUG_OP_TRAMPOLINE__: rc = efab_linux_trampoline_debug(&op->u.tramp_debug); break; case __CI_DEBUG_OP_FDS_DUMP__: rc = efab_fds_dump(op->u.fds_dump_pid); break; case __CI_DEBUG_OP_DUMP_STACK__: rc = tcp_helper_dump_stack(op->u.dump_stack.stack_id, op->u.dump_stack.orphan_only, CI_USER_PTR_GET(op->u.dump_stack.user_buf), op->u.dump_stack.user_buf_len); break; case __CI_DEBUG_OP_KILL_STACK__: rc = tcp_helper_kill_stack_by_id(op->u.stack_id); break; default: rc = -EINVAL; break; } return rc; }
/**************************************************************************** * * open - create a new file descriptor and hang private state * ****************************************************************************/ static int ci_char_fop_open(struct inode *inode, struct file *filp) { ci_private_char_t *priv; EFCH_TRACE("%s:", __FUNCTION__); if ((priv = CI_ALLOC_OBJ(ci_private_char_t)) == NULL) return -ENOMEM; CI_ZERO(priv); /* priv->cpcp_vi = NULL; */ init_waitqueue_head(&priv->cpcp_poll_queue); ci_resource_table_ctor(&priv->rt, ci_is_sysadmin() ? CI_CAP_BAR | CI_CAP_PHYS | CI_CAP_DRV : 0); filp->private_data = (void*) priv; return 0; }