1 /* sysctl.c: Rx RPC control 2 * 3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version 9 * 2 of the License, or (at your option) any later version. 10 */ 11 12 #include <linux/config.h> 13 #include <linux/sched.h> 14 #include <linux/slab.h> 15 #include <linux/module.h> 16 #include <linux/sysctl.h> 17 #include <rxrpc/types.h> 18 #include <rxrpc/rxrpc.h> 19 #include <asm/errno.h> 20 #include "internal.h" 21 22 int rxrpc_ktrace; 23 int rxrpc_kdebug; 24 int rxrpc_kproto; 25 int rxrpc_knet; 26 27 #ifdef CONFIG_SYSCTL 28 static struct ctl_table_header *rxrpc_sysctl = NULL; 29 30 static ctl_table rxrpc_sysctl_table[] = { 31 { 32 .ctl_name = 1, 33 .procname = "kdebug", 34 .data = &rxrpc_kdebug, 35 .maxlen = sizeof(int), 36 .mode = 0644, 37 .proc_handler = &proc_dointvec 38 }, 39 { 40 .ctl_name = 2, 41 .procname = "ktrace", 42 .data = &rxrpc_ktrace, 43 .maxlen = sizeof(int), 44 .mode = 0644, 45 .proc_handler = &proc_dointvec 46 }, 47 { 48 .ctl_name = 3, 49 .procname = "kproto", 50 .data = &rxrpc_kproto, 51 .maxlen = sizeof(int), 52 .mode = 0644, 53 .proc_handler = &proc_dointvec 54 }, 55 { 56 .ctl_name = 4, 57 .procname = "knet", 58 .data = &rxrpc_knet, 59 .maxlen = sizeof(int), 60 .mode = 0644, 61 .proc_handler = &proc_dointvec 62 }, 63 { 64 .ctl_name = 5, 65 .procname = "peertimo", 66 .data = &rxrpc_peer_timeout, 67 .maxlen = sizeof(unsigned long), 68 .mode = 0644, 69 .proc_handler = &proc_doulongvec_minmax 70 }, 71 { 72 .ctl_name = 6, 73 .procname = "conntimo", 74 .data = &rxrpc_conn_timeout, 75 .maxlen = sizeof(unsigned long), 76 .mode = 0644, 77 .proc_handler = &proc_doulongvec_minmax 78 }, 79 { .ctl_name = 0 } 80 }; 81 82 static ctl_table rxrpc_dir_sysctl_table[] = { 83 { 84 .ctl_name = 1, 85 .procname = "rxrpc", 86 .maxlen = 0, 87 .mode = 0555, 88 .child = rxrpc_sysctl_table 89 }, 90 { .ctl_name = 0 } 91 }; 92 #endif /* CONFIG_SYSCTL */ 93 94 /*****************************************************************************/ 95 /* 96 * initialise the sysctl stuff for Rx RPC 97 */ 98 int rxrpc_sysctl_init(void) 99 { 100 #ifdef CONFIG_SYSCTL 101 rxrpc_sysctl = register_sysctl_table(rxrpc_dir_sysctl_table, 0); 102 if (!rxrpc_sysctl) 103 return -ENOMEM; 104 #endif /* CONFIG_SYSCTL */ 105 106 return 0; 107 } /* end rxrpc_sysctl_init() */ 108 109 /*****************************************************************************/ 110 /* 111 * clean up the sysctl stuff for Rx RPC 112 */ 113 void rxrpc_sysctl_cleanup(void) 114 { 115 #ifdef CONFIG_SYSCTL 116 if (rxrpc_sysctl) { 117 unregister_sysctl_table(rxrpc_sysctl); 118 rxrpc_sysctl = NULL; 119 } 120 #endif /* CONFIG_SYSCTL */ 121 122 } /* end rxrpc_sysctl_cleanup() */ 123