sensor_configuration.c: remove 'v' from ip(v)4 and ip(v)6

--- src/sensor_configuration.c
+++ src/sensor_configuration.c
@@ -137,12 +137,12 @@
             return -1;
         }
         fprintf(stderr, "parse ipv4 address %s\n", json_object_get_string(item));
-        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ipv4_address);
+        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ip4_address);
         if (rv != 1) {
             fprintf(stderr, "invalid ipv4 address %s\n", json_object_get_string(item));
             return -1;
         }
-        ss_dump_cidr(NULL, "ipv4_address", &ss_conf->ipv4_address);
+        ss_dump_cidr(NULL, "ipv4_address", &ss_conf->ip4_address);
     }
     item = json_object_object_get(items, "ipv4_gateway");
     if (item) {
@@ -151,12 +151,12 @@
             return -1;
         }
         fprintf(stderr, "parse ipv4 gateway %s\n", json_object_get_string(item));
-        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ipv4_gateway);
+        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ip4_gateway);
         if (rv != 1) {
             fprintf(stderr, "invalid ipv4 gateway %s\n", json_object_get_string(item));
             return -1;
         }
-        ss_dump_cidr(NULL, "ipv4_gateway", &ss_conf->ipv4_gateway);
+        ss_dump_cidr(NULL, "ipv4_gateway", &ss_conf->ip4_gateway);
     }
     item = json_object_object_get(items, "ipv6_address");
     if (item) {
@@ -165,12 +165,12 @@
             return -1;
         }
         fprintf(stderr, "parse ipv6 address %s\n", json_object_get_string(item));
-        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ipv6_address);
+        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ip6_address);
         if (rv != 1) {
             fprintf(stderr, "invalid ipv6 address %s\n", json_object_get_string(item));
             return -1;
         }
-        ss_dump_cidr(NULL, "ipv6_address", &ss_conf->ipv6_address);
+        ss_dump_cidr(NULL, "ipv6_address", &ss_conf->ip6_address);
     }
     item = json_object_object_get(items, "ipv6_gateway");
     if (item) {
@@ -179,12 +179,12 @@
             return -1;
         }
         fprintf(stderr, "parse ipv6 gateway %s\n", json_object_get_string(item));
-        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ipv6_gateway);
+        rv = ss_parse_cidr(json_object_get_string(item), &ss_conf->ip6_gateway);
         if (rv != 1) {
             fprintf(stderr, "invalid ipv6 gateway %s\n", json_object_get_string(item));
             return -1;
         }
-        ss_dump_cidr(NULL, "ipv6_gateway", &ss_conf->ipv6_gateway);
+        ss_dump_cidr(NULL, "ipv6_gateway", &ss_conf->ip6_gateway);
     }
     return 0;
 }


Missing accessLevel->read for dataSourceVariables in NS0 setup (#1080)

* ns0: missing accessLevel read for dataSourceVariables; new static addDataSourceVariableNode procedure

* replaced all leading tabs by 4 blanks

--- src/server/ua_server_ns0.c
+++ src/server/ua_server_ns0.c
@@ -266,6 +266,21 @@
     UA_Server_addVariableNode(server, UA_NODEID_NUMERIC(0, nodeid), UA_NODEID_NUMERIC(0, parentid),
                               UA_NODEID_NUMERIC(0, referenceid), UA_QUALIFIEDNAME(0, name),
                               UA_NODEID_NUMERIC(0, type_id), attr, NULL, NULL);
+}
+
+static void
+addDataSourceVariableNode(UA_Server *server, UA_UInt32 nodeid, char* name, UA_Int32 valueRank,
+                const UA_NodeId *dataType, UA_DataSource *dataSource, UA_UInt32 parentid,
+                UA_UInt32 referenceid, UA_UInt32 type_id) {
+    UA_VariableAttributes attr;
+    UA_VariableAttributes_init(&attr);
+    attr.displayName = UA_LOCALIZEDTEXT("en_US", name);
+    attr.dataType = *dataType;
+    attr.valueRank = valueRank;
+    attr.accessLevel = UA_ACCESSLEVELMASK_READ;
+    UA_Server_addDataSourceVariableNode(server, UA_NODEID_NUMERIC(0, nodeid), UA_NODEID_NUMERIC(0, parentid),
+                                        UA_NODEID_NUMERIC(0, referenceid), UA_QUALIFIEDNAME(0, name),
+                                        UA_NODEID_NUMERIC(0, type_id), attr, *dataSource, NULL);
 }

 /**********************/
@@ -639,50 +654,29 @@
                              UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
                              UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERDIAGNOSTICSTYPE), NULL);

-    // TODO: Begin Serverstatus
-    UA_VariableAttributes serverstatus_attr;
-    UA_VariableAttributes_init(&serverstatus_attr);
-    serverstatus_attr.displayName = UA_LOCALIZEDTEXT("en_US", "ServerStatus");
-    serverstatus_attr.valueRank = -1;
-    serverstatus_attr.dataType = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVERSTATUSDATATYPE);
-    UA_Server_addVariableNode_begin(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
-                                    UA_QUALIFIEDNAME(0, "ServerStatus"), serverstatus_attr, NULL);
     UA_DataSource statusDS = {
         server, //handle
         readStatus, //read
         NULL //write
     };
-    UA_Server_setVariableNode_dataSource(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
-                                         statusDS);
-    UA_Server_addNode_finish(server, UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER),
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE), NULL);
+    addDataSourceVariableNode(server, UA_NS0ID_SERVER_SERVERSTATUS, "ServerStatus", -1,
+                              &UA_TYPES[UA_TYPES_SERVERSTATUSDATATYPE].typeId, &statusDS,
+                              UA_NS0ID_SERVER, UA_NS0ID_HASCOMPONENT, UA_NS0ID_BASEDATAVARIABLETYPE);

     UA_Variant_setScalar(&var, &server->startTime, &UA_TYPES[UA_TYPES_DATETIME]);
     addVariableNode(server, UA_NS0ID_SERVER_SERVERSTATUS_STARTTIME, "StartTime", -1,
                     &UA_TYPES[UA_TYPES_DATETIME].typeId, &var, UA_NS0ID_SERVER_SERVERSTATUS,
                     UA_NS0ID_HASCOMPONENT, UA_NS0ID_BASEDATAVARIABLETYPE);

-    /* TODO: UTC Time Type */
-    const UA_NodeId currentTimeId = UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME);
-    UA_VariableAttributes currenttime_attr;
-    UA_VariableAttributes_init(&currenttime_attr);
-    currenttime_attr.displayName = UA_LOCALIZEDTEXT("en_US", "CurrentTime");
-    currenttime_attr.valueRank = -1;
-    currenttime_attr.dataType = UA_TYPES[UA_TYPES_DATETIME].typeId;
-    UA_Server_addVariableNode_begin(server, currentTimeId, UA_QUALIFIEDNAME(0, "CurrentTime"),
-                                    currenttime_attr, NULL);
     UA_DataSource currentDS = {
         NULL, //handle
         readCurrentTime, //read
         NULL //write
     };
-    UA_Server_setVariableNode_dataSource(server, currentTimeId, currentDS);
-    UA_Server_addNode_finish(server, currentTimeId,
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_SERVER_SERVERSTATUS),
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_HASCOMPONENT),
-                             UA_NODEID_NUMERIC(0, UA_NS0ID_BASEDATAVARIABLETYPE), NULL);
+    addDataSourceVariableNode(server, UA_NS0ID_SERVER_SERVERSTATUS_CURRENTTIME, "CurrentTime", -1,
+                              &UA_TYPES[UA_TYPES_DATETIME].typeId, &currentDS,
+                              UA_NS0ID_SERVER_SERVERSTATUS, UA_NS0ID_HASCOMPONENT,
+                              UA_NS0ID_BASEDATAVARIABLETYPE);

     UA_ServerState state = UA_SERVERSTATE_RUNNING;
     UA_Variant_setScalar(&var, &state, &UA_TYPES[UA_TYPES_SERVERSTATE]);


android/tester: Execute socket cbacks in main loop

Execute socket test's callbacks in tester's main loop.

--- android/android-tester.c
+++ android/android-tester.c
@@ -2782,9 +2782,11 @@
 }
 /* Test Socket HAL */

-static void adapter_socket_state_changed_cb(bt_state_t state)
-{
-	switch (state) {
+static gboolean adapter_socket_state_changed(gpointer user_data)
+{
+	struct bt_cb_data *cb_data = user_data;
+
+	switch (cb_data->state) {
 	case BT_STATE_ON:
 		setup_powered_emulated_remote();
 		break;
@@ -2794,6 +2796,19 @@
 	default:
 		break;
 	}
+
+	g_free(cb_data);
+
+	return FALSE;
+}
+
+static void adapter_socket_state_changed_cb(bt_state_t state)
+{
+	struct bt_cb_data *cb_data = g_new0(struct bt_cb_data, 1);
+
+	cb_data->state = state;
+
+	g_idle_add(adapter_socket_state_changed, cb_data);
 }

 const bt_bdaddr_t bdaddr_dummy = {


fix crf_get_crlno and make CRLNumber mandatory

--- proto/myssl.c
+++ proto/myssl.c
@@ -1293,8 +1293,9 @@
     int *stap,
     int *crlstap)
 {
-    unsigned char *ptr;
-    int len;
+    ASN1_INTEGER *crlno_a1 = (ASN1_INTEGER *)exts;
+    BIGNUM *crlno_bn;
+    char *ptr;
     char *dptr;

     if (stap == NULL)
@@ -1304,24 +1305,35 @@
         *stap = ERR_SCM_INVALARG;
         return;
     }
-    if (meth->i2d == NULL)
-    {
-        *stap = ERR_SCM_BADEXT;
+
+    crlno_bn = ASN1_INTEGER_to_BN(crlno_a1, NULL);
+    if (crlno_bn == NULL)
+    {
+        *stap = ERR_SCM_BIGNUMERR;
         return;
     }
-    len = meth->i2d(exts, &ptr);
-    if (ptr == NULL || len <= 0)
-    {
-        *stap = ERR_SCM_BADEXT;
+
+    ptr = BN_bn2hex(crlno_bn);
+    if (ptr == NULL)
+    {
+        BN_free(crlno_bn);
+        *stap = ERR_SCM_BIGNUMERR;
         return;
     }
-    dptr = hexify(len, ptr, HEXIFY_HAT);
-    OPENSSL_free(ptr);
+    BN_free(crlno_bn);
+
+    dptr = malloc(2 + strlen(ptr) + 1);
     if (dptr == NULL)
     {
+        OPENSSL_free(ptr);
         *stap = ERR_SCM_NOMEM;
         return;
     }
+
+    snprintf(dptr, 2 + strlen(ptr) + 1, "^x%s", ptr);
+
+    OPENSSL_free(ptr);
+
     cf->fields[CRF_FIELD_SN] = dptr;
 }

@@ -1366,7 +1378,7 @@
 }

 static crfx_validator crxvalidators[] = {
-    {crf_get_crlno, CRF_FIELD_SN, NID_crl_number, 0},
+    {crf_get_crlno, CRF_FIELD_SN, NID_crl_number, 1},
     {crf_get_aki, CRF_FIELD_AKI, NID_authority_key_identifier, 1}
 };


Add top-right neighbor into candidate list

This commit allows the codec to check the top-right neighbor block
when available for reference motion vector candidates.

Change-Id: I94c19bdb5e2cb8c1f58bd39a3001873fcc55b08c

--- av1/common/mvref_common.c
+++ av1/common/mvref_common.c
@@ -169,6 +169,42 @@
   }  // Analyze a single 8x8 block motion information.
 }

+static int has_top_right(const MACROBLOCKD *xd,
+                         int mi_row, int mi_col, int bs) {
+  int is_second_rect = 0;
+  int has_tr = !((mi_row & bs) & (bs * 2 - 1)) ||
+               !((mi_col & bs) & (bs * 2 - 1));
+
+  // Filter out partial right-most boundaries
+  if ((mi_col & bs) & (bs * 2 - 1)) {
+    if (((mi_col & (2 * bs)) & (bs * 4 - 1)) &&
+        ((mi_row & (2 * bs)) & (bs * 4 - 1)))
+      has_tr = 0;
+  }
+
+  if (has_tr)
+    if (((mi_col + xd->n8_w) & 0x07) == 0)
+      if ((mi_row & 0x07) > 0)
+        has_tr = 0;
+
+  if (xd->n8_w < xd->n8_h) {
+    if (mi_col & (xd->n8_h - 1))
+      is_second_rect = 1;
+
+    if (!is_second_rect)
+      has_tr = 1;
+  }
+
+  if (xd->n8_w > xd->n8_h) {
+    if (mi_row & (xd->n8_w - 1))
+      is_second_rect = 1;
+
+    if (is_second_rect)
+      has_tr = 0;
+  }
+  return has_tr;
+}
+
 static void setup_ref_mv_list(const AV1_COMMON *cm, const MACROBLOCKD *xd,
                               MV_REFERENCE_FRAME ref_frame,
                               uint8_t *refmv_count,
@@ -177,9 +213,10 @@
                               int block, int mi_row, int mi_col,
                               uint8_t *mode_context) {
   int idx, nearest_refmv_count = 0;
-
   CANDIDATE_MV tmp_mv;
   int len, nr_len;
+  const int bs = AOMMAX(xd->n8_w, xd->n8_h);
+  const int has_tr = has_top_right(xd, mi_row, mi_col, bs);

   (void) mode_context;

@@ -191,6 +228,11 @@
   // Scan the first left column mode info.
   scan_col_mbmi(cm, xd, mi_row, mi_col, block, ref_frame,
                 -1, ref_mv_stack, refmv_count);
+
+  // Check top-right boundary
+  if (has_tr)
+    scan_blk_mbmi(cm, xd, mi_row, mi_col, block, ref_frame,
+                  -1, 1, ref_mv_stack, refmv_count);

   nearest_refmv_count = *refmv_count;


xfreerdp: fixed NULL windows destroying.

--- client/X11/xf_window.c
+++ client/X11/xf_window.c
@@ -612,6 +612,9 @@

 void xf_DestroyWindow(xfInfo* xfi, xfWindow* window)
 {
+	if (window == NULL)
+		return;
+
 	if (window->gc)
 		XFreeGC(xfi->display, window->gc);


vp9: Update to scene/content change detection.

Update some parameters and put check on frame size change.
For 1 pass VBR mode, speed >= 5.

Change-Id: If24ed94a21e705ea57d40b9bf235ad079db786fc

--- vp9/encoder/vp9_ratectrl.c
+++ vp9/encoder/vp9_ratectrl.c
@@ -2017,14 +2017,16 @@
   VP9_COMMON * const cm = &cpi->common;
   RATE_CONTROL *const rc = &cpi->rc;
   rc->high_source_sad = 0;
-  if (cpi->Last_Source != NULL) {
+  if (cpi->Last_Source != NULL &&
+      cpi->Last_Source->y_width == cm->width &&
+      cpi->Last_Source->y_height == cm->height) {
     const uint8_t *src_y = cpi->Source->y_buffer;
     const int src_ystride = cpi->Source->y_stride;
     const uint8_t *last_src_y = cpi->Last_Source->y_buffer;
     const int last_src_ystride = cpi->Last_Source->y_stride;
     int sbi_row, sbi_col;
     const BLOCK_SIZE bsize = BLOCK_64X64;
-    const uint32_t min_thresh = 4000;
+    uint32_t min_thresh = 4000;
     float thresh = 8.0f;
     // Loop over sub-sample of frame, and compute average sad over 64x64 blocks.
     uint64_t avg_sad = 0;
@@ -2057,7 +2059,8 @@
     // for cases where there is small change from content that is completely
     // static.
     if (cpi->oxcf.rc_mode == VPX_VBR) {
-      thresh = 2.5f;
+      min_thresh = 20000;
+      thresh = 2.0f;
     }
     if (avg_sad >
         VPXMAX(min_thresh, (unsigned int)(rc->avg_source_sad  * thresh)) &&
@@ -2065,7 +2068,8 @@
       rc->high_source_sad = 1;
     else
       rc->high_source_sad = 0;
-    rc->avg_source_sad = (rc->avg_source_sad + avg_sad) >> 1;
+    if (avg_sad > 0)
+      rc->avg_source_sad = (rc->avg_source_sad + avg_sad) >> 1;
     // For VBR, under scene change/high content change, force golden refresh.
     if (cpi->oxcf.rc_mode == VPX_VBR &&
         rc->high_source_sad &&


- remove max/min defines, no longer needed for Zero

--- BLEAttribute.h
+++ BLEAttribute.h
@@ -1,13 +1,5 @@
 #ifndef _BLE_ATTRIBUTE_H_
 #define _BLE_ATTRIBUTE_H_
-
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif

 enum BLEAttributeType {
   BLETypeService        = 0x2800,


New functionality added to ThreadSafeHashMap, operator= and setters of the internal map.

--- wallet/ThreadSafeHashMap.h
+++ wallet/ThreadSafeHashMap.h
@@ -12,7 +12,7 @@
 public:
     ThreadSafeHashMap();
     ThreadSafeHashMap(const ThreadSafeHashMap<K,V>& rhs);
-//    ThreadSafeHashMap<K,V>& operator=(const ThreadSafeHashMap<K,V>& rhs);
+    ThreadSafeHashMap<K,V>& operator=(const ThreadSafeHashMap<K,V>& rhs);
     std::size_t erase(const K &key);
     void set(const K &key, const V &value);
     bool exists(const K &key) const;
@@ -20,6 +20,8 @@
     friend inline bool operator==(const ThreadSafeHashMap<K_,V_>& lhs, const ThreadSafeHashMap<K_,V_>& rhs);
     bool get(const K &key, V &value) const;
     void clear();
+    boost::unordered_map<K,V> getInternalMap() const;
+    void setInternalMap(const boost::unordered_map<K,V>& TheMap);
 };

 template<typename K, typename V>
@@ -31,14 +33,14 @@
 }

-//template<typename K, typename V>
-//ThreadSafeHashMap<K,V> &ThreadSafeHashMap<K,V>::operator=(const ThreadSafeHashMap<K, V> &rhs)
-//{
-//    boost::unique_lock<boost::shared_mutex> lock1(mtx);
-//    boost::shared_lock<boost::shared_mutex> lock2(rhs.mtx);
-//    this->theMap = rhs.theMap;
-//    return this;
-//}
+template<typename K, typename V>
+ThreadSafeHashMap<K,V> &ThreadSafeHashMap<K,V>::operator=(const ThreadSafeHashMap<K, V> &rhs)
+{
+    boost::unique_lock<boost::shared_mutex> lock1(mtx);
+    boost::shared_lock<boost::shared_mutex> lock2(rhs.mtx);
+    this->theMap = rhs.theMap;
+    return *this;
+}

 template<typename K_, typename V_>
 bool operator==(const ThreadSafeHashMap<K_, V_> &lhs, const ThreadSafeHashMap<K_, V_> &rhs)
@@ -97,4 +99,20 @@
     return theMap.erase(key);
 }

+
+template<typename K, typename V>
+boost::unordered_map<K, V> ThreadSafeHashMap<K,V>::getInternalMap() const
+{
+    boost::unique_lock<boost::shared_mutex> lock(mtx);
+    boost::unordered_map<K, V> safeCopy = theMap;
+    return safeCopy;
+}
+
+template<typename K, typename V>
+void ThreadSafeHashMap<K,V>::setInternalMap(const boost::unordered_map<K, V> &TheMap)
+{
+    boost::unique_lock<boost::shared_mutex> lock(mtx);
+    theMap = TheMap;
+}
+
 #endif // THREADSAFEHASHMAP_H


In my previous commit, I dropped the command from the help text. Fixed.

git-svn-id: bb0627f6f70d46b61088c62c6186faa4b96a9496@8359 91ce42f0-d328-0410-95d8-f526ca767f89

--- bacula/src/dird/ua_cmds.c
+++ bacula/src/dird/ua_cmds.c
@@ -111,7 +111,7 @@

 struct cmdstruct { const char *key; int (*func)(UAContext *ua, const char *cmd); const char *help; const bool use_in_rs;};
 static struct cmdstruct commands[] = {                                      /* Can use it in Console RunScript*/
- { NT_("add"),        add_cmd,         _("[pool=<pool-name> storage=<storage> jobid=<JobId>] -- add media to a pool"),                      false},
+ { NT_("add"),        add_cmd,         _("add [pool=<pool-name> storage=<storage> jobid=<JobId>] -- add media to a pool"),                      false},
  { NT_("autodisplay"), autodisplay_cmd, _("autodisplay [on|off] -- console messages"),false},
  { NT_("automount"),   automount_cmd,  _("automount [on|off] -- after label"),        false},
  { NT_("cancel"),     cancel_cmd,    _("cancel [jobid=<number> job=<job-name> ujobid=<unique-jobid>] -- cancel a job"), false},
@@ -129,7 +129,7 @@
  { NT_("memory"),     memory_cmd,    _("print current memory usage"),                 true},
  { NT_("messages"),   messagescmd,   _("messages"),                                   false},
  { NT_("mount"),      mount_cmd,     _("mount storage=<storage-name> [ slot=<num> ] [ drive=<num> ] or mount [ jobid=<id> | job=<job-name> ]"),                       false},
- { NT_("prune"),      prunecmd,      _("files|jobs|volume client=<client-name> volume=<volume-name> prune expired records from catalog"),         true},
+ { NT_("prune"),      prunecmd,      _("prune files|jobs|volume client=<client-name> volume=<volume-name> prune expired records from catalog"),         true},
  { NT_("purge"),      purgecmd,      _("purge records from catalog"),                 true},
  { NT_("python"),     python_cmd,    _("python control commands"),                    false},
  { NT_("quit"),       quit_cmd,      _("quit"),                                       false},


fix debug locks

fix debug locks

git-svn-id: 2c9807fa3ff65b17195bd55dc8a6c4261e10127b@1030 d4fa192b-c00b-0410-8231-f00ffab90ce4

--- bin/varnishd/cache.h
+++ bin/varnishd/cache.h
@@ -445,6 +445,9 @@
 #define LOCK(foo)		AZ(pthread_mutex_lock(foo))
 #define UNLOCK(foo)		AZ(pthread_mutex_unlock(foo))
 #else
+#define MTX			pthread_mutex_t
+#define MTX_INIT(foo)		AZ(pthread_mutex_init(foo, NULL))
+#define MTX_DESTROY(foo)	AZ(pthread_mutex_destroy(foo))
 #define LOCK(foo) 					\
 do { 							\
 	if (pthread_mutex_trylock(foo)) {		\
@@ -452,17 +455,18 @@
 		    "MTX_CONTEST(%s,%s,%d," #foo ")",	\
 		    __func__, __FILE__, __LINE__);	\
 		AZ(pthread_mutex_lock(foo)); 		\
-	} else {					\
+	} else if (1) {					\
 		VSL(SLT_Debug, 0,			\
-		    "MTX_LOCK(%s,%s,%d," #foo ")",		\
+		    "MTX_LOCK(%s,%s,%d," #foo ")",	\
 		    __func__, __FILE__, __LINE__); 	\
 	}						\
 } while (0);
 #define UNLOCK(foo)					\
 do {							\
 	AZ(pthread_mutex_unlock(foo));			\
-	VSL(SLT_Debug, 0,				\
-	    "MTX_UNLOCK(%s,%s,%d," #foo ")",		\
-	    __func__, __FILE__, __LINE__);		\
+	if (1)						\
+		VSL(SLT_Debug, 0,			\
+		    "MTX_UNLOCK(%s,%s,%d," #foo ")",	\
+		    __func__, __FILE__, __LINE__);	\
 } while (0);
 #endif


rcar_gen3: plat: Drop ddr_regdef_len()

rcar_gen3: plat: Drop ddr_regdef_len()

This function is unused and triggers clang error, drop it.

Signed-off-by: Marek Vasut <bcf2901fa1b128a7a3f88ee031c46807a29aa29d@gmail.com>

--- drivers/staging/renesas/rcar/ddr/ddr_b/boot_init_dram.c
+++ drivers/staging/renesas/rcar/ddr/ddr_b/boot_init_dram.c
@@ -647,11 +647,6 @@
 	return DDR_REGDEF_LSB(pDDR_REGDEF_TBL[_regdef]);
 }

-static inline uint32_t ddr_regdef_len(uint32_t _regdef)
-{
-	return DDR_REGDEF_LEN(pDDR_REGDEF_TBL[_regdef]);
-}
-
 static void ddr_setval_s(uint32_t ch, uint32_t slice, uint32_t _regdef,
 			 uint32_t val)
 {


Add a warning for recursive emit_event

Add a warning for recursive emit_event

When event delivery is invoked by synthetic events through
clutter_do_event from inside an event handler clutter was silently
ignoring it, this warning will hopefully help resolving some issues.

--- clutter/clutter-main.c
+++ clutter/clutter-main.c
@@ -1748,7 +1748,10 @@

   /* reentrancy check */
   if (lock != FALSE)
-    return;
+    {
+      g_warning ("Tried emitting event during event delivery, bailing out.n");
+      return;
+    }

   lock = TRUE;


staging: unisys: use msecs_to_jiffies for conversions

This is only an API consolidation to make things more readable.
Instances of  var * HZ / 1000  are replaced by  msecs_to_jiffies(var).

Signed-off-by: Nicholas Mc Guire <04c1189a665e35eb7dd53274dd18ee0ba50218b3@hofr.at>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -1594,7 +1594,7 @@
 static unsigned long
 parahotplug_next_expiration(void)
 {
-	return jiffies + PARAHOTPLUG_TIMEOUT_MS * HZ / 1000;
+	return jiffies + msecs_to_jiffies(PARAHOTPLUG_TIMEOUT_MS);
 }

 /*


OMAPDSS: lb035q02: use devm_kzalloc for allocating driver data

Use devm_kzalloc instead of kzalloc to allocate driver data for the lg phillips
panel driver. This simplifies the driver's probe and remove functions.

Cc: Steve Sakoman <9ce5770b3bb4b2a1d59be2d97e34379cd192299f@sakoman.com>
Signed-off-by: Archit Taneja <49f60fff7e48ce8acf4d32f930e8060f85030a2d@ti.com>

--- drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
+++ drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
@@ -89,27 +89,21 @@
 static int lb035q02_panel_probe(struct omap_dss_device *dssdev)
 {
 	struct lb035q02_data *ld;
-	int r;

 	dssdev->panel.timings = lb035q02_timings;

-	ld = kzalloc(sizeof(*ld), GFP_KERNEL);
-	if (!ld) {
-		r = -ENOMEM;
-		goto err;
-	}
+	ld = devm_kzalloc(&dssdev->dev, sizeof(*ld), GFP_KERNEL);
+	if (!ld)
+		return -ENOMEM;
+
 	mutex_init(&ld->lock);
 	dev_set_drvdata(&dssdev->dev, ld);
-	return 0;
-err:
-	return r;
+
+	return 0;
 }

 static void lb035q02_panel_remove(struct omap_dss_device *dssdev)
 {
-	struct lb035q02_data *ld = dev_get_drvdata(&dssdev->dev);
-
-	kfree(ld);
 }

 static int lb035q02_panel_enable(struct omap_dss_device *dssdev)


Comment out unnecessary use of gvio.h

Comment out unnecessary use of gvio.h

--- cmd/gvedit/csettings.h
+++ cmd/gvedit/csettings.h
@@ -12,7 +12,7 @@
 #endif

 #include "gvc.h"
-#include "gvio.h"
+/* #include "gvio.h" */

 class CFrmSettings : public QDialog


Fix include for mongoc-write-concern-private.h

--- src/MongoDB/WriteConcern.c
+++ src/MongoDB/WriteConcern.c
@@ -27,7 +27,7 @@
 /* External libs */
 #include <bson.h>
 #include <mongoc.h>
-#include "mongoc-write-concern-private.h"
+#include <mongoc-write-concern-private.h>

 /* PHP Core stuff */
 #include <php.h>


bme280_mqtt: change loop to use mqtt_reconnect(); init/tear-down outside of loop

--- bme280/bme280_mqtt.c
+++ bme280/bme280_mqtt.c
@@ -17,7 +17,7 @@
 extern int initGatherData();
 extern int gatherData (struct config *config, struct data *data);

-int publishToMqtt (struct config *config, struct data *data);
+int publishToMqtt (struct mosquitto *mosq, struct data *data);
 static void printHelp(void);

 volatile int keepRunning=1;
@@ -33,6 +33,8 @@

 int main(int argc, char **argv)
 {
+  int rc;
+
   // handling Crl-C
   struct sigaction act;

@@ -42,8 +44,8 @@
   struct config config;
   int c;						// for getopt

-  // network communication
-  struct hostent *he_broker;
+  // mqtt
+  struct mosquitto *mosq;

   // data gathering
   struct data data;
@@ -82,7 +84,7 @@
   // read config file
   config_init(&cfg);
   /* Read the file. If there is an error, report it and exit. */
-  if(! config_read_file(&cfg, configFilePath))
+  if (!config_read_file(&cfg, configFilePath))
   {
     fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg));
     config_destroy(&cfg);
@@ -113,66 +115,73 @@
 printf ("broker: %s\n", config.pBrokerName);
 printf ("i2c bus: %s\n", config.pi2cBus);

-  if (!(he_broker = gethostbyname(config.pBrokerName)))
+  initGatherData();
+
+  mosquitto_lib_init();
+  mosq = mosquitto_new(config.pNodeName, true, NULL);
+  if (!mosq)
   {
-    fprintf(stderr, "Could not resolve broker name, err %d.\n", h_errno);
-    config_destroy(&cfg);
-    return EXIT_FAILURE;
+    printf("mosquitto handler could not be allocated! error %d (%s)\n", errno, strerror(errno));
+    rc = errno;
+  }
+  else
+  {
+    rc = mosquitto_connect(mosq, config.pBrokerName, 1883, 60);
+    if (rc)
+    {
+      printf("Client could not connect to broker '%s'! Error Code: %d (%s)\n", config.pBrokerName, rc, mosquitto_strerror(rc));
+    }
   }

-  initGatherData();
-
-  while (keepRunning)
+  while (keepRunning && !rc)
   {
     if (!(gatherData(&config, &data)))
     {
-      fprintf(stderr, "Could not gather data.\n");
-      config_destroy(&cfg);
-      return EXIT_FAILURE;
+      fprintf(stderr, "could not gather data. Sleeping...\n");
     }

-    if (!(publishToMqtt (&config, &data)))
+    if (publishToMqtt (mosq, &data))
     {
-      fprintf(stderr, "publishing failed.\n");
-      config_destroy(&cfg);
-      return EXIT_FAILURE;
+      fprintf(stderr, "publishing failed. Sleeping...\n");
     }

     sleep(60);
   }

   printf ("Closing down.\n");
-  config_destroy(&cfg);
-  return EX_OK;
+  if (mosq) mosquitto_disconnect(mosq);
+  if (mosq) mosquitto_destroy(mosq);
+  mosquitto_lib_cleanup();
+  if (&cfg) config_destroy(&cfg);
+  if (!rc)
+    return EXIT_SUCCESS;
+  else
+    return EXIT_FAILURE;
 }

-int publishToMqtt (struct config *config, struct data *data)
+//int publishToMqtt (struct config *config, struct data *data)
+int publishToMqtt (struct mosquitto *mosq, struct data *data)
 {
   int rc;
-  struct mosquitto * mosq;
   char payload[128];

-  mosquitto_lib_init();
-
-  mosq = mosquitto_new(config->pNodeName, true, NULL);
-
-  rc = mosquitto_connect(mosq, config->pBrokerName, 1883, 60);
-  if(rc != 0)
+  rc = mosquitto_reconnect(mosq);
+  if (rc)
   {
-    printf("Client could not connect to broker '%s'! Error Code: %d\n", config->pBrokerName, rc);
-    mosquitto_destroy(mosq);
-    return 0;
+    printf ("Could not reconnect: error %d (%s)\n", rc, mosquitto_strerror(rc));
+  }
+  else
+  {
+    snprintf (payload, sizeof payload, "{\"temperature\": %0.2f, \"humidity\": %0.2f, \"pressure\": %0.2f, \"pressure_reduced\": %0.2f}", data->Temperature, data->Humidity, data->Pressure/100.0, data->PressureReduced/100.0);
+    printf ("topic '%s' payload '%s'\n", "Werkstatt/environment", payload);
+    rc = mosquitto_publish(mosq, NULL, "Werkstatt/environment", strlen(payload), payload, 0, false);
+    if (rc)
+    {
+      printf ("Could not publish: error %d (%s)\n", rc, mosquitto_strerror(rc));
+    }
   }

-  snprintf (payload, sizeof payload, "{\"temperature\": %0.2f, \"humidity\": %0.2f, \"pressure\": %0.2f, \"pressure_reduced\": %0.2f}", data->Temperature, data->Humidity, data->Pressure/100.0, data->PressureReduced/100.0);
-  printf ("topic '%s' payload '%s'\n", "Werkstatt/environment", payload);
-  mosquitto_publish(mosq, NULL, "Werkstatt/environment", strlen(payload), payload, 0, false);
-
-  mosquitto_disconnect(mosq);
-  mosquitto_destroy(mosq);
-
-  mosquitto_lib_cleanup();
-  return 1;
+  return rc;
 }


board/collis/board.c: Format with clang-format

BUG=b:236386294
BRANCH=none
TEST=none

Change-Id: I1f241a3e018fc9740f0c369b4b131ce268b768f1
Signed-off-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728173
Reviewed-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>

--- board/collis/board.c
+++ board/collis/board.c
@@ -41,7 +41,7 @@

 #include "gpio_list.h" /* Must come after other header files. */

-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)

 /* Keyboard scan setting */
 __override struct keyboard_scan_config keyscan_config = {
@@ -76,8 +76,8 @@
 	.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
 };

-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
 {
 	return &copano_kb;
 }
@@ -92,7 +92,6 @@

 static void board_init(void)
 {
-
 }
 DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);

@@ -179,8 +178,8 @@
 /*
  * TODO(b/202062363): Remove when clang is fixed.
  */
-#define THERMAL_CPU \
-	{ \
+#define THERMAL_CPU              \
+	{                        \
 		.temp_host = { \
 			[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
 			[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -207,8 +206,8 @@
 /*
  * TODO(b/202062363): Remove when clang is fixed.
  */
-#define THERMAL_INDUCTOR \
-	{ \
+#define THERMAL_INDUCTOR         \
+	{                        \
 		.temp_host = { \
 			[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
 			[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -417,23 +416,22 @@
 	}

 	gpio_set_level(ps8xxx_rst_odl, 0);
-	msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
-			   PS8815_PWR_H_RST_H_DELAY_MS));
+	msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
 	gpio_set_level(ps8xxx_rst_odl, 1);
 	msleep(PS8815_FW_INIT_DELAY_MS);

 	CPRINTS("[C%d] %s: patching ps8815 registers", port, __func__);

-	if (i2c_read8(i2c_port,
-		      PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+	if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+	    EC_SUCCESS)
 		CPRINTS("ps8815: reg 0x0f was %02x", val);

-	if (i2c_write8(i2c_port,
-		      PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+	if (i2c_write8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) ==
+	    EC_SUCCESS)
 		CPRINTS("ps8815: reg 0x0f set to 0x31");

-	if (i2c_read8(i2c_port,
-		      PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+	if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+	    EC_SUCCESS)
 		CPRINTS("ps8815: reg 0x0f now %02x", val);
 }

@@ -441,8 +439,8 @@
 {
 	ps8815_reset(USBC_PORT_C0);
 	usb_mux_hpd_update(USBC_PORT_C0, USB_PD_MUX_HPD_LVL_DEASSERTED |
-					 USB_PD_MUX_HPD_IRQ_DEASSERTED);
+						 USB_PD_MUX_HPD_IRQ_DEASSERTED);
 	ps8815_reset(USBC_PORT_C1);
 	usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
-					 USB_PD_MUX_HPD_IRQ_DEASSERTED);
-}
+						 USB_PD_MUX_HPD_IRQ_DEASSERTED);
+}


snappy: remove KB/TP control in S3

snappy: remove KB/TP control in S3

Remove all TP control because TP lose function.
Remove KB control because this action of disable KB in S3 work
after modify 'SENSOR_ACTIVE_S0' to 'SENSOR_ACTIVE_S0_S3'.

BUG=chrome-os-partner:61618
BRANCH=reef
TEST=check TP don't lose function after resume, then KB disable in
tablet mode and enable normal mode whether S0 or S3.

Change-Id: I9fd11ecb453a193dc692b5f6160a2f2ef23b8afc
Signed-off-by: Bruce.Wan <a898a81068da7266439365c3bd380deb6a0a895f@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/430592
Commit-Ready: Bruce Wan <a898a81068da7266439365c3bd380deb6a0a895f@quantatw.com>
Tested-by: Bruce Wan <a898a81068da7266439365c3bd380deb6a0a895f@quantatw.com>
Reviewed-by: Aaron Durbin <af0622ab041e8b0f8e5819838dcc93898196e71f@chromium.org>

--- board/snappy/board.c
+++ board/snappy/board.c
@@ -679,17 +679,6 @@
 	if (tablet_get_mode() || chipset_in_state(CHIPSET_STATE_ANY_OFF))
 		enable = 0;
 	keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
-
-	/*
-	 * In S3 state, then disable KB/TP function
-	 * when state switch to tablet mode from normal mode.
-	 * Enable KB/TP function when state switch to nromal
-	 * mode from tablet mode.
-	 */
-	if (chipset_in_state(CHIPSET_STATE_SUSPEND)) {
-		keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
-		gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, !enable);
-	}
 }
 #endif


Remove unnecessary include from udf dev library.

Change-Id: I8bdc9474d817bf63a0908a0c8e4e7f754b4e0b33
Reviewed-on: http://gerrit.ent.cloudera.com:8080/3331
Reviewed-by: Nong Li <99a5e5f8f5911755b88e0b536d46aafa102bed41@cloudera.com>
Tested-by: jenkins

--- be/src/udf/udf-internal.h
+++ be/src/udf/udf-internal.h
@@ -21,7 +21,9 @@
 #include <string>
 #include <string.h>
 #include <vector>
-#include "runtime/decimal-value.h"
+
+// Be very careful when adding Impala includes in this file. We don't want to pull
+// in unnecessary dependencies for the development libs.
 #include "udf/udf.h"

 namespace impala {


Fix wrong usage of CollectionC by the benchmark.

--- bench/bench-collectionc.c
+++ bench/bench-collectionc.c
@@ -122,7 +122,7 @@
 {
   const unsigned long pa = (uintptr_t) key1;
   const unsigned long pb = (uintptr_t) key2;
-  return pa == pb;
+  return (pa < pb) ? -1 : pa > pb;
 }

 static void
@@ -164,7 +164,7 @@
 {
   const char_array_t *pa = (const char_array_t *)a;
   const char_array_t *pb = (const char_array_t *)b;
-  return strcmp(*pa,*pb)==0;
+  return strcmp(*pa,*pb);
 }

 static size_t char_hash(const void *a, int l, uint32_t seed)
@@ -189,9 +189,14 @@
   stat = hashtable_new_conf(&htc, &dict);
   if (stat != CC_OK) abort();

+  char_array_t **tab = malloc (sizeof(char_array_t *)*2*n);
+  if (!tab) abort();
+  size_t cpt = 0;
   for (size_t i = 0; i < n; i++) {
     char_array_t *key = malloc (sizeof (char_array_t));
     char_array_t *value = malloc (sizeof (char_array_t));
+    tab[cpt++] = key;
+    tab[cpt++] = value;
     sprintf(*key, "%u", rand_get());
     sprintf(*value, "%u", rand_get());
     stat = hashtable_add(dict, key, value );
@@ -209,6 +214,9 @@
   }
   g_result = s;
   hashtable_destroy(dict);
+  if (cpt != 2*n) abort();
+  for(size_t i = 0; i < 2*n;i++)
+    free(tab[i]);
 }

 /********************************************************************************************/


std::vector std::deque bounds check

std::vector std::deque bounds check

error: pathspec 'code/container_index.h' did not match any file(s) known to git

--- code/container_index.h
+++ code/container_index.h
@@ -0,0 +1,69 @@
+/*
+   container_index.h
+
+   if BOUNDS_CHECK is defined,
+   check index bound
+*/
+
+#ifndef CONTAINER_INDEX
+#define CONTAINER_INDEX
+
+#include <cassert>
+#include <vector>
+#include <deque>
+
+namespace jw
+{
+	template <typename T>
+	class vector: public std::vector<T>
+	{
+	public:
+		// type
+		typedef std::vector<T>		_Base;
+		typedef typename _Base::size_type	size_type;
+
+		T& operator[](size_type __n)
+		{
+#ifdef BOUNDS_CHECK
+			assert( __n < _Base::size() );
+#endif
+			return _Base::operator[](__n);
+		}
+
+		const T& operator[](size_type __n) const
+		{
+#ifdef BOUNDS_CHECK
+			assert( __n < _Base::size() );
+#endif
+			return _Base::operator[](__n);
+		}
+	};
+
+	template <typename T>
+	class deque: public std::deque<T>
+	{
+	public:
+		// type
+		typedef std::deque<T>		_Base;
+		typedef typename _Base::size_type	size_type;
+
+		T& operator[](size_type __n)
+		{
+#ifdef BOUNDS_CHECK
+			assert( __n < _Base::size() );
+#endif
+			return _Base::operator[](__n);
+		}
+
+		const T& operator[](size_type __n) const
+		{
+#ifdef BOUNDS_CHECK
+			assert( __n < _Base::size() );
+#endif
+			return _Base::operator[](__n);
+		}
+	};
+}
+
+#endif
+


i#1306 Dr. Heapstat -replace_malloc, part 3:

Remove requirement that malloc iteration be done only from a client non-app
context as it is safe from an app context.

SVN-Revision: 1483

--- common/alloc_replace.c
+++ common/alloc_replace.c
@@ -470,16 +470,6 @@
      */
     zero_stack(ZERO_APP_STACK_SZ);
 }
-
-#ifdef DEBUG
-static bool
-on_app_stack(void)
-{
-    reg_t xsp, xbp;
-    get_stack_registers(&xsp, &xbp);
-    return !dr_memory_is_dr_internal((byte *)xsp);
-}
-#endif

 /* i#900: we need to mark an app lock acquisition as a safe spot.
  * This is made possible by drwrap_replace_native() using a continuation
@@ -2027,8 +2017,9 @@
     return true;
 }

-/* We assume this is called from a client context and thus we can grab
- * DR locks.  We try to check for this via !on_app_stack().
+/* This will end up grabbing DR locks (iterator_lock()) but that's fine even
+ * in an app context, as it's not while we're marked safe-to-suspend and
+ * it's only in our own code.
  */
 static void
 alloc_iterate(malloc_iter_cb_t cb, void *iter_data, bool only_live)
@@ -2043,14 +2034,6 @@
     alloc_iter_data_t data = {only_live, cb, iter_data};
     uint i;
     malloc_info_t info;
-
-    /* The aborting case is dr_exit_process() on OOM.
-     * The nudge thread case is a nudge leak scan, where the nudge thread's stack
-     * is not marked as DR memory (i#1215).
-     */
-    ASSERT(!on_app_stack() ||
-           IF_WINDOWS(dr_is_nudge_thread(dr_get_current_drcontext()) ||)
-           aborting, "should be called from client context");

     LOG(2, "%s\n", __FUNCTION__);


knf. even old ttys need love.

knf. even old ttys need love.

--- compat/common/tty_43.c
+++ compat/common/tty_43.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: tty_43.c,v 1.10 2010/07/26 01:56:27 guenther Exp $	*/
+/*	$OpenBSD: tty_43.c,v 1.11 2013/04/09 02:56:50 tedu Exp $	*/
 /*	$NetBSD: tty_43.c,v 1.5 1996/05/20 14:29:17 mark Exp $	*/

 /*-
@@ -87,19 +87,14 @@

 /*ARGSUSED*/
 int
-ttcompat(tp, com, data, flag, p)
-	register struct tty *tp;
-	u_long com;
-	caddr_t data;
-	int flag;
-	struct proc *p;
+ttcompat(struct tty *tp, u_long com, caddr_t data, int flag, struct proc *p)
 {

 	switch (com) {
 	case TIOCGETP: {
-		register struct sgttyb *sg = (struct sgttyb *)data;
-		register u_char *cc = tp->t_cc;
-		register int speed;
+		struct sgttyb *sg = (struct sgttyb *)data;
+		u_char *cc = tp->t_cc;
+		int speed;

 		speed = ttspeedtab(tp->t_ospeed, compatspeeds);
 		sg->sg_ospeed = (speed == -1) ? MAX_SPEED : speed;
@@ -117,7 +112,7 @@

 	case TIOCSETP:
 	case TIOCSETN: {
-		register struct sgttyb *sg = (struct sgttyb *)data;
+		struct sgttyb *sg = (struct sgttyb *)data;
 		struct termios term;
 		int speed;

@@ -132,15 +127,16 @@
 			term.c_ospeed = compatspcodes[speed];
 		term.c_cc[VERASE] = sg->sg_erase;
 		term.c_cc[VKILL] = sg->sg_kill;
-		tp->t_flags = (ttcompatgetflags(tp)&0xffff0000) | (sg->sg_flags&0xffff);
+		tp->t_flags = (ttcompatgetflags(tp) & 0xffff0000) |
+		    (sg->sg_flags & 0xffff);
 		ttcompatsetflags(tp, &term);
 		return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA,
-			(caddr_t)&term, flag, p));
+		    (caddr_t)&term, flag, p));
 	}

 	case TIOCGETC: {
 		struct tchars *tc = (struct tchars *)data;
-		register u_char *cc = tp->t_cc;
+		u_char *cc = tp->t_cc;

 		tc->t_intrc = cc[VINTR];
 		tc->t_quitc = cc[VQUIT];
@@ -152,7 +148,7 @@
 	}
 	case TIOCSETC: {
 		struct tchars *tc = (struct tchars *)data;
-		register u_char *cc = tp->t_cc;
+		u_char *cc = tp->t_cc;

 		cc[VINTR] = tc->t_intrc;
 		cc[VQUIT] = tc->t_quitc;
@@ -166,7 +162,7 @@
 	}
 	case TIOCSLTC: {
 		struct ltchars *ltc = (struct ltchars *)data;
-		register u_char *cc = tp->t_cc;
+		u_char *cc = tp->t_cc;

 		cc[VSUSP] = ltc->t_suspc;
 		cc[VDSUSP] = ltc->t_dsuspc;
@@ -178,7 +174,7 @@
 	}
 	case TIOCGLTC: {
 		struct ltchars *ltc = (struct ltchars *)data;
-		register u_char *cc = tp->t_cc;
+		u_char *cc = tp->t_cc;

 		ltc->t_suspc = cc[VSUSP];
 		ltc->t_dsuspc = cc[VDSUSP];
@@ -198,20 +194,20 @@
 		flags = ttcompatgetflags(tp);
 		switch (com) {
 		case TIOCLSET:
-			tp->t_flags = (flags&0xffff) | (*(int *)data<<16);
+			tp->t_flags = (flags & 0xffff) | (*(int *)data << 16);
 			break;
 		case TIOCLBIS:
-			tp->t_flags = flags | (*(int *)data<<16);
+			tp->t_flags = flags | (*(int *)data << 16);
 			break;
 		case TIOCLBIC:
-			tp->t_flags = flags & ~(*(int *)data<<16);
+			tp->t_flags = flags & ~(*(int *)data << 16);
 			break;
 		}
 		ttcompatsetlflags(tp, &term);
 		return (ttioctl(tp, TIOCSETA, (caddr_t)&term, flag, p));
 	}
 	case TIOCLGET:
-		*(int *)data = ttcompatgetflags(tp)>>16;
+		*(int *)data = ttcompatgetflags(tp) >> 16;
 		if (ttydebug)
 			printf("CLGET: returning %x\n", *(int *)data);
 		break;
@@ -224,10 +220,8 @@
 		int ldisczero = 0;

 		return (ttioctl(tp, TIOCSETD,
-			*(int *)data == 2 ? (caddr_t)&ldisczero : data, flag,
-			p));
-	    }
-
+		    *(int *)data == 2 ? (caddr_t)&ldisczero : data, flag, p));
+	}
 	case OTIOCCONS:
 		*(int *)data = 1;
 		return (ttioctl(tp, TIOCCONS, data, flag, p));
@@ -238,12 +232,12 @@

 	case TIOCGSID:
 		if (tp->t_session == NULL)
-			return ENOTTY;
+			return (ENOTTY);

 		if (tp->t_session->s_leader == NULL)
-			return ENOTTY;
-
-		*(int *) data =  tp->t_session->s_leader->ps_pid;
+			return (ENOTTY);
+
+		*(int *)data = tp->t_session->s_leader->ps_pid;
 		break;

 	default:
@@ -253,14 +247,13 @@
 }

 int
-ttcompatgetflags(tp)
-	register struct tty *tp;
+ttcompatgetflags(struct tty *tp)
 {
-	register tcflag_t iflag = tp->t_iflag;
-	register tcflag_t lflag = tp->t_lflag;
-	register tcflag_t oflag = tp->t_oflag;
-	register tcflag_t cflag = tp->t_cflag;
-	register int flags = 0;
+	tcflag_t iflag = tp->t_iflag;
+	tcflag_t lflag = tp->t_lflag;
+	tcflag_t oflag = tp->t_oflag;
+	tcflag_t cflag = tp->t_cflag;
+	int flags = 0;

 	if (ISSET(iflag, IXOFF))
 		SET(flags, TANDEM);
@@ -319,15 +312,13 @@
 }

 void
-ttcompatsetflags(tp, t)
-	register struct tty *tp;
-	register struct termios *t;
+ttcompatsetflags(struct tty *tp, struct termios *t)
 {
-	register int flags = tp->t_flags;
-	register tcflag_t iflag = t->c_iflag;
-	register tcflag_t oflag = t->c_oflag;
-	register tcflag_t lflag = t->c_lflag;
-	register tcflag_t cflag = t->c_cflag;
+	int flags = tp->t_flags;
+	tcflag_t iflag = t->c_iflag;
+	tcflag_t oflag = t->c_oflag;
+	tcflag_t lflag = t->c_lflag;
+	tcflag_t cflag = t->c_cflag;

 	if (ISSET(flags, TANDEM))
 		SET(iflag, IXOFF);
@@ -358,7 +349,6 @@
 		CLR(oflag, OLCUC);
 		CLR(cflag, XCASE);
 	}
-

 	if (ISSET(flags, RAW)) {
 		iflag &= IXOFF|IXANY;
@@ -419,15 +409,13 @@
 }

 void
-ttcompatsetlflags(tp, t)
-	register struct tty *tp;
-	register struct termios *t;
+ttcompatsetlflags(struct tty *tp, struct termios *t)
 {
-	register int flags = tp->t_flags;
-	register tcflag_t iflag = t->c_iflag;
-	register tcflag_t oflag = t->c_oflag;
-	register tcflag_t lflag = t->c_lflag;
-	register tcflag_t cflag = t->c_cflag;
+	int flags = tp->t_flags;
+	tcflag_t iflag = t->c_iflag;
+	tcflag_t oflag = t->c_oflag;
+	tcflag_t lflag = t->c_lflag;
+	tcflag_t cflag = t->c_cflag;

 	/* Nothing we can do with CRTBS. */
 	if (ISSET(flags, PRTERA))
@@ -494,5 +482,4 @@
 	t->c_lflag = lflag;
 	t->c_cflag = cflag;
 }
-
 #endif /* COMPAT_OLDTTY */


Fix swapped pointers in strncpy

Fix swapped pointers in strncpy

--- src/OVAL/probes/oval_fts.c
+++ src/OVAL/probes/oval_fts.c
@@ -107,7 +107,7 @@
 		ofts_ent->path_len = pathlen_from_ftse(fts_ent->fts_pathlen, fts_ent->fts_namelen) - shift;
 		if (ofts_ent->path_len > 0) {
 			ofts_ent->path = malloc(ofts_ent->path_len + 1);
-			strncpy(ofts_ent->path + shift, fts_ent->fts_path, ofts_ent->path_len);
+			strncpy(ofts_ent->path, fts_ent->fts_path + shift, ofts_ent->path_len);
 			ofts_ent->path[ofts_ent->path_len] = '\0';
 		} else {
 			ofts_ent->path_len = 1;


fixed wSetWay

fixed wSetWay

--- CacheSim.c
+++ CacheSim.c
@@ -86,22 +86,25 @@

 int buildCache(){
-	Cache.setIndexFieldLength = setIndexLength();
-	Cache.blockOffsetFieldLength = offsetLength();
+	//Cache.setIndexFieldLength = setIndexLength();
+	//Cache.blockOffsetFieldLength = offsetLength();
 	Cache.tagFieldLength = (32 - Cache.setIndexFieldLength - Cache.blockOffsetFieldLength);
+
+	printf("Set Cache Values\n");

 	Cache.tagArray = (unsigned int **) malloc(Cache.kSetAss*sizeof(unsigned int*));
 	for (int i=0; i < Cache.kSetAss; i++) *(Cache.tagArray + i) = (unsigned int*) malloc(Cache.wSetWay*sizeof(unsigned int));
 	Cache.lruArray = (int **) malloc(Cache.kSetAss*sizeof(unsigned int*));
 	for (int i=0; i < Cache.kSetAss; i++) *(Cache.lruArray + i) = (unsigned int*) malloc(Cache.wSetWay*sizeof(unsigned int));

+	printf("Allocated Space for Cache\n");

 	for(int i = 0; i<Cache.kSetAss; i++){
 		for(int j = 0; j<Cache.wSetWay; j++){
 			*((int *)Cache.lruArray+(i*Cache.wSetWay)+j) = -1;
 		}
 	}
-
+	printf("Cache Built\n");
 	//intialize lru array, all values in lruArray to -1
 }

@@ -193,6 +196,27 @@
 int updateOnMissTest(){
 	return 0;
 }
+
+int printLRUArray(){
+	for(int i = 0; i<Cache.wSetWay; i++){
+		for(int j = 0; j<Cache.kSetAss; j++){
+			printf("%d\t", (*((int *)Cache.lruArray+i*Cache.kSetAss+j)));
+		}
+		printf("\n");
+	}
+	printf("lruArray Printed\n");
+	return 0;
+}
+
+int printTagArray(){
+	for(int i = 0; i<Cache.wSetWay; i++){
+		for(int j = 0; j<Cache.kSetAss; j++){
+			printf("%d\t", (*((int *)Cache.tagArray+i*Cache.kSetAss+j)));
+		}
+		printf("\n");
+	}
+	return 0;
+}

 	//argv[1] = set associativity
 	//argv[2] = line size in bytes
@@ -203,15 +227,16 @@

 	int hitRate;int k, l, c;
 	k = atoi(argv[1]); l = atoi(argv[2]); c = atoi(argv[3]);
-	Cache.kSetAss = k;Cache.lSetLength = l;Cache.cSetSizeBytes = c;Cache.wSetWay = c/(k*l);
+	Cache.kSetAss = k;Cache.lSetLength = l;Cache.cSetSizeBytes = c;Cache.wSetWay = (c*8000)/(k*l);

 	printf("Start, %d arguements: K:%d, L:%d, C:%d File: %s \n", argc, k, l, c, argv[4]);
-
+	printf("kSetAss: %d, lSetLength: %d, cSetSizeBytes: %d, wSetWay: %d\n", Cache.kSetAss, Cache.lSetLength, Cache.cSetSizeBytes, Cache.wSetWay);

 	buildCache();
+	//printLRUArray();
+
 	hitRate = readTrace(argv[4]);

-	printf("%d\n",accessLRUArray(1,1,-1));

 	printf("Done\n");
 	return 0;


Added a callback interface to be able to callback class members

error: pathspec 'Callback.h' did not match any file(s) known to git

--- Callback.h
+++ Callback.h
@@ -0,0 +1,77 @@
+#ifndef CALLBACK_
+#define CALLBACK_
+
+template <typename Ret, typename Param0>
+class Callback
+{
+  public:
+    virtual Ret invoke(Param0 param0) = 0;
+};
+
+
+
+template <typename Ret, typename Param0>
+class StaticFunctionCallback : public Callback<Ret, Param0>
+{
+  private:
+    Ret (*func_)(Param0);
+
+  public:
+    StaticFunctionCallback(Ret (*func)(Param0))
+      : func_(func)
+    {}
+
+    virtual Ret invoke(Param0 param0)
+    {
+      return (*func_)(param0);
+    }
+};
+
+
+
+template <typename Ret, typename Param0, typename T, typename Method>
+class MethodCallback : public Callback<Ret, Param0>
+{
+  private:
+    void *object_;
+    Method method_;
+
+  public:
+    MethodCallback(void *object, Method method)
+      : object_(object)
+      , method_(method)
+    {}
+
+    virtual Ret invoke(Param0 param0)
+    {
+      T *obj = static_cast<T *>(object_);
+      return (obj->*method_)(param0);
+    }
+};
+
+
+
+template <typename Ret, typename Param0>
+class Delegate
+{
+  private:
+    Callback<Ret, Param0> *callback_;
+
+  public:
+    Delegate(Ret (*func)(Param0))
+      :callback_(new StaticFunctionCallback<Ret, Param0>(func))
+    {}
+
+    template <typename T, typename Method>
+    Delegate(T *object, Method method)
+      :callback_(new MethodCallback<Ret, Param0, T, Method>(object, method))
+    {}
+
+    ~Delegate(void) { delete callback_; }
+
+    Ret operator()(Param0 param0)
+    {
+      return callback_->invoke(param0);
+    }
+};
+#endif


Improve WockyPing's debugging output.

Improve WockyPing's debugging output.

--- wocky/wocky-ping.c
+++ wocky/wocky-ping.c
@@ -84,6 +84,7 @@
       break;
     case PROP_PING_INTERVAL:
       priv->ping_interval = g_value_get_uint (value);
+      DEBUG ("updated ping interval to %u", priv->ping_interval);

       if (priv->heartbeat != NULL)
         wocky_heartbeat_source_update_interval (priv->heartbeat,
@@ -221,6 +222,7 @@
           ':', WOCKY_XMPP_NS_PING,
       ')', NULL);

+  DEBUG ("pinging");
   wocky_porter_send_iq_async (self->priv->porter, iq, NULL, NULL, NULL);
   g_object_unref (iq);
 }
@@ -228,9 +230,12 @@
 static gboolean
 ping_iq_cb (WockyPorter *porter, WockyStanza *stanza, gpointer data)
 {
+#ifdef ENABLE_DEBUG
+  const gchar *from = wocky_stanza_get_from (stanza);
+#endif
   WockyStanza *reply;

-  DEBUG ("replying to ping request");
+  DEBUG ("replying to ping from %s", from ? from : "<null>");

   reply = wocky_stanza_build_iq_result (stanza, NULL);
   wocky_porter_send (porter, reply);


ModelData exposes its materials;

ModelData exposes its materials;

--- src/api/l_data_modelData.c
+++ src/api/l_data_modelData.c
@@ -25,6 +25,25 @@
   }
 }

+static ModelMaterial* luax_checkmaterial(lua_State* L, int index, ModelData* model) {
+  switch (lua_type(L, index)) {
+    case LUA_TNUMBER: {
+      uint32_t material = lua_tointeger(L, index) - 1;
+      lovrCheck(material < model->materialCount, "Invalid material index '%d'", material + 1);
+      return &model->materials[material];
+    }
+    case LUA_TSTRING: {
+      size_t length;
+      const char* name = lua_tolstring(L, index, &length);
+      uint64_t hash = hash64(name, length);
+      uint64_t entry = map_get(&model->materialMap, hash);
+      lovrCheck(entry != MAP_NIL, "ModelData has no material named '%s'", name);
+      return &model->materials[(uint32_t) entry];
+    }
+    default: return luax_typeerror(L, index, "number or string"), NULL;
+  }
+}
+
 static int l_lovrModelDataGetBlobCount(lua_State* L) {
   ModelData* model = luax_checktype(L, 1, ModelData);
   lua_pushinteger(L, model->blobCount);
@@ -337,6 +356,51 @@
     case U32: lua_pushinteger(L, data.u32[index]); return 1;
     default: lovrThrow("Unreachable");
   }
+}
+
+static int l_lovrModelDataGetMaterialCount(lua_State* L) {
+  ModelData* model = luax_checktype(L, 1, ModelData);
+  lua_pushinteger(L, model->materialCount);
+  return 1;
+}
+
+static int l_lovrModelDataGetMaterialName(lua_State* L) {
+  ModelData* model = luax_checktype(L, 1, ModelData);
+  uint32_t index = luaL_checkinteger(L, 2) - 1;
+  lovrCheck(index < model->nodeCount, "Invalid material index '%d'", index + 1);
+  lua_pushstring(L, model->materials[index].name);
+  return 1;
+}
+
+static int l_lovrModelDataGetMaterialImage(lua_State* L) {
+  ModelData* model = luax_checktype(L, 1, ModelData);
+  ModelMaterial* material = luax_checkmaterial(L, 2, model);
+  MaterialTexture type = luax_checkenum(L, 3, MaterialTexture, "diffuse");
+  if (material->images[type] == ~0u) {
+    lua_pushnil(L);
+  } else {
+    lua_pushinteger(L, material->images[type] + 1);
+  }
+  return 1;
+}
+
+static int l_lovrModelDataGetMaterialColor(lua_State* L) {
+  ModelData* model = luax_checktype(L, 1, ModelData);
+  ModelMaterial* material = luax_checkmaterial(L, 2, model);
+  MaterialColor type = luax_checkenum(L, 3, MaterialColor, "diffuse");
+  lua_pushnumber(L, material->colors[type].r);
+  lua_pushnumber(L, material->colors[type].g);
+  lua_pushnumber(L, material->colors[type].b);
+  lua_pushnumber(L, material->colors[type].a);
+  return 4;
+}
+
+static int l_lovrModelDataGetMaterialValue(lua_State* L) {
+  ModelData* model = luax_checktype(L, 1, ModelData);
+  ModelMaterial* material = luax_checkmaterial(L, 2, model);
+  MaterialScalar type = luax_checkenum(L, 3, MaterialScalar, NULL);
+  lua_pushnumber(L, material->scalars[type]);
+  return 1;
 }

 const luaL_Reg lovrModelData[] = {
@@ -364,5 +428,10 @@
   { "getMeshVertex", l_lovrModelDataGetMeshVertex },
   { "getMeshIndex", l_lovrModelDataGetMeshIndex },
   { "getMeshIndex", l_lovrModelDataGetMeshIndex },
+  { "getMaterialCount", l_lovrModelDataGetMaterialCount },
+  { "getMaterialName", l_lovrModelDataGetMaterialName },
+  { "getMaterialImage", l_lovrModelDataGetMaterialImage },
+  { "getMaterialColor", l_lovrModelDataGetMaterialColor },
+  { "getMaterialValue", l_lovrModelDataGetMaterialValue },
   { NULL, NULL }
 };


[C] Remove unneeded return.

[C] Remove unneeded return.

--- aeron-driver/src/main/c/aeron_driver_conductor.c
+++ aeron-driver/src/main/c/aeron_driver_conductor.c
@@ -1424,7 +1424,6 @@
     malformed_command:
         AERON_FORMAT_BUFFER(error_message, "command=%d too short: length=%lu", msg_type_id, length);
         aeron_driver_conductor_error(conductor, AERON_ERROR_CODE_MALFORMED_COMMAND, "command too short", error_message);
-        return;
 }

 void aeron_driver_conductor_on_command_queue(void *clientd, volatile void *item)


bug fix

bug fix

--- src/api/src/win/api_wait.c
+++ src/api/src/win/api_wait.c
@@ -79,7 +79,7 @@
     {
         next = wait->next;

-        if (!PostQueuedCompletionStatus(wait->from, 0,
+        if (!PostQueuedCompletionStatus(wait->from->iocp, 0,
             (ULONG_PTR)&g_api_wait_notifier, (LPOVERLAPPED)wait))
         {
             //return api_error_translate(GetLastError());


working on crashes

working on crashes

git-svn-id: 68638cd4a045113044aca54b375738983316950b@1810 d3c6d0af-6456-5cbd-3218-6188ca4e956b

--- src/apps/relay/netengine.c
+++ src/apps/relay/netengine.c
@@ -386,7 +386,6 @@
 			success = 1;
 			smptr->m.sm.nd.nbh=NULL;
 		}
-
 	}

 	label_end:
@@ -394,8 +393,8 @@
 	if(!success) {
 		ioa_network_buffer_delete(e, smptr->m.sm.nd.nbh);
 		smptr->m.sm.nd.nbh=NULL;
-			IOA_CLOSE_SOCKET(smptr->m.sm.s);
-			return -1;
+		IOA_CLOSE_SOCKET(smptr->m.sm.s);
+		return -1;
 	}

 	return 0;


storage: util: steal cmd in CreateQemuImgCmdFromVol

Signed-off-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>
Reviewed-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

--- src/storage/storage_util.c
+++ src/storage/storage_util.c
@@ -1116,7 +1116,7 @@
                                          const char *inputSecretPath,
                                          virStorageVolEncryptConvertStep convertStep)
 {
-    virCommand *cmd = NULL;
+    g_autoptr(virCommand) cmd = NULL;
     struct _virStorageBackendQemuImgInfo info = {
         .format = vol->target.format,
         .type = NULL,
@@ -1246,11 +1246,10 @@
     }
     VIR_FREE(info.secretAlias);

-    return cmd;
+    return g_steal_pointer(&cmd);

  error:
     VIR_FREE(info.secretAlias);
-    virCommandFree(cmd);
     return NULL;
 }


storage: Modify storageBackendWipeLocal to allow zero from end of device

Add bool 'zero_end' and logic that would allow a caller to wipe specific
portions of a target device either from the beginning (the default) or
from the end when zero_end is true.

This will allow for this code to wipe out partition table information
from a device.

--- src/storage/storage_util.c
+++ src/storage/storage_util.c
@@ -2516,25 +2516,37 @@
 storageBackendWipeLocal(const char *path,
                         int fd,
                         unsigned long long wipe_len,
-                        size_t writebuf_length)
+                        size_t writebuf_length,
+                        bool zero_end)
 {
     int ret = -1, written = 0;
     unsigned long long remaining = 0;
+    off_t size;
     size_t write_size = 0;
     char *writebuf = NULL;

-    VIR_DEBUG("wiping start: 0 len: %llu", wipe_len);
-
     if (VIR_ALLOC_N(writebuf, writebuf_length) < 0)
         goto cleanup;

-    if (lseek(fd, 0, SEEK_SET) < 0) {
-        virReportSystemError(errno,
-                             _("Failed to seek to the start in volume "
-                               "with path '%s'"),
-                             path);
-        goto cleanup;
-    }
+    if (!zero_end) {
+        if ((size = lseek(fd, 0, SEEK_SET)) < 0) {
+            virReportSystemError(errno,
+                                 _("Failed to seek to the start in volume "
+                                   "with path '%s'"),
+                                 path);
+            goto cleanup;
+        }
+    } else {
+        if ((size = lseek(fd, -wipe_len, SEEK_END)) < 0) {
+            virReportSystemError(errno,
+                                 _("Failed to seek to %llu bytes to the end "
+                                   "in volume with path '%s'"),
+                                 wipe_len, path);
+            goto cleanup;
+        }
+    }
+
+    VIR_DEBUG("wiping start: %zd len: %llu", (ssize_t) size, wipe_len);

     remaining = wipe_len;
     while (remaining > 0) {
@@ -2573,7 +2585,8 @@
 static int
 storageBackendVolWipeLocalFile(const char *path,
                                unsigned int algorithm,
-                               unsigned long long allocation)
+                               unsigned long long allocation,
+                               bool zero_end)
 {
     int ret = -1, fd = -1;
     const char *alg_char = NULL;
@@ -2648,7 +2661,8 @@
         if (S_ISREG(st.st_mode) && st.st_blocks < (st.st_size / DEV_BSIZE)) {
             ret = storageBackendVolZeroSparseFileLocal(path, st.st_size, fd);
         } else {
-            ret = storageBackendWipeLocal(path, fd, allocation, st.st_blksize);
+            ret = storageBackendWipeLocal(path, fd, allocation, st.st_blksize,
+                                          zero_end);
         }
         if (ret < 0)
             goto cleanup;
@@ -2686,7 +2700,7 @@
         goto cleanup;

     if (storageBackendVolWipeLocalFile(target_path, algorithm,
-                                       vol->target.allocation) < 0)
+                                       vol->target.allocation, false) < 0)
         goto cleanup;

     if (virFileRemove(disk_desc, 0, 0) < 0) {
@@ -2735,7 +2749,7 @@
         ret = storageBackendVolWipePloop(vol, algorithm);
     } else {
         ret = storageBackendVolWipeLocalFile(vol->target.path, algorithm,
-                                             vol->target.allocation);
+                                             vol->target.allocation, false);
     }

     return ret;


right right

right right

--- src/store/redis/rdsstore.c
+++ src/store/redis/rdsstore.c
@@ -68,8 +68,8 @@
 #include <stdbool.h>
 #include "cmp.h"

-#define DEBUG_LEVEL NGX_LOG_WARN
-//#define DEBUG_LEVEL NGX_LOG_DEBUG
+//#define DEBUG_LEVEL NGX_LOG_WARN
+#define DEBUG_LEVEL NGX_LOG_DEBUG

 #define DBG(fmt, args...) ngx_log_error(DEBUG_LEVEL, ngx_cycle->log, 0, "REDISTORE: " fmt, ##args)
 #define ERR(fmt, args...) ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0, "REDISTORE: " fmt, ##args)


winpr/ssl: Fix capitalization in log messages

The log messages contained the `ENabled` string, which looks weird to me.
Let's change that to `enabled`.

--- winpr/libwinpr/utils/ssl.c
+++ winpr/libwinpr/utils/ssl.c
@@ -246,7 +246,7 @@
 		WLog_ERR(TAG, "Openssl fips mode not available on openssl versions less than 1.0.1!");
 		return FALSE;
 #else
-		WLog_DBG(TAG, "Ensuring openssl fips mode is ENabled");
+		WLog_DBG(TAG, "Ensuring openssl fips mode is enabled");

 #if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
 		OSSL_PROVIDER_load(NULL, "fips");
@@ -260,10 +260,10 @@
 #else
 			if (FIPS_mode_set(1))
 #endif
-				WLog_INFO(TAG, "Openssl fips mode ENabled!");
+				WLog_INFO(TAG, "Openssl fips mode enabled!");
 			else
 			{
-				WLog_ERR(TAG, "Openssl fips mode ENable failed!");
+				WLog_ERR(TAG, "Openssl fips mode enable failed!");
 				return FALSE;
 			}
 		}


add SLC Interrupt routines

add SLC Interrupt routines

--- hardware/esp8266com/esp8266/tools/sdk/include/ets_sys.h
+++ hardware/esp8266com/esp8266/tools/sdk/include/ets_sys.h
@@ -39,6 +39,7 @@

 typedef void (*int_handler_t)(void*);

+#define ETS_SLC_INUM        1
 #define ETS_SPI_INUM        2
 #define ETS_GPIO_INUM       4
 #define ETS_UART_INUM       5
@@ -53,6 +54,12 @@

 #define ETS_INTR_UNLOCK() \
     ets_intr_unlock()
+
+#define ETS_INTR_ENABLE(inum) \
+    ets_isr_unmask((1<<inum))
+
+#define ETS_INTR_DISABLE(inum) \
+    ets_isr_mask((1<<inum))

 inline uint32_t ETS_INTR_ENABLED(void)
 {
@@ -71,26 +78,35 @@
 #define ETS_CCOMPARE0_INTR_ATTACH(func, arg) \
     ets_isr_attach(ETS_CCOMPARE0_INUM, (int_handler_t)(func), (void *)(arg))

+#define ETS_CCOMPARE0_ENABLE() \
+    ETS_INTR_ENABLE(ETS_CCOMPARE0_INUM)
+
+#define ETS_CCOMPARE0_DISABLE() \
+    ETS_INTR_DISABLE(ETS_CCOMPARE0_INUM)
+
+
 #define ETS_FRC_TIMER1_INTR_ATTACH(func, arg) \
     ets_isr_attach(ETS_FRC_TIMER1_INUM, (int_handler_t)(func), (void *)(arg))
+
+#define ETS_FRC1_INTR_ENABLE() \
+    ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
+
+#define ETS_FRC1_INTR_DISABLE() \
+    ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
+

 #define ETS_GPIO_INTR_ATTACH(func, arg) \
     ets_isr_attach(ETS_GPIO_INUM, (int_handler_t)(func), (void *)(arg))

+#define ETS_GPIO_INTR_ENABLE() \
+    ETS_INTR_ENABLE(ETS_GPIO_INUM)
+
+#define ETS_GPIO_INTR_DISABLE() \
+    ETS_INTR_DISABLE(ETS_GPIO_INUM)
+
+
 #define ETS_UART_INTR_ATTACH(func, arg) \
     ets_isr_attach(ETS_UART_INUM, (int_handler_t)(func), (void *)(arg))
-
-#define ETS_SPI_INTR_ATTACH(func, arg) \
-    ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))
-
-#define ETS_INTR_ENABLE(inum) \
-    ets_isr_unmask((1<<inum))
-
-#define ETS_INTR_DISABLE(inum) \
-    ets_isr_mask((1<<inum))
-
-#define ETS_SPI_INTR_ENABLE() \
-    ETS_INTR_ENABLE(ETS_SPI_INUM)

 #define ETS_UART_INTR_ENABLE() \
     ETS_INTR_ENABLE(ETS_UART_INUM)
@@ -98,23 +114,25 @@
 #define ETS_UART_INTR_DISABLE() \
     ETS_INTR_DISABLE(ETS_UART_INUM)

-#define ETS_CCOMPARE0_ENABLE() \
-	ETS_INTR_ENABLE(ETS_CCOMPARE0_INUM)

-#define ETS_CCOMPARE0_DISABLE() \
-	ETS_INTR_DISABLE(ETS_CCOMPARE0_INUM)
+#define ETS_SPI_INTR_ATTACH(func, arg) \
+    ets_isr_attach(ETS_SPI_INUM, (int_handler_t)(func), (void *)(arg))

-#define ETS_FRC1_INTR_ENABLE() \
-	ETS_INTR_ENABLE(ETS_FRC_TIMER1_INUM)
+#define ETS_SPI_INTR_ENABLE() \
+    ETS_INTR_ENABLE(ETS_SPI_INUM)

-#define ETS_FRC1_INTR_DISABLE() \
-	ETS_INTR_DISABLE(ETS_FRC_TIMER1_INUM)
+#define ETS_SPI_INTR_DISABLE() \
+    ETS_INTR_DISABLE(ETS_SPI_INUM)

-#define ETS_GPIO_INTR_ENABLE() \
-    ETS_INTR_ENABLE(ETS_GPIO_INUM)

-#define ETS_GPIO_INTR_DISABLE() \
-    ETS_INTR_DISABLE(ETS_GPIO_INUM)
+#define ETS_SLC_INTR_ATTACH(func, arg) \
+    ets_isr_attach(ETS_SLC_INUM, (int_handler_t)(func), (void *)(arg))
+
+#define ETS_SLC_INTR_ENABLE() \
+    ETS_INTR_ENABLE(ETS_SLC_INUM)
+
+#define ETS_SLC_INTR_DISABLE() \
+    ETS_INTR_DISABLE(ETS_SLC_INUM)

 void *pvPortMalloc(size_t xWantedSize) __attribute__((malloc, alloc_size(1)));


libata-link: separate out link initialization functions

Separate out link initialization into ata_link_init() and
ata_link_init_sata_spd().

Signed-off-by: Tejun Heo <ccfba69985e72fbcd9ba8bbb6db43d42971ad06d@gmail.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/ata/libata-core.c
+++ drivers/ata/libata-core.c
@@ -6061,6 +6061,68 @@
 }

 /**
+ *	ata_link_init - Initialize an ata_link structure
+ *	@ap: ATA port link is attached to
+ *	@link: Link structure to initialize
+ *
+ *	Initialize @link.
+ *
+ *	LOCKING:
+ *	Kernel thread context (may sleep)
+ */
+static void ata_link_init(struct ata_port *ap, struct ata_link *link)
+{
+	int i;
+
+	/* clear everything except for devices */
+	memset(link, 0, offsetof(struct ata_link, device[0]));
+
+	link->ap = ap;
+	link->active_tag = ATA_TAG_POISON;
+	link->hw_sata_spd_limit = UINT_MAX;
+
+	/* can't use iterator, ap isn't initialized yet */
+	for (i = 0; i < ATA_MAX_DEVICES; i++) {
+		struct ata_device *dev = &link->device[i];
+
+		dev->link = link;
+		dev->devno = dev - link->device;
+		ata_dev_init(dev);
+	}
+}
+
+/**
+ *	sata_link_init_spd - Initialize link->sata_spd_limit
+ *	@link: Link to configure sata_spd_limit for
+ *
+ *	Initialize @link->[hw_]sata_spd_limit to the currently
+ *	configured value.
+ *
+ *	LOCKING:
+ *	Kernel thread context (may sleep).
+ *
+ *	RETURNS:
+ *	0 on success, -errno on failure.
+ */
+static int sata_link_init_spd(struct ata_link *link)
+{
+	u32 scontrol, spd;
+	int rc;
+
+	rc = sata_scr_read(link, SCR_CONTROL, &scontrol);
+	if (rc)
+		return rc;
+
+	spd = (scontrol >> 4) & 0xf;
+	if (spd)
+		link->hw_sata_spd_limit &= (1 << spd) - 1;
+
+	link->sata_spd_limit = link->hw_sata_spd_limit;
+
+	return 0;
+}
+
+/**
  *	ata_port_alloc - allocate and initialize basic ATA port resources
  *	@host: ATA host this allocated port belongs to
  *
@@ -6075,7 +6137,6 @@
 struct ata_port *ata_port_alloc(struct ata_host *host)
 {
 	struct ata_port *ap;
-	unsigned int i;

 	DPRINTK("ENTER\n");

@@ -6090,9 +6151,6 @@
 	ap->ctl = ATA_DEVCTL_OBS;
 	ap->host = host;
 	ap->dev = host->dev;
-
-	ap->link.hw_sata_spd_limit = UINT_MAX;
-	ap->link.active_tag = ATA_TAG_POISON;
 	ap->last_ctl = 0xFF;

 #if defined(ATA_VERBOSE_DEBUG)
@@ -6115,15 +6173,7 @@

 	ap->cbl = ATA_CBL_NONE;

-	ap->link.ap = ap;
-
-	/* can't use iterator, ap isn't initialized yet */
-	for (i = 0; i < ATA_MAX_DEVICES; i++) {
-		struct ata_device *dev = &ap->link.device[i];
-		dev->link = &ap->link;
-		dev->devno = i;
-		ata_dev_init(dev);
-	}
+	ata_link_init(ap, &ap->link);

 #ifdef ATA_IRQ_TRAP
 	ap->stats.unhandled_irq = 1;
@@ -6406,7 +6456,6 @@
 	for (i = 0; i < host->n_ports; i++) {
 		struct ata_port *ap = host->ports[i];
 		int irq_line;
-		u32 scontrol;
 		unsigned long xfer_mask;

 		/* set SATA cable type if still unset */
@@ -6414,12 +6463,7 @@
 			ap->cbl = ATA_CBL_SATA;

 		/* init sata_spd_limit to the current value */
-		if (sata_scr_read(&ap->link, SCR_CONTROL, &scontrol) == 0) {
-			int spd = (scontrol >> 4) & 0xf;
-			if (spd)
-				ap->link.hw_sata_spd_limit &= (1 << spd) - 1;
-		}
-		ap->link.sata_spd_limit = ap->link.hw_sata_spd_limit;
+		sata_link_init_spd(&ap->link);

 		/* report the secondary IRQ for second channel legacy */
 		irq_line = host->irq;


hello-world: Print acutal character

hello-world: Print acutal character

--- wrapper/k210/hello-world.c
+++ wrapper/k210/hello-world.c
@@ -9,10 +9,10 @@
     asm volatile(
         "li a7, 1;"
         "li a6, 0;"
-        "li a0, 97;" // just a test to see if it prints 'a'
+        "mv a0, %[character];" // just a test to see if it prints 'a'
         "ecall;"
         :
-        :
+        : [character] "r" (c)
         : "a0", "a6", "a7"
     );
 }
@@ -30,6 +30,12 @@
 uint64_t* main() {
   // point to the "Hello World!    " string
   foo = "Hello World!    ";
+
+  sbi_ecall_console_putc('H');
+  sbi_ecall_console_putc('e');
+  sbi_ecall_console_putc('l');
+  sbi_ecall_console_putc('l');
+  sbi_ecall_console_putc('o');

   // strings are actually stored in chunks of 8 characters in memory,
   // that is, here as "Hello Wo", and "rld!    " which allows us to


Add the base template of the 'StrictlyLowerMatrix' class template

error: pathspec 'blaze/math/adaptors/strictlylowermatrix/BaseTemplate.h' did not match any file(s) known to git

--- blaze/math/adaptors/strictlylowermatrix/BaseTemplate.h
+++ blaze/math/adaptors/strictlylowermatrix/BaseTemplate.h
@@ -0,0 +1,517 @@
+//=================================================================================================
+/*!
+//  \file blaze/math/adaptors/strictlylowermatrix/BaseTemplate.h
+//  \brief Header file for the implementation of the base template of the StrictlyLowerMatrix
+//
+//  Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
+//
+//  This file is part of the Blaze library. You can redistribute it and/or modify it under
+//  the terms of the New (Revised) BSD License. Redistribution and use in source and binary
+//  forms, with or without modification, are permitted provided that the following conditions
+//  are met:
+//
+//  1. Redistributions of source code must retain the above copyright notice, this list of
+//     conditions and the following disclaimer.
+//  2. Redistributions in binary form must reproduce the above copyright notice, this list
+//     of conditions and the following disclaimer in the documentation and/or other materials
+//     provided with the distribution.
+//  3. Neither the names of the Blaze development group nor the names of its contributors
+//     may be used to endorse or promote products derived from this software without specific
+//     prior written permission.
+//
+//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+//  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+//  SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+//  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+//  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+//  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+//  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+//  DAMAGE.
+*/
+//=================================================================================================
+
+#ifndef _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_BASETEMPLATE_H_
+#define _BLAZE_MATH_ADAPTORS_STRICTLYLOWERMATRIX_BASETEMPLATE_H_
+
+
+//*************************************************************************************************
+// Includes
+//*************************************************************************************************
+
+#include <blaze/math/typetraits/IsColumnMajorMatrix.h>
+#include <blaze/math/typetraits/IsDenseMatrix.h>
+
+
+namespace blaze {
+
+//=================================================================================================
+//
+//  CLASS DEFINITION
+//
+//=================================================================================================
+
+//*************************************************************************************************
+/*!\defgroup strictly_lower_matrix StrictlyLowerMatrix
+// \ingroup adaptors
+*/
+/*!\brief Matrix adapter for strictly lower triangular \f$ N \times N \f$ matrices.
+// \ingroup strictly_lower_matrix
+//
+// \section strictlylowermatrix_general General
+//
+// The StrictlyLowerMatrix class template is an adapter for existing dense and sparse matrix
+// types. It inherits the properties and the interface of the given matrix type \a MT and extends
+// it by enforcing the additional invariant that all diagonal matrix elements and all matrix
+// elements above the diagonal are 0 (strictly lower triangular matrix). The type of the adapted
+// matrix can be specified via the first template parameter:
+
+   \code
+   template< typename MT, bool SO, bool DF >
+   class StrictlyLowerMatrix;
+   \endcode
+
+//  - MT: specifies the type of the matrix to be adapted. StrictlyLowerMatrix can be used with
+//        any non-cv-qualified, non-reference, non-pointer, non-expression dense or sparse matrix
+//        type. Also, the given matrix type must have numeric element types (i.e. all integral
+//        types except \a bool, floating point and complex types). Note that the given matrix
+//        type must be either resizable (as for instance HybridMatrix or DynamicMatrix) or
+//        must be square at compile time (as for instance StaticMatrix).
+//  - SO: specifies the storage order (blaze::rowMajor, blaze::columnMajor) of the matrix. This
+//        template parameter doesn't have to be explicitly defined, but is automatically derived
+//        from the first template parameter.
+//  - DF: specifies whether the given matrix type is a dense or sparse matrix type. This template
+//        parameter doesn't have to be defined explicitly, it is automatically derived from the
+//        first template parameter. Defining the parameter explicitly may result in a compilation
+//        error!
+//
+// The following examples give an impression of several possible strictly lower triangular matrices:
+
+   \code
+   // Definition of a 3x3 row-major dense strictly lower matrix with static memory
+   blaze::StrictlyLowerMatrix< blaze::StaticMatrix<int,3UL,3UL,blaze::rowMajor> > A;
+
+   // Definition of a resizable column-major dense strictly lower matrix based on HybridMatrix
+   blaze::StrictlyLowerMatrix< blaze::HybridMatrix<float,4UL,4UL,blaze::columnMajor> B;
+
+   // Definition of a resizable row-major dense strictly lower matrix based on DynamicMatrix
+   blaze::StrictlyLowerMatrix< blaze::DynamicMatrix<double,blaze::rowMajor> > C;
+
+   // Definition of a compressed row-major single precision strictly lower matrix
+   blaze::StrictlyLowerMatrix< blaze::CompressedMatrix<float,blaze::rowMajor> > D;
+   \endcode
+
+// The storage order of a strictly lower triangular matrix is depending on the storage order of
+// the adapted matrix type \a MT. In case the adapted matrix is stored in a row-wise fashion (i.e.
+// is specified as blaze::rowMajor), the strictly lower matrix will also be a row-major matrix.
+// Otherwise if the adapted matrix is column-major (i.e. is specified as blaze::columnMajor),
+// the strictly lower matrix will also be a column-major matrix.
+//
+//
+// \n \section strictlylowermatrix_special_properties Special Properties of Strictly Lower Triangular Matrices
+//
+// A strictly lower triangular matrix is used exactly like a matrix of the underlying, adapted
+// matrix type \a MT. It also provides (nearly) the same interface as the underlying matrix type.
+// However, there are some important exceptions resulting from the strictly lower triangular
+// matrix constraint:
+//
+//  -# \ref strictlylowermatrix_square
+//  -# \ref strictlylowermatrix_strictlylower
+//  -# \ref strictlylowermatrix_initialization
+//
+// \n \subsection strictlylowermatrix_square Strictly Lower Triangular Matrices Must Always be Square!
+//
+// In case a resizable matrix is used (as for instance blaze::HybridMatrix, blaze::DynamicMatrix,
+// or blaze::CompressedMatrix), this means that the according constructors, the \c resize() and
+// the \c extend() functions only expect a single parameter, which specifies both the number of
+// rows and columns, instead of two (one for the number of rows and one for the number of columns):
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::rowMajor;
+
+   // Default constructed, default initialized, row-major 3x3 strictly lower dynamic matrix
+   StrictlyLowerMatrix< DynamicMatrix<double,rowMajor> > A( 3 );
+
+   // Resizing the matrix to 5x5
+   A.resize( 5 );
+
+   // Extending the number of rows and columns by 2, resulting in a 7x7 matrix
+   A.extend( 2 );
+   \endcode
+
+// In case a matrix with a fixed size is used (as for instance blaze::StaticMatrix), the number
+// of rows and number of columns must be specified equally:
+
+   \code
+   using blaze::StaticMatrix;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::columnMajor;
+
+   // Correct setup of a fixed size column-major 3x3 strictly lower static matrix
+   StrictlyLowerMatrix< StaticMatrix<int,3UL,3UL,columnMajor> > A;
+
+   // Compilation error: the provided matrix type is not a square matrix type
+   StrictlyLowerMatrix< StaticMatrix<int,3UL,4UL,columnMajor> > B;
+   \endcode
+//
+// \n \subsection strictlylowermatrix_strictlylower The Strictly Lower Triangular Matrix Property is Always Enforced!
+//
+// This means that it is only allowed to modify elements in the lower part of the matrix, but not
+// the elements on the diagonal or in the upper part of the matrix. Also, it is only possible to
+// to assign matrices that are strictly lower matrices themselves:
+
+   \code
+   using blaze::CompressedMatrix;
+   using blaze::DynamicMatrix;
+   using blaze::StaticMatrix;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::rowMajor;
+
+   typedef StrictlyLowerMatrix< CompressedMatrix<double,rowMajor> >  CompressedStrictlyLower;
+
+   // Default constructed, row-major 3x3 strictly lower compressed matrix
+   CompressedStrictlyLower A( 3 );
+
+   // Initializing elements via the function call operator
+   A(0,0) = 9.0;  // Throws an exception; invalid modification of diagonal element
+   A(2,0) = 2.0;  // Initialization of the lower element (2,0)
+   A(1,2) = 9.0;  // Throws an exception; invalid modification of upper element
+
+   // Inserting elements via the insert() function
+   A.insert( 1, 0, 3.0 );  // Inserting the lower element (1,0)
+   A.insert( 1, 1, 9.0 );  // Throws an exception; invalid insertion of diagonal element
+   A.insert( 0, 2, 9.0 );  // Throws an exception; invalid insertion of upper element
+
+   // Appending an element via the append() function
+   A.reserve( 2, 2 );      // Reserving enough capacity in row 2
+   A.append( 1, 1, 9.0 );  // Throws an exception; appending a diagonal element
+   A.append( 2, 1, 4.0 );  // Appending the lower element (2,1)
+
+   // Access via a non-const iterator
+   CompressedStrictlyLower::Iterator it = A.begin(2);
+   *it = 7.0;  // Modifies the lower element (2,0)
+   ++it;
+   *it = 8.0;  // Modifies the lower element (2,1)
+
+   // Erasing elements via the erase() function
+   A.erase( 0, 0 );  // Erasing the diagonal element (0,0)
+   A.erase( 2, 0 );  // Erasing the lower element (2,0)
+
+   // Construction from a strictly lower dense matrix
+   StaticMatrix<double,3UL,3UL> B(  0.0,  0.0,  0.0,
+                                    8.0,  0.0,  0.0,
+                                   -2.0, -1.0,  0.0 );
+
+   StrictlyLowerMatrix< DynamicMatrix<double,rowMajor> > C( B );  // OK
+
+   // Assignment of a general dense matrix
+   StaticMatrix<double,3UL,3UL> D(  3.0,  0.0, -2.0,
+                                    8.0,  0.0,  0.0,
+                                   -2.0, -1.0,  4.0 );
+
+   C = D;  // Throws an exception; strictly lower triangular matrix invariant would be violated!
+   \endcode
+
+// The strictly lower matrix property is also enforced for views (rows, columns, submatrices,
+// ...) on the strictly lower matrix. The following example demonstrates that modifying the
+// elements of an entire row and submatrix of a strictly lower matrix only affects the lower
+// matrix elements:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::StrictlyLowerMatrix;
+
+   // Setup of the strictly lower matrix
+   //
+   //       ( 0 0 0 0 )
+   //   A = ( 2 0 0 0 )
+   //       ( 0 3 0 0 )
+   //       ( 4 0 5 0 )
+   //
+   StrictlyLowerMatrix< DynamicMatrix<int> > A( 4 );
+   A(1,0) = 2;
+   A(2,1) = 3;
+   A(3,0) = 4;
+   A(3,2) = 5;
+
+   // Setting the lower elements in the 2nd row to 9 results in the matrix
+   //
+   //       ( 0 0 0 0 )
+   //   A = ( 2 0 0 0 )
+   //       ( 9 9 0 0 )
+   //       ( 4 0 5 0 )
+   //
+   row( A, 2 ) = 9;
+
+   // Setting the lower elements in the 1st and 2nd column to 7 results in
+   //
+   //       ( 0 0 0 0 )
+   //   A = ( 1 0 0 0 )
+   //       ( 9 7 0 0 )
+   //       ( 4 7 7 0 )
+   //
+   submatrix( A, 0, 1, 4, 2 ) = 7;
+   \endcode
+
+// The next example demonstrates the (compound) assignment to rows/columns and submatrices of
+// strictly lower matrices. Since only lower elements may be modified the matrix to be assigned
+// must be structured such that the strictly lower triangular matrix invariant of the strictly
+// lower matrix is preserved. Otherwise a \a std::invalid_argument exception is thrown:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::DynamicVector;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::rowVector;
+
+   // Setup of two default 4x4 strictly lower matrices
+   StrictlyLowerMatrix< DynamicMatrix<int> > A1( 4 ), A2( 4 );
+
+   // Setup of a 4-dimensional vector
+   //
+   //   v = ( 3 2 0 0 )
+   //
+   DynamicVector<int,rowVector> v( 4, 0 );
+   v[0] = 3;
+   v[1] = 2;
+
+   // OK: Assigning v to the 2nd row of A1 preserves the strictly lower matrix invariant
+   //
+   //        ( 0 0 0 0 )
+   //   A1 = ( 0 0 0 0 )
+   //        ( 3 2 0 0 )
+   //        ( 0 0 0 0 )
+   //
+   row( A1, 2 ) = v;  // OK
+
+   // Error: Assigning v to the 1st row of A1 violates the strictly lower matrix invariant! The
+   //   element marked with X cannot be assigned and triggers an exception.
+   //
+   //        ( 0 0 0 0 )
+   //   A1 = ( 3 X 0 0 )
+   //        ( 3 2 0 0 )
+   //        ( 0 0 0 0 )
+   //
+   row( A1, 1 ) = v;  // Assignment throws an exception!
+
+   // Setup of the 3x2 dynamic matrix
+   //
+   //       ( 0 0 )
+   //   B = ( 7 0 )
+   //       ( 8 9 )
+   //
+   DynamicMatrix<int> B( 3UL, 2UL, 0 );
+   B(1,0) = 7;
+   B(2,0) = 8;
+   B(2,1) = 9;
+
+   // OK: Assigning B to a submatrix of A2 such that the invariant can be preserved
+   //
+   //        ( 0 0 0 0 )
+   //   A2 = ( 0 0 0 0 )
+   //        ( 0 7 0 0 )
+   //        ( 0 8 9 0 )
+   //
+   submatrix( A2, 1UL, 1UL, 3UL, 2UL ) = B;  // OK
+
+   // Error: Assigning B to a submatrix of A2 such that the lower matrix invariant cannot be
+   //   preserved! The elements marked with X cannot be assigned without violating the invariant!
+   //
+   //        ( 0 0 0 0 )
+   //   A2 = ( 0 0 0 0 )
+   //        ( 0 7 X 0 )
+   //        ( 0 8 8 X )
+   //
+   submatrix( A2, 1UL, 2UL, 3UL, 2UL ) = B;  // Assignment throws an exception!
+   \endcode
+
+// \n \subsection strictlylowermatrix_initialization The Diagonal and Upper Elements of a Dense Strictly Lower Triangular Matrix are Always Default Initialized!
+//
+// Although this results in a small loss of efficiency during the creation of a dense strictly
+// lower matrix this initialization is important since otherwise the strictly lower triangular
+// matrix property of dense strictly lower matrices would not be guaranteed:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::StrictlyLowerMatrix;
+
+   // Uninitialized, 5x5 row-major dynamic matrix
+   DynamicMatrix<int,rowMajor> A( 5, 5 );
+
+   // 5x5 row-major strictly lower dynamic matrix with default initialized diagonal and upper matrix
+   StrictlyLowerMatrix< DynamicMatrix<int,rowMajor> > B( 5 );
+   \endcode
+
+// \n \section strictlylowermatrix_arithmetic_operations Arithmetic Operations
+//
+// A StrictlyLowerMatrix matrix can participate in numerical operations in any way any other dense
+// or sparse matrix can participate. It can also be combined with any other dense or sparse vector
+// or matrix. The following code example gives an impression of the use of StrictlyLowerMatrix
+// within arithmetic operations:
+
+   \code
+   using blaze::StrictlyLowerMatrix;
+   using blaze::DynamicMatrix;
+   using blaze::HybridMatrix;
+   using blaze::StaticMatrix;
+   using blaze::CompressedMatrix;
+   using blaze::rowMajor;
+   using blaze::columnMajor;
+
+   DynamicMatrix<double,rowMajor> A( 3, 3 );
+   CompressedMatrix<double,rowMajor> B( 3, 3 );
+
+   StrictlyLowerMatrix< DynamicMatrix<double,rowMajor> > C( 3 );
+   StrictlyLowerMatrix< CompressedMatrix<double,rowMajor> > D( 3 );
+
+   StrictlyLowerMatrix< HybridMatrix<float,3UL,3UL,rowMajor> > E;
+   StrictlyLowerMatrix< StaticMatrix<float,3UL,3UL,columnMajor> > F;
+
+   E = A + B;   // Matrix addition and assignment to a row-major strictly lower matrix
+   F = C - D;   // Matrix subtraction and assignment to a column-major strictly lower matrix
+   F = A * D;   // Matrix multiplication between a dense and a sparse matrix
+
+   C *= 2.0;      // In-place scaling of matrix C
+   E  = 2.0 * B;  // Scaling of matrix B
+   F  = C * 2.0;  // Scaling of matrix C
+
+   E += A - B;  // Addition assignment
+   F -= C + D;  // Subtraction assignment
+   F *= A * D;  // Multiplication assignment
+   \endcode
+
+// \n \section strictlylowermatrix_block_structured Block-Structured Strictly Lower Matrices
+//
+// It is also possible to use block-structured strictly lower matrices:
+
+   \code
+   using blaze::CompressedMatrix;
+   using blaze::StaticMatrix;
+   using blaze::StrictlyLowerMatrix;
+
+   // Definition of a 5x5 block-structured strictly lower matrix based on CompressedMatrix
+   StrictlyLowerMatrix< CompressedMatrix< StaticMatrix<int,3UL,3UL> > > A( 5 );
+   \endcode
+
+// Also in this case the strictly lower matrix invariant is enforced, i.e. it is not possible to
+// manipulate elements in the upper part of the matrix:
+
+   \code
+   const StaticMatrix<int,3UL,3UL> B( 1, -4,  5,
+                                      6,  8, -3,
+                                      2, -1,  2 )
+
+   A.insert( 4, 2, B );  // Inserting the elements (4,2)
+   A(2,4)(1,1) = -5;     // Invalid manipulation of upper matrix element; Results in an exception
+   \endcode
+
+// \n \section strictlylowermatrix_performance Performance Considerations
+//
+// The \b Blaze library tries to exploit the properties of strictly lower triangular matrices
+// whenever and wherever possible. Thus using a strictly lower triangular matrix instead of
+// a general matrix can result in a considerable performance improvement. However, there are
+// also situations when using a strictly lower matrix introduces some overhead. The following
+// examples demonstrate several common situations where strictly lower matrices can positively
+// or negatively impact performance.
+//
+// \n \subsection strictlylowermatrix_matrix_matrix_multiplication Positive Impact: Matrix/Matrix Multiplication
+//
+// When multiplying two matrices, at least one of which is strictly lower triangular, \b Blaze
+// can exploit the fact that the diagonal and the upper part of the matrix contains only default
+// elements and restrict the algorithm to the lower elements. The following example demonstrates
+// this by means of a dense matrix/dense matrix multiplication:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::rowMajor;
+   using blaze::columnMajor;
+
+   StrictlyLowerMatrix< DynamicMatrix<double,rowMajor> > A;
+   StrictlyLowerMatrix< DynamicMatrix<double,columnMajor> > B;
+   DynamicMatrix<double,columnMajor> C;
+
+   // ... Resizing and initialization
+
+   C = A * B;
+   \endcode
+
+// In comparison to a general matrix multiplication, the performance advantage is significant,
+// especially for large and medium-sized matrices. Therefore is it highly recommended to use
+// the StrictlyLowerMatrix adaptor when a matrix is known to be strictly lower triangular. Note
+// however that the performance advantage is most pronounced for dense matrices and much less
+// so for sparse matrices.
+//
+// \n \subsection strictlylowermatrix_matrix_vector_multiplication Positive Impact: Matrix/Vector Multiplication
+//
+// A similar performance improvement can be gained when using a strictly lower triangular matrix
+// in a matrix/vector multiplication:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::DynamicVector;
+   using blaze::StrictlyLowerMatrix;
+   using blaze::rowMajor;
+   using blaze::columnVector;
+
+   StrictlyLowerMatrix< DynamicMatrix<double,rowMajor> > A;
+   DynamicVector<double,columnVector> x, y;
+
+   // ... Resizing and initialization
+
+   y = A * x;
+   \endcode
+
+// In this example, \b Blaze also exploits the structure of the matrix and approx. halves the
+// runtime of the multiplication. Also in case of matrix/vector multiplications the performance
+// improvement is most pronounced for dense matrices and much less so for sparse matrices.
+//
+// \n \subsection strictlylowermatrix_assignment Negative Impact: Assignment of a General Matrix
+//
+// In contrast to using a strictly lower triangular matrix on the right-hand side of an assignment
+// (i.e. for read access), which introduces absolutely no performance penalty, using a strictly
+// lower matrix on the left-hand side of an assignment (i.e. for write access) may introduce
+// additional overhead when it is assigned a matrix, which is not strictly lower triangular at
+// compile time:
+
+   \code
+   using blaze::DynamicMatrix;
+   using blaze::StrictlyLowerMatrix;
+
+   StrictlyLowerMatrix< DynamicMatrix<double> > A, C;
+   DynamicMatrix<double> B;
+
+   B = A;  // Only read-access to the strictly lower matrix; no performance penalty
+   C = A;  // Assignment of a strictly lower matrix to another strictly lower matrix; no runtime overhead
+   C = B;  // Assignment of a general matrix to a strictly lower matrix; some runtime overhead
+   \endcode
+
+// When assigning a general, potentially not strictly lower matrix to a strictly lower matrix it
+// is necessary to check at runtime whether the general matrix is strictly lower in order to
+// guarantee the strictly lower triangular property of the strictly lower matrix. In case it
+// turns out to be strictly lower triangular, it is assigned as efficiently as possible, if it
+// is not, an exception is thrown. In order to prevent this runtime overhead it is therefore
+// generally advisable to assign strictly lower matrices to other strictly lower matrices.\n
+// In this context it is especially noteworthy that the addition, subtraction, and multiplication
+// of two strictly lower triangular matrices always results in another strictly lower matrix:
+
+   \code
+   StrictlyLowerMatrix< DynamicMatrix<double> > A, B, C;
+
+   C = A + B;  // Results in a strictly lower matrix; no runtime overhead
+   C = A - B;  // Results in a strictly lower matrix; no runtime overhead
+   C = A * B;  // Results in a strictly lower matrix; no runtime overhead
+   \endcode
+*/
+template< typename MT                               // Type of the adapted matrix
+        , bool SO = IsColumnMajorMatrix<MT>::value  // Storage order of the adapted matrix
+        , bool DF = IsDenseMatrix<MT>::value >      // Density flag
+class StrictlyLowerMatrix;
+//*************************************************************************************************
+
+} // namespace blaze
+
+#endif


docbook: fix fatal error from libata

docbook: fix fatal error from libata

'make htmldocs' has a fatal error when processing libata.xml, as seen
below.  The string "Example patterns:" (or any string with "example.*:"
in it AFAIK) causes some part of the doc generation tool chain to try to
produce an <informalexample> block without a beginning <para>, but
there is an ending </para> generated, which throws things out of kilter.

I don't even know where (what program) this is happening in.
I searched in docproc and xmlto and in some XML stylesheets without
finding anything.  If anyone can give me pointers about this, please do.
Until this is fixed, let's just spell "Example" as "Sample"
and match up the double quotation marks while there.

  Documentation/DocBook/libata.xml:6575: parser error : Opening and ending tag mismatch: programlisting line 6573 and para
     </para><para>
            ^
  Documentation/DocBook/libata.xml:6580: parser error : Opening and ending tag mismatch: para line 6575 and programlisting
  </programlisting></informalexample>
                   ^
  unable to parse Documentation/DocBook/libata.xml
  make[2]: *** [Documentation/DocBook/libata.html] Error 1

Signed-off-by: Randy Dunlap <e1d10faa7e2a0c027bf1ff1d20e7fd10154be7ea@oracle.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/ata/libata-core.c
+++ drivers/ata/libata-core.c
@@ -4281,7 +4281,7 @@
  *	The special characters ?, [, -, or *, can be matched using a set, eg. [*]
  *	Behaviour with malformed patterns is undefined, though generally reasonable.
  *
- *	Example patterns:  "SD1?",  "SD1[0-5]",  "*R0",  SD*1?[012]*xx"
+ *	Sample patterns:  "SD1?",  "SD1[0-5]",  "*R0",  "SD*1?[012]*xx"
  *
  *	This function uses one level of recursion per '*' in pattern.
  *	Since it calls _nothing_ else, and has _no_ explicit local variables,


mcu/nrf5340: Add virtual flash for BSP to use

BSP for net core that is going to be build by combine
image target needs to add vflash to its flash list.
This provides type and extern that is needed for this,
just like normal flash device.

--- hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h
+++ hw/mcu/nordic/nrf5340_net/include/mcu/nrf5340_net_hal.h
@@ -24,6 +24,8 @@
 extern "C" {
 #endif

+#include <hal/hal_flash_int.h>
+
 /* Helper functions to enable/disable interrupts. */
 #define __HAL_DISABLE_INTERRUPTS(x)                     \
     do {                                                \
@@ -46,7 +48,14 @@
 };
 const struct nrf5340_net_uart_cfg *bsp_uart_config(void);

-struct hal_flash;
+struct nrf5340_vflash {
+    struct hal_flash nv_flash;
+    const uint8_t *nv_image_address;
+    uint32_t nv_image_size;
+    const struct flash_area *nv_slot1;
+};
+extern struct nrf5340_vflash nrf5340_net_vflash_dev;
+
 extern const struct hal_flash nrf5340_net_flash_dev;

 /* SPI configuration (used for both master and slave) */


[PATCH] hpt37x: Check the enablebits

[PATCH] hpt37x: Check the enablebits

Helps for PATA but SATA bridged devices lie and always set all the bits
so will need the error handling fixes from Tejun.

Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@redhat.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/ata/pata_hpt37x.c
+++ drivers/ata/pata_hpt37x.c
@@ -25,7 +25,7 @@
 #include <linux/libata.h>

 #define DRV_NAME	"pata_hpt37x"
-#define DRV_VERSION	"0.5"
+#define DRV_VERSION	"0.5.1"

 struct hpt_clock {
 	u8	xfer_speed;
@@ -453,7 +453,13 @@
 {
 	u8 scr2, ata66;
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-
+	static const struct pci_bits hpt37x_enable_bits[] = {
+		{ 0x50, 1, 0x04, 0x04 },
+		{ 0x54, 1, 0x04, 0x04 }
+	};
+	if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
+		return -ENOENT;
+
 	pci_read_config_byte(pdev, 0x5B, &scr2);
 	pci_write_config_byte(pdev, 0x5B, scr2 & ~0x01);
 	/* Cable register now active */
@@ -488,10 +494,17 @@

 static int hpt374_pre_reset(struct ata_port *ap)
 {
+	static const struct pci_bits hpt37x_enable_bits[] = {
+		{ 0x50, 1, 0x04, 0x04 },
+		{ 0x54, 1, 0x04, 0x04 }
+	};
 	u16 mcr3, mcr6;
 	u8 ata66;
-
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+
+	if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no]))
+		return -ENOENT;
+
 	/* Do the extra channel work */
 	pci_read_config_word(pdev, 0x52, &mcr3);
 	pci_read_config_word(pdev, 0x56, &mcr6);


trunk: removed superfluous newline in FACPreconditionerStrategy.h

--- ibtk/src/solvers/interfaces/FACPreconditionerStrategy.h
+++ ibtk/src/solvers/interfaces/FACPreconditionerStrategy.h
@@ -43,6 +43,8 @@

 /////////////////////////////// CLASS DEFINITION /////////////////////////////

+namespace IBTK
+{
 /*!
  * \brief Class FACPreconditionerStrategy provides an interface for specifying
  * the problem-specific operations needed to implement a specific FAC
@@ -58,8 +60,6 @@
  *
  * \see FACPreconditioner
  */
-namespace IBTK
-{
 class FACPreconditionerStrategy
     : public virtual SAMRAI::tbox::DescribedClass
 {


NVMe: Memory barrier before queue_count is incremented

Protects against reordering and/or preempting which would allow the
kthread to access the queue descriptor before it is set up

Signed-off-by: Jon Derrick <917606af52591c5f577e1967a7cec63969a8b755@intel.com>
Acked-by: Keith Busch <695e2a2c1e39535baaa147c5eb4e5da14054d59f@intel.com>
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@fb.com>

--- drivers/block/nvme-core.c
+++ drivers/block/nvme-core.c
@@ -1453,8 +1453,11 @@
 	nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
 	nvmeq->q_depth = depth;
 	nvmeq->qid = qid;
+	dev->queues[qid] = nvmeq;
+
+	/* make sure queue descriptor is set before queue count, for kthread */
+	mb();
 	dev->queue_count++;
-	dev->queues[qid] = nvmeq;

 	return nvmeq;


Bluetooth: btbcm: Fix firmware version number calculation

The calculation for the firmware version number is off by one bit.

Signed-off-by: Marcel Holtmann <44592b4eea36663c86b994bb0ea99d15309c1c7d@holtmann.org>
Signed-off-by: Johan Hedberg <628991c7b0a19c384f9b99c21ec330ce952bb838@intel.com>


cpufreq: fix a NULL pointer dereference in __cpufreq_governor()

If ACPI _PPC changed notification happens before governor was initiated
while kernel is booting, a NULL pointer dereference will be triggered:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000030
 IP: [<ffffffff81470453>] __cpufreq_governor+0x23/0x1e0
 PGD 0
 Oops: 0000 [#1] SMP
 ... ...
 RIP: 0010:[<ffffffff81470453>]  [<ffffffff81470453>]
 __cpufreq_governor+0x23/0x1e0
 RSP: 0018:ffff881fcfbcfbb8  EFLAGS: 00010286
 RAX: 0000000000000000 RBX: ffff881fd11b3980 RCX: ffff88407fc20000
 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff881fd11b3980
 RBP: ffff881fcfbcfbd8 R08: 0000000000000000 R09: 000000000000000f
 R10: ffffffff818068d0 R11: 0000000000000043 R12: 0000000000000004
 R13: 0000000000000000 R14: ffffffff8196cae0 R15: 0000000000000000
 FS:  0000000000000000(0000) GS:ffff881fffc00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000030 CR3: 00000000018ae000 CR4: 00000000000407f0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process kworker/0:3 (pid: 750, threadinfo ffff881fcfbce000, task
 ffff881fcf556400)
 Stack:
  ffff881fffc17d00 ffff881fcfbcfc18 ffff881fd11b3980 0000000000000000
  ffff881fcfbcfc08 ffffffff81470d08 ffff881fd11b3980 0000000000000007
  ffff881fcfbcfc18 ffff881fffc17d00 ffff881fcfbcfd28 ffffffff81472e9a
 Call Trace:
  [<ffffffff81470d08>] __cpufreq_set_policy+0x1b8/0x2e0
  [<ffffffff81472e9a>] cpufreq_update_policy+0xca/0x150
  [<ffffffff81472f20>] ? cpufreq_update_policy+0x150/0x150
  [<ffffffff81324a96>] acpi_processor_ppc_has_changed+0x71/0x7b
  [<ffffffff81320bcd>] acpi_processor_notify+0x55/0x115
  [<ffffffff812f9c29>] acpi_device_notify+0x19/0x1b
  [<ffffffff813084ca>] acpi_ev_notify_dispatch+0x41/0x5f
  [<ffffffff812f64a4>] acpi_os_execute_deferred+0x27/0x34

The root cause is a race conditon -- cpufreq core and acpi-cpufreq driver
were initiated, but cpufreq_governor wasn't and _PPC changed notification
happened, __cpufreq_governor() was called within acpi_os_execute_deferred
kernel thread context.

To fix this panic issue, add pointer checking code in __cpufreq_governor()
before pointer policy->governor is to be dereferenced.

Signed-off-by: Ethan Zhao <6684312332e39abbd62c6e7a88cf7d34ce196b61@oracle.com>
Acked-by: Viresh Kumar <5ff32272b3d9f86512eddc8e0af523fc6f7924e5@linaro.org>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>

--- drivers/cpufreq/cpufreq.c
+++ drivers/cpufreq/cpufreq.c
@@ -2028,6 +2028,12 @@
 	/* Don't start any governor operations if we are entering suspend */
 	if (cpufreq_suspended)
 		return 0;
+	/*
+	 * Governor might not be initiated here if ACPI _PPC changed
+	 * notification happened, so check it.
+	 */
+	if (!policy->governor)
+		return -EINVAL;

 	if (policy->governor->max_transition_latency &&
 	    policy->cpuinfo.transition_latency >