/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* I18N message number ranges
* This file: 6000 - 6499
* Shared common messages: 1 - 1999
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/openpromio.h>
/*
* For i18n
*/
#include <stgcom.h>
/*
* 128 is the size of the largest (currently) property name
* 8192 - MAXPROPSIZE - sizeof (int) is the size of the largest
* (currently) property value, viz. nvramrc.
* the sizeof(uint_t) is from struct openpromio
*/
static int getbootdevname(char *, char *);
static int setprom(unsigned, unsigned, char *);
extern int devfs_dev_to_prom_name(char *, char *);
/*
* Call getbootdevname() to get the absolute pathname of boot device
* and call setprom() to set the boot-device variable.
*/
int
{
"Cannot determine device name for %s\n"),
fname);
return (errno);
}
}
/*
* Read the mnttab and resolve the special device of the fs we are
* interested in, into an absolute pathname
*/
static int
{
FILE *f;
char *fname;
char *devname;
struct mnttab m;
int mountpt = 0;
int found = 0;
return (0);
}
case S_IFBLK:
break;
default:
mountpt = 1;
break;
}
if (mountpt) {
if (f == NULL) {
return (0);
}
while (getmntent(f, &m) == 0) {
continue;
else {
found = 1;
break;
}
}
(void) fclose(f);
if (!found) {
return (0);
}
devname = m.mnt_special;
}
return (0);
}
return (1);
}
/*
* it to the new value.
*/
static int
{
int fd;
return (errno);
}
return (errno);
}
return (errno);
}
/*
* save the existing boot-device, so we can use it if setting
* to new value fails.
*/
if (verbose) {
MSGSTR(6005,
"New boot-device = %s\n"), bdev);
}
if (!yes) {
"Do you want to change boot-device "
"to the new setting? (y/n) "));
switch (getchar()) {
case 'Y':
case 'y':
break;
default:
return (0);
}
}
/* set the new value for boot-device */
bdev);
return (errno);
}
/* read back the value that was set */
return (errno);
}
/* could not set the new device name, set the old one back */
"Could not set boot-device, reverting to old value"));
(int)strlen(save_bootdev);
return (errno);
}
}
return (0);
}