Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149829990
D33954.id119525.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D33954.id119525.diff
View Options
diff --git a/tests/sys/ses/destructive.c b/tests/sys/ses/destructive.c
--- a/tests/sys/ses/destructive.c
+++ b/tests/sys/ses/destructive.c
@@ -66,7 +66,9 @@
globfree(&g);
}
-static bool do_setelmstat(const char *devname __unused, int fd) {
+static bool
+do_setelmstat(const char *devname __unused, int fd)
+{
encioc_element_t *map;
unsigned elm_idx;
unsigned nobj;
@@ -96,6 +98,8 @@
{
r = ioctl(fd, ENCIOC_GETELMSTAT, (caddr_t)&elmstat);
ATF_REQUIRE_EQ(r, 0);
+ ses_status_to_ctrl(map[elm_idx].elm_type,
+ &elmstat.cstat[0]);
cslot = (struct ses_ctrl_dev_slot*)&elmstat.cstat[0];
@@ -110,7 +114,8 @@
last_elm_type = -1;
for (elm_idx = 0; elm_idx < nobj; elm_idx++) {
encioc_elm_status_t elmstat;
- struct ses_status_dev_slot *sslot;
+ struct ses_status_dev_slot *sslot =
+ (struct ses_status_dev_slot*)&elmstat.cstat[0];
if (last_elm_type != map[elm_idx].elm_type) {
/* skip overall elements */
@@ -123,11 +128,6 @@
{
int i;
- r = ioctl(fd, ENCIOC_GETELMSTAT, (caddr_t)&elmstat);
- ATF_REQUIRE_EQ(r, 0);
-
- sslot = (struct ses_status_dev_slot*)&elmstat.cstat[0];
-
for (i = 0; i < 10; i++) {
r = ioctl(fd, ENCIOC_GETELMSTAT,
(caddr_t)&elmstat);
@@ -153,7 +153,8 @@
* Instead, we'll just clear every ident bit.
*/
static bool
-do_setelmstat_cleanup(const char *devname __unused, int fd __unused) {
+do_setelmstat_cleanup(const char *devname __unused, int fd __unused)
+{
encioc_element_t *map;
unsigned elm_idx;
unsigned nobj;
@@ -166,6 +167,7 @@
map = calloc(nobj, sizeof(encioc_element_t));
ATF_REQUIRE(map != NULL);
r = ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) map);
+ ATF_REQUIRE_EQ(r, 0);
/* Clear the IDENT bit for every disk slot */
for (elm_idx = 0; elm_idx < nobj; elm_idx++) {
@@ -181,11 +183,17 @@
if (map[elm_idx].elm_type == ELMTYP_DEVICE ||
map[elm_idx].elm_type == ELMTYP_ARRAY_DEV)
{
+ r = ioctl(fd, ENCIOC_GETELMSTAT, (caddr_t)&elmstat);
+ ATF_REQUIRE_EQ(r, 0);
+ ses_status_to_ctrl(map[elm_idx].elm_type,
+ &elmstat.cstat[0]);
+
cslot = (struct ses_ctrl_dev_slot*)&elmstat.cstat[0];
ses_ctrl_common_set_select(&cslot->common, 1);
ses_ctrl_dev_slot_set_rqst_ident(cslot, 0);
r = ioctl(fd, ENCIOC_SETELMSTAT, (caddr_t)&elmstat);
+ ATF_REQUIRE_EQ(r, 0);
}
}
@@ -215,7 +223,9 @@
}
-static bool do_setencstat(const char *devname __unused, int fd) {
+static bool
+do_setencstat(const char *devname __unused, int fd)
+{
unsigned char encstat;
int r, i;
bool worked = false;
@@ -245,7 +255,9 @@
return (true);
}
-static bool do_setencstat_cleanup(const char *devname __unused, int fd) {
+static bool
+do_setencstat_cleanup(const char *devname __unused, int fd)
+{
unsigned char encstat;
/*
@@ -290,7 +302,6 @@
*/
ATF_TP_ADD_TC(tp, setelmstat);
ATF_TP_ADD_TC(tp, setencstat);
- // TODO ENCIOC_SETELMSTAT
return (atf_no_error());
}
diff --git a/tests/sys/ses/nondestructive.c b/tests/sys/ses/nondestructive.c
--- a/tests/sys/ses/nondestructive.c
+++ b/tests/sys/ses/nondestructive.c
@@ -42,7 +42,9 @@
#include "common.h"
-static bool do_getelmdesc(const char *devname, int fd) {
+static bool
+do_getelmdesc(const char *devname, int fd)
+{
regex_t re;
FILE *pipe;
char cmd[256];
@@ -125,11 +127,13 @@
for_each_ses_dev(do_getelmdesc, O_RDONLY);
}
-static bool do_getelmdevnames(const char *devname __unused, int fd) {
+static bool
+do_getelmdevnames(const char *devname __unused, int fd)
+{
encioc_element_t *map;
unsigned nobj;
const size_t namesize = 128;
- int r;
+ int r, status;
char *namebuf;
unsigned elm_idx;
@@ -164,8 +168,10 @@
elmdn.elm_devnames = namebuf;
namebuf[0] = '\0';
r = ioctl(fd, ENCIOC_GETELMDEVNAMES, (caddr_t) &elmdn);
- if (e_status.cstat[0] != SES_OBJSTAT_UNSUPPORTED &&
- e_status.cstat[0] != SES_OBJSTAT_NOTINSTALLED &&
+ status = ses_status_common_get_element_status_code(
+ (struct ses_status_common*)&e_status.cstat[0]);
+ if (status != SES_OBJSTAT_UNSUPPORTED &&
+ status != SES_OBJSTAT_NOTINSTALLED &&
(map[elm_idx].elm_type == ELMTYP_DEVICE ||
map[elm_idx].elm_type == ELMTYP_ARRAY_DEV))
{
@@ -176,8 +182,7 @@
if (r == 0) {
size_t z = 0;
- int da = 0, ada = 0, pass = 0, nvd = 0;
- int nvme = 0, unknown = 0;
+ int da = 0, ada = 0, pass = 0, nda = 0, unknown = 0;
while(elmdn.elm_devnames[z] != '\0') {
size_t e;
@@ -193,16 +198,14 @@
ada++;
else if (0 == strncmp("pass", s, e))
pass++;
- else if (0 == strncmp("nvd", s, e))
- nvd++;
- else if (0 == strncmp("nvme", s, e))
- nvme++;
+ else if (0 == strncmp("nda", s, e))
+ nda++;
else
unknown++;
z += strcspn(elmdn.elm_devnames + z, ",");
}
/* There should be one pass dev for each non-pass dev */
- ATF_CHECK_EQ(pass, da + ada + nvd + nvme);
+ ATF_CHECK_EQ(pass, da + ada + nda);
ATF_CHECK_EQ_MSG(0, unknown,
"Unknown device names %s", elmdn.elm_devnames);
}
@@ -229,7 +232,8 @@
}
static int
-elm_type_name2int(const char *name) {
+elm_type_name2int(const char *name)
+{
const char *elm_type_names[] = ELM_TYPE_NAMES;
int i;
@@ -241,7 +245,9 @@
return (-1);
}
-static bool do_getelmmap(const char *devname, int fd) {
+static bool
+do_getelmmap(const char *devname, int fd)
+{
encioc_element_t *map;
FILE *pipe;
char cmd[256];
@@ -320,7 +326,9 @@
for_each_ses_dev(do_getelmmap, O_RDONLY);
}
-static bool do_getelmstat(const char *devname, int fd) {
+static bool
+do_getelmstat(const char *devname, int fd)
+{
encioc_element_t *map;
unsigned elm_idx;
unsigned nobj;
@@ -391,7 +399,9 @@
for_each_ses_dev(do_getelmstat, O_RDONLY);
}
-static bool do_getencid(const char *devname, int fd) {
+static bool
+do_getencid(const char *devname, int fd)
+{
encioc_string_t stri;
FILE *pipe;
char cmd[256];
@@ -441,7 +451,9 @@
for_each_ses_dev(do_getencid, O_RDONLY);
}
-static bool do_getencname(const char *devname, int fd) {
+static bool
+do_getencname(const char *devname, int fd)
+{
encioc_string_t stri;
FILE *pipe;
char cmd[256];
@@ -487,7 +499,9 @@
for_each_ses_dev(do_getencname, O_RDONLY);
}
-static bool do_getencstat(const char *devname, int fd) {
+static bool
+do_getencstat(const char *devname, int fd)
+{
FILE *pipe;
char cmd[256];
unsigned char e, estat, invop, info, noncrit, crit, unrecov;
@@ -530,7 +544,9 @@
for_each_ses_dev(do_getencstat, O_RDONLY);
}
-static bool do_getnelm(const char *devname, int fd) {
+static bool
+do_getnelm(const char *devname, int fd)
+{
FILE *pipe;
char cmd[256];
char line[256];
@@ -578,7 +594,9 @@
for_each_ses_dev(do_getnelm, O_RDONLY);
}
-static bool do_getstring(const char *devname, int fd) {
+static bool
+do_getstring(const char *devname, int fd)
+{
FILE *pipe;
char cmd[256];
char *sg_ses_buf, *ses_buf;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 28, 10:46 AM (1 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30468736
Default Alt Text
D33954.id119525.diff (6 KB)
Attached To
Mode
D33954: ses: cleanup ses tests
Attached
Detach File
Event Timeline
Log In to Comment