I am trying to create a symbolic link to a file in a Linux kernel module. With the following code, I have created a directory in sys/kernel
and then created a file in that directory:
// Create the base directory in sys/kernel
if (!(pmd_kobjSysKernelDir =
kobject_create_and_add(PMD_DRIVER_NAME, kernel_kobj)))
return -ENODEV;
if ((retVal = sysfs_create_file(
pmd_kobjSysKernelDir, &dev_attr_sysfs.attr)))
{
dev_err(&client->dev,
"couldn't create %s file \n", dev_attr_sysfs.attr.name);
return retVal;
}
Now I am trying to create a symbolic link to the file, that is represented by the dev_attr_sysfs
structure. The problem is, I only found sysfs_create_link
function, which seems to be able to create only directory symbolic links (I think). Is there a way to use it in order to create a symbolic link to a file? If not, is there any other dedicated function?