From: Stephen Hemminger <shemminger@osdl.org>
To: linux-kernel@vger.kernel.org
Subject: Re: get device from file struct
Date: Wed, 13 Dec 2006 15:53:46 -0800 [thread overview]
Message-ID: <20061213155346.0a9ecf20@freekitty> (raw)
In-Reply-To: Pine.LNX.4.61.0612132011280.32433@yvahk01.tjqt.qr
On Wed, 13 Dec 2006 20:19:51 +0100 (MET)
Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
>
> >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.
>
> For hard disks:
> file->f_dentry->d_inode->d_sb->s_bdev gives you the block device
> in case it is a non-virtual filesystem.
>
> For pipes/sockets I do not know of a may to go from a filp to a
> struct sock or struct socket.
>
> >If it is a socket we are interested
> >from which device (eth0, eth1, lo, ...) the data was received.
>
> I do not think that is possible either.
The connection between file and network device is through many
layers and there is no direct binding. It could be 0 to N interfaces
and even be data dependent.
--
Stephen Hemminger <shemminger@osdl.org>
next prev parent reply other threads:[~2006-12-14 1:04 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
2006-12-13 19:19 ` Jan Engelhardt
2006-12-13 23:53 ` Stephen Hemminger [this message]
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=20061213155346.0a9ecf20@freekitty \
--to=shemminger@osdl.org \
--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