Skip to content

Commit dea2903

Browse files
jtlaytonsmfrench
authored andcommitted
cifs: move superblock magic defitions to magic.h
Help userland apps to identify cifs and smb2 mounts. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 3ac5f2f commit dea2903

File tree

6 files changed

+11
-8
lines changed

6 files changed

+11
-8
lines changed

fs/cifs/cifsfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/random.h>
2727
#include <linux/uuid.h>
2828
#include <linux/xattr.h>
29+
#include <uapi/linux/magic.h>
2930
#include <net/ipv6.h>
3031
#include "cifsfs.h"
3132
#include "cifspdu.h"
@@ -202,7 +203,7 @@ cifs_read_super(struct super_block *sb)
202203
sb->s_time_max = ts.tv_sec;
203204
}
204205

205-
sb->s_magic = CIFS_MAGIC_NUMBER;
206+
sb->s_magic = CIFS_SUPER_MAGIC;
206207
sb->s_op = &cifs_super_ops;
207208
sb->s_xattr = cifs_xattr_handlers;
208209
rc = super_setup_bdi(sb);

fs/cifs/cifsglob.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "../smbfs_common/smb2pdu.h"
2525
#include "smb2pdu.h"
2626

27-
#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */
28-
2927
#define SMB_PATH_MAX 260
3028
#define CIFS_PORT 445
3129
#define RFC1001_PORT 139

fs/cifs/smb1ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/pagemap.h>
99
#include <linux/vfs.h>
10+
#include <uapi/linux/magic.h>
1011
#include "cifsglob.h"
1112
#include "cifsproto.h"
1213
#include "cifs_debug.h"
@@ -887,7 +888,7 @@ cifs_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
887888
{
888889
int rc = -EOPNOTSUPP;
889890

890-
buf->f_type = CIFS_MAGIC_NUMBER;
891+
buf->f_type = CIFS_SUPER_MAGIC;
891892

892893
/*
893894
* We could add a second check for a QFS Unix capability bit

fs/cifs/smb2glob.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#ifndef _SMB2_GLOB_H
1414
#define _SMB2_GLOB_H
1515

16-
#define SMB2_MAGIC_NUMBER 0xFE534D42
17-
1816
/*
1917
*****************************************************************
2018
* Constants go here

fs/cifs/smb2ops.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/sort.h>
1414
#include <crypto/aead.h>
1515
#include <linux/fiemap.h>
16+
#include <uapi/linux/magic.h>
1617
#include "cifsfs.h"
1718
#include "cifsglob.h"
1819
#include "smb2pdu.h"
@@ -2757,7 +2758,7 @@ smb2_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
27572758
goto qfs_exit;
27582759

27592760
rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base;
2760-
buf->f_type = SMB2_MAGIC_NUMBER;
2761+
buf->f_type = SMB2_SUPER_MAGIC;
27612762
info = (struct smb2_fs_full_size_info *)(
27622763
le16_to_cpu(rsp->OutputBufferOffset) + (char *)rsp);
27632764
rc = smb2_validate_iov(le16_to_cpu(rsp->OutputBufferOffset),
@@ -2799,7 +2800,7 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
27992800

28002801
rc = SMB311_posix_qfs_info(xid, tcon, fid.persistent_fid,
28012802
fid.volatile_fid, buf);
2802-
buf->f_type = SMB2_MAGIC_NUMBER;
2803+
buf->f_type = SMB2_SUPER_MAGIC;
28032804
SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
28042805
return rc;
28052806
}

include/uapi/linux/magic.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#define QNX6_SUPER_MAGIC 0x68191122 /* qnx6 fs detection */
5252
#define AFS_FS_MAGIC 0x6B414653
5353

54+
5455
#define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
5556
/* used by file system utilities that
5657
look at the superblock, etc. */
@@ -59,6 +60,9 @@
5960
#define REISER2FS_JR_SUPER_MAGIC_STRING "ReIsEr3Fs"
6061

6162
#define SMB_SUPER_MAGIC 0x517B
63+
#define CIFS_SUPER_MAGIC 0xFF534D42 /* the first four bytes of SMB PDUs */
64+
#define SMB2_SUPER_MAGIC 0xFE534D42
65+
6266
#define CGROUP_SUPER_MAGIC 0x27e0eb
6367
#define CGROUP2_SUPER_MAGIC 0x63677270
6468

0 commit comments

Comments
 (0)