Lines Matching defs:dsp
67 disk_status_t *dsp;
71 if ((dsp = calloc(sizeof (disk_status_t), 1)) == NULL) {
76 dsp->ds_test_mask = test_mask;
77 dsp->ds_skip_update = skip_update;
79 if ((dsp->ds_fd = open(path, O_RDWR)) < 0) {
81 free(dsp);
85 if ((dsp->ds_path = strdup(path)) == NULL) {
87 disk_status_close(dsp);
94 dsp->ds_transport = t;
96 nvlist_free(dsp->ds_state);
97 dsp->ds_state = NULL;
98 if (nvlist_alloc(&dsp->ds_state, NV_UNIQUE_NAME, 0) != 0) {
100 disk_status_close(dsp);
104 if ((dsp->ds_data = t->dt_open(dsp)) == NULL) {
105 if (dsp->ds_error != EDS_NO_TRANSPORT) {
106 *error = dsp->ds_error;
107 disk_status_close(dsp);
111 dsp->ds_error = 0;
116 if (dsp->ds_error == EDS_NO_TRANSPORT) {
117 *error = dsp->ds_error;
118 disk_status_close(dsp);
122 return (dsp);
129 disk_status_close(disk_status_t *dsp)
131 nvlist_free(dsp->ds_state);
132 nvlist_free(dsp->ds_predfail);
133 nvlist_free(dsp->ds_overtemp);
134 nvlist_free(dsp->ds_testfail);
135 if (dsp->ds_data)
136 dsp->ds_transport->dt_close(dsp->ds_data);
137 (void) close(dsp->ds_fd);
138 free(dsp->ds_path);
139 free(dsp);
152 disk_status_path(disk_status_t *dsp)
154 return (dsp->ds_path);
158 disk_status_errno(disk_status_t *dsp)
160 return (dsp->ds_error);
164 disk_status_get(disk_status_t *dsp)
173 nvlist_free(dsp->ds_testfail);
174 nvlist_free(dsp->ds_predfail);
175 nvlist_free(dsp->ds_overtemp);
176 dsp->ds_testfail = dsp->ds_overtemp = dsp->ds_predfail = NULL;
177 dsp->ds_faults = 0;
183 if (dsp->ds_transport->dt_scan(dsp->ds_data) != 0 &&
184 dsp->ds_error != EDS_IO)
191 (err = nvlist_add_nvlist(nvl, "status", dsp->ds_state)) != 0)
200 if (dsp->ds_predfail != NULL) {
203 (dsp->ds_faults & DS_FAULT_PREDFAIL) != 0)) != 0 ||
205 dsp->ds_predfail)) != 0)
209 if (dsp->ds_testfail != NULL) {
212 (dsp->ds_faults & DS_FAULT_TESTFAIL) != 0)) != 0 ||
214 dsp->ds_testfail)) != 0)
218 if (dsp->ds_overtemp != NULL) {
221 (dsp->ds_faults & DS_FAULT_OVERTEMP) != 0)) != 0 ||
223 dsp->ds_overtemp)) != 0)
237 (void) ds_set_errno(dsp, EDS_NOMEM);