It occurs to me that I could really use some sort of enumeration function
in the linux kernel. That is, a function that I could call which would
give me a unique number for enumerating devices.
Of course, if I could use it, then someone else could probably use it, and
perhaps someone has allready written it!
The function would probably look something like this:
struct enumerate {
int num;
struct semaphore lock;
}
int enum(struct enumerate * foo)
{
volatile val;
down(foo->lock);
val = foo->num;
foo->num++;
up(foo->lock);
return val;
}
This function could be implemented much more effeciently in assembly, much
like the atomic_inc() function, but with a return code.
Does such a function allready exist in the linux-kernel?
Matt Dharm
-- Matthew Dharm Home: mdharm@one-eyed-alien.net Senior Engineer, QCP Inc. Work: mdharm@qcpi.comI could always suspend a few hundred accounts and watch what happens. -- Tanya User Friendly, 7/31/1998
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon Aug 07 2000 - 21:00:13 EST