// finds out which hash names are sorted with static int what_hash (struct super_block * s) { __u32 code; code = sb_hash_function_code(SB_DISK_SUPER_BLOCK(s)); /* reiserfs_hash_detect() == true if any of the hash mount options ** were used. We must check them to make sure the user isn't ** using a bad hash value */ if (code == UNSET_HASH || reiserfs_hash_detect(s)) code = find_hash_out (s); if (code != UNSET_HASH && reiserfs_hash_detect(s)) { /* detection has found the hash, and we must check against the ** mount options */ if (reiserfs_rupasov_hash(s) && code != YURA_HASH) { printk("REISERFS: Error, %s hash detected, " "unable to force rupasov hash\n", reiserfs_hashname(code)) ; code = UNSET_HASH ; } else if (reiserfs_tea_hash(s) && code != TEA_HASH) { printk("REISERFS: Error, %s hash detected, " "unable to force tea hash\n", reiserfs_hashname(code)) ; code = UNSET_HASH ; } else if (reiserfs_r5_hash(s) && code != R5_HASH) { printk("REISERFS: Error, %s hash detected, " "unable to force r5 hash\n", reiserfs_hashname(code)) ; code = UNSET_HASH ; } } else { /* find_hash_out was not called or could not determine the hash */ if (reiserfs_rupasov_hash(s)) { code = YURA_HASH ; } else if (reiserfs_tea_hash(s)) { code = TEA_HASH ; } else if (reiserfs_r5_hash(s)) { code = R5_HASH ; } } /* if we are mounted RW, and we have a new valid hash code, update ** the super */ if (code != UNSET_HASH && !(s->s_flags & MS_RDONLY) && code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); } return code; }
/* Finds out which hash names are sorted with */ static int what_hash(struct reiserfs_mount *rmp) { uint32_t code; struct reiserfs_sb_info *sbi = rmp->rm_reiserfs; find_hash_out(rmp); code = sb_hash_function_code(SB_DISK_SUPER_BLOCK(sbi)); /* * reiserfs_hash_detect() == true if any of the hash mount options * were used. We must check them to make sure the user isn't using a * bad hash value */ if (code == UNSET_HASH || reiserfs_hash_detect(sbi)) code = find_hash_out(rmp); if (code != UNSET_HASH && reiserfs_hash_detect(sbi)) { /* * Detection has found the hash, and we must check against * the mount options */ if (reiserfs_rupasov_hash(sbi) && code != YURA_HASH) { reiserfs_log(LOG_ERR, "error, %s hash detected, " "unable to force rupasov hash", reiserfs_hashname(code)); code = UNSET_HASH; } else if (reiserfs_tea_hash(sbi) && code != TEA_HASH) { reiserfs_log(LOG_ERR, "error, %s hash detected, " "unable to force tea hash", reiserfs_hashname(code)); code = UNSET_HASH; } else if (reiserfs_r5_hash(sbi) && code != R5_HASH) { reiserfs_log(LOG_ERR, "error, %s hash detected, " "unable to force r5 hash", reiserfs_hashname(code)); code = UNSET_HASH; } } else { /* * Find_hash_out was not called or could not determine * the hash */ if (reiserfs_rupasov_hash(sbi)) { code = YURA_HASH; } else if (reiserfs_tea_hash(sbi)) { code = TEA_HASH; } else if (reiserfs_r5_hash(sbi)) { code = R5_HASH; } } /* TODO Not supported yet */ #if 0 /* If we are mounted RW, and we have a new valid hash code, update * the super */ if (code != UNSET_HASH && !(s->s_flags & MS_RDONLY) && code != sb_hash_function_code(SB_DISK_SUPER_BLOCK(s))) { set_sb_hash_function_code(SB_DISK_SUPER_BLOCK(s), code); } #endif return (code); }