disk_link.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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"
#include <devfsadm.h>
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <limits.h>
#define DISK_SUBPATH_MAX 100
#define RM_STALE 0x01
#define DISK_LINK_RE "^r?dsk/c[0-9]+(t[0-9A-F]+)?d[0-9]+(((s|p))[0-9]+)?$"
#define DISK_LINK_TO_UPPER(ch)\
#define SLICE_SMI "s7"
#define SLICE_EFI ""
#define MN_SMI "h"
#define MN_EFI "wd"
#define ASCIIWWNSIZE 255
int flags);
static devfsadm_create_t disk_cbt[] = {
},
},
},
},
},
},
};
/*
* HOT auto cleanup of disks not desired.
*/
static devfsadm_remove_t disk_remove_cbt[] = {
}
};
static int
{
char *addr;
char disk[20];
return (DEVFSADM_CONTINUE);
}
static int
{
char *addr;
char disk[10];
return (DEVFSADM_CONTINUE);
}
static int
{
char disk[10];
int lun;
int targ;
int *intp;
"target", &intp) <= 0) {
return (DEVFSADM_CONTINUE);
}
"lun", &intp) <= 0) {
lun = 0;
} else {
}
return (DEVFSADM_CONTINUE);
}
static int
{
char disk[DISK_SUBPATH_MAX];
int lun;
int count;
int *intp;
"client-guid", (char **)&wwn) > 0) {
>= sizeof (ascii_wwn)) {
devfsadm_errprint("SUNW_disk_link: GUID too long:%d",
return (DEVFSADM_CONTINUE);
}
lun = 0;
"port-wwn", &wwn) > 0) {
"lun", &intp) > 0) {
} else {
lun = 0;
}
}
*str = '\0';
} else {
return (DEVFSADM_CONTINUE);
}
}
return (DEVFSADM_CONTINUE);
}
/*
* This function is called for every disk minor node.
* Calls enumerate to assign a logical controller number, and
* then devfsadm_mklink to make the link.
*/
static void
{
char stale_re[DISK_SUBPATH_MAX];
char *dir;
char slice[4];
char *mn;
char *ctrl;
dir = "rdsk";
} else {
dir = "dsk";
}
if (mn[0] < 113) {
} else {
/* For EFI label */
}
return;
/*
* If switching between SMI and EFI label or vice versa
* cleanup the previous label's devlinks.
*/
/*
* Attempt the remove only if the stale link exists
*/
devfsadm_root_path(), l_path);
*s = '\0';
}
/*
* optimizations are made inside of devfsadm_rm_stale_links
* instead of before calling the function, as it always
* needs to add the valid link to the cache.
*/
}
}
/* index of enumeration rule applicable to this module */
#define RULE_INDEX 0
static char *
{
char *devfspath;
};
return (NULL);
}
/*
* Use controller component of disk path
*/
/*
* We failed because there are multiple logical controller
* numbers for a single physical controller. If we use node
* name also in the match it should fix this and only find one
* logical controller. (See 4045879).
* NOTE: Rules for controllers are not changed, as there is
* no unique controller number for them in this case.
*
* MATCH_UNCACHED flag is private to the "disks" and "sgen"
* modules. NOT to be used by other modules.
*/
return (NULL);
}
}
return (buf);
}