Lines Matching defs:dsp

69 	disk_status_t *dsp;
73 if ((dsp = calloc(sizeof (disk_status_t), 1)) == NULL) {
78 if ((dsp->ds_fd = open(path, O_RDWR)) < 0) {
80 free(dsp);
84 if ((dsp->ds_path = strdup(path)) == NULL) {
86 disk_status_close(dsp);
93 dsp->ds_transport = t;
95 nvlist_free(dsp->ds_state);
96 dsp->ds_state = NULL;
97 if (nvlist_alloc(&dsp->ds_state, NV_UNIQUE_NAME, 0) != 0) {
99 disk_status_close(dsp);
103 if ((dsp->ds_data = t->dt_open(dsp)) == NULL) {
104 if (dsp->ds_error != EDS_NO_TRANSPORT) {
105 *error = dsp->ds_error;
106 disk_status_close(dsp);
110 dsp->ds_error = 0;
115 if (dsp->ds_error == EDS_NO_TRANSPORT) {
116 *error = dsp->ds_error;
117 disk_status_close(dsp);
121 return (dsp);
128 disk_status_close(disk_status_t *dsp)
130 nvlist_free(dsp->ds_state);
131 nvlist_free(dsp->ds_predfail);
132 nvlist_free(dsp->ds_overtemp);
133 nvlist_free(dsp->ds_testfail);
134 if (dsp->ds_data)
135 dsp->ds_transport->dt_close(dsp->ds_data);
136 (void) close(dsp->ds_fd);
137 free(dsp->ds_path);
138 free(dsp);
151 disk_status_path(disk_status_t *dsp)
153 return (dsp->ds_path);
157 disk_status_errno(disk_status_t *dsp)
159 return (dsp->ds_error);
163 disk_status_get(disk_status_t *dsp)
172 nvlist_free(dsp->ds_testfail);
173 nvlist_free(dsp->ds_predfail);
174 nvlist_free(dsp->ds_overtemp);
175 dsp->ds_testfail = dsp->ds_overtemp = dsp->ds_predfail = NULL;
176 dsp->ds_faults = 0;
182 if (dsp->ds_transport->dt_scan(dsp->ds_data) != 0 &&
183 dsp->ds_error != EDS_IO)
190 (err = nvlist_add_nvlist(nvl, "status", dsp->ds_state)) != 0)
199 if (dsp->ds_predfail != NULL) {
202 (dsp->ds_faults & DS_FAULT_PREDFAIL) != 0)) != 0 ||
204 dsp->ds_predfail)) != 0)
208 if (dsp->ds_testfail != NULL) {
211 (dsp->ds_faults & DS_FAULT_TESTFAIL) != 0)) != 0 ||
213 dsp->ds_testfail)) != 0)
217 if (dsp->ds_overtemp != NULL) {
220 (dsp->ds_faults & DS_FAULT_OVERTEMP) != 0)) != 0 ||
222 dsp->ds_overtemp)) != 0)
236 (void) ds_set_errno(dsp, EDS_NOMEM);