Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_ahci.c
Show All 25 Lines | |||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#ifndef WITHOUT_CAPSICUM | |||||
grehan: AHCI_DEBUG is for a developer custom-build so no need for capsicum protection here. | |||||
#include <sys/capsicum.h> | |||||
#endif | |||||
#include <sys/linker_set.h> | #include <sys/linker_set.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <sys/disk.h> | #include <sys/disk.h> | ||||
#include <sys/ata.h> | #include <sys/ata.h> | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
▲ Show 20 Lines • Show All 2,246 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
char bident[sizeof("XX:XX:XX")]; | char bident[sizeof("XX:XX:XX")]; | ||||
struct blockif_ctxt *bctxt; | struct blockif_ctxt *bctxt; | ||||
struct pci_ahci_softc *sc; | struct pci_ahci_softc *sc; | ||||
int ret, slots, p; | int ret, slots, p; | ||||
MD5_CTX mdctx; | MD5_CTX mdctx; | ||||
u_char digest[16]; | u_char digest[16]; | ||||
char *next, *next2; | char *next, *next2; | ||||
#ifdef AHCI_DEBUG | |||||
#ifndef WITHOUT_CAPSICUM | |||||
cap_rights_t rights; | |||||
#endif | |||||
#endif | |||||
ret = 0; | ret = 0; | ||||
#ifdef AHCI_DEBUG | #ifdef AHCI_DEBUG | ||||
dbg = fopen("/tmp/log", "w+"); | dbg = fopen("/tmp/log", "w+"); | ||||
#ifndef WITHOUT_CAPSICUM | |||||
cap_rights_init(&rights, CAP_WRITE); | |||||
if (cap_rights_limit(fileno(dbg), &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
#endif | |||||
#endif | #endif | ||||
sc = calloc(1, sizeof(struct pci_ahci_softc)); | sc = calloc(1, sizeof(struct pci_ahci_softc)); | ||||
pi->pi_arg = sc; | pi->pi_arg = sc; | ||||
sc->asc_pi = pi; | sc->asc_pi = pi; | ||||
pthread_mutex_init(&sc->mtx, NULL); | pthread_mutex_init(&sc->mtx, NULL); | ||||
sc->ports = 0; | sc->ports = 0; | ||||
sc->pi = 0; | sc->pi = 0; | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |
AHCI_DEBUG is for a developer custom-build so no need for capsicum protection here.