/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <devid.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <meta.h>
#include <libsvm.h>
#include <svm.h>
/*
* magic strings in system
*/
typedef struct {
char *prop_name;
int prop_val;
} md_prop_t;
typedef enum {
} ftype_t;
{ PROP_KEEP_REPL_STATE, 0 },
{ PROP_DEVID_DESTROY, 0},
{ NULL, 0}
};
/*
* The following functions manage upgrade properties
*/
void
{
upp = &upgrade_props[0];
return;
}
}
}
int
{
upp = &upgrade_props[0];
}
}
return (0);
}
int
{
return (errno);
}
upp = &upgrade_props[0];
rval = RET_SUCCESS;
break;
}
}
return (rval);
}
static int
{
int cnt = 0;
char *cp;
/* there are exactly 3 colons in the string for devid */
break;
}
return (cnt == 3);
}
/*
* FUNCTION: parse_bootlist
* Parse the bootlist and add the extra field to mddb_boolist entry to
* conform to devid changes.
*
* Old format: <drivername>:<minor_number>:<offset>
* New format: <drivername>:<minor_number>:<offset>:<devid>
* Devid of id0 implies no device id.
*
* INPUT: *line - contains the mddb_bootlist
* *tfp - File pointer to the md.conf.tmp file.
*
* RETURN:
* 0 - Success
* > 0 - Failure. Errno returned
*/
static int
{
char *cp;
if (line[0] == SYS_COMMENTCHAR) {
output[0] = CONF_COMMENTCHAR;
}
/* move the line start of mddbbootlist */
/* grab the "mddb_boolist" word */
/*
* The line passed in is for example,
* mddb_bootlist1="sd:7:16:id1,sd@SIBM_DDRS34560SUN4.2G2N9688_____/h";
* At this point mddb_bootlist and "=" have been parsed out.
* The remaining string consists of driver name, colon separator and
* the device id(if it exists) within quotes.
* The deviceid string can contain upper and lower letters, digits
* and +-.=_~. Quotes, spaces and \n and \t are not
* allowed. They are converted to either _ or their ascii value.
* So using space,\n,;and quotes as a separator is safe.
*/
if (!is_devid_added(cp)) {
/* append :id0 for devid */
/* no devid => SDS->SLVM migration. Set the flag */
}
}
/* remove the extra space at the end */
}
return (retval);
}
/*
* FUNCTION: snarf_n_modify_bootlist
* The boolist in the temporary file is in device ID format.
*
* INPUT: *fp - file pointer that contains the mddb_bootlist.
* *tname - file into which the modified bootlist will be written to.
* * buf - buffer handed by upper level routine for reading in contents.
* * bufsiz - size of the buffer.
* mddb_file - flag
*
* RETURN:
* 0 - Success
* > 0 - Failure. Errno returned.
*/
static int
char *tname, /* name of the temporary file */
char *buf, /* Buffer to read into */
int bufsz, /* buffer size */
)
{
if (mddb_file == MDDB_MDCONF_FILE) {
}
return (errno);
break;
}
continue;
}
if (cstatus == MD_STR_START) {
break;
}
if (mddb_file == MDDB_MDCONF_FILE)
continue;
else
break;
}
if (rval == RET_SUCCESS)
continue;
else
break;
}
if (mddb_file == MDDB_MDCONF_FILE) {
break;
}
}
} /* while (fgets */
return (rval);
}
/*
* FUNCTION: convert_bootlist
* md.conf.
* to md.conf. Also new fields are added to handle the devid id format.
* A copy of md.conf is created and the new entries are added to it.
* The name of the new file is returned to the calling program.
*
* Input: system file name
* md.conf file name
* pointer to temp file name.
* RETURN:
* *tname - name of the file that has md.conf + new mddb_boolist entries
* 0 - success
* -1 - mddb_bootlist not found
* > 0 - errno
*
*/
int
char *sname, /* system file name */
char **tname /* temp file name */
)
{
/* check names */
/* get temp name */
goto out;
}
debug_printf("convert_bootlist: copy %s %s failed\n",
goto out;
}
} else {
goto out;
}
goto out;
}
}
out:
}
return (retval);
}