]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2009-05-05 Pavel Roskin <proski@gnu.org>
authorproski <proski@localhost>
Tue, 5 May 2009 16:36:58 +0000 (16:36 +0000)
committerproski <proski@localhost>
Tue, 5 May 2009 16:36:58 +0000 (16:36 +0000)
* include/grub/dl.h [GRUB_UTIL]: Provide inline implementations
of grub_dl_ref() and grub_dl_unref().
* commands/parttool.c: Remove preprocessor conditionals around
grub_dl_ref() and grub_dl_unref().
* fs/affs.c: Likewise.
* fs/afs.c: Likewise.
* fs/cpio.c: Likewise.
* fs/ext2.c: Likewise.
* fs/fat.c: Likewise.
* fs/hfs.c: Likewise.
* fs/hfsplus.c: Likewise.
* fs/iso9660.c: Likewise.
* fs/jfs.c: Likewise.
* fs/minix.c: Likewise.
* fs/ntfs.c: Likewise.
* fs/reiserfs.c: Likewise.
* fs/sfs.c: Likewise.
* fs/udf.c: Likewise.
* fs/ufs.c: Likewise.
* fs/xfs.c: Likewise.
* include/grub/dl.h: Likewise.
* loader/xnu.c: Likewise.

20 files changed:
ChangeLog
commands/parttool.c
fs/affs.c
fs/afs.c
fs/cpio.c
fs/ext2.c
fs/fat.c
fs/hfs.c
fs/hfsplus.c
fs/iso9660.c
fs/jfs.c
fs/minix.c
fs/ntfs.c
fs/reiserfs.c
fs/sfs.c
fs/udf.c
fs/ufs.c
fs/xfs.c
include/grub/dl.h
loader/xnu.c

index 34b1a4a3819abd519f19c550f4db5f82053c7aec..60a10dc336cc26064dc4fb5d48bdd3a44f2e134f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2009-05-05  Pavel Roskin  <proski@gnu.org>
+
+       * include/grub/dl.h [GRUB_UTIL]: Provide inline implementations
+       of grub_dl_ref() and grub_dl_unref().
+       * commands/parttool.c: Remove preprocessor conditionals around
+       grub_dl_ref() and grub_dl_unref().
+       * fs/affs.c: Likewise.
+       * fs/afs.c: Likewise.
+       * fs/cpio.c: Likewise.
+       * fs/ext2.c: Likewise.
+       * fs/fat.c: Likewise.
+       * fs/hfs.c: Likewise.
+       * fs/hfsplus.c: Likewise.
+       * fs/iso9660.c: Likewise.
+       * fs/jfs.c: Likewise.
+       * fs/minix.c: Likewise.
+       * fs/ntfs.c: Likewise.
+       * fs/reiserfs.c: Likewise.
+       * fs/sfs.c: Likewise.
+       * fs/udf.c: Likewise.
+       * fs/ufs.c: Likewise.
+       * fs/xfs.c: Likewise.
+       * include/grub/dl.h: Likewise.
+       * loader/xnu.c: Likewise.
+
 2009-05-04  Pavel Roskin  <proski@gnu.org>
 
        * commands/acpi.c: Remove unused variable my_mod.
index b4cbf005100641caef58dea2544dfe3a65c608ca..58751ca2f1e82cf3bc85f9b8ed8c56193536d781 100644 (file)
@@ -46,10 +46,8 @@ grub_parttool_register(const char *part_name,
   struct grub_parttool *cur;
   int nargs = 0;
 
-#ifndef GRUB_UTIL
   if (! parts)
     grub_dl_ref (mymod);
-#endif
 
   cur = (struct grub_parttool *) grub_malloc (sizeof (struct grub_parttool));
   cur->next = parts;
@@ -89,10 +87,8 @@ grub_parttool_unregister (int handle)
        prev = cur;
        cur = cur->next;
       }
-#ifndef GRUB_UTIL
   if (! parts)
     grub_dl_unref (mymod);
-#endif
 }
 
 static grub_err_t
index 4ddc347c8d10dec300b6de10651875ccb42e7eac..8b7bc022e19df55ba51d4bb96cdbd809720ad1f9 100644 (file)
--- a/fs/affs.c
+++ b/fs/affs.c
@@ -104,9 +104,7 @@ struct grub_affs_data
   int htsize;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 \f
 static grub_disk_addr_t
@@ -392,9 +390,7 @@ grub_affs_open (struct grub_file *file, const char *name)
   struct grub_affs_data *data;
   struct grub_fshelp_node *fdiro = 0;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_affs_mount (file->device->disk);
   if (!data)
@@ -419,9 +415,7 @@ grub_affs_open (struct grub_file *file, const char *name)
     grub_free (fdiro);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -432,9 +426,7 @@ grub_affs_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -477,9 +469,7 @@ grub_affs_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_affs_mount (device->disk);
   if (!data)
@@ -497,9 +487,7 @@ grub_affs_dir (grub_device_t device, const char *path,
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -512,9 +500,7 @@ grub_affs_label (grub_device_t device, char **label)
   struct grub_affs_file file;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_affs_mount (disk);
   if (data)
@@ -533,9 +519,7 @@ grub_affs_label (grub_device_t device, char **label)
   else
     *label = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -557,9 +541,7 @@ static struct grub_fs grub_affs_fs =
 GRUB_MOD_INIT(affs)
 {
   grub_fs_register (&grub_affs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(affs)
index 90d88644a57c1253a713bb54bddb56f52c915ee5..d710095b47e7bba4396e1e5e4a1c47ccd6005257 100644 (file)
--- a/fs/afs.c
+++ b/fs/afs.c
@@ -175,9 +175,7 @@ struct grub_afs_data
   struct grub_fshelp_node diropen;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 static grub_afs_off_t
 grub_afs_run_to_num (struct grub_afs_sblock *sb,
@@ -505,9 +503,7 @@ grub_afs_open (struct grub_file *file, const char *name)
   struct grub_afs_data *data;
   struct grub_fshelp_node *fdiro = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_afs_mount (file->device->disk);
   if (! data)
@@ -532,9 +528,7 @@ fail:
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -553,9 +547,7 @@ grub_afs_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -583,9 +575,7 @@ grub_afs_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_afs_mount (device->disk);
   if (! data)
@@ -603,9 +593,7 @@ grub_afs_dir (grub_device_t device, const char *path,
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -623,9 +611,7 @@ static struct grub_fs grub_afs_fs = {
 GRUB_MOD_INIT (afs)
 {
   grub_fs_register (&grub_afs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI (afs)
index bedd65ee0e6071a3f91e6da6727ee4a24551027c..7a49fc137304b42370c42e12190ffd371e9d9a98 100644 (file)
--- a/fs/cpio.c
+++ b/fs/cpio.c
@@ -74,9 +74,7 @@ struct grub_cpio_data
   grub_uint32_t size;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 static grub_err_t
 grub_cpio_find_file (struct grub_cpio_data *data, char **name,
@@ -192,9 +190,7 @@ grub_cpio_dir (grub_device_t device, const char *path,
   const char *np;
   int len;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   prev = 0;
 
@@ -251,9 +247,7 @@ fail:
   if (data)
     grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -266,9 +260,7 @@ grub_cpio_open (grub_file_t file, const char *name)
   char *fn;
   int i, j;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_cpio_mount (file->device->disk);
   if (!data)
@@ -322,9 +314,7 @@ fail:
   if (data)
     grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -344,9 +334,7 @@ grub_cpio_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -370,9 +358,7 @@ GRUB_MOD_INIT (tar)
 #endif
 {
   grub_fs_register (&grub_cpio_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 #ifdef MODE_USTAR
index ab50db010ad96c9009b08c0b4e4f8caeefd2bbb0..596c85984a447d869bbdd5c65f5d3195b8dc7ba1 100644 (file)
--- a/fs/ext2.c
+++ b/fs/ext2.c
@@ -317,9 +317,7 @@ struct grub_ext2_data
   struct grub_fshelp_node diropen;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 \f
 
@@ -725,9 +723,7 @@ grub_ext2_open (struct grub_file *file, const char *name)
   struct grub_ext2_data *data;
   struct grub_fshelp_node *fdiro = 0;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_ext2_mount (file->device->disk);
   if (! data)
@@ -759,9 +755,7 @@ grub_ext2_open (struct grub_file *file, const char *name)
     grub_free (fdiro);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -771,9 +765,7 @@ grub_ext2_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -825,9 +817,7 @@ grub_ext2_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_ext2_mount (device->disk);
   if (! data)
@@ -845,9 +835,7 @@ grub_ext2_dir (grub_device_t device, const char *path,
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -858,9 +846,7 @@ grub_ext2_label (grub_device_t device, char **label)
   struct grub_ext2_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ext2_mount (disk);
   if (data)
@@ -868,9 +854,7 @@ grub_ext2_label (grub_device_t device, char **label)
   else
     *label = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -883,9 +867,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid)
   struct grub_ext2_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ext2_mount (disk);
   if (data)
@@ -900,9 +882,7 @@ grub_ext2_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -916,9 +896,7 @@ grub_ext2_mtime (grub_device_t device, grub_int32_t *tm)
   struct grub_ext2_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ext2_mount (disk);
   if (!data)
@@ -926,9 +904,7 @@ grub_ext2_mtime (grub_device_t device, grub_int32_t *tm)
   else 
     *tm = grub_le_to_cpu32 (data->sblock.utime);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -954,9 +930,7 @@ static struct grub_fs grub_ext2_fs =
 GRUB_MOD_INIT(ext2)
 {
   grub_fs_register (&grub_ext2_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(ext2)
index 025319b3d8b1807ebe6a9c73f9ac494928be924b..bd213d977f794cf3e491947df1a61b99e4df8cd1 100644 (file)
--- a/fs/fat.c
+++ b/fs/fat.c
@@ -149,9 +149,7 @@ struct grub_fat_data
   grub_uint32_t uuid;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 static int
 fat_log2 (unsigned x)
@@ -692,9 +690,7 @@ grub_fat_dir (grub_device_t device, const char *path,
   char *dirname = 0;
   char *p;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_fat_mount (disk);
   if (! data)
@@ -723,9 +719,7 @@ grub_fat_dir (grub_device_t device, const char *path,
   grub_free (dirname);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return grub_errno;
 }
@@ -736,9 +730,7 @@ grub_fat_open (grub_file_t file, const char *name)
   struct grub_fat_data *data = 0;
   char *p = (char *) name;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_fat_mount (file->device->disk);
   if (! data)
@@ -767,9 +759,7 @@ grub_fat_open (grub_file_t file, const char *name)
   
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return grub_errno;
 }
@@ -786,9 +776,7 @@ grub_fat_close (grub_file_t file)
 {
   grub_free (file->data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return grub_errno;
 }
@@ -810,9 +798,7 @@ grub_fat_label (grub_device_t device, char **label)
     return 0;
   }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_fat_mount (disk);
   if (! data)
@@ -830,9 +816,7 @@ grub_fat_label (grub_device_t device, char **label)
 
  fail:
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -845,9 +829,7 @@ grub_fat_uuid (grub_device_t device, char **uuid)
   struct grub_fat_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_fat_mount (disk);
   if (data)
@@ -859,9 +841,7 @@ grub_fat_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -883,9 +863,7 @@ static struct grub_fs grub_fat_fs =
 GRUB_MOD_INIT(fat)
 {
   grub_fs_register (&grub_fat_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(fat)
index ef318d481aba514ed3fbff8fad06f98a7fce5320..ca2e56156b3da5e4e42cf23c25bab83889b44222 100644 (file)
--- a/fs/hfs.c
+++ b/fs/hfs.c
@@ -159,9 +159,7 @@ struct grub_hfs_record
   int datalen;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 \f
 static int grub_hfs_find_node (struct grub_hfs_data *, char *,
                               grub_uint32_t, int, char *, int);
@@ -972,9 +970,7 @@ grub_hfs_dir (grub_device_t device, const char *path,
   struct grub_hfs_data *data;
   struct grub_hfs_filerec frec;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_hfs_mount (device->disk);
   if (!data)
@@ -995,9 +991,7 @@ grub_hfs_dir (grub_device_t device, const char *path,
  fail:
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return grub_errno;
 }
@@ -1010,18 +1004,14 @@ grub_hfs_open (struct grub_file *file, const char *name)
   struct grub_hfs_data *data;
   struct grub_hfs_filerec frec;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_hfs_mount (file->device->disk);
   
   if (grub_hfs_find_dir (data, name, &frec, 0))
     {
       grub_free (data);
-#ifndef GRUB_UTIL
-  grub_dl_unref (my_mod);
-#endif
+      grub_dl_unref (my_mod);
       return grub_errno;
     }
   
@@ -1029,9 +1019,7 @@ grub_hfs_open (struct grub_file *file, const char *name)
     {
       grub_free (data);
       grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a file");
-#ifndef GRUB_UTIL
       grub_dl_unref (my_mod);
-#endif
       return grub_errno;
     }
   
@@ -1061,9 +1049,7 @@ grub_hfs_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return 0;
 }
@@ -1102,9 +1088,7 @@ static struct grub_fs grub_hfs_fs =
 GRUB_MOD_INIT(hfs)
 {
   grub_fs_register (&grub_hfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(hfs)
index 0a7bedde75a7e1934d848119c9b844c7955e8246..e74d20c0686886984f1b645b4be66435faf97f4d 100644 (file)
@@ -226,9 +226,7 @@ struct grub_hfsplus_data
   int embedded_offset;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 \f
 /* Return the offset of the record with the index INDEX, in the node
@@ -827,9 +825,7 @@ grub_hfsplus_open (struct grub_file *file, const char *name)
   struct grub_hfsplus_data *data;
   struct grub_fshelp_node *fdiro = 0;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_hfsplus_mount (file->device->disk);
   if (!data)
@@ -855,9 +851,7 @@ grub_hfsplus_open (struct grub_file *file, const char *name)
     grub_free (fdiro);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -868,9 +862,7 @@ grub_hfsplus_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -916,9 +908,7 @@ grub_hfsplus_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_hfsplus_mount (device->disk);
   if (!data)
@@ -939,9 +929,7 @@ grub_hfsplus_dir (grub_device_t device, const char *path,
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -964,9 +952,7 @@ grub_hfsplus_mtime (grub_device_t device, grub_int32_t *tm)
   struct grub_hfsplus_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_hfsplus_mount (disk);
   if (!data)
@@ -974,9 +960,7 @@ grub_hfsplus_mtime (grub_device_t device, grub_int32_t *tm)
   else 
     *tm = grub_be_to_cpu32 (data->volheader.utime) - 2082844800;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -990,9 +974,7 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid)
   struct grub_hfsplus_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_hfsplus_mount (disk);
   if (data)
@@ -1005,9 +987,7 @@ grub_hfsplus_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -1032,9 +1012,7 @@ static struct grub_fs grub_hfsplus_fs =
 GRUB_MOD_INIT(hfsplus)
 {
   grub_fs_register (&grub_hfsplus_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(hfsplus)
index 2278fdcc5f3754a902196d68bd100e03f14caf05..140d8c2135aa38f312654c0478df7f868c170b78 100644 (file)
@@ -150,9 +150,7 @@ struct grub_fshelp_node
   unsigned int dir_off;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 \f
 
 /* Iterate over the susp entries, starting with block SUA_BLOCK on the
@@ -688,9 +686,7 @@ grub_iso9660_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_iso9660_mount (device->disk);
   if (! data)
@@ -717,9 +713,7 @@ grub_iso9660_dir (grub_device_t device, const char *path,
  fail:
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -733,9 +727,7 @@ grub_iso9660_open (struct grub_file *file, const char *name)
   struct grub_fshelp_node rootnode;
   struct grub_fshelp_node *foundnode;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_iso9660_mount (file->device->disk);
   if (!data)
@@ -763,9 +755,7 @@ grub_iso9660_open (struct grub_file *file, const char *name)
   return 0;
   
  fail:
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   grub_free (data);
   
@@ -796,9 +786,7 @@ grub_iso9660_close (grub_file_t file)
 {
   grub_free (file->data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return GRUB_ERR_NONE;
 }
@@ -832,9 +820,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
   struct grub_iso9660_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_iso9660_mount (disk);
   if (data)
@@ -868,9 +854,7 @@ grub_iso9660_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
        grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -894,9 +878,7 @@ static struct grub_fs grub_iso9660_fs =
 GRUB_MOD_INIT(iso9660)
 {
   grub_fs_register (&grub_iso9660_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(iso9660)
index 3b5520fed226d43f96fed6d08d261f89b0cff9f6..818700552a4af5c0aea3835b37c54bc63025ff83 100644 (file)
--- a/fs/jfs.c
+++ b/fs/jfs.c
@@ -229,9 +229,7 @@ struct grub_jfs_diropen
 } __attribute__ ((packed));
 
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 \f
 static grub_err_t grub_jfs_lookup_symlink (struct grub_jfs_data *data, int ino);
 
@@ -734,9 +732,7 @@ grub_jfs_dir (grub_device_t device, const char *path,
   struct grub_jfs_data *data = 0;
   struct grub_jfs_diropen *diro = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_jfs_mount (device->disk);
   if (!data)
@@ -773,9 +769,7 @@ grub_jfs_dir (grub_device_t device, const char *path,
   grub_jfs_closedir (diro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -787,9 +781,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
 {
   struct grub_jfs_data *data;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_jfs_mount (file->device->disk);
   if (!data)
@@ -814,9 +806,7 @@ grub_jfs_open (struct grub_file *file, const char *name)
   
  fail:
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   grub_free (data);
   
@@ -839,9 +829,7 @@ grub_jfs_close (grub_file_t file)
 {
   grub_free (file->data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   
   return GRUB_ERR_NONE;
 }
@@ -876,9 +864,7 @@ static struct grub_fs grub_jfs_fs =
 GRUB_MOD_INIT(jfs)
 {
   grub_fs_register (&grub_jfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(jfs)
index 0789718a17a41806af09eee94458165d24457e72..2b30c54476306c91449914f8902a18339ab2b9c2 100644 (file)
@@ -112,9 +112,7 @@ struct grub_minix_data
   int filename_size;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 \f
 static grub_err_t grub_minix_find_file (struct grub_minix_data *data,
                                        const char *path);
@@ -607,9 +605,7 @@ static struct grub_fs grub_minix_fs =
 GRUB_MOD_INIT(minix)
 {
   grub_fs_register (&grub_minix_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(minix)
index 5d18159270096063a08c44ccdff93ee19c83c5e4..e039be0f22363a83603033b7709debbb6813f74d 100644 (file)
--- a/fs/ntfs.c
+++ b/fs/ntfs.c
@@ -25,9 +25,7 @@
 #include <grub/fshelp.h>
 #include <grub/ntfs.h>
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 ntfscomp_func_t grub_ntfscomp_func;
 
@@ -885,10 +883,7 @@ grub_ntfs_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
   }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
-
 
   data = grub_ntfs_mount (device->disk);
   if (!data)
@@ -915,9 +910,7 @@ fail:
       grub_free (data);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -928,9 +921,7 @@ grub_ntfs_open (grub_file_t file, const char *name)
   struct grub_ntfs_data *data = 0;
   struct grub_fshelp_node *mft = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ntfs_mount (file->device->disk);
   if (!data)
@@ -968,9 +959,7 @@ fail:
       grub_free (data);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -1011,9 +1000,7 @@ grub_ntfs_close (grub_file_t file)
       grub_free (data);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -1025,9 +1012,7 @@ grub_ntfs_label (grub_device_t device, char **label)
   struct grub_fshelp_node *mft = 0;
   char *pa;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   *label = 0;
 
@@ -1079,9 +1064,7 @@ fail:
       grub_free (data);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -1092,9 +1075,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
   struct grub_ntfs_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ntfs_mount (disk);
   if (data)
@@ -1105,9 +1086,7 @@ grub_ntfs_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -1128,9 +1107,7 @@ static struct grub_fs grub_ntfs_fs = {
 GRUB_MOD_INIT (ntfs)
 {
   grub_fs_register (&grub_ntfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI (ntfs)
index 16a9e0483ae714ad83d679b94a2f5a0c5d2ac5b8..30bd8723d433afba83834b85b97fb38c6fada307 100644 (file)
@@ -60,9 +60,7 @@
 
 #define S_IFLNK 0xA000
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 #define assert(boolean) real_assert (boolean, __FILE__, __LINE__)
 static inline void
@@ -986,9 +984,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
   grub_uint32_t block_number;
   grub_uint16_t entry_version, block_size, entry_location;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   data = grub_reiserfs_mount (file->device->disk);
   if (! data)
     goto fail;
@@ -1061,9 +1057,7 @@ grub_reiserfs_open (struct grub_file *file, const char *name)
   assert (grub_errno != GRUB_ERR_NONE);
   grub_free (found);
   grub_free (data);
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   return grub_errno;
 }
 
@@ -1257,9 +1251,7 @@ grub_reiserfs_close (grub_file_t file)
 
   grub_free (data);
   grub_free (node);
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   return GRUB_ERR_NONE;
 }
 
@@ -1287,9 +1279,7 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
       grub_free (node);
       return hook (filename, &info);
     }
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   data = grub_reiserfs_mount (device->disk);
   if (! data)
     goto fail;
@@ -1311,16 +1301,12 @@ grub_reiserfs_dir (grub_device_t device, const char *path,
     goto fail;
   grub_reiserfs_iterate_dir (found, iterate);
   grub_free (data);
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   return GRUB_ERR_NONE;
 
  fail:
   grub_free (data);
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
   return grub_errno;
 }
 
@@ -1347,9 +1333,7 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid)
   struct grub_reiserfs_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_reiserfs_mount (disk);
   if (data)
@@ -1364,9 +1348,7 @@ grub_reiserfs_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -1388,9 +1370,7 @@ static struct grub_fs grub_reiserfs_fs =
 GRUB_MOD_INIT(reiserfs)
 {
   grub_fs_register (&grub_reiserfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(reiserfs)
index 314a6fd1daae2ed4261325b8bb76dc6899a8f6a7..8dc5951df7c35ca3a0012d7fa60d6019f43973b2 100644 (file)
--- a/fs/sfs.c
+++ b/fs/sfs.c
@@ -135,9 +135,7 @@ struct grub_sfs_data
   char *label;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 \f
 /* Lookup the extent starting with BLOCK in the filesystem described
@@ -454,9 +452,7 @@ grub_sfs_open (struct grub_file *file, const char *name)
   struct grub_sfs_data *data;
   struct grub_fshelp_node *fdiro = 0;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_sfs_mount (file->device->disk);
   if (!data)
@@ -483,9 +479,7 @@ grub_sfs_open (struct grub_file *file, const char *name)
     grub_free (data->label);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -496,9 +490,7 @@ grub_sfs_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -540,9 +532,7 @@ grub_sfs_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_sfs_mount (device->disk);
   if (!data)
@@ -562,9 +552,7 @@ grub_sfs_dir (grub_device_t device, const char *path,
     grub_free (data->label);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -600,9 +588,7 @@ static struct grub_fs grub_sfs_fs =
 GRUB_MOD_INIT(sfs)
 {
   grub_fs_register (&grub_sfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(sfs)
index bbad458fc874c372dac0bf37a30cc9f94cb250bd..53fb63b19237b5dbdb897e850d72703e6a497f4a 100644 (file)
--- a/fs/udf.c
+++ b/fs/udf.c
@@ -356,9 +356,7 @@ struct grub_fshelp_node
   int part_ref;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 static grub_uint32_t
 grub_udf_get_block (struct grub_udf_data *data,
@@ -790,9 +788,7 @@ grub_udf_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
   }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_udf_mount (device->disk);
   if (!data)
@@ -814,9 +810,7 @@ grub_udf_dir (grub_device_t device, const char *path,
 fail:
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -828,9 +822,7 @@ grub_udf_open (struct grub_file *file, const char *name)
   struct grub_fshelp_node rootnode;
   struct grub_fshelp_node *foundnode;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_udf_mount (file->device->disk);
   if (!data)
@@ -851,9 +843,7 @@ grub_udf_open (struct grub_file *file, const char *name)
   return 0;
 
 fail:
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -879,9 +869,7 @@ grub_udf_close (grub_file_t file)
       grub_free (node);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -916,9 +904,7 @@ static struct grub_fs grub_udf_fs = {
 GRUB_MOD_INIT (udf)
 {
   grub_fs_register (&grub_udf_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI (udf)
index b799449509fa17e81f37b0fd4d502ad263807418..562bf7b25125a5232a76be5931026762a060a1c8 100644 (file)
--- a/fs/ufs.c
+++ b/fs/ufs.c
@@ -207,9 +207,7 @@ struct grub_ufs_data
   int linknest;
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 \f
 /* Forward declaration.  */
 static grub_err_t grub_ufs_find_file (struct grub_ufs_data *data,
@@ -720,9 +718,7 @@ grub_ufs_label (grub_device_t device, char **label)
 {
   struct grub_ufs_data *data = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   *label = 0;
 
@@ -733,9 +729,7 @@ grub_ufs_label (grub_device_t device, char **label)
         *label = grub_strdup ((char *) data->sblock.volume_name);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -748,9 +742,7 @@ grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
 {
   struct grub_ufs_data *data = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_ufs_mount (device->disk);
   if (!data)
@@ -760,9 +752,7 @@ grub_ufs_mtime (grub_device_t device, grub_int32_t *tm)
   else
     *tm = grub_le_to_cpu64 (data->sblock.mtime2);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -786,9 +776,7 @@ static struct grub_fs grub_ufs_fs =
 GRUB_MOD_INIT(ufs)
 {
   grub_fs_register (&grub_ufs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(ufs)
index a5c2d42f5f3314caf9203b18ab7e38c50b47b8da..3907abc9252b33e20195782c537cbf15130fe299 100644 (file)
--- a/fs/xfs.c
+++ b/fs/xfs.c
@@ -148,9 +148,7 @@ struct grub_xfs_data
 
 };
 
-#ifndef GRUB_UTIL
 static grub_dl_t my_mod;
-#endif
 
 \f
 
@@ -641,9 +639,7 @@ grub_xfs_dir (grub_device_t device, const char *path,
       return hook (filename, &info);
     }
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_xfs_mount (device->disk);
   if (!data)
@@ -661,9 +657,7 @@ grub_xfs_dir (grub_device_t device, const char *path,
     grub_free (fdiro);
   grub_free (data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 
@@ -678,9 +672,7 @@ grub_xfs_open (struct grub_file *file, const char *name)
   struct grub_xfs_data *data;
   struct grub_fshelp_node *fdiro = 0;
   
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
   
   data = grub_xfs_mount (file->device->disk);
   if (!data)
@@ -714,9 +706,7 @@ grub_xfs_open (struct grub_file *file, const char *name)
     grub_free (fdiro);
   grub_free (data);
   
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return grub_errno;
 }
@@ -738,9 +728,7 @@ grub_xfs_close (grub_file_t file)
 {
   grub_free (file->data);
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   return GRUB_ERR_NONE;
 }
@@ -752,9 +740,7 @@ grub_xfs_label (grub_device_t device, char **label)
   struct grub_xfs_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_xfs_mount (disk);
   if (data)
@@ -762,9 +748,7 @@ grub_xfs_label (grub_device_t device, char **label)
   else
     *label = 0;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -777,9 +761,7 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
   struct grub_xfs_data *data;
   grub_disk_t disk = device->disk;
 
-#ifndef GRUB_UTIL
   grub_dl_ref (my_mod);
-#endif
 
   data = grub_xfs_mount (disk);
   if (data)
@@ -794,9 +776,7 @@ grub_xfs_uuid (grub_device_t device, char **uuid)
   else
     *uuid = NULL;
 
-#ifndef GRUB_UTIL
   grub_dl_unref (my_mod);
-#endif
 
   grub_free (data);
 
@@ -820,9 +800,7 @@ static struct grub_fs grub_xfs_fs =
 GRUB_MOD_INIT(xfs)
 {
   grub_fs_register (&grub_xfs_fs);
-#ifndef GRUB_UTIL
   my_mod = mod;
-#endif
 }
 
 GRUB_MOD_FINI(xfs)
index 5e463747bed25f5f2d401aeb8680a7df439d4d29..4ff6240d81fe206bb5ead4631b1e84d755ed9742 100644 (file)
@@ -82,8 +82,23 @@ grub_dl_t grub_dl_load_core (void *addr, grub_size_t size);
 int EXPORT_FUNC(grub_dl_unload) (grub_dl_t mod);
 void grub_dl_unload_unneeded (void);
 void grub_dl_unload_all (void);
+#ifdef GRUB_UTIL
+static inline int
+grub_dl_ref (grub_dl_t mod)
+{
+  (void) mod;
+  return 0;
+}
+static inline int
+grub_dl_unref (grub_dl_t mod)
+{
+  (void) mod;
+  return 0;
+}
+#else
 int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
 int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
+#endif
 void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
 grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
 grub_err_t EXPORT_FUNC(grub_dl_register_symbol) (const char *name, void *addr,
index 2b6ffa42c3f00d289b009edf29137be28af61feb..18264bcf08e9c1c18fb83e3a21cbdb534989a281 100644 (file)
@@ -1306,20 +1306,16 @@ grub_cmd_xnu_resume (grub_command_t cmd __attribute__ ((unused)),
 void
 grub_xnu_lock ()
 {
-#ifndef GRUB_UTIL
   if (!locked)
     grub_dl_ref (my_mod);
-#endif
   locked = 1;
 }
 
 void
 grub_xnu_unlock ()
 {
-#ifndef GRUB_UTIL
   if (locked)
     grub_dl_unref (my_mod);
-#endif
   locked = 0;
 }