dsr.c revision 252
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* U.S. Government Rights - Commercial software. Government users are subject
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* to the Sun Microsystems, Inc. standard license agreement and applicable
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* provisions of the FAR and its supplements.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* This distribution may include materials developed by third parties. Sun,
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* Sun Microsystems, the Sun logo and Solaris are trademarks or registered
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy* trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypedef struct nms {
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedystatic void do_snm(char *, char *);
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedystatic int look_up_name(const char *, nms_t *);
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedystatic void make_an_entry(char *, const char *, nms_t **, int);
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedystatic char *trim(char *);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedystatic nms_t *find_str(const char *, nms_t *);
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedystatic void insert_dlist_ent(const char *, const int, const char *,
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedystatic void mk_list_of_disks(nms_t *, disk_list_t **);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedystatic int str_is_digit(char *);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyextern void *build_disk_list(void *);
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyextern char *lookup_ks_name(char *, void *);
build_disk_list(void *v)
nms_t *t;
disk_list_t *p;
p = (disk_list_t *)v;
disk_list_t *t;
for (i = 0; i < NDKMAP; i++)
p = p->next;
(void) free(t);
t = list;
nms_t *f;
t = t->next;
if (t != list) {
(void) free(f);
return (rv);
static nms_t *
rummage_dev_dsk(void)
for (i = 0; i < MAX_TYPES; i++) {
case DISK:
case TAPE:
char *npt;
if (i == DISK) {
if (i == DISK) {
int cnt;
== S_IFLNK) {
npt = (char *)0;
if (npt)
&list, i);
return (list);
int rv = 0;
rv++;
return (rv);
int len;
char *nlnm;
len++;
len++;
char *ptr;
lname++;
fnm++;
return (fnm);
if (inpt) {
* Process an /etc/path_to_inst line. The line is of the format:
char *rpt;
char *bpt;
int rv = 0;
int done;
int len;
while (*ib) {
ib++;
if (!(*ib))
goto done;
if (!rpt)
goto done;
goto done;
rpt++;
done = 0;
while (!done) {
if (*rpt) {
rpt++;
done++;
done++;
done++;
if (*rpt) {
v = rpt;
len = 0;
len++;
v = (char *)NULL;
if (len) {
bpt--;
len = 0;
bpt--;
len++;
bpt++;
len++;
rv++;
done:
return (rv);
static nms_t *
while (list) {
return (list);
while (list) {
int i, len;
while (stuff) {
if (!stuff) {
int mv;
sizeof (disk_list_t));
if (entry) {
for (i = 0; i < NDKMAP; i++) {
while (stuff) {
if (mv == 0) {
while (stuff) {
if (mv >= 0) {
char *rv = (char *)0;
int dv;
char *device;
int len;
char *tmpnm;
char *nm;
int partition;
dev_nm++;
len = 0;
while (*nm) {
nm++;
len++;
if (*nm) {
int mv;
while (list) {
if (mv == 0) {
while (list) {
if(list) {
return (rv);