Lines Matching refs:mp

98 		fstyp_module_t *mp);
102 fstyp_module_t *mp);
180 fstyp_module_t *mp;
187 for (mp = h->modules; mp != NULL; mp = mp->next) {
188 if ((fstyp_load_module(h, mp) == 0) &&
189 (mp->ops.fstyp_ident(mp->mod_handle) == 0)) {
195 h->ident = mp;
196 *ident = &mp->fsname[0];
210 fstyp_module_t *mp;
226 mp = fstyp_find_module_by_name(h, fsname);
228 mp = h->modules;
230 if (mp == NULL) {
234 if (((error = fstyp_load_module(h, mp)) == 0) &&
235 ((error = mp->ops.fstyp_ident(mp->mod_handle)) == 0)) {
236 h->ident = mp;
249 fstyp_module_t *mp = h->ident;
251 if (mp == NULL) {
255 return (mp->ops.fstyp_get_attr(mp->mod_handle, attr));
264 fstyp_module_t *mp = h->ident;
266 if (mp == NULL) {
270 if (mp->ops.fstyp_dump == NULL) {
274 return (mp->ops.fstyp_dump(mp->mod_handle, fout, ferr));
344 fstyp_module_t *mp;
346 for (mp = h->modules; mp != NULL; mp = mp->next) {
347 if (strcmp(mp->fsname, fsname) == 0) {
348 return (mp);
364 fstyp_module_t *mp;
367 if ((mp = fstyp_find_module_by_name(h, fsname)) != NULL) {
369 *mpp = mp;
386 if ((mp = calloc(1, sizeof (fstyp_module_t))) == NULL) {
391 mp->pathname = pathname;
392 (void) strlcpy(mp->fsname, fsname, sizeof (mp->fsname));
396 h->modules = h->modules_tail = mp;
398 h->modules_tail->next = mp;
399 h->modules_tail = mp;
403 *mpp = mp;
412 fstyp_fini_module(struct fstyp_handle *h, fstyp_module_t *mp)
414 if (h->ident == mp) {
417 fstyp_unload_module(h, mp);
418 if (mp->pathname != NULL) {
419 free(mp->pathname);
421 free(mp);
465 fstyp_module_t *mp, *mp_next;
467 for (mp = h->modules; mp != NULL; mp = mp_next) {
468 mp_next = mp->next;
469 fstyp_fini_module(h, mp);
479 fstyp_load_module(struct fstyp_handle *h, fstyp_module_t *mp)
483 if (mp->dl_handle != NULL) {
487 if ((mp->dl_handle = dlopen(mp->pathname, RTLD_LAZY)) == NULL) {
491 mp->ops.fstyp_init = (int (*)(int, off64_t, fstyp_mod_handle_t *))
492 dlsym(mp->dl_handle, "fstyp_mod_init");
493 mp->ops.fstyp_fini = (void (*)(fstyp_mod_handle_t))
494 dlsym(mp->dl_handle, "fstyp_mod_fini");
495 mp->ops.fstyp_ident = (int (*)(fstyp_mod_handle_t))
496 dlsym(mp->dl_handle, "fstyp_mod_ident");
497 mp->ops.fstyp_get_attr = (int (*)(fstyp_mod_handle_t, nvlist_t **))
498 dlsym(mp->dl_handle, "fstyp_mod_get_attr");
499 mp->ops.fstyp_dump = (int (*)(fstyp_mod_handle_t, FILE *, FILE *))
500 dlsym(mp->dl_handle, "fstyp_mod_dump");
502 if (((mp->ops.fstyp_init) == NULL) ||
503 ((mp->ops.fstyp_fini) == NULL) ||
504 ((mp->ops.fstyp_ident) == NULL) ||
505 ((mp->ops.fstyp_get_attr) == NULL)) {
506 fstyp_unload_module(h, mp);
510 error = mp->ops.fstyp_init(h->fd, h->offset, &mp->mod_handle);
512 fstyp_unload_module(h, mp);
521 fstyp_unload_module(struct fstyp_handle *h, fstyp_module_t *mp)
523 if (mp->mod_handle != NULL) {
524 mp->ops.fstyp_fini(mp->mod_handle);
525 mp->mod_handle = NULL;
527 if (mp->dl_handle != NULL) {
528 (void) dlclose(mp->dl_handle);
529 mp->dl_handle = NULL;