MINOR: log: Enable the log sampling and load-balancing feature.

This patch implements the sampling and load-balancing of log servers configured
with "sample" new keyword implemented by this commit:
    'MINOR: log: Add "sample" new keyword to "log" lines'.
As the list of ranges used to sample the log to balance is ordered, we only
have to maintain ->curr_idx member of smp_info struct which is the index of
the sample and check if it belongs or not to the current range to decide if we
must send it to the log server or not.
diff --git a/include/common/hathreads.h b/include/common/hathreads.h
index 7cbb349..308bcb1 100644
--- a/include/common/hathreads.h
+++ b/include/common/hathreads.h
@@ -443,6 +443,7 @@
 	START_LOCK,
 	TLSKEYS_REF_LOCK,
 	AUTH_LOCK,
+	LOGSRV_LOCK,
 	OTHER_LOCK,
 	LOCK_LABELS
 };
@@ -559,6 +560,7 @@
 	case START_LOCK:           return "START";
 	case TLSKEYS_REF_LOCK:     return "TLSKEYS_REF";
 	case AUTH_LOCK:            return "AUTH";
+	case LOGSRV_LOCK:          return "LOGSRV";
 	case OTHER_LOCK:           return "OTHER";
 	case LOCK_LABELS:          break; /* keep compiler happy */
 	};
diff --git a/include/proto/log.h b/include/proto/log.h
index b05ab3e..7b056c5 100644
--- a/include/proto/log.h
+++ b/include/proto/log.h
@@ -54,6 +54,17 @@
 extern THREAD_LOCAL char *logline_rfc5424;
 
 
+/*
+ * Test if <idx> index numbered from 0 is in <rg> range with low and high
+ * limits of indexes numbered from 1.
+ */
+static inline int in_smp_log_range(struct smp_log_range *rg, unsigned int idx)
+{
+       if (idx + 1 <= rg->high && idx + 1 >= rg->low)
+               return 1;
+       return 0;
+}
+
 /* Initialize/Deinitialize log buffers used for syslog messages */
 int init_log_buffers();
 void deinit_log_buffers();
diff --git a/include/types/log.h b/include/types/log.h
index 9f9912a..affcd92 100644
--- a/include/types/log.h
+++ b/include/types/log.h
@@ -26,6 +26,7 @@
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <common/config.h>
+#include <common/hathreads.h>
 #include <common/mini-clist.h>
 
 #define NB_LOG_FACILITIES       24
@@ -202,6 +203,7 @@
 	int minlvl;
 	int maxlen;
 	struct logsrv *ref;
+	__decl_hathreads(HA_SPINLOCK_T lock);
 };
 
 #endif /* _TYPES_LOG_H */