inet_common.c revision aa92d85b088543197e9fb4594eb30d5215fca2c1
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * CDDL HEADER START
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * The contents of this file are subject to the terms of the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Common Development and Distribution License (the "License").
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * You may not use this file except in compliance with the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * See the License for the specific language governing permissions
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * and limitations under the License.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * CDDL HEADER END
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Use is subject to license terms.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#pragma ident "%Z%%M% %I% %E% SMI"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Minor number allocation for various protocol modules.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowetypedef struct inet_arena {
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe minor_t ineta_maxminor; /* max minor number in the arena */
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Loweinet_minor_create(char *name, dev_t min_dev, dev_t max_dev, int kmflags)
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe inet_arena_t *arena = kmem_alloc(sizeof (inet_arena_t), kmflags);
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe (void *)min_dev, arena->ineta_maxminor - min_dev + 1,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe 1, NULL, NULL, NULL, 1, kmflags | VMC_IDENTIFIER);
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe return ((dev_t)vmem_alloc(((inet_arena_t *)arena)->ineta_arena,
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe ASSERT((dev != OPENFAIL) && (dev != 0) && (dev <= MAXMIN));
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe vmem_free(((inet_arena_t *)arena)->ineta_arena, (void *)dev, 1);
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * This function is used to free a message that has gone through
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * mi_copyin processing which modifies the M_IOCTL mblk's b_next
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * and b_prev pointers. We use this function to set b_next/b_prev
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * to NULL and free them.