lkml.org 
[lkml]   [2009]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: make getdents/readdir POSIX compliant wrt mount-point dirent.d ino
Date
Ulrich Drepper <drepper <at> gmail.com> writes:

> I guess that this is really a difficult way to solve. I wouldn't want
> to pay for something which is hardly ever really used.
>
> But there are programs out there which would like to use the inode
> uniqueness. Therefore the next best thing to do is perhaps to return
> a flag in the getdents information (in d_type, perhaps) to indicate
> that this is a mount point and/or that there are multiple ways to
> access the file in question. Then programs which can use the inode
> information can be watching for this flag and enter the slow path only
> if it's set.

An alternative to a flag in d_type might be setting d_ino to a sentinel value
(there is plenty of existing code that refuses to use a readdir entry with d_ino
of 0, so it would have to be something else; but maybe -1 would work). But I
definitely like your idea of making it obvious to the application (whether by
d_ino or d_type) when it is necessary to use lstat to validate the inode number,
and promising that if the flag is not set then d_ino is correct.

--
Eric Blake




\
 
 \ /
  Last update: 2009-09-03 21:09    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site