/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Logical Domains Device Agent
*/
#include <errno.h>
#include <fcntl.h>
#include <libdladm.h>
#include <libdllink.h>
#include <libds.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include "ldma.h"
};
};
/*ARGSUSED*/
static ldma_request_status_t
{
int fd;
goto done;
}
goto done;
}
reply_dlen = sizeof (uint32_t);
goto done;
}
/* LINTED E_BAD_PTR_CAST_ALIGN */
/* check if path exists */
LDMA_DBG("VALIDATE_PATH(%s): stat failed with error %d",
switch (errno) {
case EACCES:
case ELOOP:
case ENOENT:
case ENOLINK:
case ENOTDIR:
/* path is inaccessible, the request is completed */
break;
case ENAMETOOLONG:
break;
default:
/* request has failed */
break;
}
goto done;
}
case S_IFREG:
break;
case S_IFCHR:
case S_IFBLK:
break;
default:
/* we don't advertise other types (fifo, directory...) */
*path_type = 0;
}
} else {
LDMA_DBG("VALIDATE_PATH(%s): open RDWR failed with error %d",
/* check if path can be opened read only */
} else {
LDMA_DBG("VALIDATE_PATH(%s): open RDONLY failed "
}
}
done:
if (status != LDMA_REQ_COMPLETED) {
/*
* We don't provide a reply message if the request has not
* been completed. The LDoms agent daemon will send an
* appropriate reply based on the return code of this function.
*/
reply_dlen = 0;
LDMA_DBG("VALIDATE_PATH(%s): return error %d",
} else {
LDMA_DBG("VALIDATE_PATH(%s): return status=0x%x type=0x%x",
}
return (status);
}
/*
* We check that the device is a network interface (NIC) using libdladm.
*/
/*ARGSUSED*/
static ldma_request_status_t
{
goto done;
}
goto done;
}
reply_dlen = 0;
goto done;
}
goto done;
}
&media) != DLADM_STATUS_OK) {
} else {
}
done:
if (status != LDMA_REQ_COMPLETED) {
/*
* We don't provide a reply message if the request has not
* been completed. The LDoms agent daemon will send an
* appropriate reply based on the return code of this function.
*/
reply_dlen = 0;
LDMA_DBG("VALIDATE_NIC(%s): return error %d",
} else {
LDMA_DBG("VALIDATE_NIC(%s): return status=0x%x",
}
return (status);
}