#include "md_p.h"
#include "md_u.h"
-int Detail(char *dev, int brief, int test)
+int Detail(char *dev, int brief, int test, char *homehost)
{
/*
* Print out details for an md array by using
} else if (e && e->percent >= 0)
printf("\n");
if (super && st)
- st->ss->detail_super(super);
+ st->ss->detail_super(super, homehost);
printf(" Number Major Minor RaidDevice State\n");
}
e->dev);
continue;
}
- rv |= Detail(name, verbose>1?0:verbose+1, test);
+ rv |= Detail(name, verbose>1?0:verbose+1, test, homehost);
put_md_name(name);
}
} else if (devmode == 'S' && scan) {
for (dv=devlist ; dv; dv=dv->next) {
switch(dv->disposition) {
case 'D':
- rv |= Detail(dv->devname, brief?1+verbose:0, test); continue;
+ rv |= Detail(dv->devname, brief?1+verbose:0, test, homehost); continue;
case 'K': /* Zero superblock */
rv |= Kill(dv->devname, force, quiet); continue;
case 'Q':
extern struct superswitch {
void (*examine_super)(void *sbv);
void (*brief_examine_super)(void *sbv);
- void (*detail_super)(void *sbv);
+ void (*detail_super)(void *sbv, char *homehost);
void (*brief_detail_super)(void *sbv);
void (*uuid_from_super)(int uuid[4], void *sbv);
void (*getinfo_super)(struct mdinfo *info, void *sbv);
int runstop, int verbose, int force, int assume_clean,
char *bitmap_file, int bitmap_chunk, int write_behind, int delay);
-extern int Detail(char *dev, int brief, int test);
+extern int Detail(char *dev, int brief, int test, char *homehost);
extern int Query(char *dev);
extern int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust,
struct supertype *forcest);
printf("\n");
}
-static void detail_super0(void *sbv)
+static void detail_super0(void *sbv, char *homehost)
{
mdp_super_t *sb = sbv;
printf(" UUID : ");
sb->set_uuid2, sb->set_uuid3);
else
printf("%08x", sb->set_uuid0);
+ if (homehost) {
+ unsigned char *hash = SHA1((unsigned char *)homehost,
+ strlen(homehost),
+ NULL);
+ if (memcmp(&sb->set_uuid2, hash, 8)==0)
+ printf(" (local to host %s)", homehost);
+ }
printf("\n Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
}
printf("\n");
}
-static void detail_super1(void *sbv)
+static void detail_super1(void *sbv, char *homehost)
{
struct mdp_superblock_1 *sb = sbv;
int i;
-
- printf(" Name : %.32s\n", sb->set_name);
- printf(" UUID : ");
+ int l = homehost ? strlen(homehost) : 0;
+
+ printf(" Name : %.32s", sb->set_name);
+ if (l > 0 && l < 32 &&
+ sb->set_name[l] == ':' &&
+ strncmp(sb->set_name, homehost, l) == 0)
+ printf(" (local to host %s)", homehost);
+ printf("\n UUID : ");
for (i=0; i<16; i++) {
if ((i&3)==0 && i != 0) printf(":");
printf("%02x", sb->set_uuid[i]);