Factorizing loops on removable/non-removable devices.
The already duplicated code will be needed a few more times for the upcoming
persistent-media={removable,removable-usb} boot option. Copy/pasting it a few
more times seems the wrong way to go, hence this factorization.
Depending on the place they are used, the newly introduced functions must return
a list of devices named either /sys/block/* or /dev/*. Their first parameter
therefore specifies the wanted output format (default is /dev/* as it is the
most often used).