mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Convert unmappedio over to a flag.
Make unmappedio a flag. Move it to the flags definition. Add compat sysctl for it.
This commit is contained in:
parent
aeab0812e6
commit
cf3ff63e55
1 changed files with 25 additions and 7 deletions
|
|
@ -109,7 +109,8 @@ typedef enum {
|
||||||
ADA_FLAG_ANNOUNCED = 0x00100000,
|
ADA_FLAG_ANNOUNCED = 0x00100000,
|
||||||
ADA_FLAG_DIRTY = 0x00200000,
|
ADA_FLAG_DIRTY = 0x00200000,
|
||||||
ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */
|
ADA_FLAG_CAN_NCQ_TRIM = 0x00400000, /* CAN_TRIM also set */
|
||||||
ADA_FLAG_PIM_ATA_EXT = 0x00800000
|
ADA_FLAG_PIM_ATA_EXT = 0x00800000,
|
||||||
|
ADA_FLAG_UNMAPPEDIO = 0x01000000
|
||||||
} ada_flags;
|
} ada_flags;
|
||||||
#define ADA_FLAG_STRING \
|
#define ADA_FLAG_STRING \
|
||||||
"\020" \
|
"\020" \
|
||||||
|
|
@ -135,7 +136,8 @@ typedef enum {
|
||||||
"\025ANNOUNCED" \
|
"\025ANNOUNCED" \
|
||||||
"\026DIRTY" \
|
"\026DIRTY" \
|
||||||
"\027CAN_NCQ_TRIM" \
|
"\027CAN_NCQ_TRIM" \
|
||||||
"\030PIM_ATA_EXT"
|
"\030PIM_ATA_EXT" \
|
||||||
|
"\031UNMAPPEDIO"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ADA_Q_NONE = 0x00,
|
ADA_Q_NONE = 0x00,
|
||||||
|
|
@ -264,7 +266,6 @@ struct ada_softc {
|
||||||
int trim_max_ranges;
|
int trim_max_ranges;
|
||||||
int read_ahead;
|
int read_ahead;
|
||||||
int write_cache;
|
int write_cache;
|
||||||
int unmappedio;
|
|
||||||
int rotating;
|
int rotating;
|
||||||
#ifdef CAM_TEST_FAILURE
|
#ifdef CAM_TEST_FAILURE
|
||||||
int force_read_error;
|
int force_read_error;
|
||||||
|
|
@ -831,6 +832,7 @@ static periph_oninv_t adaoninvalidate;
|
||||||
static periph_dtor_t adacleanup;
|
static periph_dtor_t adacleanup;
|
||||||
static void adaasync(void *callback_arg, u_int32_t code,
|
static void adaasync(void *callback_arg, u_int32_t code,
|
||||||
struct cam_path *path, void *arg);
|
struct cam_path *path, void *arg);
|
||||||
|
static int adabitsysctl(SYSCTL_HANDLER_ARGS);
|
||||||
static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
|
static int adaflagssysctl(SYSCTL_HANDLER_ARGS);
|
||||||
static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
|
static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
|
||||||
static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
|
static int adazonesupsysctl(SYSCTL_HANDLER_ARGS);
|
||||||
|
|
@ -1514,9 +1516,6 @@ adasysctlinit(void *context, int pending)
|
||||||
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
||||||
OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE,
|
OID_AUTO, "write_cache", CTLFLAG_RW | CTLFLAG_MPSAFE,
|
||||||
&softc->write_cache, 0, "Enable disk write cache.");
|
&softc->write_cache, 0, "Enable disk write cache.");
|
||||||
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
|
||||||
OID_AUTO, "unmapped_io", CTLFLAG_RD | CTLFLAG_MPSAFE,
|
|
||||||
&softc->unmappedio, 0, "Unmapped I/O leaf");
|
|
||||||
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
||||||
OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE,
|
OID_AUTO, "rotating", CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||||
&softc->rotating, 0, "Rotating media");
|
&softc->rotating, 0, "Rotating media");
|
||||||
|
|
@ -1548,6 +1547,10 @@ adasysctlinit(void *context, int pending)
|
||||||
OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
OID_AUTO, "flags", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||||
softc, 0, adaflagssysctl, "A",
|
softc, 0, adaflagssysctl, "A",
|
||||||
"Flags for drive");
|
"Flags for drive");
|
||||||
|
SYSCTL_ADD_PROC(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree),
|
||||||
|
OID_AUTO, "unmapped_io", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
|
||||||
|
&softc->flags, (u_int)ADA_FLAG_UNMAPPEDIO, adabitsysctl, "I",
|
||||||
|
"Unmapped I/O support *DEPRECATED* gone in FreeBSD 14");
|
||||||
|
|
||||||
#ifdef CAM_TEST_FAILURE
|
#ifdef CAM_TEST_FAILURE
|
||||||
/*
|
/*
|
||||||
|
|
@ -1656,6 +1659,21 @@ adadeletemethodsysctl(SYSCTL_HANDLER_ARGS)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
adabitsysctl(SYSCTL_HANDLER_ARGS)
|
||||||
|
{
|
||||||
|
u_int *flags = arg1;
|
||||||
|
u_int test = arg2;
|
||||||
|
int tmpout, error;
|
||||||
|
|
||||||
|
tmpout = !!(*flags & test);
|
||||||
|
error = SYSCTL_OUT(req, &tmpout, sizeof(tmpout));
|
||||||
|
if (error || !req->newptr)
|
||||||
|
return (error);
|
||||||
|
|
||||||
|
return (EPERM);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
adaflagssysctl(SYSCTL_HANDLER_ARGS)
|
adaflagssysctl(SYSCTL_HANDLER_ARGS)
|
||||||
{
|
{
|
||||||
|
|
@ -3459,7 +3477,7 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev *cgd)
|
||||||
softc->disk->d_delmaxsize = maxio;
|
softc->disk->d_delmaxsize = maxio;
|
||||||
if ((softc->cpi.hba_misc & PIM_UNMAPPED) != 0) {
|
if ((softc->cpi.hba_misc & PIM_UNMAPPED) != 0) {
|
||||||
d_flags |= DISKFLAG_UNMAPPED_BIO;
|
d_flags |= DISKFLAG_UNMAPPED_BIO;
|
||||||
softc->unmappedio = 1;
|
softc->flags |= ADA_FLAG_UNMAPPEDIO;
|
||||||
}
|
}
|
||||||
softc->disk->d_flags = d_flags;
|
softc->disk->d_flags = d_flags;
|
||||||
strlcpy(softc->disk->d_descr, cgd->ident_data.model,
|
strlcpy(softc->disk->d_descr, cgd->ident_data.model,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue