SHOW:
|
|
- or go back to the newest paste.
| 1 | Index: mbuf.9 | |
| 2 | =================================================================== | |
| 3 | --- mbuf.9 (revision 260701) | |
| 4 | +++ mbuf.9 (working copy) | |
| 5 | @@ -72,8 +72,10 @@ | |
| 6 | .Ft struct mbuf * | |
| 7 | .Fn m_get "int how" "int type" | |
| 8 | .Ft struct mbuf * | |
| 9 | -.Fn m_getm "struct mbuf *orig" "int len" "int how" "int type" | |
| 10 | - | +.Fn m_getm "struct mbuf *orig" "int len" "int how" "short type" |
| 10 | + | +.Fn m_getm "struct mbuf *m" "int len" "int how" "short type" |
| 11 | .Ft struct mbuf * | |
| 12 | +.Fn m_getm2 "struct mbuf *m" "int len" "int how" "short type" "int flags" | |
| 13 | +.Ft struct mbuf * | |
| 14 | .Fn m_getcl "int how" "short type" "int flags" | |
| 15 | .Ft struct mbuf * | |
| 16 | .Fn m_getclr "int how" "int type" | |
| 17 | @@ -136,6 +138,8 @@ | |
| 18 | .Ft struct mbuf * | |
| 19 | .Fn m_defrag "struct mbuf *m0" "int how" | |
| 20 | .Ft struct mbuf * | |
| 21 | +.Fn m_collapse "struct mbuf *m0" "int how" "int maxfrags" | |
| 22 | +.Ft struct mbuf * | |
| 23 | .Fn m_unshare "struct mbuf *m0" "int how" | |
| 24 | .\" | |
| 25 | .Sh DESCRIPTION | |
| 26 | - | @@ -574,6 +578,14 @@ |
| 26 | + | @@ -538,7 +542,15 @@ |
| 27 | A function version of | |
| 28 | .Fn MGET | |
| 29 | - | allocation. |
| 29 | + | for non-critical paths. |
| 30 | -.It Fn m_getm orig len how type | |
| 31 | - | +A version of |
| 31 | + | +.It Fn m_getm m len how type |
| 32 | - | +.Fn m_getm |
| 32 | + | +A wrapper macro for |
| 33 | - | +that allows specific |
| 33 | + | +.Fn m_getm2 |
| 34 | +specifying | |
| 35 | - | +to be set, e.g. when |
| 35 | + | +.Dv M_PKTHDR |
| 36 | - | +.Vt M_PKTHDR |
| 36 | + | +as the |
| 37 | - | +is not desired. |
| 37 | + | |
| 38 | +parameter. | |
| 39 | +.It Fn m_getm2 m len how type flags | |
| 40 | Allocate | |
| 41 | - | @@ -973,8 +985,19 @@ |
| 41 | + | .Fa len |
| 42 | bytes worth of | |
| 43 | @@ -549,7 +561,7 @@ | |
| 44 | .Vt mbuf chain | |
| 45 | to the | |
| 46 | .Vt mbuf chain | |
| 47 | - | +certain long |
| 47 | + | -.Fa orig , |
| 48 | +.Fa m , | |
| 49 | if it is | |
| 50 | .No non- Ns Dv NULL . | |
| 51 | If the allocation fails at any point, | |
| 52 | @@ -556,12 +568,12 @@ | |
| 53 | free whatever was allocated and return | |
| 54 | .Dv NULL . | |
| 55 | - | +If this is not possible |
| 55 | + | If |
| 56 | -.Fa orig | |
| 57 | - | +is returned and the original |
| 57 | + | +.Fa m |
| 58 | is | |
| 59 | .No non- Ns Dv NULL , | |
| 60 | it will not be freed. | |
| 61 | It is possible to use | |
| 62 | -.Fn m_getm | |
| 63 | +.Fn m_getm2 | |
| 64 | to either append | |
| 65 | .Fa len | |
| 66 | bytes to an existing | |
| 67 | @@ -573,7 +585,19 @@ | |
| 68 | .Vt mbuf | |
| 69 | and | |
| 70 | .Vt mbuf cluster | |
| 71 | -allocation. | |
| 72 | +allocation. Valid | |
| 73 | +.Fa flags | |
| 74 | +are | |
| 75 | +.Dv M_PKTHDR | |
| 76 | +and | |
| 77 | +.Dv M_EOR | |
| 78 | +but if | |
| 79 | +.Fa m | |
| 80 | +is | |
| 81 | +.No non- Ns Dv NULL | |
| 82 | +then | |
| 83 | +.Dv M_PKTHDR | |
| 84 | +will be ignored. | |
| 85 | .It Fn m_gethdr how type | |
| 86 | A function version of | |
| 87 | .Fn MGETHDR | |
| 88 | @@ -973,8 +997,19 @@ | |
| 89 | depending on the caller's preference. | |
| 90 | .Pp | |
| 91 | This function is especially useful in network drivers, where | |
| 92 | -certain long mbuf chains must be shortened before being added | |
| 93 | -to TX descriptor lists. | |
| 94 | +certain long | |
| 95 | +.Vt mbuf chains | |
| 96 | +must be shortened before being added to TX descriptor lists. | |
| 97 | +.It Fn m_collapse m0 how maxfrags | |
| 98 | +Collapse an mbuf chain, returning at most | |
| 99 | +.Fa maxfrags | |
| 100 | +separate | |
| 101 | +.Vt mbufs+clusters . | |
| 102 | +If this is not possible | |
| 103 | +.Dv NULL | |
| 104 | +is returned and the original | |
| 105 | +.Vt mbuf chain | |
| 106 | +is left in its present (potentially modified) state. | |
| 107 | .It Fn m_unshare m0 how | |
| 108 | Create a version of the specified mbuf chain whose | |
| 109 | contents can be safely modified without affecting other users. |