Skip to content

Commit

Permalink
Move magic numbers into magic.h
Browse files Browse the repository at this point in the history
Move various magic-number definitions into magic.h.

Signed-off-by: Nick Black <[email protected]>
Acked-by: Pekka Enberg <[email protected]>
Cc: Al Viro <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Casey Schaufler <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dankamongmen authored and torvalds committed Sep 23, 2009
1 parent af91322 commit 1fd7317
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
3 changes: 1 addition & 2 deletions fs/devpts/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-
Expand Down
4 changes: 1 addition & 3 deletions fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@
#include <linux/statfs.h>
#include <linux/security.h>
#include <linux/ima.h>
#include <linux/magic.h>

#include <asm/uaccess.h>

/* some random number */
#define HUGETLBFS_MAGIC 0x958458f6

static const struct super_operations hugetlbfs_ops;
static const struct address_space_operations hugetlbfs_aops;
const struct file_operations hugetlbfs_file_operations;
Expand Down
5 changes: 5 additions & 0 deletions include/linux/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define SECURITYFS_MAGIC 0x73636673
#define SELINUX_MAGIC 0xf97cff8c
#define TMPFS_MAGIC 0x01021994
#define HUGETLBFS_MAGIC 0x958458f6 /* some random number */
#define SQUASHFS_MAGIC 0x73717368
#define EFS_SUPER_MAGIC 0x414A53
#define EXT2_SUPER_MAGIC 0xEF53
Expand Down Expand Up @@ -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__ */
3 changes: 1 addition & 2 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -235,8 +236,6 @@ int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr,
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)
Expand Down
8 changes: 1 addition & 7 deletions security/smack/smack_lsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1fd7317

Please sign in to comment.