Lines Matching defs:dependents
68 #define MSG_FAIL_DEPENDENTS gettext("failed while calling dependents.")
268 char **dependents;
283 if (use_cache(rsrc, errorp, &dependents) < 0) {
307 for (i = 0; dependents[i] != NULL; i++) {
308 if (is_critical(dependents[i])) {
322 /* Convert the gathered dependents into an error message */
323 *errorp = create_message(MSG_HDR_STD, MSG_HDR_STD_MULTI, dependents);
331 free_list(dependents);
366 char **dependents;
378 if (use_cache(rsrc, errorp, &dependents) < 0)
381 /* Convert the gathered dependents into a usage message */
382 *usagep = create_message(MSG_HDR_STD, MSG_HDR_STD_MULTI, dependents);
388 free_list(dependents);
392 /* Recurse on dependents if necessary */
393 if ((flag & RCM_INCLUDE_DEPENDENT) && (dependents != NULL)) {
394 prune_dependents(dependents, rsrc);
395 if (dependents[0] != NULL) {
396 if ((rv = rcm_get_info_list(hd, dependents, flag,
404 free_list(dependents);
412 * Notify all dependents that the resource is being suspended.
420 char **dependents;
431 if (use_cache(rsrc, errorp, &dependents) < 0)
434 /* Unforced suspensions fail if any of the dependents are critical */
435 if (detect_critical_failure(errorp, flag, dependents)) {
436 free_list(dependents);
440 /* Recurse on dependents if necessary */
441 if ((flag & RCM_INCLUDE_DEPENDENT) && (dependents != NULL)) {
442 prune_dependents(dependents, rsrc);
443 if (dependents[0] != NULL)
444 if ((rv = rcm_request_suspend_list(hd, dependents, flag,
449 free_list(dependents);
457 * Resume all the dependents of a suspended filesystem.
464 char **dependents;
474 if (use_cache(rsrc, errorp, &dependents) < 0)
477 /* Recurse on dependents if necessary */
478 if ((flag & RCM_INCLUDE_DEPENDENT) && (dependents != NULL)) {
479 prune_dependents(dependents, rsrc);
480 if (dependents[0] != NULL) {
481 if ((rv = rcm_notify_resume_list(hd, dependents, flag,
487 free_list(dependents);
1149 * multiple dependents, then the string uses the second header and the
1150 * full list of dependents is appended at the end as a comma separated
1154 create_message(char *header, char *header_multi, char **dependents)
1165 assert(dependents != NULL);
1167 /* Count the number of dependents */
1168 for (ndependents = 0; dependents[ndependents] != NULL; ndependents++);
1170 /* If there are no dependents, fail */
1176 /* Pick the appropriate header to use based on amount of dependents */
1185 for (i = 0; dependents[i] != NULL; i++)
1186 len += strlen(dependents[i]) + 2; /* +2 for quotemarks */
1200 for (i = 0; dependents[i] != NULL; i++) {
1202 (void) strlcat(msg_buf, dependents[i], len);
1224 char **dependents;
1237 dependents = (char **)calloc(entry->n_mounts + 1, sizeof (char *));
1238 if (dependents == NULL) {
1240 "FILESYS: failed to allocate dependents (%s).\n",
1246 /* Copy all the dependent names into the new list of dependents */
1248 if ((dependents[i] = strdup(entry->mountps[i])) == NULL) {
1252 free_list(dependents);
1258 return (dependents);
1264 * Given a list of dependents, a place to store an error message, and
1275 detect_critical_failure(char **errorp, uint_t flags, char **dependents)
1281 /* Do nothing if the operation is forced or there are no dependents */
1282 if ((errorp == NULL) || (flags & RCM_FORCE) || (dependents == NULL))
1286 * Count how many of the dependents are critical, and shift the
1289 if (dependents) {
1290 for (i = 0, n_critical = 0; dependents[i] != NULL; i++) {
1291 if (is_critical(dependents[i])) {
1293 tmp = dependents[n_critical];
1294 dependents[n_critical] = dependents[i];
1295 dependents[i] = tmp;
1312 for (i = n_critical; dependents[i] != NULL; i++) {
1313 free(dependents[i]);
1314 dependents[i] = NULL;
1318 *errorp = create_message(MSG_HDR_CRIT, MSG_HDR_CRIT_MULTI, dependents);
1361 * in the cache and extract a separate list of dependents for that
1390 * Before calling back into RCM with a list of dependents, the list
1395 prune_dependents(char **dependents, char *rsrc)
1400 if (dependents) {
1403 for (n = 0; dependents[n] != NULL; n++);
1406 * Move offending dependents to the tail of the list and
1409 for (i = 0; dependents[i] != NULL; i++) {
1410 if ((strcmp(dependents[i], rsrc) == 0) ||
1411 (strcmp(dependents[i], "/") == 0)) {
1412 free(dependents[i]);
1413 dependents[i] = dependents[n - 1];
1414 dependents[n] = NULL;