+/* as per http://www.tldp.org/LDP/lkmpg/2.4/html/c577.htm
+ the declaration of write in the file_operations struct reads:
+ ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
+*/
+ssize_t procfile_write(struct file *file, const char *buffer, size_t count, loff_t *data) {
+ if (!once_only) {
+ once_only=1;
+ if (init_probes()==-1)
+ printk(KERN_CRIT "Could not install procprotect probes. Reload module to retry.");
+ else
+ printk(KERN_CRIT "Activated transforward module");
+ }
+ return count;
+}
+static const struct file_operations transforward_fops = {
+ .owner = THIS_MODULE,
+ .write = procfile_write
+};
+
+static int __init transforward_init(void)
+{
+ int ret = 0;
+ printk("Transforward: starting transforward version %s.\n",
+ VERSION_STR);
+
+ proc_entry = proc_create("transforward", 0644, NULL, &transforward_fops);
+ return ret;
+}
+