Re: get device from file struct

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

 



On Wed, 2006-12-13 at 12:03 +0100, Jan Engelhardt wrote:
> >> >thanks for the reply, the block device can be determined with the major
> >> >and minor numbers , what I would be more interested in is if one can get
> >> >the net_device struct from the file struct
> >> 
> >> Just how are you supposed to match files and network devices?
> >> 
> >
> >from the struct file you can get the struct socket and from there to the
> >struct sock .
> 
> That only applies when using PF_LOCAL sockets.
> 
> >What I would like to find out is where the data is coming
> >from (read) and where it is going to(write) or if it is even possible to
> >find the net device out using the struct file.
> 
> I really don't get what you want.
> 
> Suppose a daemon reads from a socket (PF_INET), then there is a file descriptor
> to sockfs (look into /proc/$$/fd/). Well, then you may be able to get the
> struct file for that socket, but it does not connect to a regular file
> (S_IFREG) at all.
> 
> 
> 	-`J'

in fs/read_write.c, the vfs_read function does:

file->f_op->read(file, buf, count, pos);

after this call is it possible to determine where the
data is coming from? e.g., the first hard disk, a pipe
or from a socket. If it is a socket we are interested
from which device (eth0, eth1, lo, ...) the data was received.

silviu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux