2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 * Linux module support routines.
14 #include <afsconfig.h>
15 #include "afs/param.h"
17 #include <linux/module.h> /* early to avoid printf->printk mapping */
18 #include "afs/sysincludes.h"
19 #include "afsincludes.h"
20 #include "h/unistd.h" /* For syscall numbers. */
23 #ifdef AFS_AMD64_LINUX20_ENV
24 #include <asm/ia32_unistd.h>
26 #ifdef AFS_SPARC64_LINUX20_ENV
27 #include <linux/ioctl32.h>
30 #include <linux/proc_fs.h>
31 #include <linux/slab.h>
32 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
33 #include <linux/init.h>
34 #include <linux/sched.h>
35 #include <linux/kernel.h>
38 static unsigned long nfs_server_addr = 0;
39 #if defined(module_param) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
40 module_param(nfs_server_addr, long, 0);
42 MODULE_PARM(nfs_server_addr, "l");
44 MODULE_PARM_DESC(nfs_server_addr, "IP Address of NFS Server");
46 static char *this_cell = 0;
47 #if defined(module_param_array) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
48 module_param(this_cell, charp, 0);
50 MODULE_PARM(this_cell, "s");
52 MODULE_PARM_DESC(this_cell, "Local cell name");
54 #if defined(AFS_LINUX24_ENV)
55 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
56 DEFINE_MUTEX(afs_global_lock);
58 DECLARE_MUTEX(afs_global_lock);
60 struct proc_dir_entry *openafs_procfs;
62 struct semaphore afs_global_lock = MUTEX;
64 int afs_global_owner = 0;
66 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
74 #if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV)
81 err = osi_syscall_init();
84 #ifdef AFS_LINUX24_ENV
85 #if defined(EXPORTED_PROC_ROOT_FS)
86 openafs_procfs = proc_mkdir(PROC_FSDIRNAME, proc_root_fs);
88 sprintf(path, "fs/%s", PROC_FSDIRNAME);
89 openafs_procfs = proc_mkdir(path, NULL);
94 afspag_Init(htonl(nfs_server_addr));
96 afspag_SetPrimaryCell(this_cell);
101 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
109 #if !defined(EXPORTED_PROC_ROOT_FS) && defined(AFS_LINUX24_ENV)
114 osi_linux_free_afs_memory();
116 #ifdef AFS_LINUX24_ENV
118 #if defined(EXPORTED_PROC_ROOT_FS)
119 remove_proc_entry(PROC_FSDIRNAME, proc_root_fs);
121 sprintf(path, "fs/%s", PROC_FSDIRNAME);
122 remove_proc_entry(path, NULL);
128 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
129 MODULE_LICENSE("http://www.openafs.org/dl/license10.html");
130 module_init(afspag_init);
131 module_exit(afspag_cleanup);
134 #ifdef AFS_LINUX26_ENV
136 * These will never be called in the standalone PAG manager, because
137 * they are only referenced in afs_InitReq, and nothing calls that.
138 * However, we need to define them in order to resolve the reference,
139 * unless we want to move afs_InitReq out of afs_osi_pag.c.
141 int osi_linux_nfs_initreq(struct vrequest *av, AFS_UCRED *cr, int *code)
148 afs_nfsclient_reqhandler(struct afs_exporter *exporter,
150 afs_int32 host, afs_int32 *pagparam,
151 struct afs_exporter **outexporter)