svn commit: r264034 - in projects/sendfile/sys: dev/iscsi netgraph/bluetooth/socket netinet
Gleb Smirnoff
glebius at FreeBSD.org
Wed Apr 2 09:49:09 UTC 2014
Author: glebius
Date: Wed Apr 2 09:49:08 2014
New Revision: 264034
URL: http://svnweb.freebsd.org/changeset/base/264034
Log:
Use appropriate sbavail() or sbused() instead of access to sb_cc.
Modified:
projects/sendfile/sys/dev/iscsi/icl.c
projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
projects/sendfile/sys/netinet/accf_dns.c
projects/sendfile/sys/netinet/accf_http.c
Modified: projects/sendfile/sys/dev/iscsi/icl.c
==============================================================================
--- projects/sendfile/sys/dev/iscsi/icl.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/dev/iscsi/icl.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -736,7 +736,7 @@ icl_receive_thread(void *arg)
}
SOCKBUF_LOCK(&so->so_rcv);
- available = so->so_rcv.sb_cc;
+ available = sbavail(&so->so_rcv);
if (available < ic->ic_receive_len) {
so->so_rcv.sb_lowat = ic->ic_receive_len;
cv_wait(&ic->ic_receive_cv, &so->so_rcv.sb_mtx);
Modified: projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
==============================================================================
--- projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -1127,9 +1127,8 @@ ng_btsocket_l2cap_process_l2ca_write_rsp
/*
* Check if we have more data to send
*/
-
sbdroprecord(&pcb->so->so_snd);
- if (pcb->so->so_snd.sb_cc > 0) {
+ if (sbavail(&pcb->so->so_snd) > 0) {
if (ng_btsocket_l2cap_send2(pcb) == 0)
ng_btsocket_l2cap_timeout(pcb);
else
@@ -2510,7 +2509,7 @@ ng_btsocket_l2cap_send2(ng_btsocket_l2ca
mtx_assert(&pcb->pcb_mtx, MA_OWNED);
- if (pcb->so->so_snd.sb_cc == 0)
+ if (sbavail(&pcb->so->so_snd) == 0)
return (EINVAL); /* XXX */
m = m_dup(pcb->so->so_snd.sb_mb, M_NOWAIT);
Modified: projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
==============================================================================
--- projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -3274,7 +3274,7 @@ ng_btsocket_rfcomm_pcb_send(ng_btsocket_
}
for (error = 0, sent = 0; sent < limit; sent ++) {
- length = min(pcb->mtu, pcb->so->so_snd.sb_cc);
+ length = min(pcb->mtu, sbavail(&pcb->so->so_snd));
if (length == 0)
break;
Modified: projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
==============================================================================
--- projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -906,7 +906,7 @@ ng_btsocket_sco_default_msg_input(struct
sbdroprecord(&pcb->so->so_snd);
/* Send more if we have any */
- if (pcb->so->so_snd.sb_cc > 0)
+ if (sbavail(&pcb->so->so_snd) > 0)
if (ng_btsocket_sco_send2(pcb) == 0)
ng_btsocket_sco_timeout(pcb);
@@ -1744,7 +1744,7 @@ ng_btsocket_sco_send2(ng_btsocket_sco_pc
mtx_assert(&pcb->pcb_mtx, MA_OWNED);
while (pcb->rt->pending < pcb->rt->num_pkts &&
- pcb->so->so_snd.sb_cc > 0) {
+ sbavail(&pcb->so->so_snd) > 0) {
/* Get a copy of the first packet on send queue */
m = m_dup(pcb->so->so_snd.sb_mb, M_NOWAIT);
if (m == NULL) {
Modified: projects/sendfile/sys/netinet/accf_dns.c
==============================================================================
--- projects/sendfile/sys/netinet/accf_dns.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/netinet/accf_dns.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -75,7 +75,7 @@ sohasdns(struct socket *so, void *arg, i
struct sockbuf *sb = &so->so_rcv;
/* If the socket is full, we're ready. */
- if (sb->sb_cc >= sb->sb_hiwat || sb->sb_mbcnt >= sb->sb_mbmax)
+ if (sbused(sb) >= sb->sb_hiwat || sb->sb_mbcnt >= sb->sb_mbmax)
goto ready;
/* Check to see if we have a request. */
@@ -115,14 +115,14 @@ skippacket(struct sockbuf *sb) {
unsigned long packlen;
struct packet q, *p = &q;
- if (sb->sb_cc < 2)
+ if (sbavail(sb) < 2)
return DNS_WAIT;
q.m = sb->sb_mb;
q.n = q.m->m_nextpkt;
q.moff = 0;
q.offset = 0;
- q.len = sb->sb_cc;
+ q.len = sbavail(sb);
GET16(p, packlen);
if (packlen + 2 > q.len)
Modified: projects/sendfile/sys/netinet/accf_http.c
==============================================================================
--- projects/sendfile/sys/netinet/accf_http.c Wed Apr 2 09:46:00 2014 (r264033)
+++ projects/sendfile/sys/netinet/accf_http.c Wed Apr 2 09:49:08 2014 (r264034)
@@ -92,7 +92,7 @@ sbfull(struct sockbuf *sb)
"mbcnt(%ld) >= mbmax(%ld): %d",
sb->sb_cc, sb->sb_hiwat, sb->sb_cc >= sb->sb_hiwat,
sb->sb_mbcnt, sb->sb_mbmax, sb->sb_mbcnt >= sb->sb_mbmax);
- return (sb->sb_cc >= sb->sb_hiwat || sb->sb_mbcnt >= sb->sb_mbmax);
+ return (sbused(sb) >= sb->sb_hiwat || sb->sb_mbcnt >= sb->sb_mbmax);
}
/*
@@ -162,13 +162,14 @@ static int
sohashttpget(struct socket *so, void *arg, int waitflag)
{
- if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 && !sbfull(&so->so_rcv)) {
+ if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 &&
+ !sbfull(&so->so_rcv)) {
struct mbuf *m;
char *cmp;
int cmplen, cc;
m = so->so_rcv.sb_mb;
- cc = so->so_rcv.sb_cc - 1;
+ cc = sbavail(&so->so_rcv) - 1;
if (cc < 1)
return (SU_OK);
switch (*mtod(m, char *)) {
@@ -215,7 +216,7 @@ soparsehttpvers(struct socket *so, void
goto fallout;
m = so->so_rcv.sb_mb;
- cc = so->so_rcv.sb_cc;
+ cc = sbavail(&so->so_rcv);
inspaces = spaces = 0;
for (m = so->so_rcv.sb_mb; m; m = n) {
n = m->m_nextpkt;
@@ -304,7 +305,7 @@ soishttpconnected(struct socket *so, voi
* have NCHRS left
*/
copied = 0;
- ccleft = so->so_rcv.sb_cc;
+ ccleft = sbavail(&so->so_rcv);
if (ccleft < NCHRS)
goto readmore;
a = b = c = '\0';
More information about the svn-src-projects
mailing list