static int
snprint_hcil (char * buff, size_t len, struct path * pp)
{
- if (pp->sg_id.host_no < 0)
+ if (!pp || pp->sg_id.host_no < 0)
return snprintf(buff, len, "#:#:#:#");
return snprintf(buff, len, "%i:%i:%i:%i",
static int
snprint_dev (char * buff, size_t len, struct path * pp)
{
- if (!strlen(pp->dev))
+ if (!pp || !strlen(pp->dev))
return snprintf(buff, len, "-");
else
return snprint_str(buff, len, pp->dev);
static int
snprint_dev_t (char * buff, size_t len, struct path * pp)
{
- if (!strlen(pp->dev))
+ if (!pp || !strlen(pp->dev))
return snprintf(buff, len, "#:#");
else
return snprint_str(buff, len, pp->dev_t);
static int
snprint_offline (char * buff, size_t len, struct path * pp)
{
- if (pp->offline)
+ if (!pp)
+ return snprintf(buff, len, "unknown");
+ else if (pp->offline)
return snprintf(buff, len, "offline");
+ else if (!pp->mpp)
+ return snprintf(buff, len, "orphan");
else
return snprintf(buff, len, "running");
}
static int
snprint_chk_state (char * buff, size_t len, struct path * pp)
{
+ if (!pp)
+ return snprintf(buff, len, "undef");
+
switch (pp->state) {
case PATH_UP:
return snprintf(buff, len, "ready");
static int
snprint_dm_path_state (char * buff, size_t len, struct path * pp)
{
+ if (!pp)
+ return snprintf(buff, len, "undef");
+
switch (pp->dmstate) {
case PSTATE_ACTIVE:
return snprintf(buff, len, "active");
static int
snprint_next_check (char * buff, size_t len, struct path * pp)
{
- if (!pp->mpp)
+ if (!pp || !pp->mpp)
return snprintf(buff, len, "orphan");
return snprint_progress(buff, len, pp->tick, pp->checkint);
static int
snprint_pri (char * buff, size_t len, struct path * pp)
{
- return snprint_int(buff, len, pp->priority);
+ return snprint_int(buff, len, pp ? pp->priority : -1);
}
static int