One more suggestion: consider using libsysfs (which every modern distro will ship) instead reimplementing it in libcommon/sysfs.c. - R.