+
+
+static int can_proc_readlink(struct proc_dir_entry *ent, char *page)
+{
+ char *link_dest = (char*)ent->data;
+
+ strcpy(page, link_dest);
+ return strlen(link_dest);
+}
+
+
+
+/* This compatibility version of proc_symlink does not store local copy of destination */
+static inline struct proc_dir_entry *can_proc_symlink(const char *name,
+ struct proc_dir_entry *parent, const char *dest)
+{
+ struct proc_dir_entry *entry;
+
+
+ entry = can_create_proc_entry(name, S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO, parent);
+ if (entry == NULL)
+ return NULL;
+ entry->readlink_proc = can_proc_readlink;
+ entry->data = dest;
+ return entry;
+}
+
+#else /* Functions forwarded for kernel 2.4 and above */
+
+static inline struct proc_dir_entry * can_create_proc_entry(const char *name, mode_t mode,
+ struct proc_dir_entry *parent)
+{
+ return create_proc_entry(name, mode, parent);
+}
+
+
+/* This does not fully follow linux 2.4 and 2.6 prototype to simplify 2.2.x compatibility */
+/* The newer kernels use entry name instead of pointer to the entry */
+static int can_remove_proc_entry(struct proc_dir_entry *del, struct proc_dir_entry *parent)
+{
+ if(!del) return -ENODEV;
+ remove_proc_entry(del->name,parent);
+ return 0;
+}
+
+static inline struct proc_dir_entry *can_proc_symlink(const char *name,
+ struct proc_dir_entry *parent, const char *dest)
+{
+ return proc_symlink(name, parent, dest);
+}
+
+#endif /* Functions required for kernel 2.2 */