[openib-general] [PATCH 4 of 7] branch 1.0, mstflint: user-interface usability improvements

Jack Morgenstein jackm at mellanox.co.il
Thu Mar 30 06:51:27 PST 2006


flint user-interface usability improvements.

Index: flint.cpp
===================================================================
--- flint.cpp	(.../branches/1.0/src/userspace/mstflint)	(revision 6101)
+++ flint.cpp	(.../trunk/src/userspace/mstflint)	(revision 6101)
@@ -32,7 +32,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- *  Version: $Id: flint.cpp 2747 2006-01-17 16:46:17Z orenk $
+ *  Version: $Id: flint.cpp 2777 2006-03-23 14:55:51Z orenk $
  *
  */
 
@@ -133,7 +133,7 @@ char* _versionID = _VFSTR( VERSION_ID ) 
 char* _versionID = "VERSION_ID_HERE";
 #endif
 
-char* _svnID     = "$Revision: 2747 $";
+char* _svnID     = "$Revision: 2777 $";
 
 #ifndef __be32_to_cpu
     #define __be32_to_cpu(x) ntohl(x)
@@ -1240,17 +1240,17 @@ bool FImage::open(const char *fname, boo
     fh = fopen(fname, "rb");
 
     if (!fh) {
-        return errmsg("Can't open file \"%s\" - %s\n", fname, 
strerror(errno));
+        return errmsg("Can not open file \"%s\" - %s\n", fname, 
strerror(errno));
     }
 
     // Get the file size:
     if (fseek(fh, 0, SEEK_END) < 0) {
-        return errmsg("Can't get file size for \"%s\" - %s\n", fname, 
strerror(errno));
+        return errmsg("Can not get file size for \"%s\" - %s\n", fname, 
strerror(errno));
     }
 
     fsize = ftell(fh);
     if (fsize < 0) {
-        return errmsg("Can't get file size for \"%s\" - %s\n", fname, 
strerror(errno));
+        return errmsg("Can not get file size for \"%s\" - %s\n", fname, 
strerror(errno));
     }
     rewind(fh);
 
@@ -1356,7 +1356,7 @@ bool Flash::open(const char *device, boo
     // Open device
     _mf = mopen(device);
     if (!_mf) {
-        return errmsg("Can't open device %s: %s", device, strerror(errno));
+        return errmsg("Can not open device %s: %s", device, strerror(errno));
     }
 
     _locked = lock();
@@ -1971,7 +1971,7 @@ bool ParallelFlash::CmdSetAmd::write(u_i
                 int  loop_cnt = 0;
                 // Timeout checks
                 if (++loop_cnt > FLASH_CMD_CNT) {
-                    return _f.errmsg("Use scratchpad: CMD doesn't become 
zero");
+                    return _f.errmsg("Use scratchpad: CMD does not become 
zero");
                 }
                 if (mread4(_f._mf, _f.USE_SCR , &cmd) != 4) return false;
 
@@ -2008,7 +2008,7 @@ bool ParallelFlash::CmdSetAmd::write(u_i
                 if (++cnt1 > READ_CNT_FAST)
                     usleep(READ_DELAY);
                 if (cnt1 > READ_CNT_FAST + READ_CNT_SLOW) {
-                    return _f.errmsg("Flash write error - read value didn't 
stabilize.");
+                    return _f.errmsg("Flash write error - read value did not 
stabilize.");
                     return false;
                 }
 
@@ -3005,7 +3005,8 @@ bool SpiFlash::CmdSetStSpi::write (u_int
 
         if (!all_ffs) {
 
-            write_block(block_addr, block_data, block_size);
+            if (!write_block(block_addr, block_data, block_size))
+                return false;
 
             if (!noverify) {
                 u_int8_t verify_buffer[MAX_WRITE_BUFFER_SIZE];
@@ -3192,7 +3193,7 @@ bool SpiFlash::CmdSetStSpi::wait_wip(u_i
             usleep(delay);
         if (cnt > retrys) {
             reset();
-            return _f.errmsg("Flash write error - Write In Progress bit 
didn't clear.");
+            return _f.errmsg("Flash write error - Write In Progress bit did 
not clear.");
         }
 
         MWRITE4(FLASH_ADDR, gw_addr);
@@ -3268,7 +3269,7 @@ public:
     void SetNumPorts     (u_int32_t num_ports) {_num_ports = num_ports;}
     void SetAllowSkipIs  (bool asis)           {_allow_skip_is = asis;}
     
-    bool ask_user        (const char* msg);
+    bool ask_user        ();
 
     u_int32_t              _last_image_addr;
 
@@ -3381,8 +3382,8 @@ private:
 // Returns true if user chose Y, false if user chose N.
 //
 
-bool Operations::ask_user(const char* msg) {
-    printf(msg);
+bool Operations::ask_user() {
+    printf("\n Do you want to continue ? (y/n) [n] : ");
     if (_assume_yes)
         printf("y\n");
     else {
@@ -3390,7 +3391,7 @@ bool Operations::ask_user(const char* ms
         ansbuff[0] = '\0';
 
         if (!isatty(0)) {
-            return errmsg("Not on tty - Can't interact. assuming \"no\" for 
question \"%s\"", msg);
+            return errmsg("Not on tty - Can not interact. assuming \"no\"");
         }
         fflush(stdout);
         fgets(ansbuff, 30, stdin);
@@ -3487,7 +3488,7 @@ bool Operations::repair(Flash& f, const 
 
     // Make sure ps ik ok:
     if (sig != SIGNATURE) {
-        return errmsg("Can't copy image. Pointer sector %d signature is bad 
(%08x).", from, sig);
+        return errmsg("Can not copy image. Pointer sector %d signature is bad 
(%08x).", from, sig);
     }
 
     // Valid image size in bytes
@@ -3643,7 +3644,7 @@ bool Operations::FailSafe_burn_internal(
         return errmsg("Invalid image: too small.");
     }
     if (prim_len != scnd_len) {
-        return errmsg("Invalid image: two FW images should be in a same 
size.");
+        return errmsg("Invalid image: two FW images should have the same 
size.");
     }
 
     // Image size from flash
@@ -3727,23 +3728,23 @@ bool Operations::CheckInvariantSector(Fl
     if (first_diff != -1) {
             report("DIFF DETECTED\n\n");
             printf(" Invariant sector mismatch. Address 0x%x "
-                   " in image: 0x%08x, while in flash: 0x%08x\n\n",
+                   " in image: 0x%08x, while on flash: 0x%08x\n\n",
                    first_diff*4 , data32[first_diff], buf1[first_diff]);
 
             printf(" The invariant sector can not be burnt in a failsafe 
manner.\n"
-                   " To force burn of the invariant sector, rerun with -nofs 
flag.\n");
+                   " To force-burn the invariant sector, rerun with -nofs 
flag.\n");
 
         if (_allow_skip_is) {
             printf(" You can also continue to update the FW without updating 
the invariant sector.\n"
-                   " See the firmware release notes for more details.\n\n");
+                   " See the FW release notes for more details.\n\n");
 
-            return ask_user(" Do you want to continue  ? ");
+            return ask_user();
 
         } else {
             // Continue with burn
             printf(" You can also update the FW without updating the 
invariant sector by\n"
                    " specifying the -skip_is flag.\n" 
-                   " See the firmware release notes for more details.\n\n");
+                   " See the FW release notes for more details.\n\n");
 
             return errmsg("Invariant sector mismatch");
         }
@@ -3799,7 +3800,7 @@ bool Operations::FailSafe_burn(Flash& f,
     u_int32_t  cur_image_size[2];
 
     // Check signatures on flash
-    report("Read and verify PPS/SPS in flash               - ");
+    report("Read and verify PPS/SPS on flash               - ");
     for (i = 0 ; i < 2 ; i++) {
         if (!f.read(sect_size * (i+1) + 8, &signature_for_compare)) {
 
@@ -3821,12 +3822,12 @@ bool Operations::FailSafe_burn(Flash& f,
 
     if (!cur_image_ok[0] && !cur_image_ok[1]) {
         //
-        // Both images are invalid in flash
+        // Both images are invalid on flash
         // --------------------------------
         //
-        printf("\nBoth images (primary and secondary) are invalid in flash.
\n");
-        printf("The burning can't be failsafe, but it is harmless for host.
\n");
-        if(!ask_user("\n    Do you want to continue ? (y/n) [n] : ")) {
+        printf("\nBoth images (primary and secondary) are invalid on flash.
\n");
+        printf("The burning can not be failsafe, but it is harmless for host.
\n");
+        if(!ask_user()) {
             return false;
         }
 
@@ -3878,7 +3879,7 @@ bool Operations::FailSafe_burn(Flash& f,
         }
 
         //
-        // Both images are valid in flash
+        // Both images are valid on flash
         //
         return FailSafe_burn_internal(f, data, size, need_report);
 
@@ -3902,7 +3903,7 @@ bool Operations::FailSafe_burn(Flash& f,
             //   first image, and new image would be written as second.
 
             if (frst_new_image_addr + frst_new_image_size > 
cur_image_addr[1]) {
-                // New image is too large - can't get in between first image 
start 
+                // New image is too large - can not get in between first 
image start 
                 // and current (second) image - move current image to be 
first.
                 if (!repair(f, 1, 0, need_report))
                     return false;
@@ -4239,14 +4240,25 @@ bool Operations::Verify(FBase& f)
     if (signature == SIGNATURE) {
         // Full image
         _image_is_full = true;
+
+        bool psStat[2];
+
         report("\nFailsafe image:\n\n");
         CHECKB2(f, 0, 0x28, prim_ptr, "Invariant      ");
         report("\n");
-        if (checkPS(f, f.get_sector_size(), prim_ptr, "Primary  "))
+        psStat[0] = checkPS(f, f.get_sector_size(), prim_ptr, "Primary  ");
+        if (psStat[0]) {
             ret &= checkList(f, prim_ptr, "               ");
+        }
         report("\n");
-        if (checkPS(f, f.get_sector_size() * 2, scnd_ptr, "Secondary"))
+        psStat[1] = checkPS(f, f.get_sector_size() * 2, scnd_ptr, 
"Secondary");
+        if (psStat[1]) {
             CHECKLS(f, scnd_ptr, "               ");
+        }
+
+        if (psStat[0] == false && psStat[1] == false) {
+            ret = false;
+        }
     } else {
         // Short image
         _image_is_full = false;
@@ -4268,12 +4280,12 @@ bool Operations::DumpConf        (const 
         out = fopen(conf_file, "w");
 
         if (out == NULL) {
-            return errmsg("Can't open file %s for write: %s.", conf_file, 
strerror(errno));
+            return errmsg("Can not open file %s for write: %s.", conf_file, 
strerror(errno));
         }
     }
 
     if (_fw_conf_sect.empty()) {
-        return errmsg("Fw configuration section not found in the given 
image.");
+        return errmsg("FW configuration section not found in the given 
image.");
     }
 
     // restore endianess.
@@ -4289,7 +4301,7 @@ bool Operations::DumpConf        (const 
 
     if (rc != Z_OK)
     {
-        return errmsg("Failed uncompressing FW Info section. uncompress 
returnes %d", rc);
+        return errmsg("Failed uncompressing FW configuration section. 
uncompress returnes %d", rc);
     }
 
     dest.resize(destLen);
@@ -4399,29 +4411,29 @@ bool Operations::getBSN(char *s, guid_t 
     if (dd > 31)
         BSN_RET1("Day (dd) should not exceed 31");
     if (!dd)
-        BSN_RET1("Day (dd) can't be zero");
+        BSN_RET1("Day (dd) can not be zero");
     u_int32_t mm = BSN_subfield(s, 10+date_offs, 2);
     if (mm > 12)
         BSN_RET1("Months (mm) should not exceed 12");
     if (!mm)
-        BSN_RET1("Months (mm) can't be zero");
+        BSN_RET1("Months (mm) can not be zero");
     u_int32_t yy = BSN_subfield(s, 12+date_offs, 2);
     if (yy > 99)
         BSN_RET1("Year (yy) should not exceed 99");
     if (!yy)
-        BSN_RET1("Year (yy) can't be zero");
+        BSN_RET1("Year (yy) can not be zero");
     u_int32_t num = BSN_subfield(s, 15+date_offs, 3);
     if (num > 999)
         BSN_RET1("Number (num) should not exceed 999");
     if (!num)
-        BSN_RET1("Number (num) can't be zero");
+        BSN_RET1("Number (num) can not be zero");
     int cc = 1;
     if (cc_present) {
         cc = BSN_subfield(s, 19+date_offs, 2);
         if (cc > 14)
             BSN_RET1("Chip number (cc) should not exceed 14");
         if (!cc)
-            BSN_RET1("Chip number (cc) can't be zero");
+            BSN_RET1("Chip number (cc) can not be zero");
     }
     u_int64_t id = ((((yy*12+mm-1)*31+ dd-1) * 1000) + num-1) * 112;
     id += (cc-1)*8;
@@ -4472,7 +4484,7 @@ bool Operations::extractGUIDptr(u_int32_
     TOCPU1(*ind);
     *ind += offs;
     if (*ind >= (u_int32_t)buf_len) {
-        printf("%s image - insane GUID pointer (%08x)\n", pref, *ind);
+        printf("%s image - illegal GUID pointer (%08x)\n", pref, *ind);
         return false;
     }
     *nguids = buf[*ind/4 - 3];
@@ -4481,7 +4493,7 @@ bool Operations::extractGUIDptr(u_int32_
 
     // More sanity check
     if (*nguids > GUIDS) {
-        printf("%s image - insane number of GUIDs (%d)\n", pref, *nguids);
+        printf("%s image - illegal number of GUIDs (%d)\n", pref, *nguids);
         return false;
     }
 
@@ -4580,7 +4592,7 @@ void Operations::PatchPs(u_int8_t*      
         fix_end += PSID_LEN;
     }
 
-    //vsd is kept in flash byte-swapped.
+    //VSD is kept on flash byte-swapped.
     //recode it back before patching
     u_int32_t *qp;
 
@@ -4624,9 +4636,9 @@ bool Operations::patchVSD(FImage& f, 
     if (user_psid) {
         // New psid is explicitly given - take it from user
         printf("\n    You are about to replace current PSID in the image file 
- \"%s\" with a different PSID - \"%s\".\n"
-               "    Note: It is highly recommended NOT to change the image 
PSID.\n", user_psid, image_psid);
+               "    Note: It is highly recommended not to change the image 
PSID.\n", user_psid, image_psid);
 
-        if (! ask_user("\n    Is it OK ? (y/n) [n] : "))
+        if (! ask_user())
             return false;
 
         psid_to_use = user_psid;
@@ -4638,9 +4650,12 @@ bool Operations::patchVSD(FImage& f, 
 
 
     if (curr_psid && strncmp( psid_to_use, (char*) curr_psid, PSID_LEN)) {
-        printf("\n    You are about to replace current PSID in flash - \"%s\" 
with a different PSID - \"%s\".\n", curr_psid, psid_to_use);
+        printf("\n    You are about to replace current PSID on flash - \"%s\" 
with a different PSID - \"%s\".\n"
+
+               "    Note: It is highly recommended not to change the PSID.
\n",
+	       curr_psid, psid_to_use);
 
-        if (! ask_user("\n    Is it OK ? (y/n) [n] : "))
+        if (! ask_user())
             return false;
     }
 
@@ -4710,7 +4725,7 @@ bool Operations::patchGUIDs(FImage& f, g
         if (!image_file_old_guids_fmt)
             printf("        Sys.Image: " GUID_FORMAT "\n", 
new_guids[3].h,new_guids[3].l);
 
-        if (!ask_user("\n    Is it OK ? (y/n) [n] : "))
+        if (!ask_user())
             return false;
 
         used_guids = new_guids;
@@ -4835,12 +4850,12 @@ bool Operations::QueryImage (FBase& f, 
     TOCPU1(guid_ptr);
     guid_ptr += im_start;
     if (guid_ptr >= f.get_size()) {
-        return errmsg("Failed to read GUIDs - Insane GUID pointer (%08x). 
Probably image is corrupted", guid_ptr);
+        return errmsg("Failed to read GUIDs - Illegal GUID pointer (%08x). 
Probably image is corrupted", guid_ptr);
     }
     READ4(f, guid_ptr - 3*sizeof(u_int32_t), &nguids, "Number of GUIDs");
     TOCPU1(nguids);
     if (nguids > GUIDS*2) {
-        report("Failed to read GUIDs - Insane Number of GUIDs (%d)\n", 
nguids);
+        report("Failed to read GUIDs - Illegal Number of GUIDs (%d)\n", 
nguids);
         return false;
     }
     READBUF(f, guid_ptr, guids, nguids / 2 * sizeof(u_int64_t), "GUIDS");
@@ -4864,7 +4879,7 @@ bool Operations::QueryImage (FBase& f, 
     }
 
     if (info_ptr_cs) {
-        return errmsg("Failed to read Info Section - Bad checksum for Info 
section pointer (%08x). Probably image is corrupted", info_ptr);        
+        return errmsg("Failed to read Info Section - Bad checksum for Info 
section pointer (%08x). Probably the image is corrupted.", info_ptr);        
     }
 
     info_ptr = info_ptr_ba.range(23,0);
@@ -4872,7 +4887,7 @@ bool Operations::QueryImage (FBase& f, 
         
         info_ptr += im_start;
         if (info_ptr >= f.get_size()) {
-            return errmsg("Failed to read Info Section - Info section pointer 
(%08x) too large. Probably image is corrupted", info_ptr);
+            return errmsg("Failed to read Info Section - Info section pointer 
(%08x) too large. Probably the image is corrupted.", info_ptr);
         }
         READ4(f, info_ptr - 3*sizeof(u_int32_t), &info_size, "Info section 
size");
         TOCPU1(info_size);
@@ -5070,7 +5085,7 @@ Flash* get_flash(const char* device, u_i
 
     mfile* mf = mopen(device);
     if (!mf) {
-        printf("*** ERROR *** Can't open %s: %s\n", device,  
strerror(errno));
+        printf("*** ERROR *** Can not open %s: %s\n", device,  
strerror(errno));
         return NULL;
     }
 
@@ -5119,7 +5134,8 @@ void usage(const char *sname, bool full 
     "\n"
     "               FLINT - FLash INTerface\n"
     "\n"
-    "InfiniHost flash memory operations.\n"
+    "FW (firmware) burning and flash memory operations tool for\n"
+    "Mellanox InfiniHost HCAs family.\n"
     "\n"
     "Usage:\n"
     "------\n"
@@ -5134,13 +5150,14 @@ void usage(const char *sname, bool full 
     "                                 MTxxxxx[-]R[xx]ddmmyy-nnn[-cc]\n"
     "                         Commands affected: burn\n"
     "\n"
-    "    -crc               - Print CRC after each section when verify.\n"
+    "    -crc               - Print out each section CRC.\n"
+    "                         Commands affected: verify\n"
     "\n"
     "    -d[evice] <device> - Device flash is connected to.\n"
     "                         Commands affected: all\n"
     "\n"
-    "    -guid <GUID>       - Base value for up to 4 GUIDs, which\n"
-    "                         are automatically assigned the\n"
+    "    -guid <GUID>       - GUID base value. 4 GUIDs\n"
+    "                         are automatically assigned to the\n"
     "                         following values:\n"
     "\n"
     "                         guid   -> node GUID\n"
@@ -5148,8 +5165,8 @@ void usage(const char *sname, bool full 
     "                         guid+2 -> port2\n"
     "                         guid+3 -> system image GUID.\n"
     "\n"
-    "                         Note: For a single port HCA, port2 guid is 
assigned\n"
-    "                               with the 'guid + 2' value, although it is 
ignored.\n"
+    "                         Note: port2 guid will be assigned even for a"
+    "                         single port HCA - The HCA ignores this value.
\n"
     "\n"
     "                         Commands affected: burn\n"
     "\n"
@@ -5158,17 +5175,20 @@ void usage(const char *sname, bool full 
     "                         the following values, repectively:\n"
     "                         node, port1, port2 and system image GUID.\n"
     "\n"
-    "                         Note: For a single port HCA, port2 guid must 
be\n"
-    "                               specified (can be set to 0x0), although 
it is ignored.\n"
+    "                         Note: port2 guid must be specified even for 
a\n"
+    "                         single port HCA - The HCA ignores this value.
\n"
+    "                         It can be set to 0x0.\n"
     "\n"
     "                         Commands affected: burn\n"
     "\n"
-    "    -clear_semaphore   - Force clear of the flash semaphore on the 
device.\n"
-    "                         This flag should come BEFORE the -d[evice] flag 
in the command line.\n"
+    "    -clear_semaphore   - Force clear the flash semaphore on the device.
\n"
+    "                         This flag should come BEFORE the -d[evice] 
flag\n"
+    "                         on the command line.\n"
     "                         No command is allowed when this flag is used.
\n"
-    "                         NOTE: Using this flag may result in an unstable 
behavior and flash image\n"
-    "                               corruption if the device or another flash 
application is currently\n"
-    "                               using the flash. Handle with care.\n"
+    "                         NOTE: May result in system instability or 
flash\n"
+    "                               corruption if the device or another\n"
+    "                               application is currently using the flash.
\n"
+    "                               Exercise caution.\n"
     "\n"
     "    -h[elp]            - Prints this message and exits\n"
     "    -hh                - Prints extended command help\n"
@@ -5179,7 +5199,7 @@ void usage(const char *sname, bool full 
     "    -nofs              - Burn image not in failsafe manner.\n"
     "\n"
     "    -skip_is           - Allow burning the FW image without updating the 
invariant sector,\n"
-    "                         to insures failsafe burning even when invariant 
sector difference is detected.\n"
+    "                         to ensure failsafe burning even when an 
invariant sector difference is detected.\n"
     "                         See the specific FW release notes for more 
details.\n"
     "\n"
     "    -byte_mode         - Shift address when accessing flash internal 
registers. May\n"
@@ -5202,7 +5222,7 @@ void usage(const char *sname, bool full 
     "\n"
     "    -psid <PSID>       - Write the Parameter Set ID (PSID) string to 
PS-ID field (last 16 bytes of VSD) when burn.\n"
     "\n"
-    "    -use_image_ps      - Burn vsd as appears in the given image - don't 
keep existing vsd on flash.\n"
+    "    -use_image_ps      - Burn vsd as appears in the given image - do not 
keep existing VSD on flash.\n"
     "                         Commands affected: burn\n"
     "\n"
     "    -dual_image        - Make the burn process burn two images on flash 
(previously default algorithm). Current\n" 
@@ -5215,7 +5235,7 @@ void usage(const char *sname, bool full 
     "-----------------\n"
     "    b[urn]   - Burn flash\n"
     "    e[rase]  - Erase sector\n"
-    "    q[uery]  - Query misc. flash/FW characteristics\n"
+    "    q[uery]  - Query misc. flash/firmware characteristics\n"
     "    rw       - Read one dword from flash\n"
     "    v[erify] - Verify entire flash\n"
     "    ww       - Write one dword to flash\n"
@@ -5368,7 +5388,7 @@ void usage(const char *sname, bool full 
     "    Example:\n"
     "        " FLINT_NAME " -d " DEV_MST_EXAMPLE1 " wbne 0x10000 12 0x30000 
0x76800 0x5a445a44\n"
     "\n"
-    "* Print (to screen or to a file) the firmware configuration text file 
used by the image generation process.\n"
+    "* Print (to screen or to a file) the FW configuration text file used by 
the image generation process.\n"
     "  This command would fail if the image does not contain a FW 
configuration section. Existence of this\n"
     "  section depends on the version of the image generation tool.\n"
     "\n"
@@ -5650,12 +5670,9 @@ int main(int ac, char *av[])
 
     Operations            ops;
 
-    FBase*      fbase = 0 /* Suppress gcc warning */;
-    char*       cmdTarget = 0 /* Suppress gcc warning */;
-    char*       cmdAccess = 0 /* Suppress gcc warning */;
-
-    // Output file
-    FILE*  fh = 0 /* Suppress gcc warning */;
+    FBase*      fbase     = NULL;
+    char*       cmdTarget = NULL;
+    char*       cmdAccess = NULL;
 
     //
     // Map termination signal handlers
@@ -5800,7 +5817,6 @@ int main(int ac, char *av[])
         }
     }
 
-
     //
     // Commands
     // --------
@@ -5842,6 +5858,7 @@ int main(int ac, char *av[])
         rc = 1; goto done;
     }
 
+
     if (device) {
         // Open the device
 
@@ -5850,7 +5867,7 @@ int main(int ac, char *av[])
         f = tmp;
         
         if (f.get() == NULL) {
-            printf("*** ERROR *** Can't get flash type using device %s\n", 
device);
+            printf("*** ERROR *** Can not get flash type using device %s\n", 
device);
             rc =  1; goto done; 
         }
         
@@ -5858,7 +5875,7 @@ int main(int ac, char *av[])
         
         g_flash = f.get();
         if (!f->open(device, clear_semaphore)) {
-            printf("*** ERROR *** Can't open %s: %s\n", device, f->err());
+            printf("*** ERROR *** Can not open %s: %s\n", device, f->err());
             rc =  1; goto done; 
         }
 
@@ -5936,12 +5953,12 @@ int main(int ac, char *av[])
                 if (read_guids && !flashInfo.imageOk) {
 
                     printf("\n");
-                    printf("*** ERROR *** Can't extract GUIDS info from 
flash. "
+                    printf("*** ERROR *** Can not extract GUIDS info from 
flash. "
                            "Please specify GUIDs (using command line flags 
-guid(s) ). \n");
                 }
                 
                 if (burn_failsafe) {
-                    printf("              Can't burn in a failsafe mode. 
Please use \"-nofs\" flag to burn in a none failsafe mode.\n");
+                    printf("              Can not burn in a failsafe mode. 
Please use \"-nofs\" flag to burn in a none failsafe mode.\n");
                 }
                 rc =  1; goto done;
             }
@@ -5950,16 +5967,16 @@ int main(int ac, char *av[])
                 printf("\n");
                 if (burn_failsafe) {
 
-                    printf("*** ERROR *** Can't extract VSD/PSID info from 
flash.\n"
-                           "              Can't burn in a failsafe mode. 
Please use \"-nofs\" flag to burn in a none failsafe mode.\n");
+                    printf("*** ERROR *** Can not extract VSD/PSID info from 
flash.\n"
+                           "              Can not burn in a failsafe mode. 
Please use \"-nofs\" flag to burn in a none failsafe mode.\n");
                     rc =  1; goto done;
                 }  else {
-                    printf("*** WARNING *** Can't extract VSD/PSID info from 
flash.\n\n"
+                    printf("*** WARNING *** Can not extract VSD/PSID info 
from flash.\n\n"
                            "    To use a specific VSD, abort and re-burn 
specifying the\n"
                            "    needed info (using command line flags -vsd / 
-use_image_ps).\n"
                            "    You can also continue burn using blank VSD.
\n");
                 
-                    if (!ops.ask_user("\n    Continue burn using a blank 
VSD ? (y/n) ")) {
+                    if (!ops.ask_user()) {
                         rc =  1; goto done;
                     }
                 }
@@ -5986,7 +6003,7 @@ int main(int ac, char *av[])
                 if (!ops.patchGUIDs(fim, 
                                     user_guids, 
                                     flashInfo.imageOk ? flashInfo.guids : 
NULL, 
-                                    isatty(0) != 0)) {
+                                    true)) {
                     rc =  1; goto done;
                 }
             } else {
@@ -6015,7 +6032,7 @@ int main(int ac, char *av[])
         if (burn_failsafe) {
             // Failsafe burn
             if (!_image_is_full) {
-                printf("*** ERROR *** Failsafe burn failed: FW Image on flash 
is short.\n");
+                printf("*** ERROR *** Failsafe burn failed: FW image on flash 
is short.\n");
                 printf("It is impossible to burn a short image in a failsafe 
mode.\n");
                 printf("If you want to burn in non failsafe mode, use the 
\"-nofs\" switch.\n");
                 rc =  1; goto done; 
@@ -6050,9 +6067,9 @@ int main(int ac, char *av[])
             }
             printf("Burn process will not be failsafe. No checks are 
performed.\n");
             printf("ALL flash, including Invariant Sector will be 
overwritten.\n");
-            printf("If this process fails computer may remain in unoperatable 
state.\n");
+            printf("If this process fails computer may remain in inoperable 
state.\n");
 
-            if (!ops.ask_user("\nAre you sure ? (y/n) [n] : ")) {
+            if (!ops.ask_user()) {
                 rc =  1; goto done;
 	    }
 
@@ -6134,13 +6151,16 @@ int main(int ac, char *av[])
         }
         data = new u_int8_t[length];
 
+        // Output file
+        FILE*  fh = NULL;
+
         if (i + 2 == ac)
             to_file = true;
 
         if (to_file) {
             NEXTC("<OUT_FILENAME>", "rb");
             if ((fh = fopen(av[i], "wb")) == NULL) {
-                fprintf(stderr, "Can't open ");
+                fprintf(stderr, "Can not open ");
                 perror(av[i]);
                 rc =  1; goto done; 
             }
@@ -6201,10 +6221,10 @@ int main(int ac, char *av[])
     {
         // VERIFY
         if (!ops.Verify(*fbase)) {
-            printf("\n*** ERROR *** FW Image verification failed. AN HCA 
DEVICE CAN NOT BOOT FROM THIS IMAGE.\n");
+            printf("\n*** ERROR *** FW image verification failed. AN HCA 
DEVICE CAN NOT BOOT FROM THIS IMAGE.\n");
             rc =  1; goto done; 
         } else {
-            printf("\nFW Image verification succeeded. Image is OK.\n\n");
+            printf("\nFW image verification succeeded. Image is OK.\n\n");
         }
     }
     break;
@@ -6248,7 +6268,7 @@ int main(int ac, char *av[])
         FILE* fh;
 
         if ((fh = fopen(av[i], "wb")) == NULL) {
-            fprintf(stderr, "Can't open ");
+            fprintf(stderr, "Can not open ");
             perror(av[i]);
             rc =  1; goto done; 
         }



More information about the general mailing list