OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [net/] [ax25/] [sysctl_net_ax25.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* -*- linux-c -*-
2
 * sysctl_net_ax25.c: sysctl interface to net AX.25 subsystem.
3
 *
4
 * Begun April 1, 1996, Mike Shaver.
5
 * Added /proc/sys/net/ax25 directory entry (empty =) ). [MS]
6
 */
7
 
8
#include <linux/config.h>
9
#include <linux/mm.h>
10
#include <linux/sysctl.h>
11
#include <net/ax25.h>
12
 
13
static int min_ipdefmode[] = {0},        max_ipdefmode[] = {1};
14
static int min_axdefmode[] = {0},        max_axdefmode[] = {1};
15
static int min_backoff[] = {0},          max_backoff[] = {2};
16
static int min_conmode[] = {0},          max_conmode[] = {2};
17
static int min_window[] = {1},          max_window[] = {7};
18
static int min_ewindow[] = {1},         max_ewindow[] = {63};
19
static int min_t1[] = {1},              max_t1[] = {30 * HZ};
20
static int min_t2[] = {1},              max_t2[] = {20 * HZ};
21
static int min_t3[] = {0},               max_t3[] = {3600 * HZ};
22
static int min_idle[] = {0},             max_idle[] = {65535 * HZ};
23
static int min_n2[] = {1},              max_n2[] = {31};
24
static int min_paclen[] = {1},          max_paclen[] = {512};
25
static int min_proto[] = {0},            max_proto[] = {3};
26
static int min_ds_timeout[] = {0},       max_ds_timeout[] = {65535 * HZ};
27
 
28
static struct ctl_table_header *ax25_table_header;
29
 
30
static ctl_table *ax25_table;
31
static int ax25_table_size;
32
 
33
static ctl_table ax25_dir_table[] = {
34
        {NET_AX25, "ax25", NULL, 0, 0555, NULL},
35
        {0}
36
};
37
 
38
static ctl_table ax25_root_table[] = {
39
        {CTL_NET, "net", NULL, 0, 0555, ax25_dir_table},
40
        {0}
41
};
42
 
43
static const ctl_table ax25_param_table[] = {
44
        {NET_AX25_IP_DEFAULT_MODE, "ip_default_mode",
45
         NULL, sizeof(int), 0644, NULL,
46
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
47
         &min_ipdefmode, &max_ipdefmode},
48
        {NET_AX25_DEFAULT_MODE, "ax25_default_mode",
49
         NULL, sizeof(int), 0644, NULL,
50
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
51
         &min_axdefmode, &max_axdefmode},
52
        {NET_AX25_BACKOFF_TYPE, "backoff_type",
53
         NULL, sizeof(int), 0644, NULL,
54
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
55
         &min_backoff, &max_backoff},
56
        {NET_AX25_CONNECT_MODE, "connect_mode",
57
         NULL, sizeof(int), 0644, NULL,
58
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
59
         &min_conmode, &max_conmode},
60
        {NET_AX25_STANDARD_WINDOW, "standard_window_size",
61
         NULL, sizeof(int), 0644, NULL,
62
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
63
         &min_window, &max_window},
64
        {NET_AX25_EXTENDED_WINDOW, "extended_window_size",
65
         NULL, sizeof(int), 0644, NULL,
66
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
67
         &min_ewindow, &max_ewindow},
68
        {NET_AX25_T1_TIMEOUT, "t1_timeout",
69
         NULL, sizeof(int), 0644, NULL,
70
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
71
         &min_t1, &max_t1},
72
        {NET_AX25_T2_TIMEOUT, "t2_timeout",
73
         NULL, sizeof(int), 0644, NULL,
74
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
75
         &min_t2, &max_t2},
76
        {NET_AX25_T3_TIMEOUT, "t3_timeout",
77
         NULL, sizeof(int), 0644, NULL,
78
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
79
         &min_t3, &max_t3},
80
        {NET_AX25_IDLE_TIMEOUT, "idle_timeout",
81
         NULL, sizeof(int), 0644, NULL,
82
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
83
         &min_idle, &max_idle},
84
        {NET_AX25_N2, "maximum_retry_count",
85
         NULL, sizeof(int), 0644, NULL,
86
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
87
         &min_n2, &max_n2},
88
        {NET_AX25_PACLEN, "maximum_packet_length",
89
         NULL, sizeof(int), 0644, NULL,
90
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
91
         &min_paclen, &max_paclen},
92
        {NET_AX25_PROTOCOL, "protocol",
93
         NULL, sizeof(int), 0644, NULL,
94
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
95
         &min_proto, &max_proto},
96
        {NET_AX25_DAMA_SLAVE_TIMEOUT, "dama_slave_timeout",
97
         NULL, sizeof(int), 0644, NULL,
98
         &proc_dointvec_minmax, &sysctl_intvec, NULL,
99
         &min_ds_timeout, &max_ds_timeout},
100
        {0}      /* that's all, folks! */
101
};
102
 
103
void ax25_register_sysctl(void)
104
{
105
        ax25_dev *ax25_dev;
106
        int n, k;
107
 
108
        for (ax25_table_size = sizeof(ctl_table), ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next)
109
                ax25_table_size += sizeof(ctl_table);
110
 
111
        if ((ax25_table = kmalloc(ax25_table_size, GFP_ATOMIC)) == NULL)
112
                return;
113
 
114
        memset(ax25_table, 0x00, ax25_table_size);
115
 
116
        for (n = 0, ax25_dev = ax25_dev_list; ax25_dev != NULL; ax25_dev = ax25_dev->next) {
117
                ctl_table *child = kmalloc(sizeof(ax25_param_table), GFP_ATOMIC);
118
                if (!child) {
119
                        while (n--)
120
                                kfree(ax25_table[n].child);
121
                        kfree(ax25_table);
122
                        return;
123
                }
124
                memcpy(child, ax25_param_table, sizeof(ax25_param_table));
125
                ax25_table[n].child = ax25_dev->systable = child;
126
                ax25_table[n].ctl_name     = n + 1;
127
                ax25_table[n].procname     = ax25_dev->dev->name;
128
                ax25_table[n].mode         = 0555;
129
 
130
#ifndef CONFIG_AX25_DAMA_SLAVE
131
                /*
132
                 * We do not wish to have a representation of this parameter
133
                 * in /proc/sys/ when configured *not* to include the
134
                 * AX.25 DAMA slave code, do we?
135
                 */
136
 
137
                child[AX25_VALUES_DS_TIMEOUT].procname = NULL;
138
#endif
139
 
140
                child[AX25_MAX_VALUES].ctl_name = 0;     /* just in case... */
141
 
142
                for (k = 0; k < AX25_MAX_VALUES; k++)
143
                        child[k].data = &ax25_dev->values[k];
144
 
145
                n++;
146
        }
147
 
148
        ax25_dir_table[0].child = ax25_table;
149
 
150
        ax25_table_header = register_sysctl_table(ax25_root_table, 1);
151
}
152
 
153
void ax25_unregister_sysctl(void)
154
{
155
        ctl_table *p;
156
        unregister_sysctl_table(ax25_table_header);
157
 
158
        ax25_dir_table[0].child = NULL;
159
        for (p = ax25_table; p->ctl_name; p++)
160
                kfree(p->child);
161
        kfree(ax25_table);
162
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.