Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
staging
dgrp
dgrp_common.h
Go to the documentation of this file.
1
/*
2
*
3
* Copyright 1999 Digi International (www.digi.com)
4
* James Puzzo <jamesp at digi dot com>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
13
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
* PURPOSE. See the GNU General Public License for more details.
15
*
16
*/
17
18
#ifndef __DGRP_COMMON_H
19
#define __DGRP_COMMON_H
20
21
#define DIGI_VERSION "1.9-29"
22
23
#include <linux/fs.h>
24
#include <
linux/timer.h
>
25
#include "
drp.h
"
26
27
#define DGRP_TTIME 100
28
#define DGRP_RTIME 100
29
30
/************************************************************************
31
* All global storage allocation.
32
************************************************************************/
33
34
extern
int
dgrp_rawreadok
;
/* Allow raw writing of input */
35
extern
int
dgrp_register_cudevices
;
/* enable legacy cu devices */
36
extern
int
dgrp_register_prdevices
;
/* enable transparent print devices */
37
extern
int
dgrp_poll_tick
;
/* Poll interval - in ms */
38
39
extern
struct
list_head
nd_struct_list
;
40
41
struct
dgrp_poll_data
{
42
spinlock_t
poll_lock
;
43
struct
timer_list
timer
;
44
int
poll_tick
;
45
ulong
poll_round
;
/* Timer rouding factor */
46
long
node_active_count
;
47
};
48
49
extern
struct
dgrp_poll_data
dgrp_poll_data
;
50
extern
void
dgrp_poll_handler
(
unsigned
long
arg
);
51
52
/* from dgrp_mon_ops.c */
53
extern
void
dgrp_register_mon_hook
(
struct
proc_dir_entry
*de);
54
55
/* from dgrp_tty.c */
56
extern
int
dgrp_tty_init
(
struct
nd_struct
*nd);
57
extern
void
dgrp_tty_uninit
(
struct
nd_struct
*nd);
58
59
/* from dgrp_ports_ops.c */
60
extern
void
dgrp_register_ports_hook
(
struct
proc_dir_entry
*de);
61
62
/* from dgrp_net_ops.c */
63
extern
void
dgrp_register_net_hook
(
struct
proc_dir_entry
*de);
64
65
/* from dgrp_dpa_ops.c */
66
extern
void
dgrp_register_dpa_hook
(
struct
proc_dir_entry
*de);
67
extern
void
dgrp_dpa_data
(
struct
nd_struct
*,
int
,
u8
*,
int
);
68
69
/* from dgrp_sysfs.c */
70
extern
void
dgrp_create_class_sysfs_files
(
void
);
71
extern
void
dgrp_remove_class_sysfs_files
(
void
);
72
73
extern
void
dgrp_create_node_class_sysfs_files
(
struct
nd_struct
*nd);
74
extern
void
dgrp_remove_node_class_sysfs_files
(
struct
nd_struct
*nd);
75
76
extern
void
dgrp_create_tty_sysfs
(
struct
un_struct
*un,
struct
device
*
c
);
77
extern
void
dgrp_remove_tty_sysfs
(
struct
device
*
c
);
78
79
/* from dgrp_specproc.c */
80
/*
81
* The list of DGRP entries with r/w capabilities. These
82
* magic numbers are used for identification purposes.
83
*/
84
enum
{
85
DGRP_CONFIG
= 1,
/* Configure portservers */
86
DGRP_NETDIR
= 2,
/* Directory for "net" devices */
87
DGRP_MONDIR
= 3,
/* Directory for "mon" devices */
88
DGRP_PORTSDIR
= 4,
/* Directory for "ports" devices */
89
DGRP_INFO
= 5,
/* Get info. about the running module */
90
DGRP_NODEINFO
= 6,
/* Get info. about the configured nodes */
91
DGRP_DPADIR
= 7,
/* Directory for the "dpa" devices */
92
};
93
94
/*
95
* Directions for proc handlers
96
*/
97
enum
{
98
INBOUND
= 1,
/* Data being written to kernel */
99
OUTBOUND
= 2,
/* Data being read from the kernel */
100
};
101
121
struct
dgrp_proc_entry
{
122
int
id
;
/* Integer identifier */
123
const
char
*
name
;
/* ASCII identifier */
124
mode_t
mode
;
/* File access permissions */
125
struct
dgrp_proc_entry
*
child
;
/* Child pointer */
126
127
/* file ops to use, pass NULL to use default */
128
struct
file_operations
*
proc_file_ops
;
129
130
struct
proc_dir_entry
*
de
;
/* proc entry pointer */
131
struct
semaphore
excl_sem
;
/* Protects exclusive access var */
132
int
excl_cnt
;
/* Counts number of curr accesses */
133
};
134
135
extern
void
dgrp_unregister_proc
(
void
);
136
extern
void
dgrp_register_proc
(
void
);
137
138
/*-----------------------------------------------------------------------*
139
*
140
* Declarations for common operations:
141
*
142
* (either used by more than one of net, mon, or tty,
143
* or in interrupt context (i.e. the poller))
144
*
145
*-----------------------------------------------------------------------*/
146
147
void
dgrp_carrier
(
struct
ch_struct
*ch);
148
extern
int
dgrp_inode_permission
(
struct
inode
*
inode
,
int
op
);
149
extern
int
dgrp_chk_perm
(
int
mode
,
int
op
);
150
151
152
/*
153
* ID manipulation macros (where c1 & c2 are characters, i is
154
* a long integer, and s is a character array of at least three members
155
*/
156
157
static
inline
void
ID_TO_CHAR(
long
i
,
char
*
s
)
158
{
159
s[0] = ((i & 0xff00)>>8);
160
s[1] = (i & 0xff);
161
s[2] = 0;
162
}
163
164
static
inline
long
CHAR_TO_ID(
char
*
s
)
165
{
166
return
((s[0] & 0xff) << 8) | (s[1] & 0xff);
167
}
168
169
static
inline
struct
nd_struct
*nd_struct_get(
long
major)
170
{
171
struct
nd_struct
*nd;
172
173
list_for_each_entry
(nd, &
nd_struct_list
,
list
) {
174
if
(major == nd->
nd_major
)
175
return
nd;
176
}
177
178
return
NULL
;
179
}
180
181
static
inline
int
nd_struct_add(
struct
nd_struct
*
entry
)
182
{
183
struct
nd_struct
*
ptr
;
184
185
ptr = nd_struct_get(entry->
nd_major
);
186
187
if
(ptr)
188
return
-
EBUSY
;
189
190
list_add_tail
(&entry->
list
, &
nd_struct_list
);
191
192
return
0;
193
}
194
195
static
inline
int
nd_struct_del(
struct
nd_struct
*entry)
196
{
197
struct
nd_struct
*nd;
198
199
nd = nd_struct_get(entry->
nd_major
);
200
201
if
(!nd)
202
return
-
ENODEV
;
203
204
list_del
(&nd->
list
);
205
return
0;
206
}
207
208
#endif
/* __DGRP_COMMON_H */
Generated on Thu Jan 10 2013 14:28:08 for Linux Kernel by
1.8.2