On Thu, May 20, 2010 at 12:18:44AM +0200, Sergio Lopez wrote: > El Wed, 19 May 2010 23:32:37 +0200 > Samuel Thibault <samuel.thiba...@gnu.org> escribió: > > > Sergio Lopez, le Wed 19 May 2010 17:33:39 +0200, a écrit : > > > El Wed, 19 May 2010 16:05:27 +0200 > > > Carl Fredrik Hammar <hammy.l...@gmail.com> escribió: > > > > > > > On Tue, May 18, 2010 at 04:19:34PM +0200, Sergio Lopez wrote: > > > > > > > > > > This patch adds some padding to tmpfs_dirent structure as it's > > > > > suggested in the wiki > > > > > (http://www.gnu.org/software/hurd/hurd/translator/tmpfs.html). > > > > > > > > It seems Samuel beat you to it back in January: see commit 97c569. > > > > > > Humm... I didn't see that. Anyway, I think that change should be > > > reverted and the assertion in diskfs_get_directs removed. > > > > Err, why removing it? Isn't there a need for the whole struct dirent > > structure to be allocated or something like that? (Which probably was > > the reason for the assertion). > > diskfs_get_directs needs to allocate a buffer and fill it with dirent > entries to describe the contents from the requested directory. The size > of this buffer is dn_stat.st_size plus two dirent structures (to hold > "." and ".."). > > The code seems to assume that dn_stat.st_size represents the size of a > collection of tmpfs_dirent entries, so it needs to check that this > structure is the same size or bigger than dirent, to ensure the buffer > is big enough. > > But, in diskfs_direnter_hard, dn_stat.st_size is actually increased > with the value of dirent (and not tmpfs_dirent), so there's no need to > worry about the sizes of those structures.
I looked into the code and came to the same conclusion. I even checked if dn_stat.st_size was modified anywhere else, and all the other cases involved non-directories. Regards, Fredrik