isdn-16
This commit is contained in:
parent
8e5fce4699
commit
894f4b987a
2
DOKU
2
DOKU
|
@ -603,7 +603,7 @@ Parameter:
|
||||||
Spezifisch für 1TR6 und CAPI:
|
Spezifisch für 1TR6 und CAPI:
|
||||||
:sv Dienstkennung; zwei Bytes in Hex. Telefon ist 0101 und 0102; DFÜ ist
|
:sv Dienstkennung; zwei Bytes in Hex. Telefon ist 0101 und 0102; DFÜ ist
|
||||||
07xx (xx ist üblicherweise 00).
|
07xx (xx ist üblicherweise 00).
|
||||||
:pv Semipermanente Verbindung bei abgehenden Rufen. (Noch nicht bei CAPI.)
|
:pv Semipermanente Verbindung bei abgehenden Rufen.
|
||||||
Ankommend werden SPVs automatisch unterstützt.
|
Ankommend werden SPVs automatisch unterstützt.
|
||||||
|
|
||||||
Spezifisch für Euro-ISDN:
|
Spezifisch für Euro-ISDN:
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
## =()<CARDS = @<CARDS>@>()=
|
## =()<CARDS = @<CARDS>@>()=
|
||||||
CARDS = ncp16 ncp teles bintec
|
CARDS = teles
|
||||||
## =()<PROTOCOLS = @<PROTOCOLS>@>()=
|
## =()<PROTOCOLS = @<PROTOCOLS>@>()=
|
||||||
PROTOCOLS = phone capi tei fixed
|
PROTOCOLS = phone tei
|
||||||
## =()<SUBPROTOCOLS = @<SUBPROTOCOLS>@>()=
|
## =()<SUBPROTOCOLS = @<SUBPROTOCOLS>@>()=
|
||||||
SUBPROTOCOLS = euro german
|
SUBPROTOCOLS = euro german
|
||||||
|
|
||||||
## =()<KERNELSRC := @<KERNELSRC>@>()=
|
## =()<KERNELSRC := @<KERNELSRC>@>()=
|
||||||
KERNELSRC := /usr/src/kernel/linux-test
|
KERNELSRC := /usr/src/linux
|
||||||
|
|
||||||
ifdef KERNEL
|
ifdef KERNEL
|
||||||
## =()<CC = @<CC>@>()=
|
## =()<CC = @<CC>@>()=
|
||||||
|
@ -37,7 +37,7 @@ LD = ld
|
||||||
## =()<LDFLAGS = @<LDFLAGS>@>()=
|
## =()<LDFLAGS = @<LDFLAGS>@>()=
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
## =()<RANLIB = @<RANLIB>@>()=
|
## =()<RANLIB = @<RANLIB>@>()=
|
||||||
RANLIB = ranlib
|
RANLIB = echo
|
||||||
## =()<STR_IF = str_@<STR_IF>@>()=
|
## =()<STR_IF = str_@<STR_IF>@>()=
|
||||||
STR_IF = str_linux
|
STR_IF = str_linux
|
||||||
## =()<SYS = @<SYS>@>()=
|
## =()<SYS = @<SYS>@>()=
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -6,6 +6,10 @@ SUBDIRS = config include tools compat streams support isdn_3 isdn_4 \
|
||||||
.PHONY: depend
|
.PHONY: depend
|
||||||
|
|
||||||
all:: .diddepend
|
all:: .diddepend
|
||||||
|
depend::
|
||||||
|
$(MAKE) -C compat depend
|
||||||
|
$(MAKE) -C streams depend
|
||||||
|
|
||||||
dep: depend
|
dep: depend
|
||||||
|
|
||||||
TOPDIR=.
|
TOPDIR=.
|
||||||
|
|
|
@ -776,6 +776,11 @@ bintec_mode (struct _isdn1_card * card, short channel, char mode, char listen)
|
||||||
if(channel > 0 && channel <= bp->card.nr_chans) {
|
if(channel > 0 && channel <= bp->card.nr_chans) {
|
||||||
DEBUG(info) printf("%sBINTEC: Chan%d %s<%d>%s\n",KERN_INFO ,channel,mode?"up":"down",mode,listen?" listen":"");
|
DEBUG(info) printf("%sBINTEC: Chan%d %s<%d>%s\n",KERN_INFO ,channel,mode?"up":"down",mode,listen?" listen":"");
|
||||||
bp->chan[channel].mode = mode;
|
bp->chan[channel].mode = mode;
|
||||||
|
if(mode == M_OFF) {
|
||||||
|
bp->chan[channel].appID = 0;
|
||||||
|
bp->chan[channel].PLCI = 0;
|
||||||
|
bp->chan[channel].NCCI = 0;
|
||||||
|
}
|
||||||
splx(ms);
|
splx(ms);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
##
|
||||||
|
## ISDN master configuration file for Linux.
|
||||||
|
## Note that if you leave a field blank, you must have the trailing tab!
|
||||||
|
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## System type.
|
||||||
|
##
|
||||||
|
#### =()<SYS @<SYS>@>()=
|
||||||
|
SYS linux
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Where to install everything. The programs are in bin-KERNELVERSION.
|
||||||
|
##
|
||||||
|
#### =()<DESTDIR @<DESTDIR>@>()=
|
||||||
|
DESTDIR /usr/local/isdn
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## What to name the lockfiles. Someting with %s (device name).
|
||||||
|
## Make sure "cu" and other UUCP utilities use the same convention!
|
||||||
|
##
|
||||||
|
#### =()<LOCKNAME @<LOCKNAME>@>()=
|
||||||
|
LOCKNAME /var/lock/LCK..%s
|
||||||
|
##
|
||||||
|
##
|
||||||
|
#### Path names
|
||||||
|
##
|
||||||
|
#### =()<ROUTE_PATH @<ROUTE_PATH>@>()=
|
||||||
|
ROUTE_PATH /sbin/route
|
||||||
|
##
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Card drivers to install. teles.
|
||||||
|
##
|
||||||
|
#### =()<CARDS @<CARDS>@>()=
|
||||||
|
CARDS teles
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Protocols to make. fixed phone tei.
|
||||||
|
##
|
||||||
|
#### =()<PROTOCOLS @<PROTOCOLS>@>()=
|
||||||
|
PROTOCOLS phone tei
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Subprotocols for "phone". euro german.
|
||||||
|
##
|
||||||
|
#### =()<SUBPROTOCOLS @<SUBPROTOCOLS>@>()=
|
||||||
|
SUBPROTOCOLS euro german
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Debugging? DO or DONT
|
||||||
|
##
|
||||||
|
#### =()<DEBUGGING @<DEBUGGING>@>()=
|
||||||
|
DEBUGGING DO
|
||||||
|
##
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Stuff to define
|
||||||
|
##
|
||||||
|
## Where's the Linux source?
|
||||||
|
##
|
||||||
|
#### =()<KERNELSRC @<KERNELSRC>@>()=
|
||||||
|
KERNELSRC /usr/src/linux
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## C compiler for the kernel
|
||||||
|
##
|
||||||
|
#### =()<CC @<CC>@>()=
|
||||||
|
CC gcc
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## C compiler for the utilities
|
||||||
|
##
|
||||||
|
#### =()<HOSTCC @<HOSTCC>@>()=
|
||||||
|
HOSTCC gcc
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## C flags for kernel modules. Needs -DMODULE -DKERNEL -D__KERNEL__.
|
||||||
|
##
|
||||||
|
#### =()<CFLAGS @<CFLAGS>@>()=
|
||||||
|
CFLAGS -g -O2 -Wall -fomit-frame-pointer -DKERNEL -D__KERNEL__ -DMODULE
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## C flags for programs
|
||||||
|
##
|
||||||
|
#### =()<HOSTCFLAGS @<HOSTCFLAGS>@>()=
|
||||||
|
HOSTCFLAGS -g -O2 -Wall
|
||||||
|
#CFLAGS -x c++ -g -O2 -W -Wreturn-type -Wshadow -Wcomment
|
||||||
|
#CFLAGS -g -W -Wreturn-type -Wshadow -Wcomment -D_BSD_SOURCE -D_SYSV_SOURCE
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Calling ld directly?
|
||||||
|
##
|
||||||
|
#### =()<LD @<LD>@>()=
|
||||||
|
LD ld
|
||||||
|
#LD /usr/i486-linuxaout/bin/ld -m i386linux
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Flags for the "cc -o" command line
|
||||||
|
##
|
||||||
|
#### =()<LDFLAGS @<LDFLAGS>@>()=
|
||||||
|
LDFLAGS
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## If you need to link in other libraries, add them here
|
||||||
|
##
|
||||||
|
#### =()<LIBS @<LIBS>@>()=
|
||||||
|
LIBS -lbsd
|
||||||
|
##
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## System dependent stuff below: don't change.
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## Byte order. Motorola 4321, Intel 1234.
|
||||||
|
#### =()<BYTEORDER @<BYTEORDER>@>()=
|
||||||
|
BYTEORDER 1234
|
||||||
|
##
|
||||||
|
## Ranlib needed ? "ranlib" or "echo"
|
||||||
|
#### =()<RANLIB @<RANLIB>@>()=
|
||||||
|
RANLIB echo
|
||||||
|
##
|
||||||
|
## Need strsave(3)? DO or DONT.
|
||||||
|
#### =()<NEED_STRDUP @<NEED_STRDUP>@>()=
|
||||||
|
NEED_STRDUP DONT
|
||||||
|
##
|
||||||
|
## Do you have setsid()?
|
||||||
|
#### =()<HAVE_SETSID @<HAVE_SETSID>@>()=
|
||||||
|
HAVE_SETSID DO
|
||||||
|
##
|
||||||
|
## How many arguments does your setpgrp() take? 0 or 2.
|
||||||
|
#### =()<HAVE_SETPGRP @<HAVE_SETPGRP>@>()=
|
||||||
|
HAVE_SETPGRP 0
|
||||||
|
|
||||||
|
## Does Streeams use signed or unsigned characters in its buffer?
|
||||||
|
#### =()<STREAMCHAR @<STREAMCHAR>@>()=
|
||||||
|
STREAMCHAR unsigned char
|
||||||
|
##
|
||||||
|
## Define only if building a kernel complains that there's no spl().
|
||||||
|
#### =()<NEED_SPL @<NEED_SPL>@>()=
|
||||||
|
NEED_SPL DONT
|
||||||
|
##
|
||||||
|
## signal functions' return type? Usually void or int.
|
||||||
|
#### =()<SIGRET @<SIGRET>@>()=
|
||||||
|
SIGRET void
|
||||||
|
##
|
||||||
|
## Need writev(3)? DO or DONT.
|
||||||
|
#### =()<NEED_WRITEV @<NEED_WRITEV>@>()=
|
||||||
|
NEED_WRITEV DONT
|
||||||
|
##
|
||||||
|
## Signal blocking? SYSV or BSD or NONE.
|
||||||
|
#### =()<SIGTYPE @<SIGTYPE>@>()=
|
||||||
|
SIGTYPE SYSV
|
||||||
|
##
|
||||||
|
## Define only if building a kernel complains that there's no memcpy.
|
||||||
|
#### =()<NEED_MEMCPY @<NEED_MEMCPY>@>()=
|
||||||
|
NEED_MEMCPY DONT
|
||||||
|
##
|
||||||
|
## Name of sys/termio.h (or sys/termios.h)
|
||||||
|
#### =()<TERMIO @<TERMIO>@>()=
|
||||||
|
TERMIO termios
|
||||||
|
##
|
||||||
|
## Name of /usr/include/strings.h
|
||||||
|
#### =()<STRINGS @<STRINGS>@>()=
|
||||||
|
STRINGS string
|
||||||
|
##
|
||||||
|
## What a minor number is called.
|
||||||
|
#### =()<SUBDEV @<SUBDEV>@>()=
|
||||||
|
SUBDEV uchar_t
|
||||||
|
##
|
||||||
|
## Streams <-> INet interface? "in" or "in2" or "str" or "linux" or "none"
|
||||||
|
## "in" is old BSD, "in2" is BSD 4.4, "str" is Streams-based
|
||||||
|
#### =()<STR_IF @<STR_IF>@>()=
|
||||||
|
STR_IF linux
|
||||||
|
##
|
||||||
|
## kernel timeout() funtion. OLD: untimeout takes first two args of timeout().
|
||||||
|
## NEW: untimeout takes return value of timeout().
|
||||||
|
#### =()<TIMEOUT @<TIMEOUT>@>()=
|
||||||
|
TIMEOUT NEW
|
||||||
|
##
|
||||||
|
## Streams XXXopen() -- does it get an additional "pointer to int" argument
|
||||||
|
## which points to the appropriate errno value?
|
||||||
|
#### =()<ADDERROR @<ADDERROR>@>()=
|
||||||
|
ADDERROR DONT
|
||||||
|
##
|
||||||
|
|
||||||
|
|
||||||
|
### ISDN configuration options
|
||||||
|
|
||||||
|
## One TEI per B channel? Seems to be required for US National-1.
|
||||||
|
## DO or DONT.
|
||||||
|
#### =()<MULTI_TEI @<MULTI_TEI>@>()=
|
||||||
|
MULTI_TEI DONT
|
||||||
|
##
|
||||||
|
##
|
||||||
|
## What to call protocol stuff. M_EXPROTO or (M_PROTO+0x40)
|
||||||
|
#### =()<MSG_PROTO @<MSG_PROTO>@>()=
|
||||||
|
MSG_PROTO M_EXPROTO
|
||||||
|
##
|
||||||
|
## What to call hopefully-expedited data stuff. M_EXDATA or (M_DATA+0x40).
|
||||||
|
#### =()<MSG_EXDATA @<MSG_EXDATA>@>()=
|
||||||
|
MSG_EXDATA M_EXDATA
|
||||||
|
##
|
||||||
|
## What to call normal data stuff. M_DATA
|
||||||
|
#### =()<MSG_DATA @<MSG_DATA>@>()=
|
||||||
|
MSG_DATA M_DATA
|
||||||
|
|
|
@ -173,7 +173,7 @@ typedef struct _isdn23_hdr {
|
||||||
|
|
||||||
} sel;
|
} sel;
|
||||||
}
|
}
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
|
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
|
||||||
__attribute__((packed))
|
__attribute__((packed))
|
||||||
#endif
|
#endif
|
||||||
*isdn23_hdr;
|
*isdn23_hdr;
|
||||||
|
|
|
@ -153,7 +153,7 @@ typedef struct _isdn3_talk { /* one per card's D channel connection */
|
||||||
** One struct isdn3_conn represents one ISDN call.
|
** One struct isdn3_conn represents one ISDN call.
|
||||||
**/
|
**/
|
||||||
#define STACK_LEN 10
|
#define STACK_LEN 10
|
||||||
#define NICONN 16
|
#define NICONN 18
|
||||||
#define NSCONN 3
|
#define NSCONN 3
|
||||||
|
|
||||||
typedef struct _isdn3_conn {
|
typedef struct _isdn3_conn {
|
||||||
|
|
169
isdn_3/capi.c
169
isdn_3/capi.c
|
@ -22,14 +22,14 @@
|
||||||
|
|
||||||
#define ST_pbx 2 /* Bits! */
|
#define ST_pbx 2 /* Bits! */
|
||||||
|
|
||||||
#if NITALK <=NBOARD+3
|
#if NITALK <=NBOARD+5
|
||||||
#error "Need NITALK > NBOARD+3"
|
#error "Need NITALK > NBOARD+5"
|
||||||
#endif
|
#endif
|
||||||
#define tappl talki
|
#define tappl talki
|
||||||
#define regnum talki[NBOARD+0] /* current interface I'm talking about */
|
#define regnum talki[NBOARD+0] /* current interface I'm talking about */
|
||||||
#define message_id talki[NBOARD+1] /* Expected msgid for current interface */
|
#define message_id talki[NBOARD+1] /* Expected msgid for current interface */
|
||||||
#define tstate talki[NBOARD+2] /* State of the current interface */
|
#define tstate talki[NBOARD+2] /* State of the current interface */
|
||||||
#define lasteaz talki[NBOARD+3] /* last EAZ we used up */
|
#define chanmask talki[NBOARD+3] /* channels we have used up */
|
||||||
|
|
||||||
#if NICONN <= 15
|
#if NICONN <= 15
|
||||||
#error "Need NICONN > 15"
|
#error "Need NICONN > 15"
|
||||||
|
@ -152,6 +152,25 @@ printf ("Conn CAPI:%d %05lx: State %d --> %d\n", deb_line, conn->call_ref, conn-
|
||||||
timer(CAPI_TFOO,conn);
|
timer(CAPI_TFOO,conn);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(state == 0 || state >= 20) {
|
||||||
|
if(conn->bchan != 0) {
|
||||||
|
conn->bchan = 0;
|
||||||
|
conn->talk->chanmask &=~ (1<<conn->bchan);
|
||||||
|
conn->minorstate &=~ MS_BCHAN;
|
||||||
|
/* XXX send a clearing msg down? */
|
||||||
|
}
|
||||||
|
} else if(conn->bchan == 0) {
|
||||||
|
int ch; unsigned long chm;
|
||||||
|
for(ch=1,chm = 1;chm; chm <<= 1, ch++)
|
||||||
|
if(!(conn->talk->chanmask & chm))
|
||||||
|
break;
|
||||||
|
if(chm) {
|
||||||
|
conn->bchan = ch;
|
||||||
|
conn->minorstate |= MS_BCHAN;
|
||||||
|
conn->talk->chanmask |= chm;
|
||||||
|
isdn3_setup_conn (conn, EST_NO_CHANGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ushort_t newmsgid(isdn3_talk talk)
|
static ushort_t newmsgid(isdn3_talk talk)
|
||||||
|
@ -267,11 +286,11 @@ send_setup(isdn3_conn conn)
|
||||||
bzero(dl,sizeof(*dl));
|
bzero(dl,sizeof(*dl));
|
||||||
bzero(c3,sizeof(*c3));
|
bzero(c3,sizeof(*c3));
|
||||||
|
|
||||||
c2->plci = conn->call_ref & 0xFFFF;
|
c2->plci = conn->call_ref;
|
||||||
c2->B2_proto = 0x02; /* transparent HDLC */
|
c2->B2_proto = 0x02; /* transparent HDLC */
|
||||||
c2->dlpdlen = sizeof(*dl);
|
c2->dlpdlen = sizeof(*dl);
|
||||||
dl->data_length = 4096;
|
dl->data_length = 4096;
|
||||||
c3->plci = conn->call_ref & 0xFFFF;
|
c3->plci = conn->call_ref;
|
||||||
c3->B3_proto = 0x04; /* transparent */
|
c3->B3_proto = 0x04; /* transparent */
|
||||||
err = capi_send(conn->talk,conn->call_ref >> 16, CAPI_SELECTB2_REQ, m2, conn->conni[WF_SELECTB2_CONF] = newmsgid(conn->talk));
|
err = capi_send(conn->talk,conn->call_ref >> 16, CAPI_SELECTB2_REQ, m2, conn->conni[WF_SELECTB2_CONF] = newmsgid(conn->talk));
|
||||||
if(err < 0) {
|
if(err < 0) {
|
||||||
|
@ -378,6 +397,7 @@ chstate (isdn3_talk talk, uchar_t ind, short add)
|
||||||
case DL_ESTABLISH_IND:
|
case DL_ESTABLISH_IND:
|
||||||
case DL_ESTABLISH_CONF:
|
case DL_ESTABLISH_CONF:
|
||||||
talk->regnum = 0;
|
talk->regnum = 0;
|
||||||
|
talk->state |= IS_UP;
|
||||||
{
|
{
|
||||||
isdn3_conn conn, nconn;
|
isdn3_conn conn, nconn;
|
||||||
for(conn = talk->conn; conn != NULL; conn = nconn) {
|
for(conn = talk->conn; conn != NULL; conn = nconn) {
|
||||||
|
@ -399,6 +419,7 @@ chstate (isdn3_talk talk, uchar_t ind, short add)
|
||||||
case PH_DISCONNECT_IND:
|
case PH_DISCONNECT_IND:
|
||||||
talk->regnum = 0;
|
talk->regnum = 0;
|
||||||
talk->tstate = STATE_BOOTING;
|
talk->tstate = STATE_BOOTING;
|
||||||
|
talk->state &=~ IS_UP;
|
||||||
{
|
{
|
||||||
isdn3_conn conn, nconn;
|
isdn3_conn conn, nconn;
|
||||||
for(conn = talk->conn; conn != NULL; conn = nconn) {
|
for(conn = talk->conn; conn != NULL; conn = nconn) {
|
||||||
|
@ -545,8 +566,10 @@ send_disconnect(isdn3_conn conn, char do_L3, ushort_t cause)
|
||||||
return 0;
|
return 0;
|
||||||
if(conn->state == 0)
|
if(conn->state == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
if((conn->state >= 20) && (cause == N1_LocalProcErr))
|
||||||
|
cause = 0;
|
||||||
conn->waitflags = 0;
|
conn->waitflags = 0;
|
||||||
report_terminate(conn,0,0);
|
report_terminate(conn,0,cause);
|
||||||
switch(conn->state) {
|
switch(conn->state) {
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
|
@ -623,21 +646,71 @@ send_dialout(isdn3_conn conn)
|
||||||
struct CAPI_connect_req *c2;
|
struct CAPI_connect_req *c2;
|
||||||
struct capi_info *info = conn->p_data;
|
struct capi_info *info = conn->p_data;
|
||||||
mblk_t *m2;
|
mblk_t *m2;
|
||||||
|
int llen = strlen(info->lnr);
|
||||||
|
|
||||||
if(info == NULL)
|
if(info == NULL)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
m2 = allocb(sizeof(*c2)+strlen(info->nr)+((info->flags & INF_SPV) != 0),BPRI_MED);
|
m2 = allocb(sizeof(*c2)+strlen(info->nr)+(llen ? llen+1 : 0)+((info->flags & INF_SPV) != 0),BPRI_MED);
|
||||||
|
|
||||||
if(m2 == NULL)
|
if(m2 == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
c2 = ((typeof(c2))m2->b_wptr++);
|
c2 = ((typeof(c2))m2->b_wptr)++;
|
||||||
bzero(c2,sizeof(*c2));
|
bzero(c2,sizeof(*c2));
|
||||||
c2->infomask = ~0;
|
c2->infomask = 0xC00000FF;
|
||||||
|
{ /* Find correct info mask */
|
||||||
|
int err; char skip = 0;
|
||||||
|
mblk_t *inf = conn->talk->card->info;
|
||||||
|
if(inf != NULL) {
|
||||||
|
streamchar *sta = inf->b_rptr;
|
||||||
|
ushort_t idx;
|
||||||
|
|
||||||
|
while(m_getid(inf,&idx) == 0) {
|
||||||
|
long sap;
|
||||||
|
switch(idx) {
|
||||||
|
case ARG_PROTOCOL:
|
||||||
|
if (m_geti(inf,&sap) == 0) {
|
||||||
|
skip = (sap != SAPI_CAPI);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ARG_SUBPROT:
|
||||||
|
if (m_geti(inf,&sap) == 0 && !skip) {
|
||||||
|
switch(sap) {
|
||||||
|
case SAPI_CAPI_BINTEC:
|
||||||
|
skip=0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* Wrong card. TODO: Do something! */
|
||||||
|
inf->b_rptr = sta;
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ARG_SUBCARD:
|
||||||
|
if (m_geti(inf,&sap) == 0 && !skip)
|
||||||
|
skip = (sap != info->subcard);
|
||||||
|
break;
|
||||||
|
case ARG_LISTEN:
|
||||||
|
{
|
||||||
|
long x;
|
||||||
|
if(skip)
|
||||||
|
break;
|
||||||
|
if((err = m_getx(inf,&x)) >= 0) {
|
||||||
|
if((err = m_getx(inf,&x)) >= 0) {
|
||||||
|
if((err = m_getx(inf,&x)) >= 0) {
|
||||||
|
c2->infomask = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inf->b_rptr = sta;
|
||||||
|
}
|
||||||
|
}
|
||||||
c2->channel = (info->bchan ? info->bchan : CAPI_ANYBCHANNEL);
|
c2->channel = (info->bchan ? info->bchan : CAPI_ANYBCHANNEL);
|
||||||
c2->DST_service = info->service >> 8;
|
c2->DST_service = info->service >> 8;
|
||||||
c2->DST_addinfo = info->service;
|
c2->DST_addinfo = info->service;
|
||||||
if(info->lnr[0] != '\0')
|
|
||||||
c2->SRC_eaz = info->lnr[strlen(info->lnr)-1];
|
|
||||||
c2->telnolen = strlen(info->nr);
|
c2->telnolen = strlen(info->nr);
|
||||||
strncpy(m2->b_wptr,info->nr,c2->telnolen);
|
strncpy(m2->b_wptr,info->nr,c2->telnolen);
|
||||||
m2->b_wptr += strlen(info->nr);
|
m2->b_wptr += strlen(info->nr);
|
||||||
|
@ -645,6 +718,18 @@ send_dialout(isdn3_conn conn)
|
||||||
c2->telnolen++;
|
c2->telnolen++;
|
||||||
*m2->b_wptr++ = 'S';
|
*m2->b_wptr++ = 'S';
|
||||||
}
|
}
|
||||||
|
if(llen > 0) && (conn->talk->state & (1<<(info->subcard+ST_pbx)))) {
|
||||||
|
c2->SRC_eaz = 0;
|
||||||
|
if(info->lnr[0] >= '0' && info->lnr[0] <= '9') {
|
||||||
|
memcpy(m2->b_wptr+1,info->lnr,llen);
|
||||||
|
} else {
|
||||||
|
llen--;
|
||||||
|
memcpy(m2->b_wptr+1,info->lnr+1,llen);
|
||||||
|
}
|
||||||
|
*m2->b_wptr = llen;
|
||||||
|
m2->b_wptr += llen+1;
|
||||||
|
} else if(llen > 0)
|
||||||
|
c2->SRC_eaz = info->lnr[llen-1];
|
||||||
conn->call_ref = conn->talk->tappl[info->subcard]<<16;
|
conn->call_ref = conn->talk->tappl[info->subcard]<<16;
|
||||||
if((err = capi_send(conn->talk,conn->talk->tappl[info->subcard],CAPI_CONNECT_REQ,m2,conn->conni[WF_CONNECT_CONF]=newmsgid(conn->talk))) < 0)
|
if((err = capi_send(conn->talk,conn->talk->tappl[info->subcard],CAPI_CONNECT_REQ,m2,conn->conni[WF_CONNECT_CONF]=newmsgid(conn->talk))) < 0)
|
||||||
freemsg(m2);
|
freemsg(m2);
|
||||||
|
@ -868,11 +953,9 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
report_terminate(conn,0,0);
|
report_terminate(conn,0,0);
|
||||||
setstate(conn,0);
|
setstate(conn,0);
|
||||||
}
|
}
|
||||||
} else {
|
} else if((c2->info != 0) || ((conn->state >= 21) && (conn->state < 99))) {
|
||||||
if((c2->info != 0) || (conn->state >= 21))
|
|
||||||
printf("CAPI error: DISCONNECT_IND in wrong state %d, info %04x\n",conn->state,c2->info);
|
printf("CAPI error: DISCONNECT_IND in wrong state %d, info %04x\n",conn->state,c2->info);
|
||||||
isdn3_setup_conn (conn, EST_DISCONNECT);
|
isdn3_setup_conn (conn, EST_DISCONNECT);
|
||||||
send_disconnect(conn,0,0);
|
|
||||||
report_terminate(conn,c2->info,0);
|
report_terminate(conn,c2->info,0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -930,6 +1013,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
c2 = ((typeof(c2))data->b_rptr)++;
|
c2 = ((typeof(c2))data->b_rptr)++;
|
||||||
if((c2->info == 0) && ((conn = capi_findconn(talk,capi->appl,c2->plci)) != NULL)) {
|
if((c2->info == 0) && ((conn = capi_findconn(talk,capi->appl,c2->plci)) != NULL)) {
|
||||||
printf("CAPI error: CONNECT_CONF has known cref %x%04x\n",capi->appl,c2->plci);
|
printf("CAPI error: CONNECT_CONF has known cref %x%04x\n",capi->appl,c2->plci);
|
||||||
|
report_terminate(conn,c2->info,0);
|
||||||
setstate(conn,0);
|
setstate(conn,0);
|
||||||
err = -ENXIO;
|
err = -ENXIO;
|
||||||
break;
|
break;
|
||||||
|
@ -1170,7 +1254,6 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
struct capi_info *info = conn->p_data;
|
struct capi_info *info = conn->p_data;
|
||||||
|
|
||||||
bzero(info,sizeof(*info));
|
bzero(info,sizeof(*info));
|
||||||
info->subcard = ~0;
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i < talk->card->dchans; i++) {
|
for(i=0;i < talk->card->dchans; i++) {
|
||||||
|
@ -1251,7 +1334,6 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bzero(conn->p_data,sizeof(struct capi_info));
|
bzero(conn->p_data,sizeof(struct capi_info));
|
||||||
((struct capi_info *)conn->p_data)->subcard = 0;
|
|
||||||
}
|
}
|
||||||
info = conn->p_data;
|
info = conn->p_data;
|
||||||
|
|
||||||
|
@ -1277,22 +1359,28 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AI_DAD:
|
case AI_DAD:
|
||||||
{
|
|
||||||
int nrlen = c2->infolen;
|
|
||||||
switch(*data->b_rptr) {
|
switch(*data->b_rptr) {
|
||||||
case 0x81:
|
case 0x81:
|
||||||
|
{
|
||||||
|
int nrlen = c2->infolen;
|
||||||
|
int haslen = strlen(info->lnr);
|
||||||
|
if(haslen == 0) {
|
||||||
|
haslen = 1;
|
||||||
|
info->lnr[0] = '/';
|
||||||
|
}
|
||||||
data->b_rptr++; nrlen--;
|
data->b_rptr++; nrlen--;
|
||||||
if(nrlen >= MAXNR)
|
if(nrlen >= MAXNR-haslen)
|
||||||
nrlen = MAXNR-1;
|
nrlen = MAXNR-haslen-1;
|
||||||
bcopy(data->b_rptr,info->lnr,nrlen);
|
bcopy(data->b_rptr,info->lnr+haslen,nrlen);
|
||||||
|
info->lnr[nrlen+1]='\0';
|
||||||
setstate(conn,7);
|
setstate(conn,7);
|
||||||
report_incoming(conn);
|
report_incoming(conn);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case AI_UUINFO:
|
case AI_UUINFO:
|
||||||
break;
|
break;
|
||||||
|
@ -1418,7 +1506,7 @@ recv (isdn3_talk talk, char isUI, mblk_t * data)
|
||||||
c2->info_mask = 0xC00000FF;
|
c2->info_mask = 0xC00000FF;
|
||||||
c2->eaz_mask = 0x03FF;
|
c2->eaz_mask = 0x03FF;
|
||||||
c2->service_mask = 0xE7BF;
|
c2->service_mask = 0xE7BF;
|
||||||
{ /* Find correct driver name */
|
{ /* Find correct masks */
|
||||||
int err; char skip = 0;
|
int err; char skip = 0;
|
||||||
mblk_t *info = talk->card->info;
|
mblk_t *info = talk->card->info;
|
||||||
if(info != NULL) {
|
if(info != NULL) {
|
||||||
|
@ -1745,6 +1833,7 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
||||||
} else
|
} else
|
||||||
send_disconnect(conn,0,N1_OutOfOrder);
|
send_disconnect(conn,0,N1_OutOfOrder);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case CMD_DIAL:
|
case CMD_DIAL:
|
||||||
{
|
{
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
|
@ -1757,31 +1846,6 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
||||||
conn->lockit--;
|
conn->lockit--;
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if((info->lnr[0] != '\0') && (conn->talk->state & (1<<(info->subcard+ST_pbx)))) {
|
|
||||||
char eaz;
|
|
||||||
struct eazmapping *ce;
|
|
||||||
mblk_t *mp;
|
|
||||||
int len = strlen(info->lnr+1);
|
|
||||||
|
|
||||||
eaz = ++conn->talk->lasteaz;
|
|
||||||
if(eaz > 8) eaz = 1;
|
|
||||||
eaz += '0';
|
|
||||||
mp = allocb(sizeof(*ce)+len, BPRI_MED);
|
|
||||||
if(mp == NULL)
|
|
||||||
break;
|
|
||||||
ce = ((struct eazmapping *)mp->b_wptr)++;
|
|
||||||
bzero(ce,sizeof(*ce));
|
|
||||||
ce->eaz = eaz;
|
|
||||||
ce->telnolen = len;
|
|
||||||
strncpy(mp->b_wptr,info->lnr+1,len);
|
|
||||||
mp->b_wptr += len;
|
|
||||||
if((err = capi_sendctl(conn->talk,conn->talk->tappl[conn->talk->regnum],CONTROL_EAZMAPPING,mp,conn->conni[WF_CONTROL_EAZ] = newmsgid(conn->talk))) < 0)
|
|
||||||
freemsg(mp);
|
|
||||||
else {
|
|
||||||
conn->waitflags = 1<<WF_CONTROL_EAZ;
|
|
||||||
setstate(conn,1);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
err = send_dialout(conn);
|
err = send_dialout(conn);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1860,12 +1924,13 @@ killconn (isdn3_conn conn, char force)
|
||||||
if (force) {
|
if (force) {
|
||||||
untimer (CAPI_TCONN, conn);
|
untimer (CAPI_TCONN, conn);
|
||||||
untimer (CAPI_TWAITEAZ, conn);
|
untimer (CAPI_TWAITEAZ, conn);
|
||||||
|
untimer (CAPI_TFOO, conn);
|
||||||
|
}
|
||||||
|
if(conn->state == 0) {
|
||||||
|
conn->lockit--;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
send_disconnect(conn, !force, 0);
|
send_disconnect(conn, !force, 0);
|
||||||
if (conn->p_data != NULL) {
|
|
||||||
free (conn->p_data);
|
|
||||||
conn->p_data = NULL;
|
|
||||||
}
|
|
||||||
conn->lockit--;
|
conn->lockit--;
|
||||||
checkterm(conn);
|
checkterm(conn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,6 +390,8 @@ isdn3_killconn (isdn3_conn conn, char force)
|
||||||
if(conn->conns[i] != NULL)
|
if(conn->conns[i] != NULL)
|
||||||
free(conn->conns[i]);
|
free(conn->conns[i]);
|
||||||
}
|
}
|
||||||
|
if(conn->p_data != NULL)
|
||||||
|
free(conn->p_data);
|
||||||
free(conn);
|
free(conn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2461,10 +2461,6 @@ sendcmd (isdn3_conn conn, ushort_t id, mblk_t * data)
|
||||||
static void
|
static void
|
||||||
killconn (isdn3_conn conn, char force)
|
killconn (isdn3_conn conn, char force)
|
||||||
{
|
{
|
||||||
if (conn->p_data != NULL) {
|
|
||||||
free (conn->p_data);
|
|
||||||
conn->p_data = NULL;
|
|
||||||
}
|
|
||||||
if (force) {
|
if (force) {
|
||||||
untimer (N1_T308, conn);
|
untimer (N1_T308, conn);
|
||||||
untimer (N1_T313, conn);
|
untimer (N1_T313, conn);
|
||||||
|
|
|
@ -437,7 +437,7 @@ printf("FacL 8 is %d %d\n",ilen,nlen);
|
||||||
ilen--;
|
ilen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
|
#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
|
||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
#else
|
#else
|
||||||
#define UNUSED
|
#define UNUSED
|
||||||
|
|
|
@ -222,6 +222,7 @@ typedef struct proginfo {
|
||||||
char *protocol;
|
char *protocol;
|
||||||
char *cclass;
|
char *cclass;
|
||||||
char *card;
|
char *card;
|
||||||
|
long id;
|
||||||
ulong_t mask;
|
ulong_t mask;
|
||||||
char *type;
|
char *type;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
@ -279,6 +280,7 @@ typedef struct conninfo {
|
||||||
long ccharge; /* cumulative charge, informational msg */
|
long ccharge; /* cumulative charge, informational msg */
|
||||||
int chargecount; /* Debug! */
|
int chargecount; /* Debug! */
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
long id;
|
||||||
uchar_t minor;
|
uchar_t minor;
|
||||||
uchar_t fminor;
|
uchar_t fminor;
|
||||||
CState state;
|
CState state;
|
||||||
|
|
|
@ -588,7 +588,19 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
||||||
syslog(LOG_CRIT,"Pipe: %m");
|
syslog(LOG_CRIT,"Pipe: %m");
|
||||||
return "NO PIPE";
|
return "NO PIPE";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
struct conninfo *xconn;
|
||||||
|
int id = 0; char *ids = strchr(cfr->type,'/');
|
||||||
|
if(ids != NULL)
|
||||||
|
id = atoi(ids);
|
||||||
|
if(id != 0) {
|
||||||
|
for(xconn = isdn4_conn; xconn != NULL; xconn = xconn->next) {
|
||||||
|
if(xconn->id == id) {
|
||||||
|
return "Already Running";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
char *err;
|
char *err;
|
||||||
|
|
||||||
|
@ -619,6 +631,17 @@ runprog (cf cfr, struct conninfo **rconn, conngrab *foo)
|
||||||
ReportConn(conn);
|
ReportConn(conn);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(conn != NULL) {
|
||||||
|
int id = 0; char *ids = strchr(cfr->type,'/');
|
||||||
|
if(ids != NULL)
|
||||||
|
id = atoi(ids);
|
||||||
|
if(id != 0) {
|
||||||
|
for(prog = conn->run; prog != NULL; prog = prog->next) {
|
||||||
|
if(prog->id == id)
|
||||||
|
return "Already Running";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
prog = (struct proginfo *) malloc (sizeof (struct proginfo));
|
prog = (struct proginfo *) malloc (sizeof (struct proginfo));
|
||||||
|
|
||||||
if (prog == NULL)
|
if (prog == NULL)
|
||||||
|
@ -1101,6 +1124,8 @@ run_rp(struct conninfo *conn, char what)
|
||||||
for(cfr = cf_RP; cfr != NULL; cfr = cfr->next) {
|
for(cfr = cf_RP; cfr != NULL; cfr = cfr->next) {
|
||||||
char *sit,*pro,*car,*cla;
|
char *sit,*pro,*car,*cla;
|
||||||
ulong_t sub;
|
ulong_t sub;
|
||||||
|
int id = 0;
|
||||||
|
char *ids;
|
||||||
|
|
||||||
if(strchr(cfr->type,what) == NULL) continue;
|
if(strchr(cfr->type,what) == NULL) continue;
|
||||||
if((sit = wildmatch(conn->cg->site,cfr->site)) == NULL) continue;
|
if((sit = wildmatch(conn->cg->site,cfr->site)) == NULL) continue;
|
||||||
|
@ -1108,9 +1133,13 @@ run_rp(struct conninfo *conn, char what)
|
||||||
if((car = wildmatch(conn->cg->card,cfr->card)) == NULL) continue;
|
if((car = wildmatch(conn->cg->card,cfr->card)) == NULL) continue;
|
||||||
if((sub = maskmatch(conn->cg->mask,cfr->mask)) == 0) continue;
|
if((sub = maskmatch(conn->cg->mask,cfr->mask)) == 0) continue;
|
||||||
if((cla = classmatch(conn->cg->cclass,cfr->cclass)) == NULL) continue;
|
if((cla = classmatch(conn->cg->cclass,cfr->cclass)) == NULL) continue;
|
||||||
|
if((ids = strchr(cfr->type,'/')) != NULL)
|
||||||
|
id = atoi(ids);
|
||||||
|
|
||||||
for(pr = conn->run; pr != NULL; pr = pr->next) {
|
for(pr = conn->run; pr != NULL; pr = pr->next) {
|
||||||
struct conninfo *xconn;
|
struct conninfo *xconn;
|
||||||
|
if(id != 0 && pr->id == id)
|
||||||
|
break;
|
||||||
if(strchr(pr->type,what) == NULL) continue;
|
if(strchr(pr->type,what) == NULL) continue;
|
||||||
if(wildmatch(pr->site,sit) == NULL) continue;
|
if(wildmatch(pr->site,sit) == NULL) continue;
|
||||||
if(wildmatch(pr->protocol,pro) == NULL) continue;
|
if(wildmatch(pr->protocol,pro) == NULL) continue;
|
||||||
|
|
|
@ -576,6 +576,11 @@ extern int strmsgsz; /* maximum stream message size */
|
||||||
extern int nstrpush; /* maximum # of pushed modules */
|
extern int nstrpush; /* maximum # of pushed modules */
|
||||||
extern volatile queue_t *sched_first, *sched_last;
|
extern volatile queue_t *sched_first, *sched_last;
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
|
extern void putnext(queue_t *p_queue, mblk_t *p_msg);
|
||||||
|
extern void linkb(mblk_t *p_msg1, mblk_t *p_msg2);
|
||||||
|
extern mblk_t *unlinkb(mblk_t *p_msg);
|
||||||
|
#else
|
||||||
static inline void putnext(queue_t *p_queue, mblk_t *p_msg)
|
static inline void putnext(queue_t *p_queue, mblk_t *p_msg)
|
||||||
{
|
{
|
||||||
(*p_queue->q_next->q_qinfo->qi_putp)(p_queue->q_next, p_msg);
|
(*p_queue->q_next->q_qinfo->qi_putp)(p_queue->q_next, p_msg);
|
||||||
|
@ -603,5 +608,6 @@ static inline mblk_t *unlinkb(mblk_t *p_msg)
|
||||||
p_msg->b_cont = NULL;
|
p_msg->b_cont = NULL;
|
||||||
return p_nextmsg;
|
return p_nextmsg;
|
||||||
}
|
}
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
#endif /* __sys_stream_h */
|
#endif /* __sys_stream_h */
|
||||||
|
|
|
@ -184,7 +184,9 @@ xstreams_open (struct inode *inode, struct file *file, struct stream_header **pp
|
||||||
p_stream->flag &= ~SF_WAITOPEN;
|
p_stream->flag &= ~SF_WAITOPEN;
|
||||||
wake_up (&p_stream->waiting);
|
wake_up (&p_stream->waiting);
|
||||||
if (p_stream->error < 0) {
|
if (p_stream->error < 0) {
|
||||||
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
printk("XOpen RetErr %d\n",p_stream->error);
|
printk("XOpen RetErr %d\n",p_stream->error);
|
||||||
|
#endif
|
||||||
return p_stream->error;
|
return p_stream->error;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -255,7 +257,15 @@ xstreams_open (struct inode *inode, struct file *file, struct stream_header **pp
|
||||||
freeq (p_queue);
|
freeq (p_queue);
|
||||||
kfree_s (p_stream, sizeof (*p_stream));
|
kfree_s (p_stream, sizeof (*p_stream));
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
printk("XOpen RetErrR %d\n",err);
|
printk("XOpen RetErrR %d\n",err);
|
||||||
|
#endif
|
||||||
|
if(p_stream->next != NULL)
|
||||||
|
p_stream->next->prev = p_stream->prev;
|
||||||
|
if(p_stream->prev != NULL)
|
||||||
|
p_stream->prev->next = p_stream->next;
|
||||||
|
else
|
||||||
|
first_stream = p_stream->next;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +328,7 @@ streams_close (struct inode *inode, struct file *file)
|
||||||
wake_up (&p_stream->ioctling);
|
wake_up (&p_stream->ioctling);
|
||||||
|
|
||||||
p_queue = p_stream->write_queue;
|
p_queue = p_stream->write_queue;
|
||||||
#if 0 /* def CONFIG_DEBUG_STREAMS */
|
#ifdef CONFIG_DEBUG_STREAMS_1
|
||||||
printf("Closing %p q %p\n",p_stream,RD(p_queue));
|
printf("Closing %p q %p\n",p_stream,RD(p_queue));
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -77,7 +77,6 @@ int q_timeout = 0;
|
||||||
#undef freeb
|
#undef freeb
|
||||||
#undef dupb
|
#undef dupb
|
||||||
#undef copyb
|
#undef copyb
|
||||||
#undef unlinkb
|
|
||||||
#undef qenable
|
#undef qenable
|
||||||
#ifdef CONFIG_MALLOC_NAMES
|
#ifdef CONFIG_MALLOC_NAMES
|
||||||
#undef kmalloc
|
#undef kmalloc
|
||||||
|
@ -89,7 +88,6 @@ int q_timeout = 0;
|
||||||
#define freeb(a) deb_freeb(deb_file,deb_line,a)
|
#define freeb(a) deb_freeb(deb_file,deb_line,a)
|
||||||
#define dupb(a) deb_dupb(deb_file,deb_line,a)
|
#define dupb(a) deb_dupb(deb_file,deb_line,a)
|
||||||
#define copyb(a) deb_copyb(deb_file,deb_line,a)
|
#define copyb(a) deb_copyb(deb_file,deb_line,a)
|
||||||
#define unlinkb(a) deb_unlinkb(deb_file,deb_line,a)
|
|
||||||
#define qenable(a) deb_qenable(deb_file,deb_line,a)
|
#define qenable(a) deb_qenable(deb_file,deb_line,a)
|
||||||
|
|
||||||
void traceback(char str) {
|
void traceback(char str) {
|
||||||
|
@ -132,7 +130,8 @@ __res;})
|
||||||
* Data message type?
|
* Data message type?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static inline const int datamsg(uchar_t type)
|
static inline const int
|
||||||
|
datamsg(uchar_t type)
|
||||||
{
|
{
|
||||||
return (type == M_DATA || type==M_EXDATA);
|
return (type == M_DATA || type==M_EXDATA);
|
||||||
}
|
}
|
||||||
|
@ -150,10 +149,11 @@ static inline const int datamsg(uchar_t type)
|
||||||
* reasonable values.
|
* reasonable values.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t * deb_allocb(const char *deb_file, unsigned int deb_line, ushort size, ushort pri)
|
deb_allocb(const char *deb_file, unsigned int deb_line, ushort size, ushort pri)
|
||||||
#else
|
#else
|
||||||
mblk_t * allocb(ushort size, ushort pri)
|
allocb(ushort size, ushort pri)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg;
|
mblk_t *p_msg;
|
||||||
|
@ -226,10 +226,11 @@ mblk_t * allocb(ushort size, ushort pri)
|
||||||
* Free a message header, decrement data block refcount, free data block if zero.
|
* Free a message header, decrement data block refcount, free data block if zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_freeb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_freeb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void freeb(mblk_t *p_msg)
|
freeb(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef SK_STREAM
|
#ifdef SK_STREAM
|
||||||
|
@ -325,10 +326,11 @@ void freeb(mblk_t *p_msg)
|
||||||
*
|
*
|
||||||
* This is rather inefficient and unsafe, but testb() is not widely used anyway.
|
* This is rather inefficient and unsafe, but testb() is not widely used anyway.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_testb(const char *deb_file, unsigned int deb_line, ushort size, ushort pri)
|
deb_testb(const char *deb_file, unsigned int deb_line, ushort size, ushort pri)
|
||||||
#else
|
#else
|
||||||
int testb(ushort size, ushort pri)
|
testb(ushort size, ushort pri)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg;
|
mblk_t *p_msg;
|
||||||
|
@ -349,7 +351,8 @@ int testb(ushort size, ushort pri)
|
||||||
* Class of the buffer?
|
* Class of the buffer?
|
||||||
* We're using kmalloc instead of fixed tables, so this gets skipped.
|
* We're using kmalloc instead of fixed tables, so this gets skipped.
|
||||||
*/
|
*/
|
||||||
int getclass(ushort size)
|
int
|
||||||
|
getclass(ushort size)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -361,10 +364,11 @@ int getclass(ushort size)
|
||||||
* The read side gets a QREADR flag so OTHERQ knows what to do.
|
* The read side gets a QREADR flag so OTHERQ knows what to do.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
queue_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
queue_t *deb_allocq(const char *deb_file, unsigned int deb_line)
|
deb_allocq(const char *deb_file, unsigned int deb_line)
|
||||||
#else
|
#else
|
||||||
queue_t *allocq(void)
|
allocq(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
queue_t *p_queue;
|
queue_t *p_queue;
|
||||||
|
@ -391,10 +395,11 @@ queue_t *allocq(void)
|
||||||
*
|
*
|
||||||
* Frees a queue pair.
|
* Frees a queue pair.
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_freeq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
deb_freeq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
void freeq(queue_t *p_queue)
|
freeq(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(p_queue == NULL) {
|
if(p_queue == NULL) {
|
||||||
|
@ -423,10 +428,11 @@ void freeq(queue_t *p_queue)
|
||||||
* this is the place to add the appropriate dispose code.
|
* this is the place to add the appropriate dispose code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_freemsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_freemsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void freemsg(mblk_t *p_msg)
|
freemsg(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_temp;
|
mblk_t *p_temp;
|
||||||
|
@ -452,10 +458,11 @@ void freemsg(mblk_t *p_msg)
|
||||||
* the existing data; also increment the refcount.
|
* the existing data; also increment the refcount.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_dupb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_dupb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *dupb(mblk_t *p_msg)
|
dupb(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_newmsg;
|
mblk_t *p_newmsg;
|
||||||
|
@ -492,10 +499,11 @@ mblk_t *dupb(mblk_t *p_msg)
|
||||||
* Duplicate a message. Walk through it with dupb().
|
* Duplicate a message. Walk through it with dupb().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_dupmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_dupmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *dupmsg(mblk_t *p_msg)
|
dupmsg(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_head, *p_newmsg;
|
mblk_t *p_head, *p_newmsg;
|
||||||
|
@ -529,10 +537,11 @@ mblk_t *dupmsg(mblk_t *p_msg)
|
||||||
* of the block is _not_ preserved.
|
* of the block is _not_ preserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_copyb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_copyb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *copyb(mblk_t *p_msg)
|
copyb(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_newmsg;
|
mblk_t *p_newmsg;
|
||||||
|
@ -565,10 +574,11 @@ mblk_t *copyb(mblk_t *p_msg)
|
||||||
* Copy a message. Walk through it with dupb().
|
* Copy a message. Walk through it with dupb().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_copymsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_copymsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *copymsg(mblk_t *p_msg)
|
copymsg(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_head, *p_newmsg;
|
mblk_t *p_head, *p_newmsg;
|
||||||
|
@ -600,10 +610,11 @@ mblk_t *copymsg(mblk_t *p_msg)
|
||||||
* Free space is preserved.
|
* Free space is preserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_copybufb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_copybufb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *copybufb(mblk_t *p_msg)
|
copybufb(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_newmsg;
|
mblk_t *p_newmsg;
|
||||||
|
@ -637,10 +648,11 @@ mblk_t *copybufb(mblk_t *p_msg)
|
||||||
* Copy a message with block alignment. Walk through it with copybufb().
|
* Copy a message with block alignment. Walk through it with copybufb().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_copybufmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_copybufmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
mblk_t *copybufmsg(mblk_t *p_msg)
|
copybufmsg(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_head, *p_newmsg;
|
mblk_t *p_head, *p_newmsg;
|
||||||
|
@ -666,25 +678,6 @@ mblk_t *copybufmsg(mblk_t *p_msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* linkb
|
|
||||||
*
|
|
||||||
* Link two messages.
|
|
||||||
* This procedure is misnamed and should be called linkmsg().
|
|
||||||
*
|
|
||||||
* Inlined and moved to the header file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* unlinkb
|
|
||||||
*
|
|
||||||
* Unlink a message block from the head of a message.
|
|
||||||
*
|
|
||||||
* This code is rather useless because there's no advantage to grabbing the
|
|
||||||
* b_cont field and then either freeb()ing the head or clearing b_cont...
|
|
||||||
* unless it's inlined, that is.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rmvb
|
* rmvb
|
||||||
*
|
*
|
||||||
|
@ -696,10 +689,11 @@ mblk_t *copybufmsg(mblk_t *p_msg)
|
||||||
* block is in the message, you deserve to lose.
|
* block is in the message, you deserve to lose.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_rmvb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, mblk_t *p_block)
|
deb_rmvb(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, mblk_t *p_block)
|
||||||
#else
|
#else
|
||||||
mblk_t *rmvb(mblk_t *p_msg, mblk_t *p_block)
|
rmvb(mblk_t *p_msg, mblk_t *p_block)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_ret = p_msg;
|
mblk_t *p_ret = p_msg;
|
||||||
|
@ -743,10 +737,11 @@ mblk_t *rmvb(mblk_t *p_msg, mblk_t *p_block)
|
||||||
* This code is rather stupid. See pullupm() for how to do it better
|
* This code is rather stupid. See pullupm() for how to do it better
|
||||||
* (but not compatible).
|
* (but not compatible).
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_pullupmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, short length)
|
deb_pullupmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, short length)
|
||||||
#else
|
#else
|
||||||
int pullupmsg(mblk_t *p_msg, short length)
|
pullupmsg(mblk_t *p_msg, short length)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_temp, *p_newmsg;
|
mblk_t *p_temp, *p_newmsg;
|
||||||
|
@ -828,10 +823,11 @@ int pullupmsg(mblk_t *p_msg, short length)
|
||||||
* Actually, this is the same stupidity pullupmsg() engaged in,
|
* Actually, this is the same stupidity pullupmsg() engaged in,
|
||||||
* but I didn't redo adjmsg() because I don't need it...
|
* but I didn't redo adjmsg() because I don't need it...
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_adjmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, short length)
|
deb_adjmsg(const char *deb_file, unsigned int deb_line, mblk_t *p_msg, short length)
|
||||||
#else
|
#else
|
||||||
int adjmsg(mblk_t *p_msg, short length)
|
adjmsg(mblk_t *p_msg, short length)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_temp = NULL; /* shut up GCC */
|
mblk_t *p_temp = NULL; /* shut up GCC */
|
||||||
|
@ -888,10 +884,11 @@ int adjmsg(mblk_t *p_msg, short length)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_xmsgsize(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_xmsgsize(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
int xmsgsize(mblk_t *p_msg)
|
xmsgsize(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
|
@ -941,10 +938,11 @@ int xmsgsize(mblk_t *p_msg)
|
||||||
*
|
*
|
||||||
* Count size of data blocks.
|
* Count size of data blocks.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_msgdsize(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
deb_msgdsize(const char *deb_file, unsigned int deb_line, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
int msgdsize(mblk_t *p_msg)
|
msgdsize(mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int bytes = 0;
|
int bytes = 0;
|
||||||
|
@ -1013,9 +1011,11 @@ int msgdsize(mblk_t *p_msg)
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
#define rmv_post(a,b) deb_rmv_post(deb_file,deb_line,a,b)
|
#define rmv_post(a,b) deb_rmv_post(deb_file,deb_line,a,b)
|
||||||
static inline void deb_rmv_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
static void
|
||||||
|
deb_rmv_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
static inline void rmv_post(queue_t *p_queue, mblk_t *p_msg)
|
static inline void
|
||||||
|
rmv_post(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_tmp = p_msg;
|
mblk_t *p_tmp = p_msg;
|
||||||
|
@ -1084,9 +1084,11 @@ static inline void rmv_post(queue_t *p_queue, mblk_t *p_msg)
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
#define put_post(a,b) deb_put_post(deb_file,deb_line,a,b)
|
#define put_post(a,b) deb_put_post(deb_file,deb_line,a,b)
|
||||||
static inline void deb_put_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
static void
|
||||||
|
deb_put_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
static inline void put_post(queue_t *p_queue, mblk_t *p_msg)
|
static inline void
|
||||||
|
put_post(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_tmp = p_msg;
|
mblk_t *p_tmp = p_msg;
|
||||||
|
@ -1150,9 +1152,11 @@ static inline void put_post(queue_t *p_queue, mblk_t *p_msg)
|
||||||
* - Enable back queue if QWANTW is set, i.e. if a back queue is full.
|
* - Enable back queue if QWANTW is set, i.e. if a back queue is full.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
inline void deb_get_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
void
|
||||||
|
deb_get_post(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
inline void get_post(queue_t *p_queue)
|
inline void
|
||||||
|
get_post(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (p_queue->q_count<=p_queue->q_lowat && p_queue->q_flag&QWANTW) {
|
if (p_queue->q_count<=p_queue->q_lowat && p_queue->q_flag&QWANTW) {
|
||||||
|
@ -1180,10 +1184,11 @@ inline void get_post(queue_t *p_queue)
|
||||||
* - Adjust flow control.
|
* - Adjust flow control.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
mblk_t *deb_getq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
deb_getq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
mblk_t *getq(queue_t *p_queue)
|
getq(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg;
|
mblk_t *p_msg;
|
||||||
|
@ -1256,10 +1261,11 @@ if(0)printf("%sG %s:%d ",KERN_ERR ,deb_file,deb_line);
|
||||||
* The message must be on the queue.
|
* The message must be on the queue.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_rmvq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
deb_rmvq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void rmvq(queue_t *p_queue, mblk_t *p_msg)
|
rmvq(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -1328,10 +1334,11 @@ void rmvq(queue_t *p_queue, mblk_t *p_msg)
|
||||||
* Restore flow control.
|
* Restore flow control.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_flushq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, int flag)
|
deb_flushq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, int flag)
|
||||||
#else
|
#else
|
||||||
void flushq(queue_t *p_queue, int flag)
|
flushq(queue_t *p_queue, int flag)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg, *p_next;
|
mblk_t *p_msg, *p_next;
|
||||||
|
@ -1391,10 +1398,11 @@ void flushq(queue_t *p_queue, int flag)
|
||||||
* Reports if the queue is full and kicks the next available writer if it is.
|
* Reports if the queue is full and kicks the next available writer if it is.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_canput(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
deb_canput(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
int canput(queue_t *p_queue)
|
canput(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (p_queue == NULL) {
|
if (p_queue == NULL) {
|
||||||
|
@ -1425,10 +1433,11 @@ if(0)printf("%sP %s:%d ",KERN_ERR ,deb_file,deb_line);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_putq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
deb_putq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void putq(queue_t *p_queue, mblk_t *p_msg)
|
putq(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -1510,10 +1519,11 @@ if(0)printf("%sP %s:%d ",KERN_ERR ,deb_file,deb_line);
|
||||||
* Put a message back onto its queue.
|
* Put a message back onto its queue.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_putbq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
deb_putbq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void putbq(queue_t *p_queue, mblk_t *p_msg)
|
putbq(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -1592,10 +1602,11 @@ void putbq(queue_t *p_queue, mblk_t *p_msg)
|
||||||
* If NULL, insert at the end.
|
* If NULL, insert at the end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_insq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
deb_insq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void insq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
insq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -1659,10 +1670,11 @@ void insq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
* if NULL, insert at the beginning.
|
* if NULL, insert at the beginning.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_appq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
deb_appq(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void appq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
appq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -1735,10 +1747,11 @@ void appq(queue_t *p_queue, mblk_t *p_oldmsg, mblk_t *p_msg)
|
||||||
*
|
*
|
||||||
* Create a zero-byte control message and put it onto a queue.
|
* Create a zero-byte control message and put it onto a queue.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_putctl(const char *deb_file, unsigned int deb_line, queue_t *p_queue, uchar_t type)
|
deb_putctl(const char *deb_file, unsigned int deb_line, queue_t *p_queue, uchar_t type)
|
||||||
#else
|
#else
|
||||||
int putctl(queue_t *p_queue, uchar_t type)
|
putctl(queue_t *p_queue, uchar_t type)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg;
|
mblk_t *p_msg;
|
||||||
|
@ -1757,10 +1770,11 @@ int putctl(queue_t *p_queue, uchar_t type)
|
||||||
*
|
*
|
||||||
* Create a one-byte control message and put it onto a queue.
|
* Create a one-byte control message and put it onto a queue.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_putctl1(const char *deb_file, unsigned int deb_line, queue_t *p_queue, uchar_t type, streamchar param)
|
deb_putctl1(const char *deb_file, unsigned int deb_line, queue_t *p_queue, uchar_t type, streamchar param)
|
||||||
#else
|
#else
|
||||||
int putctl1(queue_t *p_queue, uchar_t type, streamchar param)
|
putctl1(queue_t *p_queue, uchar_t type, streamchar param)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
mblk_t *p_msg;
|
mblk_t *p_msg;
|
||||||
|
@ -1781,10 +1795,11 @@ int putctl1(queue_t *p_queue, uchar_t type, streamchar param)
|
||||||
* Return the queue which feeds this one.
|
* Return the queue which feeds this one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
queue_t
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
queue_t *deb_backq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
*deb_backq(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
queue_t *backq(queue_t *p_queue)
|
*backq(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(p_queue == NULL) {
|
if(p_queue == NULL) {
|
||||||
|
@ -1808,10 +1823,11 @@ queue_t *backq(queue_t *p_queue)
|
||||||
* Send something in the "other" direction.
|
* Send something in the "other" direction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_qreply(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
deb_qreply(const char *deb_file, unsigned int deb_line, queue_t *p_queue, mblk_t *p_msg)
|
||||||
#else
|
#else
|
||||||
void qreply(queue_t *p_queue, mblk_t *p_msg)
|
qreply(queue_t *p_queue, mblk_t *p_msg)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(p_msg == NULL) {
|
if(p_msg == NULL) {
|
||||||
|
@ -1860,10 +1876,11 @@ void qreply(queue_t *p_queue, mblk_t *p_msg)
|
||||||
*
|
*
|
||||||
* return number of messages on queue
|
* return number of messages on queue
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_qsize(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
deb_qsize(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
int qsize(queue_t *p_queue)
|
qsize(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int msgs = 0;
|
int msgs = 0;
|
||||||
|
@ -1887,10 +1904,11 @@ int qsize(queue_t *p_queue)
|
||||||
*
|
*
|
||||||
* Set queue variables
|
* Set queue variables
|
||||||
*/
|
*/
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_setq (const char *deb_file, unsigned int deb_line, queue_t * p_queue, struct qinit *read_init, struct qinit *write_init)
|
deb_setq (const char *deb_file, unsigned int deb_line, queue_t * p_queue, struct qinit *read_init, struct qinit *write_init)
|
||||||
#else
|
#else
|
||||||
void setq (queue_t * p_queue, struct qinit *read_init, struct qinit *write_init)
|
setq (queue_t * p_queue, struct qinit *read_init, struct qinit *write_init)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(p_queue == NULL) {
|
if(p_queue == NULL) {
|
||||||
|
@ -1927,10 +1945,11 @@ void setq (queue_t * p_queue, struct qinit *read_init, struct qinit *write_init)
|
||||||
* Afterwards, unschedule the service procedures if necessary.
|
* Afterwards, unschedule the service procedures if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_qdetach (const char *deb_file, unsigned int deb_line, queue_t * p_queue, int do_close, int flag)
|
deb_qdetach (const char *deb_file, unsigned int deb_line, queue_t * p_queue, int do_close, int flag)
|
||||||
#else
|
#else
|
||||||
void qdetach (queue_t * p_queue, int do_close, int flag)
|
qdetach (queue_t * p_queue, int do_close, int flag)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -2007,10 +2026,11 @@ void qdetach (queue_t * p_queue, int do_close, int flag)
|
||||||
* driver/module.
|
* driver/module.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_qattach (const char *deb_file, unsigned int deb_line, struct streamtab *qinfo, queue_t * p_queue, dev_t dev, int flag)
|
deb_qattach (const char *deb_file, unsigned int deb_line, struct streamtab *qinfo, queue_t * p_queue, dev_t dev, int flag)
|
||||||
#else
|
#else
|
||||||
int qattach (struct streamtab *qinfo, queue_t * p_queue, dev_t dev, int flag)
|
qattach (struct streamtab *qinfo, queue_t * p_queue, dev_t dev, int flag)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
queue_t *p_newqueue;
|
queue_t *p_newqueue;
|
||||||
|
@ -2069,10 +2089,11 @@ printf("%sDriver %s opened\n",KERN_DEBUG ,p_newqueue->q_qinfo->qi_minfo->mi_idna
|
||||||
* Schedule a queue.
|
* Schedule a queue.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_qenable(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
deb_qenable(const char *deb_file, unsigned int deb_line, queue_t *p_queue)
|
||||||
#else
|
#else
|
||||||
void qenable(queue_t *p_queue)
|
qenable(queue_t *p_queue)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -2178,10 +2199,11 @@ qretry(queue_t *p_queue)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
void deb_runqueues(const char *deb_file, unsigned int deb_line)
|
deb_runqueues(const char *deb_file, unsigned int deb_line)
|
||||||
#else
|
#else
|
||||||
void runqueues(void)
|
runqueues(void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(sched_first != NULL) {
|
if(sched_first != NULL) {
|
||||||
|
@ -2194,10 +2216,12 @@ void runqueues(void)
|
||||||
static void do_runqueues(void*);
|
static void do_runqueues(void*);
|
||||||
static int isrunning = 0;
|
static int isrunning = 0;
|
||||||
|
|
||||||
if(isrunning) {
|
if(isrunning++) {
|
||||||
|
--isrunning;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do_runqueues(NULL);
|
do_runqueues(NULL);
|
||||||
|
--isrunning;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2210,7 +2234,8 @@ void runqueues(void)
|
||||||
* Must not be reentered. (Guaranteed by Linux and by the above code.)
|
* Must not be reentered. (Guaranteed by Linux and by the above code.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void do_runqueues(void *dummy)
|
static void
|
||||||
|
do_runqueues(void *dummy)
|
||||||
{
|
{
|
||||||
queue_t *p_queue;
|
queue_t *p_queue;
|
||||||
unsigned long s;
|
unsigned long s;
|
||||||
|
@ -2272,7 +2297,8 @@ static void do_runqueues(void *dummy)
|
||||||
|
|
||||||
const char *str__file; unsigned long str__line;
|
const char *str__file; unsigned long str__line;
|
||||||
|
|
||||||
int deb_splstr(const char * deb_file, unsigned int deb_line)
|
int
|
||||||
|
deb_splstr(const char * deb_file, unsigned int deb_line)
|
||||||
{
|
{
|
||||||
if(bh_mask & (1<<STREAMS_BH)) {
|
if(bh_mask & (1<<STREAMS_BH)) {
|
||||||
long x;
|
long x;
|
||||||
|
@ -2297,7 +2323,8 @@ int deb_splstr(const char * deb_file, unsigned int deb_line)
|
||||||
|
|
||||||
char streams_inited = 0;
|
char streams_inited = 0;
|
||||||
|
|
||||||
static void streams_init(void)
|
static void
|
||||||
|
streams_init(void)
|
||||||
{
|
{
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
static void q_run(void *);
|
static void q_run(void *);
|
||||||
|
@ -2315,7 +2342,8 @@ static void streams_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
static void q_run(void *dummy)
|
static void
|
||||||
|
q_run(void *dummy)
|
||||||
{
|
{
|
||||||
if(bh_mask & (1<<STREAMS_BH)) {
|
if(bh_mask & (1<<STREAMS_BH)) {
|
||||||
do_runqueues(dummy);
|
do_runqueues(dummy);
|
||||||
|
@ -2327,16 +2355,67 @@ static void q_run(void *dummy)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
|
|
||||||
|
void
|
||||||
|
putnext(queue_t *p_queue, mblk_t *p_msg)
|
||||||
|
{
|
||||||
|
(*p_queue->q_next->q_qinfo->qi_putp)(p_queue->q_next, p_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* linkb
|
||||||
|
*
|
||||||
|
* Link two messages.
|
||||||
|
* This procedure is misnamed and should be called linkmsg().
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
linkb(mblk_t *p_msg1, mblk_t *p_msg2)
|
||||||
|
{
|
||||||
|
if(p_msg1 == NULL || p_msg2 == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while(p_msg1->b_cont != NULL)
|
||||||
|
p_msg1 = p_msg1->b_cont;
|
||||||
|
|
||||||
|
p_msg1->b_cont = p_msg2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* unlinkb
|
||||||
|
*
|
||||||
|
* Unlink a message block from the head of a message.
|
||||||
|
*
|
||||||
|
* Some people think this code is actually useful...
|
||||||
|
*/
|
||||||
|
|
||||||
|
mblk_t *
|
||||||
|
unlinkb(mblk_t *p_msg)
|
||||||
|
{
|
||||||
|
mblk_t *p_nextmsg;
|
||||||
|
|
||||||
|
if(p_msg == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
p_nextmsg = p_msg->b_cont;
|
||||||
|
p_msg->b_cont = NULL;
|
||||||
|
return p_nextmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_DEBUG_STREAMS */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* findmod
|
* findmod
|
||||||
*
|
*
|
||||||
* Find a Streams module by name.
|
* Find a Streams module by name.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
#ifdef CONFIG_DEBUG_STREAMS
|
#ifdef CONFIG_DEBUG_STREAMS
|
||||||
int deb_findmod(const char *deb_file, unsigned int deb_line, const char *name)
|
deb_findmod(const char *deb_file, unsigned int deb_line, const char *name)
|
||||||
#else
|
#else
|
||||||
int findmod(const char *name)
|
findmod(const char *name)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -2358,7 +2437,9 @@ int findmod(const char *name)
|
||||||
*/
|
*/
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
struct streamtab *fstr_sw[MAX_STRDEV] = {NULL,};
|
struct streamtab *fstr_sw[MAX_STRDEV] = {NULL,};
|
||||||
int register_strdev(unsigned int major, struct streamtab *strtab, int nminor)
|
|
||||||
|
int
|
||||||
|
register_strdev(unsigned int major, struct streamtab *strtab, int nminor)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int register_term_strdev(unsigned int major, const char *name, int nminor);
|
int register_term_strdev(unsigned int major, const char *name, int nminor);
|
||||||
|
@ -2414,7 +2495,8 @@ int unregister_strdev (unsigned int major, struct streamtab *strtab, int nminor)
|
||||||
struct fmodsw fmod_sw[MAX_STRMOD] = {{{0}}};
|
struct fmodsw fmod_sw[MAX_STRMOD] = {{{0}}};
|
||||||
int fmodcnt = MAX_STRMOD;
|
int fmodcnt = MAX_STRMOD;
|
||||||
|
|
||||||
int register_strmod(struct streamtab *strtab)
|
int
|
||||||
|
register_strmod(struct streamtab *strtab)
|
||||||
{
|
{
|
||||||
int fm;
|
int fm;
|
||||||
struct fmodsw *f;
|
struct fmodsw *f;
|
||||||
|
@ -2438,7 +2520,8 @@ int register_strmod(struct streamtab *strtab)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
int unregister_strmod(struct streamtab *strtab)
|
int
|
||||||
|
unregister_strmod(struct streamtab *strtab)
|
||||||
{
|
{
|
||||||
int fm;
|
int fm;
|
||||||
struct fmodsw *f;
|
struct fmodsw *f;
|
||||||
|
|
Loading…
Reference in New Issue