[ofw] [Patch 1/3 ][ALL] Moving "shutter.h" under different location
Alex Naslednikov
xalex at mellanox.co.il
Mon Jan 25 10:48:41 PST 2010
This patches moves shutter.h from hw/mlx4/kernel/inc/ to inc/kernel
Signed-off by: Alexander Naslednikov (xalex at mellanox.com),
Tzachi Dar (tzachid at mellanox.com)
Index: hw/mlx4/kernel/inc/shutter.h
===================================================================
--- hw/mlx4/kernel/inc/shutter.h (revision 5435)
+++ hw/mlx4/kernel/inc/shutter.h (working copy)
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
- *
- * This software is available to you under the OpenIB.org BSD license
- * below:
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- * - Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
- *
- * - Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * $Id: shutter.h 1611 2006-08-20 14:48:55Z sleybo $
- */
-
-
-#pragma once
-
-
-// Define the max numbers of operations that can be simultaniously done
-#define MAX_OPERATIONS 0x10000000
-
-typedef struct _shutter_t {
- long cnt;
- KEVENT event;
-
-} shutter_t;
-
-static inline void shutter_init(shutter_t* p_shutter)
-{
- p_shutter->cnt = 0;
- KeInitializeEvent( &p_shutter->event, SynchronizationEvent, FALSE );
-}
-
-
-static inline void shutter_sub(shutter_t * p_shutter,long Val)
-{
- long res = 0;
- ASSERT(Val < 0);
- res = InterlockedExchangeAdd( &p_shutter->cnt,Val );
- if ((res+Val) == -MAX_OPERATIONS)
- KeSetEvent( &p_shutter->event, 0, FALSE );
-}
-
-// if RC == true, one can proceed
-static inline BOOLEAN shutter_add(shutter_t * p_shutter,long Val)
-{
- long res = 0;
- ASSERT(Val > 0);
- res = InterlockedExchangeAdd(&p_shutter->cnt,Val);
- ASSERT(res <= MAX_OPERATIONS);
- if (res < 0 )
- {
- shutter_sub(p_shutter, -Val);
- return FALSE;
- }
- return TRUE;
-}
-
-static inline void shutter_loose(shutter_t * p_shutter)
-{
- long res = InterlockedDecrement( &p_shutter->cnt );
- if (res == -MAX_OPERATIONS)
- KeSetEvent( &p_shutter->event, 0, FALSE );
-}
-
-// if RC > 0, one can proceed
-static inline int shutter_use(shutter_t * p_shutter)
-{
- long res = InterlockedIncrement( &p_shutter->cnt );
- ASSERT(res <= MAX_OPERATIONS);
- if (res <= 0 )
- shutter_loose( p_shutter ); // The object is in shutdown
- return res;
-}
-
-
-static inline void shutter_shut(shutter_t * p_shutter)
-{
- long res = 0;
- //
- // ASSERT not calling shu twice.
- //
- ASSERT(p_shutter->cnt - MAX_OPERATIONS >= (-MAX_OPERATIONS));
-
- // Mark the counter as locked
- res = InterlockedExchangeAdd(&p_shutter->cnt, -MAX_OPERATIONS);
- ASSERT(res >= 0);
- if (res)
- // We are now waiting for the object to reach -MAX_OPERATIONS
- KeWaitForSingleObject( &p_shutter->event, Executive, KernelMode, FALSE, NULL );
-}
-
-static inline void shutter_alive(shutter_t * p_shutter)
-{
- long res = 0;
-
- // Mark the counter as alive
- res = InterlockedExchangeAdd(&p_shutter->cnt, MAX_OPERATIONS);
- ASSERT(res < 0);
-}
-
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100125/219a289d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shutter_MPE_patch_1_of_3.patch
Type: application/octet-stream
Size: 3942 bytes
Desc: shutter_MPE_patch_1_of_3.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100125/219a289d/attachment.obj>
More information about the ofw
mailing list