Include homehost information in --detail where appropriate.

Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
Neil Brown 2006-05-19 07:13:03 +00:00
parent 05697ec1e2
commit b6750aa8da
5 changed files with 22 additions and 10 deletions

View File

@ -31,7 +31,7 @@
#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
@ -268,7 +268,7 @@ This is pretty boring
} 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");
}

View File

@ -1069,7 +1069,7 @@ int main(int argc, char *argv[])
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) {
@ -1114,7 +1114,7 @@ int main(int argc, char *argv[])
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':

View File

@ -274,7 +274,7 @@ extern char *map_dev(int major, int minor, int create);
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);
@ -358,7 +358,7 @@ extern int Create(struct supertype *st, char *mddev, int mdfd,
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);

View File

@ -231,7 +231,7 @@ static void brief_examine_super0(void *sbv)
printf("\n");
}
static void detail_super0(void *sbv)
static void detail_super0(void *sbv, char *homehost)
{
mdp_super_t *sb = sbv;
printf(" UUID : ");
@ -240,6 +240,13 @@ static void detail_super0(void *sbv)
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);
}

View File

@ -317,13 +317,18 @@ static void brief_examine_super1(void *sbv)
printf("\n");
}
static void detail_super1(void *sbv)
static void detail_super1(void *sbv, char *homehost)
{
struct mdp_superblock_1 *sb = sbv;
int i;
int l = homehost ? strlen(homehost) : 0;
printf(" Name : %.32s\n", sb->set_name);
printf(" UUID : ");
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]);