X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=util.c;h=1736d70791c8ce5d145f6c01516384f4c19adb30;hb=f2e55eccfb92969c3e11bc5d4883315f2e866a14;hp=f073bce0ad5ad2e1129e7bafef3947b6ce770363;hpb=d7ab966bb82d1dfe5d532ae7bcbe233e906628ae;p=thirdparty%2Fmdadm.git diff --git a/util.c b/util.c index f073bce0..1736d707 100644 --- a/util.c +++ b/util.c @@ -828,6 +828,20 @@ int open_dev_excl(int devnum) return -1; } +int same_dev(char *one, char *two) +{ + struct stat st1, st2; + if (stat(one, &st1) != 0) + return 0; + if (stat(two, &st2) != 0) + return 0; + if ((st1.st_mode & S_IFMT) != S_IFBLK) + return 0; + if ((st2.st_mode & S_IFMT) != S_IFBLK) + return 0; + return st1.st_rdev == st2.st_rdev; +} + struct superswitch *superlist[] = { &super0, &super1, &super_ddf, &super_imsm, NULL }; #if !defined(MDASSEMBLE) || defined(MDASSEMBLE) && defined(MDASSEMBLE_AUTO) @@ -1209,7 +1223,7 @@ int start_mdmon(int devnum) NULL }; - if (env_no_mdmon()) + if (check_env("MDADM_NO_MDMON")) return 0; len = readlink("/proc/self/exe", pathbuf, sizeof(pathbuf)); @@ -1248,9 +1262,9 @@ int start_mdmon(int devnum) return 0; } -int env_no_mdmon(void) +int check_env(char *name) { - char *val = getenv("MDADM_NO_MDMON"); + char *val = getenv(name); if (val && atoi(val) == 1) return 1; @@ -1299,15 +1313,6 @@ void append_metadata_update(struct supertype *st, void *buf, int len) *st->update_tail = mu; st->update_tail = &mu->next; } - -struct superswitch *find_metadata_methods(char *vers) -{ - if (strcmp(vers, "ddf") == 0) - return &super_ddf; - if (strcmp(vers, "imsm") == 0) - return &super_imsm; - return NULL; -} #endif /* MDASSEMBLE */ #ifdef __TINYC__