3 ms·
unsigned long getino(char * pathname): For a given designated device and path, get the inode number of the designated file. Return 0 (there is no inode n
by cperciva 16y ago
unsigned long getino(char * pathname):
For a given designated device and path, get the
inode number of the designated file. Return 0
(there is no inode number 0) in case of error.
Completely off-topic, but there is a bug in this prototype: Inode numbers have type ino_t, not type unsigned long.
(Ok, two bugs, if you count the fact that there can theoretically be an inode number 0. And three bugs if you count the fact that pathname should be declared as a (const char *). But the ino_t vs. unsigned long bug is really bad if you care about portability.)
- philwelch 16y agoYou're right on all counts, and if I were writing a real filesystem rather than a class assignment I would have taken these issues more seriously. (edited to add paragraph:) Nothing I've said in this discussion should be taken as a strongly held opinion about anything--I'm rather shy about sharing these thoughts in the first place, but considered this particular example illustrative of a possibility I take seriously. You do not want to see the other horrors that particular professor of mine has perpetrated, incidentally.