git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/trunk@5017 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- MagickCore/annotate.c
+++ MagickCore/annotate.c
@@ -566,7 +566,7 @@
   {
     if (IsUTFSpace(GetUTFCode(p)) != MagickFalse)
       s=p;
-    if (*p == '\n')
+    if (GetUTFCode(p) == '\n')
       q=draw_info->text;
     for (i=0; i < (ssize_t) GetUTFOctets(p); i++)
       *q++=(*(p+i));


--- MagickCore/annotate.c
+++ MagickCore/annotate.c
@@ -1728,6 +1728,7 @@
     }
   metrics->width-=metrics->bounds.x1/64.0;
   metrics->width+=annotate_info->stroke_width;
+  metrics->width+=metrics.max_advance/8;
   metrics->bounds.x1/=64.0;
   metrics->bounds.y1/=64.0;
   metrics->bounds.x2/=64.0;


Correct font max width

Correct font max width

--- MagickCore/annotate.c
+++ MagickCore/annotate.c
@@ -1726,9 +1726,7 @@
         }
       FT_Done_Glyph(glyph.image);
     }
-  metrics->width-=metrics->bounds.x1/64.0;
   metrics->width+=annotate_info->stroke_width;
-  metrics->width+=metrics.max_advance/8;
   metrics->bounds.x1/=64.0;
   metrics->bounds.y1/=64.0;
   metrics->bounds.x2/=64.0;


git-svn-id: https://www.imagemagick.org/subversion/ImageMagick/trunk@13727 aa41f4f7-0bf4-0310-aa73-e5a19afd5a74

--- MagickCore/property.c
+++ MagickCore/property.c
@@ -1939,7 +1939,7 @@
         }
         if( IfMagickFalse(in_subpath) )
           {
-            (void) FormatLocaleString(message,MaxTextExtent,"M %g,%g\n",
+            (void) FormatLocaleString(message,MaxTextExtent,"  %g,%g m\n",
               point[1].x,point[1].y);
             for (i=0; i < 3; i++)
             {


--- MagickCore/quantize.c
+++ MagickCore/quantize.c
@@ -175,6 +175,7 @@
   Include declarations.
 */
 #include "MagickCore/studio.h"
+#include "MagickCore/artifact.h"
 #include "MagickCore/attribute.h"
 #include "MagickCore/cache-view.h"
 #include "MagickCore/color.h"
@@ -201,6 +202,7 @@
 #include "MagickCore/quantum-private.h"
 #include "MagickCore/resource_.h"
 #include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
 #include "MagickCore/thread-private.h"

@@ -1504,6 +1506,12 @@
   CacheView
     *image_view;

+  const char
+    *artifact;
+
+  double
+    amount;
+
   DoublePixelPacket
     **pixels;

@@ -1520,6 +1528,10 @@
   if (pixels == (DoublePixelPacket **) NULL)
     return(MagickFalse);
   status=MagickTrue;
+  amount=1.0;
+  artifact=GetImageArtifact(image,"dither:diffusion-amount");
+  if (artifact != (const char *) NULL)
+    amount=StringToDoubleInterval(artifact,1.0);
   image_view=AcquireAuthenticCacheView(image,exception);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
@@ -1573,11 +1585,11 @@
       AssociateAlphaPixel(image,&cube,q+u*GetPixelChannels(image),&pixel);
       if (x > 0)
         {
-          pixel.red+=7*current[u-v].red/16;
-          pixel.green+=7*current[u-v].green/16;
-          pixel.blue+=7*current[u-v].blue/16;
+          pixel.red+=7.0*amount*current[u-v].red/16;
+          pixel.green+=7.0*amount*current[u-v].green/16;
+          pixel.blue+=7.0*amount*current[u-v].blue/16;
           if (cube.associate_alpha != MagickFalse)
-            pixel.alpha+=7*current[u-v].alpha/16;
+            pixel.alpha+=7.0*amount*current[u-v].alpha/16;
         }
       if (y > 0)
         {
@@ -1589,18 +1601,18 @@
               if (cube.associate_alpha != MagickFalse)
                 pixel.alpha+=previous[u+v].alpha/16;
             }
-          pixel.red+=5*previous[u].red/16;
-          pixel.green+=5*previous[u].green/16;
-          pixel.blue+=5*previous[u].blue/16;
+          pixel.red+=5.0*amount*previous[u].red/16;
+          pixel.green+=5.0*amount*previous[u].green/16;
+          pixel.blue+=5.0*amount*previous[u].blue/16;
           if (cube.associate_alpha != MagickFalse)
-            pixel.alpha+=5*previous[u].alpha/16;
+            pixel.alpha+=5.0*amount*previous[u].alpha/16;
           if (x > 0)
             {
-              pixel.red+=3*previous[u-v].red/16;
-              pixel.green+=3*previous[u-v].green/16;
-              pixel.blue+=3*previous[u-v].blue/16;
+              pixel.red+=3.0*amount*previous[u-v].red/16;
+              pixel.green+=3.0*amount*previous[u-v].green/16;
+              pixel.blue+=3.0*amount*previous[u-v].blue/16;
               if (cube.associate_alpha != MagickFalse)
-                pixel.alpha+=3*previous[u-v].alpha/16;
+                pixel.alpha+=3.0*amount*previous[u-v].alpha/16;
             }
         }
       pixel.red=(double) ClampPixel(pixel.red);


[Fix] reinterpret cast when creating memory view for MemoryView

--- experimental/ArrayView.h
+++ experimental/ArrayView.h
@@ -210,7 +210,7 @@
 			ArrayView<T>{ _data + offset, _size - offset};
 	}

-
+	bool isValid() { return _data != nullptr; }
 protected:
 	constexpr bool _throwIfOutOfRange(size_t idx) const { return idx < _size ? true : throw std::out_of_range("Tried to access " + std::to_string(idx) + "th element of an Array view of size" + std::to_string(_size)); }
 	constexpr bool _throwIfInvalidSubview(size_t offset, size_t count) const {
@@ -242,12 +242,12 @@

 template<class T>
 constexpr ConstMemoryView viewMemory(const T& e){
-	return ConstMemoryView(reinterpret_cast<ByteType*>(&e),sizeof(e));
+	return ConstMemoryView(reinterpret_cast<const ByteType*>(&e),sizeof(e));
 }

 template<class T>
 constexpr ConstMemoryView viewMemoryConst(const T& e){
-	return ConstMemoryView(reinterpret_cast<ByteType*>(&e),sizeof(e));
+	return ConstMemoryView(reinterpret_cast<const ByteType*>(&e),sizeof(e));
 }


set return value, fixes #22

set return value, fixes #22

--- port-mirroring.c
+++ port-mirroring.c
@@ -914,7 +914,7 @@
     if (handle == NULL)
     {
         writeLog(MYLOG_ERROR, "port-mirroring::start_mirroring, couldn't open device \"%s\": %s\n", (const char *)dev, errbuf);
-        return;
+        return NULL;
     }

     if (mirroring_filter[0] != '\0')
@@ -923,13 +923,13 @@
         {
             writeLog(MYLOG_ERROR, "port-mirroring::start_mirroring, couldn't parse filter \"%s\": %s\n", mirroring_filter, pcap_geterr(handle));
             pcap_close(handle);
-            return;
+            return NULL;
         }
         if (pcap_setfilter(handle, &fp) == -1)
         {
             writeLog(MYLOG_ERROR, "port-mirroring::start_mirroring, couldn't install filter \"%s\": %s\n", mirroring_filter, pcap_geterr(handle));
             pcap_close(handle);
-            return;
+            return NULL;
         }
     }
     //start the capture
@@ -956,7 +956,7 @@
         writeLog(MYLOG_ERROR, "port-mirroring::start_mirroring, reopen device \"%s\".\n", (const char *)dev);
         goto start_handle;
     }
-    return;
+    return NULL;
 }

 void write_pid()


fixed dumb buffer extension bug

fixed dumb buffer extension bug

--- lib/stringbuf.c
+++ lib/stringbuf.c
@@ -47,7 +47,7 @@

     l = strlen(s);
     /* If free == l there is no room for NULL terminator! */
-    if ((l + nl) > sb->free) {
+    while ((l + nl) > sb->free) {
         sb->allocated += BUF_CHUNK;
 	sb->free += BUF_CHUNK;
         sb->buf = realloc(sb->buf, sb->allocated);


Add comment noting that hashm_procid in a hash index's metapage isn't actually used for anything.

--- src/backend/access/hash/hashpage.c
+++ src/backend/access/hash/hashpage.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.63 2007/01/05 22:19:22 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.64 2007/01/29 23:22:59 tgl Exp $
  *
  * NOTES
  *	  Postgres hash pages look like ordinary relation pages.  The opaque
@@ -275,6 +275,11 @@
 	metap->hashm_bmshift = i + BYTE_TO_BIT;
 	Assert((1 << BMPG_SHIFT(metap)) == (BMPG_MASK(metap) + 1));

+	/*
+	 * Label the index with its primary hash support function's OID.  This is
+	 * pretty useless for normal operation (in fact, hashm_procid is not used
+	 * anywhere), but it might be handy for forensic purposes so we keep it.
+	 */
 	metap->hashm_procid = index_getprocid(rel, 1, HASHPROC);

 	/*


Fix bogus concurrent use of _hash_getnewbuf() in bucket split code.

_hash_splitbucket() obtained the base page of the new bucket by calling
_hash_getnewbuf(), but it held no exclusive lock that would prevent some
other process from calling _hash_getnewbuf() at the same time.  This is
contrary to _hash_getnewbuf()'s API spec and could in fact cause failures.
In practice, we must only call that function while holding write lock on
the hash index's metapage.

An additional problem was that we'd already modified the metapage's bucket
mapping data, meaning that failure to extend the index would leave us with
a corrupt index.

Fix both issues by moving the _hash_getnewbuf() call to just before we
modify the metapage in _hash_expandtable().

Unfortunately there's still a large problem here, which is that we could
also incur ENOSPC while trying to get an overflow page for the new bucket.
That would leave the index corrupt in a more subtle way, namely that some
index tuples that should be in the new bucket might still be in the old
one.  Fixing that seems substantially more difficult; even preallocating as
many pages as we could possibly need wouldn't entirely guarantee that the
bucket split would complete successfully.  So for today let's just deal
with the base case.

Per report from Antonin Houska.  Back-patch to all active branches.

--- src/backend/access/hash/hashpage.c
+++ src/backend/access/hash/hashpage.c
@@ -37,6 +37,7 @@
 static bool _hash_alloc_buckets(Relation rel, BlockNumber firstblock,
 					uint32 nblocks);
 static void _hash_splitbucket(Relation rel, Buffer metabuf,
+				  Buffer nbuf,
 				  Bucket obucket, Bucket nbucket,
 				  BlockNumber start_oblkno,
 				  BlockNumber start_nblkno,
@@ -176,7 +177,9 @@
  *		EOF but before updating the metapage to reflect the added page.)
  *
  *		It is caller's responsibility to ensure that only one process can
- *		extend the index at a time.
+ *		extend the index at a time.  In practice, this function is called
+ *		only while holding write lock on the metapage, because adding a page
+ *		is always associated with an update of metapage data.
  */
 Buffer
 _hash_getnewbuf(Relation rel, BlockNumber blkno, ForkNumber forkNum)
@@ -503,6 +506,7 @@
 	uint32		spare_ndx;
 	BlockNumber start_oblkno;
 	BlockNumber start_nblkno;
+	Buffer		buf_nblkno;
 	uint32		maxbucket;
 	uint32		highmask;
 	uint32		lowmask;
@@ -604,6 +608,13 @@
 	}

 	/*
+	 * Physically allocate the new bucket's primary page.  We want to do this
+	 * before changing the metapage's mapping info, in case we can't get the
+	 * disk space.
+	 */
+	buf_nblkno = _hash_getnewbuf(rel, start_nblkno, MAIN_FORKNUM);
+
+	/*
 	 * Okay to proceed with split.  Update the metapage bucket mapping info.
 	 *
 	 * Since we are scribbling on the metapage data right in the shared
@@ -653,7 +664,8 @@
 	_hash_chgbufaccess(rel, metabuf, HASH_WRITE, HASH_NOLOCK);

 	/* Relocate records to the new bucket */
-	_hash_splitbucket(rel, metabuf, old_bucket, new_bucket,
+	_hash_splitbucket(rel, metabuf, buf_nblkno,
+					  old_bucket, new_bucket,
 					  start_oblkno, start_nblkno,
 					  maxbucket, highmask, lowmask);

@@ -733,10 +745,16 @@
  * The caller must hold a pin, but no lock, on the metapage buffer.
  * The buffer is returned in the same state.  (The metapage is only
  * touched if it becomes necessary to add or remove overflow pages.)
+ *
+ * In addition, the caller must have created the new bucket's base page,
+ * which is passed in buffer nbuf, pinned and write-locked.  The lock
+ * and pin are released here.  (The API is set up this way because we must
+ * do _hash_getnewbuf() before releasing the metapage write lock.)
  */
 static void
 _hash_splitbucket(Relation rel,
 				  Buffer metabuf,
+				  Buffer nbuf,
 				  Bucket obucket,
 				  Bucket nbucket,
 				  BlockNumber start_oblkno,
@@ -748,7 +766,6 @@
 	BlockNumber oblkno;
 	BlockNumber nblkno;
 	Buffer		obuf;
-	Buffer		nbuf;
 	Page		opage;
 	Page		npage;
 	HashPageOpaque oopaque;
@@ -765,7 +782,7 @@
 	oopaque = (HashPageOpaque) PageGetSpecialPointer(opage);

 	nblkno = start_nblkno;
-	nbuf = _hash_getnewbuf(rel, nblkno, MAIN_FORKNUM);
+	Assert(nblkno == BufferGetBlockNumber(nbuf));
 	npage = BufferGetPage(nbuf);

 	/* initialize the new bucket's primary page */
@@ -814,6 +831,11 @@
 				 * insert the tuple into the new bucket.  if it doesn't fit on
 				 * the current page in the new bucket, we must allocate a new
 				 * overflow page and place the tuple on that page instead.
+				 *
+				 * XXX we have a problem here if we fail to get space for a
+				 * new overflow page: we'll error out leaving the bucket split
+				 * only partially complete, meaning the index is corrupt,
+				 * since searches may fail to find entries they should find.
 				 */
 				itemsz = IndexTupleDSize(*itup);
 				itemsz = MAXALIGN(itemsz);


Internal change

Internal change

PiperOrigin-RevId: 446723346

--- quiche/quic/core/quic_flags_list.h
+++ quiche/quic/core/quic_flags_list.h
@@ -76,7 +76,7 @@
 // If true, server proactively retires client issued connection ID on reverse path validation failure.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_retire_cid_on_reverse_path_validation_failure, true)
 // If true, server sends bandwidth eastimate when network is idle for a while.
-QUIC_FLAG(FLAGS_quic_restart_flag_quic_enable_sending_bandwidth_estimate_when_network_idle, false)
+QUIC_FLAG(FLAGS_quic_restart_flag_quic_enable_sending_bandwidth_estimate_when_network_idle, true)
 // If true, servers drop received packets with changed server address.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_drop_packets_with_changed_server_address, true)
 // If true, set burst token to 2 in cwnd bootstrapping experiment.


Tolerate EPERM return from sendto().

Tolerate EPERM return from sendto().

If Linux iptables drops an outgoing packet, e.g. under heavy congestion,
it may return an EPERM to the application. That is not a fatal error,
and will most likely succeed if retried, so log and ignore it.

--- src/backend/cdb/motion/ic_udpifc.c
+++ src/backend/cdb/motion/ic_udpifc.c
@@ -4435,6 +4435,21 @@

 		if (errno == EAGAIN) /* no space ? not an error. */
 			return;
+
+		/*
+		 * If Linux iptables (nf_conntrack?) drops an outgoing packet, it may
+		 * return an EPERM to the application. This might be simply because
+		 * of traffic shaping or congestion, so ignore it.
+		 */
+		if (errno == EPERM)
+		{
+			ereport(LOG,
+					(errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
+					 errmsg("Interconnect error writing an outgoing packet: %m"),
+					 errdetail("error during sendto() for Remote Connection: contentId=%d at %s",
+							   conn->remoteContentId, conn->remoteHostAndPort)));
+			return;
+		}

 		ereport(ERROR, (errcode(ERRCODE_GP_INTERCONNECTION_ERROR),
 						errmsg("Interconnect error writing an outgoing packet: %m"),


added some template/tuple utilities

added some template/tuple utilities

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

--- native/utility.h
+++ native/utility.h
@@ -0,0 +1,66 @@
+#ifndef __UTILITY_H__
+#define __UTILITY_H__
+
+#include "base.h"
+#include <tuple>
+
+namespace dev
+{
+    namespace utility
+    {
+        // append to tuple
+        template<typename, typename >
+        struct tuple_append;
+
+        template<typename H, typename ...T>
+        struct tuple_append<H, std::tuple<T...> >
+        { typedef std::tuple<H, T...> type; };
+
+        // make a new tuple from elements at even index
+        template<typename ...>
+        struct tuple_even_elements;
+
+        template<typename A, typename B>
+        struct tuple_even_elements<A, B>
+        { typedef std::tuple<A> type; };
+
+        template<typename A, typename B, typename ...T>
+        struct tuple_even_elements<A, B, T...>
+        { typedef typename tuple_append<A, typename tuple_even_elements<T...>::type>::type type; };
+
+        // make a new tuple from elements at odd index
+        template<typename ...>
+        struct tuple_odd_elements;
+
+        template<typename A, typename B>
+        struct tuple_odd_elements<A, B>
+        { typedef std::tuple<B> type; };
+
+        template<typename A, typename B, typename ...T>
+        struct tuple_odd_elements<A, B, T...>
+        { typedef typename tuple_append<B, typename tuple_odd_elements<T...>::type>::type type; };
+
+
+
+        // get the first index of a type in the tuple
+        template<typename T, typename C, std::size_t I>
+        struct tuple_index_r;
+
+        template<typename H, typename ...R, typename C, std::size_t I>
+        struct tuple_index_r<std::tuple<H, R...>, C, I>
+            : public std::conditional<std::is_same<C, H>::value,
+                  std::integral_constant<std::size_t, I>,
+                  tuple_index_r<std::tuple<R...>, C, I+1>>::type
+        {};
+
+        template<typename C, std::size_t I>
+        struct tuple_index_r<std::tuple<>, C, I>
+        {};
+
+        template<typename T, typename C>
+        struct tuple_index_of
+            : public std::integral_constant<std::size_t, tuple_index_r<T, C, 0>::value> {};
+    }
+}
+
+#endif


Keytool: enhance functionality

Keytool: enhance functionality

Now works on volumes, so saving and loading can be done from an external USB
key.

PK can now be deleted in user mode with a signed .auth file

All variables can now be saved as .esl files

Supports rebooting to firmware menu (assuming platform has the feature, it is
defined in UEFI 2.3.1 Errata C)

Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>

--- KeyTool.c
+++ KeyTool.c
@@ -15,6 +15,7 @@
 #include "efiauthenticated.h"

 static EFI_HANDLE im;
+static UINT8 SetupMode, SecureBoot;

 #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))

@@ -69,12 +70,58 @@
 static const int signatures_size = ARRAY_SIZE(signatures);

 static void
+select_and_apply(CHAR16 **title, CHAR16 *ext, int key, UINTN options)
+{
+	CHAR16 *file_name;
+	EFI_STATUS status;
+	EFI_FILE *file;
+	EFI_HANDLE h = NULL;
+
+	simple_file_selector(&h, title, NULL, ext, &file_name);
+	if (file_name == NULL)
+		return;
+
+	status = simple_file_open(h, file_name, &file, EFI_FILE_MODE_READ);
+	if (status != EFI_SUCCESS)
+		return;
+
+	UINTN size;
+	void *esl;
+	simple_file_read_all(file, &size, &esl);
+	simple_file_close(file);
+
+	/* PK is different: need to update with an authenticated bundle
+	 * including a signature with the new PK */
+	if (StrCmp(&file_name[StrLen(file_name) - 4], L".esl") == 0) {
+		status = SetSecureVariable(keyinfo[key].name, esl, size,
+				*keyinfo[key].guid, options, 0);
+	} else if (StrCmp(&file_name[StrLen(file_name) - 5], L".auth") == 0) {
+		status = uefi_call_wrapper(RT->SetVariable, 5,
+					   keyinfo[key].name, keyinfo[key].guid,
+					   EFI_VARIABLE_NON_VOLATILE
+					   | EFI_VARIABLE_RUNTIME_ACCESS
+					   | EFI_VARIABLE_BOOTSERVICE_ACCESS
+					   | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS
+					   | options,
+				   size, esl);
+	} else {
+		/* do something about .cer case */
+		console_errorbox(L"Handling .cer files is unimplemented");
+		return;
+	}
+	if (status != EFI_SUCCESS) {
+		console_error(L"Failed to update variable", status);
+		return;
+	}
+}
+
+static void
 show_key(int key, int offset, void *Data, int DataSize)
 {
 	EFI_SIGNATURE_LIST *CertList;
 	EFI_SIGNATURE_DATA *Cert = NULL;
 	int cert_count = 0, i, Size, option, offs = 0;
-	CHAR16 *title[6];
+	CHAR16 *title[6], *options[4];
 	CHAR16 str[256], str1[256];

 	title[0] = keyinfo[key].text;
@@ -96,7 +143,7 @@
 	}

 	SPrint(str, sizeof(str), L"Sig[%d] - owner: %g", offset, &Cert->SignatureOwner);
-	Print(L"Got option%s\n\n", str);
+
 	title[1] = str;
 	title[2] = L"Unknown";

@@ -108,11 +155,20 @@
 		}
 	}
 	title[3] = NULL;
-	option = console_select(title, (CHAR16 *[]){ L"Back", L"Delete", L"Save to File", NULL }, 0);
-	if (option == -1 || option == 0)
-		return;
-	if (option == 1) {
-		Print(L"Old Size %d\n", DataSize);
+	options[0] = L"Delete";
+	options[1] = L"Save to File";
+	if (key == 0) {
+		options[2] = L"Delete with .auth File";
+		options[3] = NULL;
+	} else {
+		options[2] = NULL;
+	}
+	option = console_select(title, options, 0);
+	if (option == -1)
+		return;
+	if (option == 0) {
+		EFI_STATUS status;
+
 		if (offs == 0) {
 			/* delete entire sig list + data */
 			DataSize -= CertList->SignatureListSize;
@@ -124,11 +180,13 @@
 			if (DataSize > 0)
 				CopyMem(Cert, (void *)Cert + CertList->SignatureSize, DataSize - (Data - (void *)Cert));
 		}
-		Print(L"New Size %d\n", DataSize);
-
-		SetSecureVariable(keyinfo[key].name, Data, DataSize,
-				  *keyinfo[key].guid, 0, 0);
-	} else if (option == 2) {
+
+		status = SetSecureVariable(keyinfo[key].name, Data, DataSize,
+					   *keyinfo[key].guid, 0, 0);
+		if (status != EFI_SUCCESS)
+			console_error(L"Failed to delete key", status);
+
+	} else if (option == 1) {
 		CHAR16 *filename;
 		EFI_FILE *file;
 		EFI_STATUS status;
@@ -143,52 +201,30 @@
 		}

 		if (status != EFI_SUCCESS) {
-			Print(L"Failed to write %s: %d\n", filename, status);
-			console_get_keystroke();
-		}
+			CHAR16 str[80];
+
+			SPrint(str, sizeof(str), L"Failed to write %s", filename);
+			console_error(str, status);
+		}
+	} else if (option == 2) {
+		title[0] = L"Select authority bundle to remove PK";
+		title[1] = NULL;
+		select_and_apply(title, L".auth", key, 0);
 	}
 }

 static void
-add_new_key(key)
-{
-	CHAR16 *title[3], *file_name;
-	EFI_STATUS status;
-	EFI_FILE *file;
+add_new_key(int key, UINTN options)
+{
+	CHAR16 *title[3];
 	/* PK update must be signed: so require .auth file */
-	CHAR16 *ext = key ? L".esl" : L".auth";
-
-	title[0] = L"Select file to add to";
+	CHAR16 *ext = key ? L".esl|.auth|.cer" : L".auth";
+
+	title[0] = L"Select File containing additional key for";
 	title[1] = keyinfo[key].text;
 	title[2] = NULL;
-	simple_file_selector(im, title, L".", ext, &file_name);
-	if (file_name == NULL)
-		return;
-
-	status = simple_file_open(im, file_name, &file, EFI_FILE_MODE_READ);
-	if (status != EFI_SUCCESS)
-		return;
-
-	UINTN size;
-	void *esl;
-	simple_file_read_all(file, &size, &esl);
-	simple_file_close(file);
-
-	/* PK is different: need to update with an authenticated bundle
-	 * including a signature with the new PK */
-	if (key)
-		status = SetSecureVariable(keyinfo[key].name, esl, size,
-				*keyinfo[key].guid, EFI_VARIABLE_APPEND_WRITE, 0);
-	else
-		status = uefi_call_wrapper(RT->SetVariable, 5, keyinfo[key].name, keyinfo[key].guid,
-				   EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS
-				   | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
-				   size, esl);
-	if (status != EFI_SUCCESS) {
-		Print(L"Failed to update variable: %d\n", status);
-		console_get_keystroke();
-		return;
-	}
+
+	select_and_apply(title, ext, key, options);
 }

 static void
@@ -205,27 +241,27 @@
 	UINTN DataSize = 0, Size;
 	efi_status = uefi_call_wrapper(RT->GetVariable, 5, keyinfo[key].name, keyinfo[key].guid, NULL, &DataSize, NULL);
 	if (efi_status != EFI_BUFFER_TOO_SMALL && efi_status != EFI_NOT_FOUND) {
-		Print(L"Failed to get DataSize\n");
+		console_error(L"Failed to get DataSize", efi_status);
 		return;
 	}

 	Data = AllocatePool(DataSize);
 	if (!Data) {
-		Print(L"Failed to allocate %d\n", DataSize);
-		console_get_keystroke();
+		CHAR16 str[80];
+		SPrint(str, sizeof(str), L"Failed to allocate %d", DataSize);
+		console_errorbox(str);
 		return;
 	}

 	efi_status = uefi_call_wrapper(RT->GetVariable, 5, keyinfo[key].name, keyinfo[key].guid, NULL, &DataSize, Data);
 	if (efi_status == EFI_NOT_FOUND) {
 		int t = 2;
-		title[t++] = L"Variable is Empty\n";
+		title[t++] = L"Variable is Empty";
 		if (key == 0)
 			title[t++] = L"WARNING: Setting PK will take the platform out of Setup Mode";
 		title[t++] = NULL;
 	} else if (efi_status != EFI_SUCCESS) {
-		Print(L"Failed to get variable %d\n", efi_status);
-		console_get_keystroke();
+		console_error(L"Failed to get variable", efi_status);
 		return;
 	}

@@ -238,7 +274,7 @@
 		cert_count += (CertList->SignatureListSize - sizeof(EFI_SIGNATURE_LIST)) / CertList->SignatureSize;
 	}

-	CHAR16 **guids = (CHAR16 **)AllocatePool((cert_count + 2)*sizeof(void *));
+	CHAR16 **guids = (CHAR16 **)AllocatePool((cert_count + 3)*sizeof(void *));
 	cert_count = 0;
 	for (CertList = (EFI_SIGNATURE_LIST *) Data, Size = DataSize;
 	     Size > 0
@@ -253,12 +289,17 @@
 			SPrint(guids[cert_count++], 64*sizeof(CHAR16), L"%g", &Cert[j].SignatureOwner);
 		}
 	}
-	guids[cert_count] = L"Add New Key";
-	guids[cert_count + 1] = NULL;
+	int add = cert_count, replace = cert_count;
+	if (key != 0)
+		guids[replace++] = L"Add New Key";
+	guids[replace] = L"Replace Key(s)";
+	guids[replace + 1] = NULL;
 	int select = console_select(title, guids, 0);
-
-	if (select == cert_count)
-		add_new_key(key);
+	FreePool(guids);
+	if (select == replace)
+		add_new_key(key, 0);
+	else if (select == add)
+		add_new_key(key, EFI_VARIABLE_APPEND_WRITE);
 	else if (select >= 0)
 		show_key(key, select, Data, DataSize);
 	FreePool(Data);
@@ -282,12 +323,114 @@
 	}
 }

+void
+transition_to_uefi_menu(void)
+{
+	int option;
+	UINT64 indications = GetOSIndications();
+
+	if ((indications & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) == 0) {
+		console_errorbox(L"Platform Does not Support rebooting to firmware menu");
+		return;
+	}
+
+	option = console_yes_no( (CHAR16 *[]){
+			L"About to reboot to UEFI Setup Menu",
+			L"",
+			L"For more details about your system's setup menu",
+			L"Including how to reset the system to setup mode, see",
+			L"",
+			L"http://www.linuxfoundation.org/uefi",
+			L"",
+			L"Note: This option only works on machines supporting",
+			L"UEFI 2.3.1 Errata C and later",
+			NULL
+		});
+	/* user said no */
+	if (option == 0)
+		return;
+
+	SETOSIndicationsAndReboot(EFI_OS_INDICATIONS_BOOT_TO_FW_UI);
+
+	return;
+}
+
+void
+save_keys(void)
+{
+	EFI_HANDLE vol;
+	CHAR16 *volname;
+
+	simple_volume_selector((CHAR16 *[]) {
+			L"Save Keys",
+			L"",
+			L"Select a disk Volume to save all the key files to",
+			L"Key files will be saved in the top level directory",
+			L"",
+			L"Note: For USB volumes, some UEFI implementations aren't",
+			L"very good at hotplug, so you may have to boot with the USB",
+			L"Key already plugged in to see the volume",
+			NULL
+		}, &volname, &vol);
+	/* no selection or ESC pressed */
+	if (!volname)
+		return;
+	FreePool(volname);
+
+	CHAR16 *title[10], buf[4096], file_name[512];
+	CHAR16 *variables[] = { L"PK", L"KEK", L"db", L"dbx" };
+	EFI_GUID owners[] = { GV_GUID, GV_GUID, SIG_DB, SIG_DB };
+	int i, t_c = 0, b_c = 0;
+	UINT8 *data;
+	UINTN len;
+	EFI_STATUS status;
+	EFI_FILE *file;
+
+	title[t_c++] = L"Results of Saving Keys";
+	title[t_c++] = L"";
+
+	for (i = 0; i < ARRAY_SIZE(owners); i++) {
+		StrCpy(&buf[b_c], variables[i]);
+
+		status = get_variable(variables[i], &data, &len, owners[i]);
+		if (status != EFI_SUCCESS) {
+			if (status == EFI_NOT_FOUND)
+				StrCat(&buf[b_c], L": Variable has no entries");
+			else
+				StrCat(&buf[b_c], L": Failed to get variable");
+			goto cont;
+		}
+		StrCpy(file_name, L"\\");
+		StrCat(file_name, variables[i]);
+		StrCat(file_name, L".esl");
+		status = simple_file_open(vol, file_name, &file,
+					  EFI_FILE_MODE_READ
+					  | EFI_FILE_MODE_WRITE
+					  | EFI_FILE_MODE_CREATE);
+		if (status != EFI_SUCCESS) {
+			StrCat(&buf[b_c], L": Failed to open file for writing: ");
+			StrCat(&buf[b_c], file_name);
+			goto cont;
+		}
+		status = simple_file_write_all(file, len, data);
+		if (status != EFI_SUCCESS) {
+			StrCat(&buf[b_c], L": Failed to write to ");
+			StrCat(&buf[b_c], file_name);
+			goto cont;
+		}
+		StrCat(&buf[b_c], L": Successfully written to ");
+		StrCat(&buf[b_c], file_name);
+	cont:
+		title[t_c++] = &buf[b_c];
+		b_c += StrLen(&buf[b_c]) + 1;
+	}
+	console_alertbox(title);
+}

 EFI_STATUS
 efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
 {
 	EFI_STATUS efi_status;
-	UINT8 SetupMode;
 	UINTN DataSize = sizeof(SetupMode);

 	im = image;
@@ -300,16 +443,45 @@
 		Print(L"No SetupMode variable ... is platform secure boot enabled?\n");		return EFI_SUCCESS;
 	}

-	if (!SetupMode) {
-		Print(L"Platform is not in Setup Mode, cannot manipulate Keys\n"
-		      L"To put your platform into setup mode, see\n"
-		      L"http://www.linux-foundation.org/uefi-setup-mode.html\n");
-		return EFI_SUCCESS;
-	}
-
-	Print(L"Platform is in Setup Mode\n");
-
-	select_key();
+	for (;;) {
+
+		CHAR16 line2[80], line3[80], **title;
+		int option;
+
+		DataSize = sizeof(SetupMode);
+		uefi_call_wrapper(RT->GetVariable, 5, L"SetupMode", &GV_GUID, NULL, &DataSize, &SetupMode);
+
+		DataSize = sizeof(SecureBoot);
+		uefi_call_wrapper(RT->GetVariable, 5, L"SecureBoot", &GV_GUID, NULL, &DataSize, &SecureBoot);
+
+		line2[0] = line3[0] = L'\0';
+
+		StrCat(line2, L"Platform is in ");
+		StrCat(line2, SetupMode ? L"Setup Mode" : L"User Mode");
+		StrCat(line3, L"Secure Boot is ");
+		StrCat(line3, SecureBoot ? L"on" : L"off");
+		title =  (CHAR16 *[]){L"KeyTool main menu", L"", line2, line3, NULL };
+
+		option = console_select(title, (CHAR16 *[]){ L"Save Keys", L"Edit Keys", L"UEFI Setup Menu", L"Exit", NULL }, 0);
+
+		switch (option) {
+		case 0:
+			save_keys();
+			break;
+		case 1:
+			select_key();
+			break;
+		case 2:
+			/* use OS options to return to UEFI menu */
+			transition_to_uefi_menu();
+			break;
+		case 3:
+			/* exit from programme */
+			return EFI_SUCCESS;
+		default:
+			break;
+		}
+	}

 	return EFI_SUCCESS;
 }


Don't collect execution stats if the query failed

Currently, if one segment (like seg1) panics due to some reason, other
segments (like seg0) will report "InstrEndLoop called on running node".

This is because QE on seg1 reports ERROR to QD when execution fails,
and the QD dispatches cancel command to all the QEs, but another QE on
seg0 is not finished yet, its `instr` structure is not cleaned up.

This commit is to remove the logic of sending stats when execution
failed, which is not needed.

Fixes https://github.com/greenplum-db/gpdb/issues/9904

Signed-off-by: Adam Lee <05880280e88848115cdb7191f7cbb09adb1d195b@vmware.com>

--- src/backend/executor/nodeSubplan.c
+++ src/backend/executor/nodeSubplan.c
@@ -1412,25 +1412,6 @@
 }
 PG_CATCH();
 {
-	/* If EXPLAIN ANALYZE, collect local and distributed execution stats. */
-	if (planstate->instrument && planstate->instrument->need_cdb)
-	{
-		if(Gp_role == GP_ROLE_DISPATCH)
-			cdbexplain_localExecStats(planstate, econtext->ecxt_estate->showstatctx);
-		if (!explainRecvStats &&
-			shouldDispatch &&
-			queryDesc->estate->dispatcherState)
-		{
-			/* Wait for all gangs to finish.  Cancel slowpokes. */
-			cdbdisp_cancelDispatch(queryDesc->estate->dispatcherState);
-
-			cdbexplain_recvExecStats(planstate,
-									 queryDesc->estate->dispatcherState->primaryResults,
-									 LocallyExecutingSliceIndex(queryDesc->estate),
-									 econtext->ecxt_estate->showstatctx);
-		}
-	}
-
 	/* Restore memory high-water mark for root slice of main query. */
 	MemoryContextSetPeakSpace(planstate->state->es_query_cxt, savepeakspace);


<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">      <title>403 - Forbidden</title>
403 - Forbidden


Serbdom

Serbdom


Fix weird indentation of function return type.

--- src/backend/utils/misc/ps_status.c
+++ src/backend/utils/misc/ps_status.c
@@ -5,7 +5,7 @@
  * to contain some useful information. Mechanism differs wildly across
  * platforms.
  *
- * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.23 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.24 2005/05/24 07:16:27 neilc Exp $
  *
  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
  * various details abducted from various places
@@ -130,7 +130,7 @@
  * environment strings may be moved, so this should be called before any code
  * that might try to hang onto a getenv() result.)
  */
-char	  **
+char **
 save_ps_display_args(int argc, char **argv)
 {
 	save_argc = argc;


minorship

minorship


incarnational

incarnational


unbenight

unbenight


poppyfish

poppyfish


dothienenteritis

dothienenteritis


bakeshop

bakeshop


"unarbitrary"

"unarbitrary"


"semiconvergence"

"semiconvergence"


pruinose

pruinose


paludicolous

paludicolous


Reintroduce the -1, -f and -p options to varnishtop

--- bin/varnishtop/varnishtop_options.h
+++ bin/varnishtop/varnishtop_options.h
@@ -31,17 +31,41 @@
 #include "vapi/vapi_options.h"
 #include "vut_options.h"

+#define TOP_OPT_1							\
+	VOPT("1", "[-1]", "Run once",					\
+	    "Instead of a continously updated display, print the"	\
+	    " statistics once and exit. Implies ``-d``."		\
+	)
+
+#define TOP_OPT_f							\
+	VOPT("f", "[-f]", "First field only",				\
+	    "Sort and group only on the first field of each log entry."	\
+	    " This is useful when displaying e.g. stataddr entries,"	\
+	    " where the first field is the client IP address."		\
+	)
+
+#define TOP_OPT_p							\
+	VOPT("p:", "-p period", "Sampling period",			\
+	    "Specified the number of seconds to measure over, the"	\
+	    " default is 60 seconds. The first number in the list is"	\
+	    " the average number of requests seen over this time"	\
+	    " period."							\
+	)
+
+TOP_OPT_1
 VSL_OPT_b
 VSL_OPT_c
 VSL_OPT_C
 VUT_OPT_d
 VUT_OPT_D
+TOP_OPT_f
 VUT_OPT_h
 VSL_OPT_i
 VSL_OPT_I
 VSL_OPT_L
 VUT_OPT_n
 VUT_OPT_N
+TOP_OPT_p
 VUT_OPT_q
 VUT_OPT_r
 VSL_OPT_T


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52308 954022d7-b5bf-4e40-9824-e11837661b57

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

--- Common/Structures.h
+++ Common/Structures.h
@@ -0,0 +1,687 @@
+#ifndef STRUCTURES
+#define STRUCTURES
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+#ifndef max
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef min
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+namespace Structures
+{
+	struct POINTI
+	{
+		int x;
+		int y;
+
+		POINTI()
+		{
+			x = y = 0;
+		}
+		POINTI(int _x, int _y)
+		{
+			x = _x;
+			y = _y;
+		}
+		POINTI(const POINTI& point)
+		{
+			operator= (point);
+		}
+		POINTI(const POINT& point)
+		{
+			operator= (point);
+		}
+
+		POINTI& operator= (const POINTI& point)
+		{
+			x = point.x;
+			y = point.y;
+
+			return *this;
+		}
+		POINTI& operator= (const POINT& point)
+		{
+			x = point.x;
+			y = point.y;
+
+			return *this;
+		}
+		operator POINT() const
+		{
+			POINT point;
+
+			point.x = x;
+			point.y = y;
+
+			return point;
+		}
+
+		friend BOOL operator== (const POINTI& point1, const POINTI& point2)
+		{
+			return (point1.x == point2.x && point1.y == point2.y);
+		}
+		friend BOOL operator!= (const POINTI& point1, const POINTI& point2)
+		{
+			return (point1.x != point2.x || point1.y != point2.y);
+		}
+
+		void Create(int _x, int _y)
+		{
+			x = _x;
+			y = _y;
+		}
+	};
+	struct POINTD
+	{
+		double x;
+		double y;
+
+		POINTD()
+		{
+			x = y = 0.0;
+		}
+		POINTD(double _x, double _y)
+		{
+			x = _x;
+			y = _y;
+		}
+		POINTD(const POINTD& point)
+		{
+			operator= (point);
+		}
+
+		POINTD& operator= (const POINTD& point)
+		{
+			x = point.x;
+			y = point.y;
+
+			return *this;
+		}
+
+		void Create(double _x, double _y)
+		{
+			x = _x;
+			y = _y;
+		}
+	};
+	struct RECTI
+	{
+		int left;
+		int top;
+		int right;
+		int bottom;
+
+		RECTI()
+		{
+			left = top = right = bottom = 0;
+		}
+		RECTI(int x, int y)
+		{
+			left = right = x;
+			top = bottom = y;
+		}
+		RECTI(int _left, int _top, int _right, int _bottom)
+		{
+			left = _left;
+			top = _top;
+			right = _right;
+			bottom = _bottom;
+		}
+		RECTI(const RECTI& rect)
+		{
+			operator= (rect);
+		}
+		RECTI(const RECT& rect)
+		{
+			operator= (rect);
+		}
+
+		RECTI& operator= (const RECT& rect)
+		{
+			left = rect.left;
+			top = rect.top;
+			right = rect.right;
+			bottom = rect.bottom;
+
+			return *this;
+		}
+		RECTI& operator= (const RECTI& rect)
+		{
+			left = rect.left;
+			top = rect.top;
+			right = rect.right;
+			bottom = rect.bottom;
+
+			return *this;
+		}
+
+		friend BOOL operator== (const RECTI& rect1, const RECTI& rect2)
+		{
+			return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
+		}
+		friend BOOL operator!= (const RECTI& rect1, const RECTI& rect2)
+		{
+			return (rect1.left != rect2.left || rect1.top != rect2.top || rect1.right != rect2.right || rect1.bottom != rect2.bottom);
+		}
+
+		void Normalize()
+		{
+			RECTI rect = *this;
+
+			if (left > right)
+			{
+				right = rect.left;
+				left = rect.right;
+			}
+
+			if (top > bottom)
+			{
+				bottom = rect.top;
+				top = rect.bottom;
+			}
+		}
+		int GetWidth()
+		{
+			return right - left;
+		}
+		int GetHeight()
+		{
+			return bottom - top;
+		}
+
+		BOOL IsPointInside(const POINTI& point)
+		{
+			Normalize();
+
+			if (point.x >= left && point.x <= right && point.y >= top && point.y <= bottom)
+				return TRUE;
+
+			return FALSE;
+		}
+		POINTI GetCenter()
+		{
+			return POINTI((left + right)/2, (top + bottom)/2);
+		}
+		void SetCener(int x, int y)
+		{
+			int cx = (left + right)/2;
+			int cy = (top + bottom)/2;
+
+			left = x + (left - cx);
+			top = y + (top - cy);
+			right = x + (right - cx);
+			bottom = y + (bottom - cy);
+		}
+		void Offset(int x, int y)
+		{
+			left += x;
+			top += y;
+			right += x;
+			bottom += y;
+		}
+	};
+	struct RECTD
+	{
+		double left;
+		double top;
+		double right;
+		double bottom;
+
+		RECTD()
+		{
+			left = top = right = bottom = 0.0;
+		}
+		RECTD(double x, double y)
+		{
+			left = right = x;
+			top = bottom = y;
+		}
+		RECTD(double _left, double _top, double _right, double _bottom)
+		{
+			left = _left;
+			top = _top;
+			right = _right;
+			bottom = _bottom;
+		}
+		RECTD(const RECTD& rect)
+		{
+			operator= (rect);
+		}
+		RECTD(const RECTI& rect)
+		{
+			operator= (rect);
+		}
+		RECTD(const RECT& rect)
+		{
+			operator= (rect);
+		}
+
+		RECTD& operator= (const RECTI& rect)
+		{
+			left = rect.left;
+			top = rect.top;
+			right = rect.right;
+			bottom = rect.bottom;
+
+			return *this;
+		}
+		RECTD& operator= (const RECTD& rect)
+		{
+			left = rect.left;
+			top = rect.top;
+			right = rect.right;
+			bottom = rect.bottom;
+
+			return *this;
+		}
+		RECTD& operator= (const RECT& rect)
+		{
+			left = rect.left;
+			top = rect.top;
+			right = rect.right;
+			bottom = rect.bottom;
+
+			return *this;
+		}
+
+		void Normalize()
+		{
+			RECTD rect = *this;
+
+			if (left > right)
+			{
+				right = rect.left;
+				left = rect.right;
+			}
+
+			if (top > bottom)
+			{
+				bottom = rect.top;
+				top = rect.bottom;
+			}
+		}
+		double GetWidth()
+		{
+			return right - left;
+		}
+		double GetHeight()
+		{
+			return bottom - top;
+		}
+		BOOL IsPointInside(const POINTD& point)
+		{
+			Normalize();
+
+			if (point.x >= left && point.x <= right && point.y >= top && point.y <= bottom)
+				return TRUE;
+
+			return FALSE;
+		}
+		POINTD GetCenter()
+		{
+			return POINTD(0.5*(left + right), 0.5*(top + bottom));
+		}
+		void SetCenter(double x, double y)
+		{
+			double cx = 0.5*(left + right);
+			double cy = 0.5*(top + bottom);
+
+			left = x + (left - cx);
+			top = y + (top - cy);
+			right = x + (right - cx);
+			bottom = y + (bottom - cy);
+		}
+		void Offset(double x, double y)
+		{
+			left += x;
+			top += y;
+			right += x;
+			bottom += y;
+		}
+	};
+}
+
+namespace Templates
+{
+	template<typename E>
+	class CArray
+	{
+	public:
+		CArray()
+			: m_pData(NULL)
+			, m_nSize(0)
+			, m_nMaxSize(0)
+			, m_nGrowBy(0)
+		{
+		}
+		~CArray()
+		{
+			RemoveAll();
+		}
+
+		int GetCount() const
+		{
+			return m_nSize;
+		}
+		BOOL IsEmpty() const
+		{
+			return (0>=m_nSize);
+		}
+		BOOL SetCount( int nNewSize, int nGrowBy = -1 )
+		{
+			if (-1!=nGrowBy)
+			{
+				m_nGrowBy = nGrowBy;  // set new size
+			}
+
+			if (0==nNewSize)
+			{
+				if(NULL!=m_pData)
+				{
+					CallDestructors(m_pData, m_nSize);
+					free(m_pData);
+					m_pData = NULL;
+				}
+				m_nSize = 0;
+				m_nMaxSize = 0;
+			}
+			else if (nNewSize <= m_nMaxSize)
+			{
+				// it fits
+				if( nNewSize > m_nSize )
+				{
+					// initialize the new elements
+					CallConstructors(m_pData+m_nSize, nNewSize - m_nSize);
+				}
+				else if (m_nSize > nNewSize)
+				{
+					// destroy the old elements
+					CallDestructors(m_pData+nNewSize, m_nSize - nNewSize);
+				}
+				m_nSize = nNewSize;
+			}
+			else
+			{
+				if (!GrowBuffer(nNewSize))
+					return FALSE;
+				CallConstructors(m_pData+m_nSize, nNewSize - m_nSize);
+				m_nSize = nNewSize;
+			}
+			return TRUE;
+		}
+		void RemoveAll()
+		{
+			SetCount(0, -1);
+		}
+
+		const E& GetAt(int nIndex) const
+		{
+			if (0>nIndex)
+				nIndex = 0;
+			else if (nIndex>=m_nSize)
+				nIndex = m_nSize;
+			return m_pData[nIndex];
+		}
+		void SetAt(int nIndex, const E &oElement)
+		{
+			if ((0>nIndex)||(nIndex>=m_nSize))
+				return;
+			m_pData[nIndex] = oElement;
+		}
+		E& GetAt(int nIndex)
+		{
+			if (0>nIndex)
+				nIndex = 0;
+			else if (nIndex>=m_nSize)
+				nIndex = m_nSize;
+			return m_pData[nIndex];
+		}
+
+		// Add an element to the end of the array
+		int Add(const E& oElement)
+		{
+			int nIndex = m_nSize;
+			if (nIndex >= m_nMaxSize)
+			{
+				if (!GrowBuffer(nIndex+1))
+					return -1;
+			}
+			::new(m_pData+nIndex)E(oElement);
+			m_nSize++;
+			return(nIndex);
+		}
+		int Append(const CArray<E>&arSrc)
+		{
+			int nOldSize = m_nSize;
+			if(!SetCount(m_nSize + arSrc.m_nSize))
+				return -1;
+			memcpy(m_pData+nOldSize, arSrc.m_pData, arSrc.m_nSize*sizeof(E));
+			return( nOldSize );
+		}
+
+		const E& operator[](int nIndex) const
+		{
+			return GetAt(nIndex);
+		}
+		E& operator[](int nIndex)
+		{
+			return GetAt(nIndex);
+		}
+
+		void InsertAt(int nIndex, const E& oElement)
+		{
+			if (nIndex>=m_nSize)
+			{
+				Add(oElement);
+				return;
+			}
+
+			// inserting in the middle of the array
+			int nOldSize = m_nSize;
+			if(!SetCount(m_nSize + 1, -1))
+				return;
+
+			memcpy(m_pData + (nIndex + 1), m_pData + nIndex, sizeof(E)*(nOldSize-nIndex));
+			m_pData[nIndex] = oElement;
+		}
+		void InsertArrayAt(int nStart, const CArray<E> &arNew)
+		{
+			if (nStart>=m_nSize)
+			{
+				Append(arNew);
+				return;
+			}
+
+			int nNewArrayCount = arNew.GetCount();
+			// inserting in the middle of the array
+			int nOldSize = m_nSize;
+			if(!SetCount(m_nSize + nNewArrayCount, -1))
+				return;
+
+			// shift old data up to fill gap
+			memcpy(m_pData + (nStart + nNewArrayCount), m_pData + nStart, sizeof(E)*(nOldSize-nStart));
+
+			for (int nIndex = nStartl nIndex<nNewArrayCount; nIndex++)
+				m_pData[nIndex] = arNew[nIndex];
+		}
+		void RemoveAt(int nIndex)
+		{
+			if ((0>nIndex)||(nIndex>=m_nSize))
+				return;
+			m_pData[nIndex].~E();
+
+			memcpy(m_pData + nIndex, m_pData + nIndex + 1, (m_nSize - nIndex)*sizeof(E));
+			m_nSize--;
+		}
+	private:
+		BOOL GrowBuffer(int nNewSize)
+		{
+			if (nNewSize > m_nMaxSize)
+			{
+				if (NULL==m_pData)
+				{
+					int nAllocSize =  (m_nGrowBy>nNewSize) ? m_nGrowBy : nNewSize;
+					m_pData = static_cast<E*>(calloc(nAllocSize, sizeof(E)));
+					if (NULL==m_pData)
+						return FALSE;
+					m_nMaxSize = nAllocSize;
+				}
+				else
+				{
+					// otherwise, grow array
+					int nGrowBy = m_nGrowBy;
+					if (0==nGrowBy)
+					{
+						// heuristically determine growth when nGrowBy == 0
+						//  (this avoids heap fragmentation in many situations)
+						nGrowBy = m_nSize/8;
+						nGrowBy = (nGrowBy < 4) ? 4 : ((nGrowBy > 1024) ? 1024 : nGrowBy);
+					}
+					int nNewMax = max(nNewSize, (m_nMaxSize+nGrowBy));
+
+					E* pNewData = static_cast<E*>(calloc(nNewMax, sizeof(E)));
+					if (NULL==pNewData)
+					{
+						return FALSE;
+					}
+
+					// copy new data from old
+					memcpy(pNewData, m_pData, m_nSize*sizeof(E));
+
+					// get rid of old stuff (note: no destructors called)
+					free(m_pData);
+					m_pData = pNewData;
+					m_nMaxSize = nNewMax;
+				}
+			}
+			return TRUE;
+		}
+	// Implementation
+	private:
+		E* m_pData;
+		int m_nSize;
+		int m_nMaxSize;
+		int m_nGrowBy;
+
+		void CallDestructors(E* pData, int nCount)
+		{
+			for (int i=0; i<nCount; i++)
+				pData[i].~E();
+		}
+		void CallConstructors(E* pData, int nCount)
+		{
+			for (int i=0; i<nCount; i++)
+				::new(pData + i) E;
+		}
+	};
+	template<typename K, typename V>
+	class CMap
+	{
+	public:
+		class CPair
+		{
+		public:
+			CPair(const K &oKey, const V &oValue)
+				: m_key(oKey)
+				, m_value(oValue)
+			{
+			}
+			const K m_key;
+			V m_value;
+		};
+	public:
+		CMap()
+		{
+		}
+		~CMap()
+		{
+			RemoveAll();
+		}
+		void SetAt(const K &oKey, const V &oValue)
+		{
+			int nIndex = FindByKey(oKey);
+			if (-1==nIndex)
+			{
+				CPair *pPair = new CPair(oKey, oValue);
+				if (NULL==pPair)
+					return;
+				m_arPair.Add(pPair);
+			}
+			else
+			{
+				m_arPair[nIndex]->m_value = oValue;
+			}
+		}
+		CPair *Lookup(const K &oKey)
+		{
+			int nIndex = FindByKey(oKey);
+			if (-1==nIndex)
+				return NULL;
+			return m_arPair[nIndex];
+		}
+		const CPair *Lookup(const K &oKey) const
+		{
+			int nIndex = FindByKey(oKey);
+			if (-1==nIndex)
+				return NULL;
+			return m_arPair[nIndex];
+		}
+		CPair *GetAt(int nIndex)
+		{
+			if ((nIndex<0)||(nIndex>=m_arPair.GetCount()))
+				return NULL;
+			return m_arPair[nIndex];
+		}
+		const CPair *GetAt(int nIndex) const
+		{
+			if ((nIndex<0)||(nIndex>=m_arPair.GetCount()))
+				return NULL;
+			return m_arPair[nIndex];
+		}
+		void RemoveKey(const K &oKey)
+		{
+			int nIndex = FindByKey(oKey);
+			if (-1==nIndex)
+				return;
+			if (NULL!=m_arPair[nIndex])
+				delete m_arPair[nIndex];
+			m_arPair.RemoveAt(nIndex);
+		}
+		void RemoveAll()
+		{
+			int nCount = m_arPair.GetCount();
+			for (int nIndex = 0; nIndex<nCount; nIndex++)
+			{
+				if (NULL==m_arPair[nIndex])
+					continue;
+				delete m_arPair[nIndex];
+			}
+			m_arPair.RemoveAll();
+		}
+		int GetCount() const
+		{
+			return m_arPair.GetCount();
+		}
+	protected:
+		int FindByKey(const K &oKey) const
+		{
+			int nCount = m_arPair.GetCount();
+			for (int nIndex = 0; nIndex<nCount; nIndex++)
+			{
+				if (NULL==m_arPair[nIndex])
+					continue;
+				if (oKey==m_arPair[nIndex]->m_key)
+					return nIndex;
+			}
+			return -1;
+		}
+		CArray<CPair *> m_arPair;
+	};
+};
+
+#endif//STRUCTURES


fieldwort

fieldwort


STYLE: Nightly Version update

STYLE: Nightly Version update

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -28,7 +28,7 @@

 #include "vtkObject.h"

-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2774 $, $Date: 2007-05-19 00:51:43 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2775 $, $Date: 2007-05-20 06:39:41 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


STYLE: Nightly Version update

STYLE: Nightly Version update

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -28,7 +28,7 @@

 #include "vtkObject.h"

-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2492 $, $Date: 2006-07-15 12:21:19 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2493 $, $Date: 2006-07-16 12:13:46 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


Nightly Version

Nightly Version

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -28,7 +28,7 @@

 #include "vtkObject.h"

-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1788 $, $Date: 2004-01-11 02:45:37 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1789 $, $Date: 2004-01-12 02:45:36 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


STYLE: Nightly Version update

STYLE: Nightly Version update

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -28,7 +28,7 @@

 #include "vtkObject.h"

-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2256 $, $Date: 2005-11-07 10:34:10 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.2257 $, $Date: 2005-11-08 10:33:39 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


otimization - update only on increment.

otimization - update only on increment.

--- black-hole-solitaire/c-solver/lib.c
+++ black-hole-solitaire/c-solver/lib.c
@@ -660,10 +660,6 @@

     while (solver->queue_len > 0)
     {
-        if (solver->current_depths_stack_len > max_reached_queue_len)
-        {
-            max_reached_queue_len = solver->current_depths_stack_len;
-        }
         const_AUTO(prev_len, solver->queue_len);
         --solver->queue_len;
 #if 0
@@ -744,6 +740,10 @@
         {
             solver->depths_stack[solver->current_depths_stack_len++] =
                 solver->queue_len;
+            if (solver->current_depths_stack_len > max_reached_queue_len)
+            {
+                max_reached_queue_len = solver->current_depths_stack_len;
+            }
         }

         if (no_cards)


Automated commit to force versioning.

Automated commit to force versioning.

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -59,7 +59,7 @@
 #define VTK_MINOR_VERSION 2
 #define VTK_BUILD_VERSION 0
 #define VTK_VERSION "3.2.0"
-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.872 $, $Date: 2001-05-27 00:05:34 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.873 $, $Date: 2001-05-28 00:05:32 $ (GMT)"

 class VTK_EXPORT vtkVersion : public vtkObject {


Nightly Version

Nightly Version

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -35,7 +35,7 @@
 #define VTK_MINOR_VERSION 1
 #define VTK_BUILD_VERSION 1
 #define VTK_VERSION "4.1.1"
-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1267 $, $Date: 2002-07-05 02:45:03 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1268 $, $Date: 2002-07-06 02:45:03 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


Nightly Version

Nightly Version

--- Common/vtkVersion.h
+++ Common/vtkVersion.h
@@ -31,7 +31,7 @@

 #include "vtkObject.h"

-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1453 $, $Date: 2003-01-07 03:45:03 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.1454 $, $Date: 2003-01-08 03:45:04 $ (GMT)"

 class VTK_COMMON_EXPORT vtkVersion : public vtkObject


asperity

asperity


monosaccharose

monosaccharose


Vistlik

Vistlik


ADDED: example of unpacking a value from dictionary

--- examples/pack-unpack/pack-unpack.c
+++ examples/pack-unpack/pack-unpack.c
@@ -41,6 +41,9 @@
 	rpc_client_t client;
 	rpc_connection_t conn;
 	rpc_object_t result;
+	const char *keys[] = {"key"};
+	const rpc_object_t values[] = {rpc_int64_create(11234)};
+

 	ctx = rpc_context_create();

@@ -48,12 +51,14 @@
 	    ^(void *cookie, rpc_object_t args) {
 		const char *str;
 		int64_t num;
+		int64_t dict_num;
 		bool sure;

-		rpc_object_unpack(args, "[sib]", &str, &num, &sure);
+		rpc_object_unpack(args, "[sib{i}]", &str, &num, &sure, "key",
+		    &dict_num);

-		printf("str = %s, num = %jd, sure = %s\n", str, num,
-		    sure ? "true" : "false");
+		printf("str = %s, num = %jd, dict_num = %jd, sure = %s\n", str,
+		    num, dict_num, sure ? "true" : "false");

 	    	return rpc_object_pack("{siubn[iii{s}]}",
 		    "hello", "world",
@@ -80,7 +85,8 @@
 	conn = rpc_client_get_connection(client);
 	result = rpc_connection_call_sync(conn, "hello",
 	    rpc_string_create("world"), rpc_int64_create(123),
-	    rpc_bool_create(true), NULL);
+	    rpc_bool_create(true),
+	    rpc_dictionary_create_ex(keys, values, 1, true), NULL);

 	printf("result = %s\n", rpc_copy_description(result));


sanctifiable

sanctifiable


prestidigitator

prestidigitator


overtameness

overtameness


uranoscopic

uranoscopic


spinicarpous

spinicarpous


inf-test-reduce-replay: also catch SIGTRAP of the child process

--- test/inf-test-reduce-replay.c
+++ test/inf-test-reduce-replay.c
@@ -409,7 +409,9 @@

 #ifndef G_OS_WIN32
   if(WIFSIGNALED(ret) &&
-     (WTERMSIG(ret) == SIGABRT || WTERMSIG(ret) == SIGSEGV))
+     (WTERMSIG(ret) == SIGABRT ||
+      WTERMSIG(ret) == SIGSEGV ||
+      WTERMSIG(ret) == SIGTRAP))
   {
     return FALSE;
   }
@@ -629,7 +631,6 @@
       }
     }
   }
-
   g_object_unref(local_replay);

   if(result)


isohydrosorbic

isohydrosorbic


sonoriferously

sonoriferously


pretentious

pretentious


gamut

gamut


Bug fix: -n option used to crash on multithread

--- MrsFAST.c
+++ MrsFAST.c
@@ -767,6 +767,7 @@
 					unsigned char mderr = calculateMD(genLoc, _tmpCmpSeq, err, &_msf_op[id]);
 					unsigned char mdlen = strlen(_msf_op[id]);

+					pthread_mutex_lock(&_msf_writeLock);
 					tmpOut = fwrite(&r, sizeof(int), 1, _msf_hitsTempFile);
 					tmpOut = fwrite(&flag, sizeof(int), 1, _msf_hitsTempFile);
 					tmpOut = fwrite(&loc, sizeof(int), 1, _msf_hitsTempFile);
@@ -775,6 +776,7 @@
 					tmpOut = fwrite(&mderr, sizeof(char), 1, _msf_hitsTempFile);
 					tmpOut = fwrite(&mdlen, sizeof(char), 1, _msf_hitsTempFile);
 					tmpOut = fwrite(_msf_op[id], sizeof(char), mdlen, _msf_hitsTempFile);
+					pthread_mutex_unlock(&_msf_writeLock);
 				}

 			}


CLIENT : remove BadSessionClosed when disconnect

--- src/client/ua_client_subscriptions.c
+++ src/client/ua_client_subscriptions.c
@@ -613,6 +613,15 @@
         return;
     }

+    if(response->responseHeader.serviceResult == UA_STATUSCODE_BADSESSIONCLOSED) {
+        if(client->state >= UA_CLIENTSTATE_SESSION) {
+            UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,
+                           "Received Publish Response with code %s",
+                            UA_StatusCode_name(response->responseHeader.serviceResult));
+        }
+        return;
+    }
+
     if(response->responseHeader.serviceResult == UA_STATUSCODE_BADSESSIONIDINVALID) {
         UA_Client_close(client); /* TODO: This should be handled before the process callback */
         UA_LOG_WARNING(client->config.logger, UA_LOGCATEGORY_CLIENT,


symphysodactylia

symphysodactylia


relapsing

relapsing


loopback_test: add loopback test struct

loopback_test: add loopback test struct

The kernel driver no longer manages the device mask and no longer
does aggregation. The application needs to configure and set each
device it wants to exercise for a test. Having, for example, a global
control interface does not make sense anymore.

In preparation for the next couple of patches that will add a
per-device structure, remove global variables and add them to a
structure instead that is easier to pass as argument to functions.

Reviewed-by: Bryan O'Donoghue <165dc05575478af93ac2f97f67be6e1756010094@linaro.org>
Signed-off-by: Axel Haslam <66bbaa7bd8fe83108c810be839e25f81f43cf794@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@google.com>

--- test/loopback/loopback_test.c
+++ test/loopback/loopback_test.c
@@ -17,9 +17,11 @@
 #include <unistd.h>
 #include <dirent.h>

+#define MAX_NUM_DEVICES 50
 #define MAX_SYSFS_PATH	0x200
 #define CSV_MAX_LINE	0x1000
 #define SYSFS_MAX_INT	0x20
+#define MAX_STR_LEN	255

 struct dict {
 	char *name;
@@ -32,23 +34,63 @@
 	{"sink", 4}
 };

-struct loopback_names {
+struct loopback_results {
+	float latency_avg;
+	uint32_t latency_max;
+	uint32_t latency_min;
+	uint32_t latency_jitter;
+
+	float request_avg;
+	uint32_t request_max;
+	uint32_t request_min;
+	uint32_t request_jitter;
+
+	float throughput_avg;
+	uint32_t throughput_max;
+	uint32_t throughput_min;
+	uint32_t throughput_jitter;
+
+	float apbridge_unipro_latency_avg;
+	uint32_t apbridge_unipro_latency_max;
+	uint32_t apbridge_unipro_latency_min;
+	uint32_t apbridge_unipro_latency_jitter;
+
+	float gpbridge_firmware_latency_avg;
+	uint32_t gpbridge_firmware_latency_max;
+	uint32_t gpbridge_firmware_latency_min;
+	uint32_t gpbridge_firmware_latency_jitter;
+
+	uint32_t error;
+};
+
+struct loopback_device {
+	char name[MAX_SYSFS_PATH];
 	char sysfs_entry[MAX_SYSFS_PATH];
-	char dbgfs_entry[MAX_SYSFS_PATH];
-	int module_node;
+	char debugfs_entry[MAX_SYSFS_PATH];
+	int inotify_wd;
+	struct loopback_results results;
 };
-static struct loopback_names *lb_name = NULL;
-static unsigned int lb_entries = 0;
-static char *ctrl_path;
-static int verbose;
-static int debug;
-static int raw_data_dump;
-static int porcelain;
+
+struct loopback_test {
+	int verbose;
+	int debug;
+	int raw_data_dump;
+	int porcelain;
+	int mask;
+	int size;
+	int iteration_max;
+	int test_id;
+	int device_count;
+	char test_name[MAX_STR_LEN];
+	char sysfs_prefix[MAX_SYSFS_PATH];
+	char debugfs_prefix[MAX_SYSFS_PATH];
+	struct loopback_device devices[MAX_NUM_DEVICES];
+};
+struct loopback_test t;
+

 void abort()
 {
-	if (lb_name)
-		free(lb_name);
 	_exit(1);
 }

@@ -90,6 +132,14 @@
 	abort();
 }

+static inline int device_enabled(struct loopback_test *t, int dev_idx)
+{
+	if (!t->mask || (t->mask & (1 << dev_idx)))
+		return 1;
+
+	return 0;
+}
+
 int open_sysfs(const char *sys_pfx, const char *node, int flags)
 {
 	int fd;
@@ -174,9 +224,8 @@
 		strerror(err));
 }

-void __log_csv(const char *test_name, int size, int iteration_max,
-	       int fd, struct tm *tm, const char *dbgfs_entry,
-	       const char *sys_pfx)
+void __log_csv(struct loopback_test *t, struct loopback_device *d,
+	       int fd, struct tm *tm, const char *dbgfs_entry)
 {
 	char buf[CSV_MAX_LINE];
 	int error, fd_dev, len;
@@ -200,22 +249,22 @@
 	}

 	/* gather data set */
-	error = read_sysfs_int(sys_pfx, "error");
-	request_min = read_sysfs_int(sys_pfx, "requests_per_second_min");
-	request_max = read_sysfs_int(sys_pfx, "requests_per_second_max");
-	request_avg = read_sysfs_float(sys_pfx, "requests_per_second_avg");
-	latency_min = read_sysfs_int(sys_pfx, "latency_min");
-	latency_max = read_sysfs_int(sys_pfx, "latency_max");
-	latency_avg = read_sysfs_float(sys_pfx, "latency_avg");
-	throughput_min = read_sysfs_int(sys_pfx, "throughput_min");
-	throughput_max = read_sysfs_int(sys_pfx, "throughput_max");
-	throughput_avg = read_sysfs_float(sys_pfx, "throughput_avg");
-	apbridge_unipro_latency_min = read_sysfs_int(sys_pfx, "apbridge_unipro_latency_min");
-	apbridge_unipro_latency_max = read_sysfs_int(sys_pfx, "apbridge_unipro_latency_max");
-	apbridge_unipro_latency_avg = read_sysfs_float(sys_pfx, "apbridge_unipro_latency_avg");
-	gpbridge_firmware_latency_min = read_sysfs_int(sys_pfx, "gpbridge_firmware_latency_min");
-	gpbridge_firmware_latency_max = read_sysfs_int(sys_pfx, "gpbridge_firmware_latency_max");
-	gpbridge_firmware_latency_avg = read_sysfs_float(sys_pfx, "gpbridge_firmware_latency_avg");
+	error = read_sysfs_int(d->sysfs_entry, "error");
+	request_min = read_sysfs_int(d->sysfs_entry, "requests_per_second_min");
+	request_max = read_sysfs_int(d->sysfs_entry, "requests_per_second_max");
+	request_avg = read_sysfs_float(d->sysfs_entry, "requests_per_second_avg");
+	latency_min = read_sysfs_int(d->sysfs_entry, "latency_min");
+	latency_max = read_sysfs_int(d->sysfs_entry, "latency_max");
+	latency_avg = read_sysfs_float(d->sysfs_entry, "latency_avg");
+	throughput_min = read_sysfs_int(d->sysfs_entry, "throughput_min");
+	throughput_max = read_sysfs_int(d->sysfs_entry, "throughput_max");
+	throughput_avg = read_sysfs_float(d->sysfs_entry, "throughput_avg");
+	apbridge_unipro_latency_min = read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_min");
+	apbridge_unipro_latency_max = read_sysfs_int(d->sysfs_entry, "apbridge_unipro_latency_max");
+	apbridge_unipro_latency_avg = read_sysfs_float(d->sysfs_entry, "apbridge_unipro_latency_avg");
+	gpbridge_firmware_latency_min = read_sysfs_int(d->sysfs_entry, "gpbridge_firmware_latency_min");
+	gpbridge_firmware_latency_max = read_sysfs_int(d->sysfs_entry, "gpbridge_firmware_latency_max");
+	gpbridge_firmware_latency_avg = read_sysfs_float(d->sysfs_entry, "gpbridge_firmware_latency_avg");

 	/* derive jitter */
 	request_jitter = request_max - request_min;
@@ -229,10 +278,10 @@
 	len = snprintf(buf, sizeof(buf), "%u-%u-%u %u:%u:%u",
 		       tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
 		       tm->tm_hour, tm->tm_min, tm->tm_sec);
-	if (porcelain) {
+	if (t->porcelain) {
 		len += snprintf(&buf[len], sizeof(buf) - len,
 			"\n test:\t\t\t%s\n path:\t\t\t%s\n size:\t\t\t%u\n iterations:\t\t%u\n errors:\t\t%u\n",
-			test_name, sys_pfx, size, iteration_max, error);
+			t->test_name, d->sysfs_entry, t->size, t->iteration_max, error);
 		len += snprintf(&buf[len], sizeof(buf) - len,
 			" requests per-sec:\tmin=%u, max=%u, average=%f, jitter=%u\n",
 			request_min, request_max, request_avg, request_jitter);
@@ -255,7 +304,7 @@
 	} else {
 		len += snprintf(&buf[len], sizeof(buf) - len,
 			",%s,%s,%u,%u,%u,%u,%u,%f,%u,%u,%u,%f,%u,%u,%u,%f,%u,%u,%u,%f,%u,%u,%u,%f,%u",
-			test_name, sys_pfx, size, iteration_max, error,
+			t->test_name, d->sysfs_entry, t->size, t->iteration_max, error,
 			request_min, request_max, request_avg, request_jitter,
 			latency_min, latency_max, latency_avg, latency_jitter,
 			throughput_min, throughput_max, throughput_avg,
@@ -271,12 +320,12 @@
 	printf("\n%s\n", buf);

 	/* Write raw latency times to CSV  */
-	for (i = 0; i < iteration_max && raw_data_dump && !porcelain; i++) {
+	for (i = 0; i < t->iteration_max && t->raw_data_dump && !t->porcelain; i++) {
 		memset(&rx_buf, 0x00, sizeof(rx_buf));
 		len = read(fd_dev, rx_buf, sizeof(rx_buf));
 		if (len < 0) {
 			fprintf(stderr, "error reading %s %s\n",
-				dbgfs_entry, strerror(errno));
+				t->debugfs_prefix, strerror(errno));
 			break;
 		}
 		lseek(fd_dev, SEEK_SET, 0);
@@ -286,7 +335,7 @@
 			break;
 		}
 	}
-	if (!porcelain) {
+	if (!t->porcelain) {
 		if (write(fd, "\n", 1) < 1)
 			log_csv_error(1, errno);
 	}
@@ -296,17 +345,16 @@

 }

-void log_csv(const char *test_name, int size, int iteration_max,
-	     const char *sys_pfx, uint32_t mask)
-{
-	int fd, j, i;
+void log_csv(struct loopback_test *t)
+{
+	int fd, i;
 	struct tm tm;
-	time_t t;
+	time_t cur_time;
 	mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
 	char buf[MAX_SYSFS_PATH];

-	t = time(NULL);
-	tm = *localtime(&t);
+	cur_time = time(NULL);
+	tm = *localtime(&cur_time);

 	/*
 	 * file name will test_name_size_iteration_max.csv
@@ -314,82 +362,70 @@
 	 * append to the same CSV with datestamp - representing each test
 	 * dataset.
 	 */
-	snprintf(buf, sizeof(buf), "%s_%d_%d.csv", test_name, size,
-		 iteration_max);
-
-	if (!porcelain) {
+	snprintf(buf, sizeof(buf), "%s_%d_%d.csv", t->test_name, t->size,
+		 t->iteration_max);
+
+	if (!t->porcelain) {
 		fd = open(buf, O_WRONLY | O_CREAT | O_APPEND, mode);
 		if (fd < 0) {
 			fprintf(stderr, "unable to open %s for appendation\n", buf);
 			abort();
 		}
 	}
-	for (j = 0, i = 0; j < lb_entries; j++) {
-		if (lb_name[j].module_node || mask & (1 << i) || (!mask))
-			__log_csv(test_name, size, iteration_max, fd, &tm,
-				  lb_name[j].dbgfs_entry,
-				  ctrl_path);
-		if (!lb_name[j].module_node)
-			i++;
-	}
-	if (!porcelain)
+	for (i = 0; i < t->device_count; i++) {
+		if (!device_enabled(t, i))
+			continue;
+
+		__log_csv(t, &t->devices[i], fd, &tm, t->devices[i].debugfs_entry);
+	}
+	if (!t->porcelain)
 		close(fd);
 }

-int construct_paths(const char *sys_pfx, const char *dbgfs_pfx)
+int construct_paths(struct loopback_test *t)
 {
 	struct dirent **namelist;
-	int i, n, ret, j;
+	int i, n, ret;
 	unsigned int bus_id, interface_id, bundle_id;
-
-	n = scandir(dbgfs_pfx, &namelist, NULL, alphasort);
+	struct loopback_device *d;
+
+	n = scandir(t->debugfs_prefix, &namelist, NULL, alphasort);
 	if (n < 0) {
 		perror("scandir");
 		ret = -ENODEV;
 		goto baddir;
-	} else {
-		/* Don't include '.' and '..' */
-		lb_entries = n - 2;
-		if (!lb_entries) {
-			ret = -ENOMEM;
-			goto done;
-		}
-		lb_name = malloc(lb_entries * sizeof(*lb_name));
-		if (lb_name == NULL) {
-			ret = -ENOMEM;
-			goto done;
-		}
-
-		j = 0;
-		for (i = 0; i < n; i++) {
-			if (strstr(namelist[i]->d_name, "raw_latency_")) {
-				ret = sscanf(namelist[i]->d_name,
-					     "raw_latency_%u-%u.%u",
-					     &bus_id, &interface_id,
-					     &bundle_id);
-				if (ret == 3) {
-					snprintf(lb_name[j].sysfs_entry, MAX_SYSFS_PATH,
-						 "%s%u-%u.%u/", sys_pfx,
-						 bus_id, interface_id,
-						 bundle_id);
-					ctrl_path = lb_name[j].sysfs_entry;
-					lb_name[j].module_node = 0;
-				} else {
-					memset(&lb_name[j].sysfs_entry, 0,
-					       MAX_SYSFS_PATH);
-					lb_name[j].module_node = 1;
-				}
-				snprintf(lb_name[j].dbgfs_entry, MAX_SYSFS_PATH,
-					 "%s%s", dbgfs_pfx,
-					 namelist[i]->d_name);
-				if (debug)
-					printf("add %s %s\n",
-					       lb_name[j].dbgfs_entry,
-					       lb_name[j].sysfs_entry);
-				j++;
-			}
-		}
-	}
+	}
+
+	/* Don't include '.' and '..' */
+	if (n <= 2) {
+		ret = -ENOMEM;
+		goto done;
+	}
+
+	for (i = 0; i < n; i++) {
+		if (!strstr(namelist[i]->d_name, "raw_latency_"))
+			continue;
+		ret = sscanf(namelist[i]->d_name,
+				"raw_latency_%u-%u.%u",
+				&bus_id, &interface_id,
+				&bundle_id);
+		if (ret == 3) {
+			d = &t->devices[t->device_count++];
+
+			snprintf(d->sysfs_entry, MAX_SYSFS_PATH,
+					"%s%u-%u.%u/", t->sysfs_prefix,
+					bus_id, interface_id, bundle_id);
+
+			snprintf(d->debugfs_entry, MAX_SYSFS_PATH,
+				"%s%s", t->debugfs_prefix,
+				namelist[i]->d_name);
+
+			if (t->debug)
+				printf("add %s %s\n", d->sysfs_entry,
+					d->debugfs_entry);
+		}
+	}
+
 	ret = 0;
 done:
 	for (i = 0; i < n; i++)
@@ -399,33 +435,30 @@
 	return ret;
 }

-void loopback_run(const char *test_name, int size, int iteration_max,
-		  const char *sys_prefix, const char *dbgfs_prefix,
-		  uint32_t mask)
+void loopback_run(struct loopback_test *t)
 {
 	char buf[MAX_SYSFS_PATH];
 	char inotify_buf[0x800];
-	char *sys_pfx = (char*)sys_prefix;
+	char *sys_pfx = (char *)t->sysfs_prefix;
 	fd_set fds;
-	int test_id = 0;
 	int i;
 	int previous, err, iteration_count;
 	int fd, wd, ret;
 	struct timeval tv;

-	if (construct_paths(sys_prefix, dbgfs_prefix)) {
+	if (construct_paths(t)) {
 		fprintf(stderr, "unable to construct sysfs/dbgfs path names\n");
 		usage();
 		return;
 	}
-	sys_pfx = ctrl_path;
+	sys_pfx = t->devices[0].sysfs_entry;

 	for (i = 0; i < sizeof(dict) / sizeof(struct dict); i++) {
-		if (strstr(dict[i].name, test_name))
-			test_id = dict[i].type;
-	}
-	if (!test_id) {
-		fprintf(stderr, "invalid test %s\n", test_name);
+		if (strstr(dict[i].name, t->test_name))
+			t->test_id = dict[i].type;
+	}
+	if (!t->test_id) {
+		fprintf(stderr, "invalid test %s\n", t->test_name);
 		usage();
 		return;
 	}
@@ -437,16 +470,16 @@
 	write_sysfs_val(sys_pfx, "us_wait", 0);

 	/* Set operation size */
-	write_sysfs_val(sys_pfx, "size", size);
+	write_sysfs_val(sys_pfx, "size", t->size);

 	/* Set iterations */
-	write_sysfs_val(sys_pfx, "iteration_max", iteration_max);
+	write_sysfs_val(sys_pfx, "iteration_max", t->iteration_max);

 	/* Set mask of connections to include */
-	write_sysfs_val(sys_pfx, "mask", mask);
+	write_sysfs_val(sys_pfx, "mask", t->mask);

 	/* Initiate by setting loopback operation type */
-	write_sysfs_val(sys_pfx, "type", test_id);
+	write_sysfs_val(sys_pfx, "type", t->test_id);
 	sleep(1);

 	/* Setup for inotify on the sysfs entry */
@@ -491,14 +524,14 @@
 		if (previous == iteration_count) {
 			err = 1;
 			break;
-		} else if (iteration_count == iteration_max) {
+		} else if (iteration_count == t->iteration_max) {
 			break;
 		}
 		previous = iteration_count;
-		if (verbose) {
+		if (t->verbose) {
 			printf("%02d%% complete %d of %d\r",
-				100 * iteration_count / iteration_max,
-				iteration_count, iteration_max);
+				100 * iteration_count / t->iteration_max,
+				iteration_count, t->iteration_max);
 			fflush(stdout);
 		}
 	}
@@ -508,50 +541,48 @@
 	if (err)
 		printf("\nError executing test\n");
 	else
-		log_csv(test_name, size, iteration_max, sys_pfx, mask);
+		log_csv(t);
 }

 int main(int argc, char *argv[])
 {
 	int o;
-	char *test = NULL;
-	int size = 0;
-	uint32_t mask = 0;
-	int iteration_count = 0;
 	char *sysfs_prefix = "/sys/bus/greybus/devices/";
 	char *debugfs_prefix = "/sys/kernel/debug/gb_loopback/";
+
+	memset(&t, 0, sizeof(t));

 	while ((o = getopt(argc, argv, "t:s:i:S:D:m:v::d::r::p::")) != -1) {
 		switch (o) {
 		case 't':
-			test = optarg;
+			snprintf(t.test_name, MAX_STR_LEN, "%s", optarg);
 			break;
 		case 's':
-			size = atoi(optarg);
+			t.size = atoi(optarg);
 			break;
 		case 'i':
-			iteration_count = atoi(optarg);
+			t.iteration_max = atoi(optarg);
 			break;
 		case 'S':
-			sysfs_prefix = optarg;
+			snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
 			break;
 		case 'D':
-			debugfs_prefix = optarg;
+			snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", optarg);
 			break;
 		case 'm':
-			mask = atol(optarg);
+			t.mask = atol(optarg);
 			break;
 		case 'v':
-			verbose = 1;
+			t.verbose = 1;
 			break;
 		case 'd':
-			debug = 1;
+			t.debug = 1;
 			break;
 		case 'r':
-			raw_data_dump = 1;
+			t.raw_data_dump = 1;
 			break;
 		case 'p':
-			porcelain = 1;
+			t.porcelain = 1;
 			break;
 		default:
 			usage();
@@ -559,12 +590,16 @@
 		}
 	}

-	if (test == NULL || iteration_count == 0)
+	if (t.test_name == NULL || t.iteration_max == 0)
 		usage();

-	loopback_run(test, size, iteration_count, sysfs_prefix, debugfs_prefix,
-		     mask);
-	if (lb_name)
-		free(lb_name);
+	if (!strcmp(t.sysfs_prefix, ""))
+		snprintf(t.sysfs_prefix, MAX_SYSFS_PATH, "%s", sysfs_prefix);
+
+	if (!strcmp(t.debugfs_prefix, ""))
+		snprintf(t.debugfs_prefix, MAX_SYSFS_PATH, "%s", debugfs_prefix);
+
+	loopback_run(&t);
+
 	return 0;
 }


cmtspeech: Fix logging level of some debug prints.

--- src/cmtspeech/cmtspeech-connection.c
+++ src/cmtspeech/cmtspeech-connection.c
@@ -406,7 +406,7 @@
             pa_log_error("cmtspeech_open() failed");
         return -1;
     } else if (counter > 0) {
-        pa_log_error("cmtspeech_open() OK");
+        pa_log_debug("cmtspeech_open() OK");
         counter = 0;
     }
     return 0;
@@ -698,7 +698,7 @@

     if (res == 0) {
         if (ul_frame_count++ < 10)
-            pa_log_error("Sending ul frame # %d", ul_frame_count);
+            pa_log_debug("Sending ul frame # %d", ul_frame_count);

         /* note: 'bytes' must match the fixed size of frames */
         pa_assert(bytes == (size_t)salbuf->pcount);


elaeometer

elaeometer


uncertificated

uncertificated


literaryism

literaryism


orthoceratite

orthoceratite


complex math

complex math

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

--- Modules/cmathmodule.c
+++ Modules/cmathmodule.c
@@ -0,0 +1,314 @@
+/* Complex math module */
+
+/* much code borrowed from mathmodule.c */
+
+#include "allobjects.h"
+#include "complexobject.h"
+
+#include <errno.h>
+
+#include "mymath.h"
+
+#ifdef i860
+/* Cray APP has bogus definition of HUGE_VAL in <math.h> */
+#undef HUGE_VAL
+#endif
+
+#ifdef HUGE_VAL
+#define CHECK(x) if (errno != 0) ; \
+	else if (-HUGE_VAL <= (x) && (x) <= HUGE_VAL) ; \
+	else errno = ERANGE
+#else
+#define CHECK(x) /* Don't know how to check */
+#endif
+
+#ifndef M_PI
+#define M_PI (3.141592653589793239)
+#endif
+
+/* First, the C functions that do the real work */
+
+/* constants */
+static complex c_1 = {1., 0.};
+static complex c_half = {0.5, 0.};
+static complex c_i = {0., 1.};
+static complex c_i2 = {0., 0.5};
+static complex c_mi = {0., -1.};
+static complex c_pi2 = {M_PI/2., 0.};
+
+/* forward declarations */
+complex c_log();
+complex c_prodi();
+complex c_sqrt();
+
+
+complex c_acos(x)
+	complex x;
+{
+	return c_neg(c_prodi(c_log(c_sum(x,c_prod(c_i,
+		    c_sqrt(c_diff(c_1,c_prod(x,x))))))));
+}
+
+complex c_acosh(x)
+	complex x;
+{
+	return c_log(c_sum(x,c_prod(c_i,
+		    c_sqrt(c_diff(c_1,c_prod(x,x))))));
+}
+
+complex c_asin(x)
+	complex x;
+{
+	return c_neg(c_prodi(c_log(c_sum(c_prod(c_i,x),
+		    c_sqrt(c_diff(c_1,c_prod(x,x)))))));
+}
+
+complex c_asinh(x)
+	complex x;
+{
+	return c_neg(c_log(c_diff(c_sqrt(c_sum(c_1,c_prod(x,x))),x)));
+}
+
+complex c_atan(x)
+	complex x;
+{
+	return c_prod(c_i2,c_log(c_quot(c_sum(c_i,x),c_diff(c_i,x))));
+}
+
+complex c_atanh(x)
+	complex x;
+{
+	return c_prod(c_half,c_log(c_quot(c_sum(c_1,x),c_diff(c_1,x))));
+}
+
+complex c_cos(x)
+	complex x;
+{
+	complex r;
+	r.real = cos(x.real)*cosh(x.imag);
+	r.imag = -sin(x.real)*sinh(x.imag);
+	return r;
+}
+
+complex c_cosh(x)
+	complex x;
+{
+	complex r;
+	r.real = cos(x.imag)*cosh(x.real);
+	r.imag = sin(x.imag)*sinh(x.real);
+	return r;
+}
+
+complex c_exp(x)
+	complex x;
+{
+	complex r;
+	double l = exp(x.real);
+	r.real = l*cos(x.imag);
+	r.imag = l*sin(x.imag);
+	return r;
+}
+
+complex c_log(x)
+	complex x;
+{
+	complex r;
+	double l = hypot(x.real,x.imag);
+	r.imag = atan2(x.imag, x.real);
+	r.real = log(l);
+	return r;
+}
+
+complex c_log10(x)
+	complex x;
+{
+	complex r;
+	double l = hypot(x.real,x.imag);
+	r.imag = atan2(x.imag, x.real)/log(10.);
+	r.real = log10(l);
+	return r;
+}
+
+complex c_prodi(x)
+     complex x;
+{
+	complex r;
+	r.real = -x.imag;
+	r.imag = x.real;
+	return r;
+}
+
+complex c_sin(x)
+	complex x;
+{
+	complex r;
+	r.real = sin(x.real)*cosh(x.imag);
+	r.imag = cos(x.real)*sinh(x.imag);
+	return r;
+}
+
+complex c_sinh(x)
+	complex x;
+{
+	complex r;
+	r.real = cos(x.imag)*sinh(x.real);
+	r.imag = sin(x.imag)*cosh(x.real);
+	return r;
+}
+
+complex c_sqrt(x)
+	complex x;
+{
+	complex r;
+	double s,d;
+	if (x.real == 0. && x.imag == 0.)
+		r = x;
+	else {
+		s = sqrt(0.5*(fabs(x.real) + hypot(x.real,x.imag)));
+		d = 0.5*x.imag/s;
+		if (x.real > 0.) {
+			r.real = s;
+			r.imag = d;
+		}
+		else if (x.imag >= 0.) {
+			r.real = d;
+			r.imag = s;
+		}
+		else {
+			r.real = -d;
+			r.imag = -s;
+		}
+	}
+	return r;
+}
+
+complex c_tan(x)
+	complex x;
+{
+	complex r;
+	double sr,cr,shi,chi;
+	double rs,is,rc,ic;
+	double d;
+	sr = sin(x.real);
+	cr = cos(x.real);
+	shi = sinh(x.imag);
+	chi = cosh(x.imag);
+	rs = sr*chi;
+	is = cr*shi;
+	rc = cr*chi;
+	ic = -sr*shi;
+	d = rc*rc + ic*ic;
+	r.real = (rs*rc+is*ic)/d;
+	r.imag = (is*rc-rs*ic)/d;
+	return r;
+}
+
+complex c_tanh(x)
+	complex x;
+{
+	complex r;
+	double si,ci,shr,chr;
+	double rs,is,rc,ic;
+	double d;
+	si = sin(x.imag);
+	ci = cos(x.imag);
+	shr = sinh(x.real);
+	chr = cosh(x.real);
+	rs = ci*shr;
+	is = si*chr;
+	rc = ci*chr;
+	ic = si*shr;
+	d = rc*rc + ic*ic;
+	r.real = (rs*rc+is*ic)/d;
+	r.imag = (is*rc-rs*ic)/d;
+	return r;
+}
+
+
+/* And now the glue to make them available from Python: */
+
+static object *
+math_error()
+{
+	if (errno == EDOM)
+		err_setstr(ValueError, "math domain error");
+	else if (errno == ERANGE)
+		err_setstr(OverflowError, "math range error");
+	else
+		err_errno(ValueError); /* Unexpected math error */
+	return NULL;
+}
+
+static object *
+math_1(args, func)
+	object *args;
+	complex (*func) FPROTO((complex));
+{
+	complex x;
+	if (!PyArg_ParseTuple(args, "D", &x))
+		return NULL;
+	errno = 0;
+	x = (*func)(x);
+	CHECK(x.real);
+	CHECK(x.imag);
+	if (errno != 0)
+		return math_error();
+	else
+		return newcomplexobject(x);
+}
+
+#define FUNC1(stubname, func) \
+	static object * stubname(self, args) object *self, *args; { \
+		return math_1(args, func); \
+	}
+
+FUNC1(cmath_acos, c_acos)
+FUNC1(cmath_acosh, c_acosh)
+FUNC1(cmath_asin, c_asin)
+FUNC1(cmath_asinh, c_asinh)
+FUNC1(cmath_atan, c_atan)
+FUNC1(cmath_atanh, c_atanh)
+FUNC1(cmath_cos, c_cos)
+FUNC1(cmath_cosh, c_cosh)
+FUNC1(cmath_exp, c_exp)
+FUNC1(cmath_log, c_log)
+FUNC1(cmath_log10, c_log10)
+FUNC1(cmath_sin, c_sin)
+FUNC1(cmath_sinh, c_sinh)
+FUNC1(cmath_sqrt, c_sqrt)
+FUNC1(cmath_tan, c_tan)
+FUNC1(cmath_tanh, c_tanh)
+
+
+static struct methodlist cmath_methods[] = {
+	{"acos", cmath_acos, 1},
+	{"acosh", cmath_acosh, 1},
+	{"asin", cmath_asin, 1},
+	{"asinh", cmath_asinh, 1},
+	{"atan", cmath_atan, 1},
+	{"atanh", cmath_atanh, 1},
+	{"cos", cmath_cos, 1},
+	{"cosh", cmath_cosh, 1},
+	{"exp", cmath_exp, 1},
+	{"log", cmath_log, 1},
+	{"log10", cmath_log10, 1},
+	{"sin", cmath_sin, 1},
+	{"sinh", cmath_sinh, 1},
+	{"sqrt", cmath_sqrt, 1},
+	{"tan", cmath_tan, 1},
+	{"tanh", cmath_tanh, 1},
+	{NULL,		NULL}		/* sentinel */
+};
+
+void
+initcmath()
+{
+	object *m, *d, *v;
+
+	m = Py_InitModule("cmath", cmath_methods);
+	d = getmoduledict(m);
+	dictinsert(d, "pi", v = newfloatobject(atan(1.0) * 4.0));
+	DECREF(v);
+	dictinsert(d, "e", v = newfloatobject(exp(1.0)));
+	DECREF(v);
+}


Doc strings by Chris Petrilli.

Doc strings by Chris Petrilli.

--- Modules/fcntlmodule.c
+++ Modules/fcntlmodule.c
@@ -95,6 +95,15 @@
 	return PyInt_FromLong((long)ret);
 }

+static char fcntl_doc [] =
+
+"fcntl(fd, opt, [arg])\n\
+\n\
+Perform the requested operation on file descriptor fd.  The operation\n\
+is defined by op and is operating system dependent.  Typically these\n\
+codes can be retrieved from the library module FCNTL.  The argument arg\n\
+is optional, and defaults to 0; it may be an int or a string.";
+

 /* ioctl(fd, opt, [arg]) */

@@ -145,6 +154,14 @@
 	}
 	return PyInt_FromLong((long)ret);
 }
+
+static char ioctl_doc [] =
+"ioctl(fd, opt, [arg])\n\
+\n\
+Perform the requested operation on file descriptor fd.  The operation\n\
+is defined by op and is operating system dependent.  Typically these\n\
+codes can be retrieved from the library module IOCTL.  The argument arg\n\
+is optional, and defaults to 0; it may be an int or a string.";

 /* flock(fd, operation) */
@@ -197,6 +214,14 @@
 	Py_INCREF(Py_None);
 	return Py_None;
 }
+
+static char flock_doc [] =
+"flock(fd, operation)\n\
+\n\
+Perform the lock operation op on file descriptor fd.  See the Unix \n\
+manual flock(3) for details.  (On some systems, this function is\n\
+emulated using fcntl().)";
+

 /* lockf(fd, operation) */
 static PyObject *
@@ -244,16 +269,29 @@
 	return Py_None;
 }

+static char lockf_doc [] =
+"lockf (fd, operation)\n\
+\n\
+This is a wrapper around the FCNTL.F_SETLK and FCNTL.F_SETLKW fcntl()\n\
+calls.  See the Unix manual for details.";
+
 /* List of functions */

 static PyMethodDef fcntl_methods[] = {
-	{"fcntl",	fcntl_fcntl},
-	{"ioctl",	fcntl_ioctl},
-	{"flock",	fcntl_flock},
-	{"lockf",       fcntl_lockf, 1},
+	{"fcntl",	fcntl_fcntl, 0, fcntl_doc},
+	{"ioctl",	fcntl_ioctl, 0, ioctl_doc},
+	{"flock",	fcntl_flock, 0, flock_doc},
+	{"lockf",       fcntl_lockf, 1, lockf_doc},
 	{NULL,		NULL}		/* sentinel */
 };

+
+static char module_doc [] =
+
+"This module performs file control and I/O control on file \n\
+descriptors.  It is an interface to the fcntl() and ioctl() Unix\n\
+routines.  File descriptors can be obtained with the fileno() method of\n\
+a file or socket object.";

 /* Module initialisation */

@@ -287,8 +325,8 @@
 {
 	PyObject *m, *d;

-	/* Create the module and add the functions */
-	m = Py_InitModule("fcntl", fcntl_methods);
+	/* Create the module and add the functions and documentation */
+	m = Py_InitModule3("fcntl", fcntl_methods, module_doc);

 	/* Add some symbolic constants to the module */
 	d = PyModule_GetDict(m);


sanctified

sanctified


More PyBytes -> PyString.

More PyBytes -> PyString.

--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -6568,11 +6568,11 @@
 	}

 	/* Allocate bytes */
-	result = PyBytes_FromStringAndSize(NULL, howMany);
+	result = PyString_FromStringAndSize(NULL, howMany);
 	if (result != NULL) {
 		/* Get random data */
 		if (! pCryptGenRandom(hCryptProv, howMany, (unsigned char*)
-				      PyBytes_AS_STRING(result))) {
+				      PyString_AS_STRING(result))) {
 			Py_DECREF(result);
 			return win32_error("CryptGenRandom", NULL);
 		}
@@ -6639,11 +6639,11 @@
 				    "negative argument not allowed");

 	/* Allocate bytes */
-	result = PyBytes_FromStringAndSize(NULL, howMany);
+	result = PyString_FromStringAndSize(NULL, howMany);
 	if (result != NULL) {
 		/* Get random data */
 		if (RAND_pseudo_bytes((unsigned char*)
-				      PyBytes_AS_STRING(result),
+				      PyString_AS_STRING(result),
 				      howMany) < 0) {
 			Py_DECREF(result);
 			return PyErr_Format(PyExc_ValueError,


instantaneous

instantaneous


update outdated comment

update outdated comment

--- Pod/Classes/PIAPIEnvironmentManager.h
+++ Pod/Classes/PIAPIEnvironmentManager.h
@@ -14,7 +14,7 @@
 /**
  * User defaults key for API Environment
  * To include environment switching in the Settings bundle, add an item with this key
- * Make sure items are numbered according to the enum defined in PIAPIEnvironment.h
+ * Values should correspond to the enviornment name set in PIAPIEnvironment
  */
 extern NSString *const kAPIEnvironmentNameUserDefaultsIdentifier;


Fix docstring to be consistent with parameter name (prefix)

--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -5130,7 +5130,7 @@
 PyDoc_STRVAR(posix_tempnam__doc__,
 "tempnam([dir[, prefix]]) -> string\n\n\
 Return a unique name for a temporary file.\n\
-The directory and a short may be specified as strings; they may be omitted\n\
+The directory and a prefix may be specified as strings; they may be omitted\n\
 or None if not needed.");

 static PyObject *


Changed NT -> MSC or WATCOM

Changed NT -> MSC or WATCOM

--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -1695,7 +1695,7 @@
 };

-#ifdef NT
+#if defined(_MSC_VER) || defined(__WATCOMC__)
 void
 initnt()
 {


draperied

draperied


angulateness

angulateness


undistractedness

undistractedness


x86: correct instructions related to REP prefix

--- arch/X86/X86Mapping.c
+++ arch/X86/X86Mapping.c
@@ -41789,36 +41789,30 @@
 		switch(id) {
 			default:
 				return false;
-			case X86_REP_MOVSB_32:
-			case X86_REP_MOVSW_32:
-			case X86_REP_MOVSD_32:
-			case X86_REP_MOVSB_64:
-			case X86_REP_MOVSD_64:
-			case X86_REP_MOVSQ_64:
-			case X86_REP_MOVSW_64:
+			case X86_INS_MOVSB:
+			case X86_INS_MOVSW:
+			//case X86_INS_MOVSD:
+			case X86_INS_MOVSQ:

 			case X86_INS_CMPSB:
 			case X86_INS_CMPSW:
-			case X86_INS_CMPSD:
+			//case X86_INS_CMPSD:
 			case X86_INS_CMPSQ:

 			case X86_INS_SCASB:
 			case X86_INS_SCASW:
-			case X86_INS_SCASD:
+			//case X86_INS_SCASD:
 			case X86_INS_SCASQ:

 			case X86_INS_LODSB:
 			case X86_INS_LODSW:
-			case X86_INS_LODSD:
+			//case X86_INS_LODSD:
 			case X86_INS_LODSQ:

-			case X86_REP_STOSB_32:
-			case X86_REP_STOSD_32:
-			case X86_REP_STOSW_32:
-			case X86_REP_STOSB_64:
-			case X86_REP_STOSD_64:
-			case X86_REP_STOSQ_64:
-			case X86_REP_STOSW_64:
+			case X86_INS_STOSB:
+			case X86_INS_STOSW:
+			//case X86_INS_STOSD:
+			case X86_INS_STOSQ:

 			case X86_INS_INSB:
 			case X86_INS_INSW:


Locker relies on Proxy now

Locker relies on Proxy now

--- CosStd/src/Tracer.c
+++ CosStd/src/Tracer.c
@@ -29,7 +29,7 @@
  |
  o---------------------------------------------------------------------o
  |
- | $Id: Tracer.c,v 1.8 2009/09/21 09:49:38 ldeniau Exp $
+ | $Id: Tracer.c,v 1.9 2009/09/21 09:51:05 ldeniau Exp $
  |
 */

@@ -68,13 +68,15 @@

 // ----- behavior

-// rank 1
+// ----- rank 1
+
 defmethod(void, gunrecognizedMessage1, Tracer)
   trace(self, _sel, (OBJ[]){self->Proxy.obj}, 1);
   next_method(self);
 endmethod

-// rank 2
+// ----- rank 2
+
 defmethod(void, gunrecognizedMessage2, Tracer, Object)
   trace(self, _sel, (OBJ[]){self->Proxy.obj, _2}, 1);
   next_method(self,self2);
@@ -85,7 +87,8 @@
   next_method(self,self2);
 endmethod

-// rank 3
+// ----- rank 3
+
 defmethod(void, gunrecognizedMessage3, Tracer, Object, Object)
   trace(self, _sel, (OBJ[]){self->Proxy.obj, _2, _3}, 1);
   next_method(self,self2,self3);
@@ -101,7 +104,8 @@
   next_method(self,self2,self3);
 endmethod

-// rank 4
+// ----- rank 4
+
 defmethod(void, gunrecognizedMessage4, Tracer, Object, Object, Object)
   trace(self, _sel, (OBJ[]){self->Proxy.obj, _2, _3, _4}, 1);
   next_method(self,self2,self3,self4);
@@ -122,7 +126,8 @@
   next_method(self,self2,self3,self4);
 endmethod

-// rank 5
+// ----- rank 5
+
 defmethod(void, gunrecognizedMessage5, Tracer, Object, Object, Object, Object)
   trace(self, _sel, (OBJ[]){self->Proxy.obj, _2, _3, _4, _5}, 1);
   next_method(self,self2,self3,self4,self5);


virtio 1.0: NetKVM: removing from osdep.h types already defined in linux/types.h

Signed-off-by: Yan Vugenfirer <42a2f19fc0e2f936689088d7ea4bb1f2d7be23d6@redhat.com>

--- NetKVM/Common/osdep.h
+++ NetKVM/Common/osdep.h
@@ -32,12 +32,6 @@
 #define _Acquires_exclusive_lock_(lock)
 #endif

-#define u8 unsigned char
-#define u16 unsigned short
-#define u32 unsigned long
-#define u64 ULONGLONG
-
-
 #define mb()   KeMemoryBarrier()
 #define rmb()  KeMemoryBarrier()
 #define wmb()  KeMemoryBarrier()


more FF_FSA_DEBUG logs

more FF_FSA_DEBUG logs

git-svn-id: 357248c53bdac2d7b36f7ee045286eb205fcf757@388 ec762483-ff6d-05da-a07a-a48fb63a330f

--- decoder/ff_from_fsa.h
+++ decoder/ff_from_fsa.h
@@ -141,7 +141,7 @@
                                       const void* residual_state,
                                       FeatureVector* final_features) const
   {
-    ff.init_features(final_features); // estimated_features is fresh
+    ff.init_features(final_features);
     Sentence const& ends=ff.end_phrase();
     if (!ssz) {
       AccumFeatures(ff,smeta,begin(ends),end(ends),final_features,0);
@@ -150,19 +150,23 @@
     SP ss=ff.start_state();
     WP l=(WP)residual_state,lend=left_end(residual_state);
     SP rst=fsa_state(residual_state);
+    FSAFFDBG("(FromFsa) Final "<<name);
     if (lend==rst) { // implying we have an fsa state
       AccumFeatures(ff,smeta,l,lend,final_features,ss); // e.g. <s> score(full left unscored phrase)
+      FSAFFDBG(" left: "<<Sentence(l,lend));
       AccumFeatures(ff,smeta,begin(ends),end(ends),final_features,rst); // e.g. [ctx for last M words] score("</s>")
+      FSAFFDBG(" right: "<<ff.describe_state(rst)<<" -> "<<ends);
     } else { // all we have is a single short phrase < M words before adding ends
       int nl=lend-l;
       Sentence whole(ends.size()+nl);
       WordID *w=begin(whole);
       wordcpy(w,l,nl);
       wordcpy(w+nl,begin(ends),ends.size());
+      FSAFFDBG(" score whole sentence: "<<whole);
       // whole = left-words + end-phrase
       AccumFeatures(ff,smeta,w,end(whole),final_features,ss);
     }
-    FSAFFDBG("Final "<<name<<" = "<<*final_features<<'\n');
+    FSAFFDBG(" = "<<*final_features<<'\n');
   }

   bool rule_feature() const {


ecryptfs: dont call lookup_one_len to avoid NULL nameidata

I have encountered the same problem that Eric Sandeen described in
this post

 http://lkml.org/lkml/fancy/2010/4/23/467

while experimenting with stackable filesystems.

The reason seems to be that ecryptfs calls lookup_one_len() to get the
lower dentry, which in turn calls the lower parent dirs d_revalidate()
with a NULL nameidata object.
If ecryptfs is the underlaying filesystem, the NULL pointer dereference
occurs, since ecryptfs is not prepared to handle a NULL nameidata.

I know that this cant happen any more, since it is no longer allowed to
mount ecryptfs upon itself.

But maybe this patch it useful nevertheless, since the problem would still
apply for an underlaying filesystem that implements d_revalidate() and is
not prepared to handle a NULL nameidata (I dont know if there actually
is such a fs).

With this patch (against 2.6.35-rc5) ecryptfs uses the vfs_lookup_path()
function instead of lookup_one_len() which ensures that the nameidata
passed to the lower filesystems d_revalidate().

Signed-off-by: Lino Sanfilippo <ff19ebaea67c281c47b9efdbbdfaf0dd57d98f08@gmx.de>
Signed-off-by: Tyler Hicks <93eeee00a2beb1fbd6106ad8f59025f171ca91c6@linux.vnet.ibm.com>

--- fs/ecryptfs/inode.c
+++ fs/ecryptfs/inode.c
@@ -348,6 +348,76 @@
 }

 /**
+ * ecryptfs_new_lower_dentry
+ * @ename: The name of the new dentry.
+ * @lower_dir_dentry: Parent directory of the new dentry.
+ * @nd: nameidata from last lookup.
+ *
+ * Create a new dentry or get it from lower parent dir.
+ */
+static struct dentry *
+ecryptfs_new_lower_dentry(struct qstr *name, struct dentry *lower_dir_dentry,
+			  struct nameidata *nd)
+{
+	struct dentry *new_dentry;
+	struct dentry *tmp;
+	struct inode *lower_dir_inode;
+
+	lower_dir_inode = lower_dir_dentry->d_inode;
+
+	tmp = d_alloc(lower_dir_dentry, name);
+	if (!tmp)
+		return ERR_PTR(-ENOMEM);
+
+	mutex_lock(&lower_dir_inode->i_mutex);
+	new_dentry = lower_dir_inode->i_op->lookup(lower_dir_inode, tmp, nd);
+	mutex_unlock(&lower_dir_inode->i_mutex);
+
+	if (!new_dentry)
+		new_dentry = tmp;
+	else
+		dput(tmp);
+
+	return new_dentry;
+}
+
+
+/**
+ * ecryptfs_lookup_one_lower
+ * @ecryptfs_dentry: The eCryptfs dentry that we are looking up
+ * @lower_dir_dentry: lower parent directory
+ *
+ * Get the lower dentry from vfs. If lower dentry does not exist yet,
+ * create it.
+ */
+static struct dentry *
+ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry,
+			  struct dentry *lower_dir_dentry)
+{
+	struct nameidata nd;
+	struct vfsmount *lower_mnt;
+	struct qstr *name;
+	int err;
+
+	name = &ecryptfs_dentry->d_name;
+	lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt(
+				    ecryptfs_dentry->d_parent));
+	err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd);
+	mntput(lower_mnt);
+
+	if (!err) {
+		/* we dont need the mount */
+		mntput(nd.path.mnt);
+		return nd.path.dentry;
+	}
+	if (err != -ENOENT)
+		return ERR_PTR(err);
+
+	/* create a new lower dentry */
+	return ecryptfs_new_lower_dentry(name, lower_dir_dentry, &nd);
+}
+
+/**
  * ecryptfs_lookup
  * @ecryptfs_dir_inode: The eCryptfs directory inode
  * @ecryptfs_dentry: The eCryptfs dentry that we are looking up
@@ -374,14 +444,12 @@
 		goto out_d_drop;
 	}
 	lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent);
-	mutex_lock(&lower_dir_dentry->d_inode->i_mutex);
-	lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name,
-				      lower_dir_dentry,
-				      ecryptfs_dentry->d_name.len);
-	mutex_unlock(&lower_dir_dentry->d_inode->i_mutex);
+
+	lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry,
+						 lower_dir_dentry);
 	if (IS_ERR(lower_dentry)) {
 		rc = PTR_ERR(lower_dentry);
-		ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
+		ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned "
 				"[%d] on lower_dentry = [%s]\n", __func__, rc,
 				encrypted_and_encoded_name);
 		goto out_d_drop;
@@ -403,14 +471,11 @@
 		       "filename; rc = [%d]\n", __func__, rc);
 		goto out_d_drop;
 	}
-	mutex_lock(&lower_dir_dentry->d_inode->i_mutex);
-	lower_dentry = lookup_one_len(encrypted_and_encoded_name,
-				      lower_dir_dentry,
-				      encrypted_and_encoded_name_size - 1);
-	mutex_unlock(&lower_dir_dentry->d_inode->i_mutex);
+	lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry,
+						 lower_dir_dentry);
 	if (IS_ERR(lower_dentry)) {
 		rc = PTR_ERR(lower_dentry);
-		ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned "
+		ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned "
 				"[%d] on lower_dentry = [%s]\n", __func__, rc,
 				encrypted_and_encoded_name);
 		goto out_d_drop;


Fix off-by-1 error in assert.

Fix off-by-1 error in assert.

Submitted by:	Tycho Nightingale (tycho.nightingale@pluribusnetworks.com)


Began drawing code.

Began drawing code.

--- scrlock.c
+++ scrlock.c
@@ -248,6 +248,20 @@
     }
 }

+static void draw_window(struct screen_t* scr, const char* msg, xcb_gcontext_t gc)
+{
+    xcb_rectangle_t bg;
+
+    bg.x = bg.y = 0;
+    bg.width  = scr->xcb->width_in_pixels;
+    bg.height = scr->xcb->height_in_pixels;
+    xcb_poly_fill_rectangle(scr->c, scr->win, gc, 1, &bg);
+
+    if(msg) {
+        /* TODO draw msg. */
+    }
+}
+
 static void mainloop(struct screen_t* scrs, const char* pws)
 {
     xcb_connection_t* c = scrs->c;
@@ -266,9 +280,17 @@
     running = 1;
     while(running && (ev = xcb_wait_for_event(c))) {
         evtype = ev->response_type & ~0x80;
+        /* Drawing the windows. */
         if(evtype == XCB_EXPOSE) {
-            /* TODO draw screens */
-        } else if(evtype == XCB_KEY_PRESS) {
+            struct screen_t* act = scrs;
+            while(act) {
+                draw_window(act, passwd, act->fg);
+                act = act->next;
+            }
+        }
+
+        /* Handling the keyboard events. */
+        else if(evtype == XCB_KEY_PRESS) {
             keypress = (xcb_key_press_event_t*)ev;
             symbol   = xcb_key_press_lookup_keysym(syms, keypress, 0);

@@ -277,6 +299,7 @@
                 running = 0;
         }
         free(ev);
+        xcb_flush(c);
     }

     xcb_key_symbols_free(syms);


Finished backspace function

Finished backspace function

--- wynaut.c
+++ wynaut.c
@@ -264,6 +264,21 @@
 	E.dirty++;
 }

+// frees from memory a given row and the chars in it
+void editorFreeRow(erow* row){
+	free(row->render);
+	free(row->chars);
+}
+
+// handles deleting a char if it happens to be the start of the row
+void editorDelRow(int at){
+	if (at < 0 || at >= E.numrows) return;
+	editorFreeRow(&E.row[at]);
+	memmove(&E.row[at],&E.row[at+1],sizeof(erow)*(E.numrows-at-1));
+	E.numrows--;
+	E.dirty++;
+}
+
 // deletes characters given position
 void editorRowDelChar(erow* row, int at){
 	if(at<0 || at >= row->size) return;
@@ -290,6 +305,15 @@
 	E.dirty++;
 }

+void editorRowAppendString(erow* row, char* s, size_t len){
+	row->chars = realloc(row->chars,row->size +len+1);
+	memcpy(&row->chars[row->size],s,len);
+	row->size += len;
+	row->chars[row->size] = '\0';
+	editorUpdateRow(row);
+	E.dirty++;
+}
+
 /** editor operations **/

 // Deals with where the cursor is and adds a char
@@ -304,10 +328,17 @@
 // Mapped to Backspace character
 void editorDelChar(){
 	if(E.cy == E.numrows) return;
+	if(E.cx==0 && E.cy == 0)return;
 	erow* row = &E.row[E.cy];
 	if (E.cx >0){
 		editorRowDelChar(row,E.cx-1);
 		E.cx--;
+	}
+	else{ // moves everything to the end of the last line and deletes current row
+		E.cx = E.row[E.cy-1].size;
+		editorRowAppendString(&E.row[E.cy-1],row->chars,row->size);
+		editorDelRow(E.cy);
+		E.cy--;
 	}
 }


[arch][arm-m] Implement quiesce and chain load for arm-m

--- arch/arm/arm-m/arch.c
+++ arch/arm/arm-m/arch.c
@@ -105,6 +105,9 @@

 void arch_quiesce(void)
 {
+#if ARM_WITH_CACHE
+    arch_disable_cache(UCACHE);
+#endif
 }

 void arch_idle(void)
@@ -163,5 +166,29 @@

 void arch_chain_load(void *entry, ulong arg0, ulong arg1, ulong arg2, ulong arg3)
 {
+#if (__CORTEX_M >= 0x03)
+
+    uint32_t *vectab = (uint32_t *)entry;
+
+    __asm__ volatile(
+        "mov r0,  %[arg0]; "
+        "mov r1,  %[arg1]; "
+        "mov r2,  %[arg2]; "
+        "mov r3,  %[arg3]; "
+        "mov sp,  %[SP]; "
+        "bx  %[entry]; "
+        :
+        : [arg0]"r"(arg0),
+          [arg1]"r"(arg1),
+          [arg2]"r"(arg2),
+          [arg3]"r"(arg3),
+          [SP]"r"(vectab[0]),
+          [entry]"r"(vectab[1])
+        : "r0", "r1", "r2", "r3"
+    );
+
+    __UNREACHABLE;
+#else
     PANIC_UNIMPLEMENTED;
+#endif
 }


"dingledangle"

"dingledangle"


i#2985 drx_expand_scatter_gather(): Remove unnecessary workaround. (#3924)

This patch removes a workaround that was conservatively put in place for spilling
cross-app instructions. As discussed in #3899, the workaround is not needed.

Allocates an additional slot per reserved cross-app register as required by drreg.

Issues: #2985, #3899

--- ext/drx/drx.c
+++ ext/drx/drx.c
@@ -2203,7 +2203,11 @@
      * mask register as well as a temp xmm register.
      */
     if (!expand_scatter_gather_drreg_initialized) {
-        drreg_options_t ops = { sizeof(ops), 3, false, NULL, true };
+        /* We're requesting 3 slots for 3 gprs plus 3 additional ones because they are
+         * used cross-app. The additional slots are needed if drreg needs to move the
+         * values as documented in drreg.
+         */
+        drreg_options_t ops = { sizeof(ops), 3 + 3, false, NULL, true };
         if (drreg_init(&ops) != DRREG_SUCCESS)
             return false;
         expand_scatter_gather_drreg_initialized = true;
@@ -2218,13 +2222,6 @@
      * same time. Do not use.
      */
     drreg_set_vector_entry(&allowed, sg_info.base_reg, false);
-    /* FIXME i#2985: these registers are reserved for client.drx-scattergather. This is a
-     * temporary hack due to the fact that drx is not yet able to restore the state across
-     * app instructions.
-     */
-    drreg_set_vector_entry(&allowed, DR_REG_XAX, false);
-    drreg_set_vector_entry(&allowed, DR_REG_XCX, false);
-    drreg_set_vector_entry(&allowed, DR_REG_XDX, false);
     if (drreg_reserve_aflags(drcontext, bb, sg_instr) != DRREG_SUCCESS)
         goto drx_expand_scatter_gather_exit;
     if (drreg_reserve_register(drcontext, bb, sg_instr, &allowed, &scratch_reg0) !=


eCryptfs: initialize persistent lower file on inode create

Initialize persistent lower file on inode create.

Signed-off-by: Michael Halcrow <8c1011c9d06fc72acd93645d683782ab9543044d@us.ibm.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- fs/ecryptfs/super.c
+++ fs/ecryptfs/super.c
@@ -47,15 +47,16 @@
  */
 static struct inode *ecryptfs_alloc_inode(struct super_block *sb)
 {
-	struct ecryptfs_inode_info *ecryptfs_inode;
+	struct ecryptfs_inode_info *inode_info;
 	struct inode *inode = NULL;

-	ecryptfs_inode = kmem_cache_alloc(ecryptfs_inode_info_cache,
-					  GFP_KERNEL);
-	if (unlikely(!ecryptfs_inode))
+	inode_info = kmem_cache_alloc(ecryptfs_inode_info_cache, GFP_KERNEL);
+	if (unlikely(!inode_info))
 		goto out;
-	ecryptfs_init_crypt_stat(&ecryptfs_inode->crypt_stat);
-	inode = &ecryptfs_inode->vfs_inode;
+	ecryptfs_init_crypt_stat(&inode_info->crypt_stat);
+	mutex_init(&inode_info->lower_file_mutex);
+	inode_info->lower_file = NULL;
+	inode = &inode_info->vfs_inode;
 out:
 	return inode;
 }


dont let the antisemaphore clear the WAITING flag so NO_CCB doesnt cause
us to loop forever.

follow sdstart through to to an adapters scsi_cmd handler and assume that
handler returns NO_CCB to enjoy the bug in full.

ok kettenis@ krw@ beck@


fix wrong merge in [996] and [451], [454]

git-svn-id: 88e1a00e4eab3b0bb0c09889526309a3e2f5bd8a@455 c26eb9a1-5813-0410-bd6c-c2e55f420ca7

--- xcache.c
+++ xcache.c
@@ -993,12 +993,6 @@
 	}

 	if (!XG(initial_compile_file_called)) {
-		xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
-		ENTER_LOCK(cache) {
-			cache->compiling = 0;
-			/* it's not cachable, but don't scare the users with high misses */
-			cache->misses --;
-		} LEAVE_LOCK(cache);
 		return op_array;
 	}

@@ -1313,6 +1307,8 @@
 		/* not cachable */
 		if (!php.op_array) {
 			cache->compiling = 0;
+			/* it's not cachable, but don't scare the users with high misses */
+			cache->misses --;
 			xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);
 			return op_array;
 		}