All of lore.kernel.org
 help / color / mirror / Atom feed
* hdparm documentation
@ 2009-11-08 15:27 Pedro A ARANDA
  2009-11-08 17:09 ` Christian Franke
  0 siblings, 1 reply; 6+ messages in thread
From: Pedro A ARANDA @ 2009-11-08 15:27 UTC (permalink / raw)
  To: grub-devel

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


Hi,
I'm trying to make the hdparm module run on my HP Mini 110. I have had no luck,neither in doing so or finding documentation which could help me doing so. If I getthe right pointer and I make it run on my box, I'd be willing to post a HOWTO, tomake things easier to other people.
I'm currently running Ubuntu 2009.10 with grub2.
When I 
set debug=atainsmod ata
I actually get my drive listed as (ata0,0) but when I thentry
insmod hdparmhdparm -B 255 (ata0,0)
grub keeps telling me that the drive (hd0) is not known... 
The objective of the exercise is to make sure that grub2 disables APM and rid meof the clunking which is going to kill my HD. I know Seagate (my HD's manufacturer)should be caring a bit more... but since they have this peculiar customer care conceptand I don't want my HD unusable in a couple of months, I'll have to care about it.
Cheers,/PA 		 	   		  
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010

[-- Attachment #2: Type: text/html, Size: 1669 bytes --]

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

* Re: hdparm documentation
  2009-11-08 15:27 hdparm documentation Pedro A ARANDA
@ 2009-11-08 17:09 ` Christian Franke
  2009-11-09 14:13   ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Franke @ 2009-11-08 17:09 UTC (permalink / raw)
  To: The development of GNU GRUB

Pedro A ARANDA wrote:
> I'm trying to make the hdparm module run on my HP Mini 110. I have had 
> no luck,
> neither in doing so or finding documentation which could help me doing 
> so. If I get
> the right pointer and I make it run on my box, I'd be willing to post 
> a HOWTO, to
> make things easier to other people.
>
> I'm currently running Ubuntu 2009.10 with grub2.
>
> When I 
>
> set debug=ata
> insmod ata
>
> I actually get my drive listed as (ata0,0) but when I then
> try
>
> insmod hdparm
> hdparm -B 255 (ata0,0)
>
> grub keeps telling me that the drive (hd0) is not known... 
>

After 'insmod ata', loading of further modules typically fails because 
the drive in the 'prefix' variable is no longer valid.

The following works for me:

# Load needed modules first
insmod hdparm

# Switch to ATA driver and load ATA pass-through support
# (this invalidates prefix)
insmod ata_pthru

# Turn APM off
hdparm -B 255 (ata0)


-- 
Regards,
Christian Franke




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

* Re: hdparm documentation
  2009-11-08 17:09 ` Christian Franke
@ 2009-11-09 14:13   ` Robert Millan
  2009-11-09 15:00     ` [PATCH] prefix redefinition fix (Re: hdparm documentation) Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-11-09 14:13 UTC (permalink / raw)
  To: The development of GNU GRUB

On Sun, Nov 08, 2009 at 06:09:33PM +0100, Christian Franke wrote:
>
> After 'insmod ata', loading of further modules typically fails because  
> the drive in the 'prefix' variable is no longer valid.

Actually, there's a bit more to it:  even if you reset prefix, it won't
use the new path.

I'm working on a fix for that right now.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



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

* [PATCH] prefix redefinition fix (Re: hdparm documentation)
  2009-11-09 14:13   ` Robert Millan
@ 2009-11-09 15:00     ` Robert Millan
  2009-11-09 21:06       ` Robert Millan
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Millan @ 2009-11-09 15:00 UTC (permalink / raw)
  To: The development of GNU GRUB

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

On Mon, Nov 09, 2009 at 03:13:38PM +0100, Robert Millan wrote:
> On Sun, Nov 08, 2009 at 06:09:33PM +0100, Christian Franke wrote:
> >
> > After 'insmod ata', loading of further modules typically fails because  
> > the drive in the 'prefix' variable is no longer valid.
> 
> Actually, there's a bit more to it:  even if you reset prefix, it won't
> use the new path.
> 
> I'm working on a fix for that right now.

Here.  The problem is that command.lst (and friends) are only processed
once.  I fixed this by inserting a write hook in ${prefix}.

Would you please test and/or review?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

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


sftp://bzr.savannah.gnu.org/srv/bzr/grub/people/robertmh/prefix-redefinition-fix/

=== modified file 'normal/autofs.c'
--- normal/autofs.c	2009-11-09 14:45:28 +0000
+++ normal/autofs.c	2009-11-09 14:55:27 +0000
@@ -51,12 +51,6 @@
 read_fs_list (void)
 {
   const char *prefix;
-  static int first_time = 1;
-
-  /* Make sure that this function does not get executed twice.  */
-  if (! first_time)
-    return;
-  first_time = 0;
 
   prefix = grub_env_get ("prefix");
   if (prefix)
@@ -72,6 +66,15 @@
 	  file = grub_file_open (filename);
 	  if (file)
 	    {
+	      /* Override previous fs.lst.  */
+	      while (fs_module_list)
+		{
+		  grub_named_list_t tmp;
+		  tmp = fs_module_list->next;
+		  grub_free (fs_module_list);
+		  fs_module_list = tmp;
+		}
+
 	      while (1)
 		{
 		  char *buf;

=== modified file 'normal/dyncmd.c'
--- normal/dyncmd.c	2009-11-09 14:50:20 +0000
+++ normal/dyncmd.c	2009-11-09 14:55:27 +0000
@@ -62,12 +62,6 @@
 read_command_list (void)
 {
   const char *prefix;
-  static int first_time = 1;
-
-  /* Make sure that this function does not get executed twice.  */
-  if (! first_time)
-    return;
-  first_time = 0;
 
   prefix = grub_env_get ("prefix");
   if (prefix)
@@ -84,6 +78,16 @@
 	  if (file)
 	    {
 	      char *buf = NULL;
+
+	      /* Override previous commands.lst.  */
+	      while (grub_command_list)
+		{
+		  grub_command_t tmp;
+		  tmp = grub_command_list->next;
+		  grub_free (grub_command_list);
+		  grub_command_list = tmp;
+		}
+
 	      for (;; grub_free (buf))
 		{
 		  char *p, *name, *modname;

=== modified file 'normal/handler.c'
--- normal/handler.c	2009-11-09 14:50:20 +0000
+++ normal/handler.c	2009-11-09 14:55:27 +0000
@@ -135,7 +135,6 @@
 read_handler_list (void)
 {
   const char *prefix;
-  static int first_time = 1;
   const char *class_name;
 
   auto int iterate_handler (grub_handler_t handler);
@@ -162,11 +161,6 @@
       return 0;
     }
 
-  /* Make sure that this function does not get executed twice.  */
-  if (! first_time)
-    return;
-  first_time = 0;
-
   prefix = grub_env_get ("prefix");
   if (prefix)
     {
@@ -182,6 +176,16 @@
 	  if (file)
 	    {
 	      char *buf = NULL;
+
+	      /* Override previous handler.lst.  */
+	      while (grub_handler_class_list)
+		{
+		  grub_handler_class_t tmp;
+		  tmp = grub_handler_class_list->next;
+		  grub_free (grub_handler_class_list);
+		  grub_handler_class_list = tmp;
+		}
+
 	      for (;; grub_free (buf))
 		{
 		  char *p;

=== modified file 'normal/main.c'
--- normal/main.c	2009-08-24 23:55:06 +0000
+++ normal/main.c	2009-11-09 14:55:27 +0000
@@ -404,6 +404,16 @@
 
 static int reader_nested;
 
+static char *
+read_lists (struct grub_env_var *var __attribute__ ((unused)),
+	    const char *val)
+{
+  read_command_list ();
+  read_fs_list ();
+  read_handler_list ();
+  return val ? grub_strdup (val) : NULL;
+}
+
 /* Read the config file CONFIG and execute the menu interface or
    the command line interface if BATCH is false.  */
 void
@@ -411,9 +421,8 @@
 {
   grub_menu_t menu = 0;
 
-  read_command_list ();
-  read_fs_list ();
-  read_handler_list ();
+  read_lists (NULL, NULL);
+  grub_register_variable_hook ("prefix", NULL, read_lists);
   grub_command_execute ("parser.sh", 0, 0);
 
   reader_nested = nested;


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

* Re: [PATCH] prefix redefinition fix (Re: hdparm documentation)
  2009-11-09 15:00     ` [PATCH] prefix redefinition fix (Re: hdparm documentation) Robert Millan
@ 2009-11-09 21:06       ` Robert Millan
  0 siblings, 0 replies; 6+ messages in thread
From: Robert Millan @ 2009-11-09 21:06 UTC (permalink / raw)
  To: The development of GNU GRUB; +Cc: Vladimir Serbinenko

On Mon, Nov 09, 2009 at 04:00:17PM +0100, Robert Millan wrote:
> === modified file 'normal/autofs.c'
> --- normal/autofs.c	2009-11-09 14:45:28 +0000
> +++ normal/autofs.c	2009-11-09 14:55:27 +0000
> @@ -51,12 +51,6 @@
>  read_fs_list (void)
>  {
>    const char *prefix;
> -  static int first_time = 1;
> -
> -  /* Make sure that this function does not get executed twice.  */
> -  if (! first_time)
> -    return;
> -  first_time = 0;
>  
>    prefix = grub_env_get ("prefix");
>    if (prefix)
> @@ -72,6 +66,15 @@
>  	  file = grub_file_open (filename);

Vladimir, I don't think grub_file_open() can cause read_fs_list() to be invoked
recursively.  Note that read_fs_list() is not called when probing for
filesystems, only during initialization (before my patch, only once, and after
my patch, additionally each time ${prefix} is written to).

Do you still see a problem with this patch?

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."



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

* RE: [PATCH] prefix redefinition fix (Re: hdparm documentation)
       [not found] <COL0-MC1-F14MZ9CxvH0084d84c@col0-mc1-f14.Col0.hotmail.com>
@ 2009-11-12  6:43 ` Pedro A ARANDA
  0 siblings, 0 replies; 6+ messages in thread
From: Pedro A ARANDA @ 2009-11-12  6:43 UTC (permalink / raw)
  To: grub-devel; +Cc: rmh

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


Hi Robert

> Message: 1
> Date: Mon, 9 Nov 2009 16:00:17 +0100
> From: Robert Millan <rmh@aybabtu.com>
> Subject: [PATCH] prefix redefinition fix (Re: hdparm documentation)
> To: The development of GNU GRUB <grub-devel@gnu.org>
> Message-ID: <20091109150017.GA13079@thorin>
> Content-Type: text/plain; charset="us-ascii"
> 
> On Mon, Nov 09, 2009 at 03:13:38PM +0100, Robert Millan wrote:
> > On Sun, Nov 08, 2009 at 06:09:33PM +0100, Christian Franke wrote:
> > >
> > > After 'insmod ata', loading of further modules typically fails because  
> > > the drive in the 'prefix' variable is no longer valid.
> > 
> > Actually, there's a bit more to it:  even if you reset prefix, it won't
> > use the new path.
> > 
> > I'm working on a fix for that right now.
> 
> Here.  The problem is that command.lst (and friends) are only processed
> once.  I fixed this by inserting a write hook in ${prefix}.
> 
> Would you please test and/or review?
> 
> -- 
> Robert Millan
> 

Sorry for the silence... to many things going on at once...
I've been able to step-up the full grub 1.97 infrastructure,
including the debian/ directory from the Ubuntu 09.10
sources in order to have clean install/uninstall cycles.
I'm running on a VirtualBox for all tests ;-) but since it
takes time to setup everything, its quite convenient to
have snapshots you can revert to. 

Can I apply your patch on the stock 1.97 source or do
I need the experimental sources? I had a lot of problems
with them. In fact, I  haven't able to produce the deb 
packages from them.

Cheers,/PA


Cheers,/PA
 		 	   		  
_________________________________________________________________
Keep your friends updated—even when you’re not signed in.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010

[-- Attachment #2: Type: text/html, Size: 2306 bytes --]

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

end of thread, other threads:[~2009-11-12  6:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-08 15:27 hdparm documentation Pedro A ARANDA
2009-11-08 17:09 ` Christian Franke
2009-11-09 14:13   ` Robert Millan
2009-11-09 15:00     ` [PATCH] prefix redefinition fix (Re: hdparm documentation) Robert Millan
2009-11-09 21:06       ` Robert Millan
     [not found] <COL0-MC1-F14MZ9CxvH0084d84c@col0-mc1-f14.Col0.hotmail.com>
2009-11-12  6:43 ` Pedro A ARANDA

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.