fix

fix

git-svn-id: d3d46767b8f15aa15dc28b4413db96165ce057f7@7505 140774ce-b5e7-0310-ab8b-a85725594a96

error: pathspec 'src/include/platform.h' did not match any file(s) known to git

--- src/include/platform.h
+++ src/include/platform.h
@@ -0,0 +1,94 @@
+/*
+     This file is part of libmicrohttpd
+     (C) 2008 Christian Grothoff (and other contributing authors)
+
+     This library is free software; you can redistribute it and/or
+     modify it under the terms of the GNU Lesser General Public
+     License as published by the Free Software Foundation; either
+     version 2.1 of the License, or (at your option) any later version.
+
+     This library is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     Lesser General Public License for more details.
+
+     You should have received a copy of the GNU Lesser General Public
+     License along with this library; if not, write to the Free Software
+     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+/**
+ * @file platform.h
+ * @brief platform-specific includes for libmicrohttpd
+ * @author Christian Grothoff
+ *
+ * This file is included by the libmicrohttpd code
+ * before "microhttpd.h"; it provides the required
+ * standard headers (which are platform-specific).<p>
+ *
+ * Note that this file depends on our configure.ac
+ * build process and the generated config.h file.
+ * Hence you cannot include it directly in applications
+ * that use libmicrohttpd.
+ */
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#include "config.h"
+
+#define _XOPEN_SOURCE_EXTENDED  1
+#define _OPEN_THREADS
+#define _OPEN_SYS_SOCK_IPV6
+#define _OPEN_MSGQ_EXT
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pthread.h>
+#include <sys/types.h>
+
+/* different OSes have size_t, fd_set in
+   a broad range of header files;
+   we just include most of them (if they
+   are available) */
+
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#if HAVE_SYS_MSG_H
+#include <sys/msg.h>
+#endif
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_TIME_H
+#include <time.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include "plibc.h"
+
+
+#endif


add some functional interfaces for execute module

--- self-lang/klang/exec.c
+++ self-lang/klang/exec.c
@@ -49,3 +49,125 @@

   return result;
 }
+
+static KL_StmtResult
+exec_global_stmt(KL_State* L, KL_LocalEnv* env, KL_Stmt* stmt)
+{
+  KL_IDList* id_list;
+  KL_StmtResult result;
+
+  result.type = SRT_NORMAL;
+
+  if (NULL == env) {
+    //! runtime error
+  }
+
+  for (id_list = stmt->stmt.global_s.id_list;
+      NULL != id_list; id_list = id_list->next) {
+    KL_GlobalVariableRef* ref;
+    KL_GlobalVariableRef* new_ref;
+    KL_Variable* variable;
+
+    for (ref = env->global_variable; NULL != ref; ref = ref->next) {
+      if (0 == strcmp(ref->variable->name, id_list->name))
+        goto NEXT_IDENTIFIER;
+    }
+
+    variable = KL_lookup_global_variable(L, id_list->name);
+    if (NULL == variable) {
+      //! runtime error
+    }
+
+    new_ref = (KL_GlobalVariableRef*)KL_malloc(sizeof(*new_ref));
+    new_ref->variable = variable;
+    new_ref->next = env->global_variable;
+    env->global_variable = new_ref;
+
+NEXT_IDENTIFIER:
+    {
+    }
+  }
+
+  return result;
+}
+
+static KL_StmtResult
+exec_if_stmt(KL_State* L, KL_LocalEnv* env, KL_Stmt* stmt)
+{
+  KL_StmtResult result;
+  KL_Value cond;
+
+  result.type = SRT_NORMAL;
+  cond = KL_eval_expr(L, env, stmt->stmt.if_s.cond);
+  if (VT_BOOL != cond.val_type) {
+    //! runtime error
+  }
+
+  if (cond.value.bool_val) {
+    result = KL_exec_stmt_list(L, env,
+        stmt->stmt.if_s.then_block->stmt_list);
+  }
+  else {
+    result = KL_exec_stmt_list(L, env,
+        stmt->stmt.if_s.else_block->stmt_list);
+  }
+
+  return result;
+}
+
+static KL_StmtResult
+exec_while_stmt(KL_State* L, KL_LocalEnv* env, KL_Stmt* stmt)
+{
+  KL_StmtResult result;
+  KL_Value cond;
+
+  result.type = SRT_NORMAL;
+  for (;;) {
+    cond = KL_eval_expr(L, env, stmt->stmt.while_s.cond);
+    if (VT_BOOL != cond.val_type) {
+      //! runtime error
+    }
+
+    if (!cond.value.bool_val)
+      break;
+
+    result = KL_exec_stmt_list(L, env,
+        stmt->stmt.while_s.block->stmt_list);
+
+    if (SRT_RETURN == result.type) {
+      break;
+    }
+    else if (SRT_BREAK == result.type) {
+      result.type = SRT_NORMAL;
+      break;
+    }
+  }
+
+  return result;
+}
+
+static KL_StmtResult
+exec_return_stmt(KL_State* L, KL_LocalEnv* env, KL_Stmt* stmt)
+{
+  KL_StmtResult result;
+
+  result.type = SRT_RETURN;
+  if (stmt->stmt.ret_s.ret_expr) {
+    result.stmt_result.value
+      = KL_eval_expr(L, env, stmt->stmt.ret_s.ret_expr);
+  }
+  else {
+    result.stmt_result.value.val_type = VT_NIL;
+  }
+
+  return result;
+}
+
+static KL_StmtResult
+exec_break_stmt(KL_State* L, KL_LocalEnv* env, KL_Stmt* stmt)
+{
+  KL_StmtResult result;
+  result.type = SRT_BREAK;
+
+  return result;
+}


filesystem header inclusion for g++

filesystem header inclusion for g++

--- Engine/Source/FileIO/FileSystem/Path.h
+++ Engine/Source/FileIO/FileSystem/Path.h
@@ -1,9 +1,17 @@
 #pragma once

-#include <filesystem>
+#include "Common/compiler.h"
+
 #include <string>
 #include <iostream>
 #include <cwchar>
+
+// TODO: other platforms and versions that do not need the "experimental" folder
+#if defined(PH_COMPILER_IS_MSVC)
+	#include <filesystem>
+#elif defined(PH_COMPILER_IS_GCC)
+	#include <experimental/filesystem>
+#endif

 namespace ph
 {


fix segmentation fault with pkg check -r

--- libpkg/pkg.c
+++ libpkg/pkg.c
@@ -1672,10 +1672,11 @@

 			if (regular)
 				flatsize += st.st_size;
-		}
-		if (strcmp(sum, f->sum) != 0)
-			pkgdb_file_set_cksum(db, f, sum);
-		free(sum);
+
+			if (strcmp(sum, f->sum) != 0)
+				pkgdb_file_set_cksum(db, f, sum);
+			free(sum);
+		}
 	}
 	kh_destroy_hardlinks(hl);


Changes made for PANN (changes in PVLayerLoc, now LayerLoc).

git-svn-id: 602a26e73ae9f2a14e2bb95676f2e137fcc39919@1557 7c0444ca-5550-0410-9008-faecdbe78eb5

--- src/include/pv_types.h
+++ src/include/pv_types.h
@@ -8,6 +8,7 @@
 #ifndef PV_TYPES_H_
 #define PV_TYPES_H_

+#include "LayerLoc.h"
 #include <stdlib.h>   /* for size_t */

 #define PV_ON  1
@@ -30,16 +31,6 @@
   CHANNEL_INH  = 1,
   CHANNEL_INHB = 2
 };
-
-/**
- * PVLayerLoc describes a data items location in the global layer
- */
-typedef struct PVLayerLoc_ {
-   float nx, ny;
-   float nxGlobal, nyGlobal; // total number of neurons in (x,y) across all hypercolumns
-   float nxBorder, nyBorder; // size of border region surrounding layer
-   float kx0, ky0;  // origin of the layer in index space
-} PVLayerLoc;

 typedef struct PVRect_ {
 	float x;
@@ -66,7 +57,7 @@
    int        numItems;  // number of items in data buffer
    pvdata_t * data;      // pointer to data (may follow header)
    int        padding[NUM_PADDING];   // header size should be n*128 bits
-   PVLayerLoc loc;       // location of cube in global layer
+   LayerLoc loc;       // location of cube in global layer
 } PVLayerCube;

 typedef struct PVAxonalArbor_ {


Fix the build with Lua 5.4

Fix the build with Lua 5.4

Lua 5.4 changed the API to lua_resume(). This commit changes the code to
cope with that.

Signed-off-by: Uli Schlachter <346c0ad49ac8427b61b3b55abbe37dc0ebd524f2@znc.in>

--- lgi/callable.c
+++ lgi/callable.c
@@ -1355,7 +1355,10 @@
     }
   else
     {
-#if LUA_VERSION_NUM >= 502
+#if LUA_VERSION_NUM >= 504
+      int nresults;
+      res = lua_resume (L, NULL, npos, &nresults);
+#elif LUA_VERSION_NUM >= 502
       res = lua_resume (L, NULL, npos);
 #else
       res = lua_resume (L, npos);


fix:加入原子计数器.

fix:加入原子计数器.

--- src/ez_atomic.h
+++ src/ez_atomic.h
@@ -1,25 +1,57 @@
 #ifndef EZ_CUTIL_EZ_ATOMIC_H
 #define EZ_CUTIL_EZ_ATOMIC_H

-/**
- * 如果*ptr == oldval,就将newval写入*ptr，并返回true
- */
-#define ATOM_CAS(ptr, oval, nval)         __sync_bool_compare_and_swap(ptr, oval, nval)

-#define ATOM_INC(ptr)      __sync_add_and_fetch(ptr, 1)
-#define ATOM_INC_N(ptr, n)  __sync_add_and_fetch(ptr, n)
-#define ATOM_FINC(ptr)     __sync_fetch_and_add(ptr, 1)
-#define ATOM_FINC_N(ptr, n) __sync_fetch_and_add(ptr, n)
+#if !defined(__ATOMIC_VAR_FORCE_SYNC_MACROS) && defined(__ATOMIC_RELAXED)

-#define ATOM_DEC(ptr)      __sync_sub_and_fetch(ptr, 1)
-#define ATOM_DEC_N(ptr, n)  __sync_sub_and_fetch(ptr, n)
-#define ATOM_FDEC(ptr)     __sync_fetch_and_sub(ptr, 1)
-#define ATOM_FDEC_N(ptr, n) __sync_fetch_and_sub(ptr, n)
+    #define _ATOMIC_API "atomic-builtin"

-/* Atomic BIT operator */
-#define ATOM_BIT_AND(ptr, n)  __sync_and_and_fetch(ptr, n)
-#define ATOM_BIT_FAND(ptr, n) __sync_fetch_and_and(ptr, n)
-#define ATOM_BIT_OR(ptr, n)  __sync_or_and_fetch(ptr, n)
-#define ATOM_BIT_FOR(ptr, n) __sync_fetch_and_or(ptr, n)
+    /**
+     * 如果*ptr == oldval,就将newval写入*ptr，并返回true
+     */
+    #define ATOM_CAS(ptr, oval, nval)         __atomic_compare_exchange(ptr, oval, nval, true, __ATOMIC_RELAXED, __ATOMIC_RELAXED)
+
+    #define ATOM_INC(ptr)       __atomic_add_fetch(ptr, 1, __ATOMIC_RELAXED)
+    #define ATOM_INC_N(ptr, n)  __atomic_add_fetch(ptr, n, __ATOMIC_RELAXED)
+    #define ATOM_FINC(ptr)      __atomic_fetch_add(ptr, 1, __ATOMIC_RELAXED)
+    #define ATOM_FINC_N(ptr, n) __atomic_fetch_add(ptr, n, __ATOMIC_RELAXED)
+
+
+    #define ATOM_DEC(ptr)       __atomic_sub_fetch(ptr, 1, __ATOMIC_RELAXED)
+    #define ATOM_DEC_N(ptr, n)  __atomic_sub_fetch(ptr, n, __ATOMIC_RELAXED)
+    #define ATOM_FDEC(ptr)      __atomic_fetch_sub(ptr, 1, __ATOMIC_RELAXED)
+    #define ATOM_FDEC_N(ptr, n) __atomic_fetch_sub(ptr, n, __ATOMIC_RELAXED)
+
+    /* Atomic BIT operator */
+    #define ATOM_BIT_AND(ptr, n)  __atomic_and_fetch(ptr, n, __ATOMIC_RELAXED)
+    #define ATOM_BIT_FAND(ptr, n) __atomic_fetch_and(ptr, n, __ATOMIC_RELAXED)
+    #define ATOM_BIT_OR(ptr, n)   __atomic_or_fetch(ptr,  n, __ATOMIC_RELAXED)
+    #define ATOM_BIT_FOR(ptr, n)  __atomic_fetch_or(ptr,  n, __ATOMIC_RELAXED)
+
+#else /* user gcc __sync */
+
+    #define _ATOMIC_API "sync-builtin"
+    /**
+     * 如果*ptr == oldval,就将newval写入*ptr，并返回true
+     */
+    #define ATOM_CAS(ptr, oval, nval)         __sync_bool_compare_and_swap(ptr, oval, nval)
+
+    #define ATOM_INC(ptr)      __sync_add_and_fetch(ptr, 1)
+    #define ATOM_INC_N(ptr, n)  __sync_add_and_fetch(ptr, n)
+    #define ATOM_FINC(ptr)     __sync_fetch_and_add(ptr, 1)
+    #define ATOM_FINC_N(ptr, n) __sync_fetch_and_add(ptr, n)
+
+    #define ATOM_DEC(ptr)      __sync_sub_and_fetch(ptr, 1)
+    #define ATOM_DEC_N(ptr, n)  __sync_sub_and_fetch(ptr, n)
+    #define ATOM_FDEC(ptr)     __sync_fetch_and_sub(ptr, 1)
+    #define ATOM_FDEC_N(ptr, n) __sync_fetch_and_sub(ptr, n)
+
+    /* Atomic BIT operator */
+    #define ATOM_BIT_AND(ptr, n)  __sync_and_and_fetch(ptr, n)
+    #define ATOM_BIT_FAND(ptr, n) __sync_fetch_and_and(ptr, n)
+    #define ATOM_BIT_OR(ptr, n)  __sync_or_and_fetch(ptr, n)
+    #define ATOM_BIT_FOR(ptr, n) __sync_fetch_and_or(ptr, n)
+
+#endif

 #endif //EZ_CUTIL_EZ_ATOMIC_H


Cleaned up ProcMan code

Cleaned up ProcMan code

git-svn-id: 767549f2a3626ae39d79f5348867a3ebb5082aca@3721 c7283977-0100-402a-a91a-fa70b306dbfe

--- software/network/network_sim/src/network_bridge/procman-codecs.h
+++ software/network/network_sim/src/network_bridge/procman-codecs.h
@@ -15,12 +15,17 @@
 template<typename LCMType, typename DiffType>
 struct State
 {
-    State() : need_to_send_ack_(false)
+State() : need_to_send_ack_(false),
+        has_last_full_(false),
+        has_last_diff_(false)
         { }

-    LCMType state_;
+    LCMType last_full_;
+    bool has_last_full_;
+
     bool need_to_send_ack_;
-    DiffType diff_state_;
+    DiffType last_diff_;
+    bool has_last_diff_;
     DiffType diff_waiting_ack_;
 };

@@ -61,70 +66,74 @@
             }

             wrapper.set_host(host);
-
-
-            if(Codec::host_info_.count(lcm_object.host) && Codec::host_info_[lcm_object.host].need_to_send_ack_)
+
+            State<LCMType, DiffType>& host_info = Codec::host_info_[lcm_object.host];
+
+            // send an ACK
+            if(host_info.need_to_send_ack_)
             {
                 wrapper.set_type(drc::ProcManWrapper::ACK);
-                Codec::host_info_[lcm_object.host].need_to_send_ack_ = false;
+                host_info.need_to_send_ack_ = false;
             }
             // if we have nothing to compare to, or we need to signal the other side to
             // send a full message
-            else if(!Codec::host_info_.count(lcm_object.host) || !OtherCodec::host_info_.count(lcm_object.host))
-            {
-                if(!OtherCodec::host_info_.count(lcm_object.host))
+            // send a FULL
+            else if(!host_info.has_last_full_ || !OtherCodec::host_info_[lcm_object.host].has_last_full_)
+            {
+                if(!OtherCodec::host_info_[lcm_object.host].has_last_full_)
                     wrapper.set_request_full(true);

-                Codec::host_info_[lcm_object.host].state_ = lcm_object;
+                host_info.last_full_ = lcm_object;
+                host_info.has_last_full_ = true;
+
                 wrapper.set_type(drc::ProcManWrapper::FULL);

                 wrapper.mutable_data()->resize(lcm_object.getEncodedSize());
                 lcm_object.encode(&(*wrapper.mutable_data())[0], 0, wrapper.data().size());

             }
+            // send a DIFF
             else
             {
-                glog.is(VERBOSE) && glog <<  "Checking if diff_waiting_ack_ is cleared" << std::endl;
-                if(Codec::host_info_.count(lcm_object.host) && Codec::host_info_[lcm_object.host].diff_waiting_ack_.IsInitialized())
-                {
-                    if(lcm_object.utime < Codec::host_info_[lcm_object.host].diff_waiting_ack_.utime() + Codec::host_info_[lcm_object.host].state_.utime + RESEND_SECONDS*1e6)
+                if(host_info.diff_waiting_ack_.IsInitialized())
+                {
+                    if(lcm_object.utime < host_info.diff_waiting_ack_.utime() + host_info.last_full_.utime + RESEND_SECONDS*1e6)
                     {
                         glog.is(VERBOSE) && glog << "Waiting for ACK for " << RESEND_SECONDS << " after last diff" << std::endl;
                         return false;
                     }
                     else
                     {
-                        Codec::host_info_[lcm_object.host].diff_waiting_ack_.Clear();
+                        host_info.diff_waiting_ack_.Clear();
                     }
                 }
-
+
                 wrapper.set_type(drc::ProcManWrapper::DIFF);
-                if(!make_diff(lcm_object, Codec::host_info_[lcm_object.host].state_, &Codec::host_info_[lcm_object.host].diff_waiting_ack_))
+                if(!make_diff(lcm_object, host_info.last_full_, &host_info.diff_waiting_ack_))
                     return false;
-
-                if(Codec::host_info_.count(lcm_object.host) && Codec::host_info_[lcm_object.host].diff_state_.IsInitialized())
-                {
-
-                    DiffType& diff_acked = Codec::host_info_[lcm_object.host].diff_state_;
+
+                if(host_info.has_last_diff_)
+                {
+                    DiffType& diff_acked = host_info.last_diff_;

                     // update time, since this is the only thing that is allowed to change without
                     // needing to send a new diff.
-                    diff_acked.set_utime(Codec::host_info_[lcm_object.host].diff_waiting_ack_.utime());
-
-                    glog.is(VERBOSE) && glog << "diff_waiting_ack: " << Codec::host_info_[lcm_object.host].diff_waiting_ack_.ShortDebugString() << std::endl;
+                    diff_acked.set_utime(host_info.diff_waiting_ack_.utime());
+
+                    glog.is(VERBOSE) && glog << "diff_waiting_ack: " << host_info.diff_waiting_ack_.ShortDebugString() << std::endl;
                     glog.is(VERBOSE) && glog << "diff_acked: " << diff_acked.ShortDebugString() << std::endl;
-
-                    if(diff_acked.SerializeAsString() == Codec::host_info_[lcm_object.host].diff_waiting_ack_.SerializeAsString())
+
+                    if(diff_acked.SerializeAsString() == host_info.diff_waiting_ack_.SerializeAsString())
                     {
                         glog.is(VERBOSE) && glog << "Diff is identical, so not sending" << std::endl;
-                        Codec::host_info_[lcm_object.host].diff_waiting_ack_.Clear();
+                        host_info.diff_waiting_ack_.Clear();
                         return false;
                     }

                 }

                 //diff.SerializeToString(wrapper.mutable_data());
-                dccl_->encode(wrapper.mutable_data(), Codec::host_info_[lcm_object.host].diff_waiting_ack_);
+                dccl_->encode(wrapper.mutable_data(), host_info.diff_waiting_ack_);
             }

             glog.is(VERBOSE) && glog << "ProcMan Message type is: "
@@ -145,8 +154,14 @@

             drc::ProcManWrapper wrapper;
             wrapper.ParseFromArray(&transmit_data[0], transmit_data.size());
-
+
+            glog.is(VERBOSE) && glog << "Decoding message: " << wrapper.ShortDebugString() << std::endl;
+
             LCMType lcm_object;
+
+            std::string host = drc::ProcManWrapper::Host_Name(wrapper.host());
+            boost::to_lower(host);
+            State<LCMType, DiffType>& host_info = Codec::host_info_[host];

             if(wrapper.type() == drc::ProcManWrapper::FULL)
             {
@@ -159,15 +174,14 @@
                     glog.is(VERBOSE) && glog << "Other side requested FULL message, resetting state" << std::endl;
                     OtherCodec::host_info_.erase(lcm_object.host);
                 }
-
-                Codec::host_info_[lcm_object.host].state_ = lcm_object;
-
+
+                host_info.last_full_ = lcm_object;
+                host_info.has_last_full_ = true;
+
             }
             else if(wrapper.type() == drc::ProcManWrapper::DIFF)
             {
-                std::string host = drc::ProcManWrapper::Host_Name(wrapper.host());
-                boost::to_lower(host);
-                if(!Codec::host_info_.count(host))
+                if(!host_info.has_last_full_)
                     return false;

                 DiffType diff;
@@ -175,7 +189,7 @@
                 DRCEmptyIdentifierCodec::currently_decoded_id = dccl_->id<DiffType>();
                 dccl_->decode(wrapper.data(), &diff);

-                if(!reverse_diff(&lcm_object, Codec::host_info_[host].state_, diff))
+                if(!reverse_diff(&lcm_object, host_info.last_full_, diff))
                 {
                     // assume our reference is no good, so delete it and force the other side to send a new one
                     Codec::host_info_.erase(host);
@@ -185,11 +199,17 @@
             }
             else if(wrapper.type() == drc::ProcManWrapper::ACK)
             {
-                std::string host = drc::ProcManWrapper::Host_Name(wrapper.host());
-                boost::to_lower(host);
-                OtherCodec::host_info_[host].diff_state_ = OtherCodec::host_info_[host].diff_waiting_ack_;
-                OtherCodec::host_info_[host].diff_waiting_ack_.Clear();
-                glog.is(VERBOSE) && glog << "Received ACK for last DIFF" << std::endl;
+                glog.is(VERBOSE) && glog << "Received ACK for last DIFF: " <<  OtherCodec::host_info_[host].diff_waiting_ack_.ShortDebugString() << std::endl;
+                if(OtherCodec::host_info_[host].diff_waiting_ack_.IsInitialized())
+                {
+                    OtherCodec::host_info_[host].last_diff_ = OtherCodec::host_info_[host].diff_waiting_ack_;
+                    OtherCodec::host_info_[host].has_last_diff_ = true;
+                    OtherCodec::host_info_[host].diff_waiting_ack_.Clear();
+                }
+                else
+                {
+                    glog.is(VERBOSE) && glog << "... we weren't expecting an ACK." << std::endl;
+                }
                 return false;
             }


build-export: Canonicalize file permissions

This canonicalizes the file modes for directories to 0755, and
for files to 0755 for executables or 0644 otherwise.

This means we never get files/dirs writable by non-root in the
system repo, and we never get setuid/setgid/sticky-bit, all
which could potentially be a problem if we store them in the
system repo.

See https://github.com/flatpak/flatpak/pull/837 for some discussion
about this.

--- app/flatpak-builtins-build-export.c
+++ app/flatpak-builtins-build-export.c
@@ -168,15 +168,25 @@
   g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
   g_file_info_set_attribute_uint32 (file_info, "unix::gid", 0);

+  /* In flatpak, there is no real reason for files to have different
+   * permissions based on the group or user really, everything is
+   * always used readonly for everyone. Having things be writeable
+   * for anyone but the user just causes risks for the system-installed
+   * case. So, we canonicalize the mode to writable only by the user,
+   * readable to all, and executable for all for directories and
+   * files that the user can execute.
+  */
   mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
-  /* No setuid */
-  mode = mode & ~07000;
-  /* Canonical permission mode == same as what bare-user mode uses for checkouts */
-  if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
-    mode = mode | 0744;
-  /* Always make directories readable and executable */
   if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
-    mode = mode | 0555;
+    mode = 0755 | S_IFDIR;
+  else if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
+    {
+      /* If use can execute, make executable by all */
+      if (mode & S_IXUSR)
+        mode = 0755 | S_IFREG;
+      else /* otherwise executable by none */
+        mode = 0644 | S_IFREG;
+    }
   g_file_info_set_attribute_uint32 (file_info, "unix::mode", mode);

   if (matches_patterns (commit_data->exclude, path) &&


Fix windows build (broken by r228823)

Fix windows build (broken by r228823)

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@228828 91177308-0d34-0410-b5e6-96231b3b80d8

--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.h
@@ -12,6 +12,9 @@

 // C Includes
 // C++ Includes
+#include <functional>
+#include <map>
+
 // Other libraries and framework includes
 // Project includes
 #include "lldb/lldb-private-forward.h"


Finally found the silly malloc bug...

Finally found the silly malloc bug...

--- cornebize-hamoudi/src/average.c
+++ cornebize-hamoudi/src/average.c
@@ -9,6 +9,8 @@

 #define ONLY 0
 #define TAG 0
+#define max(a,b) (a>b ? a : b)
+#define min(a,b) (a>b ? b : a)

 /* Compute in a distributed fashion one step of the delta function. */
 void compute(Process process, double **buff) {
@@ -80,7 +82,7 @@
     double content ;
     double *buffcolumns[8] ; /* buffers for messages */
     for(i=0 ; i < 8 ; i++) {
-        buffcolumns[i] = (double*) malloc(process->automata->height*sizeof(double)) ;
+        buffcolumns[i] = (double*) malloc(max(process->automata->height,process->automata->width)*sizeof(double)) ;
         assert(buffcolumns[i]) ;
     }
     MPI_Status stat;


testlib/common: fixes bug in C99 track-job setup verification function

--- tests/sixtracklib/testlib/common/track/track_job_setup.c
+++ tests/sixtracklib/testlib/common/track/track_job_setup.c
@@ -328,8 +328,8 @@
               NS(TrackJobNew_get_elem_by_elem_output_buffer_offset)( job ) ) &&
             ( ( ( ptrdiff_t )0 ) < ( ( ( intptr_t )be_mon_idx_end ) -
                 ( intptr_t )be_mon_idx_it ) ) &&
-            ( ( buf_size_t )( ( ( uintptr_t )be_mon_idx_end ) -
-                ( uintptr_t )be_mon_idx_end ) == num_beam_monitors ) );
+            ( ( buf_size_t )( be_mon_idx_end - be_mon_idx_it ) ==
+                num_beam_monitors ) );

         if( success )
         {


MAINT: fix a compiler warning in `signal/_firfilter.c`

The warning shows up with Clang 11 and up on macOS:
```
../scipy/signal/_firfilter.c:125:43: warning: absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
    int64_t k = (j >= 0) ? (j % (2*m)) : (abs(j + 1) % (2*m));
                                          ^
../scipy/signal/_firfilter.c:125:43: note: use function 'llabs' instead
    int64_t k = (j >= 0) ? (j % (2*m)) : (abs(j + 1) % (2*m));
                                          ^~~
                                          llabs
```

--- scipy/signal/_firfilter.c
+++ scipy/signal/_firfilter.c
@@ -122,7 +122,7 @@
 {
     // First map j to k in the interval [0, 2*m-1).
     // Then flip the k values that are greater than or equal to m.
-    int64_t k = (j >= 0) ? (j % (2*m)) : (abs(j + 1) % (2*m));
+    int64_t k = (j >= 0) ? (j % (2*m)) : (llabs(j + 1) % (2*m));
     return (k >= m) ? (2*m - k - 1) : k;
 }


utils: update docs, we're not using GDKmalloc

--- tools/merovingian/utils/utils.c
+++ tools/merovingian/utils/utils.c
@@ -48,7 +48,7 @@

 /**
  * Parses the given file stream matching the keys from list.  If a match
- * is found, the value is set in list->value.  Values are GDKmalloced.
+ * is found, the value is set in list->value.  Values are malloced.
  */
 void
 readConfFile(confkeyval *list, FILE *cnf) {
@@ -130,7 +130,7 @@
  * Sets the value in the given confkeyval struct to val ensuring it is
  * of the desired type.  In case of type BOOL, val is converted to "yes"
  * or "no", based on val.  If the type does not match, this function
- * returns a GDKmalloced diagnostic message, or if everything is
+ * returns a malloced diagnostic message, or if everything is
  * successful, NULL.  If val is NULL, this function always returns
  * successful and unsets the value for the given key.  Upon an error,
  * the original value for the key is left untouched.


perf test: Do not be case sensitive when searching for matching tests

Before:

  # perf test llvm
  # perf test LLVM
  35: Test LLVM searching and compiling                        : Ok
  #

After

  # perf test llvm
  35: Test LLVM searching and compiling                        : Ok
  #

Cc: Adrian Hunter <41bb5944f244750b7cf0394140496972a3f1bee3@intel.com>
Cc: David Ahern <b80c1600f604d3b0d768f26f90a76757e76005dd@gmail.com>
Cc: Jiri Olsa <2c6594f608aa3d41e98d48846a6328831f7084ad@redhat.com>
Cc: Namhyung Kim <5c915a589b3ddf58cebf14bec41bcc143b37ac3c@kernel.org>
Cc: Wang Nan <7b589a40e0ecd4816b422e8ed1f74a01c34bf6bb@huawei.com>
Link: 41b2fc9be9e90e805b51c75e686a5cf16e07238b@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/tests/builtin-test.c
+++ tools/perf/tests/builtin-test.c
@@ -196,7 +196,7 @@
 			continue;
 		}

-		if (strstr(test->desc, argv[i]))
+		if (strcasestr(test->desc, argv[i]))
 			return true;
 	}


Don't call kevent(2) with nevents == 0.

Don't call kevent(2) with nevents == 0.

If we have zero file descriptors registered, call kevent(2) with
an nevents value of one, as it will otherwise return immediately
(ignoring the specified timeout).

Signed-off-by: Lennert Buytenhek <8858498612e3a522354216649776e3032dcb7e5b@wantstofly.org>

--- src/iv_method_kqueue.c
+++ src/iv_method_kqueue.c
@@ -67,7 +67,7 @@
 static void iv_kqueue_poll(int numfds, struct list_head *active, int msec)
 {
 	struct timespec to;
-	struct kevent batch[numfds];
+	struct kevent batch[numfds ? : 1];
 	int ret;
 	int i;

@@ -75,7 +75,7 @@
 	to.tv_nsec = 1000000 * (msec % 1000);

 	ret = kevent(kqueue_fd, upload_queue, upload_entries,
-		     batch, numfds, &to);
+		     batch, numfds ? : 1, &to);
 	if (ret < 0) {
 		if (errno == EINTR)
 			return;


minor

minor

--- docs/C++May2016/HW3/EduPersons.h
+++ docs/C++May2016/HW3/EduPersons.h
@@ -4,11 +4,13 @@
 class EduPersons : public Courses, public Persons
 {
 enum kindOfPerson {student, teacher, guestTeacher} ;
+enum CourseStatus {open, close} ;

 struct CurrentCourse
 {
 	ID _personName ;
 	ID _courseName ;
+	CourseStatus _courseStatus ;
 } ;

 struct Teacher


RDMA experiment with multi-threading

RDMA experiment with multi-threading

--- experiments/lab/rdmads/ds.c
+++ experiments/lab/rdmads/ds.c
@@ -10,7 +10,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <infiniband/verbs.h>
-
+#include <sys/time.h>
 #define RDMA_WRID 3

@@ -19,9 +19,10 @@
 #define TEST_Z(x,y) do { if (!(x)) die(y); } while (0)
 #define TEST_N(x,y) do { if ((x)<0) die(y); } while (0)

-#define PAGE_SIZE (4096)
+//64MB page
 #define MAX_PAGE (16)
 #define	SVR_PORT (18515)
+#define MAX_SQE (100)

 /*
  * All clients and server has 16 pages. The client requests
@@ -29,8 +30,8 @@
  */

 const char * hlp_info = " Usage: \n \
- ds svr \n \
- ds cli <sip> 0 3 6 9 \n";
+ ds svr <pagesize> <nloop> \n \
+ ds cli <server> <pagesize> 0 3 6 9 12 ... \n";

 static int die(const char *reason){
   fprintf(stderr, "Err: %s - %s \n ", strerror(errno), reason);
@@ -47,17 +48,19 @@
 } AppCtxt;

 static AppCtxt ctxt;
-
-static void init_ctxt(){
+static int page_size = 0;
+static int nloop = 0;
+
+static void init_ctxt(int page_size){
   // STEP 1 context
-  TEST_NZ(posix_memalign(&ctxt.pages, PAGE_SIZE, PAGE_SIZE*MAX_PAGE),"could not allocate working buffer ctx->pages");
-  memset(ctxt.pages, 0, PAGE_SIZE*MAX_PAGE);
+  TEST_NZ(posix_memalign(&ctxt.pages, page_size, page_size*MAX_PAGE),"could not allocate working buffer ctx->pages");
+  memset(ctxt.pages, 0, page_size*MAX_PAGE);
   struct ibv_device **dev_list;
   TEST_Z(dev_list = ibv_get_device_list(NULL),"No IB-device available. get_device_list returned NULL");
   TEST_Z(ctxt.dev=dev_list[0],"IB-device could not be assigned. Maybe dev_list array is empty");
   TEST_Z(ctxt.context=ibv_open_device(ctxt.dev),"Could not create context, ibv_open_device");
   TEST_Z(ctxt.pd=ibv_alloc_pd(ctxt.context),"Could not allocate protection domain, ibv_alloc_pd");
-  TEST_Z(ctxt.mr=ibv_reg_mr(ctxt.pd, ctxt.pages, PAGE_SIZE*MAX_PAGE,
+  TEST_Z(ctxt.mr=ibv_reg_mr(ctxt.pd, ctxt.pages, page_size*MAX_PAGE,
          IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_LOCAL_WRITE), "Could not allocate mr, ibv_reg_mr. Do you have root access?");
 }

@@ -69,17 +72,17 @@
     char ch = 'A';
     for(i=0;i<MAX_PAGE;i++){
       printf("[%c]",ch);
-      for(j=0;j<PAGE_SIZE;j++){
-        ((char*)ctxt.pages)[i*PAGE_SIZE+j]=ch;
+      for(j=0;j<page_size;j++){
+        ((char*)ctxt.pages)[i*page_size+j]=ch;
       }
       ch ++;
     }
     printf("\n");
     for(i=0;i<MAX_PAGE;i++)
-      printf("[%c]",((char*)ctxt.pages)[i*PAGE_SIZE]);
+      printf("[%c]",((char*)ctxt.pages)[i*page_size]);
     printf("\n");
   }else{
-    memset(ctxt.pages,'Z',MAX_PAGE*PAGE_SIZE);
+    memset(ctxt.pages,'Z',MAX_PAGE*page_size);
   }
 }

@@ -169,7 +172,7 @@
   memset(attr, 0, sizeof *attr);

   attr->qp_state = IBV_QPS_RTS;
-  attr->timeout = 14;
+  attr->timeout = 20;
   attr->retry_cnt = 7;
   attr->rnr_retry = 7;
   attr->sq_psn = ibcon->l_psn;
@@ -197,7 +200,8 @@
   Request req;
   Response res;
   res.err_code = 0;
-
+struct timeval tv1,tv2,tv3;
+gettimeofday(&tv1,NULL);
   // STEP 1 - setup connection
   Connection ibcon = {
     .scq = NULL,
@@ -208,13 +212,13 @@
   };
   TEST_Z(ibcon.ch=ibv_create_comp_channel(ctxt.context),"Could not create completion channel, ibv_create_comp_channel");
   TEST_Z(ibcon.rcq=ibv_create_cq(ctxt.context,1,NULL,NULL,0),"Could not create receive completion queue, ibv_create_cq");
-  TEST_Z(ibcon.scq=ibv_create_cq(ctxt.context,100,&ibcon,ibcon.ch,0),"Could not create send completion queue, ibv_create_cq");
+  TEST_Z(ibcon.scq=ibv_create_cq(ctxt.context,MAX_SQE,&ibcon,ibcon.ch,0),"Could not create send completion queue, ibv_create_cq");
   struct ibv_qp_init_attr qp_init_attr = {
     .send_cq = ibcon.scq,
     .recv_cq = ibcon.rcq,
     .qp_type = IBV_QPT_RC,
     .cap = {
-      .max_send_wr = 100,
+      .max_send_wr = MAX_SQE,
       .max_recv_wr = 1,
       .max_send_sge = MAX_PAGE,
       .max_recv_sge = 1,
@@ -228,7 +232,6 @@
   ibcon.l_lid = attr.lid;
   ibcon.l_qpn = ibcon.qp->qp_num;
   ibcon.l_psn = lrand48() & 0xffffff;
-printf("l_psn=%d\n",ibcon.l_psn);
   ibcon.l_rkey = ctxt.mr->rkey;
   ibcon.l_vaddr = (uintptr_t)ctxt.pages;
   char msg[sizeof "0000:000000:000000:00000000:0000000000000000"];
@@ -250,25 +253,17 @@
   print_ib_con(&ibcon);
   //change to RTS
   qp_change_state_rts(ibcon.qp,&ibcon);
-
-/////////////////////////////////////////////////////
-// use completion queue
-  TEST_NZ(ibv_req_notify_cq(ibcon.scq,0),"Could not request notify from sending completion queue, ibv_req_notify_cq");
-/////////////////////////////////////////////////////
-
   // read command: a fixed-length byte array: byte[MAX_PAGE]
   recv(connfd,(void*)&req.page_flags,MAX_PAGE,MSG_WAITALL);
-  int i=0;
+  struct ibv_sge *sge_list = malloc(sizeof(struct ibv_sge)*MAX_PAGE);
+  int i;
   //RDMA write
-  struct ibv_sge *sge_list = malloc(sizeof(struct ibv_sge)*MAX_PAGE);
-  for(;i<MAX_PAGE;i++){
+  for(i=0;i<MAX_PAGE;i++){
     if(req.page_flags[i]==255)break;
-    printf("%d ",req.page_flags[i]);
-    (sge_list+i)->addr = (uintptr_t)ctxt.pages+PAGE_SIZE*req.page_flags[i];
-    (sge_list+i)->length = PAGE_SIZE;
+    (sge_list+i)->addr = (uintptr_t)ctxt.pages+page_size*req.page_flags[i];
+    (sge_list+i)->length = page_size;
     (sge_list+i)->lkey = ctxt.mr->lkey;
   }
-  printf("\n");
   struct ibv_send_wr wr;
   wr.wr.rdma.remote_addr = ibcon.r_vaddr;
   wr.wr.rdma.rkey = ibcon.r_rkey;
@@ -279,30 +274,58 @@
   wr.send_flags = IBV_SEND_SIGNALED;
   wr.next = NULL;
   struct ibv_send_wr *bad_wr;
-  TEST_NZ(ibv_post_send(ibcon.qp,&wr,&bad_wr),"ibv_post_send failed. This is bad mkay");
-  int ne;
-  struct ibv_wc wc;
+gettimeofday(&tv2,NULL);
+  int nl=nloop,pcnt=0,rcnt=0;
+  int nwr=0;
+  do{
+//fprintf(stdout, "[begin]nl=%d.\n", nl);
+/////////////////////////////////////////////////////
+// use completion queue
+    TEST_NZ(ibv_req_notify_cq(ibcon.scq,0),"Could not request notify from sending completion queue, ibv_req_notify_cq");
+/////////////////////////////////////////////////////
+    int rSend = 0;
+    do{
+//    TEST_NZ(ibv_post_send(ibcon.qp,&wr,&bad_wr),"ibv_post_send failed. This is bad mkay");
+      rSend = ibv_post_send(ibcon.qp,&wr,&bad_wr);
+      if(rSend==0){
+        nl--;nwr++;
+        pcnt += wr.num_sge;
+        rcnt ++;
+      }
+    }while(rSend==0 && nl>0 && nwr<MAX_SQE);
+    // if(rSend!=0 && rSend!=ENOMEM){
+    if(rSend!=0){
+      fprintf(stderr,"ERROR in ibv_post_send:%d\n",rSend);
+      exit(-1);
+    }
+    int ne;
+    struct ibv_wc *wc = (struct ibv_wc*)malloc(MAX_SQE*sizeof(struct ibv_wc));
 //////////////////////////////////////////////////////////
 // wait on completion queue
-  void *cq_ctxt;
-  TEST_NZ(ibv_get_cq_event(ibcon.ch,&ibcon.scq,&cq_ctxt),"ibv_get_cq_event failed");
-  ibv_ack_cq_events(ibcon.scq,1);
+    void *cq_ctxt;
+    TEST_NZ(ibv_get_cq_event(ibcon.ch,&ibcon.scq,&cq_ctxt),"ibv_get_cq_event failed");
+    ibv_ack_cq_events(ibcon.scq,1);
 //////////////////////////////////////////////////////////
-  do{
-    ne = ibv_poll_cq(ibcon.scq,100,&wc);
-  }while(ne==0);
-
-  if(ne<0){
-    fprintf(stderr, "%s: poll CQ failed %d\n", __func__, ne);
-  }else
-    fprintf(stdout, "I received %d wc entries.\n", ne);
-
-  if(wc.status != IBV_WC_SUCCESS) {
-    fprintf(stderr, "%d:%s: Completion with error at %s:\n", getpid(), __func__, "server");
-    fprintf(stderr, "%d:%s: Failed status %d: wr_id %ld\n", getpid(), __func__, wc.status, wc.wr_id);
-    res.err_code = 1;
-  }
-
+    do{
+      ne = ibv_poll_cq(ibcon.scq,MAX_SQE,wc);
+    }while(ne==0);
+    if(ne<0){
+      fprintf(stderr, "%s: poll CQ failed %d\n", __func__, ne);
+    }else{
+      nwr -= ne;
+      // fprintf(stdout, "I received %d wc entries.\n", ne);
+    }
+  int i;
+  for(i=0;i<ne;i++)
+    if((wc+i)->status != IBV_WC_SUCCESS) {
+      fprintf(stderr, "%d:%s: Completion with error at %s:\n", getpid(), __func__, "server");
+      fprintf(stderr, "%d:%s: Failed status %d: wr_id %ld\n", getpid(), __func__, (wc+i)->status, (wc+i)->wr_id);
+      res.err_code = 1;
+    }
+//fprintf(stdout, "[end]nl=%d.\n", nl);
+  }while(nl>0);
+gettimeofday(&tv3,NULL);
+  free(sge_list);
   // write notification: a byte: 0 for success, otherwise failure.
   send(connfd,(void*)&res.err_code,1,0);
   close(connfd);
@@ -311,11 +334,29 @@
   TEST_NZ(ibv_destroy_cq(ibcon.scq),"Could not destroy send completion queue, ibv_destroy_cq");
   TEST_NZ(ibv_destroy_cq(ibcon.rcq),"Could not destroy receive completion queue, ibv_destroy_cq");
   TEST_NZ(ibv_destroy_comp_channel(ibcon.ch),"Cloud not destroy completion channel, ibv_destroy_comp_channel");
-
+#define SPAN(tv1,tv2) (((tv2).tv_sec-(tv1).tv_sec)*1000000 + (tv2).tv_usec - (tv1).tv_usec)
+#define THP(npage,us) (((double)(npage)*page_size)/(us))
+#define NREQ(n,us) ((double)(n)/(us))
+/*
+printf("[%d] %ld %ld %ld.%ld %ld.%ld %ld.%ld %.3f\n", connfd,
+  SPAN(tv1,tv2),SPAN(tv2,tv3),
+  tv1.tv_sec,tv1.tv_usec,
+  tv2.tv_sec,tv2.tv_usec,
+  tv3.tv_sec,tv3.tv_usec,
+  THP(pcnt,SPAN(tv2,tv3)));
+*/
+printf("%.3f %.3f\n",THP(pcnt,SPAN(tv2,tv3)), NREQ(rcnt,SPAN(tv2,tv3)));
   return NULL;
 }

-static void doServer(){
+static void doServer(int argc, char ** argv){
+  if(argc!=4){
+    fprintf(stderr,"Error: we expected 4 args, but we got %d\n", argc);
+    return;
+  }
+
+  page_size = atoi(argv[2]);
+  nloop = atoi(argv[3]);
   // STEP 1 initialization
   struct addrinfo *res;
   struct addrinfo hints = {
@@ -327,7 +368,7 @@
   int sockfd = -1;
   int n,connfd;
   // initialize context
-  init_ctxt();
+  init_ctxt(page_size);
   // initialize page data;
   init_pages(1);
   ///struct sockaddr_in sin;
@@ -344,12 +385,13 @@
     TEST_N(connfd = accept(sockfd, NULL, 0), "server accept failed.");
     pthread_create(&tid,NULL,server_routine,&connfd);
   }
-
 }

 static void doClient(int argc, char ** argv){
+  char * server = argv[2];
+  int page_size = atoi(argv[3]);
   // STEP 1 initialization
-  init_ctxt();
+  init_ctxt(page_size);
   init_pages(0);
   // STEP 1.1 - setup connection
   Connection ibcon = {
@@ -361,13 +403,13 @@
   };
   TEST_Z(ibcon.ch=ibv_create_comp_channel(ctxt.context),"Could not create completion channel, ibv_create_comp_channel");
   TEST_Z(ibcon.rcq=ibv_create_cq(ctxt.context,1,NULL,NULL,0),"Could not create receive completion queue, ibv_create_cq");
-  TEST_Z(ibcon.scq=ibv_create_cq(ctxt.context,100,&ibcon,ibcon.ch,0),"Could not create send completion queue, ibv_create_cq");
+  TEST_Z(ibcon.scq=ibv_create_cq(ctxt.context,MAX_SQE,&ibcon,ibcon.ch,0),"Could not create send completion queue, ibv_create_cq");
   struct ibv_qp_init_attr qp_init_attr = {
     .send_cq = ibcon.scq,
     .recv_cq = ibcon.rcq,
     .qp_type = IBV_QPT_RC,
     .cap = {
-      .max_send_wr = 100,
+      .max_send_wr = MAX_SQE,
       .max_recv_wr = 1,
       .max_send_sge = MAX_PAGE,
       .max_recv_sge = 1,
@@ -399,7 +441,7 @@
   int sockfd = -1;
   //struct sockaddr_in sin;
   TEST_N(asprintf(&service, "%d", SVR_PORT), "Error writing port number to port string.");
-  TEST_N(getaddrinfo(argv[2], service, &hints, &res), "getaddrinfo threw error");
+  TEST_N(getaddrinfo(server, service, &hints, &res), "getaddrinfo threw error");
   //STEP 2 connect
   for(t = res; t; t=t->ai_next){
     TEST_N(sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol),"Could not create client socket");
@@ -428,22 +470,21 @@
   Request req;
   uint8_t err_code=0;
   int i = 0;
-  for(;i<argc-3;i++)
-    req.page_flags[i]=(uint8_t)atoi(argv[i+3]);
+  for(;i<argc-4;i++)
+    req.page_flags[i]=(uint8_t)atoi(argv[i+4]);
   if(i<MAX_PAGE)req.page_flags[i]=255;
   send(sockfd,(void*)&req.page_flags,16,0);
   recv(sockfd,(void*)&err_code,1,MSG_WAITALL);
   close(sockfd);
   printf("err_code=%d\n",err_code);
   if(err_code==0){
-    for(i=0;i<argc-3;i++)
+    for(i=0;i<argc-4;i++)
       printf("%c%c%c\n",
-        ((char*)ctxt.pages)[i*PAGE_SIZE],
-        ((char*)ctxt.pages)[i*PAGE_SIZE+2048],
-        ((char*)ctxt.pages)[i*PAGE_SIZE+4095]);
+        ((char*)ctxt.pages)[i*page_size],
+        ((char*)ctxt.pages)[i*page_size+page_size/2],
+        ((char*)ctxt.pages)[i*page_size+page_size-1]);
   }
   //STEP 4 clean and destroy connection.
-  // TODO
   TEST_NZ(ibv_destroy_qp(ibcon.qp),"Could not destroy queue pair, ibv_destroy_qp");
   TEST_NZ(ibv_destroy_cq(ibcon.scq),"Could not destroy send completion queue, ibv_destroy_cq");
   TEST_NZ(ibv_destroy_cq(ibcon.rcq),"Could not destroy receive completion queue, ibv_destroy_cq");
@@ -460,7 +501,7 @@
   }

   if(strcmp(argv[1],"svr")==0){
-    doServer();
+    doServer(argc,argv);
   }else if(strcmp(argv[1],"cli")==0){
     doClient(argc,argv);
   }else{


zephyr/modmachine: Add machine.idle().

zephyr/modmachine: Add machine.idle().

Signed-off-by: Damien George <99e6b749acbfbe2a596df99e91d24d6e1fdbee00@micropython.org>

--- ports/zephyr/modmachine.c
+++ ports/zephyr/modmachine.c
@@ -53,12 +53,19 @@
 }
 STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);

+STATIC mp_obj_t machine_idle(void) {
+    k_yield();
+    return mp_const_none;
+}
+STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
+
 STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
     { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_umachine) },
     #ifdef CONFIG_REBOOT
     { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
     #endif
     { MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
+    { MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },

     #if MICROPY_PY_MACHINE_I2C
     { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_hard_i2c_type) },


Evas: Fix 'variable undeclared': I assume we wanted the xr rectangle
there ? ;)

NB: Fixes building w/ xcb.

git-svn-id: 6d771e449150288cc513807b7f4d2af31e9482bd@61685 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/engines/software_x11/evas_xcb_outbuf.c
+++ src/modules/engines/software_x11/evas_xcb_outbuf.c
@@ -538,10 +538,10 @@
              buf->priv.onebuf_regions =
                eina_list_remove_list(buf->priv.onebuf_regions,
                                      buf->priv.onebuf_regions);
-             pixman_region_union_rect(&tmpr, &tmpr, r.x, r.y, r.w, r.h);
+             pixman_region_union_rect(&tmpr, &tmpr, xr.x, xr.y, xr.w, xr.h);
              if (buf->priv.debug)
                evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
-                                                   r.x, r.y, r.w, r.h);
+                                                   xr.x, xr.y, xr.w, xr.h);
              eina_rectangle_free(rect);
           }
         xcb_set_clip_rectangles(buf->priv.x11.xcb.conn,
@@ -764,7 +764,7 @@
      {
         src_data += x + (y * update->cache_entry.w);
         data += (bpl * obr->y) +
-           (obr->x * (evas_software_xcb_output_buffer_depth(obr->xob) / 8));
+           (obr->x * (evas_software_xcb_output_buffer_depth(obr->xcbob) / 8));
      }
    if (data != (unsigned char *)src_data)
      {


FW attitude control: Increase default integrator gains to compensate common airframe trim issues

--- src/modules/fw_att_control/fw_att_control_params.c
+++ src/modules/fw_att_control/fw_att_control_params.c
@@ -84,11 +84,11 @@
  * This gain defines how much control response will result out of a steady
  * state error. It trims any constant error.
  *
- * @min 0.0
- * @max 50.0
- * @group FW Attitude Control
- */
-PARAM_DEFINE_FLOAT(FW_PR_I, 0.005f);
+ * @min 0.005
+ * @max 0.5
+ * @group FW Attitude Control
+ */
+PARAM_DEFINE_FLOAT(FW_PR_I, 0.01f);

 /**
  * Maximum positive / up pitch rate.
@@ -157,11 +157,11 @@
  * This gain defines how much control response will result out of a steady
  * state error. It trims any constant error.
  *
- * @min 0.0
- * @max 100.0
- * @group FW Attitude Control
- */
-PARAM_DEFINE_FLOAT(FW_RR_I, 0.005f);
+ * @min 0.005
+ * @max 0.2
+ * @group FW Attitude Control
+ */
+PARAM_DEFINE_FLOAT(FW_RR_I, 0.01f);

 /**
  * Roll Integrator Anti-Windup


mtecs: BlockPDLimited: make sure dt > 0

mtecs: BlockPDLimited: make sure dt > 0

--- src/modules/fw_pos_control_l1/mtecs/mTecs_blocks.h
+++ src/modules/fw_pos_control_l1/mtecs/mTecs_blocks.h
@@ -193,7 +193,7 @@
 	virtual ~BlockPDLimited() {};
 	float update(float input) {
 		float difference = 0.0f;
-		float output = getKP() * input + getKD() * getDerivative().update(input);
+		float output = getKP() * input + (getDerivative().getDt() > 0.0f ? getKD() * getDerivative().update(input) : 0.0f);
 		getOutputLimiter().limit(output, difference);

 		return output;


factor out salut_ft_manager_channel_created and call it in message_stanza_callback

--- src/salut-ft-manager.c
+++ src/salut-ft-manager.c
@@ -47,6 +47,8 @@
 static SalutFileTransferChannel *
 salut_ft_manager_new_channel (SalutFtManager *mgr, TpHandle handle,
     gboolean requested, GError **error);
+static void salut_ft_manager_channel_created (SalutFtManager *mgr,
+    SalutFileTransferChannel *chan, gpointer request_token);

 G_DEFINE_TYPE_WITH_CODE (SalutFtManager, salut_ft_manager, G_TYPE_OBJECT,
     G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_MANAGER,
@@ -119,6 +121,8 @@
       tp_channel_manager_emit_new_channel (self, TP_EXPORTABLE_CHANNEL (chan),
           NULL);
     }
+
+  salut_ft_manager_channel_created (self, chan, NULL);
 }

 static void salut_ft_manager_dispose (GObject *object);
@@ -267,6 +271,27 @@

   DEBUG ("Object path of file channel is %s", path);
   return path;
+}
+
+static void
+salut_ft_manager_channel_created (SalutFtManager *self,
+                                  SalutFileTransferChannel *chan,
+                                  gpointer request_token)
+{
+  SalutFtManagerPrivate *priv = SALUT_FT_MANAGER_GET_PRIVATE (self);
+  GSList *requests = NULL;
+
+  g_signal_connect (chan, "closed", G_CALLBACK (file_channel_closed_cb), self);
+
+  priv->channels = g_list_append (priv->channels, chan);
+
+  if (request_token != NULL)
+    requests = g_slist_prepend (requests, request_token);
+
+  tp_channel_manager_emit_new_channel (self, TP_EXPORTABLE_CHANNEL (chan),
+      requests);
+
+  g_slist_free (requests);
 }

 static SalutFileTransferChannel *
@@ -315,19 +340,11 @@

   path = generate_object_path (mgr, handle);

-
   chan = salut_file_transfer_channel_new (priv->connection, contact, path,
       handle, priv->xmpp_connection_manager, initiator, state);

   g_object_unref (contact);
   g_free (path);
-
-  /* Don't fire the new channel signal now so the caller of this function can
-   * set the extra properties on the ft channel. */
-
-  g_signal_connect (chan, "closed", G_CALLBACK (file_channel_closed_cb), mgr);
-
-  priv->channels = g_list_append (priv->channels, chan);

   return chan;
 }
@@ -349,7 +366,6 @@
   TpFileHashType content_hash_type;
   GError *error = NULL;
   gboolean valid;
-  GSList *requests = NULL;

   DEBUG ("File transfer request");

@@ -476,10 +492,7 @@
       goto error;
     }

-  requests = g_slist_prepend (requests, request_token);
-  tp_channel_manager_emit_new_channel (manager, TP_EXPORTABLE_CHANNEL (chan),
-      requests);
-  g_slist_free (requests);
+  salut_ft_manager_channel_created (self, chan, request_token);

   return TRUE;


Fix compiler warning

Fix compiler warning

card_eventmgr.c: In function ‘main’:
card_eventmgr.c:336:8: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘pid_t’ {aka ‘int’} [-Wformat=]
   DBG1("Killing process: %ld", pid);
        ^~~~~~~~~~~~~~~~~~~~~~  ~~~

--- src/tools/card_eventmgr.c
+++ src/tools/card_eventmgr.c
@@ -333,7 +333,7 @@
 	    pid_t pid = read_pidfile(pidfile);
 	    if (pid > 0)
 	    {
-		DBG1("Killing process: %ld", pid);
+		DBG1("Killing process: %ld", (long)pid);
 	    	kill(pid, SIGQUIT);
 	    }
 	    else


mc_pos_control: parameters comments minor fixes

--- src/modules/mc_pos_control/mc_pos_control_params.c
+++ src/modules/mc_pos_control/mc_pos_control_params.c
@@ -100,6 +100,7 @@
  *
  * Maximum vertical velocity in AUTO mode and endpoint for stabilized modes (SEATBELT, EASY).
  *
+ * @unit m/s
  * @min 0.0
  * @group Multicopter Position Control
  */
@@ -155,6 +156,7 @@
  *
  * Maximum horizontal velocity in AUTO mode and endpoint for position stabilized mode (EASY).
  *
+ * @unit m/s
  * @min 0.0
  * @group Multicopter Position Control
  */
@@ -186,6 +188,7 @@
 /**
  * Landing descend rate
  *
+ * @unit m/s
  * @min 0.0
  * @group Multicopter Position Control
  */


mc_pos_control_params: add type boolean to MPC_OBS_AVOID parameter

--- src/modules/mc_pos_control/mc_pos_control_params.c
+++ src/modules/mc_pos_control/mc_pos_control_params.c
@@ -608,10 +608,7 @@
  * Flag to enable obstacle avoidance
  * Temporary Parameter to enable interface testing
  *
- * @min 0
- * @max 1
- * @value 0 Obstacle Avoidance Not Enabled
- * @value 1 Obstacle Avoidance Enabled
+ * @boolean
  * @group Multicopter Position Control
  */
 PARAM_DEFINE_INT32(MPC_OBS_AVOID, 0);


dont free null ptrs eh?

dont free null ptrs eh?

git-svn-id: a6113611d365f0fc061992be0d1d0b451b434026@53944 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

--- src/modules/mp/chained_pool/eina_chained_mempool.c
+++ src/modules/mp/chained_pool/eina_chained_mempool.c
@@ -282,7 +282,10 @@
    }

 #ifndef NVALGRIND
-   VALGRIND_MEMPOOL_FREE(pool, ptr);
+   if (ptr)
+     {
+        VALGRIND_MEMPOOL_FREE(pool, ptr);
+     }
 #endif

 #ifdef EFL_HAVE_THREADS


git-svn-id: http://svn.seqan.de/seqan/trunk@2523 e6417c60-b987-48fd-844e-b20f0fcc1017

--- seqan/projects/library/seqan/modifier/modifier_functors.h
+++ seqan/projects/library/seqan/modifier/modifier_functors.h
@@ -133,7 +133,7 @@
     template <>
     struct FunctorComplement<Dna5> : public ::std::unary_function<Dna5,Dna5>
 	{
-        inline Dna operator()(Dna5 x) const {
+        inline Dna5 operator()(Dna5 x) const {
 			return _Translate_Table_Dna5_2_Dna5Complement<>::VALUE[x.value];
 		}
     };


Bug 588187 – Large FTP transfers hang gvfsd-ftp

Enable keepalive on the command connection. See the comment in the
source code or the bug report for a detailed explanation.

--- daemon/gvfsftpconnection.c
+++ daemon/gvfsftpconnection.c
@@ -44,6 +44,22 @@

   int                   debug_id;               /* unique id for debugging purposes */
 };
+
+static void
+enable_keepalive (GSocketConnection *conn)
+{
+  /* We enable keepalive on the socket, because data connections can be
+   * idle for a long time while data is transferred using the data
+   * connection. And there are still buggy routers in existance that purge
+   * idle connections from time to time.
+   * To work around this problem, we set the keep alive flag here. It's the
+   * user's responsibility to configure his kernel properly so that the
+   * keepalive packets are sent before the buggy router disconnects the
+   * TCP connection. If a user asks, a howto is at
+   * http://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/
+   */
+  g_socket_set_keepalive (g_socket_connection_get_socket (conn), TRUE);
+}

 GVfsFtpConnection *
 g_vfs_ftp_connection_new (GSocketConnectable *addr,
@@ -68,6 +84,7 @@
       return NULL;
     }

+  enable_keepalive (G_SOCKET_CONNECTION (conn->commands));
   conn->commands_in = G_DATA_INPUT_STREAM (g_data_input_stream_new (g_io_stream_get_input_stream (conn->commands)));
   g_data_input_stream_set_newline_type (conn->commands_in, G_DATA_STREAM_NEWLINE_TYPE_CR_LF);


#75 remove extra qualification

#75 remove extra qualification

--- bouncer/src/repo/manipulator/modelconvertor/export/repo_model_export_gltf.h
+++ bouncer/src/repo/manipulator/modelconvertor/export/repo_model_export_gltf.h
@@ -47,7 +47,7 @@
 				virtual ~GLTFModelExport();

 				//temporary function to debug gltf. to remove once done
-				void GLTFModelExport::debug() const;
+				void debug() const;

 				/**
 				* Export a repo scene graph to file


[Topi] Missing header (#4865)

[Topi] Missing header (#4865)

--- topi/include/topi/x86/default.h
+++ topi/include/topi/x86/default.h
@@ -27,6 +27,7 @@
 #include <topi/tags.h>
 #include <topi/detail/fuse.h>
 #include <tvm/te/operation.h>
+#include <tvm/te/schedule_pass.h>
 #include <tvm/target/generic_func.h>

 namespace topi {


Don't leak the sender handle when text messages are zapped

--- src/sip-text-channel.c
+++ src/sip-text-channel.c
@@ -132,19 +132,17 @@

 #define TPSIP_TEXT_CHANNEL_GET_PRIVATE(o)     (G_TYPE_INSTANCE_GET_PRIVATE ((o), TPSIP_TYPE_TEXT_CHANNEL, TpsipTextChannelPrivate))

-static void _tpsip_text_pending_free(TpsipTextPendingMessage *msg)
-{
-  if (msg->text)
-    g_free (msg->text);
+static void tpsip_text_pending_free (TpsipTextPendingMessage *msg,
+                                     TpHandleRepoIface *contact_handles)
+{
+  if (msg->sender)
+    tp_handle_unref (contact_handles, msg->sender);
+
+  g_free (msg->text);

   nua_handle_unref (msg->nh);

   g_slice_free (TpsipTextPendingMessage, msg);
-}
-
-static void _tpsip_text_pending_free_walk(gpointer data, gpointer user_data)
-{
-  _tpsip_text_pending_free ((TpsipTextPendingMessage *) data);
 }

 static void
@@ -435,15 +433,19 @@
 {
   TpsipTextChannel *self = TPSIP_TEXT_CHANNEL (object);
   TpsipTextChannelPrivate *priv = TPSIP_TEXT_CHANNEL_GET_PRIVATE (self);
-
-  DEBUG("enter");
+  TpHandleRepoIface *contact_handles;
+
+  DEBUG("enter");
+
+  contact_handles = tp_base_connection_get_handles (
+      (TpBaseConnection *)priv->conn, TP_HANDLE_TYPE_CONTACT);

   if (!g_queue_is_empty (priv->pending_messages))
     {
       g_warning ("zapping %u pending incoming messages",
                  g_queue_get_length (priv->pending_messages));
       g_queue_foreach (priv->pending_messages,
-                       _tpsip_text_pending_free_walk, NULL);
+          (GFunc) tpsip_text_pending_free, contact_handles);
     }
   g_queue_free (priv->pending_messages);

@@ -452,7 +454,7 @@
       g_message ("zapping %u pending outgoing message requests",
                  g_queue_get_length (priv->messages_to_be_acknowledged));
       g_queue_foreach (priv->messages_to_be_acknowledged,
-                       _tpsip_text_pending_free_walk, NULL);
+          (GFunc) tpsip_text_pending_free, contact_handles);
     }
   g_queue_free (priv->messages_to_be_acknowledged);

@@ -533,8 +535,7 @@

       g_queue_remove (priv->pending_messages, msg);

-      tp_handle_unref (contact_repo, msg->sender);
-      _tpsip_text_pending_free (msg);
+      tpsip_text_pending_free (msg, contact_repo);
     }

   g_free(nodes);
@@ -785,6 +786,7 @@
 {
   TpsipTextChannelPrivate *priv = TPSIP_TEXT_CHANNEL_GET_PRIVATE (self);
   TpsipTextPendingMessage *msg;
+  TpHandleRepoIface *contact_repo;
   TpChannelTextSendError send_error;
   GList *node;

@@ -854,14 +856,18 @@
   }

   g_queue_remove(priv->messages_to_be_acknowledged, msg);
-  _tpsip_text_pending_free(msg);
+
+  contact_repo = tp_base_connection_get_handles (
+      (TpBaseConnection *)(priv->conn), TP_HANDLE_TYPE_CONTACT);
+
+  tpsip_text_pending_free(msg, contact_repo);

   return TRUE;
 }

 void tpsip_text_channel_receive(TpsipTextChannel *chan,
-			      TpHandle sender,
-			      const char *message)
+			        TpHandle sender,
+			        const char *message)
 {
   TpsipTextPendingMessage *msg;
   TpsipTextChannelPrivate *priv;


make static var in txn manager factory private

--- src/backend/concurrency/transaction_manager_factory.h
+++ src/backend/concurrency/transaction_manager_factory.h
@@ -43,6 +43,7 @@
     return isolation_level;
   }

+private:
   static ConcurrencyType protocol;
   static IsolationLevelType isolation_level;


examples/list-vms: Removed unused ca_cert variable

We read OvirtProxy::ca-cert but never do anything with it, so this can
be removed.

--- examples/list-vms.c
+++ examples/list-vms.c
@@ -99,7 +99,6 @@
     OvirtApi *api;
     OvirtProxy *proxy = NULL;
     GError *error = NULL;
-    GByteArray *ca_cert = NULL;

     g_type_init();

@@ -124,7 +123,6 @@
         g_debug("failed to get CA certificate: %s", error->message);
         goto error;
     }
-    g_object_get(G_OBJECT(proxy), "ca-cert", &ca_cert, NULL);

     api = ovirt_proxy_fetch_api(proxy, &error);
     if (error != NULL) {
@@ -138,8 +136,6 @@

 error:
-    if (ca_cert != NULL)
-        g_byte_array_unref(ca_cert);
     if (error != NULL)
         g_error_free(error);
     if (proxy != NULL)


Fix hang up when backend node did fast or immediate shutdown.

If shutdown occured, postgres send an error which error code is
"57P01" and error message is "terminating connection due to
administrator command".

However, another nodes did not send any messages. pgpool waited for a
message from them. when the error is sended, pgpool reads the message
and degenerate.

--- pool_process_query.c
+++ pool_process_query.c
@@ -51,6 +51,9 @@
 #define INIT_STATEMENT_LIST_SIZE 8

 #define DEADLOCK_ERROR_CODE "40P01"
+#define ADMIN_SHUTDOWN_ERROR_CODE "57P01"
+#define CRASH_SHUTDOWN_ERROR_CODE "57P02"
+
 #define POOL_ERROR_QUERY "send invalid query from pgpool to abort transaction"

 typedef struct {
@@ -196,9 +199,9 @@
 static POOL_STATUS start_internal_transaction(POOL_CONNECTION_POOL *backend, Node *node);
 static POOL_STATUS end_internal_transaction(POOL_CONNECTION_POOL *backend);
 static int extract_ntuples(char *message);
-static int detect_error(POOL_CONNECTION *master, char *error_code, int major);
+static int detect_error(POOL_CONNECTION *master, char *error_code, int major, bool unread);
 static int detect_deadlock_error(POOL_CONNECTION *master, int major);
-
+static int detect_postmaster_down_error(POOL_CONNECTION *master, int major);

 POOL_STATUS pool_process_query(POOL_CONNECTION *frontend,
 							   POOL_CONNECTION_POOL *backend,
@@ -272,7 +275,7 @@
 		if (is_cache_empty(frontend, backend))
 		{
 			struct timeval timeout;
-			int num_fds;
+			int num_fds, was_error = 0;

 			timeout.tv_sec = 1;
 			timeout.tv_usec = 0;
@@ -321,12 +324,27 @@
 				return POOL_CONTINUE;
 			}

-			if (FD_ISSET(MASTER(backend)->fd, &readmask))
-			{
-				status = read_kind_from_backend(frontend, backend, &kind);
-				if (status != POOL_CONTINUE)
-					return status;
-			}
+			for (i = 0; i < NUM_BACKENDS; i++)
+			{
+				if (VALID_BACKEND(i) && FD_ISSET(CONNECTION(backend, i)->fd, &readmask))
+				{
+					if (detect_postmaster_down_error(CONNECTION(backend, i), MAJOR(backend)))
+					{
+						was_error = 1;
+						notice_backend_error(i);
+						sleep(5);
+						break;
+					}
+
+					status = read_kind_from_backend(frontend, backend, &kind);
+					if (status != POOL_CONTINUE)
+						return status;
+					break;
+				}
+			}
+
+			if (was_error)
+				continue;

 			if (!connection_reuse)
 			{
@@ -4787,9 +4805,26 @@
 	return atoi(rows);
 }

-static int detect_deadlock_error(POOL_CONNECTION *master, int major)
-{
-	int r =  detect_error(master, DEADLOCK_ERROR_CODE, major);
+static int detect_postmaster_down_error(POOL_CONNECTION *backend, int major)
+{
+	int r =  detect_error(backend, ADMIN_SHUTDOWN_ERROR_CODE, major, false);
+	if (r)
+	{
+		pool_debug("detect_stop_postmaster_error: receive admin shutdown error from a node.");
+		return r;
+	}
+
+	r = detect_error(backend, CRASH_SHUTDOWN_ERROR_CODE, major, false);
+	if (r == 1)
+	{
+		pool_debug("detect_stop_postmaster_error: receive crash shutdown error from a node.");
+	}
+	return r;
+}
+
+static int detect_deadlock_error(POOL_CONNECTION *backend, int major)
+{
+	int r =  detect_error(backend, DEADLOCK_ERROR_CODE, major, true);
 	if (r == 1)
 		pool_debug("detect_deadlock_error: receive deadlock error from master node.");
 	return r;
@@ -4798,19 +4833,13 @@
 /*
  * detect_error: Detect specified error from error code.
  */
-static int detect_error(POOL_CONNECTION *backend, char *error_code, int major)
+static int detect_error(POOL_CONNECTION *backend, char *error_code, int major, bool unread)
 {
 	int is_error = 0;
 	char kind;
 	int readlen = 0, len;
-	char *buf;
+	static char buf[1024]; /* memory space is large enough */
 	char *p, *str;
-
-	if ((buf = malloc(1024)) == NULL)
-	{
-		pool_error("detect_error: malloc failed");
-		return -1;
-	}

 	if (pool_read(backend, &kind, sizeof(kind)))
 		return POOL_END;
@@ -4836,15 +4865,6 @@
 			str = malloc(len);
 			pool_read(backend, str, len);
 			readlen += len;
-			if (readlen > 1024)
-			{
-				buf = realloc(buf, readlen);
-				if (buf == NULL)
-				{
-					pool_error("detect_error: malloc failed");
-					return -1;
-				}
-			}
 			memcpy(p, str, len);

 			/*
@@ -4871,20 +4891,14 @@
 		{
 			str = pool_read_string(backend, &len, 0);
 			readlen += len;
-			if (readlen > 1024)
-			{
-				buf = realloc(buf, readlen);
-				if (buf == NULL)
-				{
-					pool_error("detect_error: malloc failed");
-					return -1;
-				}
-			}
 			memcpy(p, str, len);
 		}
 	}
-	if (pool_unread(backend, buf, readlen) != 0)
-		is_error = -1;
-	free(buf);
+	if (unread || !is_error)
+	{
+		if (pool_unread(backend, buf, readlen) != 0)
+			is_error = -1;
+	}
+
 	return is_error;
 }


Fix reset_backend to deal with DEALLOCATE error. In this case prepared
objects are not removed and reset_backend is infinitely called.

Fix do_command to guard against the case that after execution of an
SQL command, the backend does not return either N, E or C. This should
not happen but there was a report that it actually happend in certain
cases(maybe caused by asynchronized backend data?)

See:

Subject: Re: [Pgpool-general] pgpool 2.2.4: DEALLOCATED children
From: Xavier Noguer
Date: Fri, 25 Sep 2009 03:35:57 -0400

For more details.

Patches by Xavier Noguer with minor tweak by Tatsuo Ishii.

--- pool_process_query.c
+++ pool_process_query.c
@@ -2161,10 +2161,20 @@

 	qn = pool_config->num_reset_queries;

+	/*
+	 * After execution of all SQL commands in the reset_query_list, we
+	 * remove all prepared objects in the prepared_list.
+	 */
 	if (qcnt >= qn)
 	{
 		if (prepared_list.cnt == 0)
 		{
+			/*
+			 * Either no prepared objects were created or DISCARD ALL
+			 * or DEALLOCATE ALL is on the reset_query_list and they
+			 * were executed.  The latter causes call to
+			 * reset_prepared_list which removes all prepared objects.
+			 */
 			reset_prepared_list(&prepared_list);
 			return 2;
 		}
@@ -2178,6 +2188,15 @@
 			reset_prepared_list(&prepared_list);
 			return -1;
 		}
+		/*
+		 * If DEALLOCATE returns ERROR response, instead of
+		 * CommandComplete, del_prepared_list is not called and the
+		 * prepared object keeps on sitting on the prepared list. This
+		 * will cause infinite call to reset_backend.  So we call
+		 * del_prepared_list() again. This is harmless since trying to
+		 * remove same prepared object will be ignored.
+		 */
+		del_prepared_list(&prepared_list, prepared_list.portal_list[0]);
 		return 1;
 	}

@@ -2619,6 +2638,12 @@
 				return POOL_END;
 			}
 			len = ntohl(len) - 4;
+
+			if (kind != 'N' && kind != 'E' && kind != 'C')
+			{
+				pool_error("do_command: error, kind is not N, E or C(%02x)", kind);
+				return POOL_END;
+			}
 			string = pool_read2(backend, len);
 			if (string == NULL)
 			{


ata: ahci_platform: Add DT compatible for Synopsis DWC AHCI controller

Add compatible string "snps,dwc-ahci", which should be used
for Synopsis Designware SATA cores. e.g. on TI OMAP5 and DRA7 platforms.

Signed-off-by: Roger Quadros <eba86029bdfc5762d0419aa8dd4fd0368b2d01d4@ti.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <24970bf3d8506c473367e9292a8e5eb43a40bda0@samsung.com>
Signed-off-by: Hans de Goede <9fa1be1a5b5729e4c6b404f34c9ce49ff4882fd8@redhat.com>
Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>


PM / Domains: Don't measure ->start|stop() latency in system PM callbacks

Measure latency does by itself contribute to an increased latency, thus we
should avoid it when it isn't needed.

Genpd measures latencies in the system PM phase for the ->start|stop()
callbacks and is thus affecting the system PM suspend/resume time.
Moreover these latencies are validated only at runtime PM suspend/resume.

To this reasoning, let's decide to leave these measurements out of the
system PM phase. There should be plenty of occasions during runtime PM to
perform these measurements anyway.

Signed-off-by: Ulf Hansson <fe47b31f388f85ce6ddf64bf3a0cf6b46077d0e6@linaro.org>
Reviewed-by: Lina Iyer <aa8fe410730c92616b67de3693d55beda1de4e6b@linaro.org>
Acked-by: Kevin Hilman <f9849b02abe18c1ece6bd40346458ed53f49d31b@linaro.org>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


PM / Domains: Free pm_subsys_data in error path in __pm_genpd_add_device()

The error path in __pm_genpd_add_device() didn't decrease the reference
to the struct pm_subsys_data.

Let's move the calls to dev_pm_get|put_subsys_data() into
genpd_alloc|free_dev_data() to fix this issue and thus prevent a
potential memory leakage.

Signed-off-by: Ulf Hansson <fe47b31f388f85ce6ddf64bf3a0cf6b46077d0e6@linaro.org>
Signed-off-by: Rafael J. Wysocki <27ffc44a8ec6a212fba98cfc3246c6ce8ab131e0@intel.com>


[PATCH] drivers/char/pc8736x_gpio.c: unexport a static struct

A static struct mustn't be exported.

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@stusta.de>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/char/pc8736x_gpio.c
+++ drivers/char/pc8736x_gpio.c
@@ -221,7 +221,6 @@
 	.gpio_change	= pc8736x_gpio_change,
 	.gpio_current	= pc8736x_gpio_current
 };
-EXPORT_SYMBOL(pc8736x_gpio_ops);

 static int pc8736x_gpio_open(struct inode *inode, struct file *file)
 {


clk: keystone: gate: fix clk_init_data initialization

The clk_init_data struct is allocated in the stack. All members of
this struct should be initialized before using otherwise it will
lead to unpredictable situation as it can contain garbage.

Ultimately the clk->flag field contains garbage. In my case it leads
that flag CLK_IGNORE_UNUSED is set for most of clocks. As result a
bunch of unused clocks cannot be disabled.

So initialize flags in this structure too.

Cc: Mike Turquette <6dab61939fc5e23761050a66932f032dceda5ebf@linaro.org>
Signed-off-by: Ivan Khoronzhuk <15ad2a232c436ab54d1b78ef06a09c4cd03911f0@ti.com>
Signed-off-by: Santosh Shilimkar <5b4d8dc9ea337fff5fd1729321eda9873ade0b09@ti.com>


connector: Fix incompatible pointer type warning

Commit 7069331 (connector: Provide the sender's credentials to the
callback, 2009-10-02) changed callbacks to take two arguments but missed
this one.

drivers/connector/cn_proc.c: In function ‘cn_proc_init’:
drivers/connector/cn_proc.c:263: warning: passing argument 3 of
‘cn_add_callback’ from incompatible pointer type

Signed-off-by: Stephen Boyd <66c4b3fccf5786e0c6198a1e0f640664da3951b2@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/connector/cn_proc.c
+++ drivers/connector/cn_proc.c
@@ -227,7 +227,8 @@
  * cn_proc_mcast_ctl
  * @data: message sent from userspace via the connector
  */
-static void cn_proc_mcast_ctl(struct cn_msg *msg)
+static void cn_proc_mcast_ctl(struct cn_msg *msg,
+			      struct netlink_skb_parms *nsp)
 {
 	enum proc_cn_mcast_op *mc_op = NULL;
 	int err = 0;


i.MX IPU DMA: Fix wrong burstsize settings

The burstsize (npb in struct chan_param_mem) is set in
ipu_ch_param_set_size() once. The number of allowed
pixels in a burst depend on the pixel format and the
rotation mode. For 16bit formats 16 pixels are allowed
whereas for 32bit formats only 8 pixels are allowed.
Set these values correctly in ipu_ch_param_set_size()
and do not overwrite them afterwards.
We do not support rotation right now, so ignore this
case.
This patch fixes the wrong burstsize setting of 16 pixels
for 32bpp.

Signed-off-by: Sascha Hauer <c00cbc2b736c26791a3822db86f8796fe9efff67@pengutronix.de>
Signed-off-by: Vinod Koul <5cf69c63beb17bf38d63aa0e923ee8256af0e205@linux.intel.com>

--- drivers/dma/ipu/ipu_idmac.c
+++ drivers/dma/ipu/ipu_idmac.c
@@ -312,7 +312,7 @@
 	case IPU_PIX_FMT_RGB565:
 		params->ip.bpp	= 2;
 		params->ip.pfs	= 4;
-		params->ip.npb	= 7;
+		params->ip.npb	= 15;
 		params->ip.sat	= 2;		/* SAT = 32-bit access */
 		params->ip.ofs0	= 0;		/* Red bit offset */
 		params->ip.ofs1	= 5;		/* Green bit offset */
@@ -420,12 +420,6 @@
 	}

 	params->pp.nsb = 1;
-}
-
-static void ipu_ch_param_set_burst_size(union chan_param_mem *params,
-					uint16_t burst_pixels)
-{
-	params->pp.npb = burst_pixels - 1;
 }

 static void ipu_ch_param_set_buffer(union chan_param_mem *params,
@@ -690,23 +684,6 @@
 	ipu_ch_param_set_size(&params, pixel_fmt, width, height, stride_bytes);
 	ipu_ch_param_set_buffer(&params, phyaddr_0, phyaddr_1);
 	ipu_ch_param_set_rotation(&params, rot_mode);
-	/* Some channels (rotation) have restriction on burst length */
-	switch (channel) {
-	case IDMAC_IC_7:	/* Hangs with burst 8, 16, other values
-				   invalid - Table 44-30 */
-/*
-		ipu_ch_param_set_burst_size(&params, 8);
- */
-		break;
-	case IDMAC_SDC_0:
-	case IDMAC_SDC_1:
-		/* In original code only IPU_PIX_FMT_RGB565 was setting burst */
-		ipu_ch_param_set_burst_size(&params, 16);
-		break;
-	case IDMAC_IC_0:
-	default:
-		break;
-	}

 	spin_lock_irqsave(&ipu->lock, flags);


gpio/davinci: Prepare gpio_irq_handler for irq argument removal

The irq argument of most interrupt flow handlers is unused or merily
used instead of a local variable. The handlers which need the irq
argument can retrieve the irq number from the irq descriptor.

Search and update was done with coccinelle and the invaluable help of
Julia Lawall.

Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Cc: Julia Lawall <3d4a3affaf9163789962e9770780389962bda29d@lip6.fr>
Cc: Jiang Liu <68ee766e574f18b34b683085865827393efe88bd@linux.intel.com>
Cc: Linus Walleij <9cd9d802d23c0ed5e224beabf4ae4a5c478746ef@linaro.org>
Cc: Alexandre Courbot <65cb6c989b5ca9e749bdf49f881cbebafb9afedc@gmail.com>
Cc: 566578396a3687944c2f0ec2d93d3fcd41719bb0@vger.kernel.org


gpio: Error pin out of range consistently.

Several GPIO drivers detect an out of range pin number and return an
errno error code.  Use the same errno code across all drivers.

Change-Id: I0e2949432d6845d12c37064c78f9c228b8e8e45a
Signed-off-by: Marcus Shawcroft <cf6354583ee83038f2010cbcbe1b1f2adb85107d@arm.com>

--- drivers/gpio/gpio_pulpino.c
+++ drivers/gpio/gpio_pulpino.c
@@ -78,7 +78,7 @@
 		return -ENOTSUP;

 	if (pin > 31)
-		return -ENODEV;
+		return -EINVAL;

 	/* Configure pin as gpio */
 	PULP_PADMUX |= (PULP_PAD_GPIO << pin);


drivers: gpio_sx1509b: correct handling of initialized output

The data_first flag was intended to be set when the configuration
requires setting the output value before setting the direction.
Respect the intent.

Signed-off-by: Peter Bigot <a4112a160b558d5427af084318038e19a95979ee@nordicsemi.no>

--- drivers/gpio/gpio_sx1509b.c
+++ drivers/gpio/gpio_sx1509b.c
@@ -179,8 +179,10 @@
 		pins->dir &= ~BIT(pin);
 		if ((flags & GPIO_OUTPUT_INIT_LOW) != 0) {
 			pins->data &= ~BIT(pin);
+			data_first = true;
 		} else if ((flags & GPIO_OUTPUT_INIT_HIGH) != 0) {
 			pins->data |= BIT(pin);
+			data_first = true;
 		}
 	} else {
 		pins->dir |= BIT(pin);


drm: Preserve the list head in drm_mode_copy

Preserve the destination mode's list head in drm_mode_copy. Just
in case someone decides that it's a good idea to overwrite a mode which
happens to be on some list,

Signed-off-by: Ville Syrjälä <cd6e8d405ca90be3a03d5427c5b24fbd2d68dcc4@linux.intel.com>
Reviewed-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>


drm/tegra: Don't disable unused planes

drm/tegra: Don't disable unused planes

When a plane isn't in use it isn't attached to a CRTC and therefore the
DC registers aren't available for programming.

Signed-off-by: Thierry Reding <b75a4d02013b0e68ae2c6bb0dcfd4b7bec282dc9@avionic-design.de>

--- drivers/gpu/host1x/drm/dc.c
+++ drivers/gpu/host1x/drm/dc.c
@@ -78,6 +78,9 @@
 	struct tegra_dc *dc = to_tegra_dc(plane->crtc);
 	struct tegra_plane *p = to_tegra_plane(plane);
 	unsigned long value;
+
+	if (!plane->crtc)
+		return 0;

 	value = WINDOW_A_SELECT << p->index;
 	tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER);


[PATCH] ratelimit the ieee1394 IR legacy activated messages

running coriander1 with an Apple iSight produces lots of dmesg output.

Jul 13 22:14:17 ibook kernel: ieee1394: raw1394: /dev/raw1394 device initialized
Jul 13 22:15:28 ibook kernel: ohci1394: fw-host0: IR legacy activated
Jul 13 22:15:59 ibook last message repeated 208 times
Jul 13 22:17:00 ibook last message repeated 762 times
Jul 13 22:18:01 ibook last message repeated 914 times
Jul 13 22:18:17 ibook last message repeated 238 times
Jul 13 22:18:17 ibook kernel: ieee1394: unsolicited response packet received - no tlabel match
Jul 13 22:18:17 ibook kernel: ohci1394: fw-host0: IR legacy activated

its less noisy with the patch:

Jul 14 08:03:08 ibook kernel: ieee1394: raw1394: /dev/raw1394 device initialized
Jul 14 08:03:26 ibook kernel: ohci1394: fw-host0: IR legacy activated
Jul 14 08:03:42 ibook last message repeated 10 times
Jul 14 08:03:47 ibook kernel: printk: 63 messages suppressed.
Jul 14 08:03:47 ibook kernel: ohci1394: fw-host0: IR legacy activated
Jul 14 08:03:52 ibook kernel: printk: 74 messages suppressed.

Signed-off-by: Olaf Hering <9d781ea8292a2154c6ca4a89a79e3c0c69f1ae9f@suse.de>
Cc: Jody McIntyre <2fe38dc9619fcace8b7ad6df654c4a2da8ef8e2c@modernduck.com>
Cc: Ben Collins <313d575bc822fefc4b8f5cef37aa7dabeb604115@debian.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/ieee1394/ohci1394.c
+++ drivers/ieee1394/ohci1394.c
@@ -1084,7 +1084,8 @@

 			initialize_dma_rcv_ctx(&ohci->ir_legacy_context, 1);

-			PRINT(KERN_ERR, "IR legacy activated");
+			if (printk_ratelimit())
+				PRINT(KERN_ERR, "IR legacy activated");
 		}

                 spin_lock_irqsave(&ohci->IR_channel_lock, flags);


kinetis board identity:fix sign-compare

kinetis board identity:fix sign-compare

--- src/drivers/boards/common/kinetis/board_identity.c
+++ src/drivers/boards/common/kinetis/board_identity.c
@@ -51,7 +51,7 @@
 	uint32_t *chip_uuid = (uint32_t *) KINETIS_SIM_UIDH;
 	uint32_t  *uuid_words = (uint32_t *) uuid_bytes;

-	for (int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
+	for (unsigned int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
 		*uuid_words++ = SWAP_UINT32(chip_uuid[i]);
 	}
 }
@@ -71,7 +71,7 @@
 	int offset = 0;
 	int sep_size = seperator ? strlen(seperator) : 0;

-	for (int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
+	for (unsigned int i = 0; i < PX4_CPU_UUID_WORD32_LENGTH; i++) {
 		offset += snprintf(&format_buffer[offset], size - ((i * 2 * sizeof(uint32_t)) + 1), format, uuid[i]);

 		if (sep_size && i < PX4_CPU_UUID_WORD32_LENGTH - 1) {


iio: mma8452: add copyright notice comment

Signed-off-by: Martin Kepplinger <5f224f582e4d41e2bdb8535d23e6b63d7ab1203d@theobroma-systems.com>
Signed-off-by: Christoph Muellner <bdf9ce27b225f4bff91b927f0d376a51850c94a7@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


iio: vf610_adc: cleanup wait_for_completion return handling

return type of wait_for_completion_timeout is unsigned long not int, this
patch only fixes up the return handling.

Signed-off-by: Nicholas Mc Guire <1f1947151fff46847c7ab253c8b8ee2fc7e63b14@osadl.org>
Signed-off-by: Jonathan Cameron <09f65b71b7655725897b2fd41a09a0cefe2e1ace@kernel.org>


iommu/vt-d: Unify domain->iommu attach/detachment

Move the code to attach/detach domains to iommus and vice
verce into a single function to make sure there are no
dangling references.

Signed-off-by: Joerg Roedel <61aff96566804ea1da8a65de5bcc892ce07caceb@suse.de>


[PATCH] bootmem: use pfn/page conversion macros

It also creates get_mapsize() helper in order to make the code more readable
when it calculates the boot bitmap size.

Signed-off-by: Franck Bui-Huu <1c1c35c3f3736173cb1d0a6d3df6bcfc2bf24c3e@gmail.com>
Cc: Dave Hansen <e169c2064f54e292652f83bb35eed10e1aa33f38@us.ibm.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- mm/bootmem.c
+++ mm/bootmem.c
@@ -9,6 +9,7 @@
  *  system memory and memory holes as well.
  */
 #include <linux/init.h>
+#include <linux/pfn.h>
 #include <linux/bootmem.h>
 #include <linux/module.h>

@@ -68,6 +69,18 @@
 	return;
 }

+/*
+ * Given an initialised bdata, it returns the size of the boot bitmap
+ */
+static unsigned long __init get_mapsize(bootmem_data_t *bdata)
+{
+	unsigned long mapsize;
+	unsigned long start = PFN_DOWN(bdata->node_boot_start);
+	unsigned long end = bdata->node_low_pfn;
+
+	mapsize = ((end - start) + 7) / 8;
+	return ALIGN(mapsize, sizeof(long));
+}

 /*
  * Called once to set up the allocator itself.
@@ -76,11 +89,10 @@
 	unsigned long mapstart, unsigned long start, unsigned long end)
 {
 	bootmem_data_t *bdata = pgdat->bdata;
-	unsigned long mapsize = ((end - start)+7)/8;
-
-	mapsize = ALIGN(mapsize, sizeof(long));
-	bdata->node_bootmem_map = phys_to_virt(mapstart << PAGE_SHIFT);
-	bdata->node_boot_start = (start << PAGE_SHIFT);
+	unsigned long mapsize;
+
+	bdata->node_bootmem_map = phys_to_virt(PFN_PHYS(mapstart));
+	bdata->node_boot_start = PFN_PHYS(start);
 	bdata->node_low_pfn = end;
 	link_bootmem(bdata);

@@ -88,6 +100,7 @@
 	 * Initially all pages are reserved - setup_arch() has to
 	 * register free RAM areas explicitly.
 	 */
+	mapsize = get_mapsize(bdata);
 	memset(bdata->node_bootmem_map, 0xff, mapsize);

 	return mapsize;
@@ -101,20 +114,19 @@
 static void __init reserve_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
 					unsigned long size)
 {
+	unsigned long sidx, eidx;
 	unsigned long i;
+
 	/*
 	 * round up, partially reserved pages are considered
 	 * fully reserved.
 	 */
-	unsigned long sidx = (addr - bdata->node_boot_start)/PAGE_SIZE;
-	unsigned long eidx = (addr + size - bdata->node_boot_start +
-							PAGE_SIZE-1)/PAGE_SIZE;
-	unsigned long end = (addr + size + PAGE_SIZE-1)/PAGE_SIZE;
-
 	BUG_ON(!size);
-	BUG_ON(sidx >= eidx);
-	BUG_ON((addr >> PAGE_SHIFT) >= bdata->node_low_pfn);
-	BUG_ON(end > bdata->node_low_pfn);
+	BUG_ON(PFN_DOWN(addr) >= bdata->node_low_pfn);
+	BUG_ON(PFN_UP(addr + size) > bdata->node_low_pfn);
+
+	sidx = PFN_DOWN(addr - bdata->node_boot_start);
+	eidx = PFN_UP(addr + size - bdata->node_boot_start);

 	for (i = sidx; i < eidx; i++)
 		if (test_and_set_bit(i, bdata->node_bootmem_map)) {
@@ -127,18 +139,15 @@
 static void __init free_bootmem_core(bootmem_data_t *bdata, unsigned long addr,
 				     unsigned long size)
 {
+	unsigned long sidx, eidx;
 	unsigned long i;
-	unsigned long start;
+
 	/*
 	 * round down end of usable mem, partially free pages are
 	 * considered reserved.
 	 */
-	unsigned long sidx;
-	unsigned long eidx = (addr + size - bdata->node_boot_start)/PAGE_SIZE;
-	unsigned long end = (addr + size)/PAGE_SIZE;
-
 	BUG_ON(!size);
-	BUG_ON(end > bdata->node_low_pfn);
+	BUG_ON(PFN_DOWN(addr + size) > bdata->node_low_pfn);

 	if (addr < bdata->last_success)
 		bdata->last_success = addr;
@@ -146,8 +155,8 @@
 	/*
 	 * Round up the beginning of the address.
 	 */
-	start = (addr + PAGE_SIZE-1) / PAGE_SIZE;
-	sidx = start - (bdata->node_boot_start/PAGE_SIZE);
+	sidx = PFN_UP(addr) - PFN_DOWN(bdata->node_boot_start);
+	eidx = PFN_DOWN(addr + size - bdata->node_boot_start);

 	for (i = sidx; i < eidx; i++) {
 		if (unlikely(!test_and_clear_bit(i, bdata->node_bootmem_map)))
@@ -173,7 +182,7 @@
 	      unsigned long align, unsigned long goal, unsigned long limit)
 {
 	unsigned long offset, remaining_size, areasize, preferred;
-	unsigned long i, start = 0, incr, eidx, end_pfn = bdata->node_low_pfn;
+	unsigned long i, start = 0, incr, eidx, end_pfn;
 	void *ret;

 	if(!size) {
@@ -185,23 +194,22 @@
 	if (limit && bdata->node_boot_start >= limit)
 		return NULL;

-        limit >>=PAGE_SHIFT;
+	end_pfn = bdata->node_low_pfn;
+	limit = PFN_DOWN(limit);
 	if (limit && end_pfn > limit)
 		end_pfn = limit;

-	eidx = end_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
+	eidx = end_pfn - PFN_DOWN(bdata->node_boot_start);
 	offset = 0;
-	if (align &&
-	    (bdata->node_boot_start & (align - 1UL)) != 0)
-		offset = (align - (bdata->node_boot_start & (align - 1UL)));
-	offset >>= PAGE_SHIFT;
+	if (align && (bdata->node_boot_start & (align - 1UL)) != 0)
+		offset = align - (bdata->node_boot_start & (align - 1UL));
+	offset = PFN_DOWN(offset);

 	/*
 	 * We try to allocate bootmem pages above 'goal'
 	 * first, then we try to allocate lower pages.
 	 */
-	if (goal && (goal >= bdata->node_boot_start) &&
-	    ((goal >> PAGE_SHIFT) < end_pfn)) {
+	if (goal && goal >= bdata->node_boot_start && PFN_DOWN(goal) < end_pfn) {
 		preferred = goal - bdata->node_boot_start;

 		if (bdata->last_success >= preferred)
@@ -210,9 +218,8 @@
 	} else
 		preferred = 0;

-	preferred = ALIGN(preferred, align) >> PAGE_SHIFT;
-	preferred += offset;
-	areasize = (size+PAGE_SIZE-1)/PAGE_SIZE;
+	preferred = PFN_DOWN(ALIGN(preferred, align)) + offset;
+	areasize = (size + PAGE_SIZE-1) / PAGE_SIZE;
 	incr = align >> PAGE_SHIFT ? : 1;

 restart_scan:
@@ -243,7 +250,7 @@
 	return NULL;

 found:
-	bdata->last_success = start << PAGE_SHIFT;
+	bdata->last_success = PFN_PHYS(start);
 	BUG_ON(start >= eidx);

 	/*
@@ -301,8 +308,8 @@

 	count = 0;
 	/* first extant page of the node */
-	pfn = bdata->node_boot_start >> PAGE_SHIFT;
-	idx = bdata->node_low_pfn - (bdata->node_boot_start >> PAGE_SHIFT);
+	pfn = PFN_DOWN(bdata->node_boot_start);
+	idx = bdata->node_low_pfn - pfn;
 	map = bdata->node_bootmem_map;
 	/* Check physaddr is O(LOG2(BITS_PER_LONG)) page aligned */
 	if (bdata->node_boot_start == 0 ||
@@ -343,9 +350,10 @@
 	 */
 	page = virt_to_page(bdata->node_bootmem_map);
 	count = 0;
-	for (i = 0; i < ((bdata->node_low_pfn-(bdata->node_boot_start >> PAGE_SHIFT))/8 + PAGE_SIZE-1)/PAGE_SIZE; i++,page++) {
+	idx = (get_mapsize(bdata) + PAGE_SIZE-1) >> PAGE_SHIFT;
+	for (i = 0; i < idx; i++, page++) {
+		__free_pages_bootmem(page, 0);
 		count++;
-		__free_pages_bootmem(page, 0);
 	}
 	total += count;
 	bdata->node_bootmem_map = NULL;


drivers: isdn: use new hex_to_bin() method

Remove own implementation of hex_to_bin().

Signed-off-by: Andy Shevchenko <f22fd278e04b059f9eabb8d18172c92cd71ea30e@nokia.com>
Acked-by: Tilman Schmidt <dc8b785d67b4628425f4b275427621124af5d812@imap.cc>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/isdn/gigaset/capi.c
+++ drivers/isdn/gigaset/capi.c
@@ -170,17 +170,6 @@
 }

 /*
- * convert hex to binary
- */
-static inline u8 hex2bin(char c)
-{
-	int result = c & 0x0f;
-	if (c & 0x40)
-		result += 9;
-	return result;
-}
-
-/*
  * convert an IE from Gigaset hex string to ETSI binary representation
  * including length byte
  * return value: result length, -1 on error
@@ -191,7 +180,7 @@
 	while (*in) {
 		if (!isxdigit(in[0]) || !isxdigit(in[1]) || l >= maxlen)
 			return -1;
-		out[++l] = (hex2bin(in[0]) << 4) + hex2bin(in[1]);
+		out[++l] = (hex_to_bin(in[0]) << 4) + hex_to_bin(in[1]);
 		in += 2;
 	}
 	out[0] = l;


leds-hp-disk: fix build warning

leds-hp-disk: fix build warning

drivers/leds/leds-hp-disk.c:59: warning: passing argument 4 of ‘acpi_evaluate_integer’ from incompatible pointer type

Signed-off-by: Len Brown <b060cfa1096cc6e8be83699ddb4ed8a77dd63af5@intel.com>

--- drivers/leds/leds-hp-disk.c
+++ drivers/leds/leds-hp-disk.c
@@ -49,7 +49,7 @@

 static acpi_status hpled_acpi_write(acpi_handle handle, int reg)
 {
-	unsigned long ret; /* Not used when writing */
+	unsigned long long ret; /* Not used when writing */
 	union acpi_object in_obj[1];
 	struct acpi_object_list args = { 1, in_obj };


leds: convert PCA9532 LED driver to devm_kzalloc()

Cc: Riku Voipio <1b2b12f1a98b3f96608883bfc38852bb84b0d6c5@iki.fi>
Signed-off-by: Bryan Wu <465f0e91e61585f5bc1128e7fe63296c33a56926@canonical.com>


sdio: give sdio irq thread a host specific name

There is one thread per host controller so make sure they all get
unique names.

Signed-off-by: Pierre Ossman <8b64f2aeec7ea42cd6838e5b2901f7aa61dfa5d4@drzeus.cx>

--- drivers/mmc/core/sdio_irq.c
+++ drivers/mmc/core/sdio_irq.c
@@ -159,7 +159,8 @@
 	if (!host->sdio_irqs++) {
 		atomic_set(&host->sdio_irq_thread_abort, 0);
 		host->sdio_irq_thread =
-			kthread_run(sdio_irq_thread, host, "ksdiorqd");
+			kthread_run(sdio_irq_thread, host, "ksdioirqd/%s",
+				mmc_hostname(host));
 		if (IS_ERR(host->sdio_irq_thread)) {
 			int err = PTR_ERR(host->sdio_irq_thread);
 			host->sdio_irqs--;


net: move am79c961's probe function to .devinit.text

A pointer to am79c961_probe is passed to the core via
platform_driver_register and so the function must not disappear when the
.init sections are discarded.  Otherwise (if also having HOTPLUG=y)
unbinding and binding a device to the driver via sysfs will result in an
oops as does a device being registered late.

An alternative to this patch is using platform_driver_probe instead of
platform_driver_register plus removing the pointer to the probe function
from the struct platform_driver.

Signed-off-by: Uwe Kleine-König <181323dd666a182bc2d953e52d0ac3ab54cd8391@pengutronix.de>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/arm/am79c961a.c
+++ drivers/net/arm/am79c961a.c
@@ -680,7 +680,7 @@
 #endif
 };

-static int __init am79c961_probe(struct platform_device *pdev)
+static int __devinit am79c961_probe(struct platform_device *pdev)
 {
 	struct resource *res;
 	struct net_device *dev;


be2net: In case of UE, do not dump registers for Lancer

In case of UE, do not dump registers for Lancer as they are not
supported.

Signed-off-by: Padmanabh Ratnakar <d5b49587591187df149d9c5ab392c0cdf197fd56@emulex.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/benet/be_cmds.c
+++ drivers/net/benet/be_cmds.c
@@ -293,7 +293,8 @@

 		if (msecs > 4000) {
 			dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
-			be_detect_dump_ue(adapter);
+			if (!lancer_chip(adapter))
+				be_detect_dump_ue(adapter);
 			return -1;
 		}


be2net: clear intr bit in be_probe()

be2net: clear intr bit in be_probe()

It may be set in the card while the driver is probed by kdump kernel after a
crash.

Signed-off-by: Sathya Perla <1eff9e7106e41e61d300fda4dd1f1162a30aeba8@emulex.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


benet: Add missing comma between constant string array

Multiple quoted strings are concatenated without comma separators.

Make the arrays const while there.

Signed-off-by: Joe Perches <16a9a54ddf4259952e3c118c763138e83693d7fd@perches.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


qlcnic: update version 5.0.2

qlcnic: update version 5.0.2

Update version to indicate IDC(fw recovery) changes.

Signed-off-by: Amit Kumar Salecha <b95978a93e8c5cd598a905aeb6b4a5c23933265e@qlogic.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/qlcnic/qlcnic.h
+++ drivers/net/qlcnic/qlcnic.h
@@ -51,8 +51,8 @@

 #define _QLCNIC_LINUX_MAJOR 5
 #define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 1
-#define QLCNIC_LINUX_VERSIONID  "5.0.1"
+#define _QLCNIC_LINUX_SUBVERSION 2
+#define QLCNIC_LINUX_VERSIONID  "5.0.2"

 #define QLCNIC_VERSION_CODE(a, b, c)	(((a) << 24) + ((b) << 16) + (c))
 #define _major(v)	(((v) >> 24) & 0xff)


regulator: 88pm800: forever loop in pm800_regulator_probe()

This is supposed to be testing "i < ARRAY_SIZE()" instead of just
"ARRAY_SIZE()".

Signed-off-by: Dan Carpenter <ff341aa343d564f9e53e9dcb6996be8c04859a66@oracle.com>
Reviewed-by: Axel Lin <b6ffd6973e972cb999e8e535ab74da7fee0c035f@ingics.com>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@linaro.org>


[SCSI] zfcp: Fix reference counter for remote ports

Fix the remote port reference counter handling during ELS ADISC
commands and find the remote port by WWPN not by D_IDs that could
change.

Signed-off-by: Swen Schillig <b9305175aabd96649683d7df948a63acfe4e638d@vnet.ibm.com>
Signed-off-by: Christof Schmitt <afe27fc9cc8724d5819dd86aabfb0a732dbdb77b@de.ibm.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>

--- drivers/s390/scsi/zfcp_fc.c
+++ drivers/s390/scsi/zfcp_fc.c
@@ -38,18 +38,6 @@
 	struct scatterlist sg_req;
 	struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS];
 };
-
-static struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *adapter,
-					      u32 d_id)
-{
-	struct zfcp_port *port;
-
-	list_for_each_entry(port, &adapter->port_list_head, list)
-		if ((port->d_id == d_id) &&
-		    !atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status))
-			return port;
-	return NULL;
-}

 static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
 				   struct fcp_rscn_element *elem)
@@ -341,12 +329,13 @@

 	zfcp_port_get(port);
 	retval = zfcp_fc_adisc(port);
-	if (retval == 0 || retval == -EBUSY)
+	if (retval == 0)
 		return;

 	/* send of ADISC was not possible */
 	zfcp_port_put(port);
-	zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
+	if (retval != -EBUSY)
+		zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
 }

 static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter)
@@ -503,9 +492,13 @@
 		       acc->port_id[2];

 		/* skip the adapter's port and known remote ports */
-		if (acc->wwpn == fc_host_port_name(adapter->scsi_host) ||
-		     zfcp_get_port_by_did(adapter, d_id))
+		if (acc->wwpn == fc_host_port_name(adapter->scsi_host))
 			continue;
+		port = zfcp_get_port_by_wwpn(adapter, acc->wwpn);
+		if (port) {
+			zfcp_port_get(port);
+			continue;
+		}

 		port = zfcp_port_enqueue(adapter, acc->wwpn,
 					 ZFCP_STATUS_PORT_DID_DID |


[SCSI] mvsas: bug fix of dead lock

[SCSI] mvsas: bug fix of dead lock

TMF task should be issued with Interrupt Disabled, or Deadlock may take place.
Clean-up unused parameters and conditonal lock.

Signed-off-by: Ying Chu <a8bb7266f708a5b00d9520dfb0c998776c9643dd@marvell.com>
Signed-off-by: Andy Yan <9b4c26fc44674a92e21059109ca07945ed622838@marvell.com>
Signed-off-by: Ke Wei <53e9f67ccb3e501b2122e38802c1f2f5524b352b@marvell.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>

--- drivers/scsi/mvsas/mv_sas.c
+++ drivers/scsi/mvsas/mv_sas.c
@@ -868,8 +868,8 @@

 #define	DEV_IS_GONE(mvi_dev)	((!mvi_dev || (mvi_dev->dev_type == NO_DEVICE)))
 static int mvs_task_exec(struct sas_task *task, const int num, gfp_t gfp_flags,
-				struct completion *completion, int lock,
-				int is_tmf, struct mvs_tmf_task *tmf)
+				struct completion *completion,int is_tmf,
+				struct mvs_tmf_task *tmf)
 {
 	struct domain_device *dev = task->dev;
 	struct mvs_info *mvi;
@@ -892,8 +892,7 @@

 	mvi = mvs_find_dev_mvi(task->dev);

-	if (lock)
-		spin_lock_irqsave(&mvi->lock, flags);
+	spin_lock_irqsave(&mvi->lock, flags);
 	do {
 		dev = t->dev;
 		mvi_dev = (struct mvs_device *)dev->lldd_dev;
@@ -1020,15 +1019,14 @@
 		MVS_CHIP_DISP->start_delivery(mvi,
 			(mvi->tx_prod - 1) & (MVS_CHIP_SLOT_SZ - 1));
 	}
-	if (lock)
-		spin_unlock_irqrestore(&mvi->lock, flags);
+	spin_unlock_irqrestore(&mvi->lock, flags);
 	return rc;
 }

 int mvs_queue_command(struct sas_task *task, const int num,
 			gfp_t gfp_flags)
 {
-	return mvs_task_exec(task, num, gfp_flags, NULL, 1, 0, NULL);
+	return mvs_task_exec(task, num, gfp_flags, NULL, 0, NULL);
 }

 static void mvs_slot_free(struct mvs_info *mvi, u32 rx_desc)
@@ -1448,7 +1446,7 @@
 		task->timer.expires = jiffies + MVS_TASK_TIMEOUT*HZ;
 		add_timer(&task->timer);

-		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 0, 1, tmf);
+		res = mvs_task_exec(task, 1, GFP_KERNEL, NULL, 1, tmf);

 		if (res) {
 			del_timer(&task->timer);


scsi: add Intel Multi-Flex to scsi scan blacklist

Intel Multi-Flex LUNs choke on REPORT SUPPORTED OPERATION CODES
resulting in sd_mod hanging for several minutes on startup.
The issue was introduced with WRITE SAME discovery heuristics.

Fixes: 5db44863b6eb ("[SCSI] sd: Implement support for WRITE SAME")
Signed-off-by: Christian Sünkenberg <1eda3f729541be1177e523cb79e5374569a31e35@hfg-karlsruhe.de>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org


staging: dgap: Change GFP_ATOMICs to GFP_KERNEL

We don't need to use GFP_ATOMIC at driver load time
so use GFP_KERNEL instead.

Signed-off-by: Mark Hounschell <2768f22284a3a1a19b282345ce7b3c23351472ff@compro.net>
Tested-by: Mark Hounschell <2768f22284a3a1a19b282345ce7b3c23351472ff@compro.net>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


Staging: hv: netvsc: call vmbus_sendpacket_pagebuffer directly

Don't do the interface indirection, it's not needed at all.

Cc: Haiyang Zhang <6c26c5044f1d67d9ed5db6596adb36d25510e216@microsoft.com>
Cc: Hank Janssen <e6f1dacc1d794bd13c3a15bd13b25100c5d4d1f8@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/hv/netvsc.c
+++ drivers/staging/hv/netvsc.c
@@ -912,12 +912,12 @@
 	sendMessage.Messages.Version1Messages.SendRNDISPacket.SendBufferSectionSize = 0;

 	if (Packet->PageBufferCount) {
-		ret = Device->Driver->VmbusChannelInterface.SendPacketPageBuffer(
-					Device, Packet->PageBuffers,
-					Packet->PageBufferCount,
-					&sendMessage,
-					sizeof(struct nvsp_message),
-					(unsigned long)Packet);
+		ret = vmbus_sendpacket_pagebuffer(Device->channel,
+						  Packet->PageBuffers,
+						  Packet->PageBufferCount,
+						  &sendMessage,
+						  sizeof(struct nvsp_message),
+						  (unsigned long)Packet);
 	} else {
 		ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 				&sendMessage,


add more profiling info in tdb_encode_model

these tend to be the most expensive operations

--- src/tdb_encode_model.c
+++ src/tdb_encode_model.c
@@ -390,6 +390,7 @@
     struct ngram_state g = {.final_freqs = final_freqs};
     Word_t tmp;
     int ret = 0;
+    TDB_TIMER_DEF

     j128m_init(&g.ngram_freqs);
     if ((ret = init_gram_bufs(&g.gbufs, num_fields)))
@@ -404,19 +405,25 @@
        for finding frequent sets (bigrams) */

     /* find unigrams that are sufficiently frequent */
+    TDB_TIMER_START
     if ((ret = find_candidates(unigram_freqs, &g.candidates)))
         goto done;
+    TDB_TIMER_END("encode_model/find_candidates")

     /* collect frequencies of *all* occurring bigrams of candidate unigrams */
+    TDB_TIMER_START
     ret = event_fold(all_bigrams, grouped, num_events, items, num_fields, &g);
     if (ret)
         goto done;
+    TDB_TIMER_END("encode_model/all_bigrams")

     /* collect frequencies of non-overlapping bigrams and unigrams
        (exact covering set for each event), store in final_freqs */
+    TDB_TIMER_START
     ret = event_fold(choose_grams, grouped, num_events, items, num_fields, &g);
     if (ret)
         goto done;
+    TDB_TIMER_END("encode_model/choose_grams")

 done:
 #pragma GCC diagnostic push


USB: class: cdc-acm: Fixed coding style issue.

Fixed coding style issue related to
prohibited space in drivers/usb/class/cdc-acm.c

Signed-off-by: Jeffrin Jose <a38e15590f8e6812c2194dc87dd052da0f71cfba@yahoo.co.in>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


USB: cdc-acm: fix shutdown and suspend race

We should stop I/O unconditionally at suspend rather than rely on the
tty-port initialised flag (which is set prior to stopping I/O during
shutdown) in order to prevent suspend returning with URBs still active.

Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices
that support remote wakeup")

Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>	# v2.6.27
Signed-off-by: Johan Hovold <6a430eed381e126d51a8cce8db662f765ce314bc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


usb: dwc3-msm: Explicitly set clock rates

There's no guarantee from the clock driver that the clocks used
by the DWC3 core will have the frequencies set correctly. Hence,
explicitly call clk_set_rate() at probe time to the right values.

Change-Id: I919117447b54ea004b7b7399568fd86551646eda
Signed-off-by: Jack Pham <cbd79eb9617449d4bb49d0087b0eb70c6cf062b0@codeaurora.org>

--- drivers/usb/dwc3/dwc3-msm.c
+++ drivers/usb/dwc3/dwc3-msm.c
@@ -2275,6 +2275,7 @@
 		goto disable_dwc3_gdsc;
 	}

+	clk_set_rate(mdwc->xo_clk, 19200000);
 	ret = clk_prepare_enable(mdwc->xo_clk);
 	if (ret) {
 		dev_err(&pdev->dev, "%s failed to vote for TCXO buffer%d\n",
@@ -2301,6 +2302,7 @@
 		ret = PTR_ERR(mdwc->iface_clk);
 		goto disable_core_clk;
 	}
+	clk_set_rate(mdwc->iface_clk, 125000000);
 	clk_prepare_enable(mdwc->iface_clk);

 	mdwc->sleep_clk = devm_clk_get(&pdev->dev, "sleep_clk");
@@ -2309,6 +2311,7 @@
 		ret = PTR_ERR(mdwc->sleep_clk);
 		goto disable_iface_clk;
 	}
+	clk_set_rate(mdwc->sleep_clk, 32000);
 	clk_prepare_enable(mdwc->sleep_clk);

 	mdwc->hsphy_sleep_clk = devm_clk_get(&pdev->dev, "sleep_a_clk");
@@ -2325,6 +2328,7 @@
 		ret = PTR_ERR(mdwc->utmi_clk);
 		goto disable_sleep_a_clk;
 	}
+	clk_set_rate(mdwc->utmi_clk, 19200000);
 	clk_prepare_enable(mdwc->utmi_clk);

 	mdwc->ref_clk = devm_clk_get(&pdev->dev, "ref_clk");
@@ -2333,6 +2337,7 @@
 		ret = PTR_ERR(mdwc->ref_clk);
 		goto disable_utmi_clk;
 	}
+	clk_set_rate(mdwc->ref_clk, 19200000);
 	clk_prepare_enable(mdwc->ref_clk);

 	mdwc->id_state = mdwc->ext_xceiv.id = DWC3_ID_FLOAT;