[openib-general] [PATCH] fix flint error messages

Tom Duffy tduffy at sun.com
Thu Jan 13 14:21:58 PST 2005


On Thu, 2005-01-13 at 20:57 +0200, Michael S. Tsirkin wrote:
> So, since mmapping /dev/mem does not work:
> 
> I added an option to do pread/pwrite on dev/mem instead of
> mmap, on the off-chance that it might work (it does not
> on a regular x86 box).
> To try, turn off CONFIG_ENABLE_MMAP and turn on
> CONFIG_ENABLE_READWRITE.

Ok, I tried this, but got the following message:

tat:/build1/tduffy/openib-work/gen2-sparc/src/userspace/mstflint# ./mstflint -d 0000:81:00.0 q
*** ERROR *** (null)

Not very useful, so I updated all the spots where *** ERROR *** was in
flint to make it more human readable (and debuggable).

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: flint.cpp
===================================================================
--- flint.cpp	(revision 1526)
+++ flint.cpp	(working copy)
@@ -3490,7 +3490,7 @@
                 device = av[i];
                 if (!f.open(device))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Device open failed: %s\n", f._err);
                     return 1;
                 }
             }
@@ -3639,7 +3639,7 @@
                 FImage         fim;
                 if (!fim.open(image_fname))
                 {
-                    printf("*** ERROR *** %s\n", fim._err);
+                    fprintf(stderr, "Image open failed: %s\n", fim._err);
                     return 1;
                 }
                 bool old_silent = _silent;
@@ -3706,9 +3706,9 @@
                     if (!f.FailSafe_burn(fim.getBuf(), fim.getBufLength(),
                                               !silent))
                     {
-                        printf("*** ERROR *** %s\n", f._err);
-                        printf("It is impossible to burn this image in a failsafe mode.\n");
-                        printf("If you want to burn in non failsafe mode, use the \"-nofs\" switch.\n");
+                        fprintf(stderr, "FailSafe burn failed: %s\n", f._err);
+                        fprintf(stderr, "It is impossible to burn this image in a failsafe mode.\n");
+                        fprintf(stderr, "If you want to burn in non failsafe mode, use the \"-nofs\" switch.\n");
                         return 1;
                     }
                 }
@@ -3740,7 +3740,7 @@
                                        !silent))
                     {
                         report("\n");
-                        printf("*** ERROR *** %s\n", f._err);
+                        fprintf(stderr, "Non FailSafe burn failed: %s\n", f._err);
                         return 1;
                     }
                     report("\n");
@@ -3774,7 +3774,7 @@
                 // Erase
                 if (!f.erase_sector(addr))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Erase sector failed: %s\n", f._err);
                     return 1;
                 }
             }
@@ -3788,7 +3788,7 @@
                     FImage         fim;
                     if (!fim.open(image_fname))
                     {
-                        printf("*** ERROR *** %s\n", fim._err);
+                        fprintf(stderr, "Image open failed: %s\n", fim._err);
                         return 1;
                     }
                     RevisionInfo(fim, guids, 0, &fs_image);
@@ -3862,7 +3862,7 @@
                 // Read flash
                 if (!f.read(addr, data, length))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Flash read failed: %s\n", f._err);
                     return 1;
                 }
 
@@ -3918,7 +3918,7 @@
                 // Read
                 if (!f.read(addr, &data))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Address read failed: %s\n", f._err);
                     return 1;
                 }
                 printf("0x%08x\n", (unsigned int)__cpu_to_be32(data));
@@ -3933,7 +3933,7 @@
                     FImage         fim;
                     if (!fim.open(image_fname))
                     {
-                        printf("*** ERROR *** %s\n", fim._err);
+                        fprintf(stderr, "Verify open image failed: %s\n", fim._err);
                         return 1;
                     }
                     Verify(fim);
@@ -3997,7 +3997,7 @@
                 // Write flash
                 if (!f.write_image(addr, data, length, !silent))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Write flash failed: %s\n", f._err);
                     return 1;
                 }
 
@@ -4037,7 +4037,7 @@
                 f.curr_sector = 0xffffffff;  // First time erase sector
                 if (!f.write(addr, data))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Erase sector failed: %s\n", f._err);
                     return 1;
                 }
             }
@@ -4073,7 +4073,7 @@
 
                 if (!f.write(addr, &data, 4, true, true))
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Write failed: %s\n", f._err);
                     return 1;
                 }
             }
@@ -4091,7 +4091,7 @@
   
                 if (!f.query_cfi())
                 {
-                    printf("*** ERROR *** %s\n", f._err);
+                    fprintf(stderr, "Query cfi failed: %s\n", f._err);
                     return 1;
                 }
             }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050113/a92bcb06/attachment.sig>


More information about the general mailing list