proc_symlink args

From: Paul Mackerras (paulus@linuxcare.com.au)
Date: Sat Jun 10 2000 - 06:59:18 EST


I suggest that the `dest' parameter to proc_symlink should be a const
char * rather than a char *. I have been using the patch below for a
while because it removes a warning for me. Looking at the code in
proc_symlink, the `dest' argument is only passed to strlen and used as
the source argument for strcpy, so it looks to me like it can safely
be marked as const char *.

Paul.

diff -urN official/fs/proc/generic.c linux/fs/proc/generic.c
--- official/fs/proc/generic.c Sat Jun 10 12:11:55 2000
+++ linux/fs/proc/generic.c Tue Jun 6 15:15:51 2000
@@ -403,7 +403,7 @@
 }
 
 struct proc_dir_entry *proc_symlink(const char *name,
- struct proc_dir_entry *parent, char *dest)
+ struct proc_dir_entry *parent, const char *dest)
 {
         struct proc_dir_entry *ent = NULL;
         const char *fn = name;
diff -urN official/include/linux/proc_fs.h linux/include/linux/proc_fs.h
--- official/include/linux/proc_fs.h Thu May 25 00:21:52 2000
+++ linux/include/linux/proc_fs.h Sat Jun 10 14:04:25 2000
@@ -127,7 +127,7 @@
 extern void proc_device_tree_init(void);
 
 extern struct proc_dir_entry *proc_symlink(const char *,
- struct proc_dir_entry *,char *);
+ struct proc_dir_entry *, const char *);
 extern struct proc_dir_entry *proc_mknod(const char *,mode_t,
                 struct proc_dir_entry *,kdev_t);
 extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);

-- 
Paul Mackerras, Senior Open Source Researcher, Linuxcare, Inc.
+61 2 6262 8990 tel, +61 2 6262 8991 fax
paulus@linuxcare.com.au, http://www.linuxcare.com.au/
Linuxcare.  Support for the revolution.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:21 EST