9 Sep 2011 15:56
Patch: Use fstab different to /etc/fstab in fstab.h
Julian Fagir <gnrp <at> komkon2.de>
2011-09-09 13:56:50 GMT
2011-09-09 13:56:50 GMT
Hi, in a case where it would be useful to read a fstab that is not the system's own one (sysinst), i.e. lies not /etc/fstab, you can't do that with fstab.h. The solution would be to have a function setfstab(const char*) do set the fstab you want to read. The code is about 20 lines of additional code + some documentation. Rewriting that for a userland program would need either copying nearly the whole fstab.c or changing the interface, which is not wanted. Appended are patches (fstab.h.diff, fstab.c.diff, fstab.3.diff) and a test program (fstab-test.file, fstab-test.c, Makefile). To test it locally, just copy over fstab.c, apply the patch and change the include to a local include. Then run make and execute fstab-test. It will show the mount point of a directory according to your and the delivered fstab. So far, the test was run on two systems, one 5.99.55, one 5.0.2 (thanks to dzoe). I fully understand objections that it's unnecessary bloat and only used in that single case. Then I would rather copy fstab.c and modify that code to fit my needs. Regards, Julian(Continue reading)
RSS Feed