Re[2]: [pso] Help Needed (T3L)

Andrei Costin pso@cursuri.cs.pub.ro
Wed, 5 May 2004 06:01:57 -0700 (PDT)


OP> Daca nu folosesti INIT_REQUEST/CURRENT/end_request() nu poti sa folosesti 

OP> campurile din request_t, trebuie sa folosesti campurile din buffer_head

Pai si exemplele din LDD, spre exemplu code snippets din SBULL:

Deci aici nu se foloseste INIT_REQUEST, end_request si functii mai low level:

void sbull_request(request_queue_t *q)
{
 /* ....

 .... */
 
 /* Process requests in the queue */
    while(! list_empty(&q->queue_head)) {

    /* Pull the next request off the list. */
        req = blkdev_entry_next_request(&q->queue_head);
        blkdev_dequeue_request(req);
        spin_unlock_irq (&io_request_lock);
        spin_lock(&device->lock);

    /* Process all of the buffers in this (possibly clustered) request. */
        do {
            status = sbull_transfer(device, req);
        } while (end_that_request_first(req, status, DEVICE_NAME));
        spin_unlock(&device->lock);
        spin_lock_irq (&io_request_lock);
        end_that_request_last(req);
    }
    
 /* ....

 .... */    
}

iar sbull_transfer() este:

adica se vede in calculul lui ptr si size ca se folosesc totusi cimpuri direct din
reqestu_t

static int sbull_transfer(Sbull_Dev *device, const struct request *req)
{
    int size;
    u8 *ptr;
    
    ptr = device->data + req->sector * sbull_hardsect;
    size = req->current_nr_sectors * sbull_hardsect;

    /* Make sure that the transfer fits within the device. */
    if (ptr + size > device->data + sbull_blksize*sbull_size) {
        static int count = 0;
        if (count++ < 5)
            printk(KERN_WARNING "sbull: request past end of device\n");
        return 0;
    }

    /* Looks good, do the transfer. */
    switch(req->cmd) {
        case READ:
            memcpy(req->buffer, ptr, size); /* from sbull to buffer */
            return 1;
        case WRITE:
            memcpy(ptr, req->buffer, size); /* from buffer to sbull */
            return 1;
        default:
            /* can't happen */
            return 0;
    }
}

Daca sincer nu am stat sa compilez SBULL in toate flavors-urile sale, dar banuiesc ca
autorii au
publicar cod care functioneaza totusi. Where's the catch atunci?

Multumesc anticipat pentru raspuns si rabdare acordata :).

PS: apropo de "Re: [pso] Tema 3 Linux...nu apare nimic in fisierele suport" ca raspuns
lui Rizoiu
Valentin, eu fac "close(fd)" la iesirea din thread si totusi fisierele /dev/file* sint
umplute cu
0x00 :((

Best regards and respect,
 Andrei Costin (mailto:zveriu_biz@yahoo.com)

___________________________________________
Manifest - ".M D - My Domain!" - by .Zveriu.
             y o
               m
               a
               i
               n



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover