summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-05-19 07:13:03 +0000
committerNeil Brown <neilb@suse.de>2006-05-19 07:13:03 +0000
commitb6750aa8da57bfc0eb3a3bdc47c289638b1022c8 (patch)
treefadb26de92f6cd4c8ca07064133250b9fb47a32d
parent05697ec1e26eadc2f814d9f84f8c783fff5b98b5 (diff)
downloadmdadm-b6750aa8da57bfc0eb3a3bdc47c289638b1022c8.tar.gz
mdadm-b6750aa8da57bfc0eb3a3bdc47c289638b1022c8.tar.xz
mdadm-b6750aa8da57bfc0eb3a3bdc47c289638b1022c8.zip
Include homehost information in --detail where appropriate.
Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--Detail.c4
-rw-r--r--mdadm.c4
-rw-r--r--mdadm.h4
-rw-r--r--super0.c9
-rw-r--r--super1.c13
5 files changed, 23 insertions, 11 deletions
diff --git a/Detail.c b/Detail.c
index c377f29..832e0d8 100644
--- a/Detail.c
+++ b/Detail.c
@@ -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");
}
diff --git a/mdadm.c b/mdadm.c
index d123e49..de0a503 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -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':
diff --git a/mdadm.h b/mdadm.h
index 7bfd8cb..2a2529f 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -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);
diff --git a/super0.c b/super0.c
index 7fe2336..d1fbfae 100644
--- a/super0.c
+++ b/super0.c
@@ -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);
}
diff --git a/super1.c b/super1.c
index a29795a..77118d4 100644
--- a/super1.c
+++ b/super1.c
@@ -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;
-
- 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]);