Rename index to idx to avoid symbol conflicts.

Picky compilers with old index() string functions.
Reviewed-by: Matt Caswell <1fa2ef4755a9226cb9a0a4840bd89b158ac71391@openssl.org>

--- crypto/ec/ecp_nistz256.c
+++ crypto/ec/ecp_nistz256.c
@@ -116,13 +116,13 @@
                           const BN_ULONG in[P256_LIMBS]);
 /* Functions that perform constant time access to the precomputed tables */
 void ecp_nistz256_scatter_w5(P256_POINT *val,
-                             const P256_POINT *in_t, int index);
+                             const P256_POINT *in_t, int idx);
 void ecp_nistz256_gather_w5(P256_POINT *val,
-                            const P256_POINT *in_t, int index);
+                            const P256_POINT *in_t, int idx);
 void ecp_nistz256_scatter_w7(P256_POINT_AFFINE *val,
-                             const P256_POINT_AFFINE *in_t, int index);
+                             const P256_POINT_AFFINE *in_t, int idx);
 void ecp_nistz256_gather_w7(P256_POINT_AFFINE *val,
-                            const P256_POINT_AFFINE *in_t, int index);
+                            const P256_POINT_AFFINE *in_t, int idx);

 /* One converted into the Montgomery domain */
 static const BN_ULONG ONE[P256_LIMBS] = {
@@ -563,7 +563,7 @@
                                       int num, BN_CTX *ctx)
 {
     int i, j;
-    unsigned int index;
+    unsigned int idx;
     unsigned char (*p_str)[33] = NULL;
     const unsigned int window_size = 5;
     const unsigned int mask = (1 << (window_size + 1)) - 1;
@@ -666,10 +666,10 @@
         ecp_nistz256_scatter_w5  (row, &temp[1], 16);
     }

-    index = 255;
-
-    wvalue = p_str[0][(index - 1) / 8];
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
+    idx = 255;
+
+    wvalue = p_str[0][(idx - 1) / 8];
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;

     /*
      * We gather to temp[0], because we know it's position relative
@@ -678,12 +678,12 @@
     ecp_nistz256_gather_w5(&temp[0], table[0], _booth_recode_w5(wvalue) >> 1);
     memcpy(r, &temp[0], sizeof(temp[0]));

-    while (index >= 5) {
-        for (i = (index == 255 ? 1 : 0); i < num; i++) {
-            unsigned int off = (index - 1) / 8;
+    while (idx >= 5) {
+        for (i = (idx == 255 ? 1 : 0); i < num; i++) {
+            unsigned int off = (idx - 1) / 8;

             wvalue = p_str[i][off] | p_str[i][off + 1] << 8;
-            wvalue = (wvalue >> ((index - 1) % 8)) & mask;
+            wvalue = (wvalue >> ((idx - 1) % 8)) & mask;

             wvalue = _booth_recode_w5(wvalue);

@@ -695,7 +695,7 @@
             ecp_nistz256_point_add(r, r, &temp[0]);
         }

-        index -= window_size;
+        idx -= window_size;

         ecp_nistz256_point_double(r, r);
         ecp_nistz256_point_double(r, r);
@@ -943,7 +943,7 @@
     unsigned char sign1, digit1;
     unsigned char sign2, digit2;
     unsigned char sign3, digit3;
-    unsigned int index = 0;
+    unsigned int idx = 0;
     BN_ULONG tmp[P256_LIMBS];
     int i;

@@ -955,19 +955,19 @@
     /* Initial four windows */
     wvalue = *((u16 *) & p_str[0]);
     wvalue = (wvalue << 1) & mask;
-    index += window_size;
+    idx += window_size;
     booth_recode_w7(&sign0, &digit0, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign1, &digit1, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign2, &digit2, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign3, &digit3, wvalue);

     ecp_nistz256_avx2_multi_gather_w7(point_arr, preComputedTable[0],
@@ -987,21 +987,21 @@
     ecp_nistz256_avx2_to_mont(&aX4[4 * 9], &aX4[4 * 9]);
     ecp_nistz256_avx2_set1(&aX4[4 * 9 * 2]);

-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign0, &digit0, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign1, &digit1, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign2, &digit2, wvalue);
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-    index += window_size;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+    idx += window_size;
     booth_recode_w7(&sign3, &digit3, wvalue);

     ecp_nistz256_avx2_multi_gather_w7(point_arr, preComputedTable[4 * 1],
@@ -1023,21 +1023,21 @@
     ecp_nistz256_avx2_point_add_affines_x4(aX4, aX4, bX4);

     for (i = 2; i < 9; i++) {
-        wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-        wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-        index += window_size;
+        wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+        wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+        idx += window_size;
         booth_recode_w7(&sign0, &digit0, wvalue);
-        wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-        wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-        index += window_size;
+        wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+        wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+        idx += window_size;
         booth_recode_w7(&sign1, &digit1, wvalue);
-        wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-        wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-        index += window_size;
+        wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+        wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+        idx += window_size;
         booth_recode_w7(&sign2, &digit2, wvalue);
-        wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-        wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-        index += window_size;
+        wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+        wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+        idx += window_size;
         booth_recode_w7(&sign3, &digit3, wvalue);

         ecp_nistz256_avx2_multi_gather_w7(point_arr,
@@ -1066,8 +1066,8 @@

     ecp_nistz256_avx2_convert_transpose_back(res_point_arr, aX4);
     /* Last window is performed serially */
-    wvalue = *((u16 *) & p_str[(index - 1) / 8]);
-    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
+    wvalue = *((u16 *) & p_str[(idx - 1) / 8]);
+    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
     booth_recode_w7(&sign0, &digit0, wvalue);
     ecp_nistz256_gather_w7((P256_POINT_AFFINE *)r,
                            preComputedTable[36], digit0);
@@ -1129,7 +1129,7 @@
     const PRECOMP256_ROW *preComputedTable = NULL;
     const EC_PRE_COMP *pre_comp = NULL;
     const EC_POINT *generator = NULL;
-    unsigned int index = 0;
+    unsigned int idx = 0;
     const unsigned int window_size = 7;
     const unsigned int mask = (1 << (window_size + 1)) - 1;
     unsigned int wvalue;
@@ -1249,7 +1249,7 @@
             {
                 /* First window */
                 wvalue = (p_str[0] << 1) & mask;
-                index += window_size;
+                idx += window_size;

                 wvalue = _booth_recode_w7(wvalue);

@@ -1262,10 +1262,10 @@
                 memcpy(p.p.Z, ONE, sizeof(ONE));

                 for (i = 1; i < 37; i++) {
-                    unsigned int off = (index - 1) / 8;
+                    unsigned int off = (idx - 1) / 8;
                     wvalue = p_str[off] | p_str[off + 1] << 8;
-                    wvalue = (wvalue >> ((index - 1) % 8)) & mask;
-                    index += window_size;
+                    wvalue = (wvalue >> ((idx - 1) % 8)) & mask;
+                    idx += window_size;

                     wvalue = _booth_recode_w7(wvalue);


qemuDomainBuildNamespace: Populate disks from daemon's namespace

As mentioned in one of previous commits, populating domain's
namespace from pre-exec() hook is dangerous. This commit moves
population of the namespace with domain disks into daemon's
namespace.

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

--- src/qemu/qemu_namespace.c
+++ src/qemu/qemu_namespace.c
@@ -482,33 +482,29 @@

 static int
 qemuDomainSetupDisk(virStorageSourcePtr src,
-                    const struct qemuDomainCreateDeviceData *data)
+                    char ***paths)
 {
     virStorageSourcePtr next;
     bool hasNVMe = false;

     for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
-        VIR_AUTOSTRINGLIST targetPaths = NULL;
-        size_t i;
+        g_autofree char *tmpPath = NULL;

         if (next->type == VIR_STORAGE_TYPE_NVME) {
-            g_autofree char *nvmePath = NULL;
-
             hasNVMe = true;

-            if (!(nvmePath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
-                return -1;
-
-            if (qemuDomainCreateDevice(nvmePath, data, false) < 0)
+            if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
                 return -1;
         } else {
-            if (!next->path || !virStorageSourceIsLocalStorage(next)) {
+            VIR_AUTOSTRINGLIST targetPaths = NULL;
+
+            if (virStorageSourceIsEmpty(next) ||
+                !virStorageSourceIsLocalStorage(next)) {
                 /* Not creating device. Just continue. */
                 continue;
             }

-            if (qemuDomainCreateDevice(next->path, data, false) < 0)
-                return -1;
+            tmpPath = g_strdup(next->path);

             if (virDevMapperGetTargets(next->path, &targetPaths) < 0 &&
                 errno != ENOSYS) {
@@ -518,20 +514,21 @@
                 return -1;
             }

-            for (i = 0; targetPaths && targetPaths[i]; i++) {
-                if (qemuDomainCreateDevice(targetPaths[i], data, false) < 0)
-                    return -1;
-            }
-        }
+            if (virStringListMerge(paths, &targetPaths) < 0)
+                return -1;
+        }
+
+        if (virStringListAdd(paths, tmpPath) < 0)
+            return -1;
     }

     /* qemu-pr-helper might require access to /dev/mapper/control. */
     if (src->pr &&
-        qemuDomainCreateDevice(QEMU_DEVICE_MAPPER_CONTROL_PATH, data, true) < 0)
+        virStringListAdd(paths, QEMU_DEVICE_MAPPER_CONTROL_PATH) < 0)
         return -1;

     if (hasNVMe &&
-        qemuDomainCreateDevice(QEMU_DEV_VFIO, data, false) < 0)
+        virStringListAdd(paths, QEMU_DEV_VFIO) < 0)
         return -1;

     return 0;
@@ -540,14 +537,15 @@

 static int
 qemuDomainSetupAllDisks(virDomainObjPtr vm,
-                        const struct qemuDomainCreateDeviceData *data)
+                        char ***paths)
 {
     size_t i;
+
     VIR_DEBUG("Setting up disks");

     for (i = 0; i < vm->def->ndisks; i++) {
         if (qemuDomainSetupDisk(vm->def->disks[i]->src,
-                                data) < 0)
+                                paths) < 0)
             return -1;
     }

@@ -865,6 +863,9 @@
     if (qemuDomainPopulateDevices(cfg, &paths) < 0)
         return -1;

+    if (qemuDomainSetupAllDisks(vm, &paths) < 0)
+        return -1;
+
     if (qemuNamespaceMknodPaths(vm, (const char **) paths) < 0)
         return -1;

@@ -914,9 +915,6 @@
         goto cleanup;

     if (qemuDomainSetupDev(mgr, vm, devPath) < 0)
-        goto cleanup;
-
-    if (qemuDomainSetupAllDisks(vm, &data) < 0)
         goto cleanup;

     if (qemuDomainSetupAllHostdevs(vm, &data) < 0)
@@ -1638,55 +1636,12 @@
 qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
                              virStorageSourcePtr src)
 {
-    virStorageSourcePtr next;
     VIR_AUTOSTRINGLIST paths = NULL;
-    bool hasNVMe = false;

     if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
         return 0;

-    for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
-        g_autofree char *tmpPath = NULL;
-
-        if (next->type == VIR_STORAGE_TYPE_NVME) {
-            hasNVMe = true;
-
-            if (!(tmpPath = virPCIDeviceAddressGetIOMMUGroupDev(&next->nvme->pciAddr)))
-                return -1;
-        } else {
-            VIR_AUTOSTRINGLIST targetPaths = NULL;
-
-            if (virStorageSourceIsEmpty(next) ||
-                !virStorageSourceIsLocalStorage(next)) {
-                /* Not creating device. Just continue. */
-                continue;
-            }
-
-            tmpPath = g_strdup(next->path);
-
-            if (virDevMapperGetTargets(next->path, &targetPaths) < 0 &&
-                errno != ENOSYS) {
-                virReportSystemError(errno,
-                                     _("Unable to get devmapper targets for %s"),
-                                     next->path);
-                return -1;
-            }
-
-            if (virStringListMerge(&paths, &targetPaths) < 0)
-                return -1;
-        }
-
-        if (virStringListAdd(&paths, tmpPath) < 0)
-            return -1;
-    }
-
-    /* qemu-pr-helper might require access to /dev/mapper/control. */
-    if (src->pr &&
-        virStringListAdd(&paths, QEMU_DEVICE_MAPPER_CONTROL_PATH) < 0)
-        return -1;
-
-    if (hasNVMe &&
-        virStringListAdd(&paths, QEMU_DEV_VFIO) < 0)
+    if (qemuDomainSetupDisk(src, &paths) < 0)
         return -1;

     if (qemuNamespaceMknodPaths(vm, (const char **) paths) < 0)


Style.

Style.


use more QPC features in MPRGP

use more QPC features in MPRGP

--- src/qps/impls/mpgp/mpgp.c
+++ src/qps/impls/mpgp/mpgp.c
@@ -186,26 +186,6 @@
   PetscFunctionReturn(0);
 }

-
-#undef __FUNCT__
-#define __FUNCT__ "MPGPProj"
-/*
-MPGPProj - realize projection to feasible set
-
-Parameters:
-+ x - vector of variables
-. lb - vector of lower bounds
-- ub - vector of upper bounds
-*/
-static PetscErrorCode MPGPProj(Vec x, Vec lb, Vec ub)
-{
-  PetscFunctionBegin;
-  if (ub) TRY( VecPointwiseMin(x,x,ub) );
-  if (lb) TRY( VecPointwiseMax(x,x,lb) );
-  PetscFunctionReturn(0);
-}
-
-
 #undef __FUNCT__
 #define __FUNCT__ "MPGPGrads"
 /*
@@ -215,159 +195,30 @@
 + qps - QP solver
 - g - gradient
 */
-static PetscErrorCode MPGPGrads(QPS qps, Vec x, Vec lb, Vec ub, Vec g)
-{
-  PetscInt          i;                  /* ... iterator                         */
-  PetscInt          m;                  /* ... local size                       */
+static PetscErrorCode MPGPGrads(QPS qps, Vec x, Vec g)
+{
+  QP                qp;
+  QPC               qpc;

   Vec               gP;                 /* ... projected gradient               */
   Vec               gr;                 /* ... reduced free gradient            */
   Vec               beta;               /* ... chopped gradient                 */
   Vec               phi;                /* ... free gradient                    */

-  /* vector arrays */
-  PetscScalar       *x_a, *lb_a, *ub_a, *g_a, *phi_a, *beta_a, *gP_a, *gr_a;
-
   QPS_MPGP          *mpgp = (QPS_MPGP*)qps->data;
-  PetscReal         alpha;
-
-  PetscFunctionBegin;
-  TRY( VecGetLocalSize(g, &m) );
+
+  PetscFunctionBegin;
+  TRY( QPSGetSolvedQP(qps,&qp) );
+  TRY( QPGetQPC(qp,&qpc) );

   gP                = qps->work[0];
   gr                = qps->work[6];
   phi               = qps->work[1];
   beta              = qps->work[2];
-  alpha             = 1.0/mpgp->alpha;
-
-  TRY( VecWAXPY(gr,-1.0,lb,x) ); /* gr = x-lb */
-  TRY( VecWAXPY(gP,-1.0,ub,x) ); /* gP = x-ub */
-
-  /* get local arrays */
-  TRY( VecGetArray(x, &x_a) );
-  TRY( VecGetArray(lb, &lb_a) );
-  TRY( VecGetArray(ub, &ub_a) );
-  TRY( VecGetArray(g, &g_a) );
-  TRY( VecGetArray(phi, &phi_a) );
-  TRY( VecGetArray(beta, &beta_a) );
-  TRY( VecGetArray(gP, &gP_a) );
-  TRY( VecGetArray(gr, &gr_a) );
-
-  /* go through the local array and fill the gradients */
-  for (i = 0; i < m; i++){
-      if (PetscAbsScalar(gr_a[i]) < mpgp->btol) {
-          /* index of this component is in ACTIVE SET */
-          phi_a[i] = 0.0;
-          gr_a[i] = 0.0;
-          /* active lower bound */
-          beta_a[i]= PetscMin(g_a[i],0.0);
-      } else if (PetscAbsScalar(gP_a[i]) < mpgp->btol) {
-         /* index of this component is in ACTIVE SET */
-          phi_a[i] = 0.0;
-          gr_a[i] = 0.0;
-          /* active upper bound */
-          beta_a[i]= PetscMax(g_a[i],0.0);
-      } else {
-          /* index of this component is in FREE SET */
-          phi_a[i] = g_a[i];
-          beta_a[i] = 0.0;
-          gr_a[i] = alpha*gr_a[i];
-          if (g_a[i] > 0) {
-            if (g_a[i] < gr_a[i]) gr_a[i] = g_a[i];
-          } else {
-            gr_a[i] = alpha*gP_a[i];
-            if (g_a[i] > gr_a[i]) gr_a[i] = g_a[i];
-          }
-      }
-
-      /* compute projected gradient */
-      gP_a[i] = phi_a[i] + beta_a[i];
-
-  }
-
-  /* restore local arrays */
-  TRY( VecRestoreArray(x, &x_a) );
-  TRY( VecRestoreArray(lb, &lb_a) );
-  TRY( VecRestoreArray(ub, &ub_a) );
-  TRY( VecRestoreArray(g, &g_a) );
-  TRY( VecRestoreArray(phi, &phi_a) );
-  TRY( VecRestoreArray(beta, &beta_a) );
-  TRY( VecRestoreArray(gP, &gP_a) );
-  TRY( VecRestoreArray(gr, &gr_a) );
-  PetscFunctionReturn(0);
-}
-
-#undef __FUNCT__
-#define __FUNCT__ "MPGPFeas"
-/*
-MPGPFeas - compute the largest feasible step alpha,
-  i.e. lb <= x-alpha*p <= ub
-
-  MATLAB:
-  i = find(p > 0);
-  alpha_f1 = inf;
-  if min(size(i)) > 0
-      alpha_f1 = min((x(i)-l1(i))./p(i));
-  end
-  j = find(p < 0);
-  alpha_f2 = inf;
-  if min(size(j)) > 0
-      alpha_f2 = min((x(j)-l2(j))./p(j));
-  end
-  alpha_f = min(alpha_f1,alpha_f2);
-
-Parameters:
-+ x - vector of actual iteration
-. lb - vector of lower bounds
-. ub - vector of upper bounds
-. p - vector of direction
-- *alpha - pointer to return value
-*/
-static PetscErrorCode MPGPFeas(Vec x, Vec lb, Vec ub, Vec p, PetscScalar *alpha)
-{
-  PetscInt          i, m;
-  PetscScalar       *x_a, *lb_a, *ub_a, *p_a;
-  PetscScalar       alpha_temp, alpha_loc;
-
-  PetscFunctionBegin;
-
-  /* get local arrays */
-  TRY( VecGetLocalSize(x,&m) );
-  TRY( VecGetArray(x,    &x_a) );
-  TRY( VecGetArray(lb,   &lb_a) );
-  TRY( VecGetArray(ub,   &ub_a) );
-  TRY( VecGetArray(p,    &p_a) );
-
-  /* the initial value of max feasible step-size */
-  alpha_loc = PETSC_INFINITY;
-
-  /* go through local arrays */
-  for (i=0; i<m; i++) {
-    /* max step to lower bound */
-    if (p_a[i] > 0.0) {
-      alpha_temp=x_a[i]-lb_a[i];
-      alpha_temp=alpha_temp/p_a[i];
-      if (alpha_temp < alpha_loc) alpha_loc=alpha_temp;
-    }
-
-    /* max step to upper bound */
-    if (p_a[i] < 0.0) {
-      alpha_temp=x_a[i]-ub_a[i];
-      alpha_temp=alpha_temp/p_a[i];
-      if (alpha_temp < alpha_loc) alpha_loc=alpha_temp;
-    }
-  }
-
-  /* compute the minimal alpha from all computed maximal steps */
-  TRY( MPI_Allreduce(&alpha_loc, alpha, 1, MPIU_SCALAR, MPIU_MIN, PetscObjectComm((PetscObject)x)) );
-
-  if (*alpha >= PETSC_INFINITY) *alpha = 0.0;
-
-  /* restore vectors */
-  TRY( VecRestoreArray(x, &x_a) );
-  TRY( VecRestoreArray(lb,&lb_a) );
-  TRY( VecRestoreArray(ub,&ub_a) );
-  TRY( VecRestoreArray(p, &p_a) );
+
+  TRY( QPCGrads(qpc,x,g,phi,beta) );
+  TRY( QPCGradReduced(qpc,x,phi,mpgp->alpha,gr) );
+  TRY( VecWAXPY(gP,1.0,phi,beta) );
   PetscFunctionReturn(0);
 }

@@ -383,7 +234,6 @@
 {
   QPS_MPGP          *mpgp = (QPS_MPGP*)qps->data;
   Vec               lb,ub,y;
-  PetscScalar       min;

   PetscFunctionBegin;
   /* reset statistics*/
@@ -419,28 +269,6 @@
     mpgp->alpha = mpgp->alpha_user;
   }
   TRY( PetscInfo1(qps,  "alpha      = %.8e\n", mpgp->alpha) );
-
-  if (ub) {
-    /* check that lb < ub */
-    TRY( VecWAXPY(y,-1.0,lb,ub) );
-    TRY( VecMin(y,NULL,&min) );
-    if (min <= 0.0) {
-      FLLOP_SETERRQ(PetscObjectComm((PetscObject)qps),PETSC_ERR_ARG_INCOMP,"lower bounds must be less than upper bounds");
-    }
-  } else {
-    QPC qpc;
-    Vec lub;
-
-    //TODO make MPGP compatible with ub = NULL
-    /* create ub=inf(size(lb)) */
-    TRY( VecDuplicate(lb,&ub) );
-    TRY( VecSet(ub,PETSC_INFINITY) );
-    TRY( QPSetBox(qps->solQP,NULL,lb,ub) );
-
-    TRY( QPGetQPC(qps->solQP,&qpc) );
-    TRY( QPCBoxGetMultipliers(qpc,NULL,&lub) );
-    TRY( VecSet(lub,0.0) );
-  }
   PetscFunctionReturn(0);
 }

@@ -456,10 +284,10 @@
 {
   QPS_MPGP          *mpgp = (QPS_MPGP*)qps->data;
   QP                qp;
+  QPC               qpc;
   Mat               A;                  /* ... hessian matrix                   */
   Vec               b;                  /* ... right-hand side vector           */
   Vec               x;                  /* ... vector of variables              */
-  Vec               lb, ub;             /* ... lower and upper bound            */
   Vec               gP;                 /* ... projected gradient               */
   Vec               beta;               /* ... chopped gradient                 */
   Vec               phi;                /* ... free gradient                    */
@@ -496,19 +324,19 @@
   gamma             = mpgp->gamma;

   TRY( QPSGetSolvedQP(qps,&qp) );
+  TRY( QPGetQPC(qp,&qpc) );                       /* get constraints */
   TRY( QPGetSolutionVector(qp, &x) );             /* get the solution vector */
   TRY( QPGetOperator(qp, &A) );                   /* get hessian matrix */
   TRY( QPGetRhs(qp, &b) );                        /* get right-hand side vector */
-  TRY( QPGetBox(qp, NULL, &lb, &ub) );            /* get lower and upper bounds */
-
-  TRY( MPGPProj(x, lb, ub) );                     /* project x initial guess to feasible set */
+
+  TRY( QPCProject(qpc,x,x) );                     /* project x initial guess to feasible set */

   /* compute gradient */
   TRY( MatMult(A, x, g) );                        /* g=A*x */
   nmv++;                                          /* matrix multiplication counter */
   TRY( VecAXPY(g, -1.0, b) );                     /* g=g-b */

-  TRY( MPGPGrads(qps, x, lb, ub, g) );            /* grad. splitting  gP,phi,beta */
+  TRY( MPGPGrads(qps, x, g) );            /* grad. splitting  gP,phi,beta */

   /* initiate CG method */
   TRY( VecCopy(phi, p) );                         /* p=phi */
@@ -545,7 +373,7 @@
       TRY( VecDot(p, Ap, &pAp) );                 /* pAp=p'*Ap      */
       TRY( VecDot(g,  p, &acg) );                 /* acg=g'*p       */
       acg  = acg/pAp;                             /* acg=acg/pAp    */
-      TRY( MPGPFeas(x, lb, ub, p, &afeas) );      /* finds max.feas.steplength */
+      TRY( QPCFeas(qpc, x, p, &afeas) );          /* finds max.feas.steplength */

       /* decide if it is able to do full CG step */
       if (acg <= afeas)
@@ -558,7 +386,7 @@
         TRY( VecAXPY(x, -acg, p) );               /* x=x-acg*p      */
         TRY( VecAXPY(g, -acg, Ap) );              /* g=g-acg*Ap      */

-        TRY( MPGPGrads(qps, x, lb, ub, g) );      /* grad. splitting  gP,phi,beta */
+        TRY( MPGPGrads(qps, x, g) );      /* grad. splitting  gP,phi,beta */

         /* compute orthogonalization parameter and next orthogonal vector */
         TRY( VecDot(Ap, phi, &bcg) );             /* bcg=Ap'*phi     */
@@ -572,18 +400,18 @@
         TRY( VecAXPY(x, -afeas, p) );             /* x=x-afeas*p*/
         TRY( VecAXPY(g, -afeas, Ap) );            /* g=g-afeas*Ap    */

-        TRY( MPGPGrads(qps, x, lb, ub, g) );      /* grad. splitting  gP,phi,beta,gr */
+        TRY( MPGPGrads(qps, x, g) );      /* grad. splitting  gP,phi,beta,gr */

         /* make one more projected gradient step with constant step-length */
         TRY( VecAXPY(x, -alpha, phi) );           /* x=x-abar*phi */
-        TRY( MPGPProj(x, lb, ub) );               /* project x to feas.set */
+        TRY( QPCProject(qpc, x, x) );             /* project x to feas.set */

         /* compute new gradient */
         TRY( MatMult(A, x, g) );                  /* g=A*x */
         nmv++;                                    /* matrix multiplication counter */
         TRY( VecAXPY(g, -1.0, b) );               /* g=g-b           */

-        TRY( MPGPGrads(qps, x, lb, ub, g) );      /* grad. splitting  gP,phi,beta */
+        TRY( MPGPGrads(qps, x, g) );              /* grad. splitting  gP,phi,beta */

         /* restart CG method */
         TRY( VecCopy(phi, p) );                   /* p=phi           */
@@ -611,7 +439,7 @@
       TRY( VecAXPY(x, -acg, p) );                 /* x=x-acg*p       */
       TRY( VecAXPY(g, -acg, Ap) );                /* g=g-acg*Ap      */

-      TRY( MPGPGrads(qps, x, lb, ub, g) );        /* grad. splitting  gP,phi,beta */
+      TRY( MPGPGrads(qps, x, g) );        /* grad. splitting  gP,phi,beta */

       /* restart CG method */
       TRY( VecCopy(phi, p) );                     /* p=phi           */


Add array debug printing

Add array debug printing

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

--- tests/test_tools.h
+++ tests/test_tools.h
@@ -0,0 +1,26 @@
+#ifndef SCC_UT_TEST_TOOLS_HG
+#define SCC_UT_TEST_TOOLS_HG
+
+#include "test_suite.h"
+
+#include <stdio.h>
+#include "../include/config.h"
+
+#define scc_ut_print_Vid_array(to_print, length) _scc_ut_print_Vid_array(to_print, length, #to_print, __LINE__)
+
+void _scc_ut_print_Vid_array(const scc_Vid* const to_print,
+                                    const size_t length,
+                                    const char* const name,
+                                    const int line) {
+	printf("%i:%s: ", line, name);
+
+	if (length == 0) {
+		printf("[]\n");
+	} else {
+		printf("[%ju", (uintmax_t)to_print[0]);
+		for (size_t i = 1; i < length; ++i) printf(", %ju", (uintmax_t)to_print[i]);
+		printf("]\n");
+	}
+}
+
+#endif


drm/amdkfd: Don't create BUG due to incorrect user parameter

This patch changes a BUG_ON() statement to pr_debug, in case the user tries to
update a non-existing queue.

Signed-off-by: Oded Gabbay <c2fce4493a16d94b58efb315151c29911fc5d347@amd.com>
Reviewed-by: Ben Goz <7ad054068e22862b74505c1139ad54a17792b0d9@amd.com>
Reviewed-by: Jammy Zhou <302958b3037f7fa601b11152090f51ed851f29fd@amd.com>
Reviewed-by: Alex Deucher <08dc22c6156113f2deff178e35e3ed9b24d6af9e@amd.com>

--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -315,7 +315,11 @@
 	BUG_ON(!pqm);

 	pqn = get_queue_by_qid(pqm, qid);
-	BUG_ON(!pqn);
+	if (!pqn) {
+		pr_debug("amdkfd: No queue %d exists for update operation\n",
+				qid);
+		return -EFAULT;
+	}

 	pqn->q->properties.queue_address = p->queue_address;
 	pqn->q->properties.queue_size = p->queue_size;


caps-channel-manager.c: add assert: update_capabilities cannot be called on channel manager that does not implement the caps interface

--- src/caps-channel-manager.c
+++ src/caps-channel-manager.c
@@ -147,11 +147,9 @@
     GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
   GabbleCapsChannelManagerCopyCapsFunc method = iface->update_caps;

-  if (method != NULL)
-    {
-      method (caps_manager, specific_caps_out, specific_caps_in);
-    }
-  /* ... else, do what? */
+  /* cannot be called if not implemented */
+  g_assert (method != NULL);
+  method (caps_manager, specific_caps_out, specific_caps_in);
 }

 gboolean gabble_caps_channel_manager_capabilities_diff (


version 0.9.4

version 0.9.4

Haplotype calling cleanup.

--- src/Version.h
+++ src/Version.h
@@ -1,2 +1,2 @@
-#define FREEBAYES_VERSION "0.9.3"
-#define FREEBAYES_COMPILE_DATE "2011-10-14"
+#define FREEBAYES_VERSION "0.9.4"
+#define FREEBAYES_COMPILE_DATE "2011-10-28"


oops, typo (tests passed by chance)

oops, typo (tests passed by chance)

--- Cython/Utility/Optimize.c
+++ Cython/Utility/Optimize.c
@@ -297,9 +297,9 @@
         static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
         const char *name = PyUnicode_AsUTF8(method_name);
         PyObject **pp = NULL;
-        if (strcmp(name, "iteritems")) pp = &py_items;
-        else if (strcmp(name, "iterkeys")) pp = &py_keys;
-        else if (strcmp(name, "itervalues")) pp = &py_values;
+        if (strcmp(name, "iteritems") == 0) pp = &py_items;
+        else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
+        else if (strcmp(name, "itervalues") == 0) pp = &py_values;
         if (pp) {
             if (!*pp) {
                 *pp = PyUnicode_FromString(name + 4);


Staging: sbe-2t3e3: logical || vs bitwise |

Bitwise OR was clearly intended here.

Signed-off-by: Dan Carpenter <ff341aa343d564f9e53e9dcb6996be8c04859a66@oracle.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/sbe-2t3e3/intr.c
+++ drivers/staging/sbe-2t3e3/intr.c
@@ -188,7 +188,7 @@
 			}

 			if (sc->s.LOS) {
-				error_mask &= ~(SBE_2T3E3_RX_DESC_DRIBBLING_BIT ||
+				error_mask &= ~(SBE_2T3E3_RX_DESC_DRIBBLING_BIT |
 						SBE_2T3E3_RX_DESC_MII_ERROR);
 			}


target/spc: Only expose PI mode page bits when supported by fabric

Only expose the control modepage bit for Application Tag Owner (ATO)
if the session + fabric support DIX PASS operations.

Reviewed-by: Sagi Grimberg <380ce2a82d3d08e67ab163b51dc6d30288ad3f13@mellanox.com>
Cc: Martin K. Petersen <0384aaef27f06874adbdb09a807bb339f4aff9fd@oracle.com>
Cc: Or Gerlitz <de1b678a59344538ef9f2ddb34a5f9486544e2f9@mellanox.com>
Cc: Quinn Tran <a02f5c47ee09ecfb205631316fdc727ed52eb140@qlogic.com>
Cc: Giridhar Malavali <799b6491fce2c7a80b5fedcf9a728560cc9eb954@qlogic.com>
Signed-off-by: Nicholas Bellinger <978acd1567d5598152161fdf8bf3ca568f950c9b@linux-iscsi.org>

--- drivers/target/target_core_spc.c
+++ drivers/target/target_core_spc.c
@@ -769,7 +769,7 @@
 	return ret;
 }

-static int spc_modesense_rwrecovery(struct se_device *dev, u8 pc, u8 *p)
+static int spc_modesense_rwrecovery(struct se_cmd *cmd, u8 pc, u8 *p)
 {
 	p[0] = 0x01;
 	p[1] = 0x0a;
@@ -782,8 +782,11 @@
 	return 12;
 }

-static int spc_modesense_control(struct se_device *dev, u8 pc, u8 *p)
-{
+static int spc_modesense_control(struct se_cmd *cmd, u8 pc, u8 *p)
+{
+	struct se_device *dev = cmd->se_dev;
+	struct se_session *sess = cmd->se_sess;
+
 	p[0] = 0x0a;
 	p[1] = 0x0a;

@@ -875,8 +878,10 @@
 	 * type, shall not modify the contents of the LOGICAL BLOCK REFERENCE
 	 * TAG field.
 	 */
-	if (dev->dev_attrib.pi_prot_type)
-		p[5] |= 0x80;
+	if (sess->sup_prot_ops & (TARGET_PROT_DIN_PASS | TARGET_PROT_DOUT_PASS)) {
+		if (dev->dev_attrib.pi_prot_type)
+			p[5] |= 0x80;
+	}

 	p[8] = 0xff;
 	p[9] = 0xff;
@@ -886,8 +891,10 @@
 	return 12;
 }

-static int spc_modesense_caching(struct se_device *dev, u8 pc, u8 *p)
-{
+static int spc_modesense_caching(struct se_cmd *cmd, u8 pc, u8 *p)
+{
+	struct se_device *dev = cmd->se_dev;
+
 	p[0] = 0x08;
 	p[1] = 0x12;

@@ -903,7 +910,7 @@
 	return 20;
 }

-static int spc_modesense_informational_exceptions(struct se_device *dev, u8 pc, unsigned char *p)
+static int spc_modesense_informational_exceptions(struct se_cmd *cmd, u8 pc, unsigned char *p)
 {
 	p[0] = 0x1c;
 	p[1] = 0x0a;
@@ -919,7 +926,7 @@
 static struct {
 	uint8_t		page;
 	uint8_t		subpage;
-	int		(*emulate)(struct se_device *, u8, unsigned char *);
+	int		(*emulate)(struct se_cmd *, u8, unsigned char *);
 } modesense_handlers[] = {
 	{ .page = 0x01, .subpage = 0x00, .emulate = spc_modesense_rwrecovery },
 	{ .page = 0x08, .subpage = 0x00, .emulate = spc_modesense_caching },
@@ -1057,7 +1064,7 @@
 			 * the only two possibilities).
 			 */
 			if ((modesense_handlers[i].subpage & ~subpage) == 0) {
-				ret = modesense_handlers[i].emulate(dev, pc, &buf[length]);
+				ret = modesense_handlers[i].emulate(cmd, pc, &buf[length]);
 				if (!ten && length + ret >= 255)
 					break;
 				length += ret;
@@ -1070,7 +1077,7 @@
 	for (i = 0; i < ARRAY_SIZE(modesense_handlers); ++i)
 		if (modesense_handlers[i].page == page &&
 		    modesense_handlers[i].subpage == subpage) {
-			length += modesense_handlers[i].emulate(dev, pc, &buf[length]);
+			length += modesense_handlers[i].emulate(cmd, pc, &buf[length]);
 			goto set_length;
 		}

@@ -1102,7 +1109,6 @@

 static sense_reason_t spc_emulate_modeselect(struct se_cmd *cmd)
 {
-	struct se_device *dev = cmd->se_dev;
 	char *cdb = cmd->t_task_cdb;
 	bool ten = cdb[0] == MODE_SELECT_10;
 	int off = ten ? 8 : 4;
@@ -1138,7 +1144,7 @@
 		if (modesense_handlers[i].page == page &&
 		    modesense_handlers[i].subpage == subpage) {
 			memset(tbuf, 0, SE_MODE_PAGE_BUF);
-			length = modesense_handlers[i].emulate(dev, 0, tbuf);
+			length = modesense_handlers[i].emulate(cmd, 0, tbuf);
 			goto check_contents;
 		}


Read "WindowsForceFeedbackDevice" for compatibility

--- src/Wrapper.c
+++ src/Wrapper.c
@@ -461,6 +461,8 @@
 				useSpringForceFeedbackEffect = atoi(line + 29);
 			else if (!strncasecmp("ForceFeedbackDevice=", line, 20))
 				forceFeedbackDevice = atoi(line + 20);
+			else if (forceFeedbackDevice < 0 && !strncasecmp("WindowsForceFeedbackDevice=", line, 27))
+				forceFeedbackDevice = atoi(line + 27);
 			else if (!strncasecmp("LinearSoundInterpolation=", line, 25))
 				linearSoundInterpolation = !!atoi(line + 25);
 			else if (!strncasecmp("UseGlBleginGlEnd=", line, 17))


tpl_contact_from_room_id: allow room with an empty name

--- telepathy-logger/contact.c
+++ telepathy-logger/contact.c
@@ -202,7 +202,7 @@
 {
   TplContact *ret;

-  g_return_val_if_fail (!TPL_STR_EMPTY (chatroom_id), NULL);
+  g_return_val_if_fail (chatroom_id != NULL, NULL);

   ret = tpl_contact_new (chatroom_id);
   tpl_contact_set_alias (ret, chatroom_id);


adapter: Always set new default adapter if current one is removed

In case hci_get_route() failed mark first adapter on list as default.
This make sure default adapter is always set and that
btd_adapter_get_default will not return NULL if at least one adapter
is registered.

--- src/adapter.c
+++ src/adapter.c
@@ -5539,8 +5539,10 @@
 		struct btd_adapter *new_default;

 		new_default = adapter_find_by_id(hci_get_route(NULL));
-		if (new_default)
-			new_default->is_default = true;
+		if (new_default == NULL)
+			new_default = adapters->data;
+
+		new_default->is_default = true;
 	}

 	adapter_list = g_list_remove(adapter_list, adapter);


Packed structs are not portable, so the code has been rewritten do work without packed structs. (see http://groups-beta.google.com/group/comp.unix.programmer/browse_thread/thread/917ca3a9bfdc40c1/9aba4e48ff9cdcd0#9aba4e48ff9cdcd0 ) Dds still needs some endianess work, though.

--- DevIL/src-IL/src/il_dds.c
+++ DevIL/src-IL/src/il_dds.c
@@ -96,31 +96,35 @@

 // Internal function used to get the .dds header from the current file.
 ILboolean iGetDdsHead(DDSHEAD *Header)
-{
-	if (iread(Header, sizeof(DDSHEAD), 1) != 1)
-		return IL_FALSE;
-
-	UInt(&Header->Size1);
-	UInt(&Header->Flags1);
-	UInt(&Header->Height);
-	UInt(&Header->Width);
-	UInt(&Header->LinearSize);
-	UInt(&Header->Depth);
-	UInt(&Header->MipMapCount);
-	UInt(&Header->AlphaBitDepth);
-	UInt(&Header->Size2);
-	UInt(&Header->Flags2);
-	UInt(&Header->FourCC);
-	UInt(&Header->RGBBitCount);
-	UInt(&Header->RBitMask);
-	UInt(&Header->GBitMask);
-	UInt(&Header->BBitMask);
-	UInt(&Header->RGBAlphaBitMask);
-	UInt(&Header->ddsCaps1);
-	UInt(&Header->ddsCaps2);
-	UInt(&Header->ddsCaps3);
-	UInt(&Header->ddsCaps4);
-	UInt(&Header->TextureStage);
+{
+	ILint i;
+
+	iread(&Header->Signature, 1, 4);
+	Header->Size1 = GetLittleUInt();
+	Header->Flags1 = GetLittleUInt();
+	Header->Height = GetLittleUInt();
+	Header->Width = GetLittleUInt();
+	Header->LinearSize = GetLittleUInt();
+	Header->Depth = GetLittleUInt();
+	Header->MipMapCount = GetLittleUInt();
+	Header->AlphaBitDepth = GetLittleUInt();
+
+	for (i = 0; i < 10; ++i)
+		Header->NotUsed[i] = GetLittleUInt();
+
+	Header->Size2 = GetLittleUInt();
+	Header->Flags2 = GetLittleUInt();
+	Header->FourCC = GetLittleUInt();
+	Header->RGBBitCount = GetLittleUInt();
+	Header->RBitMask = GetLittleUInt();
+	Header->GBitMask = GetLittleUInt();
+	Header->BBitMask = GetLittleUInt();
+	Header->RGBAlphaBitMask = GetLittleUInt();
+	Header->ddsCaps1 = GetLittleUInt();
+	Header->ddsCaps2 = GetLittleUInt();
+	Header->ddsCaps3 = GetLittleUInt();
+	Header->ddsCaps4 = GetLittleUInt();
+	Header->TextureStage = GetLittleUInt();

 	if (Head.Depth == 0)
 		Head.Depth = 1;


* change writting.

  * change writting.

git-svn-id: 941c396c0c997e7bb438e0bf88317cdf88a3ff60@1148 1a406e8e-add9-4483-a2c8-d8cac5b7c224

--- src/chxj_img_conv_format.c
+++ src/chxj_img_conv_format.c
@@ -238,10 +238,8 @@
   else
     spec = chxj_specified_device(r, user_agent);

-  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "found device_name=[%s]",
-                  spec->device_name);
-  ap_log_rerror(APLOG_MARK,APLOG_DEBUG, 0, r, "User-Agent=[%s]",
-                  user_agent);
+  DBG1(r,"found device_name=[%s]", spec->device_name);
+  DBG1(r,"User-Agent=[%s]", user_agent);

   if (spec->width == 0 || spec->heigh == 0)
     return HTTP_NOT_FOUND;


cosmetic

cosmetic

--- Library/Sources/Stroika/Foundation/Containers/Set.h
+++ Library/Sources/Stroika/Foundation/Containers/Set.h
@@ -18,10 +18,6 @@
  *
  *
  *  TODO:
- *      @todo   Add/FIX three-way-comparer support - operator<=> etc - for Set. I Think it can be
- *              easily defined as operator<> on ELT, followed by operator<> on value and then as a string
- *              of those operations.
- *
  *      @todo   Started using concepts on CTORs, but make sure THIS supports the appropriate new Container
  *              concepts and that it USES that for the appropriate overloaded constructors.
  *
@@ -336,7 +332,7 @@
 #if __cpp_impl_three_way_comparison >= 201907
     public:
         /**
-         * simply indirect to @Set<>::EqualsComparer
+         * simply indirect to @Set<>::EqualsComparer (always defined because Set<> knows how to compare T items.
          */
         nonvirtual bool operator== (const Set& rhs) const;
         nonvirtual bool operator== (const Iterable<T>& rhs) const;


Initialize callinfo error variable

Initialize callinfo error variable

--- src/rpc/connection/loop.c
+++ src/rpc/connection/loop.c
@@ -66,6 +66,7 @@
   /* generate callinfo */
   cinfo->msgid = request->msgid;
   cinfo->hasresponse = false;
+  cinfo->errorresponse = false;

   /* push callinfo to connection callinfo vector */
   kv_push(struct callinfo *, con->callvector, cinfo);


symlink-cache: fix return value of readlink

- sc_readlink wrongly returned strlen (link) + 1 when link was present in
    cache.
  - this fixes rt #828. Since fuse_readlink_cbk does link[op_ret] = '\0', there
    was a memory corruption.

Signed-off-by: Anand V. Avati <6a1810c170bd423868ce2e225ecea39d80cade0f@amp.gluster.com>

--- xlators/performance/symlink-cache/src/symlink-cache.c
+++ xlators/performance/symlink-cache/src/symlink-cache.c
@@ -91,7 +91,7 @@

 int
 sc_cache_set (xlator_t *this, inode_t *inode, struct stat *buf,
-	      const char *link)
+              const char *link)
 {
 	struct symlink_cache *sc = NULL;
 	int                   ret = -1;
@@ -268,7 +268,7 @@
 		gf_log (this->name, GF_LOG_DEBUG,
 			"cache hit %s -> %s",
 			loc->path, link);
-		STACK_UNWIND (frame, strlen (link) + 1, 0, link);
+		STACK_UNWIND (frame, strlen (link), 0, link);
 		FREE (link);
 		return 0;
 	}


Bug fix

Bug fix

--- src/allvars.h
+++ src/allvars.h
@@ -2029,7 +2029,7 @@
         L_200mean_excl_gas[0]=L_200mean_excl_gas[1]=L_200mean_excl_gas[2]=0;
         L_BN98_excl_gas[0]=L_BN98_excl_gas[1]=L_BN98_excl_gas[2]=0;
 #ifdef STARON
-        n_gas_sf = n_gas_nfs = 0;
+        n_gas_sf = n_gas_nsf = 0;
         M_gas_sf=M_gas_sf_rvmax=M_gas_sf_30kpc=M_gas_sf_50kpc=0;
         L_gas_sf[0]=L_gas_sf[1]=L_gas_sf[2]=0;
         q_gas_sf=s_gas_sf=1.0;


enabled DICOM reading without MBI_INTERNAL

--- Qmitk/QmitkApplicationBase/QmitkMainTemplate.ui.h
+++ Qmitk/QmitkApplicationBase/QmitkMainTemplate.ui.h
@@ -54,12 +54,20 @@
 #include <mitkDSRFileReader.h>
 #include <mitkCylindricToCartesianFilter.h>
 #include <itksys/SystemTools.hxx>
+#else
+  #include "itkImage.h"
+  #include "itkImageFileReader.h"
+  #include "itkDICOMImageIO2.h"
+  #include "itkImageSeriesReader.h"
+  #include "itkDICOMSeriesFileNames.h"
+  #include "QmitkCommonFunctionality.h"
 #endif

 #include <mitkParRecFileReader.h>
 #include <mitkInteractionConst.h>
 #include <QmitkStatusBar/QmitkStatusBar.h>

+
 mitk::FloatProperty::Pointer opacityprop=NULL;

 void QmitkMainTemplate::fileNew()
@@ -72,7 +80,7 @@
 #ifdef MBI_INTERNAL
   QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.ves *.uvg *.par *.dcm hpsonos.db HPSONOS.DB);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;vessel files (*.ves *.uvg);;par/rec files (*.par);;DSR files (hpsonos.db HPSONOS.DB);;DICOM files (*.dcm)");
 #else
-  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.ves *.uvg *.par);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;par/rec files (*.par)");
+  QString fileName = QFileDialog::getOpenFileName(NULL,"all (*.seq *.pic *.pic.gz *.seq.gz *.pvtk *.stl *.vtk *.ves *.uvg *.par);;DKFZ Pic (*.seq *.pic *.pic.gz *.seq.gz);;surface files (*.stl *.vtk);;stl files (*.stl);;vtk surface files (*.vtk);;vtk image files (*.pvtk);;par/rec files (*.par);;DICOM files (*.dcm)");
 #endif

   if ( !fileName.isNull() )
@@ -283,12 +291,12 @@
     initWidgets(it);
     delete it;
   }
-  else if(strstr(fileName, "DCM")!=0)
+  else if(strstr(fileName, "DCM")!=0 || strstr(fileName, "dcm")!=0)
   {
     mitk::DICOMFileReader::Pointer reader;

     reader=mitk::DICOMFileReader::New();
-    std::cout << "loading " << fileName << " as pic ... " << std::endl;
+    std::cout << "loading " << fileName << " as DICOM... " << std::endl;

     reader->SetFileName(fileName);

@@ -487,6 +495,77 @@
     }

     mitkMultiWidget->levelWindowWidget->setLevelWindow(levelWindow);
+
+    initWidgets(it);
+
+    delete it;
+  }
+#else
+  if(strstr(fileName, "DCM")!=0 || strstr(fileName, "dcm")!=0)
+  {
+    QString tmpName = fileName;
+    QString dir = tmpName.left(tmpName.findRev("/",tmpName.length())+1);
+
+    typedef itk::Image<unsigned short,3>            ImageType;
+    typedef itk::ImageSeriesReader< ImageType >     ReaderType;
+
+    itk::DICOMImageIO2::Pointer dicomIO = itk::DICOMImageIO2::New();
+
+    // Get the DICOM filenames from the directory
+    itk::DICOMSeriesFileNames::Pointer nameGenerator = itk::DICOMSeriesFileNames::New();
+    nameGenerator->SetDirectory( dir.ascii() );
+
+    typedef std::vector<std::string> seriesIdContainer;
+    const seriesIdContainer & seriesUID = nameGenerator->GetSeriesUIDs();
+
+    seriesIdContainer::const_iterator seriesItr = seriesUID.begin();
+    seriesIdContainer::const_iterator seriesEnd = seriesUID.end();
+
+    std::cout << std::endl << "The directory: " << std::endl;
+    std::cout << std::endl << dir << std::endl << std::endl;
+    std::cout << "Contains the following DICOM Series: ";
+    std::cout << std::endl << std::endl;
+
+    while( seriesItr != seriesEnd )
+    {
+      std::cout << seriesItr->c_str() << std::endl;
+      seriesItr++;
+    }
+
+    std::cout << std::endl << std::endl;
+    std::cout << "Now reading series: " << std::endl << std::endl;
+
+    typedef std::vector<std::string> fileNamesContainer;
+    fileNamesContainer fileNames;
+
+    std::cout << seriesUID.begin()->c_str() << std::endl;
+    fileNames = nameGenerator->GetFileNames();
+
+    ReaderType::Pointer reader = ReaderType::New();
+    reader->SetFileNames( fileNames );
+    reader->SetImageIO( dicomIO );
+
+    try
+    {
+      reader->Update();
+    }
+    catch (itk::ExceptionObject &ex)
+    {
+      std::cout << ex << std::endl;
+      return;
+    }
+    mitk::DataTreeIterator* it=tree->inorderIterator();
+
+    CommonFunctionality::AddItkImageToDataTree<ImageType>(reader->GetOutput(),it,fileName);
+
+
+    // disable volume rendering by default
+//    node->SetProperty("volumerendering",new mitk::BoolProperty(false));
+
+    //mitk::LevelWindow levelWindow;
+    //reader->Update();
+    //node->SetLevelWindow(levelWindow, NULL);
+    //mitkMultiWidget->levelWindowWidget->setLevelWindow(levelWindow);

     initWidgets(it);


fix MacOS Build

fix MacOS Build

--- ui/typeview.h
+++ ui/typeview.h
@@ -175,7 +175,7 @@
 	virtual std::vector<std::string> getNavigationModes() override;

 	uint64_t findMatchingLine(const BinaryNinja::QualifiedName& name, uint64_t offset,
-		uint64_t& cursorOffset);
+		size_t& cursorOffset);
 	bool navigateToType(const std::string& name, uint64_t offset = 0);

 	virtual void OnTypeDefined(BinaryNinja::BinaryView* view, const BinaryNinja::QualifiedName& name,


Drivers: DxeInit: remove ExitBootServicesEvent

LK may need events which can't be used during an event.
this also means that any linux loader has to manually call platform_uninit now.

--- Drivers/DxeInit/DxeInit.c
+++ Drivers/DxeInit/DxeInit.c
@@ -23,8 +23,6 @@
 #include <Library/PcdLib.h>
 #include <LittleKernel.h>
 #include <Library/UefiBootServicesTableLib.h>
-
-EFI_EVENT             EfiExitBootServicesEvent = (EFI_EVENT)NULL;

 STATIC VOID
 lkapi_event_init(VOID** event)
@@ -55,17 +53,6 @@
   ASSERT_EFI_ERROR (Status);
 }

-VOID
-EFIAPI
-ExitBootServicesEvent (
-  IN EFI_EVENT  Event,
-  IN VOID       *Context
-  )
-{
-  lkapi_t* LKApi = GetLKApi();
-  LKApi->platform_uninit();
-}
-
 EFI_STATUS
 EFIAPI
 DxeInitInitialize (
@@ -73,7 +60,6 @@
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUS Status;
   lkapi_t* LKApi = GetLKApi();

   PcdSet32 (PcdGicDistributorBase, LKApi->int_get_dist_base());
@@ -85,9 +71,5 @@
   LKApi->event_wait = lkapi_event_wait;
   LKApi->event_signal = lkapi_event_signal;

-  // Register for an ExitBootServicesEvent
-  Status = gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent);
-  ASSERT_EFI_ERROR (Status);
-
   return EFI_SUCCESS;
 }


Do not use inline asm for debugbreak on non i386/x86_64 targets

Fixes compilation on non i386/x86_64 Linux targets.

Don't use arch specific assembly for other architectures because
in most cases it breaks gdb ability to do next step.

Signed-off-by: Danylo Piliaiev <8378ae5317bb8096ca0545d3a500a19f9686c9cf@igalia.com>

--- renderdoc/common/common.h
+++ renderdoc/common/common.h
@@ -48,7 +48,7 @@
 #include <stdlib.h>
 #define OS_DEBUG_BREAK() abort()

-#elif ENABLED(RDOC_LINUX)
+#elif ENABLED(RDOC_LINUX) && (defined(__i386__) || defined(__x86_64__))

 #define OS_DEBUG_BREAK()           \
   do                               \


star bool

star bool

--- utils/star.h
+++ utils/star.h
@@ -1,5 +1,7 @@
 #ifndef _STAR_H_
 #define _STAR_H_
+
+// star(x) computes the infinite sum x^0 + x^1 + x^2 + ...

 template <typename T>
 T star(const T& x) {
@@ -9,4 +11,8 @@
   return T(1) / (T(1) - x);
 }

+bool star(bool x) {
+  return x;
+}
+
 #endif


tolow

tolow

error: pathspec 'linux/tolow.c' did not match any file(s) known to git


fixed compile struct/class missmatch

fixed compile struct/class missmatch

--- core/componentsystem.h
+++ core/componentsystem.h
@@ -99,8 +99,9 @@
   ComponentSystemSpriteDrawStore spriteDraw;
 };

-struct World
+class World
 {
+public:
   EntReg   reg;
   Systems* systems;


Resolve -Wall errors in xenguest_stubs.c, register local with OCaml GC

Resolved all -Wall errors, except implicit declarations of libxc code which
isn't exported by xenctrl.h. Called CAMLxparams on recently added
no_incr_generationid parameter, which had been omitted from the caml local
params init code.

Signed-off-by: Mike McClurg <d5d39725aee3103039228164deec3c7acc6f60e3@citrix.com>

--- ocaml/xenguest/xenguest_stubs.c
+++ ocaml/xenguest/xenguest_stubs.c
@@ -12,6 +12,9 @@
  * GNU Lesser General Public License for more details.
  */

+#define _GNU_SOURCE
+
+#include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <inttypes.h>
@@ -126,8 +129,7 @@
 static char *
 xenstore_getsv(int domid, const char *fmt, va_list ap)
 {
-    char *path = NULL, *s;
-    uint64_t value = 0;
+    char *path = NULL, *s = NULL;
     struct xs_handle *xsh = NULL;
     int n, m;
     char key[1024];
@@ -275,7 +277,7 @@
     f->ramdisk_max_size = vm_pv_ramdisk_max_size ? vm_pv_ramdisk_max_size : host_pv_ramdisk_max_size;

     printf("Determined the following parameters from xenstore:");
-    printf("vcpu/number:%d vcpu/weight:%d vcpu/cap:%d nx: %d viridian: %d apic: %d acpi: %d pae: %d acpi_s4: %d acpi_s3: %d mmio_size_mib: %ld tsc_mode %d",
+    printf("vcpu/number:%d vcpu/weight:%d vcpu/cap:%d nx: %d viridian: %d apic: %d acpi: %d pae: %d acpi_s4: %d acpi_s3: %d mmio_size_mib: %lld tsc_mode %d",
            f->vcpus,f->vcpu_weight,f->vcpu_cap,f->nx,f->viridian,f->apic,f->acpi,f->pae,f->acpi_s4,f->acpi_s3,f->mmio_size_mib,f->tsc_mode);
     for (n = 0; n < f->vcpus; n++){
         printf("vcpu/%d/affinity:%s", n, (f->vcpu_affinity[n])?f->vcpu_affinity[n]:"unset");
@@ -536,7 +538,6 @@
     CAMLlocal1(result);

     char *image_name_c = strdup(String_val(image_name));
-    char *error[256];
     xc_interface *xch;

     unsigned long store_mfn=0;
@@ -621,11 +622,11 @@

 }

-static struct save_callbacks save_callbacks = {
-    .suspend = dispatch_suspend,
-    .switch_qemu_logdirty = switch_qemu_logdirty,
-    .checkpoint = NULL,
-};
+/* static struct save_callbacks save_callbacks = { */
+/*     .suspend = dispatch_suspend, */
+/*     .switch_qemu_logdirty = switch_qemu_logdirty, */
+/*     .checkpoint = NULL, */
+/* }; */

 #define GENERATION_ID_ADDRESS "hvmloader/generation-id-address"

@@ -761,15 +762,17 @@
                                       value hvm, value no_incr_generationid)
 {
     CAMLparam5(handle, fd, domid, store_evtchn, console_evtchn);
-    CAMLxparam1(hvm);
+    CAMLxparam2(hvm, no_incr_generationid);
     CAMLlocal1(result);
     unsigned long store_mfn, console_mfn;
     domid_t c_store_domid, c_console_domid;
+
+#ifdef XENGUEST_4_2
     unsigned long c_vm_generationid_addr;
-    char c_vm_generationid_addr_s[32];
+#endif
+
     unsigned int c_store_evtchn, c_console_evtchn;
     int r;
-    size_t size, written;

 #ifdef XC_HAS_4_1_NEW_GENERATION_ID_INTERFACE
     genid_cb_data_t genid_cb_data = { _D(domid) };


No need to make restart public

No need to make restart public

--- src/ios/MultipeerConnectivity/THEMultipeerSession.h
+++ src/ios/MultipeerConnectivity/THEMultipeerSession.h
@@ -47,9 +47,6 @@
 // Stop discovering and advertising, must be called before destrution
 - (void)stop;

-// Restart discovery and advertising without affecting existing sessions
-- (void)restart;
-
 // Connects to the peer server with the specified peer identifier. |connectCallback| will
 // be called when the connection completes with first param being any error message or nil and
 // second param being the port number the relay is listening on


vatrace: print frame_type for VP8 encoding

Signed-off-by: Austin Yuan <f447c34e4ebcef84a81b40a8d4dbc448a14e5570@intel.com>
(cherry picked from commit 1a011ce5bb0b80506797a25a988854f3f81ce909)

--- va/va_trace.c
+++ va/va_trace.c
@@ -2413,7 +2413,8 @@
     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_gf = %d\n", p->ref_flags.bits.no_ref_gf);
     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_arf = %d\n", p->ref_flags.bits.no_ref_arf);
     va_TraceMsg(trace_ctx, "\tref_flags.bits.no_ref_arf = 0x%08x\n", p->ref_flags.bits.reserved);
-
+
+    va_TraceMsg(trace_ctx, "\tpic_flags.bits.frame_type = %d\n", p->pic_flags.bits.frame_type);
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.version = %d\n", p->pic_flags.bits.version);
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.show_frame = %d\n", p->pic_flags.bits.show_frame);
     va_TraceMsg(trace_ctx, "\tpic_flags.bits.color_space = %d\n", p->pic_flags.bits.color_space);


i#1551 Port DynamoRIO to ARM: fix mangle_indirect_jump mode change bug
- add "orr r2, r2, #1" instr in T32 mode only if it is OP_mov or OP_add

Review-URL: https://codereview.appspot.com/202260043

--- core/arch/arm/mangle.c
+++ core/arch/arm/mangle.c
@@ -932,9 +932,10 @@
             }
         }
         ASSERT(found_pc);
-        if (isa_mode == DR_ISA_ARM_THUMB) {
-            /* Thumb writes to the PC (OP_add and OP_mov are all that's allowed)
-             * are non-mode-changing branches, so we set LSB to 1.
+        if (isa_mode == DR_ISA_ARM_THUMB &&
+            (instr_get_opcode(instr) == OP_mov || instr_get_opcode(instr) == OP_add)) {
+            /* Some Thumb write-to-PC instructions (OP_add and OP_mov) are simple
+             * non-mode-changing branches, so we set LSB to 1.
              */
             opnd_t src = opnd_create_reg(IBL_TARGET_REG);
             if (instr_get_opcode(instr) == OP_mov && !instr_is_predicated(instr)) {


dabba: refactor interface status id list handling.

Signed-off-by: Emmanuel Roullit <e51ad7dcb99c77ecf30f537962c562ac80636eba@gmail.com>

--- dabba/interface-status.c
+++ dabba/interface-status.c
@@ -48,6 +48,7 @@
 static void interface_status_list_print(const Dabba__InterfaceStatusList *
 					result, void *closure_data)
 {
+	Dabba__InterfaceStatus *statusp;
 	protobuf_c_boolean *status = (protobuf_c_boolean *) closure_data;
 	size_t a;

@@ -56,15 +57,14 @@
 	display_interface_status_header();

 	for (a = 0; result && a < result->n_list; a++) {
-		printf("    - name: %s\n", result->list[a]->id->name);
+		statusp = result->list[a];
+		printf("    - name: %s\n", statusp->id->name);
 		printf("      status: {");
-		printf("connectivity: %s, ",
-		       print_tf(result->list[a]->connectivity));
-		printf("up: %s, ", print_tf(result->list[a]->up));
-		printf("running: %s, ", print_tf(result->list[a]->running));
-		printf("promiscuous: %s, ",
-		       print_tf(result->list[a]->promiscous));
-		printf("loopback: %s", print_tf(result->list[a]->loopback));
+		printf("connectivity: %s, ", print_tf(statusp->connectivity));
+		printf("up: %s, ", print_tf(statusp->up));
+		printf("running: %s, ", print_tf(statusp->running));
+		printf("promiscuous: %s, ", print_tf(statusp->promiscous));
+		printf("loopback: %s", print_tf(statusp->loopback));
 		printf("}\n");
 	}

@@ -80,13 +80,13 @@
 		OPT_INTERFACE_ID,
 		OPT_HELP,
 	};
-
 	const struct option interface_status_option[] = {
 		{"id", required_argument, NULL, OPT_INTERFACE_ID},
 		{"server", required_argument, NULL, OPT_SERVER_ID},
 		{NULL, 0, NULL, 0},
 	};
 	int ret, rc = 0;
+	Dabba__InterfaceId **idpp;

 	assert(list);

@@ -98,16 +98,22 @@
 			*server_name = optarg;
 			break;
 		case OPT_INTERFACE_ID:
-			list->list =
+			idpp =
 			    realloc(list->list,
 				    sizeof(*list->list) * (list->n_list + 1));

-			if (!list->list)
+			if (!idpp)
 				return ENOMEM;

+			list->list = idpp;
 			list->list[list->n_list] =
 			    malloc(sizeof(*list->list[list->n_list]));
+
+			if (!list->list[list->n_list])
+				return ENOMEM;
+
 			dabba__interface_id__init(list->list[list->n_list]);
+
 			list->list[list->n_list]->name = optarg;
 			list->n_list++;


Mark filters lists as static.

Mark filters lists as static.

--- configuration.c
+++ configuration.c
@@ -42,17 +42,17 @@
 #include "configuration.h"
 #include "rule.h"

-struct filter *input_filters = NULL;
-struct filter *output_filters = NULL;
-struct filter *redistribute_filters = NULL;
-struct filter *install_filters = NULL;
+static struct filter *input_filters = NULL;
+static struct filter *output_filters = NULL;
+static struct filter *redistribute_filters = NULL;
+static struct filter *install_filters = NULL;
 struct interface_conf *default_interface_conf = NULL;
-struct interface_conf *interface_confs = NULL;
+static struct interface_conf *interface_confs = NULL;

 /* This indicates whether initial configuration is done.  See
    finalize_config below. */

-int config_finalised = 0;
+static int config_finalised = 0;

 /* This file implements a recursive descent parser with one character
    lookahead.  The looked-ahead character is returned from most


* Writing is changed.

  * Writing is changed.

git-svn-id: 941c396c0c997e7bb438e0bf88317cdf88a3ff60@833 1a406e8e-add9-4483-a2c8-d8cac5b7c224

--- src/chxj_load_emoji_data.c
+++ src/chxj_load_emoji_data.c
@@ -212,7 +212,9 @@
   for (child = qs_get_child_node(doc, node);
        child ;
        child = qs_get_next_node(doc, child)) {
+
     char* name  = qs_get_node_name(doc, child);
+
     if (strcasecmp(name, "hex1") == 0)
     {
       Node* hex1node = qs_get_child_node(doc, child);


marking `MTKCatchException` as hidden.  This isn't really part of the test kit and really primarily exists for the purposes of making the exception assertion tests work.  Exception assertion tests will be modified to return any caught exception in addition to passing or failing.

--- MetovaTestKit/ExceptionTesting/MTKExceptionTester.h
+++ MetovaTestKit/ExceptionTesting/MTKExceptionTester.h
@@ -27,6 +27,8 @@
 //  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //

+#pragma GCC visibility push(hidden)
+
 #import <Foundation/Foundation.h>

 /**
@@ -42,3 +44,5 @@

  */
 NSException * __nullable MTKCatchException(__attribute__((noescape)) void (^ __nonnull testBlock)());
+
+#pragma GCC visibility pop


support Bidirectional ep transfer for usb_fs

--- port/ch32/usb_dc_usbfs.c
+++ port/ch32/usb_dc_usbfs.c
@@ -38,8 +38,9 @@
 struct ch32_usbfs_udc {
     __attribute__((aligned(4))) struct usb_setup_packet setup;
     volatile uint8_t dev_addr;
-    struct ch32_usbfs_ep_state in_ep[USB_NUM_BIDIR_ENDPOINTS];  /*!< IN endpoint parameters*/
-    struct ch32_usbfs_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS]; /*!< OUT endpoint parameters */
+    struct ch32_usbfs_ep_state in_ep[USB_NUM_BIDIR_ENDPOINTS];                            /*!< IN endpoint parameters*/
+    struct ch32_usbfs_ep_state out_ep[USB_NUM_BIDIR_ENDPOINTS];                           /*!< OUT endpoint parameters */
+    __attribute__((aligned(4))) uint8_t ep_databuf[USB_NUM_BIDIR_ENDPOINTS - 1][64 + 64]; //epx_out(64)+epx_in(64)
 } g_ch32_usbfs_udc;

 volatile bool ep0_rx_data_toggle;
@@ -68,6 +69,14 @@
     USBFS_DEVICE->UEP5_6_MOD = USBFS_UEP5_RX_EN | USBFS_UEP5_TX_EN | USBFS_UEP6_RX_EN | USBFS_UEP6_TX_EN;
     USBFS_DEVICE->UEP7_MOD = USBFS_UEP7_RX_EN | USBFS_UEP7_TX_EN;

+    USBFS_DEVICE->UEP1_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[0];
+    USBFS_DEVICE->UEP2_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[1];
+    USBFS_DEVICE->UEP3_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[2];
+    USBFS_DEVICE->UEP4_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[3];
+    USBFS_DEVICE->UEP5_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[4];
+    USBFS_DEVICE->UEP6_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[5];
+    USBFS_DEVICE->UEP7_DMA = (uint32_t)g_ch32_usbfs_udc.ep_databuf[6];
+
     USBFS_DEVICE->INT_FG = 0xFF;
     USBFS_DEVICE->INT_EN = USBFS_UIE_SUSPEND | USBFS_UIE_BUS_RST | USBFS_UIE_TRANSFER;
     USBFS_DEVICE->DEV_ADDR = 0x00;
@@ -150,6 +159,7 @@
     }
     return 0;
 }
+
 int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled)
 {
     return 0;
@@ -158,7 +168,6 @@
 int usbd_ep_start_write(const uint8_t ep, const uint8_t *data, uint32_t data_len)
 {
     uint8_t ep_idx = USB_EP_GET_IDX(ep);
-    uint32_t tmp;

     if (!data && data_len) {
         return -1;
@@ -193,7 +202,7 @@
         } else {
             data_len = MIN(data_len, g_ch32_usbfs_udc.in_ep[ep_idx].ep_mps);
             USB_SET_TX_LEN(ep_idx, data_len);
-            USB_SET_DMA(ep_idx, (uint32_t)data);
+            memcpy(&g_ch32_usbfs_udc.ep_databuf[ep_idx - 1][64], data, data_len);
         }
         USB_SET_TX_CTRL(ep_idx, (USB_GET_TX_CTRL(ep_idx) & ~USBFS_UEP_T_RES_MASK) | USBFS_UEP_T_RES_ACK);
     }
@@ -229,7 +238,6 @@
         }
         return 0;
     } else {
-        USB_SET_DMA(ep_idx, (uint32_t)data);
         USB_SET_RX_CTRL(ep_idx, (USB_GET_RX_CTRL(ep_idx) & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_ACK);
     }

@@ -238,7 +246,7 @@

 void USBD_IRQHandler(void)
 {
-    uint32_t ep_idx, token, write_count, read_count;
+    uint32_t ep_idx = 0, token, write_count, read_count;
     uint8_t intflag = 0;

     intflag = USBFS_DEVICE->INT_FG;
@@ -293,7 +301,7 @@

                         write_count = MIN(g_ch32_usbfs_udc.in_ep[ep_idx].xfer_len, g_ch32_usbfs_udc.in_ep[ep_idx].ep_mps);
                         USB_SET_TX_LEN(ep_idx, write_count);
-                        USB_SET_DMA(ep_idx, (uint32_t)g_ch32_usbfs_udc.in_ep[ep_idx].xfer_buf);
+                        memcpy(&g_ch32_usbfs_udc.ep_databuf[ep_idx - 1][64], g_ch32_usbfs_udc.in_ep[ep_idx].xfer_buf, write_count);

                         USB_SET_TX_CTRL(ep_idx, (USB_GET_TX_CTRL(ep_idx) & ~USBFS_UEP_T_RES_MASK) | USBFS_UEP_T_RES_ACK);
                     } else {
@@ -328,6 +336,8 @@
                         USB_SET_RX_CTRL(ep_idx, (USB_GET_RX_CTRL(ep_idx) & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_NAK);
                         read_count = USBFS_DEVICE->RX_LEN;

+                        memcpy(g_ch32_usbfs_udc.out_ep[ep_idx].xfer_buf, &g_ch32_usbfs_udc.ep_databuf[ep_idx - 1][0], read_count);
+
                         g_ch32_usbfs_udc.out_ep[ep_idx].xfer_buf += read_count;
                         g_ch32_usbfs_udc.out_ep[ep_idx].actual_xfer_len += read_count;
                         g_ch32_usbfs_udc.out_ep[ep_idx].xfer_len -= read_count;
@@ -335,7 +345,6 @@
                         if ((read_count < g_ch32_usbfs_udc.out_ep[ep_idx].ep_mps) || (g_ch32_usbfs_udc.out_ep[ep_idx].xfer_len == 0)) {
                             usbd_event_ep_out_complete_handler(ep_idx, g_ch32_usbfs_udc.out_ep[ep_idx].actual_xfer_len);
                         } else {
-                            USB_SET_DMA(ep_idx, (uint32_t)g_ch32_usbfs_udc.out_ep[ep_idx].xfer_buf);
                             USB_SET_RX_CTRL(ep_idx, (USB_GET_RX_CTRL(ep_idx) & ~USBFS_UEP_R_RES_MASK) | USBFS_UEP_R_RES_ACK);
                         }
                     }


+subject

+subject

--- ReactiveCocoaFramework/ReactiveCocoa/RACSubject.h
+++ ReactiveCocoaFramework/ReactiveCocoa/RACSubject.h
@@ -10,6 +10,8 @@

 @interface RACSubject : RACValue
+
++ (id)subject;

 // Send the `next` event to all our observers with the given value.
 //


properly initialize Timestep's members to NULL

git-svn-id: 353be9ac11a1e711854a13efcc2fc17d9d6b83e7@1516 c36c8488-0289-0348-9b64-b301f74bd9a7

--- uvfDataset.h
+++ uvfDataset.h
@@ -144,6 +144,9 @@

 private:
   struct Timestep {
+	Timestep() : m_fMaxGradMagnitude(0), m_pVolumeDataBlock(NULL),
+				 m_pHist1DDataBlock(NULL), m_pHist2DDataBlock(NULL),
+				 m_pMaxMinData(NULL) {}
     /// used for 2D TF scaling
     float                        m_fMaxGradMagnitude;
     const RasterDataBlock*       m_pVolumeDataBlock; ///< data


staging: west bridge: cyasgadget, remove file system / vfs calls

This patch remove file system specific (fat_get_block) and vfs calls
from the cyasgadget driver. The current implementation expects user
space to write the file (open, seek to end, 1 byte write), followed by a
call to clear the dirty pages from the the page cache.

Signed-off-by: David Cross <8cd367eb9cf911cda089e16b165445ea616bddc4@cypress.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- drivers/staging/westbridge/astoria/gadget/cyasgadget.c
+++ drivers/staging/westbridge/astoria/gadget/cyasgadget.c
@@ -1149,11 +1149,9 @@
 			struct inode *inode = mapping->host;
 			struct inode *alloc_inode =
 				file_to_allocate->f_path.dentry->d_inode;
-			int cluster = 0;
 			uint32_t num_clusters = 0;
 			struct buffer_head bh;
 			struct kstat stat;
-			struct iattr alloc_iattr;
 			int nr_pages = 0;
 			int ret_stat = 0;

@@ -1188,47 +1186,7 @@
 			/* block size is arbitrary , we'll use sector size*/
 			bh.b_size = SECTOR_SIZE ;

-			#ifndef WESTBRIDGE_NDEBUG
-			cy_as_hal_print_message("%s: getting fat blocks %d "
-				"size of  %d\n", __func__,
-				num_clusters, bh.b_size);
-			#endif
-			for (cluster = 0; cluster < num_clusters; cluster++)  {
-				ret_stat = fat_get_block(inode,
-					cluster, &bh, 1);
-				if (ret_stat) {
-					cy_as_hal_print_message(
-						"%s: unable to get fat block, "
-						"ret_stat=0x%d\n",
-						__func__, ret_stat);
-					goto initsoj_safe_exit;
-				}
-			}
-
-			#ifndef WESTBRIDGE_NDEBUG
-			cy_as_hal_print_message("%s: allocated clusters "
-				"successfully (fat_get_block), check bmap..."
-				"\n", __func__);
-			#endif
-
-			alloc_iattr.ia_valid = ATTR_SIZE;
-			alloc_iattr.ia_size = k_d.num_bytes;
-
-			#ifndef WESTBRIDGE_NDEBUG
-			cy_as_hal_print_message("%s: calling fat_notify_change "
-				"(ia_valid:%d, ia_size:%d)\n", __func__,
-				alloc_iattr.ia_valid,
-				(int)alloc_iattr.ia_size);
-			#endif
-
-			/* adjust the filesize */
-			ret_stat = alloc_inode->i_op->setattr(
-				file_to_allocate->f_path.dentry, &alloc_iattr);
-			#ifndef WESTBRIDGE_NDEBUG
-			cy_as_hal_print_message("%s: fat_setattr() "
-				"returned 0x%x\n",
-				__func__, ret_stat);
-			#endif
+

 			/* clear dirty pages in page cache
 			 * (if were any allocated) */


Fixed the way ~ (HOME) is parsed on OSX/Linux

--- core/cphvb_component.c
+++ core/cphvb_component.c
@@ -41,9 +41,13 @@
 #else

 #include <dlfcn.h>
+#include <limits.h>

 #define HOME_INI_PATH "~/.cphvb/config.ini"
 #define SYSTEM_INI_PATH "/opt/cphvb/config.ini"
+
+//We need a buffer for path expansion
+char _expand_buffer[PATH_MAX];

 #endif

@@ -147,6 +151,14 @@
 		{
 			homepath = _expand_buffer1;
 		}
+#else
+
+		char* h = getenv("HOME");
+		if (h != NULL)
+		{
+			snprintf(_expand_buffer, PATH_MAX, "%s/%s", h, homepath+1);
+			homepath = _expand_buffer;
+		}
 #endif

 		FILE *fp = fopen(homepath,"r");


Fix backwards type errors;

Fix backwards type errors;

--- src/api/api.c
+++ src/api/api.c
@@ -108,7 +108,7 @@
   } else {
     name = luaL_typename(L, index);
   }
-  const char* message = lua_pushfstring(L, "%s expected, got %s", name, expected);
+  const char* message = lua_pushfstring(L, "%s expected, got %s", expected, name);
   return luaL_argerror(L, index, message);
 }


Replace `(char *)0' et al with `NULL'. None of them are vararg parameters.

--- uip/annosbr.c
+++ uip/annosbr.c
@@ -88,7 +88,7 @@
     int		n;		/* number of bytes written */
     char	*sp;		/* another miscellaneous character pointer */

-    if ((fp = fopen(file, "r")) == (FILE *)0)
+    if ((fp = fopen(file, "r")) == NULL)
 	adios(file, "unable to open");

     /*
@@ -140,7 +140,7 @@
 	    if (number)
 		(void)printf("%d\t", ++count);

-	    if (text == (char *)0 && (sp = strrchr(cp, '/')) != (char *)0)
+	    if (text == NULL && (sp = strrchr(cp, '/')) != (char *)0)
 		cp = sp + 1;

 	    (void)printf("%s\n", cp);
@@ -203,7 +203,7 @@
      */

     if (delete >= -1 || append != 0) {
-	if ((fp = fdopen(fd, "r")) == (FILE *)0)
+	if ((fp = fdopen(fd, "r")) == NULL)
 	    adios(NULL, "unable to fdopen file.");

 	field = (char *)mh_xmalloc(field_size = 256);
@@ -296,7 +296,7 @@

 	    if (strncasecmp(field, comp, length) == 0 && field[length] == ':') {
 		if (delete == 0) {
-		    if (text == (char *)0)
+		    if (text == NULL)
 			break;

 		    for (cp = field + length + 1; *cp == ' ' || *cp == '\t'; cp++)
@@ -307,7 +307,7 @@
 				break;
 		    }
 		    else {
-			if ((sp = strrchr(cp, '/')) != (char *)0)
+			if ((sp = strrchr(cp, '/')) != NULL)
 			    cp = sp + 1;

 			if (strcmp(cp, text) == 0)


Update UefiScsiLib to add ASSERT comments and define new macros to replace the hard code value.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@5838 6f19259b-4bc3-4df7-8a09-765794883524

--- MdePkg/Library/UefiScsiLib/UefiScsiLib.c
+++ MdePkg/Library/UefiScsiLib/UefiScsiLib.c
@@ -20,9 +20,23 @@

 #include <IndustryStandard/Scsi.h>

+//
+// bit5..7 are for Logical unit number
+// 11100000b (0xe0)
+//
+#define EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK 0xe0
+
+//
+// Scsi Command Length six or ten
+//
+#define EFI_SCSI_OP_LENGTH_SIX 0x6
+#define EFI_SCSI_OP_LENGTH_TEN 0xa

 /**
   Function test the ready status of the SCSI unit.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().

   @param[in]     ScsiIo             A pointer to SCSI IO protocol.
   @param[in]     Timeout            The length of timeout period.
@@ -67,7 +81,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[6];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_SIX];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -78,7 +92,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 6);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = NULL;
@@ -94,8 +108,8 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]                        = EFI_SCSI_OP_TEST_UNIT_READY;
-  Cdb[1]                        = (UINT8) (Lun & 0xe0);
-  CommandPacket.CdbLength       = (UINT8) 6;
+  Cdb[1]                        = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
+  CommandPacket.CdbLength       = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
   CommandPacket.SenseDataLength = *SenseDataLength;

   Status                        = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
@@ -110,6 +124,10 @@

 /**
   Function to submit SCSI inquiry command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If InquiryDataLength is NULL, then ASSERT().

   @param[in]     ScsiIo             SCSI IO Protocol to use
   @param[in]     Timeout            The length of timeout period.
@@ -159,7 +177,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[6];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_SIX];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -171,7 +189,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 6);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = InquiryDataBuffer;
@@ -184,7 +202,7 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]  = EFI_SCSI_OP_INQUIRY;
-  Cdb[1]  = (UINT8) (Lun & 0xe0);
+  Cdb[1]  = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
   if (EnableVitalProductData) {
     Cdb[1] |= 0x01;
   }
@@ -194,7 +212,7 @@
   }

   Cdb[4]                      = (UINT8) (*InquiryDataLength);
-  CommandPacket.CdbLength     = (UINT8) 6;
+  CommandPacket.CdbLength     = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
   CommandPacket.DataDirection = EFI_SCSI_DATA_IN;

   Status                      = ScsiIo->ExecuteScsiCommand (ScsiIo, &CommandPacket, NULL);
@@ -210,6 +228,10 @@

 /**
   Function to submit SCSI mode sense 10 command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If DataLength is NULL, then ASSERT().

   @param[in]     ScsiIo             A pointer to SCSI IO protocol.
   @param[in]     Timeout            The length of timeout period.
@@ -263,7 +285,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[10];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TEN];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -275,7 +297,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 10);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = DataBuffer;
@@ -289,12 +311,18 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]                        = EFI_SCSI_OP_MODE_SEN10;
-  Cdb[1]                        = (UINT8) ((Lun & 0xe0) + ((DBDField << 3) & 0x08));
+  //
+  // DBDField is in Cdb[1] bit3 of (bit7..0)
+  //
+  Cdb[1]                        = (UINT8) ((Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK) + ((DBDField << 3) & 0x08));
+  //
+  // PageControl is in Cdb[2] bit7..6, PageCode is in Cdb[2] bit5..0
+  //
   Cdb[2]                        = (UINT8) ((PageControl & 0xc0) | (PageCode & 0x3f));
   Cdb[7]                        = (UINT8) (*DataLength >> 8);
   Cdb[8]                        = (UINT8) (*DataLength);

-  CommandPacket.CdbLength       = 10;
+  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TEN;
   CommandPacket.DataDirection   = EFI_SCSI_DATA_IN;
   CommandPacket.SenseDataLength = *SenseDataLength;

@@ -311,6 +339,9 @@

 /**
   Function to submit SCSI request sense command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().

   @param[in]     ScsiIo             A pointer to SCSI IO protocol.
   @param[in]     Timeout            The length of timeout period.
@@ -355,7 +386,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[6];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_SIX];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -366,7 +397,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 6);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_SIX);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = SenseData;
@@ -380,10 +411,10 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]                        = EFI_SCSI_OP_REQUEST_SENSE;
-  Cdb[1]                        = (UINT8) (Lun & 0xe0);
+  Cdb[1]                        = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
   Cdb[4]                        = (UINT8) (*SenseDataLength);

-  CommandPacket.CdbLength       = (UINT8) 6;
+  CommandPacket.CdbLength       = (UINT8) EFI_SCSI_OP_LENGTH_SIX;
   CommandPacket.DataDirection   = EFI_SCSI_DATA_IN;
   CommandPacket.SenseDataLength = 0;

@@ -399,6 +430,10 @@

 /**
   Function to submit read capacity command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If DataLength is NULL, then ASSERT().

   @param[in]     ScsiIo             A pointer to SCSI IO protocol.
   @param[in]     Timeout            The length of timeout period.
@@ -448,7 +483,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[10];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TEN];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -460,7 +495,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 10);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = DataBuffer;
@@ -474,7 +509,7 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]  = EFI_SCSI_OP_READ_CAPACITY;
-  Cdb[1]  = (UINT8) (Lun & 0xe0);
+  Cdb[1]  = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
   if (!PMI) {
     //
     // Partial medium indicator,if PMI is FALSE, the Cdb.2 ~ Cdb.5 MUST BE ZERO.
@@ -484,7 +519,7 @@
     Cdb[8] |= 0x01;
   }

-  CommandPacket.CdbLength       = 10;
+  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TEN;
   CommandPacket.DataDirection   = EFI_SCSI_DATA_IN;
   CommandPacket.SenseDataLength = *SenseDataLength;

@@ -501,6 +536,10 @@

 /**
   Function to submit read 10 command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If DataLength is NULL, then ASSERT().

   @param[in]     ScsiIo             A pointer to SCSI IO protocol.
   @param[in]     Timeout            The length of timeout period.
@@ -552,7 +591,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[10];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TEN];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -564,7 +603,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 10);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.InDataBuffer    = DataBuffer;
@@ -578,7 +617,7 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]                        = EFI_SCSI_OP_READ10;
-  Cdb[1]                        = (UINT8) (Lun & 0xe0);
+  Cdb[1]                        = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
   Cdb[2]                        = (UINT8) (StartLba >> 24);
   Cdb[3]                        = (UINT8) (StartLba >> 16);
   Cdb[4]                        = (UINT8) (StartLba >> 8);
@@ -586,7 +625,7 @@
   Cdb[7]                        = (UINT8) (SectorSize >> 8);
   Cdb[8]                        = (UINT8) (SectorSize & 0xff);

-  CommandPacket.CdbLength       = 10;
+  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TEN;
   CommandPacket.DataDirection   = EFI_SCSI_DATA_IN;
   CommandPacket.SenseDataLength = *SenseDataLength;

@@ -603,6 +642,10 @@

 /**
   Function to submit SCSI write 10 command.
+  If SenseDataLength is NULL, then ASSERT().
+  If HostAdapterStatus is NULL, then ASSERT().
+  If TargetStatus is NULL, then ASSERT().
+  If DataLength is NULL, then ASSERT().

   @param[in]     ScsiIo             SCSI IO Protocol to use
   @param[in]     Timeout            The length of timeout period.
@@ -654,7 +697,7 @@
   UINT8                           *Target;
   UINT8                           TargetArray[EFI_SCSI_TARGET_MAX_BYTES];
   EFI_STATUS                      Status;
-  UINT8                           Cdb[10];
+  UINT8                           Cdb[EFI_SCSI_OP_LENGTH_TEN];

   ASSERT (SenseDataLength != NULL);
   ASSERT (HostAdapterStatus != NULL);
@@ -666,7 +709,7 @@
   }

   ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
-  ZeroMem (Cdb, 10);
+  ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);

   CommandPacket.Timeout         = Timeout;
   CommandPacket.OutDataBuffer    = DataBuffer;
@@ -680,7 +723,7 @@
   ScsiIo->GetDeviceLocation (ScsiIo, &Target, &Lun);

   Cdb[0]                        = EFI_SCSI_OP_WRITE10;
-  Cdb[1]                        = (UINT8) (Lun & 0xe0);
+  Cdb[1]                        = (UINT8) (Lun & EFI_SCSI_LOGICAL_UNIT_NUMBER_MASK);
   Cdb[2]                        = (UINT8) (StartLba >> 24);
   Cdb[3]                        = (UINT8) (StartLba >> 16);
   Cdb[4]                        = (UINT8) (StartLba >> 8);
@@ -688,7 +731,7 @@
   Cdb[7]                        = (UINT8) (SectorSize >> 8);
   Cdb[8]                        = (UINT8) SectorSize;

-  CommandPacket.CdbLength       = 10;
+  CommandPacket.CdbLength       = EFI_SCSI_OP_LENGTH_TEN;
   CommandPacket.DataDirection   = EFI_SCSI_DATA_OUT;
   CommandPacket.SenseDataLength = *SenseDataLength;


Do not attempt pixmap conversion if types match.

--- a500/base/libsys/pixmap.c
+++ a500/base/libsys/pixmap.c
@@ -75,6 +75,9 @@
 }

 __regargs void PixmapConvert(PixmapT *pixmap, PixmapTypeT type) {
+  if (pixmap->type == type)
+    return;
+
   if ((pixmap->type == PM_GRAY4 && type == PM_GRAY8) ||
       (pixmap->type == PM_CMAP4 && type == PM_CMAP8) ||
       (pixmap->type == PM_GRAY8 && type == PM_GRAY4) ||


i#3324: Fix use of uninitialised data in decode_eflags_usage. (#3325)

Fixes decode_eflags_usage() to use info->type for the opcode, since read_instruction()
does not propagate that to di->opcode.

Fixes #3324

--- core/arch/x86/decode.c
+++ core/arch/x86/decode.c
@@ -709,7 +709,10 @@
     return pc;
 }

-/* Given an instr_info_t PREFIX_EXT entry, reads the next entry based on the prefixes */
+/* Given an instr_info_t PREFIX_EXT entry, reads the next entry based on the prefixes.
+ * Note that this function does not initialise the opcode field in \p di but is set in
+ * \p info->type.
+ */
 static inline const instr_info_t *
 read_prefix_ext(const instr_info_t *info, decode_info_t *di)
 {
@@ -1875,7 +1878,7 @@
     read_instruction(pc, pc, &info, &di, true /* just opcode */ _IF_DEBUG(true));

     *usage = instr_eflags_conditionally(
-        info->eflags, decode_predicate_from_instr_info(di.opcode, info), flags);
+        info->eflags, decode_predicate_from_instr_info(info->type, info), flags);
     pc = decode_next_pc(dcontext, pc);
     /* failure handled fine -- we'll go ahead and return the NULL */


Basic codegen test for conditional with void*.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@46940 91177308-0d34-0410-b5e6-96231b3b80d8

--- test/CodeGen/conditional.c
+++ test/CodeGen/conditional.c
@@ -19,3 +19,9 @@
 int i; short j;
 float* k = 1 ? &i : &j;
 }
+
+void test5() {
+  const int* cip;
+  void* vp;
+  cip = 0 ? vp : cip;
+}


tubes-channel: add priv->requested

tubes-channel: add priv->requested

--- src/salut-tubes-channel.c
+++ src/salut-tubes-channel.c
@@ -146,6 +146,7 @@
   TpHandleType handle_type;
   TpHandle self_handle;
   TpHandle initiator;
+  gboolean requested;
   /* Used for MUC tubes channel only */
   GibberMucConnection *muc_connection;

@@ -325,7 +326,7 @@
         }
         break;
       case PROP_REQUESTED:
-        g_value_set_boolean (value, (priv->initiator == priv->self_handle));
+        g_value_set_boolean (value, priv->requested);
         break;
       case PROP_CHANNEL_DESTROYED:
         g_value_set_boolean (value, priv->closed);
@@ -400,6 +401,9 @@
       case PROP_INITIATOR_HANDLE:
         priv->initiator = g_value_get_uint (value);
         g_assert (priv->initiator != 0);
+        break;
+      case PROP_REQUESTED:
+        priv->requested = g_value_get_boolean (value);
         break;
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2313,7 +2317,7 @@
   param_spec = g_param_spec_boolean ("requested", "Requested?",
       "True if this channel was requested by the local user",
       FALSE,
-      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+      G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_REQUESTED, param_spec);

   param_spec = g_param_spec_uint ("initiator-handle", "Initiator's handle",


tests/xgetrlimit.c: fix a warning reported by -Wtype-limits

* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
to the type of argument.

--- tests/xgetrlimit.c
+++ tests/xgetrlimit.c
@@ -41,10 +41,10 @@
 sprint_rlim(kernel_ulong_t lim)
 {
 	if (sizeof(lim) == sizeof(uint64_t)) {
-		if (lim == -1ULL)
+		if (lim == (kernel_ulong_t) -1ULL)
 			return "RLIM64_INFINITY";
 	} else {
-		if (lim == -1U)
+		if (lim == (kernel_ulong_t) -1U)
 			return "RLIM_INFINITY";
 	}


Updated quaternion functions

Updated quaternion functions

--- cml/src/structures/quaternion.c
+++ cml/src/structures/quaternion.c
@@ -2,7 +2,8 @@
 #include <cml.h>

 quaternion_t
-quaternion_create_from_spherical_coords(real_t vartheta, real_t varphi) {
+quaternion_create_from_spherical_coords(real_t vartheta, real_t varphi)
+{
         real_t ct = real_cos(vartheta/2.),
                cp = real_cos(varphi/2.),
                st = real_sin(vartheta/2.),
@@ -12,7 +13,8 @@
 }

 quaternion_t
-quaternion_create_from_euler_angles(real_t alpha, real_t beta, real_t gamma) {
+quaternion_create_from_euler_angles(real_t alpha, real_t beta, real_t gamma)
+{
         real_t ca = real_cos(alpha/2.),
                cb = real_cos(beta/2.),
                cc = real_cos(gamma/2.),
@@ -79,7 +81,8 @@
 }

 real_t
-_quaternion_scalar_real_log(real_t s) {
+_quaternion_scalar_real_log(real_t s)
+{
         return real_log(s);
 }

@@ -87,19 +90,19 @@
 quaternion_scalar_power(real_t s, quaternion_t q)
 {
         /* Unlike the quaternion^quaternion power, this is unambiguous.*/
-        if(is_null(s)) { /*real_log(s)=-inf */
+        if((s)) { /*real_log(s)=-inf */
                 quaternion_t r;

                 if(!quaternion_nonzero(q)) {
-                        r = {1.0, 0.0, 0.0, 0.0};
+                        r = { 1.0, 0.0, 0.0, 0.0 };
                 } else {
-                        r = {0.0, 0.0, 0.0, 0.0};
+                        r = { 0.0, 0.0, 0.0, 0.0 };
                 }

                 return r;
         } else if(s < 0.0) {               /* real_log(s)=nan */
                 // fprintf(stderr, "Input scalar (%.15g) has no unique logarithm; returning one arbitrarily.", s);
-                quaternion_t t = {real_log(-s), PI, 0, 0};
+                quaternion_t t = {real_log(-s), PI, 0.0, 0.0};
                 return quaternion_exp(quaternion_multiply(q, t));
         }

@@ -118,7 +121,7 @@

                 r = {e*real_cos(vnorm), e*s*q.x, e*s*q.y, e*s*q.z};
         } else {
-                r = { real_exp(q.w), 0, 0, 0 };
+                r = { real_exp(q.w), 0.0, 0.0, 0.0 };
         }

         return r;


Fixed compareCommand that was comparing beyond the end of the command input based on the literal’s length

git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@396 96dfbd92-d197-e211-9ca9-00110a534b34

--- v6502/main.c
+++ v6502/main.c
@@ -108,7 +108,7 @@
 }

 static int compareCommand(const char * restrict command, const char * restrict literal) {
-	size_t len = strlen(literal);
+	size_t len = strlen(command);
 	for (size_t i = 0; i < len; i++) {
 		if (command[i] != literal[i] && command[i] != '\n' && command[i] != '\0') {
 			return NO;


Solve the NaN issue on the CPU

Solve the NaN issue on the CPU

This PR solves the NaN issue reported here : https://github.com/tmbdev/clstm/issues/63
The problem is that for newly allocated batches inside a Sequence, memory had to be reset to zeros, otherwise NaNs may flow in

--- batches.h
+++ batches.h
@@ -114,12 +114,7 @@
   }
   void resize(int N, int n, int m) {
     check();
-    if (N == size() && n == rows() && m == cols()) {
-      for (int t = 0; t < N; t++) {
-        steps[t].v.setZero();
-        steps[t].d.setZero();
-      }
-    } else {
+    if (N != size() || n != rows() || m != cols()) {
       clear();
       allocate(N, n, m);
       steps.resize(N);
@@ -128,6 +123,8 @@
         steps[t].d.displaceTo(data + (n * m) * (2 * t + 1), n, m, gpu);
       }
     }
+    //reset data, whether new or reused
+    memset(data,0,nbytes());
   }
   void like(const Sequence &other) {
     resize(other.size(), other.rows(), other.cols());


conmon: Fix cgroup subsystem parsing

conmon: Fix cgroup subsystem parsing

The code as is doesn't handle merged controllers.
For instance, I have this in my /proc/self/cgrous:

4:cpu,cpuacct:/user.slice/user-0.slice/session-4.scope

The current code fails to match "cpuacct" wit this line, and
additionally it just does a prefix match so if you were looking
for say "cpu", it would match this:

2:cpuset:/

I also removed some ninfo spew that didn't seem very useful.

Signed-off-by: Alexander Larsson <8c32c4b573bb86be9076a894bc9e0dfe2b512e8a@redhat.com>

--- conmon/conmon.c
+++ conmon/conmon.c
@@ -72,10 +72,17 @@
 		g_string_free(*string, TRUE);
 }

+static inline void strv_cleanup(char ***strv)
+{
+	if (strv)
+		g_strfreev (*strv);
+}
+
 #define _cleanup_free_ _cleanup_(freep)
 #define _cleanup_close_ _cleanup_(closep)
 #define _cleanup_fclose_ _cleanup_(fclosep)
 #define _cleanup_gstring_ _cleanup_(gstring_free_cleanup)
+#define _cleanup_strv_ _cleanup_(strv_cleanup)

 #define BUF_SIZE 256
 #define CMD_SIZE 1024
@@ -350,37 +357,43 @@
 	_cleanup_free_ char *line = NULL;
 	ssize_t read;
 	size_t len = 0;
-	char *ptr;
+	char *ptr, *path;
 	char *subsystem_path = NULL;
+	int i;
 	while ((read = getline(&line, &len, fp)) != -1) {
+		_cleanup_strv_ char **subsystems = NULL;
 		ptr = strchr(line, ':');
 		if (ptr == NULL) {
 			nwarn("Error parsing cgroup, ':' not found: %s", line);
 			return NULL;
 		}
 		ptr++;
-		if (!strncmp(ptr, subsystem, strlen(subsystem))) {
-			char *path = strchr(ptr, '/');
-			if (path == NULL) {
-				nwarn("Error finding path in cgroup: %s", line);
-				return NULL;
+		path = strchr(ptr, ':');
+		if (path == NULL) {
+			nwarn("Error parsing cgroup, second ':' not found: %s", line);
+			return NULL;
+		}
+		*path = 0;
+		path++;
+		subsystems = g_strsplit (ptr, ",", -1);
+		for (i = 0; subsystems[i] != NULL; i++) {
+			if (strcmp (subsystems[i], subsystem) == 0) {
+				char *subpath = strchr(subsystems[i], '=');
+				if (subpath == NULL) {
+					subpath = ptr;
+				} else {
+					*subpath = 0;
+				}
+
+				rc = asprintf(&subsystem_path, "%s/%s%s", CGROUP_ROOT, subpath, path);
+				if (rc < 0) {
+					nwarn("Failed to allocate memory for subsystemd path");
+					return NULL;
+				}
+
+				subsystem_path[strlen(subsystem_path) - 1] = '\0';
+				return subsystem_path;
 			}
-			ninfo("PATH: %s", path);
-			const char *subpath = strchr(subsystem, '=');
-			if (subpath == NULL) {
-				subpath = subsystem;
-			} else {
-				subpath++;
-			}
-
-			rc = asprintf(&subsystem_path, "%s/%s%s", CGROUP_ROOT, subpath, path);
-			if (rc < 0) {
-				nwarn("Failed to allocate memory for subsystemd path");
-				return NULL;
-			}
-			ninfo("SUBSYSTEM_PATH: %s", subsystem_path);
-			subsystem_path[strlen(subsystem_path) - 1] = '\0';
-			return subsystem_path;
 		}
 	}


Forgot to add updated datalayout test

Forgot to add updated datalayout test

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@209465 91177308-0d34-0410-b5e6-96231b3b80d8


alterado layout da funcao bateria

alterado layout da funcao bateria

--- bateria.c
+++ bateria.c
@@ -27,7 +27,10 @@
     if (arquivo == 0)
       arquivo = fopen("/sys/class/power_supply/BAT0/energy_full", "r");
     if (arquivo == 0)
+    {
+      strncat(b, "

Dispositivo Desktop
", s);
       return -1;
+    }
       //O nível da bateria não pôde ser lido

     //atribuindo o total da bateria a um float
@@ -44,7 +47,10 @@
     if (arquivo == 0)
       arquivo = fopen("/sys/class/power_supply/BAT0/energy_now", "r");
     if (arquivo == 0)
+    {
+      strncat(b, "O arquivo _now nao pode ser lido", s);
       return -1;
+    }
       //O nível da bateria não pôde ser lido

     //atribuindo a carga total ao float
@@ -58,9 +64,9 @@
     fclose(arquivo);

-    snprintf(buffer,TAMBUFF, "Porcentagem da bateria: %.0f%%", valor);
+    snprintf(buffer,TAMBUFF, "

Porcentagem da bateria: %.0f%%
", valor);
     strncat(b, buffer, s);

     //retorna sucesso
     return 1;
-}+}


conmon: rename --pidfile to --container-pidfile

Signed-off-by: Giuseppe Scrivano <20002b7b24c75512093a71a58285826d5c504fca@redhat.com>

--- conmon/conmon.c
+++ conmon/conmon.c
@@ -138,7 +138,7 @@
 static char *opt_cuuid = NULL;
 static char *opt_runtime_path = NULL;
 static char *opt_bundle_path = NULL;
-static char *opt_pid_file = NULL;
+static char *opt_container_pid_file = NULL;
 static bool opt_systemd_cgroup = false;
 static bool opt_no_pivot = false;
 static char *opt_exec_process_spec = NULL;
@@ -165,7 +165,8 @@
 	{"no-pivot", 0, 0, G_OPTION_ARG_NONE, &opt_no_pivot, "Do not use pivot_root", NULL},
 	{"replace-listen-pid", 0, 0, G_OPTION_ARG_NONE, &opt_replace_listen_pid, "Replace listen pid if set for oci-runtime pid", NULL},
 	{"bundle", 'b', 0, G_OPTION_ARG_STRING, &opt_bundle_path, "Bundle path", NULL},
-	{"pidfile", 'p', 0, G_OPTION_ARG_STRING, &opt_pid_file, "PID file", NULL},
+	{"pidfile", 0, 0, G_OPTION_ARG_STRING, &opt_container_pid_file, "PID file (DEPRECATED)", NULL},
+	{"container-pidfile", 'p', 0, G_OPTION_ARG_STRING, &opt_container_pid_file, "Container PID file", NULL},
 	{"systemd-cgroup", 's', 0, G_OPTION_ARG_NONE, &opt_systemd_cgroup, "Enable systemd cgroup manager", NULL},
 	{"exec", 'e', 0, G_OPTION_ARG_NONE, &opt_exec, "Exec a command in a running container", NULL},
 	{"exec-process-spec", 0, 0, G_OPTION_ARG_STRING, &opt_exec_process_spec, "Path to the process spec for exec", NULL},
@@ -1265,9 +1266,9 @@
 		nexit("Exec process spec path not provided. Use --exec-process-spec");
 	}

-	if (opt_pid_file == NULL) {
+	if (opt_container_pid_file == NULL) {
 		default_pid_file = g_strdup_printf("%s/pidfile-%s", cwd, opt_cid);
-		opt_pid_file = default_pid_file;
+		opt_container_pid_file = default_pid_file;
 	}

 	if (opt_log_path == NULL)
@@ -1370,7 +1371,7 @@
 		add_argv(runtime_argv, "--systemd-cgroup", NULL);

 	if (opt_exec) {
-		add_argv(runtime_argv, "exec", "-d", "--pid-file", opt_pid_file, NULL);
+		add_argv(runtime_argv, "exec", "-d", "--pid-file", opt_container_pid_file, NULL);
 	} else {
 		char *command;
 		if (opt_restore_path)
@@ -1378,7 +1379,7 @@
 		else
 			command = "create";

-		add_argv(runtime_argv, command, "--bundle", opt_bundle_path, "--pid-file", opt_pid_file, NULL);
+		add_argv(runtime_argv, command, "--bundle", opt_bundle_path, "--pid-file", opt_container_pid_file, NULL);

 		if (opt_restore_path) {
 			/*
@@ -1550,7 +1551,7 @@
 		nexit("Runtime did not set up terminal");

 	/* Read the pid so we can wait for the process to exit */
-	g_file_get_contents(opt_pid_file, &contents, NULL, &err);
+	g_file_get_contents(opt_container_pid_file, &contents, NULL, &err);
 	if (err) {
 		nwarnf("Failed to read pidfile: %s", err->message);
 		g_error_free(err);


Added von Kármán constant

Added von Kármán constant


rearrange slice parameters code, send to VA only second bitstream buffer

--- vdpau-soft.c
+++ vdpau-soft.c
@@ -454,20 +454,8 @@
         status = vaRenderPicture(va_dpy, decoderData->context_id, &pic_param_buf, 1);
         status = vaRenderPicture(va_dpy, decoderData->context_id, &iq_matrix_buf, 1);

+        // TODO: debug code, remove
         for (int k = 0; k < bitstream_buffer_count; k ++) {
-            status = vaCreateBuffer(va_dpy, decoderData->context_id, VASliceParameterBufferType,
-                sizeof(VASliceParameterBufferH264), 1, &slice_parameters, &slice_parameters_buf);
-            if (VA_STATUS_SUCCESS != status) goto error;
-            status = vaRenderPicture(va_dpy, decoderData->context_id, &slice_parameters_buf, 1);
-
-            VABufferID slice_buf;
-            status = vaCreateBuffer(va_dpy, decoderData->context_id, VASliceDataBufferType,
-                bitstream_buffers[0].bitstream_bytes, 1, (char *)bitstream_buffers[0].bitstream,
-                &slice_buf);
-            if (VA_STATUS_SUCCESS != status) goto error;
-            status = vaRenderPicture(va_dpy, decoderData->context_id, &slice_buf, 1);
-
-            // TODO: debug code, remove
             unsigned int sz = bitstream_buffers[k].bitstream_bytes;
             const uint8_t *buf = bitstream_buffers[k].bitstream;
             fprintf(stderr, "--------------------------\nbitstream buffer #%d, size = %d\n", k, sz);
@@ -479,30 +467,41 @@
                 fprintf(stderr, "\n");
             }
             fprintf(stderr, "---------------------------\n");
-
-            if (1 == k) {
-                rbsp_state_t st;
-                rbsp_attach_buffer(&st, bitstream_buffers[k].bitstream, bitstream_buffers[k].bitstream_bytes);
-                int c;
-                int x = 0;
-                while ((c = rbsp_consume_byte(&st)) != -1) {
-                    if (x % 16 == 0) fprintf(stderr, "\n%04x  {", x);
-                    fprintf(stderr, " %02x", c);
-                    x ++;
-                }
-                fprintf(stderr, "\n");
-
-                rbsp_attach_buffer(&st, bitstream_buffers[k].bitstream, bitstream_buffers[k].bitstream_bytes);
-
-                // TODO: this may be not entirely true for YUV444
-                // but if we limiting to YUV420, that's ok
-                int ChromaArrayType = pic_param->seq_fields.bits.chroma_format_idc;
-
-                parse_slice_header(&st, vdppi, ChromaArrayType, &slice_parameters);
-
-                fprintf(stderr, "/////////////////////\n");
-            }
         }
+
+        rbsp_state_t st;
+        rbsp_attach_buffer(&st, bitstream_buffers[1].bitstream, bitstream_buffers[1].bitstream_bytes);
+        int c;
+        int x = 0;
+        while ((c = rbsp_consume_byte(&st)) != -1) {
+            if (x % 16 == 0) fprintf(stderr, "\n%04x  {", x);
+            fprintf(stderr, " %02x", c);
+            x ++;
+        }
+        fprintf(stderr, "\n");
+
+        rbsp_attach_buffer(&st, bitstream_buffers[1].bitstream, bitstream_buffers[1].bitstream_bytes);
+
+        // TODO: this may be not entirely true for YUV444
+        // but if we limiting to YUV420, that's ok
+        int ChromaArrayType = pic_param->seq_fields.bits.chroma_format_idc;
+
+        parse_slice_header(&st, vdppi, ChromaArrayType, &slice_parameters);
+
+        fprintf(stderr, "/////////////////////\n");
+        //////////////////////////
+
+        status = vaCreateBuffer(va_dpy, decoderData->context_id, VASliceParameterBufferType,
+            sizeof(VASliceParameterBufferH264), 1, &slice_parameters, &slice_parameters_buf);
+        if (VA_STATUS_SUCCESS != status) goto error;
+        status = vaRenderPicture(va_dpy, decoderData->context_id, &slice_parameters_buf, 1);
+
+        VABufferID slice_buf;
+        status = vaCreateBuffer(va_dpy, decoderData->context_id, VASliceDataBufferType,
+            bitstream_buffers[1].bitstream_bytes, 1, (char *)bitstream_buffers[1].bitstream,
+            &slice_buf);
+        if (VA_STATUS_SUCCESS != status) goto error;
+        status = vaRenderPicture(va_dpy, decoderData->context_id, &slice_buf, 1);

         status = vaEndPicture(va_dpy, decoderData->context_id);