aboutsummaryrefslogtreecommitdiffstats
path: root/kernel4/init.c
blob: 5ba6da4f100378d32a89101bc4ca974022269e29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* -*- linux-c -*- --------------------------------------------------------- *
 *
 * linux/fs/autofs/init.c
 *
 *  Copyright 1997 Transmeta Corporation -- All Rights Reserved
 *
 * This file is part of the Linux kernel and is made available under
 * the terms of the GNU General Public License, version 2, or at your
 * option, any later version, incorporated herein by reference.
 *
 * ------------------------------------------------------------------------- */

#include <linux/module.h>
#include <linux/init.h>
#include "autofs_i.h"

/* Paranoia checks: we don't want to bloat every single inode in the kernel
   (and, to a lesser extent, every superblock).  If we've been frugal with
   space, this function should compile to nothing; otherwise it should cause
   a link failure */

extern inline void autofs_check_struct_sizes(void)
{
	extern void __autofs_sb_is_too_fscking_big(void);
	extern void __autofs_inode_is_too_fscking_big(void);

	if ( sizeof(struct autofs_sb_info) > sizeof(struct minix_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct ext2_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct hpfs_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct msdos_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct isofs_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct nfs_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct sysv_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct affs_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct ufs_sb_info) && 
	     sizeof(struct autofs_sb_info) > sizeof(struct romfs_sb_info) ) {
		__autofs_sb_is_too_fscking_big();
	}

	if ( sizeof(struct autofs_inode_info) > sizeof(struct pipe_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct minix_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct ext2_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct hpfs_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct msdos_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct umsdos_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct iso_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct nfs_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct sysv_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct affs_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct ufs_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct romfs_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct smb_inode_info) &&
	     sizeof(struct autofs_inode_info) > sizeof(struct socket) ) {
		__autofs_inode_is_too_fscking_big();
	}
}

static struct file_system_type autofs_fs_type = {
	"autofs4",
	0,
	autofs_read_super,
	NULL
};

#ifdef MODULE
int init_module(void)
{
	autofs_check_struct_sizes();
	return register_filesystem(&autofs_fs_type);
}

void cleanup_module(void)
{
	unregister_filesystem(&autofs_fs_type);
}

#else /* MODULE */

__initfunc(int init_autofs_fs(void))
{
	autofs_check_struct_sizes();
	return register_filesystem(&autofs_fs_type);
}

#endif /* !MODULE */

#ifdef DEBUG
void autofs_say(const char *name, int len)
{
	printk("(%d: ", len);
	while ( len-- )
		printk("%c", *name++);
	printk(")\n");
}
#endif