+ printk(KERN_DEBUG "%s\n", line);
+ }
+}
+
+/*************************************************************
+ * Compressor module interface
+ *************************************************************/
+
+struct compressor_link {
+ struct compressor_link *next;
+ struct compressor *comp;
+};
+
+static struct compressor_link *ppp_compressors = (struct compressor_link *) 0;
+
+static struct compressor *find_compressor (int type)
+{
+ struct compressor_link *lnk;
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+
+ lnk = ppp_compressors;
+ while (lnk != (struct compressor_link *) 0) {
+ if ((int) (__u8) lnk->comp->compress_proto == type) {
+ restore_flags(flags);
+ return lnk->comp;
+ }
+ lnk = lnk->next;
+ }
+
+ restore_flags(flags);
+ return (struct compressor *) 0;
+}
+
+static int ppp_register_compressor (struct compressor *cp)
+{
+ struct compressor_link *new;
+ unsigned long flags;
+
+ new = (struct compressor_link *)
+ kmalloc (sizeof (struct compressor_link), GFP_KERNEL);
+
+ if (new == (struct compressor_link *) 0)
+ return 1;
+
+ save_flags(flags);
+ cli();
+
+ if (find_compressor (cp->compress_proto)) {
+ restore_flags(flags);
+ kfree (new);
+ return 0;
+ }
+
+ new->next = ppp_compressors;
+ new->comp = cp;
+ ppp_compressors = new;
+
+ restore_flags(flags);
+ return 0;
+}
+
+static void ppp_unregister_compressor (struct compressor *cp)
+{
+ struct compressor_link *prev = (struct compressor_link *) 0;
+ struct compressor_link *lnk;
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+
+ lnk = ppp_compressors;
+ while (lnk != (struct compressor_link *) 0) {
+ if (lnk->comp == cp) {
+ if (prev)
+ prev->next = lnk->next;
+ else
+ ppp_compressors = lnk->next;
+ kfree (lnk);
+ break;
+ }
+ prev = lnk;
+ lnk = lnk->next;
+ }
+ restore_flags(flags);
+}
+
+/*************************************************************
+ * Module support routines
+ *************************************************************/
+
+#ifdef MODULE
+int
+init_module(void)
+{
+ int status;
+
+ /* register our line disciplines */
+ status = ppp_first_time();
+ if (status != 0)
+ printk(KERN_INFO "PPP: ppp_init() failure %d\n", status);
+#if LINUX_VERSION_CODE < VERSION(2,1,18)
+ else
+ (void) register_symtab (&ppp_syms);
+#endif
+
+ return status;
+}
+
+void
+cleanup_module(void)
+{
+ int status;
+ struct ppp *ppp, *next_ppp;
+ int busy = 0;
+
+ /*
+ * Ensure that the devices are not in operation.
+ */
+ for (ppp = ppp_list; ppp != 0; ppp = ppp->next) {
+ CHECK_PPP_MAGIC(ppp);
+ if (ppp->inuse || (ppp->dev.flags & IFF_UP))
+ ++busy;
+ }
+ if (busy)
+ printk(KERN_CRIT "PPP: removing despite %d units in use!\n",
+ busy);
+
+ /*
+ * Release the tty registration of the line discipline so that
+ * ttys can no longer be put into PPP line discipline.
+ */
+ status = tty_register_ldisc (N_PPP, NULL);
+ if (status != 0)
+ printk(KERN_ERR
+ "PPP: Unable to unregister ppp line discipline "
+ "(err = %d)\n", status);
+ else
+ printk(KERN_INFO
+ "PPP: ppp line discipline successfully unregistered\n");
+
+ /*
+ * De-register the devices so that there is no problem with them
+ */
+ for (ppp = ppp_list; ppp != 0; ppp = next_ppp) {
+ next_ppp = ppp->next;
+ unregister_netdev(&ppp->dev);
+ kfree (ppp);