Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/atactl Allow the enable command if SMART is not enabled...



details:   https://anonhg.NetBSD.org/src/rev/f7c2ce2a6f53
branches:  trunk
changeset: 536351:f7c2ce2a6f53
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Sep 13 18:31:41 2002 +0000

description:
Allow the enable command if SMART is not enabled.  Duh.
Also, just blindly allow the disable command.

diffstat:

 sbin/atactl/atactl.c |  44 +++++++++++++++++++-------------------------
 1 files changed, 19 insertions(+), 25 deletions(-)

diffs (87 lines):

diff -r 879e0f6f6e0a -r f7c2ce2a6f53 sbin/atactl/atactl.c
--- a/sbin/atactl/atactl.c      Fri Sep 13 18:30:43 2002 +0000
+++ b/sbin/atactl/atactl.c      Fri Sep 13 18:31:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atactl.c,v 1.19 2002/08/15 19:17:04 soren Exp $        */
+/*     $NetBSD: atactl.c,v 1.20 2002/09/13 18:31:41 mycroft Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 void   ata_command(struct atareq *);
 void   print_bitinfo(const char *, const char *, u_int, struct bitinfo *);
 void   print_smart_status(void *vbuf, void *tbuf);
-int    is_smart(int silent);
+int    is_smart(void);
 
 int    fd;                             /* file descriptor for device */
 const  char *dvname;                   /* device name */
@@ -358,7 +358,7 @@
  */
 
 int
-is_smart(int silent)
+is_smart(void)
 {
        int retval = 0;
        struct atareq req;
@@ -396,9 +396,7 @@
                                        status = "disabled";
                                }
                        }
-                       if (!silent || retval == 0) {
-                               printf("SMART supported, SMART %s\n", status);
-                       }
+                       printf("SMART supported, SMART %s\n", status);
                }
        }
        return retval;
@@ -677,33 +675,29 @@
                usage();
 
        if (strcmp(argv[0], "enable") == 0) {
-               if (is_smart(1)) {
-                       memset(&req, 0, sizeof(req));
+               memset(&req, 0, sizeof(req));
 
-                       req.features = WDSM_ENABLE_OPS;
-                       req.command = WDCC_SMART;
-                       req.cylinder = htole16(WDSMART_CYL);
-                       req.timeout = 1000;
+               req.features = WDSM_ENABLE_OPS;
+               req.command = WDCC_SMART;
+               req.cylinder = htole16(WDSMART_CYL);
+               req.timeout = 1000;
 
-                       ata_command(&req);
+               ata_command(&req);
 
-                       is_smart(0);
-               }
+               is_smart();
        } else if (strcmp(argv[0], "disable") == 0) {
-               if (is_smart(1)) {
-                       memset(&req, 0, sizeof(req));
+               memset(&req, 0, sizeof(req));
 
-                       req.features = WDSM_DISABLE_OPS;
-                       req.command = WDCC_SMART;
-                       req.cylinder = htole16(WDSMART_CYL);
-                       req.timeout = 1000;
+               req.features = WDSM_DISABLE_OPS;
+               req.command = WDCC_SMART;
+               req.cylinder = htole16(WDSMART_CYL);
+               req.timeout = 1000;
 
-                       ata_command(&req);
+               ata_command(&req);
 
-                       is_smart(0);
-               }
+               is_smart();
        } else if (strcmp(argv[0], "status") == 0) {
-               if (is_smart(0)) {
+               if (is_smart()) {
                        memset(&inbuf, 0, sizeof(inbuf));
                        memset(&req, 0, sizeof(req));
 



Home | Main Index | Thread Index | Old Index