[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug] tmpfs assert failure

From: Roland McGrath
Subject: Re: [bug] tmpfs assert failure
Date: Sun, 3 Aug 2003 14:58:15 -0400 (EDT)

> This is of course rather stupid, but should work.  

Wasting memory is indeed a rather stupid solution.

> Roland might have a better idea about how to fix it, though ;)

The point of the estimation is to make sure the buffer's always big enough.
The function would be hairier if it had to check and resize the buffer on
the fly.  You can make a reasonable overestimation by calculating st_size /
sizeof(tmpfs_dirent) * sizeof(dirent), though that is going to be scaled up
more than necessary unless all the names are tiny.  It woud be simple to
calculate the correct total size from st_size if it kept track of the
number of entries in the directory (should be easy enough to do).  Then it
can do st_size - nentries*sizeof(tmpfs_dirent) + nentries*sizeof(dirent).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]