2005-10-15 Yoshinori K. Okuji <okuji@enbug.org>

* fs/xfs.c (grub_xfs_iterate_dir): Change the type of BLK to
        grub_uint64_t.
        Call the hook with a NUL-terminated filename.
        (grub_xfs_mount): Use grub_be_to_cpu32 instead of
        grub_cpu_to_be32.

        * kern/term.c (cursor_state): New variable.
        (grub_term_set_current): Reset the cursor state on a new
        terminal.
        (grub_setcursor): Rewritten to use CURSOR_STATE.
        (grub_getcursor): New function.

        * include/grub/term.h (grub_getcursor): New prototype.

        * io/gzio.c (test_header): Align BUF for accessing it as 32-bit
        integers on ARM. Reported by Timothy Baldwin
        <T.E.Baldwin99@members.leeds.ac.uk>.
This commit is contained in:
okuji 2005-10-15 09:22:32 +00:00
parent bb34586ca6
commit 688e5699e6
5 changed files with 51 additions and 15 deletions

View file

@ -1,3 +1,23 @@
2005-10-15 Yoshinori K. Okuji <okuji@enbug.org>
* fs/xfs.c (grub_xfs_iterate_dir): Change the type of BLK to
grub_uint64_t.
Call the hook with a NUL-terminated filename.
(grub_xfs_mount): Use grub_be_to_cpu32 instead of
grub_cpu_to_be32.
* kern/term.c (cursor_state): New variable.
(grub_term_set_current): Reset the cursor state on a new
terminal.
(grub_setcursor): Rewritten to use CURSOR_STATE.
(grub_getcursor): New function.
* include/grub/term.h (grub_getcursor): New prototype.
* io/gzio.c (test_header): Align BUF for accessing it as 32-bit
integers on ARM. Reported by Timothy Baldwin
<T.E.Baldwin99@members.leeds.ac.uk>.
2005-10-11 Marco Gerards <mgerards@xs4all.nl> 2005-10-11 Marco Gerards <mgerards@xs4all.nl>
* fs/sfs.c (grub_sfs_open): Don't free `data->label' if it is not * fs/sfs.c (grub_sfs_open): Don't free `data->label' if it is not

View file

@ -156,8 +156,9 @@ static grub_dl_t my_mod;
#define GRUB_XFS_NEXT_DIRENT(pos,len) \ #define GRUB_XFS_NEXT_DIRENT(pos,len) \
(pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2) (pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2)
static inline int grub_xfs_inode_block (struct grub_xfs_data *data, static inline int
grub_uint64_t ino) grub_xfs_inode_block (struct grub_xfs_data *data,
grub_uint64_t ino)
{ {
long long int inoinag = GRUB_XFS_INO_INOINAG (data, ino); long long int inoinag = GRUB_XFS_INO_INOINAG (data, ino);
long long ag = GRUB_XFS_INO_AG (data, ino); long long ag = GRUB_XFS_INO_AG (data, ino);
@ -169,8 +170,9 @@ static inline int grub_xfs_inode_block (struct grub_xfs_data *data,
} }
static inline int grub_xfs_inode_offset (struct grub_xfs_data *data, static inline int
grub_uint64_t ino) grub_xfs_inode_offset (struct grub_xfs_data *data,
grub_uint64_t ino)
{ {
int inoag = GRUB_XFS_INO_INOINAG (data, ino); int inoag = GRUB_XFS_INO_INOINAG (data, ino);
return (inoag & ((1 << 4) - 1)) << 8; return (inoag & ((1 << 4) - 1)) << 8;
@ -361,8 +363,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
{ {
grub_uint64_t ino; grub_uint64_t ino;
void *inopos = (((char *) de) void *inopos = (((char *) de)
+ sizeof (struct grub_xfs_dir_entry) + de->len - 1); + sizeof (struct grub_xfs_dir_entry)
+ de->len - 1);
char name[de->len + 1];
if (smallino) if (smallino)
{ {
ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos); ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos);
@ -371,7 +375,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
else else
ino = *(grub_uint64_t *) inopos; ino = *(grub_uint64_t *) inopos;
if (call_hook (ino, de->name)) grub_memcpy (name, de->name, de->len);
name[de->len] = '\0';
if (call_hook (ino, name))
return 1; return 1;
de = ((struct grub_xfs_dir_entry *) de = ((struct grub_xfs_dir_entry *)
@ -387,10 +393,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
{ {
grub_ssize_t numread; grub_ssize_t numread;
char *dirblock; char *dirblock;
unsigned int blk; grub_uint64_t blk;
dirblock = grub_malloc (dir->data->bsize); dirblock = grub_malloc (dir->data->bsize);
if (!dirblock) if (! dirblock)
return 0; return 0;
/* Iterate over every block the directory has. */ /* Iterate over every block the directory has. */
@ -495,8 +501,8 @@ grub_xfs_mount (grub_disk_t disk)
data->diropen.data = data; data->diropen.data = data;
data->diropen.ino = data->sblock.rootino; data->diropen.ino = data->sblock.rootino;
data->diropen.inode_read = 1; data->diropen.inode_read = 1;
data->bsize = grub_cpu_to_be32 (data->sblock.bsize); data->bsize = grub_be_to_cpu32 (data->sblock.bsize);
data->agsize = grub_cpu_to_be32 (data->sblock.agsize); data->agsize = grub_be_to_cpu32 (data->sblock.agsize);
data->disk = disk; data->disk = disk;
data->inode = &data->diropen.inode; data->inode = &data->diropen.inode;

View file

@ -199,6 +199,7 @@ void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state);
void EXPORT_FUNC(grub_setcolor) (grub_uint8_t normal_color, void EXPORT_FUNC(grub_setcolor) (grub_uint8_t normal_color,
grub_uint8_t highlight_color); grub_uint8_t highlight_color);
int EXPORT_FUNC(grub_setcursor) (int on); int EXPORT_FUNC(grub_setcursor) (int on);
int EXPORT_FUNC(grub_getcursor) (void);
void EXPORT_FUNC(grub_refresh) (void); void EXPORT_FUNC(grub_refresh) (void);
void EXPORT_FUNC(grub_set_more) (int onoff); void EXPORT_FUNC(grub_set_more) (int onoff);

View file

@ -165,7 +165,7 @@ typedef unsigned long ulg;
static int static int
test_header (grub_file_t file) test_header (grub_file_t file)
{ {
unsigned char buf[10]; unsigned char buf[10] __attribute__ ((aligned));
grub_gzio_t gzio = file->data; grub_gzio_t gzio = file->data;
if (grub_file_tell (gzio->file) != 0) if (grub_file_tell (gzio->file) != 0)

View file

@ -34,6 +34,9 @@ static int grub_more_lines;
/* If the more pager is active. */ /* If the more pager is active. */
static int grub_more; static int grub_more;
/* The current cursor state. */
static int cursor_state = 1;
void void
grub_term_register (grub_term_t term) grub_term_register (grub_term_t term)
{ {
@ -77,6 +80,7 @@ grub_term_set_current (grub_term_t term)
grub_cur_term = term; grub_cur_term = term;
grub_cls (); grub_cls ();
grub_setcursor (grub_getcursor ());
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
@ -229,18 +233,23 @@ grub_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
int int
grub_setcursor (int on) grub_setcursor (int on)
{ {
static int prev = 1; int ret = cursor_state;
int ret = prev;
if (grub_cur_term->setcursor) if (grub_cur_term->setcursor)
{ {
(grub_cur_term->setcursor) (on); (grub_cur_term->setcursor) (on);
prev = on; cursor_state = on;
} }
return ret; return ret;
} }
int
grub_getcursor (void)
{
return cursor_state;
}
void void
grub_refresh (void) grub_refresh (void)
{ {