Re: open a file in spin_lock_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Selon Dmitry Torokhov <dtor_core@ameritech.net>:

> On Wednesday 02 June 2004 01:20 am, Guillaume Thouvenin wrote:
> > I implemented the ioctl as follow:
> > 
> > int my_ioctl(...) {
> >     ...
> >     switch(cmd) {
> >         case REMOVE_AN_ITEM:
> >             spin_lock_irq(&my_lock);
> >             update_my_structure();
> >             spin_unlock_irq(&my_lock);
> >             break;
> >          ....
> >     }
> > }
> > 
> It your structure accessed form an interrupt/tasklet?

My strcture can be accessed by a user via ioctl or it can also be accessed by
the kernel when a process is terminated or created (I add some code in
kernel/exit.c and in kernel/fork.c). It's not obvious for me but I think
spin_lock_irq is needed here. You can see all my code from the web page
http://cvs.sourceforge.net/viewcvs.py/elsa/modifs_kernel/drivers/elsacct/
Two main files are bank.c that contains structure I used and elsacct.c that
"plays" with it. 

> That's ignoring the fact that whole idea of dumping
> anything onto a file system from kernel is messy IMHO.

So is the solution something like relayfs to transfer data from kernel to user
space and let the user do what he wants with the data?  

Guillaume

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux