[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ext2 find patch
From: |
Tomas Ebenlendr |
Subject: |
ext2 find patch |
Date: |
Tue, 1 Jun 2004 14:17:04 +0200 |
User-agent: |
Mutt/1.5.6i |
I don't understand the ext2 fs very well, but when I tried to install
grub2 on my computer, I had no access to files in subdirectories.
I installed bochs and tried to find what happened. And I found a strange
thing: newly created ext2 haven't this problem. So I use ext2resize to
get from real filesystem smaller image (1.44M floppy). It is ext2,
e2fsck tells it is clean, but dirent.filetype == 0 even for directories.
So I moved the directory check to another place, and changed it to test
inode.mode. Here is the patch (cvs diff -u):
----------------------------------------------------------------------------
Index: fs/ext2.c
===================================================================
RCS file: /cvsroot/grub/grub2/fs/ext2.c,v
retrieving revision 1.6
diff -u -r1.6 ext2.c
--- fs/ext2.c 4 Apr 2004 13:46:00 -0000 1.6
+++ fs/ext2.c 1 Jun 2004 12:12:19 -0000
@@ -422,6 +422,15 @@
if (grub_errno)
goto fail;
+ /* Check if it is directory */
+ /* NOTE: dirent.filetype==FILETYPE_DIRECTORY check sometimes fails,
+ * (I don't know why,) but this will not */
+ if (!(grub_le_to_cpu16 (inode->mode) & 040000))
+ {
+ grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
+ goto fail;
+ }
+
/* Search the file. */
while (fpos < grub_le_to_cpu32 (inode->size))
{
@@ -526,12 +535,6 @@
currinode = grub_le_to_cpu32 (dirent.inode);
name = next;
- if (dirent.filetype != FILETYPE_DIRECTORY)
- {
- grub_error (GRUB_ERR_BAD_FILE_TYPE,
- "not a directory");
- goto fail;
- }
break;
}
else /* Found it! */
----------------------------------------------------------------------------
--
Tomas 'ebi' Ebenlendr
http://get.to/ebik
PF 2004.41690175319
- ext2 find patch,
Tomas Ebenlendr <=
- Re: ext2 find patch, Tomas Ebenlendr, 2004/06/01
- Re: ext2 find patch, Marco Gerards, 2004/06/01
- Re: ext2 find patch, Jeroen Dekkers, 2004/06/01
- Message not available
- Message not available
- normal vs. rescue mode commands, Tomas Ebenlendr, 2004/06/02
- Re: normal vs. rescue mode commands, Tomas Ebenlendr, 2004/06/02
- Re: normal vs. rescue mode commands, Marco Gerards, 2004/06/02
- Re: normal vs. rescue mode commands, Yoshinori K. Okuji, 2004/06/03
- Re: normal vs. rescue mode commands, M. Gerards, 2004/06/03
- Re: normal vs. rescue mode commands, Tomas Ebenlendr, 2004/06/03
- Re: normal vs. rescue mode commands, Yoshinori K. Okuji, 2004/06/04