* Constructor for Mbuf primary zone. * * The 'arg' pointer points to a mb_args structure which * contains call-specific information required to support the * mbuf allocation API. See mbuf.h. */
| 623 | * mbuf allocation API. See mbuf.h. |
| 624 | */ |
| 625 | static int |
| 626 | mb_ctor_mbuf(void *mem, int size, void *arg, int how) |
| 627 | { |
| 628 | struct mbuf *m; |
| 629 | struct mb_args *args; |
| 630 | int error; |
| 631 | int flags; |
| 632 | short type; |
| 633 | |
| 634 | args = (struct mb_args *)arg; |
| 635 | type = args->type; |
| 636 | |
| 637 | /* |
| 638 | * The mbuf is initialized later. The caller has the |
| 639 | * responsibility to set up any MAC labels too. |
| 640 | */ |
| 641 | if (type == MT_NOINIT) |
| 642 | return (0); |
| 643 | |
| 644 | m = (struct mbuf *)mem; |
| 645 | flags = args->flags; |
| 646 | MPASS((flags & M_NOFREE) == 0); |
| 647 | |
| 648 | error = m_init(m, how, type, flags); |
| 649 | |
| 650 | return (error); |
| 651 | } |
| 652 | |
| 653 | /* |
| 654 | * The Mbuf primary zone destructor. |