+ struct block *block = NULL;
+
+ if (name != NULL)
+ {
+ block = block_get_by_name (name);
+ if (block == NULL)
+ PANIC ("No such block device \"%s\"", name);
+ }
+ else
+ {
+ for (block = block_first (); block != NULL; block = block_next (block))
+ if (block_type (block) == role)
+ break;
+ }
+
+ if (block != NULL)
+ {
+ printf ("%s: using %s\n", block_type_name (role), block_name (block));
+ block_set_role (role, block);
+ }