2. I need to do block I/O, both synchronously and asynchronously.

Richard Dynes (rdynes@varcom.com)
Thu, 22 Apr 1999 12:49:47 +0000


I sugggest (1) the plethora of drivers in the source, and (2)
Alessando Rubini's Linux Device Drivers, published by ORA.

> 1. What is the correct way to do a generic thread yield?

Assuming a __kernel__ thread yield, schedule() is correct.

void semTake(SEM_ID psem, int timeout)
{
// Note no timeout provision....
int i=0;

if (verbosity > 15) printk(" semTake %x\n", *psem);

while (*psem == _T_SEM_EMPTY )
{
schedule(); // note: using sleep_on is a better
possibility...
.....

> 2. I need to do block I/O, both synchronously and asynchronously.

static struct wait_queue *data_wait_queue = NULL;

interruptible_sleep_on(&data_wait_queue);
wake_up_interruptible(&data_wait_queue);

> 3. What is the right way to determine the number of blocks...

I've only done network drivers. I stay away from block thingys.

-Richard

-- 
    Richard Dynes
    rdynes@varcom.com

- 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/