tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

alsactl.h (2330B)


      1 extern int debugflag;
      2 extern int force_restore;
      3 extern int ignore_nocards;
      4 extern int do_lock;
      5 extern int use_syslog;
      6 extern char *command;
      7 extern char *statefile;
      8 extern char *lockfile;
      9 
     10 void info_(const char *fcn, long line, const char *fmt, ...);
     11 void error_(const char *fcn, long line, const char *fmt, ...);
     12 void cerror_(const char *fcn, long line, int cond, const char *fmt, ...);
     13 void dbg_(const char *fcn, long line, const char *fmt, ...);
     14 
     15 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
     16 #define info(...) do { info_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
     17 #define error(...) do { error_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
     18 #define cerror(cond, ...) do { cerror_(__FUNCTION__, __LINE__, (cond) != 0, __VA_ARGS__); } while (0)
     19 #define dbg(...) do { dbg_(__FUNCTION__, __LINE__, __VA_ARGS__); } while (0)
     20 #else
     21 #define info(args...) do { info_(__FUNCTION__, __LINE__, ##args); }  while (0)
     22 #define error(args...) do { error_(__FUNCTION__, __LINE__, ##args); }  while (0)
     23 #define cerror(cond, ...) do { error_(__FUNCTION__, __LINE__, (cond) != 0, ##args); } while (0)
     24 #define dbg(args...) do { dbg_(__FUNCTION__, __LINE__, ##args); }  while (0)
     25 #endif	
     26 
     27 int init(const char *file, const char *cardname);
     28 int state_lock(const char *file, int timeout);
     29 int state_unlock(int fd, const char *file);
     30 int save_state(const char *file, const char *cardname);
     31 int load_state(const char *file, const char *initfile, const char *cardname,
     32 	       int do_init);
     33 int power(const char *argv[], int argc);
     34 int monitor(const char *name);
     35 int state_daemon(const char *file, const char *cardname, int period,
     36 		 const char *pidfile);
     37 int state_daemon_kill(const char *pidfile, const char *cmd);
     38 
     39 /* utils */
     40 
     41 int file_map(const char *filename, char **buf, size_t *bufsize);
     42 void file_unmap(void *buf, size_t bufsize);
     43 size_t line_width(const char *buf, size_t bufsize, size_t pos);
     44 void initfailed(int cardnumber, const char *reason, int exitcode);
     45 
     46 static inline int hextodigit(int c)
     47 {
     48         if (c >= '0' && c <= '9')
     49                 c -= '0';
     50         else if (c >= 'a' && c <= 'f')
     51                 c = c - 'a' + 10;
     52         else if (c >= 'A' && c <= 'F')
     53                 c = c - 'A' + 10;
     54         else
     55                 return -1;
     56         return c;
     57 }
     58 
     59 #define ARRAY_SIZE(a) (sizeof (a) / sizeof (a)[0])