* subversion/svnlook/main.c
  (print_diff_tree): No longer try to print diffs if either of the
    diff files is binary.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@845898 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/svnlook/main.c
+++ subversion/svnlook/main.c
@@ -695,36 +695,55 @@
       if ((! no_diff_deleted) || (node->action != 'D'))
         {
           svn_diff_t *diff;
+          svn_string_t *mimetype;
+          svn_boolean_t binary = FALSE;

           printf ("===========================================================\
 ===================\n");
           fflush (stdout);

-          /* ### TODO: Read the mime-type property of our two diffy
-             items, and if either indicates binariness, don't do the
-             diff. */
-
-          SVN_ERR (svn_diff_file_diff (&diff, orig_path, new_path, pool));
-          if (svn_diff_contains_diffs (diff))
+          /* Read the mime-type property of our two diffy items, and
+             if either indicates binariness, don't do the diff. */
+          SVN_ERR (svn_fs_node_prop (&mimetype, root, path,
+                                     SVN_PROP_MIME_TYPE, pool));
+          if (mimetype && svn_mime_type_is_binary (mimetype->data))
+            binary = TRUE;
+          if (! binary)
             {
-              apr_file_t *outhandle;
-              apr_status_t apr_err;
-              const char *orig_label, *new_label;
-
-              /* Get an apr_file_t representing stdout, which is where
-                 we'll have the diff program print to. */
-              apr_err = apr_file_open_stdout (&outhandle, pool);
-              if (apr_err)
-                return svn_error_create
-                  (apr_err, NULL,
-                   "print_diff_tree: can't open handle to stdout");
-
-              orig_label = generate_label (base_root, base_path, pool);
-              new_label = generate_label (root, path, pool);
-              SVN_ERR (svn_diff_file_output_unified (outhandle, diff,
-                                                     orig_path, new_path,
-                                                     orig_label, new_label,
-                                                     pool));
+              SVN_ERR (svn_fs_node_prop (&mimetype, base_root, base_path,
+                                         SVN_PROP_MIME_TYPE, pool));
+              if (mimetype && svn_mime_type_is_binary (mimetype->data))
+                binary = TRUE;
+            }
+
+          if (binary)
+            {
+              printf ("(Binary files differ)\n");
+            }
+          else
+            {
+              SVN_ERR (svn_diff_file_diff (&diff, orig_path, new_path, pool));
+              if (svn_diff_contains_diffs (diff))
+                {
+                  apr_file_t *outhandle;
+                  apr_status_t apr_err;
+                  const char *orig_label, *new_label;
+
+                  /* Get an apr_file_t representing stdout, which is where
+                     we'll have the diff program print to. */
+                  apr_err = apr_file_open_stdout (&outhandle, pool);
+                  if (apr_err)
+                    return svn_error_create
+                      (apr_err, NULL,
+                       "print_diff_tree: can't open handle to stdout");
+
+                  orig_label = generate_label (base_root, base_path, pool);
+                  new_label = generate_label (root, path, pool);
+                  SVN_ERR (svn_diff_file_output_unified (outhandle, diff,
+                                                         orig_path, new_path,
+                                                         orig_label, new_label,
+                                                         pool));
+                }
             }
         }


stm32f2: Add RTC driver

stm32f2: Add RTC driver

The driver was imported from stm32f0
Fixes:
 - Fix 12/24h handling (CR flag badly used)
 - Fix interrupt flag clearance and interrupt name

error: pathspec 'cpu/stm32f2/periph/rtc.c' did not match any file(s) known to git

--- cpu/stm32f2/periph/rtc.c
+++ cpu/stm32f2/periph/rtc.c
@@ -0,0 +1,280 @@
+/*
+ * Copyright (C) 2016 OTA keys S.A.
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser
+ * General Public License v2.1. See the file LICENSE in the top level
+ * directory for more details.
+ */
+
+/**
+ * @ingroup     cpu_stm32f2
+ * @{
+ * @file
+ * @brief       Low-level RTC driver implementation
+ * @author      Vincent Dupont <vincent@otakeys.com>
+ * @}
+ */
+
+#include <time.h>
+#include "cpu.h"
+#include "periph/rtc.h"
+#include "periph_conf.h"
+#include "sched.h"
+#include "thread.h"
+
+/* guard file in case no RTC device was specified */
+#if RTC_NUMOF
+
+#define RTC_WRITE_PROTECTION_KEY1   (0xCA)
+#define RTC_WRITE_PROTECTION_KEY2   (0x53)
+#define RTC_SYNC_PRESCALER          (0xff)  /**< prescaler for 32.768 kHz oscillator */
+#define RTC_ASYNC_PRESCALER         (0x7f)  /**< prescaler for 32.768 kHz oscillator */
+
+#define MCU_YEAR_OFFSET              (100)  /**< struct tm counts years since 1900
+                                                but RTC has only two-digit year
+                                                hence the offset of 100 years. */
+
+typedef struct {
+    rtc_alarm_cb_t cb;          /**< callback called from RTC interrupt */
+    void *arg;                  /**< argument passed to the callback */
+} rtc_state_t;
+
+static rtc_state_t rtc_callback;
+
+static uint8_t byte2bcd(uint8_t value);
+
+/**
+ * @brief Initializes the RTC to use LSE (external 32.768 kHz oscillator) as a
+ * clocl source. Verify that your board has this oscillator. If other clock
+ * source is used, then also the prescaler constants should be changed.
+ */
+void rtc_init(void)
+{
+
+    /* Enable write access to RTC registers */
+    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
+    PWR->CR |= PWR_CR_DBP;
+
+    /* Reset RTC domain */
+    RCC->BDCR |= RCC_BDCR_BDRST;
+    RCC->BDCR &= ~(RCC_BDCR_BDRST);
+
+    /* Enable the LSE clock (external 32.768 kHz oscillator) */
+    RCC->BDCR &= ~(RCC_BDCR_LSEON);
+    RCC->BDCR &= ~(RCC_BDCR_LSEBYP);
+    RCC->BDCR |= RCC_BDCR_LSEON;
+    while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0) {
+    }
+
+    /* Switch RTC to LSE clock source */
+    RCC->BDCR &= ~(RCC_BDCR_RTCSEL);
+    RCC->BDCR |= RCC_BDCR_RTCSEL_0;
+
+    /* Enable the RTC */
+    RCC->BDCR |= RCC_BDCR_RTCEN;
+
+    /* Unlock RTC write protection */
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY1;
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY2;
+
+    /* Enter RTC Init mode */
+    RTC->ISR = 0;
+    RTC->ISR |= RTC_ISR_INIT;
+    while ((RTC->ISR & RTC_ISR_INITF) == 0) {
+    }
+
+    /* Set 24-h clock */
+    RTC->CR &= ~RTC_CR_FMT;
+    /* Timestamps enabled */
+    RTC->CR |= RTC_CR_TSE;
+
+    /* Configure the RTC PRER */
+    RTC->PRER = RTC_SYNC_PRESCALER;
+    RTC->PRER |= (RTC_ASYNC_PRESCALER << 16);
+
+    /* Exit RTC init mode */
+    RTC->ISR &= (uint32_t) ~RTC_ISR_INIT;
+
+    /* Enable RTC write protection */
+    RTC->WPR = 0xff;
+
+}
+
+int rtc_set_time(struct tm *time)
+{
+    /* Enable write access to RTC registers */
+    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
+    PWR->CR |= PWR_CR_DBP;
+
+    /* Unlock RTC write protection */
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY1;
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY2;
+
+    /* Enter RTC Init mode */
+    RTC->ISR |= RTC_ISR_INIT;
+    while ((RTC->ISR & RTC_ISR_INITF) == 0) {
+    }
+
+    /* Set 24-h clock */
+    RTC->CR &= ~RTC_CR_FMT;
+
+    RTC->DR = ((((uint32_t)byte2bcd(time->tm_year - MCU_YEAR_OFFSET) << 16) & (RTC_DR_YT | RTC_DR_YU)) |
+               (((uint32_t)byte2bcd(time->tm_mon + 1) <<  8) & (RTC_DR_MT | RTC_DR_MU)) |
+               (((uint32_t)byte2bcd(time->tm_mday) <<  0) & (RTC_DR_DT | RTC_DR_DU)));
+
+    RTC->TR = ((((uint32_t)byte2bcd(time->tm_hour) << 16) & (RTC_TR_HT | RTC_TR_HU)) |
+               (((uint32_t)byte2bcd(time->tm_min) <<  8) & (RTC_TR_MNT | RTC_TR_MNU)) |
+               (((uint32_t)byte2bcd(time->tm_sec) <<  0) & (RTC_TR_ST | RTC_TR_SU)));
+
+    /* Exit RTC init mode */
+    RTC->ISR &= (uint32_t) ~RTC_ISR_INIT;
+    /* Enable RTC write protection */
+    RTC->WPR = 0xFF;
+    return 0;
+}
+
+int rtc_get_time(struct tm *time)
+{
+    time->tm_year = MCU_YEAR_OFFSET;
+    time->tm_year += (((RTC->DR & RTC_DR_YT)  >> 20) * 10) + ((RTC->DR & RTC_DR_YU)  >> 16);
+    time->tm_mon  = (((RTC->DR & RTC_DR_MT)  >> 12) * 10) + ((RTC->DR & RTC_DR_MU)  >>  8) - 1;
+    time->tm_mday = (((RTC->DR & RTC_DR_DT)  >>  4) * 10) + ((RTC->DR & RTC_DR_DU)  >>  0);
+    time->tm_hour = (((RTC->TR & RTC_TR_HT)  >> 20) * 10) + ((RTC->TR & RTC_TR_HU)  >> 16);
+    if (RTC->TR & RTC_TR_PM) {
+        /* 12PM is noon */
+        if (time->tm_hour != 12) {
+            time->tm_hour += 12;
+        }
+    }
+    else if ((RTC->CR & RTC_CR_FMT) && time->tm_hour == 12) {
+        /* 12AM is midnight */
+        time->tm_hour -= 12;
+    }
+    time->tm_min  = (((RTC->TR & RTC_TR_MNT) >> 12) * 10) + ((RTC->TR & RTC_TR_MNU) >>  8);
+    time->tm_sec  = (((RTC->TR & RTC_TR_ST)  >>  4) * 10) + ((RTC->TR & RTC_TR_SU)  >>  0);
+    return 0;
+}
+
+int rtc_set_alarm(struct tm *time, rtc_alarm_cb_t cb, void *arg)
+{
+    /* Enable write access to RTC registers */
+    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
+    PWR->CR |= PWR_CR_DBP;
+
+    /* Unlock RTC write protection */
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY1;
+    RTC->WPR = RTC_WRITE_PROTECTION_KEY2;
+
+    /* Enter RTC Init mode */
+    RTC->ISR |= RTC_ISR_INIT;
+    while ((RTC->ISR & RTC_ISR_INITF) == 0) {
+    }
+
+    RTC->CR &= ~(RTC_CR_ALRAE);
+    while ((RTC->ISR & RTC_ISR_ALRAWF) == 0) {
+    }
+    RTC->ALRMAR &= ~(RTC_ALRMAR_MSK1 | RTC_ALRMAR_MSK2 | RTC_ALRMAR_MSK3 | RTC_ALRMAR_MSK4);
+    RTC->ALRMAR = ((((uint32_t)byte2bcd(time->tm_mday) << 24) & (RTC_ALRMAR_DT | RTC_ALRMAR_DU)) |
+                   (((uint32_t)byte2bcd(time->tm_hour) << 16) & (RTC_ALRMAR_HT | RTC_ALRMAR_HU)) |
+                   (((uint32_t)byte2bcd(time->tm_min) <<  8) & (RTC_ALRMAR_MNT | RTC_ALRMAR_MNU)) |
+                   (((uint32_t)byte2bcd(time->tm_sec) <<  0) & (RTC_ALRMAR_ST | RTC_ALRMAR_SU)));
+    /* Enable Alarm A */
+    RTC->CR |= RTC_CR_ALRAE;
+    RTC->CR |= RTC_CR_ALRAIE;
+    RTC->ISR &= ~(RTC_ISR_ALRAF);
+
+    /* Exit RTC init mode */
+    RTC->ISR &= (uint32_t) ~RTC_ISR_INIT;
+    /* Enable RTC write protection */
+    RTC->WPR = 0xFF;
+
+    EXTI->IMR  |= EXTI_IMR_MR17;
+    EXTI->RTSR |= EXTI_RTSR_TR17;
+    NVIC_SetPriority(RTC_Alarm_IRQn, 10);
+    NVIC_EnableIRQ(RTC_Alarm_IRQn);
+
+    rtc_callback.cb = cb;
+    rtc_callback.arg = arg;
+
+    return 0;
+}
+
+int rtc_get_alarm(struct tm *time)
+{
+    time->tm_year = MCU_YEAR_OFFSET;
+    time->tm_year += (((RTC->DR     & RTC_DR_YT)      >> 20) * 10) + ((RTC->DR & RTC_DR_YU)          >> 16);
+    time->tm_mon  = (((RTC->DR     & RTC_DR_MT)      >> 12) * 10) + ((RTC->DR & RTC_DR_MU)          >>  8) - 1;
+    time->tm_mday = (((RTC->ALRMAR & RTC_ALRMAR_DT)  >> 28) * 10) + ((RTC->ALRMAR & RTC_ALRMAR_DU)  >> 24);
+    time->tm_hour = (((RTC->ALRMAR & RTC_ALRMAR_HT)  >> 20) * 10) + ((RTC->ALRMAR & RTC_ALRMAR_HU)  >> 16);
+    if ((RTC->ALRMAR & RTC_ALRMAR_PM) && (RTC->CR & RTC_CR_FMT)) {
+        time->tm_hour += 12;
+    }
+    time->tm_min  = (((RTC->ALRMAR & RTC_ALRMAR_MNT) >> 12) * 10) + ((RTC->ALRMAR & RTC_ALRMAR_MNU) >>  8);
+    time->tm_sec  = (((RTC->ALRMAR & RTC_ALRMAR_ST)  >>  4) * 10) + ((RTC->ALRMAR & RTC_ALRMAR_SU)  >>  0);
+    return 0;
+}
+
+void rtc_clear_alarm(void)
+{
+    /* Disable Alarm A */
+    RTC->CR &= RTC_CR_ALRAE;
+    RTC->CR &= RTC_CR_ALRAIE;
+
+    rtc_callback.cb = NULL;
+    rtc_callback.arg = NULL;
+}
+
+void rtc_poweron(void)
+{
+    /* RTC on STM32F2 is online even on sleep modes. No need to power on. */
+}
+
+void rtc_poweroff(void)
+{
+    /* Enable write access to RTC registers */
+    RCC->APB1ENR |= RCC_APB1ENR_PWREN;
+    PWR->CR |= PWR_CR_DBP;
+
+    /* Reset RTC domain */
+    RCC->BDCR |= RCC_BDCR_BDRST;
+    RCC->BDCR &= ~(RCC_BDCR_BDRST);
+    /* Disable the RTC */
+    RCC->BDCR &= ~RCC_BDCR_RTCEN;
+    /* Disable LSE clock */
+    RCC->BDCR &= ~(RCC_BDCR_LSEON);
+}
+
+void isr_rtc_alarm(void)
+{
+
+    if (RTC->ISR & RTC_ISR_ALRAF) {
+        if (rtc_callback.cb != NULL) {
+            rtc_callback.cb(rtc_callback.arg);
+        }
+        RTC->ISR &= ~RTC_ISR_ALRAF;
+    }
+    EXTI->PR |= EXTI_PR_PR17;
+    if (sched_context_switch_request) {
+        thread_yield();
+    }
+}
+
+/**
+ * Convert a number from unsigned to BCD
+ *
+ * @param[in] value to be converted
+ * @return BCD representation of the value
+ */
+static uint8_t byte2bcd(uint8_t value)
+{
+    uint8_t bcdhigh = 0;
+
+    while (value >= 10) {
+        bcdhigh++;
+        value -= 10;
+    }
+
+    return  ((uint8_t)(bcdhigh << 4) | value);
+}
+
+#endif /* RTC_NUMOF */


Added active_format to Grabber

Added active_format to Grabber

--- src/Grabber.h
+++ src/Grabber.h
@@ -44,7 +44,7 @@
     std::vector<Property> getAvailableProperties ();

     // videoformat related:
-
+
     std::vector<VideoFormatDescription> getAvailableVideoFormats () const;

     bool setVideoFormat (const VideoFormat&);
@@ -64,16 +64,17 @@
     // GrabberImpl* impl;

     CaptureDevice open_device;
+    VideoFormat active_format;

     // std::shared_ptr<Device> capture;
     std::shared_ptr<DeviceInterface> device;
-
+
     std::vector<std::shared_ptr<Property>> device_properties;
-
+
     std::vector<std::shared_ptr<Property>> pipeline_properties;
-
+
     std::vector<std::shared_ptr<Property>> user_properties;
-
+
 }; /* class Grabber */

 } /* namespace tis_imaging */


removed debugging code

removed debugging code

--- crash_kiss/_omp_smoosh.c
+++ crash_kiss/_omp_smoosh.c
@@ -109,10 +109,6 @@

         // Correct for overshoot due to lack of foreground
         if (!l_crushed) {
-            l_out_last = middle - absolute_max;
-            l_in_last = middle;
-            l_in_last = l_in_orig;
-            l_out_last = l_in_orig;
             l_in_last = l_in_orig;
             l_out_last = l_in_orig - absolute_max;
         }
@@ -167,8 +163,6 @@

         // Correct for overshoot due to lack of foreground
         if (!r_crushed) {
-            //r_out_last = middle + absolute_max;
-            //r_in_last = middle;
             r_in_last = r_in_orig;
             r_out_last = r_in_orig + absolute_max;


renamed some firm enum types to have the ir_ prefix

--- ir/be/arm/arm_gen_decls.c
+++ ir/be/arm/arm_gen_decls.c
@@ -369,8 +369,8 @@
    * FIXME: did NOT work for partly constant values
    */
   if (! is_Method_type(ty)) {
-    ent_variability variability = get_entity_variability(ent);
-    visibility visibility = get_entity_visibility(ent);
+    ir_variability variability = get_entity_variability(ent);
+    ir_visibility visibility = get_entity_visibility(ent);

     if (variability == variability_constant) {
       /* a constant entity, put it on the rdata */


fixed assertion in Const emitter (tarval mode_P and Const mode_Iu is allowed) emit block labels for switchjmp targets

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -1819,7 +1819,7 @@
 		lc_esnprintf(arg_env, cmd_buf, 256, "mov %1D, OFFSET FLAT:%C ", n, n);
 		lc_esnprintf(arg_env, cmnt_buf, 256, "/* Move address of SymConst into register */");
 	} else {
-		assert(mode == get_tarval_mode(tv));
+		assert(mode == get_tarval_mode(tv) || (mode_is_reference(get_tarval_mode(tv)) && mode == mode_Iu));
 		/* beware: in some rare cases mode is mode_b which has no tarval_null() */
 		if (tv == get_tarval_b_false() || tv == get_tarval_null(mode)) {
 			const char *instr = "xor";
@@ -2150,37 +2150,55 @@
  * and emits code for each node.
  */
 static void ia32_gen_block(ir_node *block, ir_node *last_block, ia32_emit_env_t *env) {
-	ir_graph *irg = get_irn_irg(block);
-	ir_node *start_block = get_irg_start_block(irg);
+	ir_graph      *irg         = get_irn_irg(block);
+	ir_node       *start_block = get_irg_start_block(irg);
+	int           need_label   = 1;
+	FILE          *F           = env->out;
 	const ir_node *irn;
-	int need_label = 1;
-	FILE *F = env->out;
+	int           i;

 	assert(is_Block(block));

-	if(block == start_block)
+	if (block == start_block)
 		need_label = 0;

 	if (need_label && get_irn_arity(block) == 1) {
 		ir_node *pred_block = get_Block_cfgpred_block(block, 0);

-		if(pred_block == last_block && get_irn_n_edges_kind(pred_block, EDGE_KIND_BLOCK) <= 2)
+		if (pred_block == last_block && get_irn_n_edges_kind(pred_block, EDGE_KIND_BLOCK) <= 2)
 			need_label = 0;
 	}

-	// special case because the start block contains no jump instruction
-	if(last_block == start_block) {
+	/* special case: if one of our cfg preds is a switch-jmp we need a label, */
+	/*               otherwise there might be jump table entries jumping to   */
+	/*               non-existent (omitted) labels                            */
+	for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i) {
+		ir_node *pred = get_Block_cfgpred(block, i);
+
+		if (is_Proj(pred)) {
+			assert(get_irn_mode(pred) == mode_X);
+			if (is_ia32_SwitchJmp(get_Proj_pred(pred))) {
+				need_label = 1;
+				break;
+			}
+		}
+	}
+
+	/* special case because the start block contains no jump instruction */
+	if (last_block == start_block) {
 		const ir_edge_t *edge;
 		ir_node *startsucc = NULL;

 		foreach_block_succ(start_block, edge) {
 			startsucc = get_edge_src_irn(edge);
-			if(startsucc != start_block)
+			if (startsucc != start_block)
 				break;
 		}
 		assert(startsucc != NULL);

-		if(startsucc != block) {
+		/* if the last block was the start block and we are not inside the */
+		/* start successor, emit a jump to the start successor             */
+		if (startsucc != block) {
 			char buf[SNPRINTF_BUF_LEN];
 			ir_snprintf(buf, sizeof(buf), BLOCK_PREFIX("%d"),
 			            get_irn_node_nr(startsucc));
@@ -2194,21 +2212,22 @@
 		int align = 1;
 		ir_exec_freq *execfreqs = env->cg->birg->execfreqs;

-		// align the loop headers
-		if(!is_first_loop_block(block, last_block, env)) {
-
-			// align blocks where the previous block has no fallthrough
+		/* align the loop headers */
+		if (! is_first_loop_block(block, last_block, env)) {
+			/* align blocks where the previous block has no fallthrough */
 			arity = get_irn_arity(block);
-			for(i = 0; i < arity; ++i) {
+
+			for (i = 0; i < arity; ++i) {
 				ir_node *predblock = get_Block_cfgpred_block(block, i);
-				if(predblock == last_block) {
+
+				if (predblock == last_block) {
 					align = 0;
 					break;
 				}
 			}
 		}

-		if(align)
+		if (align)
 			ia32_emit_align_label(env->out, env->isa->opt_arch);

 		ir_snprintf(cmd_buf, sizeof(cmd_buf), BLOCK_PREFIX("%d:"),
@@ -2219,11 +2238,12 @@
 		fprintf(F, "/* preds:");

 		arity = get_irn_arity(block);
-		for(i = 0; i < arity; ++i) {
+		for (i = 0; i < arity; ++i) {
 			ir_node *predblock = get_Block_cfgpred_block(block, i);
 			fprintf(F, " %ld", get_irn_node_nr(predblock));
 		}
-		if(execfreqs != NULL) {
+
+		if (execfreqs != NULL) {
 			fprintf(F, " freq: %f", get_block_execfreq(execfreqs, block));
 		}


emit execfreqs for all blocks. ignore the am_flavour setting and look at the actual values of the AM variables

[r13915]

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -529,9 +529,12 @@
  * Emits address mode.
  */
 void ia32_emit_am(ia32_emit_env_t *env, const ir_node *node) {
-	ia32_am_flavour_t am_flav = get_ia32_am_flavour(node);
-	ir_entity *ent = get_ia32_am_sc(node);
-	int offs = get_ia32_am_offs_int(node);
+	ir_entity *ent       = get_ia32_am_sc(node);
+	int        offs      = get_ia32_am_offs_int(node);
+	ir_node   *base      = get_irn_n(node, 0);
+	int        has_base  = !is_ia32_NoReg_GP(base);
+	ir_node   *index     = get_irn_n(node, 1);
+	int        has_index = !is_ia32_NoReg_GP(index);

 	/* just to be sure... */
 	assert(!is_ia32_use_frame(node) || get_ia32_frame_ent(node) != NULL);
@@ -563,20 +566,22 @@
 		}
 	}

-	if (am_flav & (ia32_B | ia32_I)) {
+	if (has_base || has_index) {
 		be_emit_char(env, '(');

 		/* emit base */
-		if (am_flav & ia32_B) {
+		if (has_base) {
 			ia32_emit_source_register(env, node, 0);
 		}

 		/* emit index + scale */
-		if (am_flav & ia32_I) {
+		if (has_index) {
+			int scale;
 			be_emit_char(env, ',');
 			ia32_emit_source_register(env, node, 1);

-			if (am_flav & ia32_S) {
+			scale = get_ia32_am_scale(node);
+			if (scale > 0) {
 				be_emit_irprintf(env->emit, ",%d", 1 << get_ia32_am_scale(node));
 			}
 		}
@@ -2037,17 +2042,16 @@
 			ir_node *predblock = get_Block_cfgpred_block(block, i);
 			be_emit_irprintf(env->emit, " %d", get_irn_node_nr(predblock));
 		}
-
-		if (exec_freq != NULL) {
-			be_emit_irprintf(env->emit, " freq: %f",
-			                 get_block_execfreq(exec_freq, block));
-		}
-		be_emit_cstring(env, " */\n");
 	} else {
 		be_emit_cstring(env, "\t/* ");
 		ia32_emit_block_name(env, block);
-		be_emit_cstring(env, ": */\n");
-	}
+		be_emit_cstring(env, ": ");
+	}
+	if (exec_freq != NULL) {
+		be_emit_irprintf(env->emit, " freq: %f",
+		                 get_block_execfreq(exec_freq, block));
+	}
+	be_emit_cstring(env, " */\n");
 	be_emit_write_line(env);
 }


fixed PsiCondCMov emitter

fixed PsiCondCMov emitter

--- ir/be/ia32/ia32_emitter.c
+++ ir/be/ia32/ia32_emitter.c
@@ -979,14 +979,15 @@
 	FILE               *F       = env->out;
 	const lc_arg_env_t *arg_env = ia32_get_arg_env();
 	const char *cmp_suffix = get_cmp_suffix(get_ia32_pncode(irn), ! mode_is_signed(get_irn_mode(get_irn_n(irn, 0))));
+	int is_PsiCondCMov     = is_ia32_PsiCondCMov(irn);

 	char cmd_buf[SNPRINTF_BUF_LEN];
 	char cmnt_buf[SNPRINTF_BUF_LEN];
 	const arch_register_t *in1, *in2, *out;

 	out = arch_get_irn_register(env->arch_env, irn);
-	in1 = arch_get_irn_register(env->arch_env, get_irn_n(irn, 2));
-	in2 = arch_get_irn_register(env->arch_env, get_irn_n(irn, 3));
+	in1 = arch_get_irn_register(env->arch_env, get_irn_n(irn, 2 - is_PsiCondCMov));
+	in2 = arch_get_irn_register(env->arch_env, get_irn_n(irn, 3 - is_PsiCondCMov));

 	/* we have to emit the cmp first, because the destination register */
 	/* could be one of the compare registers                           */
@@ -996,7 +997,7 @@
 	else if (is_ia32_xCmpCMov(irn)) {
 		lc_esnprintf(arg_env, cmd_buf, SNPRINTF_BUF_LEN, "ucomis%M %1S, %2S", get_irn_n(irn, 0), irn, irn);
 	}
-	else if (is_ia32_PsiCondCMov(irn)) {
+	else if (is_PsiCondCMov) {
 		/* omit compare because flags are already set by And/Or */
 		snprintf(cmd_buf, SNPRINTF_BUF_LEN, " ");
 	}


moved opt_calling_conventions() to mark_private_methods() in ir_memory.c

[r14623]

--- ir/opt/opt_calling_conv.c
+++ ir/opt/opt_calling_conv.c
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
- *
- * This file is part of libFirm.
- *
- * This file may be distributed and/or modified under the terms of the
- * GNU General Public License version 2 as published by the Free Software
- * Foundation and appearing in the file LICENSE.GPL included in the
- * packaging of this file.
- *
- * Licensees holding valid libFirm Professional Edition licenses may use
- * this file in accordance with the libFirm Commercial License.
- * Agreement provided with the Software.
- *
- * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE.
- */
-
-/**
- * @file
- * @brief   Change the calling conventions of "local" methods
- * @author  Michael Beck
- * @version $Id$
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "iroptimize.h"
-#include "debug.h"
-#include "irnode_t.h"
-#include "irgwalk.h"
-#include "irmemory.h"
-
-DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
-
-/**
- * Copy the calling conventions from the entities to the call type.
- */
-static void update_calls(ir_node *call, void *env) {
-	(void) env;
-	if (is_Call(call)) {
-		ir_node *ptr = get_Call_ptr(call);
-
-		if (is_SymConst(ptr)) {
-			ir_entity *ent = get_SymConst_entity(ptr);
-			ir_type *mtp = get_entity_type(ent);
-			ir_type *ctp = get_Call_type(call);
-			unsigned cc  = get_method_calling_convention(mtp);
-
-			if (cc != get_method_calling_convention(ctp)) {
-				set_method_calling_convention(ctp, cc);
-				DB((dbg, LEVEL_1, "changed calling convention of calll to %+F\n", ent));
-			}
-		}
-	}
-}
-
-/**
- * Change the calling conventions for all local methods.
- *
- * @param cc  new calling convention
- */
-void opt_change_calling_conventions(unsigned cc) {
-	int i;
-	int changed = 0;
-
-	FIRM_DBG_REGISTER(dbg, "firm.opt.cc");
-
-	assure_irp_globals_address_taken_computed();
-
-	/* first step: change the calling conventions of the local non-escaped entities */
-	for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
-		ir_graph               *irg = get_irp_irg(i);
-		ir_entity              *ent = get_irg_entity(irg);
-		ir_address_taken_state state = get_entity_address_taken(ent);
-
-		if (get_entity_visibility(ent) == visibility_local &&
-		    state == ir_address_not_taken) {
-			ir_type *mtp = get_entity_type(ent);
-
-			unsigned new_cc, old_cc = get_method_calling_convention(mtp) & ~cc_bits;
-
-			new_cc = old_cc | (cc & cc_bits);
-
-			if (new_cc != old_cc) {
-				set_method_calling_convention(mtp, new_cc);
-				changed = 1;
-				DB((dbg, LEVEL_1, "changed calling convention of %+F\n", ent));
-			}
-		}
-	}
-
-	if (changed)
-		all_irg_walk(NULL, update_calls, NULL);
-}


Implements issue #352

Implements issue #352

--- Descriptors/GPXDescriptor.h
+++ Descriptors/GPXDescriptor.h
@@ -35,7 +35,7 @@
     void SetConfig(const _DescriptorConfig& c) { config = c; }
     void Run(http::Reply & reply, const RawRouteData &rawRoute, PhantomNodes &phantomNodes, SearchEngineT &sEngine) {
         reply.content += ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
-        reply.content += "<gpx xmlns=\"http://www.topografix.com/GPX/1/1\" "
+        reply.content += "<gpx creator=\"OSRM Routing Engine\" version=\"1.1\" xmlns=\"http://www.topografix.com/GPX/1/1\" "
                 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
                 "xsi:schemaLocation=\"http://www.topografix.com/GPX/1/1 gpx.xsd"
                 "\">";


dataplane: Fixed unit test.

dataplane: Fixed unit test.

--- src/dataplane/mgr/test/flowdb_dpmgr_port_test.c
+++ src/dataplane/mgr/test/flowdb_dpmgr_port_test.c
@@ -71,6 +71,7 @@
     struct port *_port;                                                 \
     \
     snprintf(_buf, sizeof(_buf), "%s, add ports", (_msg));		\
+    memset(&ifinfo, 0, sizeof(ifinfo));                                 \
     \
     for (size_t _s = (_b); _s < (_e); _s++) {				\
       TEST_ASSERT_TRUE_MESSAGE(LAGOPUS_RESULT_OK == dp_port_create(port_name[_s]), _buf); \


TpProtocol: keep our own immutable properties

--- telepathy-glib/protocol.c
+++ telepathy-glib/protocol.c
@@ -72,11 +72,13 @@
 struct _TpProtocolPrivate
 {
   TpConnectionManagerProtocol protocol_struct;
+  GHashTable *protocol_properties;
 };

 enum
 {
     PROP_PROTOCOL_NAME = 1,
+    PROP_PROTOCOL_PROPERTIES,
     N_PROPS
 };

@@ -94,6 +96,10 @@
       g_value_set_string (value, self->priv->protocol_struct.name);
       break;

+    case PROP_PROTOCOL_PROPERTIES:
+      g_value_set_boxed (value, self->priv->protocol_properties);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -115,6 +121,11 @@
       self->priv->protocol_struct.name = g_value_dup_string (value);
       break;

+    case PROP_PROTOCOL_PROPERTIES:
+      g_assert (self->priv->protocol_properties == NULL);
+      self->priv->protocol_properties = g_value_dup_boxed (value);
+      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -157,11 +168,31 @@

   _tp_connection_manager_protocol_free_contents (&self->priv->protocol_struct);

+  if (self->priv->protocol_properties != NULL)
+    g_hash_table_unref (self->priv->protocol_properties);
+
   if (finalize != NULL)
     finalize (object);
 }

 static void
+tp_protocol_constructed (GObject *object)
+{
+  TpProtocol *self = (TpProtocol *) object;
+  void (*chain_up) (GObject *) =
+    ((GObjectClass *) tp_protocol_parent_class)->constructed;
+
+  if (chain_up != NULL)
+    chain_up (object);
+
+  g_assert (self->priv->protocol_struct.name != NULL);
+
+  if (self->priv->protocol_properties == NULL)
+    self->priv->protocol_properties = g_hash_table_new_full (g_str_hash,
+        g_str_equal, g_free, (GDestroyNotify) tp_g_value_slice_free);
+}
+
+static void
 tp_protocol_class_init (TpProtocolClass *klass)
 {
   TpProxyClass *proxy_class = (TpProxyClass *) klass;
@@ -169,6 +200,7 @@

   g_type_class_add_private (klass, sizeof (TpProtocolPrivate));

+  object_class->constructed = tp_protocol_constructed;
   object_class->get_property = tp_protocol_get_property;
   object_class->set_property = tp_protocol_set_property;
   object_class->finalize = tp_protocol_finalize;
@@ -180,6 +212,13 @@
         NULL,
         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

+  g_object_class_install_property (object_class, PROP_PROTOCOL_PROPERTIES,
+      g_param_spec_boxed ("protocol-properties",
+        "Protocol properties",
+        "The immutable properties of this Protocol",
+        TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP,
+        G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   proxy_class->must_have_unique_name = FALSE;
   proxy_class->interface = TP_IFACE_QUARK_PROTOCOL;
   tp_protocol_init_known_interfaces ();
@@ -197,8 +236,7 @@
  * @dbus: proxy for the D-Bus daemon; may not be %NULL
  * @cm_name: the connection manager name (such as "gabble")
  * @protocol_name: the protocol name (such as "jabber")
- * @immutable_properties: the immutable D-Bus properties for this protocol,
- *  if available (currently unused)
+ * @immutable_properties: the immutable D-Bus properties for this protocol
  * @error: used to indicate the error if %NULL is returned
  *
  * <!-- -->
@@ -211,7 +249,7 @@
 tp_protocol_new (TpDBusDaemon *dbus,
     const gchar *cm_name,
     const gchar *protocol_name,
-    const GHashTable *immutable_properties G_GNUC_UNUSED,
+    const GHashTable *immutable_properties,
     GError **error)
 {
   TpProtocol *ret = NULL;
@@ -237,6 +275,7 @@
         "bus-name", bus_name,
         "object-path", object_path,
         "protocol-name", protocol_name,
+        "protocol-properties", immutable_properties,
         NULL));

 finally:


add missing parens in the definition of kMinPassAliveMoves

--- cc/constants.h
+++ cc/constants.h
@@ -34,7 +34,7 @@
 // The best positions we've found for these are:
 //   141 for 19x19, 40 for 9x9
 // but there may be more optimal sequences of moves.
-constexpr int kMinPassAliveMoves = kN * (kN + 2 / 3);
+constexpr int kMinPassAliveMoves = kN * ((kN + 2) / 3);

 // 722 moves for 19x19, 162 for 9x9.
 constexpr int kMaxSearchDepth = static_cast<int>(kN * kN * 2);


fixed clear_logger

fixed clear_logger

--- seaslog.c
+++ seaslog.c
@@ -371,6 +371,10 @@

     if (SEASLOG_G(last_logger)) {
         efree(SEASLOG_G(last_logger));
+    }
+
+    if (SEASLOG_G(current_datetime_format)) {
+        efree(SEASLOG_G(current_datetime_format));
     }
 }


fixed #57

fixed #57

--- seaslog.c
+++ seaslog.c
@@ -647,9 +647,9 @@
     path = str_replace(path, "/", "\\");
 #else
     if (order == SEASLOG_DETAIL_ORDER_DESC) {
-        spprintf(&command, 0, "%s", "tac");
-    } else {
-        spprintf(&command, 0, "%s", "more");
+        spprintf(&command, 0, "%s `ls -t %s`", "tac", path);
+    } else {
+        spprintf(&command, 0, "%s %s", "more", path);
     }
 #endif

@@ -657,13 +657,13 @@
 #ifdef WINDOWS
         spprintf(&sh, 0, "findstr \"%s\" %s | findstr \"%s\" ", level, path, key_word);
 #else
-        spprintf(&sh, 0, "%s %s 2>/dev/null| grep '%s' -w | grep '%s' -w | sed -n '%ld,%ld'p", command, path, level, key_word, start, limit);
+        spprintf(&sh, 0, "%s 2>/dev/null| grep '%s' -w | grep '%s' -w | sed -n '%ld,%ld'p", command, level, key_word, start, limit);
 #endif
     } else {
 #ifdef WINDOWS
         spprintf(&sh, 0, "findstr \"%s\" %s", level, path);
 #else
-        spprintf(&sh, 0, "%s %s 2>/dev/null| grep '%s' -w | sed -n '%ld,%ld'p", command, path, level, start, limit);
+        spprintf(&sh, 0, "%s 2>/dev/null| grep '%s' -w | sed -n '%ld,%ld'p", command, level, start, limit);
 #endif
     }


Fix for threading bug with +initialize.  Some limitations:

- Now only one thread may be in any +initialize method at once.
- Not yet implemented for the new ABI lookup function.

The first I don't see as a limitation; if anything having +initialize methods
be guaranteed not to run concurrently may be convenient.  The second I will fix
soon.

--- sendmsg.c
+++ sendmsg.c
@@ -28,6 +28,7 @@
 #include "objc/runtime-legacy.h"
 #include "objc/sarray.h"
 #include "objc/encoding.h"
+#include "lock.h"

 /* This is how we hack STRUCT_VALUE to be 1 or 0.   */
 #define gen_rtx(args...) 1
@@ -45,6 +46,9 @@

 /* The uninstalled dispatch table */
 struct sarray *__objc_uninstalled_dtable = 0;   /* !T:MUTEX */
+
+/* Mutex protecting the pre-initialize dtable */
+static mutex_t initialize_lock;

 /* Two hooks for method forwarding. If either is set, it is invoked
  * to return a function that performs the real forwarding.  If both
@@ -61,6 +65,18 @@

 static void __objc_install_dispatch_table_for_class (Class);

+typedef struct _InitializingDtable
+{
+	Class class;
+	struct sarray *dtable;
+	struct _InitializingDtable *next;
+} InitializingDtable;
+
+/** Protected by initialize_lock */
+InitializingDtable *temporary_dtables;
+
+static struct sarray *create_dtable_for_class (Class class);
+
 /* Forward declare some functions */
 static void __objc_init_install_dtable (id, SEL);

@@ -122,6 +138,44 @@
 {
     struct objc_slot *slot = sarray_get_safe (dtable, key);
     return (NULL != slot) ? slot->method : (IMP)0;
+}
+
+/**
+ * Returns the dtable for a given class.  If we are currently in an +initialize
+ * method then this will block if called from a thread other than the one
+ * running the +initialize method.
+ */
+static inline struct sarray *dtable_for_class(Class cls)
+{
+  if (cls->dtable != __objc_uninstalled_dtable)
+    {
+      return cls->dtable;
+    }
+  LOCK(&initialize_lock);
+  if (cls->dtable != __objc_uninstalled_dtable)
+    {
+      UNLOCK(&initialize_lock);
+      return cls->dtable;
+    }
+  /* This is a linear search, and so, in theory, could be very slow.  It is
+   * O(n) where n is the number of +initialize methods on the stack.  In
+   * practice, this is a very small number.  Profiling with GNUstep showed that
+   * this peaks at 8. */
+  struct sarray *dtable = __objc_uninstalled_dtable;
+  InitializingDtable *buffer = temporary_dtables;
+  while (NULL != buffer)
+  {
+      if (buffer->class == cls)
+      {
+          dtable = buffer->dtable;
+          break;
+      }
+      buffer = buffer->next;
+  }
+  UNLOCK(&initialize_lock);
+  if (dtable == 0)
+    dtable = __objc_uninstalled_dtable;
+  return dtable;
 }

 /* Given a class and selector, return the selector's implementation.  */
@@ -140,8 +194,10 @@
   IMP res = sarray_get_imp (class->dtable, (size_t) sel->sel_id);
   if (res == 0)
     {
+      /* This will block if calling +initialize from another thread. */
+      struct sarray *dtable = dtable_for_class(class);
       /* Not a valid method */
-      if (class->dtable == __objc_uninstalled_dtable)
+      if (dtable == __objc_uninstalled_dtable)
         {
           /* The dispatch table needs to be installed. */
           objc_mutex_lock (__objc_runtime_mutex);
@@ -150,7 +206,7 @@
               __objc_uninstalled_dtable again in case another thread
               installed the dtable while we were waiting for the lock
               to be released.  */
-         if (class->dtable == __objc_uninstalled_dtable)
+         if (dtable_for_class(class) == __objc_uninstalled_dtable)
            {
              __objc_install_dispatch_table_for_class (class);
            }
@@ -169,7 +225,7 @@
             after we invoked sarray_get_safe, but before we checked
             class->dtable == __objc_uninstalled_dtable).
          */
-          res = sarray_get_imp (class->dtable, (size_t) sel->sel_id);
+          res = sarray_get_imp (dtable, (size_t) sel->sel_id);
           if (res == 0)
             {
               /* The dispatch table has been installed, and the method
@@ -196,7 +252,7 @@
   if (object->class_pointer->dtable == __objc_uninstalled_dtable)
     {
       objc_mutex_lock (__objc_runtime_mutex);
-      if (object->class_pointer->dtable == __objc_uninstalled_dtable)
+      if (dtable_for_class(object->class_pointer) == __objc_uninstalled_dtable)
         {
           __objc_install_dispatch_table_for_class (object->class_pointer);
         }
@@ -223,8 +279,12 @@
                                 (sidx)op->sel_id);
       if (result == 0)
         {
+          /** Get the dtable that we should be using for lookup.  This will
+           * block if we are in the middle of running +initialize in another
+           * thread. */
+          struct sarray *dtable = dtable_for_class(receiver->class_pointer);
           /* Not a valid method */
-          if (receiver->class_pointer->dtable == __objc_uninstalled_dtable)
+          if (dtable == __objc_uninstalled_dtable)
             {
               /* The dispatch table needs to be installed.
                  This happens on the very first method call to the class. */
@@ -240,8 +300,7 @@
                  has been installed by another thread after we did the
                  previous check that the method exists).
               */
-              result = sarray_get_imp (receiver->class_pointer->dtable,
-                                        (sidx)op->sel_id);
+              result = sarray_get_imp (dtable, (sidx)op->sel_id);
               if (result == 0)
                 {
                   /* Try again after giving the code a chance to install new
@@ -291,6 +350,7 @@
 void
 __objc_init_dispatch_tables ()
 {
+  INIT_LOCK(initialize_lock);
   __objc_uninstalled_dtable = sarray_new (200, 0);
 }

@@ -304,7 +364,7 @@

   /* This may happen, if the programmer has taken the address of a
      method before the dtable was initialized... too bad for him! */
-  if (receiver->class_pointer->dtable != __objc_uninstalled_dtable)
+  if (dtable_for_class(receiver->class_pointer) != __objc_uninstalled_dtable)
     {
       objc_mutex_unlock (__objc_runtime_mutex);
       return;
@@ -314,9 +374,6 @@
     {
       /* receiver is an ordinary object */
       assert (CLS_ISCLASS (receiver->class_pointer));
-
-      /* install instance methods table */
-      __objc_install_dispatch_table_for_class (receiver->class_pointer);

       /* call +initialize -- this will in turn install the factory
          dispatch table if not already done :-) */
@@ -327,10 +384,6 @@
       /* receiver is a class object */
       assert (CLS_ISCLASS ((Class)receiver));
       assert (CLS_ISMETA (receiver->class_pointer));
-
-      /* Install real dtable for factory methods */
-      __objc_install_dispatch_table_for_class (receiver->class_pointer);
-
       __objc_send_initialize ((Class)receiver);
     }
   objc_mutex_unlock (__objc_runtime_mutex);
@@ -355,14 +408,30 @@

   if (! CLS_ISINITIALIZED (class))
     {
+      /* This is always called with the runtime lock, which guarantees
+       * atomicity, but we also need to make sure that the initialize lock is
+       * held so that we can create the premature dtable. */
+      LOCK(&initialize_lock);
+      if (! CLS_ISRESOLV (class))
+        __objc_resolve_class_links ();
       CLS_SETINITIALIZED (class);
       CLS_SETINITIALIZED (class->class_pointer);

+
       /* Create the garbage collector type memory description */
       __objc_generate_gc_type_description (class);

       if (class->super_class)
         __objc_send_initialize (class->super_class);
+      /* Create the dtable, but don't install it on the class quite yet. */
+
+      struct sarray *dtable = create_dtable_for_class(class);
+      /* Taking a pointer to an on-stack object and storing it in a global is
+       * usually a silly idea.  It is safe here, because we invert this
+       * transform before we return, and we use initialize_lock to make sure no
+       * other threads have access to this pointer. */
+      InitializingDtable buffer = { class, dtable, temporary_dtables };
+      temporary_dtables = &buffer;

       {
         SEL              op = sel_register_name ("initialize");
@@ -392,6 +461,22 @@
             (*imp) ((id) class, op);

       }
+      class->dtable = dtable;
+      /* Note: We don't free the cache entry; it was allocated on the stack. */
+      if (temporary_dtables == &buffer)
+      {
+          temporary_dtables = temporary_dtables->next;
+      }
+      else
+      {
+        InitializingDtable *prev = temporary_dtables;
+        while (prev->next->class != class)
+        {
+            prev = prev->next;
+        }
+        prev->next = buffer.next;
+      }
+      UNLOCK(&initialize_lock);
     }
 }
 /* Walk on the methods list of class and install the methods in the reverse
@@ -401,7 +486,8 @@
    method nothing is guaranteed about what method will be used.
    Assumes that __objc_runtime_mutex is locked down. */
 static void
-__objc_install_methods_in_dtable (Class class, MethodList_t method_list)
+__objc_install_methods_in_dtable (Class class, MethodList_t method_list,
+        struct sarray *dtable)
 {
   int i;

@@ -409,14 +495,14 @@
     return;

   if (method_list->method_next)
-    __objc_install_methods_in_dtable (class, method_list->method_next);
+    __objc_install_methods_in_dtable (class, method_list->method_next, dtable);

   for (i = 0; i < method_list->method_count; i++)
     {
       Method_t method = &(method_list->method_list[i]);
       size_t sel_id = (size_t)method->method_name->sel_id;
       /* If there is an existing slot with this value, just update it. */
-      struct objc_slot *slot = sarray_get_safe(class->dtable, sel_id);
+      struct objc_slot *slot = sarray_get_safe(dtable, sel_id);
       if (NULL != slot && slot->owner == class)
         {
           slot->method = method->method_imp;
@@ -431,10 +517,10 @@
           slot->types = method->method_types;
           slot->method = method->method_imp;
           slot->version = 1;
-          sarray_at_put_safe (class->dtable, sel_id, slot);
+          sarray_at_put_safe (dtable, sel_id, slot);
           /* Invalidate the superclass's slot, if it has one. */
           slot = (NULL != class->super_class) ?
-              sarray_get_safe(class->super_class->dtable, sel_id) : NULL;
+              sarray_get_safe(dtable_for_class(class->super_class), sel_id) : NULL;
           if (NULL != slot)
             {
               slot->version++;
@@ -443,11 +529,13 @@
     }
 }

-/* Assumes that __objc_runtime_mutex is locked down. */
-static void
-__objc_install_dispatch_table_for_class (Class class)
+/** Returns the dispatch table for the given class, but does not install it.
+ */
+static struct sarray *create_dtable_for_class (Class class)
 {
   Class super;
+  struct sarray *dtable = dtable_for_class(class);
+  if (dtable != __objc_uninstalled_dtable) return dtable;

   /* If the class has not yet had its class links resolved, we must
      re-compute all class links */
@@ -456,21 +544,30 @@

   super = class->super_class;

-  if (super != 0 && (super->dtable == __objc_uninstalled_dtable))
+  if (super != 0 && (dtable_for_class(super) == __objc_uninstalled_dtable))
     __objc_install_dispatch_table_for_class (super);

   /* Allocate dtable if necessary */
   if (super == 0)
     {
-      objc_mutex_lock (__objc_runtime_mutex);
-      class->dtable = sarray_new (__objc_selector_max_index, 0);
-      objc_mutex_unlock (__objc_runtime_mutex);
+      dtable = sarray_new (__objc_selector_max_index, 0);
     }
   else
-    class->dtable = sarray_lazy_copy (super->dtable);
-
-  __objc_install_methods_in_dtable (class, class->methods);
-}
+    {
+      dtable = sarray_lazy_copy (dtable_for_class(super));
+    }
+
+  __objc_install_methods_in_dtable (class, class->methods, dtable);
+  return dtable;
+}
+
+/* Assumes that __objc_runtime_mutex is locked down. */
+static void
+__objc_install_dispatch_table_for_class(Class class)
+{
+  class->dtable = create_dtable_for_class(class);
+}
+

 static void merge_methods_from_superclass (Class class)
 {
@@ -520,7 +617,7 @@
   if (class->dtable == __objc_uninstalled_dtable)
     return;

-  __objc_install_methods_in_dtable (class, class->methods);
+  __objc_install_methods_in_dtable (class, class->methods, class->dtable);
   objc_mutex_lock (__objc_runtime_mutex);

   if (class->subclass_list)        /* Traverse subclasses */


winsys/radeon: clamp vram_vis_size to 256MB

the value from the kernel is wrong

Reviewed-by: Nicolai Hähnle <0d0be6cf5ad662651be2dc5dfd44aa2b09d4c1cc@amd.com>

--- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -372,7 +372,7 @@
     }
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;
-    ws->info.vram_vis_size = gem_info.vram_visible;
+    ws->info.vram_vis_size = MIN2(gem_info.vram_visible, 256*1024*1024);

     /* Radeon allocates all buffers as contigous, which makes large allocations
      * unlikely to succeed. */


Fixes memory leak.

Fixes memory leak.

--- display/default/default.c
+++ display/default/default.c
@@ -54,19 +54,6 @@
   gboolean hover;
 } DISPLAY_INFO;

-static inline DISPLAY_INFO*
-create_display_info_with_notification_info(NOTIFICATION_INFO* const ni) {
-  if (!ni) return NULL;
-
-  DISPLAY_INFO* const di = g_new0(DISPLAY_INFO, 1);
-  if (!di) {
-    perror("g_new0");
-    return NULL;
-  }
-  di->ni = ni;
-  return di;
-}
-
 static inline void
 free_display_info(DISPLAY_INFO* const di) {
   gtk_widget_destroy(di->popup);
@@ -111,7 +98,7 @@
 }

 static inline DISPLAY_INFO*
-reset_display_info(DISPLAY_INFO*);
+reset_display_info(DISPLAY_INFO*, NOTIFICATION_INFO*);

 static gboolean
 display_animation_func(gpointer data) {
@@ -123,7 +110,7 @@
   if (di->timeout < 0) {
     notifications = g_list_remove(notifications, di);
     popup_collections = g_list_append(popup_collections, di);
-    reset_display_info(di);
+    reset_display_info(di, NULL);
     return FALSE;
   }

@@ -244,8 +231,8 @@
 }

 static inline DISPLAY_INFO*
-create_popup_skelton(NOTIFICATION_INFO* const ni) {
-  DISPLAY_INFO* const di = create_display_info_with_notification_info(ni);
+create_popup_skelton() {
+  DISPLAY_INFO* const di = g_new0(DISPLAY_INFO, 1);
   if (!di) return NULL;

   di->popup = gtk_window_new(GTK_WINDOW_POPUP);
@@ -318,11 +305,19 @@
 }

 static inline DISPLAY_INFO*
-reset_display_info(DISPLAY_INFO* const di) {
+reset_display_info(DISPLAY_INFO* const di, NOTIFICATION_INFO* const ni) {
   di->timeout = 500;
   di->pos     = 0;
   di->offset  = 0;
   di->hover   = FALSE;
+  if (di->ni) {
+    g_free(di->ni->title);
+    g_free(di->ni->text);
+    g_free(di->ni->icon);
+    g_free(di->ni->url);
+    g_free(di->ni);
+  }
+  di->ni = ni;
   gtk_widget_hide_all(di->popup);
   gtk_window_set_opacity(GTK_WINDOW(di->popup), 0.8);
   remove_icon(di);
@@ -344,7 +339,7 @@
     di->ni = ni;
     return di;
   }
-  return reset_display_info(create_popup_skelton(ni));
+  return reset_display_info(create_popup_skelton(), ni);
 }

 G_MODULE_EXPORT gboolean


[paging] Cosmetic changes

[paging] Cosmetic changes

--- kernel/arch/i386/paging.c
+++ kernel/arch/i386/paging.c
@@ -840,14 +840,8 @@

    pdir_t *pdir = !user_mmap ? get_kernel_pdir() : get_curr_pdir();
    size_t page_count = round_up_at(size, PAGE_SIZE) / PAGE_SIZE;
+   u32 mmap_flags = PG_RW_BIT | (user_mmap ? PG_US_BIT : PG_GLOBAL_BIT);
    size_t count;
-   u32 mmap_flags = PG_RW_BIT;
-
-   if (user_mmap) {
-      mmap_flags |= PG_US_BIT;
-   } else {
-      mmap_flags |= PG_GLOBAL_BIT;
-   }

    if (!vaddr) {


Removed more boost code

Removed more boost code

--- third_party/ttmath/ttmathint.h
+++ third_party/ttmath/ttmathint.h
@@ -44,7 +44,6 @@
  */

 #include "ttmathuint.h"
-#include "boost/unordered_map.hpp"
 namespace ttmath {

 /*!


rename

rename

--- kernel/hook/source/main.c
+++ kernel/hook/source/main.c
@@ -89,9 +89,11 @@
 	ps4KernelMemoryCopy((void *)hook2, h2, 128);
 	printf("ps4KernelMemoryCopy: %p %p\n", hook2, h2);

+	// We need to do this manually for now, since llvm code
+	// does not
 	s = 12;
-	r = ps4KernelAssemblerInstructionSeek(a, &s);
-	printf("ps4KernelAssemblerInstructionSeek: %i %zu\n", r, s);
+	r = ps4KernelMachineInstructionSeek(a, &s);
+	printf("ps4KernelMachineInstructionSeek: %i %zu\n", r, s);

 	r = ps4KernelFunctionIsHooked(a);
 	printf("ps4KernelFunctionIsHooked: %i %p\n", r, a);


timekeeping: Add xtime_shift and ntp_error_shift to struct timekeeper

The xtime_nsec value in the timekeeper structure is shifted by a few
bits to improve precision. This happens to be the same value as the
clock->shift. To improve readability add xtime_shift to the timekeeper
and use it instead of the clock->shift. Likewise add ntp_error_shift
and replace all (NTP_SCALE_SHIFT - clock->shift) expressions.

Signed-off-by: Martin Schwidefsky <52616596d8f5df0d597e85ab515377f92f939c68@de.ibm.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Acked-by: John Stultz <2dbbc9a029f6af74f2c2786ce8fa25d932fcaf8c@us.ibm.com>
Cc: Daniel Walker <664f14bf9af4dadf8666a74e4a7425b312868d0d@fifo99.com>
LKML-Reference: <770794eb8fe6d94f49fd653ef491e3c2d03fffc1@de.ibm.com>
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/time/timekeeping.c
+++ kernel/time/timekeeping.c
@@ -23,6 +23,8 @@
 struct timekeeper {
 	/* Current clocksource used for timekeeping. */
 	struct clocksource *clock;
+	/* The shift value of the current clocksource. */
+	int	shift;

 	/* Number of clock cycles in one NTP interval. */
 	cycle_t cycle_interval;
@@ -36,6 +38,9 @@
 	/* Difference between accumulated time and NTP time in ntp
 	 * shifted nano seconds. */
 	s64	ntp_error;
+	/* Shift conversion between clock shifted nano seconds and
+	 * ntp shifted nano seconds. */
+	int	ntp_error_shift;
 };

 struct timekeeper timekeeper;
@@ -75,8 +80,10 @@
 		((u64) interval * clock->mult_orig) >> clock->shift;

 	timekeeper.xtime_nsec = 0;
+	timekeeper.shift = clock->shift;

 	timekeeper.ntp_error = 0;
+	timekeeper.ntp_error_shift = NTP_SCALE_SHIFT - clock->shift;
 }

 /*
@@ -641,8 +648,7 @@
 	 * Now calculate the error in (1 << look_ahead) ticks, but first
 	 * remove the single look ahead already included in the error.
 	 */
-	tick_error = tick_length >>
-			(NTP_SCALE_SHIFT - timekeeper.clock->shift + 1);
+	tick_error = tick_length >> (timekeeper.ntp_error_shift + 1);
 	tick_error -= timekeeper.xtime_interval >> 1;
 	error = ((error - tick_error) >> look_ahead) + tick_error;

@@ -673,8 +679,7 @@
 	s64 error, interval = timekeeper.cycle_interval;
 	int adj;

-	error = timekeeper.ntp_error >>
-		(NTP_SCALE_SHIFT - timekeeper.clock->shift - 1);
+	error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1);
 	if (error > interval) {
 		error >>= 2;
 		if (likely(error <= interval))
@@ -696,7 +701,7 @@
 	timekeeper.xtime_interval += interval;
 	timekeeper.xtime_nsec -= offset;
 	timekeeper.ntp_error -= (interval - offset) <<
-			(NTP_SCALE_SHIFT - timekeeper.clock->shift);
+				timekeeper.ntp_error_shift;
 }

 /**
@@ -708,7 +713,7 @@
 {
 	struct clocksource *clock;
 	cycle_t offset;
-	s64 nsecs;
+	u64 nsecs;

 	/* Make sure we're fully resumed: */
 	if (unlikely(timekeeping_suspended))
@@ -720,13 +725,13 @@
 #else
 	offset = timekeeper.cycle_interval;
 #endif
-	timekeeper.xtime_nsec = (s64)xtime.tv_nsec << clock->shift;
+	timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift;

 	/* normally this loop will run just once, however in the
 	 * case of lost or late ticks, it will accumulate correctly.
 	 */
 	while (offset >= timekeeper.cycle_interval) {
-		u64 nsecps = (u64)NSEC_PER_SEC << clock->shift;
+		u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;

 		/* accumulate one interval */
 		offset -= timekeeper.cycle_interval;
@@ -748,7 +753,7 @@
 		/* accumulate error between NTP and clock interval */
 		timekeeper.ntp_error += tick_length;
 		timekeeper.ntp_error -= timekeeper.xtime_interval <<
-					(NTP_SCALE_SHIFT - clock->shift);
+					timekeeper.ntp_error_shift;
 	}

 	/* correct the clock when NTP error is too big */
@@ -773,16 +778,16 @@
 	if (unlikely((s64)timekeeper.xtime_nsec < 0)) {
 		s64 neg = -(s64)timekeeper.xtime_nsec;
 		timekeeper.xtime_nsec = 0;
-		timekeeper.ntp_error += neg << (NTP_SCALE_SHIFT - clock->shift);
+		timekeeper.ntp_error += neg << timekeeper.ntp_error_shift;
 	}

 	/* store full nanoseconds into xtime after rounding it up and
 	 * add the remainder to the error difference.
 	 */
-	xtime.tv_nsec = ((s64)timekeeper.xtime_nsec >> clock->shift) + 1;
-	timekeeper.xtime_nsec -= (s64)xtime.tv_nsec << clock->shift;
-	timekeeper.ntp_error += timekeeper.xtime_nsec <<
-				(NTP_SCALE_SHIFT - clock->shift);
+	xtime.tv_nsec =	((s64) timekeeper.xtime_nsec >> timekeeper.shift) + 1;
+	timekeeper.xtime_nsec -= (s64) xtime.tv_nsec << timekeeper.shift;
+	timekeeper.ntp_error +=	timekeeper.xtime_nsec <<
+				timekeeper.ntp_error_shift;

 	nsecs = clocksource_cyc2ns(offset, clock->mult, clock->shift);
 	update_xtime_cache(nsecs);


Code style fixes

Code style fixes

--- tls/base/gtlsconnection-base.c
+++ tls/base/gtlsconnection-base.c
@@ -1076,7 +1076,6 @@
   g_value_unset (&param[1]);

   return result;
-
 }

 static GSourceFuncs tls_source_funcs =
@@ -1854,8 +1853,8 @@

   g_assert (!priv->implicit_handshake);
   priv->implicit_handshake = g_task_new (tls, cancellable,
-                                        timeout ? sync_handshake_thread_completed : NULL,
-                                        NULL);
+                                         timeout ? sync_handshake_thread_completed : NULL,
+                                         NULL);
   g_task_set_source_tag (priv->implicit_handshake, do_implicit_handshake);
   g_task_set_name (priv->implicit_handshake, "[glib-networking] do_implicit_handshake");


perf probe: Add bitfield member support

perf probe: Add bitfield member support

Add bitfield member accessing support to probe arguments.

Suggested-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@ghostprotocols.net>
Cc: 3c8b2a59b7e748a88c5b8589b841c882ca47ab8c@sdl.hitachi.co.jp
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Cc: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Cc: Srikar Dronamraju <1f69195f6d934d4caf5816234bde319316df237e@linux.vnet.ibm.com>
Cc: Steven Rostedt <43232e92d70cc7aa53504ad0397085ee47bad87f@goodmis.org>
LKML-Reference: <ec8b869b98635305b4d315f0f6b04d04444b2abc@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <60fcdccfd958d359debfe6e6e7417cd7f1aaa9e3@hitachi.com>
[ committer note: Fixed up '%lu' use for return of BYTES_TO_BITS ('%zd') ]
Signed-off-by: Arnaldo Carvalho de Melo <293abb6b76d7791c0732cc517d38c4b5c734b87f@redhat.com>

--- tools/perf/util/probe-finder.c
+++ tools/perf/util/probe-finder.c
@@ -33,6 +33,7 @@
 #include <ctype.h>
 #include <dwarf-regs.h>

+#include <linux/bitops.h>
 #include "event.h"
 #include "debug.h"
 #include "util.h"
@@ -333,13 +334,23 @@
 	return vr_die;
 }

+static int die_get_attr_udata(Dwarf_Die *tp_die, unsigned int attr_name,
+			      Dwarf_Word *result)
+{
+	Dwarf_Attribute attr;
+
+	if (dwarf_attr(tp_die, attr_name, &attr) == NULL ||
+	    dwarf_formudata(&attr, result) != 0)
+		return -ENOENT;
+
+	return 0;
+}
+
 static bool die_is_signed_type(Dwarf_Die *tp_die)
 {
-	Dwarf_Attribute attr;
 	Dwarf_Word ret;

-	if (dwarf_attr(tp_die, DW_AT_encoding, &attr) == NULL ||
-	    dwarf_formudata(&attr, &ret) != 0)
+	if (die_get_attr_udata(tp_die, DW_AT_encoding, &ret))
 		return false;

 	return (ret == DW_ATE_signed_char || ret == DW_ATE_signed ||
@@ -348,11 +359,29 @@

 static int die_get_byte_size(Dwarf_Die *tp_die)
 {
-	Dwarf_Attribute attr;
 	Dwarf_Word ret;

-	if (dwarf_attr(tp_die, DW_AT_byte_size, &attr) == NULL ||
-	    dwarf_formudata(&attr, &ret) != 0)
+	if (die_get_attr_udata(tp_die, DW_AT_byte_size, &ret))
+		return 0;
+
+	return (int)ret;
+}
+
+static int die_get_bit_size(Dwarf_Die *tp_die)
+{
+	Dwarf_Word ret;
+
+	if (die_get_attr_udata(tp_die, DW_AT_bit_size, &ret))
+		return 0;
+
+	return (int)ret;
+}
+
+static int die_get_bit_offset(Dwarf_Die *tp_die)
+{
+	Dwarf_Word ret;
+
+	if (die_get_attr_udata(tp_die, DW_AT_bit_offset, &ret))
 		return 0;

 	return (int)ret;
@@ -827,6 +856,8 @@
 	return 0;
 }

+#define BYTES_TO_BITS(nb)	((nb) * BITS_PER_LONG / sizeof(long))
+
 static int convert_variable_type(Dwarf_Die *vr_die,
 				 struct probe_trace_arg *tvar,
 				 const char *cast)
@@ -841,6 +872,14 @@
 		/* Non string type is OK */
 		tvar->type = strdup(cast);
 		return (tvar->type == NULL) ? -ENOMEM : 0;
+	}
+
+	if (die_get_bit_size(vr_die) != 0) {
+		/* This is a bitfield */
+		ret = snprintf(buf, 16, "b%d@%d/%zd", die_get_bit_size(vr_die),
+				die_get_bit_offset(vr_die),
+				BYTES_TO_BITS(die_get_byte_size(vr_die)));
+		goto formatted;
 	}

 	if (die_get_real_type(vr_die, &type) == NULL) {
@@ -887,29 +926,31 @@
 		return (tvar->type == NULL) ? -ENOMEM : 0;
 	}

-	ret = die_get_byte_size(&type) * 8;
-	if (ret) {
-		/* Check the bitwidth */
-		if (ret > MAX_BASIC_TYPE_BITS) {
-			pr_info("%s exceeds max-bitwidth."
-				" Cut down to %d bits.\n",
-				dwarf_diename(&type), MAX_BASIC_TYPE_BITS);
-			ret = MAX_BASIC_TYPE_BITS;
-		}
-
-		ret = snprintf(buf, 16, "%c%d",
-			       die_is_signed_type(&type) ? 's' : 'u', ret);
-		if (ret < 0 || ret >= 16) {
-			if (ret >= 16)
-				ret = -E2BIG;
-			pr_warning("Failed to convert variable type: %s\n",
-				   strerror(-ret));
-			return ret;
-		}
-		tvar->type = strdup(buf);
-		if (tvar->type == NULL)
-			return -ENOMEM;
-	}
+	ret = BYTES_TO_BITS(die_get_byte_size(&type));
+	if (!ret)
+		/* No size ... try to use default type */
+		return 0;
+
+	/* Check the bitwidth */
+	if (ret > MAX_BASIC_TYPE_BITS) {
+		pr_info("%s exceeds max-bitwidth. Cut down to %d bits.\n",
+			dwarf_diename(&type), MAX_BASIC_TYPE_BITS);
+		ret = MAX_BASIC_TYPE_BITS;
+	}
+	ret = snprintf(buf, 16, "%c%d",
+		       die_is_signed_type(&type) ? 's' : 'u', ret);
+
+formatted:
+	if (ret < 0 || ret >= 16) {
+		if (ret >= 16)
+			ret = -E2BIG;
+		pr_warning("Failed to convert variable type: %s\n",
+			   strerror(-ret));
+		return ret;
+	}
+	tvar->type = strdup(buf);
+	if (tvar->type == NULL)
+		return -ENOMEM;
 	return 0;
 }


more compilaton

more compilaton

--- Engine/csound_orc_compile.c
+++ Engine/csound_orc_compile.c
@@ -491,7 +491,7 @@
     int opnum;
     int n, nreqd;;

-    /* printf("%d(%d): tree=%p\n", __FILE__, __LINE__, root); */
+    /* printf("%d(%d): tree=%p\n", __FILE__, __LINE_xxxxxxxxxxx_, root); */
     /* print_tree(csound, "create_opcode", root); */
     optxt = (OPTXT *) mcalloc(csound, (int32)sizeof(OPTXT));
     tp = &(optxt->t);


Updated Netide Wireshark Dissector

Updated Netide Wireshark Dissector

--- wireshark-NetIDEdissector/netide/packet-netide.c
+++ wireshark-NetIDEdissector/netide/packet-netide.c
@@ -6,16 +6,20 @@
 #include <stdio.h>
 #include <glib.h>

-#define NETIDE_PORT 41414
+#define NETIDE_PORT 5555

 static int proto_netide = -1;
 //static dissector_handle_t data_handle=NULL;
 static dissector_handle_t netide_handle;
 static dissector_handle_t openflow_v1_handle;
+//static dissector_handle_t openflow_handle;
+static dissector_handle_t data_handle;
 //void proto_register_netide(void);
 //void proto_reg_handoff_netide(void);
 static void dissect_netide(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);

+static int hf_zmq_header = -1;
+//static int hf_zmq_packet = -1;
 static int hf_netide_ver = -1;
 static int hf_netide_type = -1;
 static int hf_netide_length = -1;
@@ -28,8 +32,9 @@
 static const value_string packettypenames[] = {
     { 17, "NETIDE_OPENFLOW" },
     { 18, "NETIDE_NETCONF" },
-    { 19, "NETIDE_HELLO" },
-    { 20, "NETIDE_ERROR" },
+    { 1, "NETIDE_HELLO" },
+    { 2, "NETIDE_ERROR" },
+    { 3, "NETIDE_MGMT" },
     { 21, "NETIDE_OPFLEX" }
 };

@@ -40,6 +45,7 @@
     gint offset = 0;
     int length, op_length;
     tvbuff_t *next_tvb;
+    guint8 type;
 //    guint8 type_temp, type;

 //    type_temp    = tvb_get_guint8(tvb, 2);
@@ -47,17 +53,19 @@
     col_set_str(pinfo->cinfo, COL_PROTOCOL, "NETIDE");
     /* Clear out stuff in the info column */
     col_clear(pinfo->cinfo,COL_INFO);
-    col_add_fstr(pinfo->cinfo, COL_INFO, "%d -> %d ",
-             pinfo->srcport, pinfo->destport);
-
+    type = tvb_get_guint8(tvb, 3);
+    col_add_fstr(pinfo->cinfo, COL_INFO, "%d -> %d  NetIDE_Type: %s  ",
+             pinfo->srcport, pinfo->destport, val_to_str_const(type, packettypenames, "Unknown NetIDE message type"));
     length = tvb_length(tvb);
-
+//hay que coger la version del protocolo openflow tb y llamar a los diferentes dissector de cada version, no directamente al general, porque si llamamos al de openflow general machaca la vision del protocolo NetIDE
     if (tree) { /* we are being asked for details */
         proto_item *netide_item = NULL;
         proto_tree *netide_tree = NULL;

         netide_item = proto_tree_add_item(tree, proto_netide, tvb, 0, -1, ENC_NA);
         netide_tree = proto_item_add_subtree(netide_item, ett_netide);
+        proto_tree_add_item(netide_tree, hf_zmq_header, tvb, offset, 1, ENC_BIG_ENDIAN);
+        offset += 2;
         proto_tree_add_item(netide_tree, hf_netide_ver, tvb, offset, 1, ENC_BIG_ENDIAN);
         offset += 1;
         proto_tree_add_item(netide_tree, hf_netide_type, tvb, offset, 1, ENC_BIG_ENDIAN);
@@ -71,7 +79,12 @@
         op_length = length-offset;
 //        next_tvb = tvb_new_subset(tvb, offset, length-offset, length-offset);
         next_tvb = tvb_new_subset(tvb, offset, op_length, op_length);
-        call_dissector(openflow_v1_handle, next_tvb, pinfo, netide_tree);
+        if (type == 17){
+            call_dissector(openflow_v1_handle, next_tvb, pinfo, netide_tree);
+        }
+        else{
+            call_dissector(data_handle, next_tvb, pinfo, netide_tree);
+        }
 //        proto_tree_add_item(netide_tree, hf_netide_openflow_msg, tvb, offset, -1, ENC_BIG_ENDIAN);
     }
 }
@@ -80,6 +93,12 @@
 {

     static hf_register_info hf[] = {
+        { &hf_zmq_header,
+            { "ZMQ header", "zmq.header",
+            FT_UINT16, BASE_HEX,
+            NULL, 0x0,
+            "ZMQ header", HFILL }
+        },
         { &hf_netide_ver,
             { "NETIDE Version", "netide.ver",
             FT_UINT8, BASE_HEX,
@@ -141,6 +160,8 @@
     netide_handle = create_dissector_handle(dissect_netide, proto_netide);
     dissector_add_uint("tcp.port", NETIDE_PORT, netide_handle);
     openflow_v1_handle = find_dissector("openflow_v1");
+//    openflow_handle = find_dissector("openflow");
+    data_handle = find_dissector("data");
 /*    if (!initialized) {
         data_handle = find_dissector("data");
         netide_handle = create_dissector_handle(dissect_netide, proto_netide);


Changed the definition of uint32 to just "unsigned" in order to make the cdb++ library work on both 32 and 64-bit systems.

--- cdb++/cdb++.h
+++ cdb++/cdb++.h
@@ -1,5 +1,5 @@
 /* $Id$ */
-// Copyright (C) 1999,2000 Bruce Guenter <bruceg@em.ca>
+// Copyright (C) 1999,2000,2005 Bruce Guenter <bruceg@em.ca>
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
 #include "cdb++/datum.h"
 #include "fdbuf/fdbuf.h"

-typedef unsigned long uint32;
+typedef unsigned uint32;

 #define CDBMAKE_HPLIST 1000


Added ARM compatibility

Added ARM compatibility

--- service/easy-setup/enrollee/linux/wifi/networkhandler.c
+++ service/easy-setup/enrollee/linux/wifi/networkhandler.c
@@ -60,7 +60,7 @@

 #ifdef ARM
     system("sudo wpa_supplicant -Dnl80211 -iwlan0 -c/home/pi/wpa.con");
-   // Optain an IP address
+   // Optain an IP address and do something
     system("sudo dhclient wlan0");
 #endif ARM
     struct ifaddrs *ifaddr, *ifa;


Check pthread_create

Check pthread_create

--- iotests/blockVerify.c
+++ iotests/blockVerify.c
@@ -153,7 +153,10 @@
     threadContext[i].bytesRead = 0;
     threadContext[i].elapsed = 0;

-    pthread_create(&(pt[i]), NULL, runThread, &(threadContext[i]));
+    if (pthread_create(&(pt[i]), NULL, runThread, &(threadContext[i]))) {
+      fprintf(stderr,"*error* can't create a thread\n");
+      exit(-1);
+    }
   }

   for (size_t i = 0; i < threads; i++) {


Handle nodes with block predecessors.

Handle nodes with block predecessors.

[r15665]

--- ir/be/beschednormal.c
+++ ir/be/beschednormal.c
@@ -129,7 +129,7 @@
 			ir_node* pred = get_irn_n(irn, i);
 			int cost;

-			if (is_Phi(irn) || get_irn_mode(pred) == mode_M) {
+			if (is_Phi(irn) || get_irn_mode(pred) == mode_M || is_Block(pred)) {
 				cost = 0;
 			} else if (get_nodes_block(pred) != block) {
 				cost = 1;
@@ -237,6 +237,8 @@
 	int            i;

 	if (irn_visited(irn)) return sched;
+
+	if (is_End(irn)) return sched;

 	if (!is_Phi(irn)) {
 		for (i = 0; i < arity; ++i) {


beschednormal: Remove strange scheduled test from tree cost calculation.

The test simply makes no sense.

--- ir/be/beschednormal.c
+++ ir/be/beschednormal.c
@@ -195,8 +195,6 @@
 		mode = get_irn_mode(op);
 		if (mode == mode_M)
 			continue;
-		if (arch_get_irn_flags(op) & arch_irn_flags_not_scheduled)
-			continue;
 		if (mode != mode_T && arch_irn_is_ignore(op))
 			continue;
 		cost = MAX(fc->costs[i].cost + n_op_res, cost);


run in loop

run in loop

--- ir/be/test/fib_iter.c
+++ ir/be/test/fib_iter.c
@@ -14,13 +14,14 @@
 }

 int main(int argc, char *argv[]) {
-	int n = 10;
+	int i, n = 10;

 	if (argc > 1) {
 		n = atoi(argv[1]);
 	}

-	printf("fib(%d) = %lu\n", n, fib_iter(n));
+	for (i = 0; i <= n; i++)
+		printf("fib(%d) = %lu\n", i, fib_iter(i));

 	return 0;
 }


fix for key cache lookup

fix for key cache lookup

--- iterator/iter_utils.c
+++ iterator/iter_utils.c
@@ -577,9 +577,14 @@
 		struct key_entry_key* kk = key_cache_obtain(env->key_cache,
 			dp->name, dp->namelen, dclass, env->scratch, *env->now);
 		if(kk) {
-			if(key_entry_isgood(kk) || key_entry_isbad(kk)) {
+			if(query_dname_compare(kk->name, dp->name) == 0) {
+			  if(key_entry_isgood(kk) || key_entry_isbad(kk)) {
 				regional_free_all(env->scratch);
 				return 1;
+			  } else if(key_entry_isnull(kk)) {
+				regional_free_all(env->scratch);
+				return 0;
+			  }
 			}
 			regional_free_all(env->scratch);
 		}


uselect_arr fix 2

uselect_arr fix 2

darcs-hash:20080515133044-54782-3a9e360d13f194128b847cc085fe29f5b25b4dca.gz

--- kernel/common/u/usocket.c
+++ kernel/common/u/usocket.c
@@ -515,6 +515,8 @@
                 sys_call_error("select");
                 return U_SOCKET_ERROR;
             }
+        else
+        	break;
     }

     for (i = 0; i < sock_num; i++)


time: Avoid potential shift overflow with large shift values

Andreas Schwab noticed that the 1 << tk->shift could overflow if the
shift value was greater than 30, since 1 would be a 32bit long on
32bit architectures. This issue was introduced by 1e75fa8be (time:
Condense timekeeper.xtime into xtime_sec)

Use 1ULL instead to ensure we don't overflow on the shift.

Reported-by: Andreas Schwab <c9df6394cb541f693236245820fbe23866f1a3fe@linux-m68k.org>
Signed-off-by: John Stultz <33837adfb53316eae44aad04041e1240088d76fd@linaro.org>
Cc: Prarit Bhargava <fe4655370dc87a32329d591d6e8472329333dfad@redhat.com>
Cc: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>
Link: http://lkml.kernel.org/r/1345595449-34965-4-git-send-email-33837adfb53316eae44aad04041e1240088d76fd@linaro.org
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/time/timekeeping.c
+++ kernel/time/timekeeping.c
@@ -1184,9 +1184,9 @@
 	* the vsyscall implementations are converted to use xtime_nsec
 	* (shifted nanoseconds), this can be killed.
 	*/
-	remainder = tk->xtime_nsec & ((1 << tk->shift) - 1);
+	remainder = tk->xtime_nsec & ((1ULL << tk->shift) - 1);
 	tk->xtime_nsec -= remainder;
-	tk->xtime_nsec += 1 << tk->shift;
+	tk->xtime_nsec += 1ULL << tk->shift;
 	tk->ntp_error += remainder << tk->ntp_error_shift;

 	/*


time: Fix timekeeping_freqadjust()'s incorrect use of abs() instead of abs64()

The internal clocksteering done for fine-grained error
correction uses a logarithmic approximation, so any time
adjtimex() adjusts the clock steering, timekeeping_freqadjust()
quickly approximates the correct clock frequency over a series
of ticks.

Unfortunately, the logic in timekeeping_freqadjust(), introduced
in commit:

  dc491596f639 ("timekeeping: Rework frequency adjustments to work better w/ nohz")

used the abs() function with a s64 error value to calculate the
size of the approximated adjustment to be made.

Per include/linux/kernel.h:

  "abs() should not be used for 64-bit types (s64, u64, long long) - use abs64()".

Thus on 32-bit platforms, this resulted in the clocksteering to
take a quite dampended random walk trying to converge on the
proper frequency, which caused the adjustments to be made much
slower then intended (most easily observed when large
adjustments are made).

This patch fixes the issue by using abs64() instead.

Reported-by: Nuno Gonçalves <54df356d35a1227da7b6a150655996586549b9d2@gmail.com>
Tested-by: Nuno Goncalves <54df356d35a1227da7b6a150655996586549b9d2@gmail.com>
Signed-off-by: John Stultz <33837adfb53316eae44aad04041e1240088d76fd@linaro.org>
Cc: <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org> # v3.17+
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Miroslav Lichvar <acc9bee607f0b55b63aa94bc82fa52f84b106ffb@redhat.com>
Cc: Peter Zijlstra <3fddac958924aef220f202ca567388ddab3f14a8@infradead.org>
Cc: Prarit Bhargava <fe4655370dc87a32329d591d6e8472329333dfad@redhat.com>
Cc: Richard Cochran <e27030aebe9cad8817d34b8c31dbaf301fb798b9@gmail.com>
Cc: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>
Link: http://lkml.kernel.org/r/1441840051-20244-1-git-send-email-33837adfb53316eae44aad04041e1240088d76fd@linaro.org
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>


Fix failing test under C++14

Fix failing test under C++14

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@337970 91177308-0d34-0410-b5e6-96231b3b80d8

--- src/experimental/filesystem/filesystem_common.h
+++ src/experimental/filesystem/filesystem_common.h
@@ -362,8 +362,8 @@
     // The tv_nsec and tv_usec fields must not be negative so adjust accordingly
     if (subsec_dur.count() < 0) {
       if (sec_dur.count() > min_seconds) {
-        sec_dur -= fs_seconds(1);
-        subsec_dur += fs_seconds(1);
+        sec_dur = sec_dur - fs_seconds(1);
+        subsec_dur = subsec_dur + fs_seconds(1);
       } else {
         subsec_dur = fs_nanoseconds::zero();
       }


timekeeping: Update tk->cycle_last in resume

commit 7ec98e15aa (timekeeping: Delay update of clock->cycle_last)
forgot to update tk->cycle_last in the resume path. This results in a
stale value versus clock->cycle_last and prevents resume in the worst
case.

Reported-by: Jiri Slaby <dfbf39eb5bf303a3db5454d815cb8c8888cbadf9@suse.cz>
Reported-and-tested-by: Borislav Petkov <0691a664b24b6f15b20cd5aee64b72271db08be1@alien8.de>
Acked-by: John Stultz <33837adfb53316eae44aad04041e1240088d76fd@linaro.org>
Cc: Linux-pm mailing list <b46218f6b44e9c202c4acd9f095c69546b4b0dff@lists.linux-foundation.org>
Link: 55494d73322e98330a0b26dd74efae5d925d9714@ionos
Signed-off-by: Thomas Gleixner <00e4cf8f46a57000a44449bf9dd8cbbcc209fd2a@linutronix.de>

--- kernel/time/timekeeping.c
+++ kernel/time/timekeeping.c
@@ -951,7 +951,7 @@
 		__timekeeping_inject_sleeptime(tk, &ts_delta);

 	/* Re-base the last cycle value */
-	clock->cycle_last = cycle_now;
+	tk->cycle_last = clock->cycle_last = cycle_now;
 	tk->ntp_error = 0;
 	timekeeping_suspended = 0;
 	timekeeping_update(tk, false, true);


added tester_6.c module example

added tester_6.c module example

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

--- kernel_modules/tester_6.c
+++ kernel_modules/tester_6.c
@@ -0,0 +1,42 @@
+#include <linux/module.h>
+#include <linux/kthread.h>
+
+struct tast_struct *ts[2];
+
+struct params {
+	char name[100];
+	int delay;
+	int idx;
+};
+
+struct params threads[2];
+
+int function(void* data) {
+	int delay = ((struct params*)data)->delay;
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(delay * HZ);
+	printk(KERN_EMERG "%s: Ding", ((struct params*)data)->name);
+	printk(KERN_EMERG "thread %d stopped", (((struct params*)data)->idx+1));
+	return 0;
+}
+
+int init_module(void) {
+	strncpy(threads[0].name, "thread 1 speaking", 17);
+	strncpy(threads[1].name, "thread 2 speaking", 17);
+	threads[0].delay = 2;
+	threads[0].idx = 0;
+	threads[1].delay = 5;
+	threads[1].idx = 1;
+
+	printk(KERN_EMERG "Starting...");
+	ts[0] = kthread_run(function, (void*)&threads[0], "spawn1");
+	ts[1] = kthread_run(function, (void*)&threads[1], "spawn2");
+
+	return 0;
+}
+
+void cleanup_module(void) {
+	printk(KERN_EMERG "Module unload successfully\n");
+}
+
+MODULE_LICENSE("GPL");


translate: Move loop variable declaration outside for loop.

Fixes MSVC build.

--- src/gallium/auxiliary/translate/translate_sse.c
+++ src/gallium/auxiliary/translate/translate_sse.c
@@ -849,6 +849,7 @@
    else if(!memcmp(&output_desc->channel[0], &input_desc->channel[0], sizeof(output_desc->channel[0])))
    {
       struct x86_reg tmp = p->tmp_EAX;
+      unsigned i;
       if(input_desc->channel[0].size == 8 && input_desc->nr_channels == 4 && output_desc->nr_channels == 4
                      && swizzle[0] == UTIL_FORMAT_SWIZZLE_W
                      && swizzle[1] == UTIL_FORMAT_SWIZZLE_Z
@@ -862,7 +863,7 @@
          return TRUE;
       }

-      for(unsigned i = 0; i < output_desc->nr_channels; ++i)
+      for(i = 0; i < output_desc->nr_channels; ++i)
       {
          switch(output_desc->channel[0].size)
          {


nvc0: fix dri3 prime buffer creation

nvc0: fix dri3 prime buffer creation

We need to place shared buffers into GART.

Reviewed-by: Axel Davy <2b6ef604b998fb81662f85c329e4fc020eae8e5d@ens.fr>
Reviewed-by: Ilia Mirkin <bcbbb7aa705ec3a5fc5824c01a845186c3d62fca@alum.mit.edu>
Signed-off-by: Dave Airlie <f2295d84e358395675bc8031be58672073ae065e@redhat.com>

--- src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -296,7 +296,7 @@
    }
    bo_config.nvc0.tile_mode = mt->level[0].tile_mode;

-   if (!bo_config.nvc0.memtype && pt->usage == PIPE_USAGE_STAGING)
+   if (!bo_config.nvc0.memtype && (pt->usage == PIPE_USAGE_STAGING || pt->bind & PIPE_BIND_SHARED))
       mt->base.domain = NOUVEAU_BO_GART;
    else
       mt->base.domain = NOUVEAU_BO_VRAM;


softpipe: Sanitise shader semantic and interpolator handling.

Handle the remaining semantic names and indices.
Respect color interpolator when not flatshading.

--- src/gallium/drivers/softpipe/sp_state_derived.c
+++ src/gallium/drivers/softpipe/sp_state_derived.c
@@ -66,8 +66,6 @@
    if (vinfo->num_attribs == 0) {
       /* compute vertex layout now */
       const struct sp_fragment_shader *spfs = softpipe->fs;
-      const enum interp_mode colorInterp
-         = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
       struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
       const uint num = draw_num_vs_outputs(softpipe->draw);
       uint i;
@@ -108,33 +106,21 @@

          switch (spfs->info.input_semantic_name[i]) {
          case TGSI_SEMANTIC_POSITION:
-            src = draw_find_vs_output(softpipe->draw,
-                                      TGSI_SEMANTIC_POSITION, 0);
-            draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src);
+            interp = INTERP_POS;
             break;

          case TGSI_SEMANTIC_COLOR:
-            src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_COLOR,
-                                 spfs->info.input_semantic_index[i]);
-            draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
-            break;
-
-         case TGSI_SEMANTIC_FOG:
-            src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_FOG, 0);
-            draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
-            break;
-
-         case TGSI_SEMANTIC_GENERIC:
-         case TGSI_SEMANTIC_FACE:
-            /* this includes texcoords and varying vars */
-            src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC,
-                                      spfs->info.input_semantic_index[i]);
-            draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
-            break;
-
-         default:
-            assert(0);
+            if (softpipe->rasterizer->flatshade) {
+               interp = INTERP_CONSTANT;
+            }
+            break;
          }
+
+         /* this includes texcoords and varying vars */
+         src = draw_find_vs_output(softpipe->draw,
+                                   spfs->info.input_semantic_name[i],
+                                   spfs->info.input_semantic_index[i]);
+         draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
       }

       softpipe->psize_slot = draw_find_vs_output(softpipe->draw,


softpipe: cleanup framebuffer state routine slightly

--- src/gallium/drivers/softpipe/sp_state_surface.c
+++ src/gallium/drivers/softpipe/sp_state_surface.c
@@ -75,51 +75,21 @@

       /* update cache */
       sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf);
-   }

-#if 0
-   /* XXX combined depth/stencil here */
-
-   /* sbuf changing? */
-   if (sp->framebuffer.sbuf != fb->sbuf) {
-      /* flush old */
-      sp_flush_tile_cache(sp, sp->sbuf_cache_sep);
-
-      /* assign new */
-      sp->framebuffer.sbuf = fb->sbuf;
-
-      /* update cache */
-      if (fb->sbuf != fb->zbuf) {
-         /* separate stencil buf */
-         sp->sbuf_cache = sp->sbuf_cache_sep;
-         sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf);
-      }
-      else {
-         /* combined depth/stencil */
-         sp->sbuf_cache = sp->zbuf_cache;
-         sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf);
-      }
-   }
-#endif
-
-   /* Tell draw module how deep the Z/depth buffer is */
-   {
-      int depth_bits;
-      double mrd;
+      /* Tell draw module how deep the Z/depth buffer is */
       if (sp->framebuffer.zsbuf) {
+         int depth_bits;
+         double mrd;
          depth_bits = pf_get_component_bits(sp->framebuffer.zsbuf->format,
                                             PIPE_FORMAT_COMP_Z);
+         if (depth_bits > 16) {
+            mrd = 0.0000001;
+         }
+         else {
+            mrd = 0.00002;
+         }
+         draw_set_mrd(sp->draw, mrd);
       }
-      else {
-         depth_bits = 0;
-      }
-      if (depth_bits > 16) {
-         mrd = 0.0000001;
-      }
-      else {
-         mrd = 0.00002;
-      }
-      draw_set_mrd(sp->draw, mrd);
    }

    sp->framebuffer.width = fb->width;


more renaming

more renaming

--- ReactiveCocoaFramework/ReactiveCocoa/NSObject+RACPropertySubscribing.h
+++ ReactiveCocoaFramework/ReactiveCocoa/NSObject+RACPropertySubscribing.h
@@ -11,8 +11,10 @@
 #define RAC_KEYPATH(object, property) ((void)(NO && ((void)object.property, NO)), @#property)
 #define RAC_KEYPATH_SELF(property) RAC_KEYPATH(self, property)

-#define RACABLE(object, property) [object RACSubscribableForKeyPath:RAC_KEYPATH(object, property)]
-#define RACABLE_SELF(property) RACABLE(self, property)
+#define RACAble(object, property) [object RACSubscribableForKeyPath:RAC_KEYPATH(object, property)]
+#define RACAbleWithStart(object, property) [[object RACSubscribableForKeyPath:RAC_KEYPATH(object, property)] startWith:object.property]
+#define RACAbleSelf(property) RACAble(self, property)
+#define RACAbleSelfWithStart(property) RACAbleWithStart(self, property)

 @class RACSubscribable;


4.8.c

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

--- chapter4/4.8.c
+++ chapter4/4.8.c
@@ -0,0 +1,25 @@
+#include "apue.h"
+#include "fcntl.h"
+
+int main(int argc, char const *argv[])
+{
+    if (argc != 2)
+    {
+        err_quit("usage: a.out <pathname>");
+    }
+
+    if (access(argv[1], R_OK) < 0)
+    {
+        err_ret("access error for %s", argv[1])
+    } else {
+        printf("read access OK\n");
+    }
+
+    if (open(argv[1], O_RDONLY) < 0)
+    {
+        err_ret("open error for %s", argv[1]);
+    } else {
+        printf("open for reading OK\n");
+    }
+    exit(0);
+}


emulator: Handle Host Number Of Completed Packets Command

The Host_Number_Of_Completed_Packets command is a special command in
the sense that no event is normally generated after the command
has completed.

--- emulator/btdev.c
+++ emulator/btdev.c
@@ -2402,6 +2402,12 @@
 		cmd_complete(btdev, opcode, &status, sizeof(status));
 		break;

+	case BT_HCI_CMD_HOST_NUM_COMPLETED_PACKETS:
+		/* This command is special in the sense that no event is
+		 * normally generated after the command has completed.
+		 */
+		break;
+
 	case BT_HCI_CMD_READ_NUM_SUPPORTED_IAC:
 		if (btdev->type == BTDEV_TYPE_LE)
 			goto unsupported;


emulator: Fix ACL packet types from controller to host

The ACL packet type 0x00 is only allowed from host to controller. When
the packet is received at the remote end and is sent from controller
to host the type needs to be converted to 0x02.

--- emulator/btdev.c
+++ emulator/btdev.c
@@ -32,6 +32,10 @@
 #include <string.h>
 #include <alloca.h>
 #include <sys/uio.h>
+#include <stdint.h>
+
+#include "lib/bluetooth.h"
+#include "lib/hci.h"

 #include "src/shared/util.h"
 #include "src/shared/timeout.h"
@@ -3252,10 +3256,34 @@
 	}
 }

+static void send_acl(struct btdev *conn, const void *data, uint16_t len)
+{
+	struct bt_hci_acl_hdr hdr;
+	struct iovec iov[3];
+
+	/* Packet type */
+	iov[0].iov_base = (void *) data;
+	iov[0].iov_len = 1;
+
+	/* ACL_START_NO_FLUSH is only allowed from host to controller.
+	 * From controller to host this should be converted to ACL_START.
+	 */
+	memcpy(&hdr, data + 1, sizeof(hdr));
+	if (acl_flags(hdr.handle) == ACL_START_NO_FLUSH)
+		hdr.handle = acl_handle_pack(acl_handle(hdr.handle), ACL_START);
+
+	iov[1].iov_base = &hdr;
+	iov[1].iov_len = sizeof(hdr);
+
+	iov[2].iov_base = (void *) (data + 1 + sizeof(hdr));
+	iov[2].iov_len = len - 1 - sizeof(hdr);
+
+	send_packet(conn, iov, 3);
+}
+
 void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len)
 {
 	uint8_t pkt_type;
-	struct iovec iov;

 	if (!btdev)
 		return;
@@ -3270,11 +3298,8 @@
 		process_cmd(btdev, data + 1, len - 1);
 		break;
 	case BT_H4_ACL_PKT:
-		if (btdev->conn) {
-			iov.iov_base = (void *) data;
-			iov.iov_len = len;
-			send_packet(btdev->conn, &iov, 1);
-		}
+		if (btdev->conn)
+			send_acl(btdev->conn, data, len);
 		num_completed_packets(btdev);
 		break;
 	default:


Override the tap iterator to pass the correct engine handle

--- engine_testapp.c
+++ engine_testapp.c
@@ -16,10 +16,21 @@
 struct mock_engine {
     ENGINE_HANDLE_V1 me;
     ENGINE_HANDLE_V1 *the_engine;
+    TAP_ITERATOR iterator;
 };

 static inline struct mock_engine* get_handle(ENGINE_HANDLE* handle) {
     return (struct mock_engine*)handle;
+}
+
+static tap_event_t mock_tap_iterator(ENGINE_HANDLE* handle,
+                                     const void *cookie, item **itm,
+                                     void **es, uint16_t *nes, uint8_t *ttl,
+                                     uint16_t *flags, uint32_t *seqno,
+                                     uint16_t *vbucket) {
+   struct mock_engine *me = get_handle(handle);
+   return me->iterator((ENGINE_HANDLE*)me->the_engine, cookie, itm, es, nes,
+                       ttl, flags, seqno, vbucket);
 }

 static const engine_info* mock_get_info(ENGINE_HANDLE* handle) {
@@ -424,8 +435,9 @@
                                            uint32_t flags,
                                            const void* userdata, size_t nuserdata) {
     struct mock_engine *me = get_handle(handle);
-    return me->the_engine->get_tap_iterator((ENGINE_HANDLE*)me->the_engine, cookie,
-                                            client, nclient, flags, userdata, nuserdata);
+    me->iterator = me->the_engine->get_tap_iterator((ENGINE_HANDLE*)me->the_engine, cookie,
+                                                    client, nclient, flags, userdata, nuserdata);
+    return (me->iterator != NULL) ? mock_tap_iterator : NULL;
 }

 static size_t mock_errinfo(ENGINE_HANDLE *handle, const void* cookie,


Update from stable branch.

Update from stable branch.

--- engines/e_capi.c
+++ engines/e_capi.c
@@ -141,6 +141,8 @@
 	/* Certificate store name to use */
 	LPTSTR storename;
 	LPTSTR ssl_client_store;
+	/* System store flags */
+	DWORD store_flags;

 /* Lookup string meanings in load_private_key */
 /* Substring of subject: uses "storename" */
@@ -190,6 +192,7 @@
 #define CAPI_CMD_LIST_OPTIONS		(ENGINE_CMD_BASE + 10)
 #define CAPI_CMD_LOOKUP_METHOD		(ENGINE_CMD_BASE + 11)
 #define CAPI_CMD_STORE_NAME		(ENGINE_CMD_BASE + 12)
+#define CAPI_CMD_STORE_FLAGS		(ENGINE_CMD_BASE + 13)

 static const ENGINE_CMD_DEFN capi_cmd_defns[] = {
 	{CAPI_CMD_LIST_CERTS,
@@ -245,6 +248,10 @@
 		"store_name",
 		"certificate store name, default \"MY\"",
 		ENGINE_CMD_FLAG_STRING},
+	{CAPI_CMD_STORE_FLAGS,
+		"store_flags",
+		"Certificate store flags: 1 = system store",
+		ENGINE_CMD_FLAG_NUMERIC},

 	{0, NULL, NULL, 0}
 	};
@@ -289,6 +296,20 @@
 			OPENSSL_free(ctx->storename);
 		ctx->storename = BUF_strdup(p);
 		CAPI_trace(ctx, "Setting store name to %s\n", p);
+		break;
+
+		case CAPI_CMD_STORE_FLAGS:
+		if (i & 1)
+			{
+			ctx->store_flags |= CERT_SYSTEM_STORE_LOCAL_MACHINE;
+			ctx->store_flags &= ~CERT_SYSTEM_STORE_CURRENT_USER;
+			}
+		else
+			{
+			ctx->store_flags |= CERT_SYSTEM_STORE_CURRENT_USER;
+			ctx->store_flags &= ~CERT_SYSTEM_STORE_LOCAL_MACHINE;
+			}
+		CAPI_trace(ctx, "Setting flags to %d\n", i);
 		break;

 		case CAPI_CMD_DEBUG_LEVEL:
@@ -410,8 +431,7 @@
 		ctx->certselectdlg = (CERTDLG)GetProcAddress(cryptui, "CryptUIDlgSelectCertificateFromStore");
 	if (kernel)
 		ctx->getconswindow = (GETCONSWIN)GetProcAddress(kernel, "GetConsoleWindow");
-	if (cryptui)
-//	if (cryptui && !OPENSSL_isservice())
+	if (cryptui && !OPENSSL_isservice())
 		ctx->client_cert_select = cert_select_dialog;
 	}
 #endif
@@ -1255,7 +1275,8 @@
 		storename = "MY";
 	CAPI_trace(ctx, "Opening certificate store %s\n", storename);

-	hstore = CertOpenSystemStore(0, storename);
+	hstore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, 0,
+				ctx->store_flags, storename);
 	if (!hstore)
 		{
 		CAPIerr(CAPI_F_CAPI_OPEN_STORE, CAPI_R_ERROR_OPENING_STORE);
@@ -1346,6 +1367,7 @@
 	{
 	CAPI_KEY *key;
 	key = OPENSSL_malloc(sizeof(CAPI_KEY));
+						contname, provname, ptype);
 	CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
 						contname, provname, ptype);
 	if (!CryptAcquireContext(&key->hprov, contname, provname, ptype, 0))
@@ -1372,7 +1394,7 @@

 static CAPI_KEY *capi_get_cert_key(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
 	{
-	CAPI_KEY *key;
+	CAPI_KEY *key = NULL;
 	CRYPT_KEY_PROV_INFO *pinfo = NULL;
 	char *provname = NULL, *contname = NULL;
 	pinfo = capi_get_prov_info(ctx, cert);
@@ -1381,8 +1403,7 @@
 	provname = wide_to_asc(pinfo->pwszProvName);
 	contname = wide_to_asc(pinfo->pwszContainerName);
 	if (!provname || !contname)
-		return 0;
-
+		goto err;
 	key = capi_get_key(ctx, contname, provname,
 				pinfo->dwProvType, pinfo->dwKeySpec);

@@ -1455,6 +1476,9 @@
 	ctx->keytype = AT_KEYEXCHANGE;
 	ctx->storename = NULL;
 	ctx->ssl_client_store = NULL;
+	ctx->store_flags = CERT_STORE_OPEN_EXISTING_FLAG |
+				CERT_STORE_READONLY_FLAG |
+				CERT_SYSTEM_STORE_CURRENT_USER;
 	ctx->lookup_method = CAPI_LU_SUBSTR;
 	ctx->debug_level = 0;
 	ctx->debug_file = NULL;


decoders: set pkt timebase when needed (android)

--- decoders.c
+++ decoders.c
@@ -19,6 +19,7 @@
  */

 #include "decoders.h"
+#include "internal.h"
 #include "log.h"

 struct decoder_ctx *decoder_alloc(void)
@@ -58,6 +59,11 @@
     // context) can be destroyed any time after the decoder_init() returns
     avcodec_parameters_to_context(ctx->avctx, stream->codecpar);

+    // The MediaCodec decoder needs pkt_timebase in order to rescale the
+    // timestamps that will be forwarded to the output surface
+    if (HAVE_MEDIACODEC_HWACCEL && !strcmp(dec->name, "ffmpeg_hw"))
+        av_codec_set_pkt_timebase(ctx->avctx, stream->time_base);
+
     ret = dec->init(ctx, opts);
     if (ret < 0) {
         if (dec->uninit)


Revert "Auto commit from CI."

Revert "Auto commit from CI."

This reverts commit 84f7108678ba3e0576d781fe332d68394793c694.

--- aws-cpp-sdk-core/include/aws/core/VersionConfig.h
+++ aws-cpp-sdk-core/include/aws/core/VersionConfig.h
@@ -13,4 +13,4 @@
   * permissions and limitations under the License.
   */

-#define AWS_SDK_VERSION_STRING "0.10.8"
+#define AWS_SDK_VERSION_STRING "0.10.7"


Update DPI interface documentation

Update DPI interface documentation

--- hvl/aes_dpi.c
+++ hvl/aes_dpi.c
@@ -9,19 +9,22 @@
 #include "aes.h"

 void
-aes_encrypt_dpi(int Nk, svBitVecVal * bv_ct, svBitVecVal * bv_pt, svBitVecVal * bv_key)
+aes_encrypt_dpi(
+    int Nk, // {4, 6, 8}
+    svBitVecVal * bv_ct, // output bit [127:0] ct
+    svBitVecVal * bv_pt, // input  bit [127:0] pt
+    svBitVecVal * bv_key // input  bit [255:0] key
+    )
 {
     int i;

-    word_t key[8];
-    word_t rkey[60];
+    word_t key[8]; // Nk
+    word_t rkey[Nb*(8+6+1)]; // Nb*(Nk+6+1)
     byte_t pt[16], ct[16];

     byte_t * bp;
     word_t * wp;

-    // Number of 32-bit words comprising the Cipher Key.
-    // For this standard, Nk = 4, 6, or 8. (Sec 6.3)
     wp = (word_t *) bv_key;
     for (i = 0; i < Nk; i++) key[i] = *wp++;

@@ -36,19 +39,22 @@
 }

 void
-aes_decrypt_dpi(int Nk, svBitVecVal * bv_pt, svBitVecVal * bv_ct, svBitVecVal * bv_key)
+aes_decrypt_dpi(
+    int Nk, // {4, 6, 8}
+    svBitVecVal * bv_pt, // output bit [127:0] pt
+    svBitVecVal * bv_ct, // input  bit [127:0] ct
+    svBitVecVal * bv_key // input  bit [255:0] key
+    )
 {
     int i;

-    word_t key[8];
-    word_t rkey[60];
+    word_t key[8]; // Nk
+    word_t rkey[Nb*(8+6+1)]; // Nb*(Nk+6+1)
     byte_t pt[16], ct[16];

     byte_t * bp;
     word_t * wp;

-    // Number of 32-bit words comprising the Cipher Key.
-    // For this standard, Nk = 4, 6, or 8. (Sec 6.3)
     wp = (word_t *) bv_key;
     for (i = 0; i < Nk; i++) key[i] = *wp++;


net/ieee802154: Add support for hw driven CSMA

Using radio's get_capabilities, it is possible to know if the driver can
get CSMA work handed-over.

For now, up to device drivers to use
CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA_* parameters.

Let's see if it will be interesting at some point to enable runtime
modification of these parameters.

Signed-off-by: Tomasz Bursztyka <ba81a3a719836727e6857ae83462b9f52ec41006@linux.intel.com>

--- subsys/net/ip/l2/ieee802154/ieee802154_radio_utils.h
+++ subsys/net/ip/l2/ieee802154/ieee802154_radio_utils.h
@@ -59,12 +59,19 @@
 				      struct net_pkt *pkt,
 				      ieee802154_radio_tx_frag_t *tx_func)
 {
+	const struct ieee802154_radio_api *radio = iface->dev->driver_api;
 	int ret = 0;
 	struct net_buf *frag;

 	frag = pkt->frags;
 	while (frag) {
-		ret = tx_func(iface, pkt, frag);
+		if (IS_ENABLED(CONFIG_NET_L2_IEEE802154_RADIO_CSMA_CA) &&
+		    radio->get_capabilities(iface->dev) & IEEE802154_HW_CSMA) {
+			ret = radio->tx(iface->dev, pkt, frag);
+		} else {
+			ret = tx_func(iface, pkt, frag);
+		}
+
 		if (ret) {
 			break;
 		}


add clarification of what the user is looking at during read test.

--- hw/ide/test.c
+++ hw/ide/test.c
@@ -2290,6 +2290,9 @@

 			/* ---- draw contents on the screen ---- */
 			vga_write_color(0x0E); vga_clear();
+
+			vga_moveto(0,0);
+			vga_write("Contents of CD-ROM sector 16 (2048) bytes");

 			vga_moveto(0,2);
 			vga_write_color(0x08);


Fix compiler warning.

Fix compiler warning.

* subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
  (gnome_keyring_init): Pass a void argument in order to supress warning
   of 'old-style function definition'.

--- subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
+++ subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
@@ -203,7 +203,7 @@
 }

 static void
-gnome_keyring_init()
+gnome_keyring_init(void)
 {
   const char *application_name = NULL;
   application_name = g_get_application_name();


* LBSEmitStringCodeset output dummy charactor for invalid charactor(iconv EILSEQ)


test: properly modify interface pause settings.

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

--- dabbad/interface-pause.c
+++ dabbad/interface-pause.c
@@ -181,10 +181,10 @@
 		p.rx_pause = pause->rx_pause;

 	if (pause->has_tx_pause)
-		p.rx_pause = pause->tx_pause;
+		p.tx_pause = pause->tx_pause;

 	if (pause->has_autoneg)
-		p.rx_pause = pause->has_autoneg;
+		p.autoneg = pause->autoneg;

 	rc = dev_pause_set(pause->id->name, &p);


bugfix: properly range-check the multiple sector count

--- hw/ide/test.c
+++ hw/ide/test.c
@@ -177,7 +177,8 @@
 	if (nfo->read_sectors == 0) return;

 	if (nfo->mode == DRIVE_RW_MODE_CHSMULTIPLE || nfo->mode == DRIVE_RW_MODE_LBAMULTIPLE || nfo->mode == DRIVE_RW_MODE_LBA48_MULTIPLE) {
-		if (nfo->multiple_sectors > tsk->sector_count) return;
+		if (nfo->multiple_sectors > ((unsigned long)sizeof(cdrom_sector) / 512UL))
+			return;
 	}

 	idelib_controller_reset_irq_counter(ide); /* IRQ will fire after command completion */


Edited database.h via GitHub

Edited database.h via GitHub

--- database.h
+++ database.h
@@ -31,8 +31,8 @@
     bool collapsed;
     QList<SchemaLink *> edgeList;
     QPointF newPos;
-    QStringList history;
-    qint32 hit;
+    QStringList history;            // History
+    qint32 hit;                     // History iterator

 protected:
     QVariant itemChange(GraphicsItemChange change, const QVariant &value);
@@ -151,4 +151,4 @@
     void collapse(Database*);
 };

-#endif // DATABASE_H
+#endif // DATABASE_H


MFC r258902: The uaddr, ufunc, umod and usym functions all seem to work as expected on FreeBSD, so stop hiding them behind a "#if defined(sun)".

--- cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -501,22 +501,16 @@
 	DT_VERS_1_0, &dt_idops_func, "void(...)" },
 { "typeref", DT_IDENT_FUNC, 0, DIF_SUBR_TYPEREF, DT_ATTR_STABCMN, DT_VERS_1_1,
 	&dt_idops_func, "uintptr_t *(void *, size_t, string, size_t)" },
-#if defined(sun)
 { "uaddr", DT_IDENT_ACTFUNC, 0, DT_ACT_UADDR, DT_ATTR_STABCMN,
 	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
 { "ucaller", DT_IDENT_SCALAR, 0, DIF_VAR_UCALLER, DT_ATTR_STABCMN,
 	DT_VERS_1_2, &dt_idops_type, "uint64_t" },
-#if defined(sun)
 { "ufunc", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
 	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
 { "uid", DT_IDENT_SCALAR, 0, DIF_VAR_UID, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_type, "uid_t" },
-#if defined(sun)
 { "umod", DT_IDENT_ACTFUNC, 0, DT_ACT_UMOD, DT_ATTR_STABCMN,
 	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
 { "uregs", DT_IDENT_ARRAY, 0, DIF_VAR_UREGS, DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_regs, NULL },
 { "ustack", DT_IDENT_ACTFUNC, 0, DT_ACT_USTACK, DT_ATTR_STABCMN, DT_VERS_1_0,
@@ -524,10 +518,8 @@
 { "ustackdepth", DT_IDENT_SCALAR, 0, DIF_VAR_USTACKDEPTH,
 	DT_ATTR_STABCMN, DT_VERS_1_2,
 	&dt_idops_type, "uint32_t" },
-#if defined(sun)
 { "usym", DT_IDENT_ACTFUNC, 0, DT_ACT_USYM, DT_ATTR_STABCMN,
 	DT_VERS_1_2, &dt_idops_func, "_usymaddr(uintptr_t)" },
-#endif
 { "vtimestamp", DT_IDENT_SCALAR, 0, DIF_VAR_VTIMESTAMP,
 	DT_ATTR_STABCMN, DT_VERS_1_0,
 	&dt_idops_type, "uint64_t" },


Add a AArch64 triple to tiny codemodel test.

Most other targets do not support the tiny code model.

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

--- test/CodeGen/codemodels.c
+++ test/CodeGen/codemodels.c
@@ -1,5 +1,5 @@
 // RUN: %clang_cc1 -emit-llvm  %s -o - | FileCheck %s -check-prefix=CHECK-NOMODEL
-// RUN: %clang_cc1 -emit-llvm -mcode-model tiny %s -o - | FileCheck %s -check-prefix=CHECK-TINY
+// RUN: %clang_cc1 -triple aarch64-unknown-none-eabi -emit-llvm -mcode-model tiny %s -o - | FileCheck %s -check-prefix=CHECK-TINY
 // RUN: %clang_cc1 -emit-llvm -mcode-model small %s -o - | FileCheck %s -check-prefix=CHECK-SMALL
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcode-model kernel %s -o - | FileCheck %s -check-prefix=CHECK-KERNEL
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -mcode-model medium %s -o - | FileCheck %s -check-prefix=CHECK-MEDIUM