]> git.proxmox.com Git - mirror_smartmontools-debian.git/blobdiff - smartctl.h
import smartmontools 7.0
[mirror_smartmontools-debian.git] / smartctl.h
index fca1df20fff8ecd2c4ad1957e955667a91a18458..305f625ec7134e3394a989367283daef40488532 100644 (file)
@@ -1,39 +1,23 @@
 /*
  * smartctl.h
  *
- * Home page of code is: http://smartmontools.sourceforge.net
+ * Home page of code is: http://www.smartmontools.org
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-10 Bruce Allen
+ * Copyright (C) 2008-17 Christian Franke
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * You should have received a copy of the GNU General Public License
- * (for example COPYING); if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * This code was originally developed as a Senior Thesis by Michael Cornwell
- * at the Concurrent Systems Laboratory (now part of the Storage Systems
- * Research Center), Jack Baskin School of Engineering, University of
- * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
- *
+ * SPDX-License-Identifier: GPL-2.0-or-later
  */
 
 #ifndef SMARTCTL_H_
 #define SMARTCTL_H_
 
-#define SMARTCTL_H_CVSID "$Id: smartctl.h,v 1.24 2006/07/20 20:59:45 chrfranke Exp $\n"
-
-/* Boolean Values */
-#define TRUE 0x01
-#define FALSE 0x00
+#define SMARTCTL_H_CVSID "$Id: smartctl.h 4842 2018-12-02 16:07:26Z chrfranke $\n"
 
 // Return codes (bitmask)
 
-// command line did not parse, or internal error occured in smartctl
+// command line did not parse, or internal error occurred in smartctl
 #define FAILCMD   (0x01<<0)
 
 // device open failed
 // command set."  The 'mandatory' S.M.A.R.T.  commands are: (1)
 // Enable/Disable Attribute Autosave, (2) Enable/Disable S.M.A.R.T.,
 // and (3) S.M.A.R.T. Return Status.  All others are optional.
-#define OPTIONAL_CMD 1
-#define MANDATORY_CMD 2
-
-void print_smartctl_examples();
+enum failure_type {
+  OPTIONAL_CMD,
+  MANDATORY_CMD,
+};
+
+// Globals to set failuretest() policy
+extern bool failuretest_conservative;
+extern unsigned char failuretest_permissive;
+
+// Compares failure type to policy in effect, and either exits or
+// simply returns to the calling routine.
+void failuretest(failure_type type, int returnvalue);
+
+// Globals to control printing
+extern bool printing_is_switchable;
+extern bool printing_is_off;
+
+// Printing control functions
+inline void print_on()
+{
+  if (printing_is_switchable)
+    printing_is_off = false;
+}
+inline void print_off()
+{
+  if (printing_is_switchable)
+    printing_is_off = true;
+}
+
+// The singleton global JSON object
+#include "json.h"
+extern json jglb;
+
+#include "utility.h" // __attribute_format_printf()
+// TODO: move this to a new include file?
+
+// Version of pout() for items already included in JSON output
+void jout(const char *fmt, ...)
+  __attribute_format_printf(1, 2);
+// Version of pout() for info/warning/error messages
+void jinf(const char *fmt, ...)
+  __attribute_format_printf(1, 2);
+void jwrn(const char *fmt, ...)
+__attribute_format_printf(1, 2);
+void jerr(const char *fmt, ...)
+__attribute_format_printf(1, 2);
 
 #endif