110 |
|
|
111 |
|
char *read_dir(char *disk_path){ |
112 |
|
DIR *dirp; |
113 |
< |
struct dirent *dp; |
114 |
< |
struct stat stbuf; |
113 |
> |
struct dirent *dp; |
114 |
> |
struct stat stbuf; |
115 |
|
char *svr_name; |
116 |
< |
char current_dir[MAXPATHLEN]; |
117 |
< |
char file_name[MAXPATHLEN]; |
118 |
< |
char temp_name[MAXPATHLEN]; |
119 |
< |
char dir_dname[MAXPATHLEN]; |
116 |
> |
char current_dir[MAXPATHLEN]; |
117 |
> |
char file_name[MAXPATHLEN]; |
118 |
> |
char temp_name[MAXPATHLEN]; |
119 |
> |
char dir_dname[MAXPATHLEN]; |
120 |
|
char *dsk_dir; |
121 |
|
int x; |
122 |
|
|
123 |
|
dsk_dir = "/dev/osa/dev/dsk"; |
124 |
< |
strncpy(current_dir, dsk_dir, sizeof current_dir); |
125 |
< |
if ((dirp = opendir(current_dir)) == NULL){ |
124 |
> |
strncpy(current_dir, dsk_dir, sizeof current_dir); |
125 |
> |
if ((dirp = opendir(current_dir)) == NULL){ |
126 |
|
dsk_dir = "/dev/dsk"; |
127 |
|
snprintf(current_dir, sizeof current_dir, "%s", dsk_dir); |
128 |
|
if ((dirp = opendir(current_dir)) == NULL){ |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
< |
while ((dp = readdir(dirp)) != NULL){ |
133 |
> |
while ((dp = readdir(dirp)) != NULL){ |
134 |
|
snprintf(temp_name, sizeof temp_name, "../..%s", disk_path); |
135 |
|
snprintf(dir_dname, sizeof dir_dname, "%s/%s", dsk_dir, dp->d_name); |
136 |
|
stat(dir_dname,&stbuf); |
186 |
|
}else{ |
187 |
|
node = di_drv_next_node(node); |
188 |
|
} |
189 |
< |
} /* End of the while loop */ |
189 |
> |
} |
190 |
|
di_fini(root_node); |
191 |
|
return (-1); |
192 |
|
} |
194 |
|
void build_mapping(){ |
195 |
|
char device_name[512]; |
196 |
|
int x; |
197 |
< |
kstat_ctl_t *kc; |
198 |
< |
kstat_t *ksp; |
199 |
< |
kstat_io_t kios; |
197 |
> |
kstat_ctl_t *kc; |
198 |
> |
kstat_t *ksp; |
199 |
> |
kstat_io_t kios; |
200 |
|
|
201 |
|
if ((kc = kstat_open()) == NULL) { |
202 |
< |
return NULL; |
203 |
< |
} |
202 |
> |
return NULL; |
203 |
> |
} |
204 |
|
|
205 |
< |
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { |
206 |
< |
if (!strcmp(ksp->ks_class, "disk")) { |
207 |
< |
|
208 |
< |
if(ksp->ks_type != KSTAT_TYPE_IO) continue; |
209 |
< |
/* We dont want metadevices appearins as num_diskio */ |
210 |
< |
if(strcmp(ksp->ks_module, "md")==0) continue; |
211 |
< |
if((kstat_read(kc, ksp, &kios))==-1) continue; |
205 |
> |
for (ksp = kc->kc_chain; ksp; ksp = ksp->ks_next) { |
206 |
> |
if (!strcmp(ksp->ks_class, "disk")) { |
207 |
> |
if(ksp->ks_type != KSTAT_TYPE_IO) continue; |
208 |
> |
/* We dont want metadevices appearing as num_diskio */ |
209 |
> |
if(strcmp(ksp->ks_module, "md")==0) continue; |
210 |
> |
if((kstat_read(kc, ksp, &kios))==-1) continue; |
211 |
|
strncpy(device_name, ksp->ks_name, sizeof device_name); |
212 |
|
for(x=0;x<(sizeof device_name);x++){ |
213 |
|
if( isdigit((int)device_name[x]) ) break; |
215 |
|
if(x == sizeof device_name) x--; |
216 |
|
device_name[x] = '\0'; |
217 |
|
get_alias(device_name); |
218 |
< |
} |
218 |
> |
} |
219 |
|
} |
220 |
< |
|
220 |
> |
|
221 |
|
return; |
222 |
|
} |
223 |
|
|
326 |
|
#ifdef ALLBSD |
327 |
|
{ |
328 |
|
kvm_t *kvmd = get_kvm(); |
329 |
< |
if (kvmd == NULL) return 1; |
329 |
> |
if (kvmd == NULL) return 1; |
330 |
|
} |
331 |
|
#endif |
332 |
|
#ifdef NETBSD |