Skip to content
Snippets Groups Projects
Select Git revision
  • 51d107a0a278955ef7330c6bb8bb74ae90f4998d
  • master default protected
  • develop-GA
  • timeFstatmap
  • add-higher-spindown-components
  • develop-DK
  • adds-header-to-grid-search
  • v1.2
  • v1.1.2
  • v1.1.0
  • v1.0.1
11 results

helper_functions.py

Blame
  • Forked from Gregory Ashton / PyFstat
    Source project has a limited visibility.
    smartd.cpp 18.66 KiB
    /*
     * Home page of code is: http://smartmontools.sourceforge.net
     *
     * Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
     * 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/
     *
     */
    
    #include <errno.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/ioctl.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <string.h>
    #include <linux/hdreg.h>
    #include <syslog.h>
    #include <stdarg.h>
    
    #include "atacmds.h"
    #include "scsicmds.h"
    #include "smartd.h"
    
    // CVS ID strings
    extern const char *CVSid1, *CVSid2;
    const char *CVSid3="$Id: smartd.cpp,v 1.33 2002/10/26 09:38:26 ballen4705 Exp $" 
    CVSID1 CVSID4 CVSID7;
    
    // This function prints either to stdout or to the syslog as needed
    void printout(int priority,char *fmt, ...){
      va_list ap;
      // initialize variable argument list 
      va_start(ap,fmt);
      if (debugmode) 
        vprintf(fmt,ap);
      else
        vsyslog(priority,fmt,ap);
      va_end(ap);
      return;
    }
    
    // Printing function for debugging atacmds. For debugging set 0 to 1
    // in #if statement
    void pout(char *fmt, ...){
      va_list ap;
      
      // initialize variable argument list 
      va_start(ap,fmt);
    #if (0)
      vprintf(fmt,ap);
    #endif
      va_end(ap);
      return;
    }