From d1d9022b1f404384568fc29c51c7b2ccd47c3592 Mon Sep 17 00:00:00 2001 From: okuji Date: Tue, 30 Dec 2003 12:36:13 +0000 Subject: [PATCH] 2003-12-30 Yoshinori K. Okuji * stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function. (ext2fs_dir): Use ext2_is_fast_symlink to check if the current inode is a fast or slow symlink. This change was required because Linux now uses acl seriously (i.e. incompatibility). Reported by Chris PeBenito and Seemant Kulleen --- ChangeLog | 9 +++++++++ stage2/fsys_ext2fs.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 988db64be..76fbf4ae8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-12-30 Yoshinori K. Okuji + + * stage2/fsys_ext2fs.c (ext2_is_fast_symlink): New function. + (ext2fs_dir): Use ext2_is_fast_symlink to check if the current + inode is a fast or slow symlink. This change was required + because Linux now uses acl seriously (i.e. incompatibility). + Reported by Chris PeBenito and Seemant + Kulleen + 2003-11-30 Yoshinori K. Okuji * lib/device.c (read_device_map) (sho_warning): New internal diff --git a/stage2/fsys_ext2fs.c b/stage2/fsys_ext2fs.c index 1f272591d..ef3770096 100644 --- a/stage2/fsys_ext2fs.c +++ b/stage2/fsys_ext2fs.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -475,6 +475,14 @@ ext2fs_read (char *buf, int len) */ +static inline +int ext2_is_fast_symlink (void) +{ + int ea_blocks; + ea_blocks = INODE->i_file_acl ? EXT2_BLOCK_SIZE (SUPERBLOCK) / DEV_BSIZE : 0; + return INODE->i_blocks == ea_blocks; +} + /* preconditions: ext2fs_mount already executed, therefore supblk in buffer * known as SUPERBLOCK * returns: 0 if error, nonzero iff we were able to find the file successfully @@ -618,7 +626,7 @@ ext2fs_dir (char *dirname) linkbuf[filemax + len] = '\0'; /* Read the symlink data. */ - if (INODE->i_blocks) + if (! ext2_is_fast_symlink ()) { /* Read the necessary blocks, and reset the file pointer. */ len = grub_read (linkbuf, filemax);