name_factory.c revision 18c2aff776a775d34a4c9893a4c72e0434d68e36
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Indexed name factory; creates unique indexed names from base name strings
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vold.h"
/*
* Local include files
*/
#include "name_factory.h"
typedef struct name_rec {
char *symnamep;
int index;
} name_rec_t;
typedef struct indexed_name {
char *namep;
int next_index;
struct indexed_name *nextp;
static indexed_name_t *name_headp;
/*
* Declarations of private functions
*/
static int num_digits(int number);
/*
* Definitions of public functions
*/
void
destroy_name_factory(void)
{
while (this_entryp != NULL) {
}
}
name_headp = NULL;
}
char **indexed_namepp)
{
int name_index, len;
if (base_namep == NULL)
return (NAME_FACTORY_BAD_BASE_NAME);
(void) mutex_lock(&name_factory_mutex);
while (next_entryp != NULL) {
break;
}
break;
}
}
if (next_entryp == NULL) {
}
(void) mutex_unlock(&name_factory_mutex);
return (NAME_FACTORY_SUCCESS);
}
/*
* Definitions of private functions
*/
static name_rec_t *
{
return (recp);
}
static int
num_digits(int number)
{
int number_of_digits;
int dividend;
number_of_digits = 1;
while (dividend > 0) {
}
return (number_of_digits);
}