1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2%{
3#include <linux/magic.h>
4
5#include "filesystems.h"
6#include "missing_magic.h"
7#include "stat-util.h"
8
9struct FilesystemMagic {
10        const char *name;
11        statfs_f_type_t magic[FILESYSTEM_MAGIC_MAX];
12};
13%}
14struct FilesystemMagic;
15%language=ANSI-C
16%define hash-function-name filesystems_gperf_hash
17%define lookup-function-name filesystems_gperf_lookup
18%define slot-name name
19%readonly-tables
20%omit-struct-type
21%struct-type
22%includes
23%%
24apparmorfs,      {AAFS_MAGIC}
25adfs,            {ADFS_SUPER_MAGIC}
26affs,            {AFFS_SUPER_MAGIC}
27afs,             {AFS_FS_MAGIC, AFS_SUPER_MAGIC}
28anon_inodefs,    {ANON_INODE_FS_MAGIC}
29autofs,          {AUTOFS_SUPER_MAGIC}
30balloon-kvm,     {BALLOON_KVM_MAGIC}
31bdev,            {BDEVFS_MAGIC}
32binder,          {BINDERFS_SUPER_MAGIC}
33binfmt_misc,     {BINFMTFS_MAGIC}
34bpf,             {BPF_FS_MAGIC}
35btrfs,           {BTRFS_SUPER_MAGIC}
36btrfs_test_fs,   {BTRFS_TEST_MAGIC}
37# cpuset's magic got reassigned to cgroupfs
38cpuset,          {CGROUP_SUPER_MAGIC}
39ceph,            {CEPH_SUPER_MAGIC}
40cgroup2,         {CGROUP2_SUPER_MAGIC}
41# note that the cgroupfs magic got reassigned from cpuset
42cgroup,          {CGROUP_SUPER_MAGIC}
43cifs,            {CIFS_SUPER_MAGIC, SMB2_SUPER_MAGIC}
44coda,            {CODA_SUPER_MAGIC}
45configfs,        {CONFIGFS_MAGIC}
46cramfs,          {CRAMFS_MAGIC}
47dax,             {DAXFS_MAGIC}
48debugfs,         {DEBUGFS_MAGIC}
49devmem,          {DEVMEM_MAGIC}
50devpts,          {DEVPTS_SUPER_MAGIC}
51# devtmpfs is just a special instance of tmpfs, hence it reports its magic
52devtmpfs,        {TMPFS_MAGIC}
53dmabuf,          {DMA_BUF_MAGIC}
54ecryptfs,        {ECRYPTFS_SUPER_MAGIC}
55efivarfs,        {EFIVARFS_MAGIC}
56efs,             {EFS_SUPER_MAGIC}
57erofs,           {EROFS_SUPER_MAGIC_V1}
58# ext2 + ext3 + ext4 use the same magic
59ext2,            {EXT2_SUPER_MAGIC}
60ext3,            {EXT3_SUPER_MAGIC}
61ext4,            {EXT4_SUPER_MAGIC}
62exfat,           {EXFAT_SUPER_MAGIC}
63f2fs,            {F2FS_SUPER_MAGIC}
64# fuseblk is so closely related to fuse that it shares the same magic
65fuseblk,         {FUSE_SUPER_MAGIC}
66fuse,            {FUSE_SUPER_MAGIC}
67fusectl,         {FUSE_CTL_SUPER_MAGIC}
68# gfs is an old version of gfs2 and reuses the magic
69gfs,             {GFS2_MAGIC}
70gfs2,            {GFS2_MAGIC}
71hostfs,          {HOSTFS_SUPER_MAGIC}
72hpfs,            {HPFS_SUPER_MAGIC}
73hugetlbfs,       {HUGETLBFS_MAGIC}
74iso9660,         {ISOFS_SUPER_MAGIC}
75jffs2,           {JFFS2_SUPER_MAGIC}
76minix,           {MINIX_SUPER_MAGIC, MINIX_SUPER_MAGIC2, MINIX2_SUPER_MAGIC, MINIX2_SUPER_MAGIC2, MINIX3_SUPER_MAGIC}
77mqueue,          {MQUEUE_MAGIC}
78# msdos is an older legacy version of vfat, shares the magic
79msdos,           {MSDOS_SUPER_MAGIC}
80# ncp/ncpfs have been removed from the kernel, but ncpfs was the official name
81ncp,             {NCP_SUPER_MAGIC}
82ncpfs,           {NCP_SUPER_MAGIC}
83# nfs is the old version of nfs4, and they share the same magic
84nfs,             {NFS_SUPER_MAGIC}
85nfs4,            {NFS_SUPER_MAGIC}
86nilfs2,          {NILFS_SUPER_MAGIC}
87nsfs,            {NSFS_MAGIC}
88ntfs,            {NTFS_SB_MAGIC}
89ntfs3,           {NTFS3_SUPER_MAGIC}
90ocfs2,           {OCFS2_SUPER_MAGIC}
91openpromfs,      {OPENPROM_SUPER_MAGIC}
92orangefs,        {ORANGEFS_DEVREQ_MAGIC}
93overlay,         {OVERLAYFS_SUPER_MAGIC}
94pipefs,          {PIPEFS_MAGIC}
95ppc-cmm,         {PPC_CMM_MAGIC}
96proc,            {PROC_SUPER_MAGIC}
97pstore,          {PSTOREFS_MAGIC}
98# pvfs2 is the old version of orangefs
99pvfs2,           {ORANGEFS_DEVREQ_MAGIC}
100qnx4,            {QNX4_SUPER_MAGIC}
101qnx6,            {QNX6_SUPER_MAGIC}
102ramfs,           {RAMFS_MAGIC}
103resctrl,         {RDTGROUP_SUPER_MAGIC}
104reiserfs,        {REISERFS_SUPER_MAGIC}
105rpc_pipefs,      {RPC_PIPEFS_SUPER_MAGIC}
106secretmem,       {SECRETMEM_MAGIC}
107securityfs,      {SECURITYFS_MAGIC}
108selinuxfs,       {SELINUX_MAGIC}
109shiftfs,         {SHIFTFS_MAGIC}
110smackfs,         {SMACK_MAGIC}
111# smb3 is an alias for cifs
112smb3,            {CIFS_SUPER_MAGIC}
113# smbfs was removed from the kernel in 2010, the magic remains
114smbfs,           {SMB_SUPER_MAGIC}
115sockfs,          {SOCKFS_MAGIC}
116squashfs,        {SQUASHFS_MAGIC}
117sysfs,           {SYSFS_MAGIC}
118# note that devtmpfs shares the same magic with tmpfs, given it is just a special named instance of it.
119tmpfs,           {TMPFS_MAGIC}
120tracefs,         {TRACEFS_MAGIC}
121udf,             {UDF_SUPER_MAGIC}
122usbdevfs,        {USBDEVICE_SUPER_MAGIC}
123vboxsf,          {VBOXSF_SUPER_MAGIC}
124# note that msdos shares the same magic (and is the older version)
125vfat,            {MSDOS_SUPER_MAGIC}
126v9fs,            {V9FS_MAGIC}
127xenfs,           {XENFS_SUPER_MAGIC}
128xfs,             {XFS_SUPER_MAGIC}
129z3fold,          {Z3FOLD_MAGIC}
130zonefs,          {ZONEFS_MAGIC}
131zsmalloc,        {ZSMALLOC_MAGIC}
132