When I think about text interface via a pseudo-filesystem or via a C API... I think the text interface will be easier.
As kernel elements in future releases expose more and more stats, then it's a matter of updating some kernel code to expose it via the pseudo-filesystem that resides IN RAM. That seems easily extensible. When I look at HWMON data in SysFS it is easy to access & manipulate via CLI, and if stored data is moved around within SysFS it's just a matter of learning where it was moved to and updating my own text-based scripts.
With a C API the only thing being exposed is the API, not the data. Now a userspace binary program, and the API opens the door to all sorts of userspace binary programs (how many variants will we see?), has to be updated to poke the right variables into the API to get an answer from Linux via the API. If the wrong variables are poked into the API call, then the API will expose either wrong data or no data; you can replicate that concept easily in your own programming. Why does a userspace binary program have to poke the right bits into the API call? Well, you don't expect the actual user to have to know that stuff, right? Next, if there is returned data from the API call, it has to be parsed and displayed on what... the CLI or do you want a GUI with that userspace binary program?
For me the use of a C API seems like way too many moving parts for something that should be oh so simple.
As kernel elements in future releases expose more and more stats, then it's a matter of updating some kernel code to expose it via the pseudo-filesystem that resides IN RAM. That seems easily extensible. When I look at HWMON data in SysFS it is easy to access & manipulate via CLI, and if stored data is moved around within SysFS it's just a matter of learning where it was moved to and updating my own text-based scripts.
With a C API the only thing being exposed is the API, not the data. Now a userspace binary program, and the API opens the door to all sorts of userspace binary programs (how many variants will we see?), has to be updated to poke the right variables into the API to get an answer from Linux via the API. If the wrong variables are poked into the API call, then the API will expose either wrong data or no data; you can replicate that concept easily in your own programming. Why does a userspace binary program have to poke the right bits into the API call? Well, you don't expect the actual user to have to know that stuff, right? Next, if there is returned data from the API call, it has to be parsed and displayed on what... the CLI or do you want a GUI with that userspace binary program?
For me the use of a C API seems like way too many moving parts for something that should be oh so simple.
Comment