Changeset 7b158663 in rtems


Ignore:
Timestamp:
Jan 31, 1999, 8:50:49 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
01a2e18
Parents:
0e94e3b3
Message:

Prepended macro variables with "_" to avoid name conflicts in expansions.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libnetworking/sys/mbuf.h

    r0e94e3b3 r7b158663  
    171171 * drivers.
    172172 */
    173 #define MBUFLOCK(code) \
     173#define MBUFLOCK(_code) \
    174174        { int ms = splimp(); \
    175           { code } \
     175          { _code } \
    176176          splx(ms); \
    177177        }
     
    187187 * and internal data.
    188188 */
    189 #define MGET(m, how, type) { \
     189#define MGET(_m, _how, _type) { \
    190190          int _ms = splimp(); \
    191191          if (mmbfree == 0) \
    192                 (void)m_mballoc(1, (how)); \
    193           if (((m) = mmbfree) != 0) { \
    194                 mmbfree = (m)->m_next; \
     192                (void)m_mballoc(1, (_how)); \
     193          if (((_m) = mmbfree) != 0) { \
     194                mmbfree = (_m)->m_next; \
    195195                mbstat.m_mtypes[MT_FREE]--; \
    196                 (m)->m_type = (type); \
    197                 mbstat.m_mtypes[type]++; \
    198                 (m)->m_next = (struct mbuf *)NULL; \
    199                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    200                 (m)->m_data = (m)->m_dat; \
    201                 (m)->m_flags = 0; \
     196                (_m)->m_type = (_type); \
     197                mbstat.m_mtypes[_type]++; \
     198                (_m)->m_next = (struct mbuf *)NULL; \
     199                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     200                (_m)->m_data = (_m)->m_dat; \
     201                (_m)->m_flags = 0; \
    202202                splx(_ms); \
    203203        } else { \
    204204                splx(_ms); \
    205                 (m) = m_retry((how), (type)); \
     205                (_m) = m_retry((_how), (_type)); \
    206206        } \
    207207}
    208208
    209 #define MGETHDR(m, how, type) { \
     209#define MGETHDR(_m, _how, _type) { \
    210210          int _ms = splimp(); \
    211211          if (mmbfree == 0) \
    212                 (void)m_mballoc(1, (how)); \
    213           if (((m) = mmbfree) != 0) { \
    214                 mmbfree = (m)->m_next; \
     212                (void)m_mballoc(1, (_how)); \
     213          if (((_m) = mmbfree) != 0) { \
     214                mmbfree = (_m)->m_next; \
    215215                mbstat.m_mtypes[MT_FREE]--; \
    216                 (m)->m_type = (type); \
    217                 mbstat.m_mtypes[type]++; \
    218                 (m)->m_next = (struct mbuf *)NULL; \
    219                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    220                 (m)->m_data = (m)->m_pktdat; \
    221                 (m)->m_flags = M_PKTHDR; \
     216                (_m)->m_type = (_type); \
     217                mbstat.m_mtypes[_type]++; \
     218                (_m)->m_next = (struct mbuf *)NULL; \
     219                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     220                (_m)->m_data = (_m)->m_pktdat; \
     221                (_m)->m_flags = M_PKTHDR; \
    222222                splx(_ms); \
    223223        } else { \
    224224                splx(_ms); \
    225                 (m) = m_retryhdr((how), (type)); \
     225                (_m) = m_retryhdr((_how), (_type)); \
    226226        } \
    227227}
     
    235235 * freeing the cluster if the reference count has reached 0.
    236236 */
    237 #define MCLALLOC(p, how) \
     237#define MCLALLOC(_p, _how) \
    238238        MBUFLOCK( \
    239239          if (mclfree == 0) \
    240                 (void)m_clalloc(1, (how)); \
    241           if (((p) = (caddr_t)mclfree) != 0) { \
    242                 ++mclrefcnt[mtocl(p)]; \
     240                (void)m_clalloc(1, (_how)); \
     241          if (((_p) = (caddr_t)mclfree) != 0) { \
     242                ++mclrefcnt[mtocl(_p)]; \
    243243                mbstat.m_clfree--; \
    244                 mclfree = ((union mcluster *)(p))->mcl_next; \
     244                mclfree = ((union mcluster *)(_p))->mcl_next; \
    245245          } \
    246246        )
    247247
    248 #define MCLGET(m, how) \
    249         { MCLALLOC((m)->m_ext.ext_buf, (how)); \
    250           if ((m)->m_ext.ext_buf != NULL) { \
    251                 (m)->m_data = (m)->m_ext.ext_buf; \
    252                 (m)->m_flags |= M_EXT; \
    253                 (m)->m_ext.ext_free = NULL;  \
    254                 (m)->m_ext.ext_ref = NULL;  \
    255                 (m)->m_ext.ext_size = MCLBYTES;  \
     248#define MCLGET(_m, _how) \
     249        { MCLALLOC((_m)->m_ext.ext_buf, (_how)); \
     250          if ((_m)->m_ext.ext_buf != NULL) { \
     251                (_m)->m_data = (_m)->m_ext.ext_buf; \
     252                (_m)->m_flags |= M_EXT; \
     253                (_m)->m_ext.ext_free = NULL;  \
     254                (_m)->m_ext.ext_ref = NULL;  \
     255                (_m)->m_ext.ext_size = MCLBYTES;  \
    256256          } \
    257257        }
    258258
    259 #define MCLFREE(p) \
     259#define MCLFREE(_p) \
    260260        MBUFLOCK ( \
    261           if (--mclrefcnt[mtocl(p)] == 0) { \
    262                 ((union mcluster *)(p))->mcl_next = mclfree; \
    263                 mclfree = (union mcluster *)(p); \
     261          if (--mclrefcnt[mtocl(_p)] == 0) { \
     262                ((union mcluster *)(_p))->mcl_next = mclfree; \
     263                mclfree = (union mcluster *)(_p); \
    264264                mbstat.m_clfree++; \
    265265          } \
     
    271271 * Place the successor, if any, in n.
    272272 */
    273 #define MFREE(m, n) \
     273#define MFREE(_m, _n) \
    274274        MBUFLOCK(  \
    275           mbstat.m_mtypes[(m)->m_type]--; \
    276           if ((m)->m_flags & M_EXT) { \
    277                 if ((m)->m_ext.ext_free) \
    278                         (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
    279                             (m)->m_ext.ext_size); \
     275          mbstat.m_mtypes[(_m)->m_type]--; \
     276          if ((_m)->m_flags & M_EXT) { \
     277                if ((_m)->m_ext.ext_free) \
     278                        (*((_m)->m_ext.ext_free))((_m)->m_ext.ext_buf, \
     279                            (_m)->m_ext.ext_size); \
    280280                else { \
    281                         char *p = (m)->m_ext.ext_buf; \
     281                        char *p = (_m)->m_ext.ext_buf; \
    282282                        if (--mclrefcnt[mtocl(p)] == 0) { \
    283283                                ((union mcluster *)(p))->mcl_next = mclfree; \
     
    287287                } \
    288288          } \
    289           (n) = (m)->m_next; \
    290           (m)->m_type = MT_FREE; \
     289          (_n) = (_m)->m_next; \
     290          (_m)->m_type = MT_FREE; \
    291291          mbstat.m_mtypes[MT_FREE]++; \
    292           (m)->m_next = mmbfree; \
    293           mmbfree = (m); \
     292          (_m)->m_next = mmbfree; \
     293          mmbfree = (_m); \
    294294        )
    295295
     
    298298 * from must have M_PKTHDR set, and to must be empty.
    299299 */
    300 #define M_COPY_PKTHDR(to, from) { \
    301         (to)->m_pkthdr = (from)->m_pkthdr; \
    302         (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
    303         (to)->m_data = (to)->m_pktdat; \
     300#define M_COPY_PKTHDR(_to, _from) { \
     301        (_to)->m_pkthdr = (_from)->m_pkthdr; \
     302        (_to)->m_flags = (_from)->m_flags & M_COPYFLAGS; \
     303        (_to)->m_data = (_to)->m_pktdat; \
    304304}
    305305
     
    308308 * an object of the specified size at the end of the mbuf, longword aligned.
    309309 */
    310 #define M_ALIGN(m, len) \
    311         { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
     310#define M_ALIGN(_m, _len) \
     311        { (_m)->m_data += (MLEN - (_len)) &~ (sizeof(long) - 1); }
    312312/*
    313313 * As above, for mbufs allocated with m_gethdr/MGETHDR
    314314 * or initialized by M_COPY_PKTHDR.
    315315 */
    316 #define MH_ALIGN(m, len) \
    317         { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
     316#define MH_ALIGN(_m, _len) \
     317        { (_m)->m_data += (MHLEN - (_len)) &~ (sizeof(long) - 1); }
    318318
    319319/*
     
    321321 * before the current start of data in an mbuf.
    322322 */
    323 #define M_LEADINGSPACE(m) \
    324         ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
    325             (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
    326             (m)->m_data - (m)->m_dat)
     323#define M_LEADINGSPACE(_m) \
     324        ((_m)->m_flags & M_EXT ? /* (_m)->m_data - (_m)->m_ext.ext_buf */ 0 : \
     325            (_m)->m_flags & M_PKTHDR ? (_m)->m_data - (_m)->m_pktdat : \
     326            (_m)->m_data - (_m)->m_dat)
    327327
    328328/*
     
    330330 * after the end of data in an mbuf.
    331331 */
    332 #define M_TRAILINGSPACE(m) \
    333         ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
    334             ((m)->m_data + (m)->m_len) : \
    335             &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
     332#define M_TRAILINGSPACE(_m) \
     333        ((_m)->m_flags & M_EXT ? (_m)->m_ext.ext_buf + (_m)->m_ext.ext_size - \
     334            ((_m)->m_data + (_m)->m_len) : \
     335            &(_m)->m_dat[MLEN] - ((_m)->m_data + (_m)->m_len))
    336336
    337337/*
     
    341341 * is freed and m is set to NULL.
    342342 */
    343 #define M_PREPEND(m, plen, how) { \
    344         if (M_LEADINGSPACE(m) >= (plen)) { \
    345                 (m)->m_data -= (plen); \
    346                 (m)->m_len += (plen); \
     343#define M_PREPEND(_m, _plen, _how) { \
     344        if (M_LEADINGSPACE(_m) >= (_plen)) { \
     345                (_m)->m_data -= (_plen); \
     346                (_m)->m_len += (_plen); \
    347347        } else \
    348                 (m) = m_prepend((m), (plen), (how)); \
    349         if ((m) && (m)->m_flags & M_PKTHDR) \
    350                 (m)->m_pkthdr.len += (plen); \
     348                (_m) = m_prepend((_m), (_plen), (_how)); \
     349        if ((_m) && (_m)->m_flags & M_PKTHDR) \
     350                (_m)->m_pkthdr.len += (_plen); \
    351351}
    352352
    353353/* change mbuf to new type */
    354 #define MCHTYPE(m, t) { \
    355         MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
    356         (m)->m_type = t;\
     354#define MCHTYPE(_m, _t) { \
     355        MBUFLOCK(mbstat.m_mtypes[(_m)->m_type]--; mbstat.m_mtypes[t]++;) \
     356        (_m)->m_type = t;\
    357357}
    358358
  • c/src/lib/libnetworking/sys/mbuf.h

    r0e94e3b3 r7b158663  
    171171 * drivers.
    172172 */
    173 #define MBUFLOCK(code) \
     173#define MBUFLOCK(_code) \
    174174        { int ms = splimp(); \
    175           { code } \
     175          { _code } \
    176176          splx(ms); \
    177177        }
     
    187187 * and internal data.
    188188 */
    189 #define MGET(m, how, type) { \
     189#define MGET(_m, _how, _type) { \
    190190          int _ms = splimp(); \
    191191          if (mmbfree == 0) \
    192                 (void)m_mballoc(1, (how)); \
    193           if (((m) = mmbfree) != 0) { \
    194                 mmbfree = (m)->m_next; \
     192                (void)m_mballoc(1, (_how)); \
     193          if (((_m) = mmbfree) != 0) { \
     194                mmbfree = (_m)->m_next; \
    195195                mbstat.m_mtypes[MT_FREE]--; \
    196                 (m)->m_type = (type); \
    197                 mbstat.m_mtypes[type]++; \
    198                 (m)->m_next = (struct mbuf *)NULL; \
    199                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    200                 (m)->m_data = (m)->m_dat; \
    201                 (m)->m_flags = 0; \
     196                (_m)->m_type = (_type); \
     197                mbstat.m_mtypes[_type]++; \
     198                (_m)->m_next = (struct mbuf *)NULL; \
     199                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     200                (_m)->m_data = (_m)->m_dat; \
     201                (_m)->m_flags = 0; \
    202202                splx(_ms); \
    203203        } else { \
    204204                splx(_ms); \
    205                 (m) = m_retry((how), (type)); \
     205                (_m) = m_retry((_how), (_type)); \
    206206        } \
    207207}
    208208
    209 #define MGETHDR(m, how, type) { \
     209#define MGETHDR(_m, _how, _type) { \
    210210          int _ms = splimp(); \
    211211          if (mmbfree == 0) \
    212                 (void)m_mballoc(1, (how)); \
    213           if (((m) = mmbfree) != 0) { \
    214                 mmbfree = (m)->m_next; \
     212                (void)m_mballoc(1, (_how)); \
     213          if (((_m) = mmbfree) != 0) { \
     214                mmbfree = (_m)->m_next; \
    215215                mbstat.m_mtypes[MT_FREE]--; \
    216                 (m)->m_type = (type); \
    217                 mbstat.m_mtypes[type]++; \
    218                 (m)->m_next = (struct mbuf *)NULL; \
    219                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    220                 (m)->m_data = (m)->m_pktdat; \
    221                 (m)->m_flags = M_PKTHDR; \
     216                (_m)->m_type = (_type); \
     217                mbstat.m_mtypes[_type]++; \
     218                (_m)->m_next = (struct mbuf *)NULL; \
     219                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     220                (_m)->m_data = (_m)->m_pktdat; \
     221                (_m)->m_flags = M_PKTHDR; \
    222222                splx(_ms); \
    223223        } else { \
    224224                splx(_ms); \
    225                 (m) = m_retryhdr((how), (type)); \
     225                (_m) = m_retryhdr((_how), (_type)); \
    226226        } \
    227227}
     
    235235 * freeing the cluster if the reference count has reached 0.
    236236 */
    237 #define MCLALLOC(p, how) \
     237#define MCLALLOC(_p, _how) \
    238238        MBUFLOCK( \
    239239          if (mclfree == 0) \
    240                 (void)m_clalloc(1, (how)); \
    241           if (((p) = (caddr_t)mclfree) != 0) { \
    242                 ++mclrefcnt[mtocl(p)]; \
     240                (void)m_clalloc(1, (_how)); \
     241          if (((_p) = (caddr_t)mclfree) != 0) { \
     242                ++mclrefcnt[mtocl(_p)]; \
    243243                mbstat.m_clfree--; \
    244                 mclfree = ((union mcluster *)(p))->mcl_next; \
     244                mclfree = ((union mcluster *)(_p))->mcl_next; \
    245245          } \
    246246        )
    247247
    248 #define MCLGET(m, how) \
    249         { MCLALLOC((m)->m_ext.ext_buf, (how)); \
    250           if ((m)->m_ext.ext_buf != NULL) { \
    251                 (m)->m_data = (m)->m_ext.ext_buf; \
    252                 (m)->m_flags |= M_EXT; \
    253                 (m)->m_ext.ext_free = NULL;  \
    254                 (m)->m_ext.ext_ref = NULL;  \
    255                 (m)->m_ext.ext_size = MCLBYTES;  \
     248#define MCLGET(_m, _how) \
     249        { MCLALLOC((_m)->m_ext.ext_buf, (_how)); \
     250          if ((_m)->m_ext.ext_buf != NULL) { \
     251                (_m)->m_data = (_m)->m_ext.ext_buf; \
     252                (_m)->m_flags |= M_EXT; \
     253                (_m)->m_ext.ext_free = NULL;  \
     254                (_m)->m_ext.ext_ref = NULL;  \
     255                (_m)->m_ext.ext_size = MCLBYTES;  \
    256256          } \
    257257        }
    258258
    259 #define MCLFREE(p) \
     259#define MCLFREE(_p) \
    260260        MBUFLOCK ( \
    261           if (--mclrefcnt[mtocl(p)] == 0) { \
    262                 ((union mcluster *)(p))->mcl_next = mclfree; \
    263                 mclfree = (union mcluster *)(p); \
     261          if (--mclrefcnt[mtocl(_p)] == 0) { \
     262                ((union mcluster *)(_p))->mcl_next = mclfree; \
     263                mclfree = (union mcluster *)(_p); \
    264264                mbstat.m_clfree++; \
    265265          } \
     
    271271 * Place the successor, if any, in n.
    272272 */
    273 #define MFREE(m, n) \
     273#define MFREE(_m, _n) \
    274274        MBUFLOCK(  \
    275           mbstat.m_mtypes[(m)->m_type]--; \
    276           if ((m)->m_flags & M_EXT) { \
    277                 if ((m)->m_ext.ext_free) \
    278                         (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
    279                             (m)->m_ext.ext_size); \
     275          mbstat.m_mtypes[(_m)->m_type]--; \
     276          if ((_m)->m_flags & M_EXT) { \
     277                if ((_m)->m_ext.ext_free) \
     278                        (*((_m)->m_ext.ext_free))((_m)->m_ext.ext_buf, \
     279                            (_m)->m_ext.ext_size); \
    280280                else { \
    281                         char *p = (m)->m_ext.ext_buf; \
     281                        char *p = (_m)->m_ext.ext_buf; \
    282282                        if (--mclrefcnt[mtocl(p)] == 0) { \
    283283                                ((union mcluster *)(p))->mcl_next = mclfree; \
     
    287287                } \
    288288          } \
    289           (n) = (m)->m_next; \
    290           (m)->m_type = MT_FREE; \
     289          (_n) = (_m)->m_next; \
     290          (_m)->m_type = MT_FREE; \
    291291          mbstat.m_mtypes[MT_FREE]++; \
    292           (m)->m_next = mmbfree; \
    293           mmbfree = (m); \
     292          (_m)->m_next = mmbfree; \
     293          mmbfree = (_m); \
    294294        )
    295295
     
    298298 * from must have M_PKTHDR set, and to must be empty.
    299299 */
    300 #define M_COPY_PKTHDR(to, from) { \
    301         (to)->m_pkthdr = (from)->m_pkthdr; \
    302         (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
    303         (to)->m_data = (to)->m_pktdat; \
     300#define M_COPY_PKTHDR(_to, _from) { \
     301        (_to)->m_pkthdr = (_from)->m_pkthdr; \
     302        (_to)->m_flags = (_from)->m_flags & M_COPYFLAGS; \
     303        (_to)->m_data = (_to)->m_pktdat; \
    304304}
    305305
     
    308308 * an object of the specified size at the end of the mbuf, longword aligned.
    309309 */
    310 #define M_ALIGN(m, len) \
    311         { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
     310#define M_ALIGN(_m, _len) \
     311        { (_m)->m_data += (MLEN - (_len)) &~ (sizeof(long) - 1); }
    312312/*
    313313 * As above, for mbufs allocated with m_gethdr/MGETHDR
    314314 * or initialized by M_COPY_PKTHDR.
    315315 */
    316 #define MH_ALIGN(m, len) \
    317         { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
     316#define MH_ALIGN(_m, _len) \
     317        { (_m)->m_data += (MHLEN - (_len)) &~ (sizeof(long) - 1); }
    318318
    319319/*
     
    321321 * before the current start of data in an mbuf.
    322322 */
    323 #define M_LEADINGSPACE(m) \
    324         ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
    325             (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
    326             (m)->m_data - (m)->m_dat)
     323#define M_LEADINGSPACE(_m) \
     324        ((_m)->m_flags & M_EXT ? /* (_m)->m_data - (_m)->m_ext.ext_buf */ 0 : \
     325            (_m)->m_flags & M_PKTHDR ? (_m)->m_data - (_m)->m_pktdat : \
     326            (_m)->m_data - (_m)->m_dat)
    327327
    328328/*
     
    330330 * after the end of data in an mbuf.
    331331 */
    332 #define M_TRAILINGSPACE(m) \
    333         ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
    334             ((m)->m_data + (m)->m_len) : \
    335             &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
     332#define M_TRAILINGSPACE(_m) \
     333        ((_m)->m_flags & M_EXT ? (_m)->m_ext.ext_buf + (_m)->m_ext.ext_size - \
     334            ((_m)->m_data + (_m)->m_len) : \
     335            &(_m)->m_dat[MLEN] - ((_m)->m_data + (_m)->m_len))
    336336
    337337/*
     
    341341 * is freed and m is set to NULL.
    342342 */
    343 #define M_PREPEND(m, plen, how) { \
    344         if (M_LEADINGSPACE(m) >= (plen)) { \
    345                 (m)->m_data -= (plen); \
    346                 (m)->m_len += (plen); \
     343#define M_PREPEND(_m, _plen, _how) { \
     344        if (M_LEADINGSPACE(_m) >= (_plen)) { \
     345                (_m)->m_data -= (_plen); \
     346                (_m)->m_len += (_plen); \
    347347        } else \
    348                 (m) = m_prepend((m), (plen), (how)); \
    349         if ((m) && (m)->m_flags & M_PKTHDR) \
    350                 (m)->m_pkthdr.len += (plen); \
     348                (_m) = m_prepend((_m), (_plen), (_how)); \
     349        if ((_m) && (_m)->m_flags & M_PKTHDR) \
     350                (_m)->m_pkthdr.len += (_plen); \
    351351}
    352352
    353353/* change mbuf to new type */
    354 #define MCHTYPE(m, t) { \
    355         MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
    356         (m)->m_type = t;\
     354#define MCHTYPE(_m, _t) { \
     355        MBUFLOCK(mbstat.m_mtypes[(_m)->m_type]--; mbstat.m_mtypes[t]++;) \
     356        (_m)->m_type = t;\
    357357}
    358358
  • c/src/libnetworking/sys/mbuf.h

    r0e94e3b3 r7b158663  
    171171 * drivers.
    172172 */
    173 #define MBUFLOCK(code) \
     173#define MBUFLOCK(_code) \
    174174        { int ms = splimp(); \
    175           { code } \
     175          { _code } \
    176176          splx(ms); \
    177177        }
     
    187187 * and internal data.
    188188 */
    189 #define MGET(m, how, type) { \
     189#define MGET(_m, _how, _type) { \
    190190          int _ms = splimp(); \
    191191          if (mmbfree == 0) \
    192                 (void)m_mballoc(1, (how)); \
    193           if (((m) = mmbfree) != 0) { \
    194                 mmbfree = (m)->m_next; \
     192                (void)m_mballoc(1, (_how)); \
     193          if (((_m) = mmbfree) != 0) { \
     194                mmbfree = (_m)->m_next; \
    195195                mbstat.m_mtypes[MT_FREE]--; \
    196                 (m)->m_type = (type); \
    197                 mbstat.m_mtypes[type]++; \
    198                 (m)->m_next = (struct mbuf *)NULL; \
    199                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    200                 (m)->m_data = (m)->m_dat; \
    201                 (m)->m_flags = 0; \
     196                (_m)->m_type = (_type); \
     197                mbstat.m_mtypes[_type]++; \
     198                (_m)->m_next = (struct mbuf *)NULL; \
     199                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     200                (_m)->m_data = (_m)->m_dat; \
     201                (_m)->m_flags = 0; \
    202202                splx(_ms); \
    203203        } else { \
    204204                splx(_ms); \
    205                 (m) = m_retry((how), (type)); \
     205                (_m) = m_retry((_how), (_type)); \
    206206        } \
    207207}
    208208
    209 #define MGETHDR(m, how, type) { \
     209#define MGETHDR(_m, _how, _type) { \
    210210          int _ms = splimp(); \
    211211          if (mmbfree == 0) \
    212                 (void)m_mballoc(1, (how)); \
    213           if (((m) = mmbfree) != 0) { \
    214                 mmbfree = (m)->m_next; \
     212                (void)m_mballoc(1, (_how)); \
     213          if (((_m) = mmbfree) != 0) { \
     214                mmbfree = (_m)->m_next; \
    215215                mbstat.m_mtypes[MT_FREE]--; \
    216                 (m)->m_type = (type); \
    217                 mbstat.m_mtypes[type]++; \
    218                 (m)->m_next = (struct mbuf *)NULL; \
    219                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    220                 (m)->m_data = (m)->m_pktdat; \
    221                 (m)->m_flags = M_PKTHDR; \
     216                (_m)->m_type = (_type); \
     217                mbstat.m_mtypes[_type]++; \
     218                (_m)->m_next = (struct mbuf *)NULL; \
     219                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     220                (_m)->m_data = (_m)->m_pktdat; \
     221                (_m)->m_flags = M_PKTHDR; \
    222222                splx(_ms); \
    223223        } else { \
    224224                splx(_ms); \
    225                 (m) = m_retryhdr((how), (type)); \
     225                (_m) = m_retryhdr((_how), (_type)); \
    226226        } \
    227227}
     
    235235 * freeing the cluster if the reference count has reached 0.
    236236 */
    237 #define MCLALLOC(p, how) \
     237#define MCLALLOC(_p, _how) \
    238238        MBUFLOCK( \
    239239          if (mclfree == 0) \
    240                 (void)m_clalloc(1, (how)); \
    241           if (((p) = (caddr_t)mclfree) != 0) { \
    242                 ++mclrefcnt[mtocl(p)]; \
     240                (void)m_clalloc(1, (_how)); \
     241          if (((_p) = (caddr_t)mclfree) != 0) { \
     242                ++mclrefcnt[mtocl(_p)]; \
    243243                mbstat.m_clfree--; \
    244                 mclfree = ((union mcluster *)(p))->mcl_next; \
     244                mclfree = ((union mcluster *)(_p))->mcl_next; \
    245245          } \
    246246        )
    247247
    248 #define MCLGET(m, how) \
    249         { MCLALLOC((m)->m_ext.ext_buf, (how)); \
    250           if ((m)->m_ext.ext_buf != NULL) { \
    251                 (m)->m_data = (m)->m_ext.ext_buf; \
    252                 (m)->m_flags |= M_EXT; \
    253                 (m)->m_ext.ext_free = NULL;  \
    254                 (m)->m_ext.ext_ref = NULL;  \
    255                 (m)->m_ext.ext_size = MCLBYTES;  \
     248#define MCLGET(_m, _how) \
     249        { MCLALLOC((_m)->m_ext.ext_buf, (_how)); \
     250          if ((_m)->m_ext.ext_buf != NULL) { \
     251                (_m)->m_data = (_m)->m_ext.ext_buf; \
     252                (_m)->m_flags |= M_EXT; \
     253                (_m)->m_ext.ext_free = NULL;  \
     254                (_m)->m_ext.ext_ref = NULL;  \
     255                (_m)->m_ext.ext_size = MCLBYTES;  \
    256256          } \
    257257        }
    258258
    259 #define MCLFREE(p) \
     259#define MCLFREE(_p) \
    260260        MBUFLOCK ( \
    261           if (--mclrefcnt[mtocl(p)] == 0) { \
    262                 ((union mcluster *)(p))->mcl_next = mclfree; \
    263                 mclfree = (union mcluster *)(p); \
     261          if (--mclrefcnt[mtocl(_p)] == 0) { \
     262                ((union mcluster *)(_p))->mcl_next = mclfree; \
     263                mclfree = (union mcluster *)(_p); \
    264264                mbstat.m_clfree++; \
    265265          } \
     
    271271 * Place the successor, if any, in n.
    272272 */
    273 #define MFREE(m, n) \
     273#define MFREE(_m, _n) \
    274274        MBUFLOCK(  \
    275           mbstat.m_mtypes[(m)->m_type]--; \
    276           if ((m)->m_flags & M_EXT) { \
    277                 if ((m)->m_ext.ext_free) \
    278                         (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
    279                             (m)->m_ext.ext_size); \
     275          mbstat.m_mtypes[(_m)->m_type]--; \
     276          if ((_m)->m_flags & M_EXT) { \
     277                if ((_m)->m_ext.ext_free) \
     278                        (*((_m)->m_ext.ext_free))((_m)->m_ext.ext_buf, \
     279                            (_m)->m_ext.ext_size); \
    280280                else { \
    281                         char *p = (m)->m_ext.ext_buf; \
     281                        char *p = (_m)->m_ext.ext_buf; \
    282282                        if (--mclrefcnt[mtocl(p)] == 0) { \
    283283                                ((union mcluster *)(p))->mcl_next = mclfree; \
     
    287287                } \
    288288          } \
    289           (n) = (m)->m_next; \
    290           (m)->m_type = MT_FREE; \
     289          (_n) = (_m)->m_next; \
     290          (_m)->m_type = MT_FREE; \
    291291          mbstat.m_mtypes[MT_FREE]++; \
    292           (m)->m_next = mmbfree; \
    293           mmbfree = (m); \
     292          (_m)->m_next = mmbfree; \
     293          mmbfree = (_m); \
    294294        )
    295295
     
    298298 * from must have M_PKTHDR set, and to must be empty.
    299299 */
    300 #define M_COPY_PKTHDR(to, from) { \
    301         (to)->m_pkthdr = (from)->m_pkthdr; \
    302         (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
    303         (to)->m_data = (to)->m_pktdat; \
     300#define M_COPY_PKTHDR(_to, _from) { \
     301        (_to)->m_pkthdr = (_from)->m_pkthdr; \
     302        (_to)->m_flags = (_from)->m_flags & M_COPYFLAGS; \
     303        (_to)->m_data = (_to)->m_pktdat; \
    304304}
    305305
     
    308308 * an object of the specified size at the end of the mbuf, longword aligned.
    309309 */
    310 #define M_ALIGN(m, len) \
    311         { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
     310#define M_ALIGN(_m, _len) \
     311        { (_m)->m_data += (MLEN - (_len)) &~ (sizeof(long) - 1); }
    312312/*
    313313 * As above, for mbufs allocated with m_gethdr/MGETHDR
    314314 * or initialized by M_COPY_PKTHDR.
    315315 */
    316 #define MH_ALIGN(m, len) \
    317         { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
     316#define MH_ALIGN(_m, _len) \
     317        { (_m)->m_data += (MHLEN - (_len)) &~ (sizeof(long) - 1); }
    318318
    319319/*
     
    321321 * before the current start of data in an mbuf.
    322322 */
    323 #define M_LEADINGSPACE(m) \
    324         ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
    325             (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
    326             (m)->m_data - (m)->m_dat)
     323#define M_LEADINGSPACE(_m) \
     324        ((_m)->m_flags & M_EXT ? /* (_m)->m_data - (_m)->m_ext.ext_buf */ 0 : \
     325            (_m)->m_flags & M_PKTHDR ? (_m)->m_data - (_m)->m_pktdat : \
     326            (_m)->m_data - (_m)->m_dat)
    327327
    328328/*
     
    330330 * after the end of data in an mbuf.
    331331 */
    332 #define M_TRAILINGSPACE(m) \
    333         ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
    334             ((m)->m_data + (m)->m_len) : \
    335             &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
     332#define M_TRAILINGSPACE(_m) \
     333        ((_m)->m_flags & M_EXT ? (_m)->m_ext.ext_buf + (_m)->m_ext.ext_size - \
     334            ((_m)->m_data + (_m)->m_len) : \
     335            &(_m)->m_dat[MLEN] - ((_m)->m_data + (_m)->m_len))
    336336
    337337/*
     
    341341 * is freed and m is set to NULL.
    342342 */
    343 #define M_PREPEND(m, plen, how) { \
    344         if (M_LEADINGSPACE(m) >= (plen)) { \
    345                 (m)->m_data -= (plen); \
    346                 (m)->m_len += (plen); \
     343#define M_PREPEND(_m, _plen, _how) { \
     344        if (M_LEADINGSPACE(_m) >= (_plen)) { \
     345                (_m)->m_data -= (_plen); \
     346                (_m)->m_len += (_plen); \
    347347        } else \
    348                 (m) = m_prepend((m), (plen), (how)); \
    349         if ((m) && (m)->m_flags & M_PKTHDR) \
    350                 (m)->m_pkthdr.len += (plen); \
     348                (_m) = m_prepend((_m), (_plen), (_how)); \
     349        if ((_m) && (_m)->m_flags & M_PKTHDR) \
     350                (_m)->m_pkthdr.len += (_plen); \
    351351}
    352352
    353353/* change mbuf to new type */
    354 #define MCHTYPE(m, t) { \
    355         MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
    356         (m)->m_type = t;\
     354#define MCHTYPE(_m, _t) { \
     355        MBUFLOCK(mbstat.m_mtypes[(_m)->m_type]--; mbstat.m_mtypes[t]++;) \
     356        (_m)->m_type = t;\
    357357}
    358358
  • cpukit/libnetworking/sys/mbuf.h

    r0e94e3b3 r7b158663  
    171171 * drivers.
    172172 */
    173 #define MBUFLOCK(code) \
     173#define MBUFLOCK(_code) \
    174174        { int ms = splimp(); \
    175           { code } \
     175          { _code } \
    176176          splx(ms); \
    177177        }
     
    187187 * and internal data.
    188188 */
    189 #define MGET(m, how, type) { \
     189#define MGET(_m, _how, _type) { \
    190190          int _ms = splimp(); \
    191191          if (mmbfree == 0) \
    192                 (void)m_mballoc(1, (how)); \
    193           if (((m) = mmbfree) != 0) { \
    194                 mmbfree = (m)->m_next; \
     192                (void)m_mballoc(1, (_how)); \
     193          if (((_m) = mmbfree) != 0) { \
     194                mmbfree = (_m)->m_next; \
    195195                mbstat.m_mtypes[MT_FREE]--; \
    196                 (m)->m_type = (type); \
    197                 mbstat.m_mtypes[type]++; \
    198                 (m)->m_next = (struct mbuf *)NULL; \
    199                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    200                 (m)->m_data = (m)->m_dat; \
    201                 (m)->m_flags = 0; \
     196                (_m)->m_type = (_type); \
     197                mbstat.m_mtypes[_type]++; \
     198                (_m)->m_next = (struct mbuf *)NULL; \
     199                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     200                (_m)->m_data = (_m)->m_dat; \
     201                (_m)->m_flags = 0; \
    202202                splx(_ms); \
    203203        } else { \
    204204                splx(_ms); \
    205                 (m) = m_retry((how), (type)); \
     205                (_m) = m_retry((_how), (_type)); \
    206206        } \
    207207}
    208208
    209 #define MGETHDR(m, how, type) { \
     209#define MGETHDR(_m, _how, _type) { \
    210210          int _ms = splimp(); \
    211211          if (mmbfree == 0) \
    212                 (void)m_mballoc(1, (how)); \
    213           if (((m) = mmbfree) != 0) { \
    214                 mmbfree = (m)->m_next; \
     212                (void)m_mballoc(1, (_how)); \
     213          if (((_m) = mmbfree) != 0) { \
     214                mmbfree = (_m)->m_next; \
    215215                mbstat.m_mtypes[MT_FREE]--; \
    216                 (m)->m_type = (type); \
    217                 mbstat.m_mtypes[type]++; \
    218                 (m)->m_next = (struct mbuf *)NULL; \
    219                 (m)->m_nextpkt = (struct mbuf *)NULL; \
    220                 (m)->m_data = (m)->m_pktdat; \
    221                 (m)->m_flags = M_PKTHDR; \
     216                (_m)->m_type = (_type); \
     217                mbstat.m_mtypes[_type]++; \
     218                (_m)->m_next = (struct mbuf *)NULL; \
     219                (_m)->m_nextpkt = (struct mbuf *)NULL; \
     220                (_m)->m_data = (_m)->m_pktdat; \
     221                (_m)->m_flags = M_PKTHDR; \
    222222                splx(_ms); \
    223223        } else { \
    224224                splx(_ms); \
    225                 (m) = m_retryhdr((how), (type)); \
     225                (_m) = m_retryhdr((_how), (_type)); \
    226226        } \
    227227}
     
    235235 * freeing the cluster if the reference count has reached 0.
    236236 */
    237 #define MCLALLOC(p, how) \
     237#define MCLALLOC(_p, _how) \
    238238        MBUFLOCK( \
    239239          if (mclfree == 0) \
    240                 (void)m_clalloc(1, (how)); \
    241           if (((p) = (caddr_t)mclfree) != 0) { \
    242                 ++mclrefcnt[mtocl(p)]; \
     240                (void)m_clalloc(1, (_how)); \
     241          if (((_p) = (caddr_t)mclfree) != 0) { \
     242                ++mclrefcnt[mtocl(_p)]; \
    243243                mbstat.m_clfree--; \
    244                 mclfree = ((union mcluster *)(p))->mcl_next; \
     244                mclfree = ((union mcluster *)(_p))->mcl_next; \
    245245          } \
    246246        )
    247247
    248 #define MCLGET(m, how) \
    249         { MCLALLOC((m)->m_ext.ext_buf, (how)); \
    250           if ((m)->m_ext.ext_buf != NULL) { \
    251                 (m)->m_data = (m)->m_ext.ext_buf; \
    252                 (m)->m_flags |= M_EXT; \
    253                 (m)->m_ext.ext_free = NULL;  \
    254                 (m)->m_ext.ext_ref = NULL;  \
    255                 (m)->m_ext.ext_size = MCLBYTES;  \
     248#define MCLGET(_m, _how) \
     249        { MCLALLOC((_m)->m_ext.ext_buf, (_how)); \
     250          if ((_m)->m_ext.ext_buf != NULL) { \
     251                (_m)->m_data = (_m)->m_ext.ext_buf; \
     252                (_m)->m_flags |= M_EXT; \
     253                (_m)->m_ext.ext_free = NULL;  \
     254                (_m)->m_ext.ext_ref = NULL;  \
     255                (_m)->m_ext.ext_size = MCLBYTES;  \
    256256          } \
    257257        }
    258258
    259 #define MCLFREE(p) \
     259#define MCLFREE(_p) \
    260260        MBUFLOCK ( \
    261           if (--mclrefcnt[mtocl(p)] == 0) { \
    262                 ((union mcluster *)(p))->mcl_next = mclfree; \
    263                 mclfree = (union mcluster *)(p); \
     261          if (--mclrefcnt[mtocl(_p)] == 0) { \
     262                ((union mcluster *)(_p))->mcl_next = mclfree; \
     263                mclfree = (union mcluster *)(_p); \
    264264                mbstat.m_clfree++; \
    265265          } \
     
    271271 * Place the successor, if any, in n.
    272272 */
    273 #define MFREE(m, n) \
     273#define MFREE(_m, _n) \
    274274        MBUFLOCK(  \
    275           mbstat.m_mtypes[(m)->m_type]--; \
    276           if ((m)->m_flags & M_EXT) { \
    277                 if ((m)->m_ext.ext_free) \
    278                         (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \
    279                             (m)->m_ext.ext_size); \
     275          mbstat.m_mtypes[(_m)->m_type]--; \
     276          if ((_m)->m_flags & M_EXT) { \
     277                if ((_m)->m_ext.ext_free) \
     278                        (*((_m)->m_ext.ext_free))((_m)->m_ext.ext_buf, \
     279                            (_m)->m_ext.ext_size); \
    280280                else { \
    281                         char *p = (m)->m_ext.ext_buf; \
     281                        char *p = (_m)->m_ext.ext_buf; \
    282282                        if (--mclrefcnt[mtocl(p)] == 0) { \
    283283                                ((union mcluster *)(p))->mcl_next = mclfree; \
     
    287287                } \
    288288          } \
    289           (n) = (m)->m_next; \
    290           (m)->m_type = MT_FREE; \
     289          (_n) = (_m)->m_next; \
     290          (_m)->m_type = MT_FREE; \
    291291          mbstat.m_mtypes[MT_FREE]++; \
    292           (m)->m_next = mmbfree; \
    293           mmbfree = (m); \
     292          (_m)->m_next = mmbfree; \
     293          mmbfree = (_m); \
    294294        )
    295295
     
    298298 * from must have M_PKTHDR set, and to must be empty.
    299299 */
    300 #define M_COPY_PKTHDR(to, from) { \
    301         (to)->m_pkthdr = (from)->m_pkthdr; \
    302         (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
    303         (to)->m_data = (to)->m_pktdat; \
     300#define M_COPY_PKTHDR(_to, _from) { \
     301        (_to)->m_pkthdr = (_from)->m_pkthdr; \
     302        (_to)->m_flags = (_from)->m_flags & M_COPYFLAGS; \
     303        (_to)->m_data = (_to)->m_pktdat; \
    304304}
    305305
     
    308308 * an object of the specified size at the end of the mbuf, longword aligned.
    309309 */
    310 #define M_ALIGN(m, len) \
    311         { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
     310#define M_ALIGN(_m, _len) \
     311        { (_m)->m_data += (MLEN - (_len)) &~ (sizeof(long) - 1); }
    312312/*
    313313 * As above, for mbufs allocated with m_gethdr/MGETHDR
    314314 * or initialized by M_COPY_PKTHDR.
    315315 */
    316 #define MH_ALIGN(m, len) \
    317         { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
     316#define MH_ALIGN(_m, _len) \
     317        { (_m)->m_data += (MHLEN - (_len)) &~ (sizeof(long) - 1); }
    318318
    319319/*
     
    321321 * before the current start of data in an mbuf.
    322322 */
    323 #define M_LEADINGSPACE(m) \
    324         ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
    325             (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
    326             (m)->m_data - (m)->m_dat)
     323#define M_LEADINGSPACE(_m) \
     324        ((_m)->m_flags & M_EXT ? /* (_m)->m_data - (_m)->m_ext.ext_buf */ 0 : \
     325            (_m)->m_flags & M_PKTHDR ? (_m)->m_data - (_m)->m_pktdat : \
     326            (_m)->m_data - (_m)->m_dat)
    327327
    328328/*
     
    330330 * after the end of data in an mbuf.
    331331 */
    332 #define M_TRAILINGSPACE(m) \
    333         ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
    334             ((m)->m_data + (m)->m_len) : \
    335             &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
     332#define M_TRAILINGSPACE(_m) \
     333        ((_m)->m_flags & M_EXT ? (_m)->m_ext.ext_buf + (_m)->m_ext.ext_size - \
     334            ((_m)->m_data + (_m)->m_len) : \
     335            &(_m)->m_dat[MLEN] - ((_m)->m_data + (_m)->m_len))
    336336
    337337/*
     
    341341 * is freed and m is set to NULL.
    342342 */
    343 #define M_PREPEND(m, plen, how) { \
    344         if (M_LEADINGSPACE(m) >= (plen)) { \
    345                 (m)->m_data -= (plen); \
    346                 (m)->m_len += (plen); \
     343#define M_PREPEND(_m, _plen, _how) { \
     344        if (M_LEADINGSPACE(_m) >= (_plen)) { \
     345                (_m)->m_data -= (_plen); \
     346                (_m)->m_len += (_plen); \
    347347        } else \
    348                 (m) = m_prepend((m), (plen), (how)); \
    349         if ((m) && (m)->m_flags & M_PKTHDR) \
    350                 (m)->m_pkthdr.len += (plen); \
     348                (_m) = m_prepend((_m), (_plen), (_how)); \
     349        if ((_m) && (_m)->m_flags & M_PKTHDR) \
     350                (_m)->m_pkthdr.len += (_plen); \
    351351}
    352352
    353353/* change mbuf to new type */
    354 #define MCHTYPE(m, t) { \
    355         MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
    356         (m)->m_type = t;\
     354#define MCHTYPE(_m, _t) { \
     355        MBUFLOCK(mbstat.m_mtypes[(_m)->m_type]--; mbstat.m_mtypes[t]++;) \
     356        (_m)->m_type = t;\
    357357}
    358358
Note: See TracChangeset for help on using the changeset viewer.