/* fwioctl.c */ #include #include extern struct fwlrtype logrec[MAX_LOG]; extern int nextin; extern int nextout; extern int time_to_live; extern int pfx_length; /**/ /* Character device open entry point */ int fw_open( struct inode *inode, struct file *fp) { return(0); } /**/ /* Character device release */ int fw_release( struct inode *inode, struct file *fp) { return(0); } /**/ /* Character device ioctl entry point */ int fw_ioctl( struct inode *inode, struct file *fp, unsigned int func_code, unsigned long arg) { unsigned int *word; int rc; word = (unsigned int *)arg; printk("Ioctl called \n"); switch(func_code) { case FW_DUMPLOG: rc = verify_area(VERIFY_WRITE, (char *)word, nextin * sizeof(struct fwlrtype)); if (rc) { printk("Verify area returned %d \n", rc); return(rc); } copy_to_user(word, logrec, nextin * sizeof(struct fwlrtype)); return(nextin); break; case FW_CLEARLOG: nextin = 0; break; case FW_SET_TTL: get_user(time_to_live, word); break; case FW_SET_PFX: get_user(pfx_length, word); default:; } return(0); }