On Sun, Aug 03, 2003 at 12:51:27PM +0200, Alfred M. Szmidt wrote:
> Hi,
> 
> The following problem exists with tmpfs:
> 
> $ settrans -ac tmp /hurd/tmpfs 10MB
> $ cd tmp
> $ ls
> tmpfs: /src-cvs/hurd/tmpfs/dir.c:62: diskfs_gets_directs: Assertion `((size_t) 
> &((struct tmpfs_dirent *)0)->name) >= ((size_t) &((struct dirent *)0)->d_name' 
> failed.
> ls: reading directory .: Computer bought the farm
> $

This code is kinda stupid.  The problem is making a guess at the buffer size
you need to store all directory entries.  Roland's idea was that the tmpfs
internal structure is always at least as big as the dirent structure, so you
can just take the directory size, plus the size for two entries with up to
three bytes for the name each (ie '.', '.', '\0').  That's what the
assertion is for.  With the change to 64 bit types in dirent this is not
true anymore.

Just adding some padding to struct tmpfs_dirent.  Can you try this in
tmpfs.h:

 struct tmpfs_dirent
 {
   struct tmpfs_dirent *next;
+  char _pad1[4];
   struct disknode *dn;
+  char _pad2[4];
   uint8_t namelen;
   char name[0];
 };

This is of course rather stupid, but should work.  Roland might have a
better idea about how to fix it, though ;)

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    [EMAIL PROTECTED]
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
[EMAIL PROTECTED]
http://www.marcus-brinkmann.de/


_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to