From: Gioh Kim Date: Wed, 29 Mar 2017 09:40:33 +0000 (+0200) Subject: super1: replace hard-coded values with bit definitions X-Git-Tag: mdadm-4.1-rc1~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa3131183661955de112fa7d9824207de63d9fa5;p=thirdparty%2Fmdadm.git super1: replace hard-coded values with bit definitions Some hard-coded values for disk status are replaced with bit definitions. Signed-off-by: Gioh Kim Signed-off-by: Jes Sorensen --- diff --git a/super1.c b/super1.c index e76f7777..6f91611c 100644 --- a/super1.c +++ b/super1.c @@ -1040,7 +1040,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map) info->disk.state = 0; /* spare: not active, not sync, not faulty */ break; case MD_DISK_ROLE_FAULTY: - info->disk.state = 1; /* faulty */ + info->disk.state = (1 << MD_DISK_FAULTY); /* faulty */ break; case MD_DISK_ROLE_JOURNAL: info->disk.state = (1 << MD_DISK_JOURNAL); @@ -1600,11 +1600,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk, } dk_state = dk->state & ~(1<raid_disk); else if (dk_state & (1< spare */ + else if ((dk_state & ~(1< spare */ *rp = MD_DISK_ROLE_SPARE; else *rp = MD_DISK_ROLE_FAULTY;