#!/bin/bash -efu
# SPDX-License-Identifier: GPL-3.0-or-later

. guess-functions

devname="$1"; shift
fstype="$1"; shift

fsmod="${fstype%%.*}"

found=
while read -r fsname more; do
	if [ "${more:-$fsname}" = "$fsmod" ]; then
		found=1
		break
	fi
done < "$PROCFS_PATH/filesystems"

[ -n "$found" ] ||
	fatal "No filesystem found for '$fstype'"

if [ -n "${RESOLVE_MODALIAS-}" ]; then
	depinfo ${KERNEL:+-k "$KERNEL"} -D "fs-$fsmod" >/dev/null 2>&1 ||
		exit 0
fi

guess_modalias "fs-$fsmod"
