I want to add a new functionality to Linux Kernel. In order to implement it I need to add a structure that can be accessed from another parts of the kernel by name.
How can I do it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not a kernel expert, but I would suggest avoiding having a globally visible symbol, and provide a function-based API (perhaps with some inlined functions, for those few who are performance critical).
I would suggest defining a set of functions only. Also, I’m not sure that giving a global data is a good idea -they are probably synchronization issues, especially on multi-core machines [most systems have at least 2 cores today]. So you probably better define a set of function interfaces, document them well (at least with good comments), and avoid global data.
I would also suggest to take inspiration from some part (or sub-system) of the kernel which might be similar to what you want to achieve. I also suggest to take advice from the kernel community, even early during the design phase, of your work (in particular, make your code publicly available even before it is working, to enable comments).
Good luck. It would be nice to understand what kind of sub-system or functionality are you aiming to implement.