/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
extern int md_status;
extern md_ops_t stripe_md_ops;
extern md_krwlock_t md_unit_array_rw;
static int
{
int ci;
int cmpcnt;
void *repl_data;
void (*repl_done)();
}
/*
* stripe_component_count and stripe_get_dev only care about the
* minor number associated with the first argument which is a
* md_dev64_t
*
* The comments section for these two routines have been updated
* to indicate that this routine calls with fake major numbers.
*/
break;
}
return (EINVAL);
}
/* In case of a dryrun we're done here */
return (0);
}
return (0);
}
static int
{
void *p;
int err;
int row;
int rid;
int num_recs;
int i, c;
}
}
/* create the db record for this mdstruct */
#if defined(_ILP32)
#else
#endif
} else {
}
if (ms_recid < 0)
/* get the address of the mdstruct */
p = (void *) mddb_getrecaddr(ms_recid);
/*
* It is okay that we muck with the mdstruct here,
* since no one else will know about the mdstruct
* until we commit it. If we crash, the record will
* be automatically purged, since we haven't
* committed it yet.
*/
/* copy in the user's mdstruct */
return (EFAULT);
}
/* All 64 bit metadevices only support EFI labels. */
}
/*
* allocate the real recids array. since we may have to commit
* underlying metadevice records, we need an array
* of size: total number of components in stripe + 3
* (1 for the stripe itself, one for the hotspare, one
* for the end marker).
*/
num_recs = 3;
rid = 0;
}
if (err = stripe_build_incore(p, 0)) {
return (err);
}
/*
* Update unit availability
*/
if (err) {
}
/*
* set the parent on any metadevice components.
* NOTE: currently soft partitions are the only metadevices
* which can appear within a stripe.
*/
/* set parent and disallow soft partitioning */
}
}
}
/* set end marker */
return (0);
}
/*ARGSUSED*/
static int
{
}
return (0);
}
return (EFAULT);
}
return (EFAULT);
return (0);
}
static int
{
}
/* This prevents new opens */
}
/* single thread */
if (md_unit_isopen(ui)) {
}
/*
* Update unit availability
*/
/*
* If MN set, reset s_un_next so all nodes can have
* the same view of the next available slot when
* nodes are -w and -j
*/
if (MD_MNSET_SETNO(setno)) {
}
return (0);
}
static int
{
int row, i, c;
int err;
int opened;
int rval = 0;
int npar;
int rid;
int num_recs;
}
if (npar >= 1) {
return (EFAULT);
}
}
/*
* then our own.
* we expect parent units to be sorted to avoid deadlock
*/
for (i = 0; i < npar; ++i) {
(void) md_ioctl_writerlock(&plock[i],
}
goto out;
}
/*
* Preserve the friendly name nature of growing device.
*/
#if defined(_ILP32)
goto out;
#else
#endif
} else {
}
if (ms_recid < 0) {
goto out;
}
/* get the address of the new unit */
/*
* It is okay that we muck with the new unit here,
* since no one else will know about the unit struct
* until we commit it. If we crash, the record will
* be automatically purged, since we haven't
* committed it yet and the old unit struct will be found.
*/
/* copy in the user's unit struct */
if (err) {
goto out;
}
/*
* allocate the real recids array. since we may have to
* commit underlying metadevice records, we need an
* array of size: total number of new components being
* attached + 2 (one for the stripe itself, one for the
* end marker).
*/
num_recs = 2;
rid = 0;
}
/*
* Save a few of the new unit structs fields.
* Before they get clobbered.
*/
/*
* Copy the old unit struct (static stuff)
* into new unit struct
*/
/*
* Restore the saved stuff.
*/
/* All 64 bit metadevices only support EFI labels. */
/*
* If the device was previously smaller than a terabyte,
* and had a vtoc record attached to it, we remove the
* vtoc record, because the layout has changed completely.
*/
(un->c.un_vtoc_id != 0)) {
new_un->c.un_vtoc_id =
}
}
/*
* Copy the old component structs into the new unit struct.
*/
sizeof (ms_comp_t));
}
}
/*
* Set parent on metadevices being added.
* Open the new devices being added.
* NOTE: currently soft partitions are the only metadevices
* which can appear within a stripe.
*/
/* set parent on any metadevices */
}
if (opened) {
/*
* Open by device id
* Check if this comp is hotspared and
* if it is then use the key for hotspare
*/
}
}
}
/* set end marker */
/* commit new unit struct */
/* delete old unit struct */
/* place new unit in in-core array */
/*
* If old_vtoc has a non zero value, we know:
* - This unit crossed the border from smaller to larger one TB
* - There was a vtoc record for the unit,
* - This vtoc record is no longer needed, because
* a new efi record has been created for this un.
*/
if (old_vtoc != 0) {
}
/* free recids array */
/* release locks, return success */
out:
for (i = npar - 1; (i >= 0); --i)
md_ioctl_writerexit(&plock[i]);
return (rval);
}
static int
)
{
return (0);
}
static int
)
{
return (0);
}
static int
)
{
}
static int
)
{
return (0);
}
static int
)
{
}
static int
)
{
return (0);
}
static int
void *d,
int mode,
)
{
int r, c, i;
int cnt;
/* check out unit */
}
if ((unit_dev = md_xlate_mini_2_targ
return (ENODEV);
}
return (EFAULT);
++devsp;
}
++cnt;
}
}
return (0);
}
static int
)
{
int r, c, i;
int irecid;
int inc_new_hsp = 0;
int err;
}
if (!pp->change_hsp_id)
return (0);
/* verify that no hot spares are in use */
mnum));
}
}
}
recids[1] = 0;
recids[2] = 0;
irecid = 1;
/* increment the reference count of the new hsp */
if (err) {
}
inc_new_hsp = 1;
irecid++;
}
/* decrement the reference count of the old hsp */
if (err) {
if (inc_new_hsp) {
(void) md_hot_spare_ifc(HSP_DECREF,
/*
* Don't need to commit the record,
* cause it never got commit before
*/
}
return (err);
}
}
recids[3] = 0;
return (0);
}
static int
{
void *d = NULL;
int err = 0;
/* We can only handle 32-bit clients for internal commands */
return (EINVAL);
}
/* handle ioctl */
switch (cmd) {
case MD_IOCSET:
{
return (EACCES);
sz = sizeof (struct md_set_params);
break;
}
break;
}
case MD_IOCGET:
{
return (EACCES);
break;
}
break;
}
case MD_IOCRESET:
{
return (EACCES);
sz = sizeof (md_i_reset_t);
break;
}
break;
}
case MD_IOCGROW:
{
return (EACCES);
sz = sizeof (struct md_grow_params);
break;
}
break;
}
case MD_IOCGET_DEVS:
{
return (EACCES);
sz = sizeof (struct md_getdevs_params);
break;
}
break;
}
case MD_IOCCHANGE:
{
return (EACCES);
sz = sizeof (md_stripe_params_t);
break;
}
break;
}
case MD_IOCREPLACE:
{
return (EACCES);
sz = sizeof (replace_params_t);
break;
}
break;
}
case MD_IOCPROBE_DEV:
{
/*
* Ignore the request since stripe is not
* a type of 'redundant' metadevice
*/
break;
}
default:
return (ENOTTY);
}
/*
* copyout and free any args
*/
if (sz != 0) {
if (err == 0) {
}
}
}
return (err);
}
/*
* The parameters of md_stripe_ioctl are defined by the ddi and so
* dev is of type dev_t and not md_dev64_t
*/
int
{
int err = 0;
/* handle admin ioctls */
if (mnum == MD_ADM_MINOR)
/* check unit */
return (ENXIO);
/* is this a supported ioctl? */
if (err != 0) {
return (err);
}
/* handle ioctl */
switch (cmd) {
case DKIOCINFO:
{
struct dk_cinfo *p;
return (EACCES);
p = kmem_alloc(sizeof (*p), KM_SLEEP);
kmem_free(p, sizeof (*p));
return (err);
}
case DKIOCGMEDIAINFO:
{
struct dk_minfo p;
return (EACCES);
return (err);
}
case DKIOCGGEOM:
{
struct dk_geom *p;
return (EACCES);
p = kmem_alloc(sizeof (*p), KM_SLEEP);
mode) != 0)
}
kmem_free(p, sizeof (*p));
return (err);
}
case DKIOCGVTOC:
{
return (EACCES);
return (err);
}
}
#ifdef _SYSCALL32
else {
}
#endif /* _SYSCALL32 */
return (err);
}
case DKIOCSVTOC:
{
return (EACCES);
}
}
#ifdef _SYSCALL32
else {
} else {
}
}
#endif /* _SYSCALL32 */
if (err == 0) {
}
return (err);
}
case DKIOCGEXTVTOC:
{
return (EACCES);
return (err);
}
return (err);
}
case DKIOCSEXTVTOC:
{
return (EACCES);
}
if (err == 0) {
}
return (err);
}
case DKIOCGAPART:
{
return (err);
}
mode) != 0)
}
#ifdef _SYSCALL32
else {
mode) != 0)
}
#endif /* _SYSCALL32 */
return (err);
}
case DKIOCGETEFI:
{
/*
* This one can be done centralized,
* no need to put in the same code for all types of metadevices
*/
}
case DKIOCSETEFI:
{
/*
* This one can be done centralized,
* no need to put in the same code for all types of metadevices
*/
}
case DKIOCPARTITION:
{
}
default:
return (ENOTTY);
}
}
/*
* rename named service entry points and support functions
*/
/*
*/
/*
* support routine for MDRNM_CHECK
*/
static int
mdi_unit_t *ui,
{
from_min);
return (EINVAL);
}
return (EINVAL);
}
return (EINVAL);
}
/* we're related if trying to swap with our parent */
case MDRNOP_EXCHANGE:
if (!related) {
return (EINVAL);
}
break;
case MDRNOP_RENAME:
/*
* if from is top-level and is open, then the kernel is using
* the device and we return EBUSY.
*/
from_min);
return (EBUSY);
}
break;
default:
from_min);
return (EINVAL);
}
return (0); /* ok */
}
/*
* Named service entry point: MDRNM_CHECK
*/
{
int err = 0;
return (EINVAL);
}
/* self does additional checks */
}
out:
return (err);
}