lkml.org 
[lkml]   [2002]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] dm update 3/3


On Tue, 29 Oct 2002, Joe Thornber wrote:

> Keep track of allocated minors in a bitset rather than abusing
> get_gendisk.

> + spin_lock(&_minor_lock);
> + for (i = 0; i < MAX_DEVICES; i++) {
> + if (!test_bit(i, _minor_bits)) {
> + r = i;
> + set_bit(i, _minor_bits);
> DMWARN("allocating minor = %d", i);
> - return i;
> + break;
> }
> + }
> + spin_unlock(&_minor_lock);

Ugh. See find_first_zero_bit() - no need to reinvent that wheel...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:30    [from the cache]
©2003-2011 Jasper Spaans