Include homehost information in --examine as appropriate
Signed-off-by: Neil Brown <neilb@suse.de>
This commit is contained in:
parent
b6750aa8da
commit
a1cbd7d053
|
@ -35,7 +35,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include "md_u.h"
|
#include "md_u.h"
|
||||||
#include "md_p.h"
|
#include "md_p.h"
|
||||||
int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct supertype *forcest)
|
int Examine(mddev_dev_t devlist, int brief, int scan,
|
||||||
|
int SparcAdjust, struct supertype *forcest,
|
||||||
|
char *homehost)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Read the raid superblock from a device and
|
/* Read the raid superblock from a device and
|
||||||
|
@ -124,7 +126,7 @@ int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust, struct su
|
||||||
dl_add(ap->devs, d);
|
dl_add(ap->devs, d);
|
||||||
} else {
|
} else {
|
||||||
printf("%s:\n",devlist->devname);
|
printf("%s:\n",devlist->devname);
|
||||||
st->ss->examine_super(super);
|
st->ss->examine_super(super, homehost);
|
||||||
free(super);
|
free(super);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
mdadm.c
2
mdadm.c
|
@ -1054,7 +1054,7 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, Name ": No devices listed in %s\n", configfile?configfile:DefaultConfFile);
|
fprintf(stderr, Name ": No devices listed in %s\n", configfile?configfile:DefaultConfFile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief, scan, SparcAdjust, ss);
|
rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief, scan, SparcAdjust, ss, homehost);
|
||||||
} else {
|
} else {
|
||||||
if (devlist == NULL) {
|
if (devlist == NULL) {
|
||||||
if (devmode=='D' && scan) {
|
if (devmode=='D' && scan) {
|
||||||
|
|
4
mdadm.h
4
mdadm.h
|
@ -272,7 +272,7 @@ extern char *map_dev(int major, int minor, int create);
|
||||||
|
|
||||||
|
|
||||||
extern struct superswitch {
|
extern struct superswitch {
|
||||||
void (*examine_super)(void *sbv);
|
void (*examine_super)(void *sbv, char *homehost);
|
||||||
void (*brief_examine_super)(void *sbv);
|
void (*brief_examine_super)(void *sbv);
|
||||||
void (*detail_super)(void *sbv, char *homehost);
|
void (*detail_super)(void *sbv, char *homehost);
|
||||||
void (*brief_detail_super)(void *sbv);
|
void (*brief_detail_super)(void *sbv);
|
||||||
|
@ -361,7 +361,7 @@ extern int Create(struct supertype *st, char *mddev, int mdfd,
|
||||||
extern int Detail(char *dev, int brief, int test, char *homehost);
|
extern int Detail(char *dev, int brief, int test, char *homehost);
|
||||||
extern int Query(char *dev);
|
extern int Query(char *dev);
|
||||||
extern int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust,
|
extern int Examine(mddev_dev_t devlist, int brief, int scan, int SparcAdjust,
|
||||||
struct supertype *forcest);
|
struct supertype *forcest, char *homehost);
|
||||||
extern int Monitor(mddev_dev_t devlist,
|
extern int Monitor(mddev_dev_t devlist,
|
||||||
char *mailaddr, char *alert_cmd,
|
char *mailaddr, char *alert_cmd,
|
||||||
int period, int daemonise, int scan, int oneshot,
|
int period, int daemonise, int scan, int oneshot,
|
||||||
|
|
16
super0.c
16
super0.c
|
@ -84,7 +84,7 @@ void super0_swap_endian(struct mdp_superblock_s *sb)
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
|
|
||||||
static void examine_super0(void *sbv)
|
static void examine_super0(void *sbv, char *homehost)
|
||||||
{
|
{
|
||||||
mdp_super_t *sb = sbv;
|
mdp_super_t *sb = sbv;
|
||||||
time_t atime;
|
time_t atime;
|
||||||
|
@ -94,10 +94,18 @@ static void examine_super0(void *sbv)
|
||||||
printf(" Magic : %08x\n", sb->md_magic);
|
printf(" Magic : %08x\n", sb->md_magic);
|
||||||
printf(" Version : %02d.%02d.%02d\n", sb->major_version, sb->minor_version,
|
printf(" Version : %02d.%02d.%02d\n", sb->major_version, sb->minor_version,
|
||||||
sb->patch_version);
|
sb->patch_version);
|
||||||
if (sb->minor_version >= 90)
|
if (sb->minor_version >= 90) {
|
||||||
printf(" UUID : %08x:%08x:%08x:%08x\n", sb->set_uuid0, sb->set_uuid1,
|
printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
|
||||||
sb->set_uuid2, sb->set_uuid3);
|
sb->set_uuid2, sb->set_uuid3);
|
||||||
else
|
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");
|
||||||
|
} else
|
||||||
printf(" UUID : %08x\n", sb->set_uuid0);
|
printf(" UUID : %08x\n", sb->set_uuid0);
|
||||||
|
|
||||||
atime = sb->ctime;
|
atime = sb->ctime;
|
||||||
|
|
11
super1.c
11
super1.c
|
@ -136,7 +136,7 @@ static unsigned int calc_sb_1_csum(struct mdp_superblock_1 * sb)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef MDASSEMBLE
|
#ifndef MDASSEMBLE
|
||||||
static void examine_super1(void *sbv)
|
static void examine_super1(void *sbv, char *homehost)
|
||||||
{
|
{
|
||||||
struct mdp_superblock_1 *sb = sbv;
|
struct mdp_superblock_1 *sb = sbv;
|
||||||
time_t atime;
|
time_t atime;
|
||||||
|
@ -144,6 +144,7 @@ static void examine_super1(void *sbv)
|
||||||
int faulty;
|
int faulty;
|
||||||
int i;
|
int i;
|
||||||
char *c;
|
char *c;
|
||||||
|
int l = homehost ? strlen(homehost) : 0;
|
||||||
|
|
||||||
printf(" Magic : %08x\n", __le32_to_cpu(sb->magic));
|
printf(" Magic : %08x\n", __le32_to_cpu(sb->magic));
|
||||||
printf(" Version : %02d\n", 1);
|
printf(" Version : %02d\n", 1);
|
||||||
|
@ -154,8 +155,12 @@ static void examine_super1(void *sbv)
|
||||||
printf("%02x", sb->set_uuid[i]);
|
printf("%02x", sb->set_uuid[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(" Name : %.32s\n", sb->set_name);
|
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");
|
||||||
atime = __le64_to_cpu(sb->ctime) & 0xFFFFFFFFFFULL;
|
atime = __le64_to_cpu(sb->ctime) & 0xFFFFFFFFFFULL;
|
||||||
printf(" Creation Time : %.24s\n", ctime(&atime));
|
printf(" Creation Time : %.24s\n", ctime(&atime));
|
||||||
c=map_num(pers, __le32_to_cpu(sb->level));
|
c=map_num(pers, __le32_to_cpu(sb->level));
|
||||||
|
|
Loading…
Reference in New Issue