public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Silviu Craciunas <silviu.craciunas@sbg.ac.at>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: get device from file struct
Date: Wed, 13 Dec 2006 13:28:59 +0100	[thread overview]
Message-ID: <1166012939.30185.77.camel@ThinkPadCK6> (raw)
In-Reply-To: <Pine.LNX.4.61.0612131200430.25870@yvahk01.tjqt.qr>

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


  reply	other threads:[~2006-12-13 12:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-11 15:22 get device from file struct Silviu Craciunas
2006-12-11 18:34 ` Brice Goglin
2006-12-12  9:04   ` Silviu Craciunas
2006-12-13  9:59     ` Jan Engelhardt
2006-12-13 10:37       ` Silviu Craciunas
2006-12-13 11:03         ` Jan Engelhardt
2006-12-13 12:28           ` Silviu Craciunas [this message]
2006-12-13 19:19             ` Jan Engelhardt
2006-12-13 23:53               ` Stephen Hemminger
2006-12-14 13:03                 ` Silviu Craciunas
2006-12-14 18:45                   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1166012939.30185.77.camel@ThinkPadCK6 \
    --to=silviu.craciunas@sbg.ac.at \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox