Replace VAD with NS in comments.
Review URL: http://webrtc-codereview.appspot.com/88005

git-svn-id: 9b397c5dfe384c04b1b200d5305b653241000171@245 4adac7df-926f-26a2-2b94-8c16560cd09d

--- modules/audio_processing/ns/main/interface/noise_suppression.h
+++ modules/audio_processing/ns/main/interface/noise_suppression.h
@@ -98,7 +98,7 @@
  * input and output signals should always be 10ms (80 or 160 samples).
  *
  * Input
- *      - NS_inst       : VAD Instance. Needs to be initiated before call.
+ *      - NS_inst       : NS Instance. Needs to be initiated before call.
  *      - spframe       : Pointer to speech frame buffer for L band
  *      - spframe_H     : Pointer to speech frame buffer for H band
  *      - fs            : sampling frequency


proper cleanup of the rwlocks in the avl trees.

This was causing some major memory leakage on win32, but was not seen
on unix.  Icecast2 on win32 is leakfree again :)

svn path=/trunk/avl/; revision=5525

--- src/avl/avl.c
+++ src/avl/avl.c
@@ -22,7 +22,7 @@
  *
  */

-/* $Id: avl.c,v 1.8 2003/07/29 00:30:36 karl Exp $ */
+/* $Id: avl.c,v 1.9 2003/10/31 19:18:42 oddsock Exp $ */

 /*
  * This is a fairly straightfoward translation of a prototype
@@ -93,6 +93,7 @@
   if (node->right) {
     avl_tree_free_helper (node->right, free_key_fun);
   }
+  thread_rwlock_destroy (&node->rwlock);
   free (node);
 }

@@ -103,6 +104,7 @@
     avl_tree_free_helper (tree->root->right, free_key_fun);
   }
   if (tree->root) {
+    thread_rwlock_destroy(&tree->root->rwlock);
     free (tree->root);
   }
   thread_rwlock_destroy(&tree->rwlock);


Bug fix - char is signed on x86

Bug fix - char is signed on x86

--- src/b6b_str.c
+++ src/b6b_str.c
@@ -498,7 +498,7 @@
 	if (!b6b_proc_get_args(interp, args, "os", NULL, &s) || (s->slen != 1))
 	    return B6B_ERR;

-	return b6b_return_int(interp, (b6b_int)s->s[0]);
+	return b6b_return_int(interp, (b6b_int)(unsigned char)s->s[0]);
 }

 static enum b6b_res b6b_str_proc_chr(struct b6b_interp *interp,


filter_kubernetes: fix issue with >1 container in pod diff parser type (#888)

If there was more than 1 container in a pod with different parser
types, it was matching the first one each time. Separate the hash-key
by container-name.

Signed-off-by: Don Bowman <1f1e67e5fdb25d2e5cd18ddc0fee425272daab56@agilicus.com>

--- plugins/filter_kubernetes/kube_meta.c
+++ plugins/filter_kubernetes/kube_meta.c
@@ -597,7 +597,10 @@

     /* Compose API server cache key */
     if (meta->podname && meta->namespace) {
-        meta->cache_key_len = meta->podname_len + meta->namespace_len + 1;
+        meta->cache_key_len = meta->podname_len + meta->namespace_len + meta->container_name_len + 1;
+        if (meta->container_name) {
+            meta->cache_key_len += meta->container_name_len + 2;
+        }
         meta->cache_key = flb_malloc(meta->cache_key_len + 1);
         if (!meta->cache_key) {
             flb_errno();
@@ -614,6 +617,14 @@
         /* Copy podname */
         memcpy(meta->cache_key + off, meta->podname, meta->podname_len);
         off += meta->podname_len;
+
+        if (meta->container_name) {
+            /* Separator */
+            meta->cache_key[off++] = ':';
+            memcpy(meta->cache_key + off, meta->container_name, meta->container_name_len);
+            off += meta->container_name_len;
+        }
+
         meta->cache_key[off] = '\0';
     }
     else {


RDKB-42303: WiFi Events Client Diag Data is Stale/Incorrect

Reason for change: Data was not process if num devices connected
equal to zero
Test Procedure: Check client diag event after moving all clients
from one radio to the other.
Risks: Low

Signed-off-by: Viviane Cordeiro <70a2d376a3a3f909311edd1f66caa8621f1106cf@sky.uk>
(cherry picked from commit 2eb1f5e5338aafdefeb5f7075f79e358bcaac8c4)
(cherry picked from commit c99eb8193433ce8c3157b5e291062f5e1663e988)
Change-Id: I89b0b433784a4f4585e43223d0ff5969b968e62c

--- source/TR-181/sbapi/wifi_monitor.c
+++ source/TR-181/sbapi/wifi_monitor.c
@@ -5170,6 +5170,7 @@

 int associated_devices_diagnostics(void *arg)
 {
+    static unsigned int phase = 0;
     static unsigned int vap_index = 0;
     static wifi_associated_dev3_t *dev_array = NULL;
     static unsigned int num_devs = 0;
@@ -5183,86 +5184,86 @@
     int jtr = 0;
     static char assoc_list[(MAX_ASSOCIATED_WIFI_DEVS*18)+1];

-    if (dev_array == NULL) {
-        current_dev = 0;
-        last_valid_dev = 0;
-        memset(assoc_list, 0, sizeof(assoc_list));
-        if (wifi_getApAssociatedDevice(vap_index, assoc_list, sizeof(assoc_list)) == RETURN_OK) {
-            num_devs = (strlen(assoc_list)+1)/18;
-            if (num_devs > 0) {
-                dev_array = (wifi_associated_dev3_t *) malloc(sizeof(wifi_associated_dev3_t) * num_devs);
-                if (dev_array == NULL) {
-                    wifi_dbg_print(1,"%s,malloc failed ! vap_index=%u\n",__func__,vap_index);
-                    goto exit_task;
-                }
-                for(i=1;i<num_devs;i++) {
-                    //remove ','
-                    assoc_list[(i*18)-1] = '\0';
+    if (phase == 0) { /* phase 0: collect diag data */
+        if (dev_array == NULL) {
+            current_dev = 0;
+            last_valid_dev = 0;
+            memset(assoc_list, 0, sizeof(assoc_list));
+            if (wifi_getApAssociatedDevice(vap_index, assoc_list, sizeof(assoc_list)) == RETURN_OK) {
+                num_devs = (strlen(assoc_list)+1)/18;
+                if (num_devs > 0) {
+                    dev_array = (wifi_associated_dev3_t *) malloc(sizeof(wifi_associated_dev3_t) * num_devs);
+                    if (dev_array == NULL) {
+                        wifi_dbg_print(1,"%s,malloc failed ! vap_index=%u\n",__func__,vap_index);
+                        goto exit_task;
+                    }
+                    for(i=1;i<num_devs;i++) {
+                        //remove ','
+                        assoc_list[(i*18)-1] = '\0';
+                    }
+                } else {
+                    /* No devices are associated with the current vap_index */
+                    phase = 1;
+                    return TIMER_TASK_CONTINUE;
                 }
             } else {
-                //reset json diag buffer
+                /* wifi_getApAssociatedDevice dint return RETURN_OK for the current vap_index.
+                 * Continue the task in the next cycle  */
+                wifi_dbg_print(1,"%s,wifi_getApAssociatedDevice returned error ! vap_index=%u\n",__func__,vap_index);
+                goto exit_task;
+            }
+            return TIMER_TASK_CONTINUE;
+        }
+
+        if(current_dev < num_devs) {
+            for(itr=0; assoc_list[(current_dev*18) + itr] != '\0'; itr++) {
+                if((assoc_list[(current_dev*18) + itr] != ':') && (jtr < MIN_MAC_LEN)) {
+                    s_mac[jtr] = assoc_list[(current_dev*18) + itr];
+                    jtr++;
+                }
+            }
+            s_mac[jtr] = '\0';
+            if (wifi_getApAssociatedClientDiagnosticResult(vap_index, s_mac,
+                                                        &dev_array[last_valid_dev]) == RETURN_OK){
+                last_valid_dev++;
+            }
+            current_dev++;
+            return TIMER_TASK_CONTINUE;
+        }
+        num_devs = last_valid_dev;
+        phase = 1;
+    }
+#else //!defined(_CBR_PRODUCT_REQ_) && !defined(_HUB4_PRODUCT_REQ_) && !defined(DUAL_CORE_XB3)
+    if (phase == 0) { /* phase 0: collect diag data */
+        if (dev_array == NULL) {
+            num_devs = 0;
+            if (wifi_getApAssociatedDeviceDiagnosticResult3(vap_index, &dev_array, &num_devs) != RETURN_OK) {
+                if (dev_array) {
+                    free(dev_array);
+                    dev_array = NULL;
+                }
+                goto exit_task;
+            }
+            phase = 1;
+            return TIMER_TASK_CONTINUE;
+        }
+    }
+#endif
+    if (phase == 1) { /* phase 1: process diag data */
 #if defined (FEATURE_CSI)
-                events_update_clientdiagdata(0, vap_index, NULL);
-#endif
-                /* No devices are associated with the current vap_index */
-                goto exit_task;
-            }
-        } else {
-            /* wifi_getApAssociatedDevice dint return RETURN_OK for the current vap_index.
-             * Continue the task in the next cycle  */
-            wifi_dbg_print(1,"%s,wifi_getApAssociatedDevice returned error ! vap_index=%u\n",__func__,vap_index);
-            goto exit_task;
-        }
-        return TIMER_TASK_CONTINUE;
-    }
-
-    if(current_dev < num_devs) {
-        for(itr=0; assoc_list[(current_dev*18) + itr] != '\0'; itr++) {
-            if((assoc_list[(current_dev*18) + itr] != ':') && (jtr < MIN_MAC_LEN)) {
-                s_mac[jtr] = assoc_list[(current_dev*18) + itr];
-                jtr++;
-            }
-        }
-        s_mac[jtr] = '\0';
-        if (wifi_getApAssociatedClientDiagnosticResult(vap_index, s_mac,
-                                                        &dev_array[last_valid_dev]) == RETURN_OK){
-            last_valid_dev++;
-        }
-        current_dev++;
-        return TIMER_TASK_CONTINUE;
-    }
-    num_devs = last_valid_dev;
-#else //!defined(_CBR_PRODUCT_REQ_) && !defined(_HUB4_PRODUCT_REQ_) && !defined(DUAL_CORE_XB3)
-    if (dev_array == NULL) {
-        num_devs = 0;
-        if (wifi_getApAssociatedDeviceDiagnosticResult3(vap_index, &dev_array, &num_devs) != RETURN_OK) {
-            if (dev_array) {
-                free(dev_array);
-                dev_array = NULL;
-            }
-            goto exit_task;
-        } else {
-            if (dev_array == NULL) {
-                /* wifi_getApAssociatedDeviceDiagnosticResult3 returns RETURN_OK but,
-                 * there is no client connected */
-                goto exit_task;
-            }
-        }
-        return TIMER_TASK_CONTINUE;
-    }
-#endif
-#if defined (FEATURE_CSI)
-    events_update_clientdiagdata(num_devs, vap_index, dev_array);
+        events_update_clientdiagdata(num_devs, vap_index, dev_array);
 #endif //FEATURE_CSI
-    process_diagnostics(vap_index, dev_array, num_devs);
-
-    if (dev_array) {
-        free(dev_array);
-        dev_array = NULL;
+        process_diagnostics(vap_index, dev_array, num_devs);
+
+        if (dev_array) {
+            free(dev_array);
+            dev_array = NULL;
+        }
     }

 exit_task:
     vap_index++;
+    phase = 0;
 #ifdef WIFI_HAL_VERSION_3
     if (vap_index >= getTotalNumberVAPs()) {
 #else


lib: Add MRPC definitions from current documentation

Flesh out and cleanup MRPC definitions from the current documentation.

--- inc/switchtec/mrpc.h
+++ inc/switchtec/mrpc.h
@@ -42,7 +42,7 @@
 	MRPC_STACKBIF = 0xB,
 	MRPC_PORTPARTP2P = 0xC,
 	MRPC_DIAG_TLP_INJECT = 0xD,
-	MRPC_DIAG_TLP_GEN = 0xE,
+	MRPC_RESERVED1 = 0xE,
 	MRPC_DIAG_PORT_EYE = 0xF,
 	MRPC_DIAG_POT_VHIST = 0x10,
 	MRPC_DIAG_PORT_LTSSM_LOG = 0x11,
@@ -60,12 +60,30 @@
 	MRPC_MULTI_CFG = 0x1D,
 	MRPC_SES = 0x1E,
 	MRPC_RD_FLASH = 0x1F,
+	MRPC_SPI_ECC = 0x20,
+	MRPC_PAT_GEN = 0x21,
+	MRPC_INT_LOOPBACK = 0x22,
+	MRPC_RESERVED2 = 0x24,
+	MRPC_ROUTE_TO_SELF = 0x25,
+	MRPC_REFCLK_S = 0x26,
+	MRPC_SYNTH_EP = 0x27,
+	MRPC_EVENTS_QUERY = 0x28,
 	MRPC_GAS_READ = 0x29,
+	MRPC_AER_GEN = 0x2A,
 	MRPC_PART_INFO = 0x2B,
+	MRPC_PCIE_GEN_1_2_DUMP = 0x2C,
+	MRPC_PCIE_GEN_1_2_TUNE = 0x2D,
+	MRPC_EYE_OBSERVE = 0x2F,
 	MRPC_RCVR_OBJ_DUMP = 0x30,
+	MRPC_RESERVED3 = 0x31,
 	MRPC_PORT_EQ_STATUS = 0x32,
-
+	MRPC_PORT_EQ_CTRL = 0x33,
 	MRPC_GAS_WRITE = 0x34,
+	MRPC_MRPC_ERR_INJ = 0x35,
+	MRPC_DEV_INFO_GET = 0x36,
+	MRPC_MRPC_PERM_TABLE_GET = 0x37,
+	MRPC_CROSS_HAIR = 0x38,
+	MRPC_RECV_DETECT_STATUS = 0x39,
 	MRPC_EXT_RCVR_OBJ_DUMP = 0x3A,
 	MRPC_LOG_DEF_GET = 0x3B,
 	MRPC_SECURITY_CONFIG_GET_EXT = 0x3C,


Update PTE_N encoding

Update PTE_N encoding

See https://github.com/riscv/riscv-isa-sim/pull/724

--- encoding.h
+++ encoding.h
@@ -216,7 +216,7 @@
 #define PTE_A     0x040 /* Accessed */
 #define PTE_D     0x080 /* Dirty */
 #define PTE_SOFT  0x300 /* Reserved for Software */
-#define PTE_N     0x4000000000000000 /* Zsn: NAPOT translation contiguity */
+#define PTE_N     0x8000000000000000 /* Svnapot: NAPOT translation contiguity */

 #define PTE_PPN_SHIFT 10


Changed NAMED... macros and added missing make_shared for C++11

--- incl/scc/utilities.h
+++ incl/scc/utilities.h
@@ -33,9 +33,16 @@

 #include <locale>

-#define NAMED(X, ...) X(#X, ##__VA_ARGS__)
-#define NAMEDD(T, X, ...) X(new T(#X, ##__VA_ARGS__))
-#define CREATE(T, X, I, ...)  X(T::create<I>(#X, ##__VA_ARGS__))
+#if __cplusplus < 201402L
+template<typename T, typename... Args>
+std::unique_ptr<T> make_unique(Args&&... args){
+    return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
+}
+#endif
+
+#define NAMED(X, ...)         X(#X, ##__VA_ARGS__)
+#define NAMEDD(X, T, ...)     X(make_unique<T>(#X, ##__VA_ARGS__))
+#define NAMEDC(X, T, I, ...)  X(T::create<I>(#X, ##__VA_ARGS__))

 #define TRACE_VAR(F, X) sc_core::sc_trace(F, X, std::string(this->name()) + "." #X)
 #define TRACE_ARR(F, X, I)                                                                                \


and clean up compile

and clean up compile

--- src/bin/azy.c
+++ src/bin/azy.c
@@ -59,7 +59,7 @@
    if (ev->net)
      total = azy_net_message_length_get(ev->net);
    if (total > 0)
-     INF("RSS: %zu bytes (of %i total) transferred for RSS feed %u", ev->size, total);
+     INF("RSS: %zu bytes (of %i total) transferred for RSS feed", ev->size, total);
    else
      INF("RSS: %zu bytes transferred for RSS feed", ev->size);
    return ECORE_CALLBACK_RENEW;


don't include FRAK headers

don't include FRAK headers

as this seems to fail in non-free opencv... see https://github.com/strands-project/v4r_ros_wrappers/pull/3

--- modules/features/include/v4r/features/FeatureDetectorHeaders.h
+++ modules/features/include/v4r/features/FeatureDetectorHeaders.h
@@ -35,7 +35,7 @@

 #include "FeatureDetector.h"
 #include "FeatureDetector_K_HARRIS.h"
-#include "FeatureDetector_D_FREAK.h"
+// #include "FeatureDetector_D_FREAK.h"
 #include "FeatureDetector_KD_ORB.h"
 #include "FeatureDetector_KD_FAST_IMGD.h"


移除_CRT_SECURE_NO_WARNINGS宏定义

移除_CRT_SECURE_NO_WARNINGS宏定义

没必要在头文件中定义 _CRT_SECURE_NO_WARNINGS 宏。

--- include/LCUI_Build.h
+++ include/LCUI_Build.h
@@ -41,8 +41,6 @@

 #ifndef __LCUI_BUILD_H__
 #define __LCUI_BUILD_H__
-
-#define _CRT_SECURE_NO_WARNINGS

 #if defined(__GNUC__)
 #  define LCUI_API


add constant size

add constant size

--- include/SizeMethod.h
+++ include/SizeMethod.h
@@ -9,17 +9,18 @@
 class SizeMethod {
  public:
   enum Method {
-    NO_SIZE = 0,
+    CONSTANT = 0,
     SIZE_FROM_DEGREE,
     SIZE_FROM_INDEGREE,
     SIZE_FROM_COLUMN,
     SIZE_FROM_NODE_COUNT
   };
-  SizeMethod(Method _method = NO_SIZE) : method(_method) { }
- SizeMethod(Method _method, const std::string & _column) : method(_method), column(_column) { }
+ SizeMethod(Method _method, float _constant = 0.0f) : method(_method), constant(_constant) { }
+ SizeMethod(Method _method, const std::string & _column) : method(_method), column(_column), constant(0.0f) { }

   Method getValue() const { return method; }
   const std::string & getColumn() const { return column; }
+  float getConstant() const { return constant; }
   bool definedForSource() const { return method == SIZE_FROM_DEGREE; }
   bool definedForTarget() const { return method == SIZE_FROM_DEGREE || method == SIZE_FROM_INDEGREE; }

@@ -28,6 +29,7 @@
  private:
   Method method;
   std::string column;
+  float constant;
 };

 #endif


Remove 2 variables which are not needed.

After we fetch geometry, we are only using w & h for comparison. X/Y
are never used, so remove those two variables.

Signed-off-by: Chris Michael <48d1b61d21f8504b6dc08474b224ab6407ac8581@comcast.net>

--- src/bin/sel.c
+++ src/bin/sel.c
@@ -572,9 +572,9 @@
 _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
 {
    Sel *sd = evas_object_smart_data_get(obj);
-   Evas_Coord ox, oy, ow, oh;
-   if (!sd) return;
-   evas_object_geometry_get(obj, &ox, &oy, &ow, &oh);
+   Evas_Coord ow, oh;
+   if (!sd) return;
+   evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
    if ((ow == w) && (oh == h)) return;
    evas_object_smart_changed(obj);
 }


header file to switch between kernel and libc malloc at compile time

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

--- include/adt_malloc.h
+++ include/adt_malloc.h
@@ -0,0 +1,21 @@
+//
+//  adt_malloc.h
+//  KmemAnalyzer
+//
+//  Created by Zachary Cutlip on 9/17/14.
+//  Copyright (c) 2014 Zachary Cutlip. All rights reserved.
+//
+
+#ifndef _ADT_MALLOC_H
+#define _ADT_MALLOC_H
+
+#ifdef ADT_XNU
+#include "adt_xnu_malloc.h"
+#define adt_malloc(x)   adt_xnu_malloc(x)
+#define adt_free(x)     adt_xnu_free(x)
+#else
+#define adt_malloc(x)   malloc(x)
+#define adt_free(x)     free(x)
+#endif
+
+#endif /* _ADT_MALLOC_H */


Compile on win32 without fork/setsid

Compile on win32 without fork/setsid

--- gram/jobmanager/scheduler_event_generator/source/main.c
+++ gram/jobmanager/scheduler_event_generator/source/main.c
@@ -91,6 +91,12 @@
     printf("Usage: %s [-t timestamp] -s scheduler\n", cmd);
 }

+#ifndef TARGET_ARCH_WIN32
+#define DAEMON_FLAGS "p:b"
+#else
+#define DAEMON_FLAGS
+#endif
+
 int
 main(int argc, char *argv[])
 {
@@ -100,9 +106,11 @@
     globus_result_t result = GLOBUS_SUCCESS;
     globus_bool_t background = GLOBUS_FALSE;
     char * directory = NULL;
+#ifndef TARGET_ARCH_WIN32
     char * pidfile = NULL;
-
-    while ((rc = getopt(argc, argv, "hs:t:d:p:b")) != EOF)
+#endif
+
+    while ((rc = getopt(argc, argv, "hs:t:d:" DAEMON_FLAGS)) != EOF)
     {
         switch (rc)
         {
@@ -118,19 +126,22 @@
                     exename = argv[0];
                 }

-                printf("Usage: %s -s SEG-MODULE [OPTIONS]\n\
-Process LRM events into a common format for use with GRAM\n\n\
-Options:\n\
-   -s LRM                    Parse events for the local resource manager\n\
-                             named by LRM.\n\
-   -t TIMESTAMP              Ignore events that occur prior to TIMESTAMP\n\
-                             in seconds since the epoch\n\
-   -d DIRECTORY              Write log events to files in DIRECTORY named\n\
-                             by their event timestamp (DIRECTORY/YYYYMMDD)\n\
-                             If not present, events will be written to \n\
-                             standard output\n\
-   -b                        Run in the background (only if -d used)\n\
-   -p PIDFILE                Write background process PID to PIDFILE\n\n",
+                printf("Usage: %s -s SEG-MODULE [OPTIONS]\n"
+"Process LRM events into a common format for use with GRAM\n\n"
+"Options:\n"
+"   -s LRM                    Parse events for the local resource manager\n"
+"                             named by LRM.\n"
+"   -t TIMESTAMP              Ignore events that occur prior to TIMESTAMP\n"
+"                             in seconds since the epoch\n"
+"   -d DIRECTORY              Write log events to files in DIRECTORY named\n"
+"                             by their event timestamp (DIRECTORY/YYYYMMDD)\n"
+"                             If not present, events will be written to \n"
+"                             standard output\n"
+#ifndef TARGET_ARCH_WIN32
+"   -b                        Run in the background (only if -d used)\n"
+"   -p PIDFILE                Write background process PID to PIDFILE\n"
+#endif
+"\n",
                 exename);
             }

@@ -153,6 +164,7 @@
             directory = optarg;
             break;

+#ifndef TARGET_ARCH_WIN32
         case 'p':
             pidfile = optarg;
             break;
@@ -160,6 +172,7 @@
         case 'b':
             background = GLOBUS_TRUE;
             break;
+#endif

         default:
             fprintf(stderr, "Invalid option: %c\n", (char) rc);
@@ -175,6 +188,7 @@
             directory, strerror(errno));
         exit(EXIT_FAILURE);
     }
+#ifndef TARGET_ARCH_WIN32
     if (background && !directory)
     {
         fprintf(stderr, "Ignoring -b option without -d\n");
@@ -226,6 +240,7 @@
             setsid();
         }
     }
+#endif
     globus_thread_set_model(GLOBUS_THREAD_MODEL_NONE);

     rc = globus_module_activate(GLOBUS_COMMON_MODULE);


* Remove the #define NOMINMAX for Win32 platforms.  It doesn't do any
  good, anyway, if the user includes windows.h before including
  ImathLimits.h.  Have to define NOMINMAX in the project in order to
  get this to work properly.


Btrfs: put all block modifications into the tree mod log

When running functions that can make changes to the internal trees
(e.g. btrfs_search_slot), we check if somebody may be interested in the
block we're currently modifying. If so, we record our modification to be
able to rewind it later on.

Signed-off-by: Jan Schmidt <4f71970d0506cd4341522b2fa877abc3c9925755@jan-o-sch.net>

--- fs/btrfs/ctree.c
+++ fs/btrfs/ctree.c
@@ -39,6 +39,14 @@
 			      struct extent_buffer *src_buf);
 static void del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		   struct btrfs_path *path, int level, int slot);
+static void tree_mod_log_free_eb(struct btrfs_fs_info *fs_info,
+				 struct extent_buffer *eb);
+struct extent_buffer *read_old_tree_block(struct btrfs_root *root, u64 bytenr,
+					  u32 blocksize, u64 parent_transid,
+					  u64 time_seq);
+struct extent_buffer *btrfs_find_old_tree_block(struct btrfs_root *root,
+						u64 bytenr, u32 blocksize,
+						u64 time_seq);

 struct btrfs_path *btrfs_alloc_path(void)
 {
@@ -816,6 +824,12 @@
 			ret = btrfs_dec_ref(trans, root, buf, 1, 1);
 			BUG_ON(ret); /* -ENOMEM */
 		}
+		/*
+		 * don't log freeing in case we're freeing the root node, this
+		 * is done by tree_mod_log_set_root_pointer later
+		 */
+		if (buf != root->node && btrfs_header_level(buf) != 0)
+			tree_mod_log_free_eb(root->fs_info, buf);
 		clean_tree_block(trans, root, buf);
 		*last_ref = 1;
 	}
@@ -913,6 +927,7 @@
 			parent_start = 0;

 		extent_buffer_get(cow);
+		tree_mod_log_set_root_pointer(root, cow);
 		rcu_assign_pointer(root->node, cow);

 		btrfs_free_tree_block(trans, root, buf, parent_start,
@@ -926,6 +941,8 @@
 			parent_start = 0;

 		WARN_ON(trans->transid != btrfs_header_generation(parent));
+		tree_mod_log_insert_key(root->fs_info, parent, parent_slot,
+					MOD_LOG_KEY_REPLACE);
 		btrfs_set_node_blockptr(parent, parent_slot,
 					cow->start);
 		btrfs_set_node_ptr_generation(parent, parent_slot,
@@ -1381,6 +1398,7 @@
 			goto enospc;
 		}

+		tree_mod_log_set_root_pointer(root, child);
 		rcu_assign_pointer(root->node, child);

 		add_root_to_dirty_list(root);
@@ -1455,6 +1473,8 @@
 		} else {
 			struct btrfs_disk_key right_key;
 			btrfs_node_key(right, &right_key, 0);
+			tree_mod_log_set_node_key(root->fs_info, parent,
+						  &right_key, pslot + 1, 0);
 			btrfs_set_node_key(parent, &right_key, pslot + 1);
 			btrfs_mark_buffer_dirty(parent);
 		}
@@ -1498,6 +1518,8 @@
 		/* update the parent key to reflect our changes */
 		struct btrfs_disk_key mid_key;
 		btrfs_node_key(mid, &mid_key, 0);
+		tree_mod_log_set_node_key(root->fs_info, parent, &mid_key,
+					  pslot, 0);
 		btrfs_set_node_key(parent, &mid_key, pslot);
 		btrfs_mark_buffer_dirty(parent);
 	}
@@ -1595,6 +1617,8 @@
 			struct btrfs_disk_key disk_key;
 			orig_slot += left_nr;
 			btrfs_node_key(mid, &disk_key, 0);
+			tree_mod_log_set_node_key(root->fs_info, parent,
+						  &disk_key, pslot, 0);
 			btrfs_set_node_key(parent, &disk_key, pslot);
 			btrfs_mark_buffer_dirty(parent);
 			if (btrfs_header_nritems(left) > orig_slot) {
@@ -1646,6 +1670,8 @@
 			struct btrfs_disk_key disk_key;

 			btrfs_node_key(right, &disk_key, 0);
+			tree_mod_log_set_node_key(root->fs_info, parent,
+						  &disk_key, pslot + 1, 0);
 			btrfs_set_node_key(parent, &disk_key, pslot + 1);
 			btrfs_mark_buffer_dirty(parent);

@@ -2348,6 +2374,7 @@
 		if (!path->nodes[i])
 			break;
 		t = path->nodes[i];
+		tree_mod_log_set_node_key(root->fs_info, t, key, tslot, 1);
 		btrfs_set_node_key(t, key, tslot);
 		btrfs_mark_buffer_dirty(path->nodes[i]);
 		if (tslot != 0)
@@ -2430,12 +2457,16 @@
 	} else
 		push_items = min(src_nritems - 8, push_items);

+	tree_mod_log_eb_copy(root->fs_info, dst, src, dst_nritems, 0,
+			     push_items);
 	copy_extent_buffer(dst, src,
 			   btrfs_node_key_ptr_offset(dst_nritems),
 			   btrfs_node_key_ptr_offset(0),
 			   push_items * sizeof(struct btrfs_key_ptr));

 	if (push_items < src_nritems) {
+		tree_mod_log_eb_move(root->fs_info, src, 0, push_items,
+				     src_nritems - push_items);
 		memmove_extent_buffer(src, btrfs_node_key_ptr_offset(0),
 				      btrfs_node_key_ptr_offset(push_items),
 				      (src_nritems - push_items) *
@@ -2489,11 +2520,14 @@
 	if (max_push < push_items)
 		push_items = max_push;

+	tree_mod_log_eb_move(root->fs_info, dst, push_items, 0, dst_nritems);
 	memmove_extent_buffer(dst, btrfs_node_key_ptr_offset(push_items),
 				      btrfs_node_key_ptr_offset(0),
 				      (dst_nritems) *
 				      sizeof(struct btrfs_key_ptr));

+	tree_mod_log_eb_copy(root->fs_info, dst, src, 0,
+			     src_nritems - push_items, push_items);
 	copy_extent_buffer(dst, src,
 			   btrfs_node_key_ptr_offset(0),
 			   btrfs_node_key_ptr_offset(src_nritems - push_items),
@@ -2568,6 +2602,7 @@
 	btrfs_mark_buffer_dirty(c);

 	old = root->node;
+	tree_mod_log_set_root_pointer(root, c);
 	rcu_assign_pointer(root->node, c);

 	/* the super has an extra ref to root->node */
@@ -2678,6 +2713,7 @@
 			    (unsigned long)btrfs_header_chunk_tree_uuid(split),
 			    BTRFS_UUID_SIZE);

+	tree_mod_log_eb_copy(root->fs_info, split, c, 0, mid, c_nritems - mid);
 	copy_extent_buffer(split, c,
 			   btrfs_node_key_ptr_offset(0),
 			   btrfs_node_key_ptr_offset(mid),


Win32: Unicode arguments (incoming)

Win32: Unicode arguments (incoming)

Convert command line arguments from UTF-16 to UTF-8 on startup.

Signed-off-by: Karsten Blees <955b63282c975ba379c4995cac1c2e1e7dfebe62@dcon.de>
Signed-off-by: Stepan Kasal <257b363030caa50dbc1cdef9b268d9d56bf639f1@ucw.cz>
Signed-off-by: Junio C Hamano <a6723cc3f76163bf7adb636a73ac3b0ceb3e6b9b@pobox.com>

--- compat/mingw.c
+++ compat/mingw.c
@@ -1943,10 +1943,48 @@
  */
 int _CRT_glob = 0;

+typedef struct {
+	int newmode;
+} _startupinfo;
+
+extern int __wgetmainargs(int *argc, wchar_t ***argv, wchar_t ***env, int glob,
+		_startupinfo *si);
+
+static NORETURN void die_startup()
+{
+	fputs("fatal: not enough memory for initialization", stderr);
+	exit(128);
+}
+
 void mingw_startup()
 {
-	/* copy executable name to argv[0] */
-	__argv[0] = xstrdup(_pgmptr);
+	int i, len, maxlen, argc;
+	char *buffer;
+	wchar_t **wenv, **wargv;
+	_startupinfo si;
+
+	/* get wide char arguments and environment */
+	si.newmode = 0;
+	if (__wgetmainargs(&argc, &wargv, &wenv, _CRT_glob, &si) < 0)
+		die_startup();
+
+	/* determine size of argv and environ conversion buffer */
+	maxlen = wcslen(_wpgmptr);
+	for (i = 1; i < argc; i++)
+		maxlen = max(maxlen, wcslen(wargv[i]));
+
+	/* allocate buffer (wchar_t encodes to max 3 UTF-8 bytes) */
+	maxlen = 3 * maxlen + 1;
+	buffer = xmalloc(maxlen);
+
+	/* convert command line arguments and environment to UTF-8 */
+	len = xwcstoutf(buffer, _wpgmptr, maxlen);
+	__argv[0] = xmemdupz(buffer, len);
+	for (i = 1; i < argc; i++) {
+		len = xwcstoutf(buffer, wargv[i], maxlen);
+		__argv[i] = xmemdupz(buffer, len);
+	}
+	free(buffer);

 	/* initialize critical section for waitpid pinfo_t list */
 	InitializeCriticalSection(&pinfo_cs);


New pin remapping. Alpha version, not tested on real hardware


Btrfs: Update magic

Btrfs: Update magic

Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>

--- fs/btrfs/ctree.h
+++ fs/btrfs/ctree.h
@@ -37,7 +37,7 @@
 extern struct kmem_cache *btrfs_bit_radix_cachep;
 extern struct kmem_cache *btrfs_path_cachep;

-#define BTRFS_MAGIC "_B3RfS_M"
+#define BTRFS_MAGIC "_B4RfS_M"

 #define BTRFS_MAX_LEVEL 8
 #define BTRFS_ROOT_TREE_OBJECTID 1ULL


Output biggest errors

Output biggest errors

--- compile/test.c
+++ compile/test.c
@@ -52,7 +52,7 @@

 #define SETUP()                                 \
         clock_t start, end, zero;               \
-        int i, j;                               \
+        int i, j, maxi;                         \
         unsigned long long int max = 0;         \
         double total = 0;                       \
         float *rands, *out, *correct;           \
@@ -122,15 +122,23 @@
 #endif

 #define CHECK(type, iter)                                               \
+        maxi = -1;                                                      \
         max = total = 0;                                                \
         for (i = 0; i < iter; i++) {                                    \
                 if (correct[i] == correct[i]) {                         \
                         unsigned long long int error = ulp(out[i], correct[i]); \
-                        if (error > max) max = error;                   \
+                        if (error > max) { maxi = i; max = error; }     \
                         total += log(error + 1.0) / log(2);             \
                 }                                                       \
         }                                                               \
-        printf("%s: max %f avg %f\n", #type, log(max + 1.0) / log(2), total / count);
+        printf("%s: max %f avg %f\n", #type, log(max + 1.0) / log(2), total / count); \
+        if (max > 0) {                                                  \
+                printf("\tat ");                                         \
+                for (int j = 0; j < NARGS; j++) {                       \
+                        printf("%g ", rands[maxi*NARGS + j]);           \
+                }                                                       \
+                printf(" (%g not %g)\n", out[maxi], correct[maxi]);     \
+        }

 #define SAMPLE(iter)                                                    \
         srand(time(NULL));                                              \
@@ -145,12 +153,12 @@
                 if (correct[i] == correct[i]) {                         \
                         count += 1;                                     \
                 }                                                       \
-        }
+        }

 int main(int argc, char** argv) {
         int count;
         SETUP();
-
+
         int iter = 1000000;
         if (argc > 1) iter = atoi(argv[1]);

@@ -179,5 +187,5 @@
         CHECK(ol, iter);

         return 0;
-
+
 }


More OS X fixes

More OS X fixes

--- util.c
+++ util.c
@@ -1073,7 +1073,7 @@
             memset(undo_event, 0, sizeof (*undo_event));
             undo_event->ident = revents[evno].ident;
             undo_event->filter = revents[evno].filter;
-            undo_event->flags = EV_DELETE;
+            undo_event->flags = EV_DELETE | EV_RECEIPT;
         } else if (revents[evno].udata != NULL) {
             struct pollfd* fd = revents[evno].udata;
             fd->revents = POLLNVAL;
@@ -1127,7 +1127,7 @@
     bool sig_happened = false;

     for (evno = 0; evno < nret; ++evno) {
-        struct kevent* kev = &events[evno];
+        struct kevent* kev = &revents[evno];
         if (kev->filter == EVFILT_READ ||
             kev->filter == EVFILT_WRITE)
         {
@@ -1140,6 +1140,7 @@
         }

         if (kev->filter == EVFILT_SIGNAL) {
+            assert(key->data != 0);
             dbg("got signal %d", (int) kev->data);
             sig_happened = true;
         }


Btrfs: Align extent length to sectorsize in

---

Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>

--- fs/btrfs/inode.c
+++ fs/btrfs/inode.c
@@ -823,6 +823,8 @@
 					btrfs_file_extent_num_bytes(leaf, fi);
 				extent_num_bytes = inode->i_size -
 					found_key.offset + root->sectorsize - 1;
+				extent_num_bytes = extent_num_bytes &
+					~((u64)root->sectorsize - 1);
 				btrfs_set_file_extent_num_bytes(leaf, fi,
 							 extent_num_bytes);
 				num_dec = (orig_num_bytes -


Fix formatting issue.

Fix formatting issue.

--- util.c
+++ util.c
@@ -130,7 +130,7 @@
         // we found the decimal point; handle all trailing zeros by setting scale to 0
         return DirectFunctionCall2(numeric_trunc, num, Int32GetDatum(p > j ? p - j : 0));
         break;
-    } else if (p < 0 ) {
+    } else if (p < 0) {
       p = j;
     }
   }


Simplify the ptp sampling problem by using samples with windows at the median or smaller. Preen and
quality parameters are removed. This greatly improves accuracy.

Add calculation of standard deviation for tx -> rx timestamps.

--- ethtscal.c
+++ ethtscal.c
@@ -95,15 +95,13 @@

 // Command line parameters
 static const char *             progname;
-static int                      hwstamps = 1;
-static unsigned long            iterations = 1;
+static unsigned int             hwstamps = 1;
+static unsigned int             iterations = 1;
+static unsigned int             ptp_samples = PTP_MAX_SAMPLES;
 static long                     rx_comp = 0;
 static long                     tx_comp = 0;
 static long                     sw_comp = 0;
 static double                   cable_len = 0.0;
-static unsigned long            ptp_samples = PTP_MAX_SAMPLES;
-static unsigned long            ptp_preen_pct = 100;
-static unsigned long            ptp_quality = 0;

 // tx/rx sockets
 static int                      tx_socket;
@@ -125,9 +123,10 @@
 static int                      tx_ptp_index;
 static int                      rx_ptp_index;

-// tx/rx message and packet buffers
+// tx packet buffer
 static char                     tx_packet[ETHER_PACKET_BYTES];

+// tx and rx info structures
 typedef struct
 {
     struct timespec             timestamp;
@@ -135,46 +134,28 @@
     long                        before_send_to_timestamp;
     long                        after_send_to_before_poll;
     long                        after_send_to_after_poll;
-    unsigned long               ptp_samples_used;
     long                        ptp_offset_avg;
-}
-send_times;
+    unsigned int                ptp_samples_used;
+}
+tx_info;

 typedef struct
 {
     struct timespec             timestamp;
     long                        timestamp_to_poll_return;
-    unsigned long               ptp_samples_used;
     long                        ptp_offset_avg;
-}
-recv_times;
-
-static send_times *             tx_values;
-static recv_times *             rx_values;
-
-
-
-// tx/rx miscellaneous system timestamps
+    unsigned int                ptp_samples_used;
+}
+rx_info;
+
+static tx_info *                tx_values;
+static rx_info *                rx_values;

 //
 // Error
 //
-#if 0
-__attribute__ ((format (printf, 1, 2)))
-static void
-error(
-    const char *                format,
-    ...)
-{
-    va_list                     args;
-
-    va_start(args, format);
-    vfprintf(stderr, format, args);
-    va_end(args);
-}
-#endif
 __attribute__ ((noreturn, format (printf, 1, 2)))
 static void
 fatal(
@@ -536,6 +517,127 @@

 //
+// sqrt function for standard deviation
+//
+static unsigned long
+llsqrt(
+    unsigned long long          x)
+{
+    unsigned long long          prev;
+    unsigned long long          s;
+
+    s = x;
+    if (s)
+    {
+        prev = ~((unsigned long long) 1 << 63);
+
+        while (s < prev)
+        {
+            prev = s;
+            s = (s + (x / s)) / 2;
+        }
+    }
+
+    return (unsigned long) s;
+}
+
+
+
+//
+// Determine the median of an array of longs
+// (Thanks to Torben Mogensen)
+//
+static long
+median(
+    long                        array[],
+    unsigned int                count)
+{
+    long                        min;
+    long                        max;
+    long                        guess;
+    long                        maxltguess;
+    long                        mingtguess;
+    unsigned int                less;
+    unsigned int                greater;
+    unsigned int                equal;
+    unsigned int                i;
+
+    min = array[0];
+    max = array[0];
+
+    for (i = 1; i < count; i++)
+    {
+        if (array[i] < min)
+        {
+            min = array[i];
+        }
+        if (array[i] > max)
+        {
+            max = array[i];
+        }
+    }
+
+    while (1) {
+        less = 0;
+        greater = 0;
+        equal = 0;
+        guess = (min + max) / 2;
+        maxltguess = min;
+        mingtguess = max;
+
+        for (i = 0; i < count; i++)
+        {
+            if (array[i] < guess)
+            {
+                less++;
+                if (array[i] > maxltguess)
+                {
+                    maxltguess = array[i];
+                }
+            }
+            else if (array[i] > guess)
+            {
+                greater++;
+                if (array[i] < mingtguess)
+                {
+                    mingtguess = array[i];
+                }
+            }
+            else
+            {
+                equal++;
+            }
+        }
+        if (less <= (count + 1) / 2 && greater <= (count + 1) / 2)
+        {
+            break;
+        }
+        else if (less > greater)
+        {
+            max = maxltguess;
+        }
+        else
+        {
+            min = mingtguess;
+        }
+    }
+
+    if (less >= (count + 1) / 2) {
+        return(maxltguess);
+    }
+    else if (less + equal >= (count + 1) / 2)
+    {
+        return(guess);
+    }
+    else
+    {
+        return(mingtguess);
+    }
+}
+
+
+
+//
 // Capture the current ptp/sys clock offset
 //
 static void
@@ -564,41 +666,38 @@
 ptp_offset_average(
     struct ptp_sys_offset *     ptp_offset,
     long *                      average,
-    unsigned long *             samples_used)
-{
-    long                        window[PTP_MAX_SAMPLES];
-    long                        offset[PTP_MAX_SAMPLES];
-    long                        smallest_window = LONG_MAX;
+    unsigned int *              samples_used)
+{
+    long                        window[PTP_MAX_SAMPLES] = {0};
     long                        total_offset = 0;
     long                        total_window = 0;
-    unsigned long               used = 0;
+    long                        median_window;
+    unsigned int                used = 0;
     struct ptp_clock_time *     pc;
     unsigned int                i;

+    // Record the window sizes
     for (i = 0; i < ptp_offset->n_samples; i++)
     {
         pc = ptp_offset->ts + i * 2;
-
         window[i] = ptpclock_delta(&pc[0], &pc[2]);
-        offset[i] = ptpclock_delta(&pc[1], &pc[0]);
-        if (window[i] < smallest_window)
-        {
-            smallest_window = window[i];
-        }
-    }
-
+    }
+
+    // Use samples that are at or below the median window size
+    median_window = median(window, ptp_offset->n_samples);
     for (i = 0; i < ptp_offset->n_samples; i++)
     {
-        if (window[i] > smallest_window + smallest_window * (long) ptp_preen_pct / 100L)
+        if (window[i] > median_window)
         {
             continue;
         }

-        total_offset += offset[i];
+        pc = ptp_offset->ts + i * 2;
+        total_offset += ptpclock_delta(&pc[1], &pc[0]);
+
         total_window += window[i];
         used++;
     }
-    assert(used);

     *average = total_offset / (long) used + total_window / (long) used / 2;
     *samples_used = used;
@@ -862,7 +961,7 @@
 usage(void)
 {
     fprintf(stderr, "Usage:\n");
-    fprintf(stderr, "  %s [-S] [-i iterations] [-r rx_comp] [-t tx_comp] [-s sw_comp] [-c cable_len] [-o ptp_samples] [-p ptp_percentage] [-q minimum_samples] src_iface dst_iface\n\n", progname);
+    fprintf(stderr, "  %s [-S] [-i iterations] [-r rx_comp] [-t tx_comp] [-s sw_comp] [-c cable_len] [-p ptp_samples] src_iface dst_iface\n\n", progname);
     fprintf(stderr, "  options:\n");
     fprintf(stderr, "    -S use software timestamps instead of hardware timestamps (low accuracy)\n");
     fprintf(stderr, "    -i number of iterations (default 1)\n");
@@ -870,10 +969,7 @@
     fprintf(stderr, "    -t receive compensation in nanoseconds\n");
     fprintf(stderr, "    -s switch compensation in nanoseconds\n");
     fprintf(stderr, "    -c cable length in meters (default 0.0)\n");
-    fprintf(stderr, "    -o number of ptp clock samples to request\n");
-    fprintf(stderr, "    -p preen ptp clock samples to within pct of smallest window\n");
-    fprintf(stderr, "    -q minimum number of samples for a successful test\n");
-    // packet size?
+    fprintf(stderr, "    -p number of ptp clock samples to request\n");
 }

@@ -890,7 +986,7 @@

     progname = argv[0];

-    while((opt = getopt(argc, argv, "Si:r:t:s:c:o:p:q:")) != -1)
+    while((opt = getopt(argc, argv, "Si:r:t:s:c:p:")) != -1)
     {
         switch (opt)
         {
@@ -898,7 +994,7 @@
             hwstamps = 0;
             break;
         case 'i':
-            iterations = strtoul(optarg, NULL, 10);
+            iterations = (unsigned int) strtoul(optarg, NULL, 10);
             break;
         case 'r':
             rx_comp = strtol(optarg, NULL, 10);
@@ -912,26 +1008,18 @@
         case 'c':
             cable_len = strtod(optarg, NULL);
             break;
-        case 'o':
-            ptp_samples = strtoul(optarg, NULL, 10);
+        case 'p':
+            ptp_samples = (unsigned int) strtoul(optarg, NULL, 10);
             if (ptp_samples > PTP_MAX_SAMPLES)
             {
                 fatal("ptp_samples must be less than or equal to %d\n", PTP_MAX_SAMPLES);
             }
             break;
-        case 'p':
-            ptp_preen_pct = strtoul(optarg, NULL, 10);
-            break;
-        case 'q':
-            ptp_quality = strtoul(optarg, NULL, 10);
-            break;
         default:
             usage();
             exit(EXIT_FAILURE);
         }
     }
-
-    // FIXME check validity of preen and samples vs quality

     // Ensure we have the correct number of parameters
     if (argc != optind + 2)
@@ -965,23 +1053,25 @@
     long                        tx_after_send_to_after_poll_total = 0;
     long                        rx_timestamp_to_poll_return_total = 0;
     long                        tx_rx_timestamp_total = 0;
-    long                        tx_ptp_samples_used_total = 0;
-    long                        rx_ptp_samples_used_total = 0;
+    unsigned long long          tx_rx_timestamp_total2 = 0;
     long                        tx_ptp_offset_avg_total = 0;
     long                        rx_ptp_offset_avg_total = 0;
-    long                        count = 0;
+    unsigned long               tx_ptp_samples_used_total = 0;
+    unsigned long               rx_ptp_samples_used_total = 0;

     long                        tx_before_send_to_after_send;
     long                        tx_before_send_to_timestamp;
     long                        tx_after_send_to_before_poll;
     long                        tx_after_send_to_after_poll;
     long                        rx_timestamp_to_poll_return;
-    long                        tx_ptp_samples_used;
-    long                        rx_ptp_samples_used;
     long                        tx_ptp_offset_avg;
     long                        rx_ptp_offset_avg;
-
+    unsigned long               tx_ptp_samples_used;
+    unsigned long               rx_ptp_samples_used;
+
+    long                        delta;
     long                        tx_rx_raw;
+    unsigned long               tx_rx_raw_stddev;
     long                        tx_rx_compensated;

     unsigned int                i;
@@ -1014,7 +1104,7 @@
     }
     else
     {
-        printf("WARNING: Using softare timestamps instead of hardware. Results will be inaccurate.\n\n");
+        printf("WARNING: Using software timestamps instead of hardware. Results will be inaccurate.\n\n");
     }

     // Drain any pending messages and clear any error state.
@@ -1044,7 +1134,7 @@

     if (iterations > 1)
     {
-        printf("Iterating over %lu packets (minimum runtime %ld seconds)\n\n", iterations,
+        printf("Iterating over %u packets (minimum runtime %ld seconds)\n\n", iterations,
                (TX_SEND_DELAY * MILLION + sfsw_expected) * (long) iterations / BILLION);
     }

@@ -1059,11 +1149,6 @@

     for (i = 0; i < iterations; i++)
     {
-        if (hwstamps && (tx_values[i].ptp_samples_used < ptp_quality || rx_values[i].ptp_samples_used < ptp_quality))
-        {
-            continue;
-        }
-        count++;
         tx_ptp_samples_used_total += tx_values[i].ptp_samples_used;
         rx_ptp_samples_used_total += rx_values[i].ptp_samples_used;
         tx_ptp_offset_avg_total += tx_values[i].ptp_offset_avg;
@@ -1073,31 +1158,25 @@
         tx_after_send_to_before_poll_total += tx_values[i].after_send_to_before_poll;
         tx_after_send_to_after_poll_total += tx_values[i].after_send_to_after_poll;
         rx_timestamp_to_poll_return_total += rx_values[i].timestamp_to_poll_return;
-        tx_rx_timestamp_total += timespec_delta(&tx_values[i].timestamp, &rx_values[i].timestamp);
-    }
-
-    if (count < (long) iterations)
-    {
-        if (count == 0)
-        {
-            fatal("No samples left after preen and quality\n");
-        }
-
-        printf("Using %ld of %ld iterations\n\n", count, iterations);
-    }
-
-    tx_ptp_samples_used = tx_ptp_samples_used_total / count;
-    rx_ptp_samples_used = rx_ptp_samples_used_total / count;
-    tx_ptp_offset_avg = tx_ptp_offset_avg_total / count;
-    rx_ptp_offset_avg = rx_ptp_offset_avg_total / count;
-
-    tx_before_send_to_after_send = tx_before_send_to_after_send_total / count;
-    tx_before_send_to_timestamp = tx_before_send_to_timestamp_total / count;
-    tx_after_send_to_before_poll = tx_after_send_to_before_poll_total / count;
-    tx_after_send_to_after_poll = tx_after_send_to_after_poll_total / count;
-    rx_timestamp_to_poll_return = rx_timestamp_to_poll_return_total / count;
-
-    tx_rx_raw =  tx_rx_timestamp_total / count;
+
+        delta = timespec_delta(&tx_values[i].timestamp, &rx_values[i].timestamp);
+        tx_rx_timestamp_total += delta;
+        tx_rx_timestamp_total2 += (unsigned long long) (delta * delta);
+    }
+
+    tx_ptp_samples_used = tx_ptp_samples_used_total / iterations;
+    rx_ptp_samples_used = rx_ptp_samples_used_total / iterations;
+    tx_ptp_offset_avg = tx_ptp_offset_avg_total / (long) iterations;
+    rx_ptp_offset_avg = rx_ptp_offset_avg_total / (long) iterations;
+
+    tx_before_send_to_after_send = tx_before_send_to_after_send_total / (long) iterations;
+    tx_before_send_to_timestamp = tx_before_send_to_timestamp_total / (long) iterations;
+    tx_after_send_to_before_poll = tx_after_send_to_before_poll_total / (long) iterations;
+    tx_after_send_to_after_poll = tx_after_send_to_after_poll_total / (long) iterations;
+    rx_timestamp_to_poll_return = rx_timestamp_to_poll_return_total / (long) iterations;
+
+    tx_rx_raw =  tx_rx_timestamp_total / (long) iterations;
+    tx_rx_raw_stddev = llsqrt((tx_rx_timestamp_total2 / iterations) - ((unsigned long long) (tx_rx_raw * tx_rx_raw)));
     tx_rx_compensated = tx_rx_raw - tx_comp - rx_comp;

     printf("Tx interface %s, speed %dMb, adddress %s\n", tx_name, tx_speed, ether_ntoa(&tx_addr));
@@ -1105,9 +1184,8 @@
     printf("\n");
     if (hwstamps)
     {
-        printf("Ptp samples %lu, preen percentage %lu, minimum samples %lu\n", ptp_samples, ptp_preen_pct, ptp_quality);
-        printf("Tx avg ptp offset %ldns, %lu samples used\n", tx_ptp_offset_avg, tx_ptp_samples_used);
-        printf("Rx avg ptp offset %ldns, %lu samples used\n", rx_ptp_offset_avg, rx_ptp_samples_used);
+        printf("Tx avg ptp offset %ldns, %lu of %u samples used\n", tx_ptp_offset_avg, tx_ptp_samples_used, ptp_samples);
+        printf("Rx avg ptp offset %ldns, %lu of %u samples used\n", rx_ptp_offset_avg, rx_ptp_samples_used, ptp_samples);
         printf("\n");
     }

@@ -1126,7 +1204,7 @@
     printf("  Total                            %8ldns\n\n", tx_comp + rx_comp + sw_comp + cable_comp);

     printf("Tx -> Rx timestamp:\n");
-    printf("  Uncompensated                    %8ldns\n", tx_rx_raw);
+    printf("  Uncompensated                    %8ldns  (stddev %ldns)\n", tx_rx_raw, tx_rx_raw_stddev);
     printf("  Compensated                      %8ldns\n\n", tx_rx_compensated);

     printf("Connection types:       Expected        Error\n");


btrfs: add RENAME_NOREPLACE

btrfs: add RENAME_NOREPLACE

RENAME_NOREPLACE is trivial to implement for most filesystems: switch over
to ->rename2() and check for the supported flags.  The rest is done by the
VFS.

Signed-off-by: Miklos Szeredi <84cd5483a2f9acd1c37251cba7c2908448f221b8@suse.cz>
Cc: Chris Mason <e2e8c5702d8ed5f565988a1cf5bb35c9ce199e5e@fb.com>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- fs/btrfs/inode.c
+++ fs/btrfs/inode.c
@@ -8476,6 +8476,16 @@
 	return ret;
 }

+static int btrfs_rename2(struct inode *old_dir, struct dentry *old_dentry,
+			 struct inode *new_dir, struct dentry *new_dentry,
+			 unsigned int flags)
+{
+	if (flags & ~RENAME_NOREPLACE)
+		return -EINVAL;
+
+	return btrfs_rename(old_dir, old_dentry, new_dir, new_dentry);
+}
+
 static void btrfs_run_delalloc_work(struct btrfs_work *work)
 {
 	struct btrfs_delalloc_work *delalloc_work;
@@ -9019,7 +9029,7 @@
 	.link		= btrfs_link,
 	.mkdir		= btrfs_mkdir,
 	.rmdir		= btrfs_rmdir,
-	.rename		= btrfs_rename,
+	.rename2	= btrfs_rename2,
 	.symlink	= btrfs_symlink,
 	.setattr	= btrfs_setattr,
 	.mknod		= btrfs_mknod,


Fixing this bug too.

Fixing this bug too.

--- util.c
+++ util.c
@@ -543,7 +543,7 @@
     fprintf(debug_file, "%s\n", out);
   }

-  if (size >= (BUFSIZE - 1)) {
+  if ( out != buffer ) {
     free(out);
   }
 #else /* Windows, MAC */


compile fix - mpi now compiles (again) w/o distributed api extension

--- ospray/common/OSPCommon.h
+++ ospray/common/OSPCommon.h
@@ -20,7 +20,7 @@
   ospray file should know about */

 // mpi, if we need it
-#ifdef OSPRAY_MPI_DISTRIBUTED
+#ifdef OSPRAY_MPI
 # include <mpi.h>
 #endif


util: fix map_buffer() warning message

util: fix map_buffer() warning message

Signed-off-by: Felipe Contreras <de77a8b9cd239b204c19c52ed62e48ab47243362@nokia.com>

--- util.c
+++ util.c
@@ -70,7 +70,7 @@
 			   buf->data,
 			   (size_t)buf->data % alignment,
 			   buf->data + buf->size,
-			   (size_t)buf->data + buf->size % alignment,
+			   (size_t)(buf->data + buf->size) % alignment,
 			   dma_dir_to_str(b->dir));
 	}


refine to hold information about each thread.

--- kcndbd/kcndb_server.c
+++ kcndbd/kcndb_server.c
@@ -30,24 +30,28 @@
 };

 struct kcndb_thread {
+	pthread_t kt_id;
 	enum kcndb_thread_status kt_status;
-	pthread_t kt_id;
+	unsigned short kt_number;
 	int kt_listenfd;
 	struct event_base *kt_evb;
 };

+#define KCNDB_THREAD_NUMBER_MAIN	0
+
 static int kcndb_server_socket = -1;
 static in_port_t kcndb_server_port = KCN_HTONS(KCN_NETSTAT_PORT_DEFAULT);

-#define KCNDB_SERVER_NWORKERS	8
+#define KCNDB_SERVER_NWORKERS		8
 static struct kcndb_thread kcndb_server_threads[KCNDB_SERVER_NWORKERS];

 static void *kcndb_server_main(void *);

 static void
-kcndb_thread_init(struct kcndb_thread *kt)
-{
-
+kcndb_thread_init(struct kcndb_thread *kt, unsigned short n)
+{
+
+	kt->kt_number = n;
 	kt->kt_listenfd = kcndb_server_socket;
 }

@@ -77,8 +81,8 @@
 	KCN_LOG(INFO, "server listen on %u with fd %d.",
 	    ntohs(kcndb_server_port), kcndb_server_socket);

-	for (i = 0; i < KCNDB_SERVER_NWORKERS; i++) {
-		kcndb_thread_init(&kcndb_server_threads[i]);
+	for (i = KCNDB_THREAD_NUMBER_MAIN + 1; i < KCNDB_SERVER_NWORKERS; i++) {
+		kcndb_thread_init(&kcndb_server_threads[i], i);
 		error = pthread_create(&kcndb_server_threads[i].kt_id, NULL,
 		    kcndb_server_main, &kcndb_server_threads[i]);
 		if (error != 0) {
@@ -106,12 +110,13 @@
 void
 kcndb_server_loop(void)
 {
-	struct kcndb_thread kt;
-
-	kcndb_thread_init(&kt);
-	kt.kt_id = pthread_self();
-	kt.kt_status = KCNDB_THREAD_STATUS_RUN;
-	kcndb_server_main(&kt);
+	struct kcndb_thread *kt;
+
+	kt = &kcndb_server_threads[KCNDB_THREAD_NUMBER_MAIN];
+	kcndb_thread_init(kt, KCNDB_THREAD_NUMBER_MAIN);
+	kt->kt_id = pthread_self();
+	kt->kt_status = KCNDB_THREAD_STATUS_RUN;
+	kcndb_server_main(kt);
 }

 static bool


give die() more standard behavior

give die() more standard behavior

--- util.c
+++ util.c
@@ -1,8 +1,9 @@
 #include <stdio.h>
 #include <stdlib.h>

-extern void	warn		();
-extern void	chomp		(char * buf, size_t biufsiz);
+extern void	warn	();
+inline void	die	();
+extern void	chomp	(char * buf, size_t biufsiz);

 void
 chomp(char *buf, size_t bufsiz)
@@ -13,9 +14,9 @@
 }

 void
-die ()
+die (char *s)
 {
-	perror("edna");
+	perror(s);
 	exit(1);
 }


Receiver debug output..

Receiver debug output..

--- proto/ICSC.h
+++ proto/ICSC.h
@@ -423,6 +423,11 @@
         // Record the timestamp of this byte, so that we know how long since we last
         // saw any activity on the line
         _lastByteSeen = millis();
+
+        Serial.print("inch=");
+        Serial.print(inch);
+        Serial.print(", _recPhase=");
+        Serial.println(_recPhase);

         switch(_recPhase) {


Fix HAPIString::myString so that it has the correct size

--- util.h
+++ util.h
@@ -153,13 +153,13 @@
                 return;
             }

-            myString.resize(bufLen);
+            myString.resize(bufLen - 1);

             HAPI_GetString(
                     theHAPISession.get(),
                     myHandle,
                     &myString[0],
-                    myString.size()
+                    myString.size() + 1
                     );
         }


Btrfs: use __u64 types in ioctl.h

Btrfs: use __u64 types in ioctl.h

Signed-off-by: Sage Weil <6dd34506bbd5e58221bbb3e4732d97c91f02277b@newdream.net>
Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>

--- fs/btrfs/ioctl.h
+++ fs/btrfs/ioctl.h
@@ -127,14 +127,14 @@
 };

 struct btrfs_ioctl_space_info {
-	u64 flags;
-	u64 total_bytes;
-	u64 used_bytes;
+	__u64 flags;
+	__u64 total_bytes;
+	__u64 used_bytes;
 };

 struct btrfs_ioctl_space_args {
-	u64 space_slots;
-	u64 total_spaces;
+	__u64 space_slots;
+	__u64 total_spaces;
 	struct btrfs_ioctl_space_info spaces[0];
 };


remove call to freecf(); thereby fixing null ptr deref

--- proto/sqhl.c
+++ proto/sqhl.c
@@ -2094,7 +2094,6 @@
   if (locerr)
     {
     delete_casn(&cert.self);
-    freecf(cf);
     return locerr;
     }
   if ( utrust > 0 )


Remove attribute pure from pstrerror.

Remove attribute pure from pstrerror.

darcs-hash:20060905001150-4cc09-7ee3a04c6bdafa2ef19fd262b5dbf9b7fe798c5d.gz

--- util.h
+++ util.h
@@ -87,7 +87,7 @@
 unsigned int hash(unsigned seed, const void *restrict key, int key_size,
                   unsigned int hash_size)
      ATTRIBUTE ((pure));
-char *pstrerror(int e) ATTRIBUTE ((pure));
+char *pstrerror(int e);
 time_t mktime_gmt(struct tm *tm) ATTRIBUTE ((pure));
 char *expandTildeString(char *string);
 AtomPtr expandTilde(AtomPtr filename);


sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check

The check at the beginning of cpupri_find() makes sure that the task_pri
variable does not exceed the cp->pri_to_cpu array length. But that length
is CPUPRI_NR_PRIORITIES not MAX_RT_PRIO, where it will miss the last two
priorities in that array.

As task_pri is computed from convert_prio() which should never be bigger
than CPUPRI_NR_PRIORITIES, if the check should cause a panic if it is
hit.

Reported-by: Mike Galbraith <d1e2fad1f6337a0a3a08db0a5375a8a96150db4c@gmail.com>
Signed-off-by: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>
Signed-off-by: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: 4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org
Link: debb09096dd9d60b94d222a36c2c4b975881811d@marge.simpson.net
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>

--- kernel/sched/cpupri.c
+++ kernel/sched/cpupri.c
@@ -70,8 +70,7 @@
 	int idx = 0;
 	int task_pri = convert_prio(p->prio);

-	if (task_pri >= MAX_RT_PRIO)
-		return 0;
+	BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES);

 	for (idx = 0; idx < task_pri; idx++) {
 		struct cpupri_vec *vec  = &cp->pri_to_cpu[idx];


TCXB8-93,TCXB8-2,TCXB8-30 : Bring up RDK-B XB8 image on topic branch

Reason for change: product class is wrong on XB8
Test Procedure: Build and verify
Risks: None
Signed-off-by: Gowthami Kanthasamy <gowthami.kanthasamy@technicolor.com>

(cherry picked from commit b63b91a02853e6c8c5eaa9e7dff5af98fca36b5e)
(cherry picked from commit 0a7ebadac4b983342bc11a540e1e26cc4e9caf45)
Change-Id: Ieb9f6e713c511476e08ed5f0008fa572a18a2754

--- source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c
+++ source-arm/TR-181/board_sbapi/cosa_deviceinfo_apis.c
@@ -528,6 +528,10 @@
 	{
 		AnscCopyString(pValue, "CBR");
 	}
+#elif defined(_XB8_PRODUCT_REQ_)
+    {
+         AnscCopyString(pValue, "XB8");
+    }
 #elif defined(_XB7_PRODUCT_REQ_)
     {
          AnscCopyString(pValue, "XB7");


Export createRayRend

Export createRayRend

--- virvo/virvo/vvrayrendfactory.h
+++ virvo/virvo/vvrayrendfactory.h
@@ -1,6 +1,8 @@
 #pragma once
+
+#include "vvexport.h"

 /*! \brief  factory function, can e. g. be called by dlsym() to create rayrend from within plugin
  */
-extern "C" vvRenderer* createRayRend(vvVolDesc* vd, vvRenderState const& rs);
+extern "C" VVAPI vvRenderer* createRayRend(vvVolDesc* vd, vvRenderState const& rs);


Removing special disable for GL_VERSION_1_3 on gtk OpenGL.

--- source/graphics/graphics_library.h
+++ source/graphics/graphics_library.h
@@ -64,9 +64,6 @@
 #undef GL_NV_vertex_program
 #undef GL_NV_register_combiners2
 #endif /* defined (WIN32_SYSTEM) */
-#endif
-#if defined (GTK_USER_INTERFACE)
-  #undef GL_VERSION_1_3
 #endif
 #include "graphics/texture.h"


btrfs: fix early abort in 'remount'

btrfs: fix early abort in 'remount'

Cc: Jeff Mahoney <5459ed423adecc5a7fe2249dd619058acc25c497@suse.com>
Cc: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>
Cc: Josef Bacik <78b342861d821967b29f951b7366f5a0267e0c38@redhat.com>
Signed-off-by: Sergei Trofimovich <110fdadc76b6bce16977f568bdb4723eaed6fb3f@gentoo.org>

--- fs/btrfs/super.c
+++ fs/btrfs/super.c
@@ -1152,13 +1152,15 @@
 		if (ret)
 			goto restore;
 	} else {
-		if (fs_info->fs_devices->rw_devices == 0)
+		if (fs_info->fs_devices->rw_devices == 0) {
 			ret = -EACCES;
 			goto restore;
-
-		if (btrfs_super_log_root(fs_info->super_copy) != 0)
+		}
+
+		if (btrfs_super_log_root(fs_info->super_copy) != 0) {
 			ret = -EINVAL;
 			goto restore;
+		}

 		ret = btrfs_cleanup_fs_roots(fs_info);
 		if (ret)


minor fix for assert

minor fix for assert

--- kaffe/kaffevm/utf8const.c
+++ kaffe/kaffevm/utf8const.c
@@ -218,7 +218,7 @@
 		jfree(utf8);
 	}

-	assert(temp->nrefs > 0);
+	assert(temp == 0 || temp->nrefs > 0);
 	return (temp);
 }


Set the default PAPI domain to PAPI_DOM_ALL to monitor all contexts (user, kernel, etc).  This should improve our ability to detect time spent in syscalls with PAPI events.

--- src/tool/hpcrun/sample-sources/papi.c
+++ src/tool/hpcrun/sample-sources/papi.c
@@ -128,6 +128,13 @@
 	PAPI_VER_CURRENT, ret);
     exit(1);
   }
+
+  // Tell PAPI to count events in all contexts (user, kernel, etc).
+  ret = PAPI_set_domain(PAPI_DOM_ALL);
+  if (ret != PAPI_OK) {
+    EMSG("warning: PAPI_set_domain(PAPI_DOM_ALL) failed: %d", ret);
+  }
+
   self->state = INIT;
 }


ftrace: Optimize the function tracer list loop

There is lots of places that perform:

       op = rcu_dereference_raw(ftrace_control_list);
       while (op != &ftrace_list_end) {

Add a helper macro to do this, and also optimize for a single
entity. That is, gcc will optimize a loop for either no iterations
or more than one iteration. But usually only a single callback
is registered to the function tracer, thus the optimized case
should be a single pass. to do this we now do:

	op = rcu_dereference_raw(list);
	do {
		[...]
	} while (likely(op = rcu_dereference_raw((op)->next)) &&
	       unlikely((op) != &ftrace_list_end));

An op is always registered (ftrace_list_end when no callbacks is
registered), thus when a single callback is registered, the link
list looks like:

 top => callback => ftrace_list_end => NULL.

The likely(op = op->next) still must be performed due to the race
of removing the callback, where the first op assignment could
equal ftrace_list_end. In that case, the op->next would be NULL.
But this is unlikely (only happens in a race condition when
removing the callback).

But it is very likely that the next op would be ftrace_list_end,
unless more than one callback has been registered. This tells
gcc what the most common case is and makes the fast path with
the least amount of branches.

Signed-off-by: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>

--- kernel/trace/ftrace.c
+++ kernel/trace/ftrace.c
@@ -111,27 +111,6 @@
 #define ftrace_ops_list_func ((ftrace_func_t)ftrace_ops_no_ops)
 #endif

-/**
- * ftrace_nr_registered_ops - return number of ops registered
- *
- * Returns the number of ftrace_ops registered and tracing functions
- */
-int ftrace_nr_registered_ops(void)
-{
-	struct ftrace_ops *ops;
-	int cnt = 0;
-
-	mutex_lock(&ftrace_lock);
-
-	for (ops = ftrace_ops_list;
-	     ops != &ftrace_list_end; ops = ops->next)
-		cnt++;
-
-	mutex_unlock(&ftrace_lock);
-
-	return cnt;
-}
-
 /*
  * Traverse the ftrace_global_list, invoking all entries.  The reason that we
  * can use rcu_dereference_raw() is that elements removed from this list
@@ -141,6 +120,38 @@
  *
  * Silly Alpha and silly pointer-speculation compiler optimizations!
  */
+#define do_for_each_ftrace_op(op, list)			\
+	op = rcu_dereference_raw(list);			\
+	do
+
+/*
+ * Optimized for just a single item in the list (as that is the normal case).
+ */
+#define while_for_each_ftrace_op(op)				\
+	while (likely(op = rcu_dereference_raw((op)->next)) &&	\
+	       unlikely((op) != &ftrace_list_end))
+
+/**
+ * ftrace_nr_registered_ops - return number of ops registered
+ *
+ * Returns the number of ftrace_ops registered and tracing functions
+ */
+int ftrace_nr_registered_ops(void)
+{
+	struct ftrace_ops *ops;
+	int cnt = 0;
+
+	mutex_lock(&ftrace_lock);
+
+	for (ops = ftrace_ops_list;
+	     ops != &ftrace_list_end; ops = ops->next)
+		cnt++;
+
+	mutex_unlock(&ftrace_lock);
+
+	return cnt;
+}
+
 static void
 ftrace_global_list_func(unsigned long ip, unsigned long parent_ip,
 			struct ftrace_ops *op, struct pt_regs *regs)
@@ -149,11 +160,9 @@
 		return;

 	trace_recursion_set(TRACE_GLOBAL_BIT);
-	op = rcu_dereference_raw(ftrace_global_list); /*see above*/
-	while (op != &ftrace_list_end) {
+	do_for_each_ftrace_op(op, ftrace_global_list) {
 		op->func(ip, parent_ip, op, regs);
-		op = rcu_dereference_raw(op->next); /*see above*/
-	};
+	} while_for_each_ftrace_op(op);
 	trace_recursion_clear(TRACE_GLOBAL_BIT);
 }

@@ -4104,14 +4113,11 @@
 	 */
 	preempt_disable_notrace();
 	trace_recursion_set(TRACE_CONTROL_BIT);
-	op = rcu_dereference_raw(ftrace_control_list);
-	while (op != &ftrace_list_end) {
+	do_for_each_ftrace_op(op, ftrace_control_list) {
 		if (!ftrace_function_local_disabled(op) &&
 		    ftrace_ops_test(op, ip))
 			op->func(ip, parent_ip, op, regs);
-
-		op = rcu_dereference_raw(op->next);
-	};
+	} while_for_each_ftrace_op(op);
 	trace_recursion_clear(TRACE_CONTROL_BIT);
 	preempt_enable_notrace();
 }
@@ -4139,12 +4145,10 @@
 	 * they must be freed after a synchronize_sched().
 	 */
 	preempt_disable_notrace();
-	op = rcu_dereference_raw(ftrace_ops_list);
-	while (op != &ftrace_list_end) {
+	do_for_each_ftrace_op(op, ftrace_ops_list) {
 		if (ftrace_ops_test(op, ip))
 			op->func(ip, parent_ip, op, regs);
-		op = rcu_dereference_raw(op->next);
-	};
+	} while_for_each_ftrace_op(op);
 	preempt_enable_notrace();
 	trace_recursion_clear(TRACE_INTERNAL_BIT);
 }


添加了部分函数注释

添加了部分函数注释

--- ouo/includes/ouobuiltin.h
+++ ouo/includes/ouobuiltin.h
@@ -17,12 +17,29 @@
  */
 struct ouoval;
 struct ouoenv;
-
 typedef ouoval * (*ouobuiltin)(ouoenv *, ouoval *);

+/**
+ *  @brief  <#Description#>
+ *
+ *  @param e    <#e description#>
+ *  @param a    <#a description#>
+ *  @param func <#func description#>
+ *
+ *  @return <#return value description#>
+ */
 ouoval * builtin_var(ouoenv * e, ouoval * a, const char * func);

+/**
+ *  @brief  Load a file
+ *
+ *  @param e env
+ *  @param a An Sexpr with file path
+ *
+ *  @return Result of evaluation
+ */
 ouoval * builtin_load(ouoenv * e, ouoval * a);
+

 ouoval * builtin_error(ouoenv * e, ouoval * a);


BUG: ComputeMode is a true virtual function. So it shouldn't have inline directive.

--- Code/Numerics/Statistics/itkMeanShiftModeSeekerBase.h
+++ Code/Numerics/Statistics/itkMeanShiftModeSeekerBase.h
@@ -79,7 +79,7 @@
   virtual ~MeanShiftModeSeekerBase() ;
   void PrintSelf(std::ostream& os, Indent indent) const;

-  inline virtual void ComputeMode(MeasurementVectorType queryPoint,
+  virtual void ComputeMode(MeasurementVectorType queryPoint,
                            MeasurementVectorType& newPoint) = 0 ;


refactor(vips): free watermark cache. refactor vips.h

--- vips.h
+++ vips.h
@@ -31,39 +31,57 @@
 	double Background[3];
 } WatermarkOptions;

+static int
+has_profile_embed(VipsImage *image) {
+	return vips_image_get_typeof(image, VIPS_META_ICC_NAME);
+}
+
+static void
+remove_profile(VipsImage *image) {
+	vips_image_remove(image, VIPS_META_ICC_NAME);
+}
+
+static gboolean
+with_interlace(int interlace) {
+	return interlace > 0 ? TRUE : FALSE;
+}
+
+static int
+has_alpha_channel(VipsImage *image) {
+	return (
+		(image->Bands == 2 && image->Type == VIPS_INTERPRETATION_B_W) ||
+		(image->Bands == 4 && image->Type != VIPS_INTERPRETATION_CMYK) ||
+		(image->Bands == 5 && image->Type == VIPS_INTERPRETATION_CMYK)
+	) ? 1 : 0;
+}
+
 void
-vips_enable_cache_set_trace()
-{
+vips_enable_cache_set_trace() {
 	vips_cache_set_trace(TRUE);
-};
-
-int
-vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator)
-{
+}
+
+int
+vips_affine_interpolator(VipsImage *in, VipsImage **out, double a, double b, double c, double d, VipsInterpolate *interpolator) {
 	return vips_affine(in, out, a, b, c, d, "interpolate", interpolator, NULL);
-};
-
-int
-vips_jpegload_buffer_shrink(void *buf, size_t len, VipsImage **out, int shrink)
-{
+}
+
+int
+vips_jpegload_buffer_shrink(void *buf, size_t len, VipsImage **out, int shrink) {
 	return vips_jpegload_buffer(buf, len, out, "shrink", shrink, NULL);
-};
-
-int
-vips_flip_bridge(VipsImage *in, VipsImage **out, int direction)
-{
+}
+
+int
+vips_flip_bridge(VipsImage *in, VipsImage **out, int direction) {
 	return vips_flip(in, out, direction, NULL);
-};
-
-int
-vips_shrink_bridge(VipsImage *in, VipsImage **out, double xshrink, double yshrink)
-{
+}
+
+int
+vips_shrink_bridge(VipsImage *in, VipsImage **out, double xshrink, double yshrink) {
 	return vips_shrink(in, out, xshrink, yshrink, NULL);
-};
-
-int
-vips_rotate(VipsImage *in, VipsImage **out, int angle)
-{
+}
+
+int
+vips_rotate(VipsImage *in, VipsImage **out, int angle) {
 	int rotate = VIPS_ANGLE_D0;

 	if (angle == 90) {
@@ -75,7 +93,7 @@
 	}

 	return vips_rot(in, out, rotate, NULL);
-};
+}

 int
 vips_exif_orientation(VipsImage *image) {
@@ -88,26 +106,7 @@
 		orientation = atoi(&exif[0]);
 	}
 	return orientation;
-};
-
-int
-has_profile_embed(VipsImage *image) {
-	return vips_image_get_typeof(image, VIPS_META_ICC_NAME);
-};
-
-void
-remove_profile(VipsImage *image) {
-	vips_image_remove(image, VIPS_META_ICC_NAME);
-};
-
-int
-has_alpha_channel(VipsImage *image) {
-	return (
-		(image->Bands == 2 && image->Type == VIPS_INTERPRETATION_B_W) ||
-		(image->Bands == 4 && image->Type != VIPS_INTERPRETATION_CMYK) ||
-		(image->Bands == 5 && image->Type == VIPS_INTERPRETATION_CMYK)
-	) ? 1 : 0;
-};
+}

 int
 interpolator_window_size(char const *name) {
@@ -115,56 +114,45 @@
 	int window_size = vips_interpolate_get_window_size(interpolator);
 	g_object_unref(interpolator);
 	return window_size;
-};
+}

 const char *
 vips_enum_nick_bridge(VipsImage *image) {
 	return vips_enum_nick(VIPS_TYPE_INTERPRETATION, image->Type);
-};
-
-int
-vips_zoom_bridge(VipsImage *in, VipsImage **out, int xfac, int yfac)
-{
+}
+
+int
+vips_zoom_bridge(VipsImage *in, VipsImage **out, int xfac, int yfac) {
 	return vips_zoom(in, out, xfac, yfac, NULL);
-};
-
-int
-vips_embed_bridge(VipsImage *in, VipsImage **out, int left, int top, int width, int height, int extend)
-{
+}
+
+int
+vips_embed_bridge(VipsImage *in, VipsImage **out, int left, int top, int width, int height, int extend) {
 	return vips_embed(in, out, left, top, width, height, "extend", extend, NULL);
-};
-
-int
-vips_extract_area_bridge(VipsImage *in, VipsImage **out, int left, int top, int width, int height)
-{
+}
+
+int
+vips_extract_area_bridge(VipsImage *in, VipsImage **out, int left, int top, int width, int height) {
 	return vips_extract_area(in, out, left, top, width, height, NULL);
-};
-
-int
-vips_colourspace_issupported_bridge(VipsImage *in)
-{
+}
+
+int
+vips_colourspace_issupported_bridge(VipsImage *in) {
 	return vips_colourspace_issupported(in) ? 1 : 0;
-};
+}

 VipsInterpretation
 vips_image_guess_interpretation_bridge(VipsImage *in) {
 	return vips_image_guess_interpretation(in);
-};
-
-int
-vips_colourspace_bridge(VipsImage *in, VipsImage **out, VipsInterpretation space)
-{
-    return vips_colourspace(in, out, space, NULL);
-};
-
-gboolean
-with_interlace(int interlace) {
-	return interlace > 0 ? TRUE : FALSE;
-};
-
-int
-vips_jpegsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality, int interlace)
-{
+}
+
+int
+vips_colourspace_bridge(VipsImage *in, VipsImage **out, VipsInterpretation space) {
+	return vips_colourspace(in, out, space, NULL);
+}
+
+int
+vips_jpegsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality, int interlace) {
 	return vips_jpegsave_buffer(in, buf, len,
 		"strip", strip,
 		"Q", quality,
@@ -172,11 +160,10 @@
 		"interlace", with_interlace(interlace),
 		NULL
 	);
-};
-
-int
-vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compression, int quality, int interlace)
-{
+}
+
+int
+vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compression, int quality, int interlace) {
 #if (VIPS_MAJOR_VERSION >= 8 || (VIPS_MAJOR_VERSION >= 7 && VIPS_MINOR_VERSION >= 42))
 	return vips_pngsave_buffer(in, buf, len,
 		"strip", FALSE,
@@ -193,20 +180,19 @@
 		NULL
 	);
 #endif
-};
-
-int
-vips_webpsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality)
-{
+}
+
+int
+vips_webpsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int quality) {
 	return vips_webpsave_buffer(in, buf, len,
 		"strip", strip,
 		"Q", quality,
 		NULL
 	);
-};
-
-int
-vips_init_image(void *buf, size_t len, int imageType, VipsImage **out) {
+}
+
+int
+vips_init_image (void *buf, size_t len, int imageType, VipsImage **out) {
 	int code = 1;

 	if (imageType == JPEG) {
@@ -224,11 +210,10 @@
 	}

 	return code;
-};
-
-int
-vips_watermark_replicate(VipsImage *orig, VipsImage *in, VipsImage **out)
-{
+}
+
+int
+vips_watermark_replicate (VipsImage *orig, VipsImage *in, VipsImage **out) {
 	VipsImage *cache = vips_image_new();

 	if (
@@ -241,12 +226,12 @@
 		return 1;
 	}

+	g_object_unref(cache);
 	return 0;
-};
-
-int
-vips_watermark(VipsImage *in, VipsImage **out, WatermarkTextOptions *to, WatermarkOptions *o)
-{
+}
+
+int
+vips_watermark(VipsImage *in, VipsImage **out, WatermarkTextOptions *to, WatermarkOptions *o) {
 	double ones[3] = { 1, 1, 1 };

 	VipsImage *base = vips_image_new();
@@ -300,4 +285,4 @@

 	g_object_unref(base);
 	return 0;
-};
+}


Reduce alignment on struct XSAVE, fixing a gcc warning

The warning is about heap-allocating a struct with bigger alignment
requirements than the standard heap allocator provides.

AFAICT, all uses of the XSAVE struct are already heap-allocated, so this
high alignment does not actually have any effect and removing it should
be NFC.

I have also done some digging in the commit history. This alignment
requirement was since the XSAVE struct was introduced in r180572 when
adding AVX register support for linux. It does not mention the alignment
specifically, so I am guessing this was just put there because the
corresponging XSAVE cpu instruction requires its buffer to be 64-byte
aligned. However, LLDB will not be normally reading this struct via the
XSAVE instruction directly. Instead we will ask the kernel to copy the
buffer saved when suspeding the inferior. This should not require such
strict alignment (in fact, linux kernel will happily do this for any
alignment).

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

--- source/Plugins/Process/Utility/RegisterContext_x86.h
+++ source/Plugins/Process/Utility/RegisterContext_x86.h
@@ -341,7 +341,7 @@

 // x86 extensions to FXSAVE (i.e. for AVX and MPX processors)
 LLVM_PACKED_START
-struct LLVM_ALIGNAS(64) XSAVE {
+struct LLVM_ALIGNAS(16) XSAVE {
   FXSAVE i387;      // floating point registers typical in i387_fxsave_struct
   XSAVE_HDR header; // The xsave_hdr_struct can be used to determine if the
                     // following extensions are usable


mistaken ext4_inode_bitmap for ext4_block_bitmap

In ext4_new_blocks(), one of two ext4_block_bitmap() calls should be
ext4_inode_bitmap() call.  It is not harmful in normal processing, but it
should be fixed.

Signed-off-by: Toshiyuki Okajima <74e75fff2c1fe888b4c42ad44a8a62b0abe84fd1@jp.fujitsu.com>
Cc: Theodore Ts'o <4ed386e0495d3e109932df055831d9ec2f824927@mit.edu>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- fs/ext4/balloc.c
+++ fs/ext4/balloc.c
@@ -1585,7 +1585,7 @@
 	ret_block = grp_alloc_blk + ext4_group_first_block_no(sb, group_no);

 	if (in_range(ext4_block_bitmap(sb, gdp), ret_block, num) ||
-	    in_range(ext4_block_bitmap(sb, gdp), ret_block, num) ||
+	    in_range(ext4_inode_bitmap(sb, gdp), ret_block, num) ||
 	    in_range(ret_block, ext4_inode_table(sb, gdp),
 		     EXT4_SB(sb)->s_itb_per_group) ||
 	    in_range(ret_block + num - 1, ext4_inode_table(sb, gdp),


Rework output/terminal_ncurses.c to be more performant

By scanning through the updates row-by-row rather than column-by-column,
a lot of color-changing updates are saved when using a gradient. This
seems to significantly reduce tearing when running Cava through urxvt on
an X11 server.

--- output/terminal_ncurses.c
+++ output/terminal_ncurses.c
@@ -71,79 +71,79 @@
 	start_color();
 	use_default_colors();

-    getmaxyx(stdscr, *height, *width);
+	getmaxyx(stdscr, *height, *width);
 	clear();

-    NCURSES_COLOR_T color_pair_number = 1;
-
-    NCURSES_COLOR_T bg_color_number;
-    bg_color_number = change_color_definition(0, bg_color_string, predef_bg_color);
-
-    if (!gradient) {
-
-	    NCURSES_COLOR_T fg_color_number;
-        fg_color_number = change_color_definition(1, fg_color_string, predef_fg_color);
-
-        init_pair(color_pair_number, fg_color_number, bg_color_number);
-
-    } else if (gradient) {
-
-        // 0 -> col1, 1-> col1<=>col2, 2 -> col2 and so on
-        short unsigned int rgb[2 * gradient_count - 1][3];
-        char next_color[14];
-
-        gradient_size = *height;
-
-        if (gradient_size > COLORS) gradient_size = COLORS - 1;
+	NCURSES_COLOR_T color_pair_number = 1;
+
+	NCURSES_COLOR_T bg_color_number;
+	bg_color_number = change_color_definition(0, bg_color_string, predef_bg_color);
+
+	if (!gradient) {
+
+		NCURSES_COLOR_T fg_color_number;
+		fg_color_number = change_color_definition(1, fg_color_string, predef_fg_color);
+
+		init_pair(color_pair_number, fg_color_number, bg_color_number);
+
+	} else if (gradient) {
+
+		// 0 -> col1, 1-> col1<=>col2, 2 -> col2 and so on
+		short unsigned int rgb[2 * gradient_count - 1][3];
+		char next_color[14];
+
+		gradient_size = *height;
+
+		if (gradient_size > COLORS) gradient_size = COLORS - 1;

-        if (gradient_size > COLOR_PAIRS) gradient_size = COLOR_PAIRS - 1;
-
-        if (gradient_size > MAX_COLOR_REDEFINITION) gradient_size = MAX_COLOR_REDEFINITION - 1;
-
-        for(int i = 0;i < gradient_count;i++){
-            int col = (i + 1)*2 - 2;
-            sscanf(gradient_colors[i]+1, "%02hx%02hx%02hx", &rgb[col][0], &rgb[col][1], &rgb[col][2]);
-        }
-
-        //sscanf(gradient_color_1 + 1, "%02hx%02hx%02hx", &rgb[0][0], &rgb[0][1], &rgb[0][2]);
-        //sscanf(gradient_color_2 + 1, "%02hx%02hx%02hx", &rgb[1][0], &rgb[1][1], &rgb[1][2]);
-
-        int individual_size = gradient_size/(gradient_count - 1);
-
-        int row = 0;
-
-        for(int i = 0;i < gradient_count - 1;i++){
-
-            int col = (i + 1)* 2 - 2;
-            if(i == gradient_count - 1)
-                col = 2*(gradient_count - 1) - 2;
-
-            for(int j = 0; j < individual_size;j++){
-
-                for(int k = 0; k < 3; k++) {
-                    rgb[col+1][k] = rgb[col][k] + (rgb[col+2][k] - rgb[col][k]) * (j / (individual_size * 0.85));
-                    if (rgb[col+1][k] > 255) rgb[col][k] = 0;
-                    if ( j > individual_size * 0.85 ) rgb[col+1][k] = rgb[col+2][k];
-                }
-
-                sprintf(next_color,"#%02x%02x%02x",rgb[col+1][0], rgb[col+1][1], rgb[col+1][2]);
-
-                change_color_definition(row + 1, next_color, row + 1);
-                init_pair(color_pair_number++, row + 1, bg_color_number);
-                row++;
-            }
-        }
-
-        int left = individual_size * (gradient_count - 1);
-        int col = 2*(gradient_count) - 2;
-        while(left < gradient_size){
-            sprintf(next_color,"#%02x%02x%02x",rgb[col][0], rgb[col][1], rgb[col][2]);
-            change_color_definition(row + 1, next_color, row + 1);
-            init_pair(color_pair_number++, row + 1, bg_color_number);
-            row++;
-            left++;
-        }
-    }
+		if (gradient_size > COLOR_PAIRS) gradient_size = COLOR_PAIRS - 1;
+
+		if (gradient_size > MAX_COLOR_REDEFINITION) gradient_size = MAX_COLOR_REDEFINITION - 1;
+
+		for(int i = 0;i < gradient_count;i++){
+			int col = (i + 1)*2 - 2;
+			sscanf(gradient_colors[i]+1, "%02hx%02hx%02hx", &rgb[col][0], &rgb[col][1], &rgb[col][2]);
+		}
+
+		//sscanf(gradient_color_1 + 1, "%02hx%02hx%02hx", &rgb[0][0], &rgb[0][1], &rgb[0][2]);
+		//sscanf(gradient_color_2 + 1, "%02hx%02hx%02hx", &rgb[1][0], &rgb[1][1], &rgb[1][2]);
+
+		int individual_size = gradient_size/(gradient_count - 1);
+
+		int row = 0;
+
+		for(int i = 0;i < gradient_count - 1;i++){
+
+			int col = (i + 1)* 2 - 2;
+			if(i == gradient_count - 1)
+				col = 2*(gradient_count - 1) - 2;
+
+			for(int j = 0; j < individual_size;j++){
+
+				for(int k = 0; k < 3; k++) {
+					rgb[col+1][k] = rgb[col][k] + (rgb[col+2][k] - rgb[col][k]) * (j / (individual_size * 0.85));
+					if (rgb[col+1][k] > 255) rgb[col][k] = 0;
+					if ( j > individual_size * 0.85 ) rgb[col+1][k] = rgb[col+2][k];
+				}
+
+				sprintf(next_color,"#%02x%02x%02x",rgb[col+1][0], rgb[col+1][1], rgb[col+1][2]);
+
+				change_color_definition(row + 1, next_color, row + 1);
+				init_pair(color_pair_number++, row + 1, bg_color_number);
+				row++;
+			}
+		}
+
+		int left = individual_size * (gradient_count - 1);
+		int col = 2*(gradient_count) - 2;
+		while(left < gradient_size){
+			sprintf(next_color,"#%02x%02x%02x",rgb[col][0], rgb[col][1], rgb[col][2]);
+			change_color_definition(row + 1, next_color, row + 1);
+			init_pair(color_pair_number++, row + 1, bg_color_number);
+			row++;
+			left++;
+		}
+	}

 	if (bg_color_number != -1)
 		bkgd(COLOR_PAIR(color_pair_number));
@@ -153,16 +153,16 @@
 }

 void change_colors(int cur_height, int tot_height) {
-    tot_height /= gradient_size ;
-    if (tot_height < 1) tot_height = 1;
-    cur_height /= tot_height;
-    if (cur_height > gradient_size  - 1) cur_height = gradient_size - 1;
-    attron(COLOR_PAIR(cur_height + 1));
+	tot_height /= gradient_size ;
+	if (tot_height < 1) tot_height = 1;
+	cur_height /= tot_height;
+	if (cur_height > gradient_size  - 1) cur_height = gradient_size - 1;
+	attron(COLOR_PAIR(cur_height + 1));
 }

 void get_terminal_dim_ncurses(int* width, int* height) {
 	getmaxyx(stdscr, *height, *width);
-    gradient_size = *height;
+	gradient_size = *height;
 	clear(); // clearing in case of resieze
 }

@@ -171,10 +171,10 @@
 int draw_terminal_ncurses(int is_tty, int terminal_height, int terminal_width,
 int bars_count, int bar_width, int bar_spacing, int rest, const int f[200],
 int flastd[200], int gradient) {
-
+	const int height = terminal_height - 1;
 	const wchar_t* bar_heights[] = {L"\u2581", L"\u2582", L"\u2583",
 		L"\u2584", L"\u2585", L"\u2586", L"\u2587", L"\u2588"};
-	#define LAST ((sizeof(bar_heights) / sizeof(bar_heights[0])) - 1)
+	int num_bar_heights = (sizeof(bar_heights) / sizeof(bar_heights[0]));

 	// output: check if terminal has been resized
 	if (!is_tty) {
@@ -182,54 +182,62 @@
 			return TERMINAL_RESIZED;
 		}
 	}
-	const int height = terminal_height - 1;
-	#define CURRENT_COLUMN bar*bar_width + width + bar*bar_spacing + rest
+
+	// Compute how much of the screen we possibly need to update ahead-of-time.
+	int max_update_y = 0;
 	for (int bar = 0; bar < bars_count; bar++) {
-		if (f[bar] > flastd[bar]) { // higher then last frame
-			if (is_tty) {
-				for (int n = flastd[bar] / 8; n < f[bar] / 8; n++) {
-                    if (gradient) change_colors(n, height);
-					for (int width = 0; width < bar_width; width++)
-						mvaddch((height - n), CURRENT_COLUMN, '8');
-                }
-			} else {
-				for (int n = flastd[bar] / 8; n < f[bar] / 8; n++) {
-                    if (gradient) change_colors(n, height);
-					for (int width = 0; width < bar_width; width++)
-						mvaddwstr((height - n), CURRENT_COLUMN,
-								bar_heights[LAST]);
-                }
+		max_update_y = max(max_update_y, max(f[bar], flastd[bar]));
+	}
+
+	max_update_y = (max_update_y + num_bar_heights) / num_bar_heights;
+
+	for (int y = 0; y < max_update_y; y++) {
+		if (gradient) {
+			change_colors(y, height);
+		}
+
+		for (int bar = 0; bar < bars_count; bar++) {
+			if (f[bar] == flastd[bar]) {
+				continue;
 			}
-            if (gradient) change_colors(f[bar] / 8, height);
-			if (f[bar] % 8) {
-				if (is_tty) {
-					for (int width = 0; width < bar_width; width++)
-						mvaddch((height - f[bar] / 8), CURRENT_COLUMN, '0' + (f[bar] % 8));
+
+			int cur_col = bar * bar_width + bar * bar_spacing + rest;
+			int f_cell = f[bar] / num_bar_heights;
+			int f_last_cell = flastd[bar] / num_bar_heights;
+
+			if (f_cell >= y) {
+				int bar_step;
+
+				if (f_cell == y) {
+					// The "cap" of the bar occurs at this [y].
+					bar_step = f[bar] % num_bar_heights;
+				} else if (f_last_cell <= y) {
+					// The bar is full at this [y].
+					bar_step = num_bar_heights - 1;
 				} else {
-					for (int width = 0; width < bar_width; width++)
-						mvaddwstr((height - f[bar] / 8), CURRENT_COLUMN,
-								bar_heights[(f[bar] % 8) - 1]);
+					// No update necessary since last frame.
+					continue;
+				}
+
+				for (int col = cur_col, i = 0; i < bar_width; i++, col++) {
+					if (is_tty) {
+						mvaddch(height - y, col, '0' + bar_step);
+					} else {
+						mvaddwstr(height - y, col, bar_heights[bar_step]);
+					}
+				}
+			} else if (f_last_cell >= y) {
+				// This bar was taller during the last frame than during this frame, so
+				// clear the excess characters.
+				for (int col = cur_col, i = 0; i < bar_width; i++, col++) {
+					mvaddch(height - y, col, ' ');
 				}
 			}
-		} else if(f[bar] < flastd[bar]) { // lower then last frame
-			for (int n = f[bar] / 8; n < flastd[bar]/8 + 1; n++)
-				for (int width = 0; width < bar_width; width++)
-					mvaddstr((height - n), CURRENT_COLUMN, " ");
-			if (f[bar] % 8) {
-                 if (gradient) change_colors(f[bar] / 8, height);
-				if (is_tty) {
-					for (int width = 0; width < bar_width; width++)
-						mvaddch((height - f[bar] / 8), CURRENT_COLUMN, '0' + (f[bar] % 8));
-				} else {
-					for (int width = 0; width < bar_width; width++)
-						mvaddwstr((height - f[bar] / 8), CURRENT_COLUMN,
-								bar_heights[(f[bar] % 8) - 1]);
-				}
-			}
-		}
-		#undef CURRENT_COLUMN
-		flastd[bar] = f[bar]; // memory for falloff func
-	}
+		}
+	}
+
+	memcpy(flastd, f, sizeof(*f));  // Memory for falloff func
+
 	refresh();
 	return 0;
 }
@@ -253,6 +261,6 @@
   */
 	endwin();
 	system("clear");
-    system("reset");
-}
-
+	system("reset");
+}
+


Avoid compiler warning on GCC 4.4 about potentially uninitialized variable

Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de>

--- vm/src/objects/object.inline.h
+++ vm/src/objects/object.inline.h
@@ -516,10 +516,10 @@

 inline double Object::fetchFloatAtinto() {
   // assumes arg is BaseHeaderSize, built into long32_at
-  double r;
-  ((int32*)&r)[0] = long32_at(1);
-  ((int32*)&r)[1] = long32_at(0);
-  return r;
+  int32 r[2];
+  r[0] = long32_at(1);
+  r[1] = long32_at(0);
+  return *((double*)&r);
 }

 inline double Object::fetchFloatofObject(oop_int_t fieldIndex) {


test: make variables static in test-gethostbyname.c

--- test/test-gethostbyname.c
+++ test/test-gethostbyname.c
@@ -26,14 +26,14 @@
 #include <stdio.h>
 #include <string.h> /* strlen */

-ares_channel channel;
-struct ares_options options;
-int optmask;
+static ares_channel channel;
+static struct ares_options options;
+static int optmask;

-int ares_bynamecallbacks;
-int bynamecallbacksig;
-int ares_byaddrcallbacks;
-int byaddrcallbacksig;
+static int ares_bynamecallbacks;
+static int bynamecallbacksig;
+static int ares_byaddrcallbacks;
+static int byaddrcallbacksig;

 static void aresbynamecallback( void *arg,
                           int status,


ext4: avoid counting the number of free inodes twice in find_group_orlov()

Signed-off-by: "Theodore Ts'o" <4ed386e0495d3e109932df055831d9ec2f824927@mit.edu>

--- fs/ext4/ialloc.c
+++ fs/ext4/ialloc.c
@@ -358,7 +358,7 @@
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	ext4_group_t real_ngroups = ext4_get_groups_count(sb);
 	int inodes_per_group = EXT4_INODES_PER_GROUP(sb);
-	unsigned int freei, avefreei;
+	unsigned int freei, avefreei, grp_free;
 	ext4_fsblk_t freeb, avefreec;
 	unsigned int ndirs;
 	int max_dirs, min_inodes;
@@ -477,8 +477,8 @@
 	for (i = 0; i < ngroups; i++) {
 		grp = (parent_group + i) % ngroups;
 		desc = ext4_get_group_desc(sb, grp, NULL);
-		if (desc && ext4_free_inodes_count(sb, desc) &&
-		    ext4_free_inodes_count(sb, desc) >= avefreei) {
+		grp_free = ext4_free_inodes_count(sb, desc);
+		if (desc && grp_free && grp_free >= avefreei) {
 			*group = grp;
 			return 0;
 		}


f2fs: fix to call put_page at the error handling routine

The locked page should be released before returning the function.

Reviewed-by: Chao Yu <0cc5db7488e13b393f245aa6263acec5e92fdcc5@samsung.com>
Signed-off-by: Jaegeuk Kim <71255387a32c360dfbe6dfb7aaeb123bf1dc8cb6@kernel.org>

--- fs/f2fs/inline.c
+++ fs/f2fs/inline.c
@@ -141,8 +141,8 @@

 	ipage = get_node_page(sbi, inode->i_ino);
 	if (IS_ERR(ipage)) {
-		f2fs_unlock_op(sbi);
-		return PTR_ERR(ipage);
+		err = PTR_ERR(ipage);
+		goto out;
 	}

 	set_new_dnode(&dn, inode, ipage, ipage, 0);
@@ -151,7 +151,7 @@
 		err = f2fs_convert_inline_page(&dn, page);

 	f2fs_put_dnode(&dn);
-
+out:
 	f2fs_unlock_op(sbi);

 	f2fs_put_page(page, 1);


[JFFS2] Make the JFFS2 messages a bit nicer

Signed-off-by: Artem B. Bityutskiy <e9e216302cf029bb622c0383fe00c08402269f9b@infradead.org>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- fs/jffs2/debug.h
+++ fs/jffs2/debug.h
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: debug.h,v 1.12 2005/08/05 10:43:47 dedekind Exp $
+ * $Id: debug.h,v 1.13 2005/08/17 13:42:06 dedekind Exp $
  *
  */
 #ifndef _JFFS2_DEBUG_H_
@@ -68,28 +68,28 @@
 #define JFFS2_ERROR(fmt, ...)						\
 	do {								\
 		printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX		\
-			" %d,%s: " fmt, current->pid,			\
+			" %d (%s): " fmt, current->pid,			\
 			__FUNCTION__, ##__VA_ARGS__);			\
 	} while(0)

 #define JFFS2_WARNING(fmt, ...)						\
 	do {								\
 		printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX		\
-			" %d,%s: " fmt, current->pid,			\
+			" %d (%s): " fmt, current->pid,			\
 			__FUNCTION__, ##__VA_ARGS__);			\
 	} while(0)

 #define JFFS2_NOTICE(fmt, ...)						\
 	do {								\
 		printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX		\
-			" %d,%s: " fmt, current->pid,			\
+			" %d (%s): " fmt, current->pid,			\
 			__FUNCTION__, ##__VA_ARGS__);			\
 	} while(0)

 #define JFFS2_DEBUG(fmt, ...)						\
 	do {								\
 		printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX		\
-			" %d,%s: " fmt, current->pid,			\
+			" %d (%s): " fmt, current->pid,			\
 			__FUNCTION__, ##__VA_ARGS__);			\
 	} while(0)


nfsd: replace boolean nfsd_up flag by users counter

Since we have generic NFSd resurces, we have to introduce some way how to
allocate and destroy those resources on first per-net NFSd start and on
last per-net NFSd stop respectively.
This patch replaces global boolean nfsd_up flag (which is unused now) by users
counter and use it to determine either we need to allocate generic resources
or destroy them.

Signed-off-by: Stanislav Kinsbursky <43b28e187c4fe6e53d7ab0bb71957481e322f182@parallels.com>
Signed-off-by: J. Bruce Fields <51738506c1b2ccb0761f23bdc612c93babf738ea@redhat.com>

--- fs/nfsd/nfssvc.c
+++ fs/nfsd/nfssvc.c
@@ -204,13 +204,13 @@
 	return 0;
 }

-static bool nfsd_up = false;
+static int nfsd_users = 0;

 static int nfsd_startup_generic(int nrservs)
 {
 	int ret;

-	if (nfsd_up)
+	if (nfsd_users++)
 		return 0;

 	/*
@@ -233,9 +233,11 @@

 static void nfsd_shutdown_generic(void)
 {
+	if (--nfsd_users)
+		return;
+
 	nfs4_state_shutdown();
 	nfsd_racache_shutdown();
-	nfsd_up = false;
 }

 static int nfsd_startup_net(int nrservs, struct net *net)
@@ -260,7 +262,6 @@
 		goto out_lockd;

 	nn->nfsd_net_up = true;
-	nfsd_up = true;
 	return 0;

 out_lockd:


Improve documentation

Improve documentation

svn path=/trunk/kdepim/; revision=397809

--- kalarm/widgets/timeedit.h
+++ kalarm/widgets/timeedit.h
@@ -57,13 +57,13 @@
 		explicit TimeEdit(QWidget* parent = 0, const char* name = 0);
 		/** Returns true if the widget is read only. */
 		bool          isReadOnly() const           { return mReadOnly; }
-		/** Sets whether the spin box is read-only for the user. If read-only,
+		/** Sets whether the widget is read-only for the user. If read-only,
 		 *  the time cannot be edited and the spin buttons and am/pm combo box
 		 *  are inactive.
 		 *  @param readOnly True to set the widget read-only, false to set it read-write.
 		 */
 		void          setReadOnly(bool readOnly);
-		/** Returns true if the spin box contains a valid value. */
+		/** Returns true if the widget contains a valid value. */
 		bool          isValid() const;
 		/** Sets whether the edit value is valid.
 		 *  If newly invalid, the value is displayed as asterisks.
@@ -81,25 +81,25 @@
 		 *  @param on True to enable wrapping, else false.
 		 */
 		void          setWrapping(bool on);
-		/** Returns the minimum value of the spin box in minutes. */
+		/** Returns the minimum value of the widget in minutes. */
 		int           minValue() const;
-		/** Returns the maximum value of the spin box in minutes. */
+		/** Returns the maximum value of the widget in minutes. */
 		int           maxValue() const;
-		/** Returns the maximum value of the spin box as a QTime value. */
+		/** Returns the maximum value of the widget as a QTime value. */
 		QTime         maxTime() const              { int mv = maxValue();  return QTime(mv/60, mv%60); }
-		/** Sets the minimum value of the spin box. */
+		/** Sets the minimum value of the widget. */
 		void          setMinValue(int minutes);
-		/** Sets the maximum value of the spin box. */
+		/** Sets the maximum value of the widget. */
 		void          setMaxValue(int minutes);
-		/** Sets the maximum value of the spin box. */
+		/** Sets the maximum value of the widget. */
 		void          setMaxValue(const QTime& time)  { setMaxValue(time.hour()*60 + time.minute()); }
 	public slots:
-		/** Sets the value of the spin box. */
+		/** Sets the value of the widget. */
 		virtual void  setValue(int minutes);
-		/** Sets the value of the spin box. */
+		/** Sets the value of the widget. */
 		void          setValue(const QTime& t)     { setValue(t.hour()*60 + t.minute()); }
 	signals:
-		/** This signal is emitted every time the value of the spin box changes
+		/** This signal is emitted every time the value of the widget changes
 		 *  (for whatever reason).
 		 *  @param minutes The new value.
 		 */
@@ -111,11 +111,11 @@
 	private:
 		void          setAmPmCombo(int am, int pm);

-		TimeSpinBox*  mSpinBox;
+		TimeSpinBox*  mSpinBox;       // always holds the 24-hour time
 		ComboBox*     mAmPm;
-		int           mAmIndex;            // mAmPm index to "am", or -1 if none
-		int           mPmIndex;            // mAmPm index to "pm", or -1 if none
-		bool          mReadOnly;           // the widget is read only
+		int           mAmIndex;       // mAmPm index to "am", or -1 if none
+		int           mPmIndex;       // mAmPm index to "pm", or -1 if none
+		bool          mReadOnly;      // the widget is read only
 };

 #endif // TIMEEDIT_H


ocfs2: Teach ocfs2_replace_extent_rec() to use an extent_tree.

Don't use a struct inode anymore.

Signed-off-by: Joel Becker <823d0e2e55da83c1616b20ae9a15f9456fa076e5@oracle.com>

--- fs/ocfs2/alloc.c
+++ fs/ocfs2/alloc.c
@@ -4983,8 +4983,8 @@
 	return ret;
 }

-static int ocfs2_replace_extent_rec(struct inode *inode,
-				    handle_t *handle,
+static int ocfs2_replace_extent_rec(handle_t *handle,
+				    struct ocfs2_extent_tree *et,
 				    struct ocfs2_path *path,
 				    struct ocfs2_extent_list *el,
 				    int split_index,
@@ -4992,7 +4992,7 @@
 {
 	int ret;

-	ret = ocfs2_path_bh_journal_access(handle, INODE_CACHE(inode), path,
+	ret = ocfs2_path_bh_journal_access(handle, et->et_ci, path,
 					   path_num_items(path) - 1);
 	if (ret) {
 		mlog_errno(ret);
@@ -5095,8 +5095,7 @@

 	if (ctxt.c_contig_type == CONTIG_NONE) {
 		if (ctxt.c_split_covers_rec)
-			ret = ocfs2_replace_extent_rec(inode, handle,
-						       path, el,
+			ret = ocfs2_replace_extent_rec(handle, et, path, el,
 						       split_index, split_rec);
 		else
 			ret = ocfs2_split_and_insert(handle, et, path,