char *getVoldName(struct device *dev, char *name) { char *rname; if(!SHOULD_USE_VOLD(dev)) return name; /*** * Solaris specific routines to use the volume management * daemon and libraries to get the correct device name... ***/ rname = media_findname(name); #ifdef HAVE_MEDIA_OLDALIASES if (rname == NULL) { if ((alias_name = media_oldaliases(name)) != NULL) rname = media_findname(alias_name); } #endif if (rname == NULL) { fprintf(stderr, "No such volume or no media in device: %s.\n", name); exit(1); } return rname; }
/* * This is an ON Consolidation Private interface. * * Print out the aliases available to the program user. Changes * depending in whether volume management is running. */ void _media_printaliases(void) { struct alias *s; DIR *dirp; struct dirent64 *dp; char pathbuf[MAXPATHLEN+1]; char *p; static const char *vold_root = NULL; if (vold_root == NULL) { vold_root = volmgt_root(); } if (!volmgt_running()) { /* no volume management */ for (s = device_aliases; *s->alias != NULLC; s++) { (void) printf("\t%s -> %s\n", s->alias, s->name); } return; } for (s = volmgt_aliases; *s->alias != NULLC; s++) { (void) printf("\t%s -> %s\n", s->alias, s->name); } (void) concat_paths(pathbuf, (char *)vold_root, ALIAS_DIR, NULL); if ((dirp = opendir(pathbuf)) == NULL) { return; } while (dp = readdir64(dirp)) { if (strcmp(dp->d_name, ".") == 0) { continue; } if (strcmp(dp->d_name, "..") == 0) { continue; } if ((p = media_findname(dp->d_name)) != NULL) { (void) printf("\t%s -> %s\n", dp->d_name, p); } } (void) closedir(dirp); }