]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-10-15 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sat, 15 Oct 2005 09:22:32 +0000 (09:22 +0000)
committerokuji <okuji@localhost>
Sat, 15 Oct 2005 09:22:32 +0000 (09:22 +0000)
        * 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>.

ChangeLog
fs/xfs.c
include/grub/term.h
io/gzio.c
kern/term.c

index d53f922155389397a59a65909c38ef8688d833c7..f07e8da7aa2db2debe6b2a6300eb3d81397fd841 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * fs/sfs.c (grub_sfs_open): Don't free `data->label' if it is not
index d5726f4934e84c2500f1cd45cc65f2832a5a9a74..44b1cec07ea5528f32974de9fdbad6be4b0b9d4c 100644 (file)
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -156,8 +156,9 @@ static grub_dl_t my_mod;
 #define GRUB_XFS_NEXT_DIRENT(pos,len)          \
   (pos) + GRUB_XFS_ROUND_TO_DIRENT (8 + 1 + len + 2)
 \f
-static inline int grub_xfs_inode_block (struct grub_xfs_data *data,
-                                       grub_uint64_t ino)
+static inline int
+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 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,
-                                        grub_uint64_t ino)
+static inline int
+grub_xfs_inode_offset (struct grub_xfs_data *data,
+                      grub_uint64_t ino)
 {
   int inoag = GRUB_XFS_INO_INOINAG (data, ino);
   return (inoag & ((1 << 4) - 1)) << 8;
@@ -361,8 +363,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
          {
            grub_uint64_t ino;
            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)
              {
                ino = grub_be_to_cpu32 (*(grub_uint32_t *) inopos);
@@ -371,7 +375,9 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
            else
              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;
 
            de = ((struct grub_xfs_dir_entry *) 
@@ -387,10 +393,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
       {
        grub_ssize_t numread;
        char *dirblock;
-       unsigned int blk;
+       grub_uint64_t blk;
 
        dirblock = grub_malloc (dir->data->bsize);
-       if (!dirblock)
+       if (! dirblock)
          return 0;
 
        /* Iterate over every block the directory has.  */
@@ -495,8 +501,8 @@ grub_xfs_mount (grub_disk_t disk)
   data->diropen.data = data;
   data->diropen.ino = data->sblock.rootino;
   data->diropen.inode_read = 1;
-  data->bsize = grub_cpu_to_be32 (data->sblock.bsize);
-  data->agsize = grub_cpu_to_be32 (data->sblock.agsize);
+  data->bsize = grub_be_to_cpu32 (data->sblock.bsize);
+  data->agsize = grub_be_to_cpu32 (data->sblock.agsize);
 
   data->disk = disk;
   data->inode = &data->diropen.inode;
index a27ab40117c6f1ef56954757cfb7142e4194580a..c104b1c51be510764a76a4a7f993f5e703ad8f20 100644 (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,
                                 grub_uint8_t highlight_color);
 int EXPORT_FUNC(grub_setcursor) (int on);
+int EXPORT_FUNC(grub_getcursor) (void);
 void EXPORT_FUNC(grub_refresh) (void);
 void EXPORT_FUNC(grub_set_more) (int onoff);
 
index 28aa5210bb1de885efec3494aa73342fd68c0449..f02fc1cb69001d1fe3669e89493ecc47962f68d0 100644 (file)
--- a/io/gzio.c
+++ b/io/gzio.c
@@ -165,7 +165,7 @@ typedef unsigned long ulg;
 static int
 test_header (grub_file_t file)
 {
-  unsigned char buf[10];
+  unsigned char buf[10] __attribute__ ((aligned));
   grub_gzio_t gzio = file->data;
 
   if (grub_file_tell (gzio->file) != 0)
index f5e39765395b38ee92a2f9a6bc36253d21363bcb..cc4dd98d41e137e78e74f06a95aa2281ef47a643 100644 (file)
@@ -34,6 +34,9 @@ static int grub_more_lines;
 /* If the more pager is active.  */
 static int grub_more;
 
+/* The current cursor state.  */
+static int cursor_state = 1;
+
 void
 grub_term_register (grub_term_t term)
 {
@@ -77,6 +80,7 @@ grub_term_set_current (grub_term_t term)
   
   grub_cur_term = term;
   grub_cls ();
+  grub_setcursor (grub_getcursor ());
   return GRUB_ERR_NONE;
 }
 
@@ -229,18 +233,23 @@ grub_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
 int
 grub_setcursor (int on)
 {
-  static int prev = 1;
-  int ret = prev;
+  int ret = cursor_state;
 
   if (grub_cur_term->setcursor)
     {
       (grub_cur_term->setcursor) (on);
-      prev = on;
+      cursor_state = on;
     }
   
   return ret;
 }
 
+int
+grub_getcursor (void)
+{
+  return cursor_state;
+}
+
 void
 grub_refresh (void)
 {