Re: Linux Kernel readlink equivalent

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

 



>>
Hello,

I'm working on some linux kernel driver stuff and I have a fake path called /dev/blah/whatever that points to /dev/block/real_device.

The issue is that lookup_bdev will fail to follow the symlink so I'd like to massage the path upfront by getting the real path (/dev/block/real_device) so I can hand that off to lookup_bdev so it returns successfully instead of an error.

Or any other kernel call that would correctly retrieve the block_device information given the initial path which is a symlink.

Note: I saw that the tomoyo module has something like that but I was looking for the generic implementation of the kernel if one exists.

Thanks

David

David,
 
1 - Please read through: man 2 readlink ( yes please read it *all* very carefully !

2 - There is a system call readlink study it... 


3  grep through the kernel and see where and how readlink is used.

    Try :   find . -name "*.[ch]" | xargs grep "readlink"

    and :   find . -name "*.[ch]" | xargs grep " readlink("

    and :   find . -name "*.[ch]" | xargs grep ">readlink"

Good luck - Aruna


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[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