[PATCH] janitorial/manpages: kill off duplication of constants

From: nick black
Date: Mon Jun 29 2009 - 09:33:35 EST


Seize back constants duplicated in smack_lsm.c, exporting them via
linux/magic.h. The removals expose no new interfaces, but moving
SOCKFD_MAGIC and DEVPTS_SUPER_MAGIC to magic.h does expose to userspace what
had not been previously exposed; I'm not sure this is desirable. If it is,
the statfs(2) man page ought probably be updated to reflect the change. If
not, #ifdef __KERNEL__ wrappers would work, but that might not be the best
choice.

Either way, the statfs(2) page references a DEVFS_SUPER_MAGIC [shudder],
which was, if memory serves, unceremoniously purged some time ago? There's
no instance of DEVFS_SUPER_MAGIC in 2.6.31-rc1. I'd be happy to send man
page patches in if that's desirable.

This is against 2.6.31-rc1. Thanks for feedback, Pekka Enberg!

--rigorously, nick

Signed-off-by: Nick Black <dank@xxxxxxxxx>
Acked-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
diff -uprN -X linux-2.6.31-rc1-pristine/Documentation/dontdiff linux-2.6.31-rc1-pristine/fs/devpts/inode.c linux-2.6.31-rc1/fs/devpts/inode.c
--- linux-2.6.31-rc1-pristine/fs/devpts/inode.c 2009-06-24 19:25:37.000000000 -0400
+++ linux-2.6.31-rc1/fs/devpts/inode.c 2009-06-29 08:56:14.000000000 -0400
@@ -18,14 +18,13 @@
#include <linux/mount.h>
#include <linux/tty.h>
#include <linux/mutex.h>
+#include <linux/magic.h>
#include <linux/idr.h>
#include <linux/devpts_fs.h>
#include <linux/parser.h>
#include <linux/fsnotify.h>
#include <linux/seq_file.h>

-#define DEVPTS_SUPER_MAGIC 0x1cd1
-
#define DEVPTS_DEFAULT_MODE 0600
/*
* ptmx is a new node in /dev/pts and will be unused in legacy (single-
diff -uprN -X linux-2.6.31-rc1-pristine/Documentation/dontdiff linux-2.6.31-rc1-pristine/include/linux/magic.h linux-2.6.31-rc1/include/linux/magic.h
--- linux-2.6.31-rc1-pristine/include/linux/magic.h 2009-06-24 19:25:37.000000000 -0400
+++ linux-2.6.31-rc1/include/linux/magic.h 2009-06-29 08:55:57.000000000 -0400
@@ -53,4 +54,8 @@
#define INOTIFYFS_SUPER_MAGIC 0x2BAD1DEA

#define STACK_END_MAGIC 0x57AC6E9D
+
+#define DEVPTS_SUPER_MAGIC 0x1cd1
+#define SOCKFS_MAGIC 0x534F434B
+
#endif /* __LINUX_MAGIC_H__ */
diff -uprN -X linux-2.6.31-rc1-pristine/Documentation/dontdiff linux-2.6.31-rc1-pristine/net/socket.c linux-2.6.31-rc1/net/socket.c
--- linux-2.6.31-rc1-pristine/net/socket.c 2009-06-24 19:25:37.000000000 -0400
+++ linux-2.6.31-rc1/net/socket.c 2009-06-29 08:55:49.000000000 -0400
@@ -86,6 +86,7 @@
#include <linux/audit.h>
#include <linux/wireless.h>
#include <linux/nsproxy.h>
+#include <linux/magic.h>

#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -235,8 +236,6 @@ int move_addr_to_user(struct sockaddr *k
return __put_user(klen, ulen);
}

-#define SOCKFS_MAGIC 0x534F434B
-
static struct kmem_cache *sock_inode_cachep __read_mostly;

static struct inode *sock_alloc_inode(struct super_block *sb)
diff -uprN -X linux-2.6.31-rc1-pristine/Documentation/dontdiff linux-2.6.31-rc1-pristine/security/smack/smack_lsm.c linux-2.6.31-rc1/security/smack/smack_lsm.c
--- linux-2.6.31-rc1-pristine/security/smack/smack_lsm.c 2009-06-24 19:25:37.000000000 -0400
+++ linux-2.6.31-rc1/security/smack/smack_lsm.c 2009-06-29 08:54:50.000000000 -0400
@@ -30,17 +30,11 @@
#include <net/netlabel.h>
#include <net/cipso_ipv4.h>
#include <linux/audit.h>
+#include <linux/magic.h>
#include "smack.h"

#define task_security(task) (task_cred_xxx((task), security))

-/*
- * I hope these are the hokeyist lines of code in the module. Casey.
- */
-#define DEVPTS_SUPER_MAGIC 0x1cd1
-#define SOCKFS_MAGIC 0x534F434B
-#define TMPFS_MAGIC 0x01021994
-
/**
* smk_fetch - Fetch the smack label from a file.
* @ip: a pointer to the inode

--
Nick Black <dankamongmen@xxxxxxx>
Principal Engineer, McAfee
Grad student, GT College of Computing
"np: the class of dashed hopes, and idle dreams..."

Attachment: signature.asc
Description: Digital signature