/[grub]/grub2/kern/device.c
ViewVC logotype

Diff of /grub2/kern/device.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by okuji, Sun Apr 4 13:46:01 2004 UTC revision 1.4 by okuji, Wed Jul 20 20:30:45 2005 UTC
# Line 1  Line 1 
1  /* device.c - device manager */  /* device.c - device manager */
2  /*  /*
3   *  GRUB  --  GRand Unified Bootloader   *  GRUB  --  GRand Unified Bootloader
4   *  Copyright (C) 2002  Free Software Foundation, Inc.   *  Copyright (C) 2002,2005  Free Software Foundation, Inc.
5   *   *
6   *  GRUB is free software; you can redistribute it and/or modify   *  GRUB is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 24  Line 24 
24  #include <grub/fs.h>  #include <grub/fs.h>
25  #include <grub/mm.h>  #include <grub/mm.h>
26  #include <grub/misc.h>  #include <grub/misc.h>
27    #include <grub/env.h>
 static char *grub_device_root;  
   
 grub_err_t  
 grub_device_set_root (const char *name)  
 {  
   grub_free (grub_device_root);  
   grub_device_root = grub_strdup (name);  
   return grub_errno;  
 }  
   
 const char *  
 grub_device_get_root (void)  
 {  
   if (! grub_device_root)  
     grub_error (GRUB_ERR_BAD_DEVICE, "no root device");  
     
   return grub_device_root;  
 }  
28    
29  grub_device_t  grub_device_t
30  grub_device_open (const char *name)  grub_device_open (const char *name)
# Line 52  grub_device_open (const char *name) Line 34  grub_device_open (const char *name)
34    
35    if (! name)    if (! name)
36      {      {
37        if (! grub_device_root)        name = grub_env_get ("root");
38          if (*name == '\0')
39          {          {
40            grub_error (GRUB_ERR_BAD_DEVICE, "no device is set");            grub_error (GRUB_ERR_BAD_DEVICE, "no device is set");
41            goto fail;            goto fail;
42          }          }
   
       name = grub_device_root;  
43      }      }
44            
45    dev = grub_malloc (sizeof (*dev));    dev = grub_malloc (sizeof (*dev));

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26