/*********************************************************************** F* Function: static int wd_ioctl(struct inode *node, struct file *filp, unsigned int cmd, unsigned long arg) P*A*Z* * P* Parameters: struct inode *inode P* - Passed by the kernel, inode of the device file being P* operated on P* struct file *file P* - Passed by the kernel, but not used P* unsigned int cmd P* - ioctl command number P* unsigned long arg P* - Pointer to arguments cast to unsigned long. P* The actual parameter depends on the command, see P* wd(4). P* P* Returnvalue: int P* - 0 => success P* <0 Errorcondition, which can be P* -EINTR the call was interrupted P* -EFAULT the pointer passed as arg is invalid P* -EINVAL a parameter was invalid * Z* Intention: This is the entry point for the ioctl() commands. Z* For a detailed description see the man-page wd(4). * D* Design: Haider / [email protected] C* Coding: Haider / [email protected] V* Verification: [email protected] / [email protected] ***********************************************************************/ static int wd_ioctl(struct inode *node, struct file *filp, unsigned int cmd, unsigned long arg) { wd_param_t param; int chainid; switch (cmd) { case WD_OPEN_ONLY: timeout_open_only = 1; break; case WD_ALWAYS: timeout_open_only = 0; break; case WD_REGISTER: if (copy_from_user(¶m, (void *)arg, sizeof(param))) return -EFAULT; return register_mon_chain(¶m, 1); case WD_RESET: if (copy_from_user(&chainid, (void *)arg, sizeof(chainid))) return -EFAULT; return wd_reset_mon_chain(chainid); case WD_UNREGISTER: if (copy_from_user(&chainid, (void *)arg, sizeof(chainid))) return -EFAULT; return wd_unregister_mon_chain(chainid); default: return -EINVAL; } return 0; }
/*********************************************************************** F* Function: int wdt_mpc8xx_register_mon_chain(wdt_mpc8xx_param_t *param) P*A*Z* * P* Parameters: wdt_mpc8xx_param_t *param P* P* Returnvalue: int P* - See description of register_mon_chain() * Z* Intention: This is only a wrapper function around register_mon_chain() Z* exported to the kernel name space. It only augments the Z* parameter with a flag informing register_mon_chain() that Z* it was called through this interface and not from a Z* user space program. * D* Design: [email protected] C* Coding: [email protected] V* Verification: [email protected] ***********************************************************************/ int wdt_mpc8xx_register_mon_chain(wdt_mpc8xx_param_t *param) { return(register_mon_chain(param, 0)); }
/*********************************************************************** F* Function: int wd_register_mon_chain(wd_param_t *param) P*A*Z* * P* Parameters: wd_param_t *param P* P* Returnvalue: int P* - See description of register_mon_chain() * Z* Intention: This is only a wrapper function around register_mon_chain() Z* exported to the kernel name space. It only augments the Z* parameter with a flag informing register_mon_chain() that Z* it was called through this interface and not from a Z* user space program. * D* Design: [email protected] C* Coding: [email protected] V* Verification: [email protected] ***********************************************************************/ int wd_register_mon_chain(wd_param_t *param) { return register_mon_chain(param, 0); }