aboutsummaryrefslogtreecommitdiffstats
path: root/kernel4/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel4/init.c')
-rw-r--r--kernel4/init.c95
1 files changed, 95 insertions, 0 deletions
diff --git a/kernel4/init.c b/kernel4/init.c
new file mode 100644
index 0000000..5ba6da4
--- /dev/null
+++ b/kernel4/init.c
@@ -0,0 +1,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