Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0b2bbab authored by Ed L. Cashin's avatar Ed L. Cashin Committed by Linus Torvalds
Browse files

aoe: make error messages more specific in static minor allocation



For some special-purpose systems where udev isn't present, static
allocation of minor numbers is desirable.  This update distinguishes
different failure scenarios, to help the user understand what went
wrong.

Signed-off-by: default avatarEd Cashin <ecashin@coraid.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 60116cf7
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -69,13 +69,23 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin)
		NPERSHELF = 16,
	};

	if (aoemin >= NPERSHELF) {
		pr_err("aoe: %s %d slots per shelf\n",
			"static minor device numbers support only",
			NPERSHELF);
		error = -1;
		goto out;
	}

	n = aoemaj * NPERSHELF + aoemin;
	if (aoemin >= NPERSHELF || n >= N_DEVS) {
	if (n >= N_DEVS) {
		pr_err("aoe: %s with e%ld.%d\n",
			"cannot use static minor device numbers",
			aoemaj, aoemin);
		error = -1;
	} else {
		goto out;
	}

	spin_lock_irqsave(&used_minors_lock, flags);
	if (test_bit(n, used_minors)) {
		pr_err("aoe: %s %lu\n",
@@ -85,9 +95,8 @@ minor_get_static(ulong *sysminor, ulong aoemaj, int aoemin)
	} else
		set_bit(n, used_minors);
	spin_unlock_irqrestore(&used_minors_lock, flags);
	}

	*sysminor = n;
out:
	return error;
}