Skip to contentSkip to conversation

hdparm documentation

PATCH In review Pedro A ARANDA 3 participants 5 messages Nov 8, 2009 – Nov 9, 2009

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 12 lines · Pedro A ARANDA

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

Quoted 8 lines

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)

Signature · 2 lines
Regards,
Christian Franke
#2 lore raw
Quoted 3 lines · Christian Franke

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.

Signature · 5 lines
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."
#3 lore raw

PATCH 1/1 prefix redefinition fix (Re: hdparm documentation)

Quoted 9 lines · Robert Millan
Quoted 3 lines · Christian Franke

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?

Signature · 5 lines
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."

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

=== modified file 'normal/autofs.c'

autofs.c +9 -6
@@ -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'

dyncmd.c +10 -6
@@ -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'

handler.c +10 -6
@@ -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'

main.c +12 -3
@@ -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;
#4 lore raw

Re: [PATCH] prefix redefinition fix (Re: hdparm documentation)

Quoted 17 lines · Robert Millan

=== modified file 'normal/autofs.c'

autofs.c +0 -6
@@ -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)

autofs.c line 66

Quoted 1 line
autofs.c +0 -0
@@ -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?

Signature · 5 lines
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."