Add error path to RangeSetPop()

Now that RangeSetPop() is being used to backend grant table allocations
it's legitimate for it to fail.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Merge pull request #19 from pauldu/master

Add error path to RangeSetPop()
[SCTX-1104] Add WindowsPEMode to xenfilt

ParentIdPrefixes are not avilable at Windows PE driver filtering time,
but we don't actually need them if we know emulated devices will be
unplugged, so, if ParentIdPrefix can't be read from the registry and
HKLM\System\CurrentControlSet\Services\xenfilt\WindowsPEMode is set to 1
then just set the prefix to be an empty string and continue

We never set WindowsPEMode anywhere except in the sample Windows PE
scripts, so non-WindowsPE environments are unaffected

Signed-off-by: Ben Chalmers <Ben.Chalmers@citrix.com>
RangeSet fixes

- add spinlock to protect rangesets.
- add a Count value to check against empty condition in audit.
- use LONGLONG in ranges rather than ULONGLONG so that ranges can be
  invalidated by setting Start > End.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Merge pull request #20 from benchalmers/pe4

[SCTX-1104] Add WindowsPEMode to xenfilt
Merge pull request #21 from pauldu/master

RangeSet fixes

Approved-By: Ben Chalmers <Ben.Chalmers@citrix.com>
Add FIST capability for pools

By setting xenstore parameters 'fist/pool/<name>/defer' to X and
'fist/pool/<name>/probability' to Y you can now cause failures of PoolGet()
such that it will fail with probability Y% after X initial invocations.
The name of the grant table pool has been set to 'gnttab' to make typing it
in more convenients, and some debug-keys output has been added to give
the PoolGet() failure count.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Merge branch 'master' of github.com:xenserver/win-xenbus
Merge pull request #22 from pauldu/fist

FIST

Approved-By: Ben Chalmers <Ben.Chalmers@citrix.com>
Fix RangeSet cursor problem

When the last or first range in the set is removed then the cursor may end
up pointing back at the anchor point. This confused RangeSetPop() so we
need to make sure that the cursor wraps round when this happens, such that
the only valid reason for the cursor to ever point at the anchor is when
the set goes empty.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Add magic number and bounds checking...

... for event channel and grant table descriptors.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Merge pull request #23 from pauldu/ca-134511

CA-134511
Resync with upstream tip