Thread (5 messages) 5 messages, 3 authors, 2015-01-30

Linux Kernel readlink equivalent

From: David Legault <hidden>
Date: 2015-01-30 16:02:01

On Thu, Jan 29, 2015 at 2:37 PM, Greg KH [off-list ref] wrote:
On Thu, Jan 29, 2015 at 01:11:13PM -0500, David Legault wrote:
quoted
Hello,

I'm working on some linux kernel driver stuff and I have a fake path
called /
quoted
dev/blah/whatever that points to /dev/block/real_device.
That's a userspace "path", right?  Why would the kernel care about this?
quoted
The issue is that lookup_bdev will fail to follow the symlink so I'd
like to
quoted
massage the path upfront by getting the real path
(/dev/block/real_device) so I
quoted
can hand that off to lookup_bdev so it returns successfully instead of an
error.
Why are you calling this from within the kernel?  You should have a bdev
already directly within the kernel, no need to muck around in /dev/
The path used is generic in that it never changes, but the pointed block
device underneath changes based on the hardware/configuration in place. So
the idea was to load a module passing the path as a module argument so I
could access the underlying block device through the link without having to
worry about the real block device path.

What exactly are you doing that you feel you need access to a block
device node?

thanks,

greg k-h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150130/773d3140/attachment.html 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help