* Change type of the queue entry. * Possibly reallocates it from another UMA zone. */
| 3071 | * Possibly reallocates it from another UMA zone. |
| 3072 | */ |
| 3073 | static __inline item_p |
| 3074 | ng_realloc_item(item_p pitem, int type, int flags) |
| 3075 | { |
| 3076 | item_p item; |
| 3077 | int from, to; |
| 3078 | |
| 3079 | KASSERT((pitem != NULL), ("%s: can't reallocate NULL", __func__)); |
| 3080 | KASSERT(((type & ~NGQF_TYPE) == 0), |
| 3081 | ("%s: incorrect item type: %d", __func__, type)); |
| 3082 | |
| 3083 | from = ((pitem->el_flags & NGQF_TYPE) == NGQF_DATA); |
| 3084 | to = (type == NGQF_DATA); |
| 3085 | if (from != to) { |
| 3086 | /* If reallocation is required do it and copy item. */ |
| 3087 | if ((item = ng_alloc_item(type, flags)) == NULL) { |
| 3088 | ng_free_item(pitem); |
| 3089 | return (NULL); |
| 3090 | } |
| 3091 | *item = *pitem; |
| 3092 | ng_free_item(pitem); |
| 3093 | } else |
| 3094 | item = pitem; |
| 3095 | item->el_flags = (item->el_flags & ~NGQF_TYPE) | type; |
| 3096 | |
| 3097 | return (item); |
| 3098 | } |
| 3099 | |
| 3100 | /************************************************************************ |
| 3101 | Module routines |
no test coverage detected