<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span style="font-size: 12pt;">Hi,</span><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div class="y_msg_container"><div id="yiv4130440407"><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">For a small side-project I decided to make some changes directly to the kernel code, so that it offers some extra functionality I need.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york',
times, serif; background-color: transparent; font-style: normal;">I have not done this before in such capacity and only put together some modules here and there in the past.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Since now I'm not creating a module, instead I'm hacking the kernel directly, I have
some questions:</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Most of my code is implemented in a new file I created <span style="font-size:12pt;"> </span><span style="font-size:12pt;">under /kernel/myfile.c </span><span style="background-color:transparent;">and added in the main Makefile (other parts of the code are spread around the existing code as edits).</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;"><br></span></div><div style="color:rgb(0, 0, 0);font-size:16px;font-family:'times
new roman', 'new york', times, serif;background-color:transparent;font-style:normal;"><span style="background-color:transparent;">Question A: </span><span style="font-size:12pt;"> </span><span style="font-size:12pt;">Is that a good idea? Alternatives?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;">When developing modules, you have the module_init where you declare a function to run when the module inits and set up everything. In my code, I have a similar init function, that basically sets up some procfs endpoints so that users can configure parts of my
system with boolean options (enable/disable functionality). </span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;">Question B: Where is the best place to I call this init function from?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;">Question C: Is using procfs the best option for setting up config options for my system?</span><span style="background-color:transparent;"> </span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><span style="background-color:transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Best,</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">George</div></div></div><br></div> </div> </div> </div></body></html>