Fix switch statement indentation in the FreeBSD kstat code
This is in preparation for some functional changes. Reviewed-by: Allan Jude <allan@klarasystems.com> Reviewed-by: Ryan Moeller <ryan@ixsystems.com> Signed-off-by: Mark Johnston <markj@FreeBSD.org> Closes #10950
This commit is contained in:
parent
37b00fb039
commit
c50f3c902f
|
@ -247,28 +247,28 @@ __kstat_create(const char *module, int instance, const char *name,
|
||||||
ksp->ks_lock = &ksp->ks_private_lock;
|
ksp->ks_lock = &ksp->ks_private_lock;
|
||||||
|
|
||||||
switch (ksp->ks_type) {
|
switch (ksp->ks_type) {
|
||||||
case KSTAT_TYPE_RAW:
|
case KSTAT_TYPE_RAW:
|
||||||
ksp->ks_ndata = 1;
|
ksp->ks_ndata = 1;
|
||||||
ksp->ks_data_size = ks_ndata;
|
ksp->ks_data_size = ks_ndata;
|
||||||
break;
|
break;
|
||||||
case KSTAT_TYPE_NAMED:
|
case KSTAT_TYPE_NAMED:
|
||||||
ksp->ks_ndata = ks_ndata;
|
ksp->ks_ndata = ks_ndata;
|
||||||
ksp->ks_data_size = ks_ndata * sizeof (kstat_named_t);
|
ksp->ks_data_size = ks_ndata * sizeof (kstat_named_t);
|
||||||
break;
|
break;
|
||||||
case KSTAT_TYPE_INTR:
|
case KSTAT_TYPE_INTR:
|
||||||
ksp->ks_ndata = ks_ndata;
|
ksp->ks_ndata = ks_ndata;
|
||||||
ksp->ks_data_size = ks_ndata * sizeof (kstat_intr_t);
|
ksp->ks_data_size = ks_ndata * sizeof (kstat_intr_t);
|
||||||
break;
|
break;
|
||||||
case KSTAT_TYPE_IO:
|
case KSTAT_TYPE_IO:
|
||||||
ksp->ks_ndata = ks_ndata;
|
ksp->ks_ndata = ks_ndata;
|
||||||
ksp->ks_data_size = ks_ndata * sizeof (kstat_io_t);
|
ksp->ks_data_size = ks_ndata * sizeof (kstat_io_t);
|
||||||
break;
|
break;
|
||||||
case KSTAT_TYPE_TIMER:
|
case KSTAT_TYPE_TIMER:
|
||||||
ksp->ks_ndata = ks_ndata;
|
ksp->ks_ndata = ks_ndata;
|
||||||
ksp->ks_data_size = ks_ndata * sizeof (kstat_timer_t);
|
ksp->ks_data_size = ks_ndata * sizeof (kstat_timer_t);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
panic("Undefined kstat type %d\n", ksp->ks_type);
|
panic("Undefined kstat type %d\n", ksp->ks_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) {
|
if (ksp->ks_flags & KSTAT_FLAG_VIRTUAL) {
|
||||||
|
@ -342,64 +342,62 @@ kstat_install_named(kstat_t *ksp)
|
||||||
namelast = ksent->name;
|
namelast = ksent->name;
|
||||||
}
|
}
|
||||||
switch (typelast) {
|
switch (typelast) {
|
||||||
case KSTAT_DATA_CHAR:
|
case KSTAT_DATA_CHAR:
|
||||||
/* Not Implemented */
|
/* Not Implemented */
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_INT32:
|
case KSTAT_DATA_INT32:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_S32 | CTLFLAG_RD, ksp, i,
|
CTLTYPE_S32 | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "I", namelast);
|
kstat_sysctl, "I", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_UINT32:
|
case KSTAT_DATA_UINT32:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_U32 | CTLFLAG_RD, ksp, i,
|
CTLTYPE_U32 | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "IU", namelast);
|
kstat_sysctl, "IU", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_INT64:
|
case KSTAT_DATA_INT64:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_S64 | CTLFLAG_RD, ksp, i,
|
CTLTYPE_S64 | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "Q", namelast);
|
kstat_sysctl, "Q", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_UINT64:
|
case KSTAT_DATA_UINT64:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_U64 | CTLFLAG_RD, ksp, i,
|
CTLTYPE_U64 | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "QU", namelast);
|
kstat_sysctl, "QU", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_LONG:
|
case KSTAT_DATA_LONG:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_LONG | CTLFLAG_RD, ksp, i,
|
CTLTYPE_LONG | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "L", namelast);
|
kstat_sysctl, "L", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_ULONG:
|
case KSTAT_DATA_ULONG:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_ULONG | CTLFLAG_RD, ksp, i,
|
CTLTYPE_ULONG | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl, "LU", namelast);
|
kstat_sysctl, "LU", namelast);
|
||||||
break;
|
break;
|
||||||
case KSTAT_DATA_STRING:
|
case KSTAT_DATA_STRING:
|
||||||
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, namelast,
|
OID_AUTO, namelast,
|
||||||
CTLTYPE_STRING | CTLFLAG_RD, ksp, i,
|
CTLTYPE_STRING | CTLFLAG_RD, ksp, i,
|
||||||
kstat_sysctl_string, "A", namelast);
|
kstat_sysctl_string, "A", namelast);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
panic("unsupported type: %d", typelast);
|
panic("unsupported type: %d", typelast);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -411,39 +409,38 @@ kstat_install(kstat_t *ksp)
|
||||||
VERIFY(ksp->ks_type == KSTAT_TYPE_RAW);
|
VERIFY(ksp->ks_type == KSTAT_TYPE_RAW);
|
||||||
|
|
||||||
switch (ksp->ks_type) {
|
switch (ksp->ks_type) {
|
||||||
case KSTAT_TYPE_NAMED:
|
case KSTAT_TYPE_NAMED:
|
||||||
return (kstat_install_named(ksp));
|
return (kstat_install_named(ksp));
|
||||||
break;
|
break;
|
||||||
case KSTAT_TYPE_RAW:
|
case KSTAT_TYPE_RAW:
|
||||||
if (ksp->ks_raw_ops.data) {
|
if (ksp->ks_raw_ops.data) {
|
||||||
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
|
||||||
OID_AUTO, ksp->ks_name,
|
|
||||||
CTLTYPE_STRING | CTLFLAG_RD, ksp, 0,
|
|
||||||
kstat_sysctl_raw, "A", ksp->ks_name);
|
|
||||||
} else {
|
|
||||||
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
|
||||||
OID_AUTO, ksp->ks_name,
|
|
||||||
CTLTYPE_OPAQUE | CTLFLAG_RD, ksp, 0,
|
|
||||||
kstat_sysctl_raw, "", ksp->ks_name);
|
|
||||||
}
|
|
||||||
VERIFY(root != NULL);
|
|
||||||
break;
|
|
||||||
case KSTAT_TYPE_IO:
|
|
||||||
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
OID_AUTO, ksp->ks_name,
|
OID_AUTO, ksp->ks_name,
|
||||||
CTLTYPE_STRING | CTLFLAG_RD, ksp, 0,
|
CTLTYPE_STRING | CTLFLAG_RD, ksp, 0,
|
||||||
kstat_sysctl_io, "A", ksp->ks_name);
|
kstat_sysctl_raw, "A", ksp->ks_name);
|
||||||
break;
|
} else {
|
||||||
case KSTAT_TYPE_TIMER:
|
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
case KSTAT_TYPE_INTR:
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
default:
|
OID_AUTO, ksp->ks_name,
|
||||||
panic("unsupported kstat type %d\n", ksp->ks_type);
|
CTLTYPE_OPAQUE | CTLFLAG_RD, ksp, 0,
|
||||||
|
kstat_sysctl_raw, "", ksp->ks_name);
|
||||||
|
}
|
||||||
|
VERIFY(root != NULL);
|
||||||
|
break;
|
||||||
|
case KSTAT_TYPE_IO:
|
||||||
|
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
|
||||||
|
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
|
||||||
|
OID_AUTO, ksp->ks_name,
|
||||||
|
CTLTYPE_STRING | CTLFLAG_RD, ksp, 0,
|
||||||
|
kstat_sysctl_io, "A", ksp->ks_name);
|
||||||
|
break;
|
||||||
|
case KSTAT_TYPE_TIMER:
|
||||||
|
case KSTAT_TYPE_INTR:
|
||||||
|
default:
|
||||||
|
panic("unsupported kstat type %d\n", ksp->ks_type);
|
||||||
}
|
}
|
||||||
ksp->ks_sysctl_root = root;
|
ksp->ks_sysctl_root = root;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue