All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rename a few functions in util/biosdisk.c
@ 2008-06-02 13:28 Robert Millan
  2008-06-04 13:59 ` Robert Millan
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Millan @ 2008-06-02 13:28 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 496 bytes --]


This patch renames a few functions in util/biosdisk.c.  Currently, by looking
at get_drive(), find_drive(), get_os_disk() function names it is very difficult
to figure out what's going on.  They're even misleading in fact.  I propose
the more descriptive names find_grub_drive(), find_system_device() and
convert_system_partition_to_system_disk().

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)

[-- Attachment #2: biosdisk_function_names.diff --]
[-- Type: text/x-diff, Size: 1931 bytes --]

diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c
--- ../grub2/util/biosdisk.c	2008-05-31 11:42:33.000000000 +0200
+++ ./util/biosdisk.c	2008-06-02 15:13:09.000000000 +0200
@@ -110,7 +110,7 @@ have_devfs (void)
 #endif /* __linux__ */
 
 static int
-get_drive (const char *name)
+find_grub_drive (const char *name)
 {
   unsigned int i;
 
@@ -148,7 +148,7 @@ grub_util_biosdisk_open (const char *nam
   int drive;
   struct stat st;
   
-  drive = get_drive (name);
+  drive = find_grub_drive (name);
   if (drive < 0)
     return grub_error (GRUB_ERR_BAD_DEVICE,
 		       "no mapping exists for `%s'", name);
@@ -503,7 +503,7 @@ read_device_map (const char *dev_map)
 
       p++;
       /* Find a free slot.  */
-      drive = get_drive (NULL);
+      drive = find_grub_drive (NULL);
       if (drive < 0)
 	show_error ("Map table size exceeded");
 
@@ -593,7 +593,7 @@ make_device_name (int drive, int dos_par
 }
 
 static char *
-get_os_disk (const char *os_dev)
+convert_system_partition_to_system_disk (const char *os_dev)
 {
 #if defined(__linux__)
   char *path = xmalloc (PATH_MAX);
@@ -696,18 +696,18 @@ get_os_disk (const char *os_dev)
   return path;
 
 #else
-# warning "The function `get_os_disk' might not work on your OS correctly."
+# warning "The function `convert_system_partition_to_system_disk' might not work on your OS correctly."
   return xstrdup (os_dev);
 #endif
 }
 
 static int
-find_drive (const char *os_dev)
+find_system_device (const char *os_dev)
 {
   int i;
   char *os_disk;
 
-  os_disk = get_os_disk (os_dev);
+  os_disk = convert_system_partition_to_system_disk (os_dev);
   if (! os_disk)
     return -1;
   
@@ -734,7 +734,7 @@ grub_util_biosdisk_get_grub_dev (const c
       return 0;
     }
 
-  drive = find_drive (os_dev);
+  drive = find_system_device (os_dev);
   if (drive < 0)
     {
       grub_error (GRUB_ERR_BAD_DEVICE,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rename a few functions in util/biosdisk.c
  2008-06-02 13:28 [PATCH] rename a few functions in util/biosdisk.c Robert Millan
@ 2008-06-04 13:59 ` Robert Millan
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Millan @ 2008-06-04 13:59 UTC (permalink / raw)
  To: grub-devel


Committed.

On Mon, Jun 02, 2008 at 03:28:11PM +0200, Robert Millan wrote:
> 
> This patch renames a few functions in util/biosdisk.c.  Currently, by looking
> at get_drive(), find_drive(), get_os_disk() function names it is very difficult
> to figure out what's going on.  They're even misleading in fact.  I propose
> the more descriptive names find_grub_drive(), find_system_device() and
> convert_system_partition_to_system_disk().
> 
> -- 
> Robert Millan
> 
> <GPLv2> I know my rights; I want my phone call!
> <DRM> What good is a phone call… if you are unable to speak?
> (as seen on /.)

> diff -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/util/biosdisk.c ./util/biosdisk.c
> --- ../grub2/util/biosdisk.c	2008-05-31 11:42:33.000000000 +0200
> +++ ./util/biosdisk.c	2008-06-02 15:13:09.000000000 +0200
> @@ -110,7 +110,7 @@ have_devfs (void)
>  #endif /* __linux__ */
>  
>  static int
> -get_drive (const char *name)
> +find_grub_drive (const char *name)
>  {
>    unsigned int i;
>  
> @@ -148,7 +148,7 @@ grub_util_biosdisk_open (const char *nam
>    int drive;
>    struct stat st;
>    
> -  drive = get_drive (name);
> +  drive = find_grub_drive (name);
>    if (drive < 0)
>      return grub_error (GRUB_ERR_BAD_DEVICE,
>  		       "no mapping exists for `%s'", name);
> @@ -503,7 +503,7 @@ read_device_map (const char *dev_map)
>  
>        p++;
>        /* Find a free slot.  */
> -      drive = get_drive (NULL);
> +      drive = find_grub_drive (NULL);
>        if (drive < 0)
>  	show_error ("Map table size exceeded");
>  
> @@ -593,7 +593,7 @@ make_device_name (int drive, int dos_par
>  }
>  
>  static char *
> -get_os_disk (const char *os_dev)
> +convert_system_partition_to_system_disk (const char *os_dev)
>  {
>  #if defined(__linux__)
>    char *path = xmalloc (PATH_MAX);
> @@ -696,18 +696,18 @@ get_os_disk (const char *os_dev)
>    return path;
>  
>  #else
> -# warning "The function `get_os_disk' might not work on your OS correctly."
> +# warning "The function `convert_system_partition_to_system_disk' might not work on your OS correctly."
>    return xstrdup (os_dev);
>  #endif
>  }
>  
>  static int
> -find_drive (const char *os_dev)
> +find_system_device (const char *os_dev)
>  {
>    int i;
>    char *os_disk;
>  
> -  os_disk = get_os_disk (os_dev);
> +  os_disk = convert_system_partition_to_system_disk (os_dev);
>    if (! os_disk)
>      return -1;
>    
> @@ -734,7 +734,7 @@ grub_util_biosdisk_get_grub_dev (const c
>        return 0;
>      }
>  
> -  drive = find_drive (os_dev);
> +  drive = find_system_device (os_dev);
>    if (drive < 0)
>      {
>        grub_error (GRUB_ERR_BAD_DEVICE,

> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel


-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-04 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-02 13:28 [PATCH] rename a few functions in util/biosdisk.c Robert Millan
2008-06-04 13:59 ` Robert Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.