[pso] work_struct::data
Alexandru Mosoi
brtzsnr at gmail.com
Thu May 15 01:25:42 EEST 2008
acum implementam solutia asta. dar esti deacord cu mine ca workstructul
trebuie alocat pentru ficare bioprimit, nu?
2008/5/15 Mihai Borobocea <mihaiborobocea at gmail.com>:
> Uite o chestie care s-a schimbat de la LDD: bio_endio() ia acum 2
> parametri, nu 3.
> Din cate stiu, poti modifica bi_private doar la bio-urile create de tine.
> Legat de work_struct, eu l-am pus intr-o structura impreuna cu alte
> date private si am folosit container_of() (exact asa e sugerat si in
> laboratorul cu workqueue-uri).
>
> 2008/5/15 Alexandru Mosoi <brtzsnr at gmail.com>:
> > am demonstrat (prin incercari) ca data trebuie sa fie 0 ca se se apeleze
> > handlerul. de curiozitate, am voi sa schimb campul private din bio-ul
> > primit?
> >
> > 2008/5/15 Alexandru Mosoi <brtzsnr at gmail.com>:
> >>
> >> grhhh. de unde invechit? l-am luat din LDD3. asa... plus ca mi se pare
> >> ceva gresit in laborator. work_struct este defapt o lista inlantuita si
> >> mereu (in laborator) se pune in coada exact acelasi element (acelasi
> >> pointer). eu am alocat workqueue-ul si l-am eliberat in handler (m-am
> uitat
> >> in doc... err... surse si e corect ce fac). problema mea e cum folosesc
> data
> >> ala? ca mi-am pierdut deja 2 ore de somn incercand sa-mi dau seama
> treaba cu
> >> el (atribuirea lui dupa INIT/PREPARE_WORK face ca handlerul sa nu fie
> >> chemat).
> >>
> >> 2008/5/15 Razvan Deaconescu <razvand at cs.pub.ro>:
> >>>
> >>> On Wed, 2008-05-14 at 23:51 +0300, Alexandru Mosoi wrote:
> >>> > incerc sa folosesc membrul data pentru a transmite pointerul la
> >>> > structura bio astfel:
> >>> >
> >>> > work_handler:
> >>> >
> >>> > struct bio* bio =
> >>> > (struct bio *)atomic_long_read(&work->data);
> >>> >
> >>> > printk(KERN_ALERT "handler bio = %p\n", bio);
> >>> >
> >>> >
> >>> > bio_request
> >>> >
> >>> > printk(KERN_ALERT "request bio = %p\n", bio);
> >>> >
> >>> > atomic_long_set(&device->work.data, (long)bio);
> >>> > PREPARE_WORK(&device->work, ssr_work_handler);
> >>> > schedule_work(&device->work);
> >>> >
> >>> >
> >>> > nu stiu ce gresesc, dar cei doi pointeri sunt distincti.
> >>>
> >>> Hmmm ... de unde ai luat exemplele de folosire a work-queue-urilor?
> >>> API-ul folosit de tine este invechit. Te-ai uitat pe solutiile
> >>> laboratorului 7 [1] (exercitiul 4) pentru un model de folosire a
> >>> work-struct-urilor? Sau chiar in laborator[2]?
> >>>
> >>> Razvan
> >>>
> >>> [1] http://cs.pub.ro/~pso/wiki/images/4/41/Lab7-tasks-sol.zip<http://cs.pub.ro/%7Epso/wiki/images/4/41/Lab7-tasks-sol.zip>
> >>> [2]
> >>>
> http://cs.pub.ro/~pso/index.php?section=Laboratoare&file=07.%20Actiuni%20amanabile#Workqueues<http://cs.pub.ro/%7Epso/index.php?section=Laboratoare&file=07.%20Actiuni%20amanabile#Workqueues>
> _______________________________________________
> pso mailing list
> pso at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/pso
>
--
Alexandru Moşoi
http://alexandru.mosoi.googlepages.com
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/pso/attachments/20080515/d876830b/attachment.htm
More information about the pso
mailing list