Skip to content

Commit

Permalink
11601 telmod: cast between incompatible function types
Browse files Browse the repository at this point in the history
Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Dan McDonald <danmcd@joyent.com>
  • Loading branch information
tsoome committed Sep 18, 2019
1 parent 203710a commit c97b107
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions usr/src/uts/common/io/telmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ _info(struct modinfo *modinfop)

static int telmodopen(queue_t *, dev_t *, int, int, cred_t *);
static int telmodclose(queue_t *, int, cred_t *);
static void telmodrput(queue_t *, mblk_t *);
static void telmodrsrv(queue_t *);
static void telmodwput(queue_t *, mblk_t *);
static void telmodwsrv(queue_t *);
static int telmodrput(queue_t *, mblk_t *);
static int telmodrsrv(queue_t *);
static int telmodwput(queue_t *, mblk_t *);
static int telmodwsrv(queue_t *);
static int rcv_parse(queue_t *q, mblk_t *mp);
static int snd_parse(queue_t *q, mblk_t *mp);
static void telmod_timer(void *);
Expand All @@ -145,8 +145,8 @@ static struct module_info telmodoinfo = {
};

static struct qinit telmodrinit = {
(int (*)())telmodrput,
(int (*)())telmodrsrv,
telmodrput,
telmodrsrv,
telmodopen,
telmodclose,
nulldev,
Expand All @@ -155,8 +155,8 @@ static struct qinit telmodrinit = {
};

static struct qinit telmodwinit = {
(int (*)())telmodwput,
(int (*)())telmodwsrv,
telmodwput,
telmodwsrv,
NULL,
NULL,
nulldev,
Expand Down Expand Up @@ -350,7 +350,7 @@ telmodclose(queue_t *q, int flag, cred_t *credp)
* telnet protocol processing to M_DATA. Take notice of TLI messages
* indicating connection tear-down, and change them into M_HANGUP's.
*/
static void
static int
telmodrput(queue_t *q, mblk_t *mp)
{
mblk_t *newmp;
Expand All @@ -361,7 +361,7 @@ telmodrput(queue_t *q, mblk_t *mp)
((q->q_first) || ((tmip->flags & TEL_STOPPED) &&
!(tmip->flags & TEL_GETBLK)) || !canputnext(q))) {
(void) putq(q, mp);
return;
return (0);
}

switch (mp->b_datap->db_type) {
Expand All @@ -376,7 +376,7 @@ telmodrput(queue_t *q, mblk_t *mp)
if (tmip->flags & TEL_GETBLK) {
if ((newmp = allocb(sizeof (char), BPRI_MED)) == NULL) {
recover(q, mp, msgdsize(mp));
return;
return (0);
}
newmp->b_datap->db_type = M_CTL;
newmp->b_wptr = newmp->b_rptr + 1;
Expand Down Expand Up @@ -498,14 +498,15 @@ telmodrput(queue_t *q, mblk_t *mp)
#endif
freemsg(mp);
}
return (0);
}

/*
* telmodrsrv:
* Mostly we end up here because of M_DATA processing delayed due to flow
* control or lack of memory. XXX.sparker: TLI primitives here?
*/
static void
static int
telmodrsrv(queue_t *q)
{
mblk_t *mp, *newmp;
Expand All @@ -516,7 +517,7 @@ telmodrsrv(queue_t *q)
if (((tmip->flags & TEL_STOPPED) &&
!(tmip->flags & TEL_GETBLK)) || !canputnext(q)) {
(void) putbq(q, mp);
return;
return (0);
}
switch (mp->b_datap->db_type) {

Expand All @@ -526,7 +527,7 @@ telmodrsrv(queue_t *q)
if ((newmp = allocb(sizeof (char),
BPRI_MED)) == NULL) {
recover(q, mp, msgdsize(mp));
return;
return (0);
}
newmp->b_datap->db_type = M_CTL;
newmp->b_wptr = newmp->b_rptr + 1;
Expand All @@ -541,7 +542,7 @@ telmodrsrv(queue_t *q)
break;
}
if (!rcv_parse(q, mp)) {
return;
return (0);
}
break;

Expand Down Expand Up @@ -630,6 +631,7 @@ telmodrsrv(queue_t *q)
freemsg(mp);
}
}
return (0);
}

/*
Expand All @@ -645,7 +647,7 @@ telmodrsrv(queue_t *q)
* can be running either daemon<->TCP or application<->telmod. We must
* carefully deal with this.
*/
static void
static int
telmodwput(
queue_t *q, /* Pointer to the read queue */
mblk_t *mp) /* Pointer to current message block */
Expand Down Expand Up @@ -848,12 +850,13 @@ telmodwput(
freemsg(mp);
break;
}
return (0);
}

/*
* telmodwsrv - module write service procedure
*/
static void
static int
telmodwsrv(queue_t *q)
{
mblk_t *mp, *savemp;
Expand All @@ -864,21 +867,21 @@ telmodwsrv(queue_t *q)
if (!canputnext(q)) {
ASSERT(mp->b_datap->db_type < QPCTL);
(void) putbq(q, mp);
return;
return (0);
}
switch (mp->b_datap->db_type) {

case M_DATA:
if (tmip->flags & TEL_STOPPED) {
(void) putbq(q, mp);
return;
return (0);
}
/*
* Insert a null character if carraige return
* is not followed by line feed
*/
if (!snd_parse(q, mp)) {
return;
return (0);
}
break;

Expand Down Expand Up @@ -906,6 +909,7 @@ telmodwsrv(queue_t *q)
}

}
return (0);
}

/*
Expand Down

0 comments on commit c97b107

Please sign in to comment.