On Sun, Jan 22, 2023 at 12:44:35AM +0100, Alexander Bluhm wrote:
> 
> > @@ -1632,13 +1634,13 @@ somove(struct socket *so, int wait)
> >             pru_rcvd(so);
> >  
> >     /* Receive buffer did shrink by len bytes, adjust oob. */
> > -   state = so->so_state;
> > -   so->so_state &= ~SS_RCVATMARK;
> > +   state = so->so_rcv.sb_state;
> 
> Should we rename this local variable to rcvstate?
> 
> > +   so->so_rcv.sb_state &= ~SS_RCVATMARK;
> >     oobmark = so->so_oobmark;
> >     so->so_oobmark = oobmark > len ? oobmark - len : 0;
> >     if (oobmark) {
> 

No problem, if this makes code more readable.

Index: sys/kern/uipc_socket.c
===================================================================
RCS file: /cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.295
diff -u -p -r1.295 uipc_socket.c
--- sys/kern/uipc_socket.c      22 Jan 2023 12:05:44 -0000      1.295
+++ sys/kern/uipc_socket.c      22 Jan 2023 12:36:33 -0000
@@ -1458,7 +1458,7 @@ somove(struct socket *so, int wait)
        u_long           len, off, oobmark;
        long             space;
        int              error = 0, maxreached = 0;
-       unsigned int     state;
+       unsigned int     rcvstate;
 
        soassertlocked(so);
 
@@ -1634,7 +1634,7 @@ somove(struct socket *so, int wait)
                pru_rcvd(so);
 
        /* Receive buffer did shrink by len bytes, adjust oob. */
-       state = so->so_rcv.sb_state;
+       rcvstate = so->so_rcv.sb_state;
        so->so_rcv.sb_state &= ~SS_RCVATMARK;
        oobmark = so->so_oobmark;
        so->so_oobmark = oobmark > len ? oobmark - len : 0;
@@ -1649,13 +1649,13 @@ somove(struct socket *so, int wait)
         * Handle oob data.  If any malloc fails, ignore error.
         * TCP urgent data is not very reliable anyway.
         */
-       while (((state & SS_RCVATMARK) || oobmark) &&
+       while (((rcvstate & SS_RCVATMARK) || oobmark) &&
            (so->so_options & SO_OOBINLINE)) {
                struct mbuf *o = NULL;
 
-               if (state & SS_RCVATMARK) {
+               if (rcvstate & SS_RCVATMARK) {
                        o = m_get(wait, MT_DATA);
-                       state &= ~SS_RCVATMARK;
+                       rcvstate &= ~SS_RCVATMARK;
                } else if (oobmark) {
                        o = m_split(m, oobmark, wait);
                        if (o) {
@@ -1689,7 +1689,7 @@ somove(struct socket *so, int wait)
                        if (oobmark) {
                                oobmark -= 1;
                                if (oobmark == 0)
-                                       state |= SS_RCVATMARK;
+                                       rcvstate |= SS_RCVATMARK;
                        }
                        m_adj(m, 1);
                }

Reply via email to