LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-23-2018, 01:06 PM   #1
eindemwort
Member
 
Registered: Dec 2017
Location: Regensburg, DE
Distribution: Slackware -current
Posts: 35

Rep: Reputation: Disabled
I need to find the kobject of my driver's sysfs directory


Hello,

I am developing a miscelaneous driver for Linu Kernel 4.9.80.
I want my driver to write some information in a file inside its sysfs directory (i.e. /sys/module/mydriversFolder/SomeFileWithInformaiton).

When I load my driver, if I go to the sys/modules/ directory, I can see there is already a directory for my driver which contains some folders and files (i.e. coresize, holders, initsize, initstate, etc.).

How can I get the kobject of this directory (the one that correspond to my drivers, inside /sys/module), so I can put a reference of it in another kboject's "parent" element?
I am trying to create a directory inside /sys/module/MyDriversFolder/.

Is this the correct approach?
Is there another -more correct/proper- way of doing this?

Thanks in advance!
 
Old 07-24-2018, 01:54 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
I think this might herlp: https://www.win.tue.nl/~aeb/linux/lk/lk-13.html
 
Old 07-24-2018, 08:30 AM   #3
eindemwort
Member
 
Registered: Dec 2017
Location: Regensburg, DE
Distribution: Slackware -current
Posts: 35

Original Poster
Rep: Reputation: Disabled
Hello AwesomeMachine.
Thanks for the link. That did help, altough it does not seem to match 100% to the kernel version I am working with (for instance, in the kernel version I am working with there is any kobject_register() method), but it was a good lecture to understand in a better way where to look at.
The proper way to do it is by means of an object of type "struct kset" (which holds a kobject member).

Thanks again.
 
  


Reply

Tags
drivers, kernel, sysfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
creating a sysfs directory with kobjects maksymilian.piechota Linux - Kernel 0 06-30-2017 12:44 PM
[SOLVED] "kobject and sysfs does not create a directory in sys/kernel" mrigendra Linux - Newbie 1 04-04-2017 11:44 AM
Is there a Kobject associated to every sysfs directory ? akhilbaai Linux - Kernel 1 02-24-2017 07:47 AM
Missing sysfs() function ... where to find? sieler Linux - Software 3 12-10-2010 12:54 PM
libbridge_private.h:36:28: sysfs/libsysfs.h: No such file or directory cellist Linux - Software 1 12-07-2004 10:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration