Xext: sync: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros
Use the new macros to make request struct parsing / field swapping much easier. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
034791c693
commit
5cded6356d
378
Xext/sync.c
378
Xext/sync.c
|
@ -59,6 +59,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <X11/extensions/syncproto.h>
|
#include <X11/extensions/syncproto.h>
|
||||||
|
|
||||||
#include "dix/dix_priv.h"
|
#include "dix/dix_priv.h"
|
||||||
|
#include "dix/request_priv.h"
|
||||||
#include "os/bug_priv.h"
|
#include "os/bug_priv.h"
|
||||||
#include "os/osdep.h"
|
#include "os/osdep.h"
|
||||||
|
|
||||||
|
@ -1267,6 +1268,8 @@ FreeAlarmClient(void *value, XID id)
|
||||||
static int
|
static int
|
||||||
ProcSyncInitialize(ClientPtr client)
|
ProcSyncInitialize(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xSyncInitializeReq);
|
||||||
|
|
||||||
xSyncInitializeReply rep = {
|
xSyncInitializeReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -1275,8 +1278,6 @@ ProcSyncInitialize(ClientPtr client)
|
||||||
.minorVersion = SERVER_SYNC_MINOR_VERSION,
|
.minorVersion = SERVER_SYNC_MINOR_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncInitializeReq);
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
}
|
}
|
||||||
|
@ -1290,6 +1291,8 @@ ProcSyncInitialize(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncListSystemCounters(ClientPtr client)
|
ProcSyncListSystemCounters(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xSyncListSystemCountersReq);
|
||||||
|
|
||||||
xSyncListSystemCountersReply rep = {
|
xSyncListSystemCountersReply rep = {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -1299,8 +1302,6 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
int len = 0;
|
int len = 0;
|
||||||
xSyncSystemCounter *list = NULL, *walklist = NULL;
|
xSyncSystemCounter *list = NULL, *walklist = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
|
|
||||||
|
|
||||||
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
|
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
|
||||||
/* pad to 4 byte boundary */
|
/* pad to 4 byte boundary */
|
||||||
len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
|
len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
|
||||||
|
@ -1361,12 +1362,13 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncSetPriority(ClientPtr client)
|
ProcSyncSetPriority(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncSetPriorityReq);
|
REQUEST_HEAD_STRUCT(xSyncSetPriorityReq);
|
||||||
|
REQUEST_FIELD_CARD32(id);
|
||||||
|
REQUEST_FIELD_CARD32(priority);
|
||||||
|
|
||||||
ClientPtr priorityclient;
|
ClientPtr priorityclient;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
|
|
||||||
|
|
||||||
if (stuff->id == None)
|
if (stuff->id == None)
|
||||||
priorityclient = client;
|
priorityclient = client;
|
||||||
else {
|
else {
|
||||||
|
@ -1396,13 +1398,13 @@ ProcSyncSetPriority(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncGetPriority(ClientPtr client)
|
ProcSyncGetPriority(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncGetPriorityReq);
|
REQUEST_HEAD_STRUCT(xSyncGetPriorityReq);
|
||||||
|
REQUEST_FIELD_CARD32(id);
|
||||||
|
|
||||||
xSyncGetPriorityReply rep;
|
xSyncGetPriorityReply rep;
|
||||||
ClientPtr priorityclient;
|
ClientPtr priorityclient;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
|
|
||||||
|
|
||||||
if (stuff->id == None)
|
if (stuff->id == None)
|
||||||
priorityclient = client;
|
priorityclient = client;
|
||||||
else {
|
else {
|
||||||
|
@ -1435,10 +1437,12 @@ ProcSyncGetPriority(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncCreateCounter(ClientPtr client)
|
ProcSyncCreateCounter(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncCreateCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncCreateCounterReq);
|
||||||
int64_t initial;
|
REQUEST_FIELD_CARD32(cid);
|
||||||
|
REQUEST_FIELD_CARD32(initial_value_lo);
|
||||||
|
REQUEST_FIELD_CARD32(initial_value_hi);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
|
int64_t initial;
|
||||||
|
|
||||||
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
LEGAL_NEW_RESOURCE(stuff->cid, client);
|
||||||
|
|
||||||
|
@ -1456,13 +1460,15 @@ ProcSyncCreateCounter(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncSetCounter(ClientPtr client)
|
ProcSyncSetCounter(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncSetCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncSetCounterReq);
|
||||||
|
REQUEST_FIELD_CARD32(cid);
|
||||||
|
REQUEST_FIELD_CARD32(value_lo);
|
||||||
|
REQUEST_FIELD_CARD32(value_hi);
|
||||||
|
|
||||||
SyncCounter *pCounter;
|
SyncCounter *pCounter;
|
||||||
int64_t newvalue;
|
int64_t newvalue;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
|
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
|
||||||
client, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1484,14 +1490,16 @@ ProcSyncSetCounter(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncChangeCounter(ClientPtr client)
|
ProcSyncChangeCounter(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncChangeCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncChangeCounterReq);
|
||||||
|
REQUEST_FIELD_CARD32(cid);
|
||||||
|
REQUEST_FIELD_CARD32(value_lo);
|
||||||
|
REQUEST_FIELD_CARD32(value_hi);
|
||||||
|
|
||||||
SyncCounter *pCounter;
|
SyncCounter *pCounter;
|
||||||
int64_t newvalue;
|
int64_t newvalue;
|
||||||
Bool overflow;
|
Bool overflow;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
|
rc = dixLookupResourceByType((void **) &pCounter, stuff->cid, RTCounter,
|
||||||
client, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1519,12 +1527,12 @@ ProcSyncChangeCounter(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncDestroyCounter(ClientPtr client)
|
ProcSyncDestroyCounter(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncDestroyCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncDestroyCounterReq);
|
||||||
|
REQUEST_FIELD_CARD32(counter);
|
||||||
|
|
||||||
SyncCounter *pCounter;
|
SyncCounter *pCounter;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
|
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
|
||||||
RTCounter, client, DixDestroyAccess);
|
RTCounter, client, DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1600,7 +1608,9 @@ SyncAwaitEpilogue(ClientPtr client, int items, SyncAwaitUnion * pAwaitUnion)
|
||||||
static int
|
static int
|
||||||
ProcSyncAwait(ClientPtr client)
|
ProcSyncAwait(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncAwaitReq);
|
REQUEST_HEAD_AT_LEAST(xSyncAwaitReq);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
int len, items;
|
int len, items;
|
||||||
int i;
|
int i;
|
||||||
xSyncWaitCondition *pProtocolWaitConds;
|
xSyncWaitCondition *pProtocolWaitConds;
|
||||||
|
@ -1608,8 +1618,6 @@ ProcSyncAwait(ClientPtr client)
|
||||||
SyncAwait *pAwait;
|
SyncAwait *pAwait;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
|
|
||||||
|
|
||||||
len = client->req_len << 2;
|
len = client->req_len << 2;
|
||||||
len -= sz_xSyncAwaitReq;
|
len -= sz_xSyncAwaitReq;
|
||||||
items = len / sz_xSyncWaitCondition;
|
items = len / sz_xSyncWaitCondition;
|
||||||
|
@ -1680,13 +1688,13 @@ ProcSyncAwait(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncQueryCounter(ClientPtr client)
|
ProcSyncQueryCounter(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncQueryCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncQueryCounterReq);
|
||||||
|
REQUEST_FIELD_CARD32(counter);
|
||||||
|
|
||||||
xSyncQueryCounterReply rep;
|
xSyncQueryCounterReply rep;
|
||||||
SyncCounter *pCounter;
|
SyncCounter *pCounter;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
|
rc = dixLookupResourceByType((void **) &pCounter, stuff->counter,
|
||||||
RTCounter, client, DixReadAccess);
|
RTCounter, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1722,14 +1730,16 @@ ProcSyncQueryCounter(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncCreateAlarm(ClientPtr client)
|
ProcSyncCreateAlarm(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncCreateAlarmReq);
|
REQUEST_HEAD_AT_LEAST(xSyncCreateAlarmReq);
|
||||||
|
REQUEST_FIELD_CARD32(id);
|
||||||
|
REQUEST_FIELD_CARD32(valueMask);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
SyncAlarm *pAlarm;
|
SyncAlarm *pAlarm;
|
||||||
int status;
|
int status;
|
||||||
unsigned long len, vmask;
|
unsigned long len, vmask;
|
||||||
SyncTrigger *pTrigger;
|
SyncTrigger *pTrigger;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
|
|
||||||
|
|
||||||
LEGAL_NEW_RESOURCE(stuff->id, client);
|
LEGAL_NEW_RESOURCE(stuff->id, client);
|
||||||
|
|
||||||
vmask = stuff->valueMask;
|
vmask = stuff->valueMask;
|
||||||
|
@ -1805,14 +1815,16 @@ ProcSyncCreateAlarm(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncChangeAlarm(ClientPtr client)
|
ProcSyncChangeAlarm(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncChangeAlarmReq);
|
REQUEST_HEAD_AT_LEAST(xSyncChangeAlarmReq);
|
||||||
|
REQUEST_FIELD_CARD32(alarm);
|
||||||
|
REQUEST_FIELD_CARD32(valueMask);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
SyncAlarm *pAlarm;
|
SyncAlarm *pAlarm;
|
||||||
SyncCounter *pCounter = NULL;
|
SyncCounter *pCounter = NULL;
|
||||||
long vmask;
|
long vmask;
|
||||||
int len, status;
|
int len, status;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
|
|
||||||
|
|
||||||
status = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
status = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
||||||
client, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
|
@ -1846,14 +1858,14 @@ ProcSyncChangeAlarm(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncQueryAlarm(ClientPtr client)
|
ProcSyncQueryAlarm(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncQueryAlarmReq);
|
REQUEST_HEAD_STRUCT(xSyncQueryAlarmReq);
|
||||||
|
REQUEST_FIELD_CARD32(alarm);
|
||||||
|
|
||||||
SyncAlarm *pAlarm;
|
SyncAlarm *pAlarm;
|
||||||
xSyncQueryAlarmReply rep;
|
xSyncQueryAlarmReply rep;
|
||||||
SyncTrigger *pTrigger;
|
SyncTrigger *pTrigger;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
||||||
client, DixReadAccess);
|
client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1905,13 +1917,12 @@ ProcSyncQueryAlarm(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncDestroyAlarm(ClientPtr client)
|
ProcSyncDestroyAlarm(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
REQUEST_HEAD_STRUCT(xSyncDestroyAlarmReq);
|
||||||
|
REQUEST_FIELD_CARD32(alarm);
|
||||||
|
|
||||||
SyncAlarm *pAlarm;
|
SyncAlarm *pAlarm;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xSyncDestroyAlarmReq);
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
rc = dixLookupResourceByType((void **) &pAlarm, stuff->alarm, RTAlarm,
|
||||||
client, DixDestroyAccess);
|
client, DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1924,13 +1935,14 @@ ProcSyncDestroyAlarm(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncCreateFence(ClientPtr client)
|
ProcSyncCreateFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncCreateFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncCreateFenceReq);
|
||||||
|
REQUEST_FIELD_CARD32(d);
|
||||||
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
DrawablePtr pDraw;
|
DrawablePtr pDraw;
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
|
|
||||||
|
|
||||||
rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess);
|
rc = dixLookupDrawable(&pDraw, stuff->d, client, M_ANY, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -1970,12 +1982,12 @@ SyncVerifyFence(SyncFence ** ppSyncFence, XID fid, ClientPtr client, Mask mode)
|
||||||
static int
|
static int
|
||||||
ProcSyncTriggerFence(ClientPtr client)
|
ProcSyncTriggerFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncTriggerFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncTriggerFenceReq);
|
||||||
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
||||||
client, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -1989,12 +2001,12 @@ ProcSyncTriggerFence(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncResetFence(ClientPtr client)
|
ProcSyncResetFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncResetFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncResetFenceReq);
|
||||||
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
||||||
client, DixWriteAccess);
|
client, DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -2011,12 +2023,12 @@ ProcSyncResetFence(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncDestroyFence(ClientPtr client)
|
ProcSyncDestroyFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncDestroyFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncDestroyFenceReq);
|
||||||
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
rc = dixLookupResourceByType((void **) &pFence, stuff->fid, RTFence,
|
||||||
client, DixDestroyAccess);
|
client, DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -2029,13 +2041,13 @@ ProcSyncDestroyFence(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncQueryFence(ClientPtr client)
|
ProcSyncQueryFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncQueryFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncQueryFenceReq);
|
||||||
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
xSyncQueryFenceReply rep;
|
xSyncQueryFenceReply rep;
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
|
|
||||||
|
|
||||||
rc = dixLookupResourceByType((void **) &pFence, stuff->fid,
|
rc = dixLookupResourceByType((void **) &pFence, stuff->fid,
|
||||||
RTFence, client, DixReadAccess);
|
RTFence, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -2061,7 +2073,9 @@ ProcSyncQueryFence(ClientPtr client)
|
||||||
static int
|
static int
|
||||||
ProcSyncAwaitFence(ClientPtr client)
|
ProcSyncAwaitFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xSyncAwaitFenceReq);
|
REQUEST_HEAD_AT_LEAST(xSyncAwaitFenceReq);
|
||||||
|
REQUEST_REST_CARD32();
|
||||||
|
|
||||||
SyncAwaitUnion *pAwaitUnion;
|
SyncAwaitUnion *pAwaitUnion;
|
||||||
SyncAwait *pAwait;
|
SyncAwait *pAwait;
|
||||||
|
|
||||||
|
@ -2073,8 +2087,6 @@ ProcSyncAwaitFence(ClientPtr client)
|
||||||
int items;
|
int items;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
|
|
||||||
|
|
||||||
len = client->req_len << 2;
|
len = client->req_len << 2;
|
||||||
len -= sz_xSyncAwaitFenceReq;
|
len -= sz_xSyncAwaitFenceReq;
|
||||||
items = len / sizeof(CARD32);
|
items = len / sizeof(CARD32);
|
||||||
|
@ -2190,252 +2202,6 @@ ProcSyncDispatch(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Boring Swapping stuff ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncCreateCounter(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncCreateCounterReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncCreateCounterReq);
|
|
||||||
swapl(&stuff->cid);
|
|
||||||
swapl(&stuff->initial_value_lo);
|
|
||||||
swapl(&stuff->initial_value_hi);
|
|
||||||
|
|
||||||
return ProcSyncCreateCounter(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncSetCounter(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncSetCounterReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
|
|
||||||
swapl(&stuff->cid);
|
|
||||||
swapl(&stuff->value_lo);
|
|
||||||
swapl(&stuff->value_hi);
|
|
||||||
|
|
||||||
return ProcSyncSetCounter(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncChangeCounter(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncChangeCounterReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
|
|
||||||
swapl(&stuff->cid);
|
|
||||||
swapl(&stuff->value_lo);
|
|
||||||
swapl(&stuff->value_hi);
|
|
||||||
|
|
||||||
return ProcSyncChangeCounter(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncQueryCounter(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncQueryCounterReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
|
|
||||||
swapl(&stuff->counter);
|
|
||||||
|
|
||||||
return ProcSyncQueryCounter(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncDestroyCounter(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncDestroyCounterReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
|
|
||||||
swapl(&stuff->counter);
|
|
||||||
|
|
||||||
return ProcSyncDestroyCounter(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncAwait(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncAwaitReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
|
|
||||||
return ProcSyncAwait(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncCreateAlarm(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncCreateAlarmReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncCreateAlarmReq);
|
|
||||||
swapl(&stuff->id);
|
|
||||||
swapl(&stuff->valueMask);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
|
|
||||||
return ProcSyncCreateAlarm(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncChangeAlarm(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncChangeAlarmReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
|
|
||||||
swapl(&stuff->alarm);
|
|
||||||
swapl(&stuff->valueMask);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
return ProcSyncChangeAlarm(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncQueryAlarm(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncQueryAlarmReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
|
|
||||||
swapl(&stuff->alarm);
|
|
||||||
|
|
||||||
return ProcSyncQueryAlarm(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncDestroyAlarm(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncDestroyAlarmReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
|
|
||||||
swapl(&stuff->alarm);
|
|
||||||
|
|
||||||
return ProcSyncDestroyAlarm(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncSetPriority(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncSetPriorityReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
|
|
||||||
swapl(&stuff->id);
|
|
||||||
swapl(&stuff->priority);
|
|
||||||
|
|
||||||
return ProcSyncSetPriority(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncGetPriority(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncGetPriorityReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
|
|
||||||
swapl(&stuff->id);
|
|
||||||
|
|
||||||
return ProcSyncGetPriority(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncCreateFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncCreateFenceReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncCreateFenceReq);
|
|
||||||
swapl(&stuff->d);
|
|
||||||
swapl(&stuff->fid);
|
|
||||||
|
|
||||||
return ProcSyncCreateFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncTriggerFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncTriggerFenceReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncTriggerFenceReq);
|
|
||||||
swapl(&stuff->fid);
|
|
||||||
|
|
||||||
return ProcSyncTriggerFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncResetFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncResetFenceReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncResetFenceReq);
|
|
||||||
swapl(&stuff->fid);
|
|
||||||
|
|
||||||
return ProcSyncResetFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncDestroyFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncDestroyFenceReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncDestroyFenceReq);
|
|
||||||
swapl(&stuff->fid);
|
|
||||||
|
|
||||||
return ProcSyncDestroyFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncQueryFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncQueryFenceReq);
|
|
||||||
REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
|
|
||||||
swapl(&stuff->fid);
|
|
||||||
|
|
||||||
return ProcSyncQueryFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncAwaitFence(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xSyncAwaitFenceReq);
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitFenceReq);
|
|
||||||
SwapRestL(stuff);
|
|
||||||
|
|
||||||
return ProcSyncAwaitFence(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _X_COLD
|
|
||||||
SProcSyncDispatch(ClientPtr client)
|
|
||||||
{
|
|
||||||
REQUEST(xReq);
|
|
||||||
|
|
||||||
switch (stuff->data) {
|
|
||||||
case X_SyncInitialize:
|
|
||||||
return ProcSyncInitialize(client);
|
|
||||||
case X_SyncListSystemCounters:
|
|
||||||
return ProcSyncListSystemCounters(client);
|
|
||||||
case X_SyncCreateCounter:
|
|
||||||
return SProcSyncCreateCounter(client);
|
|
||||||
case X_SyncSetCounter:
|
|
||||||
return SProcSyncSetCounter(client);
|
|
||||||
case X_SyncChangeCounter:
|
|
||||||
return SProcSyncChangeCounter(client);
|
|
||||||
case X_SyncQueryCounter:
|
|
||||||
return SProcSyncQueryCounter(client);
|
|
||||||
case X_SyncDestroyCounter:
|
|
||||||
return SProcSyncDestroyCounter(client);
|
|
||||||
case X_SyncAwait:
|
|
||||||
return SProcSyncAwait(client);
|
|
||||||
case X_SyncCreateAlarm:
|
|
||||||
return SProcSyncCreateAlarm(client);
|
|
||||||
case X_SyncChangeAlarm:
|
|
||||||
return SProcSyncChangeAlarm(client);
|
|
||||||
case X_SyncQueryAlarm:
|
|
||||||
return SProcSyncQueryAlarm(client);
|
|
||||||
case X_SyncDestroyAlarm:
|
|
||||||
return SProcSyncDestroyAlarm(client);
|
|
||||||
case X_SyncSetPriority:
|
|
||||||
return SProcSyncSetPriority(client);
|
|
||||||
case X_SyncGetPriority:
|
|
||||||
return SProcSyncGetPriority(client);
|
|
||||||
case X_SyncCreateFence:
|
|
||||||
return SProcSyncCreateFence(client);
|
|
||||||
case X_SyncTriggerFence:
|
|
||||||
return SProcSyncTriggerFence(client);
|
|
||||||
case X_SyncResetFence:
|
|
||||||
return SProcSyncResetFence(client);
|
|
||||||
case X_SyncDestroyFence:
|
|
||||||
return SProcSyncDestroyFence(client);
|
|
||||||
case X_SyncQueryFence:
|
|
||||||
return SProcSyncQueryFence(client);
|
|
||||||
case X_SyncAwaitFence:
|
|
||||||
return SProcSyncAwaitFence(client);
|
|
||||||
default:
|
|
||||||
return BadRequest;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Event Swapping
|
* Event Swapping
|
||||||
*/
|
*/
|
||||||
|
@ -2509,7 +2275,7 @@ SyncExtensionInit(void)
|
||||||
RTAlarmClient == 0 ||
|
RTAlarmClient == 0 ||
|
||||||
(extEntry = AddExtension(SYNC_NAME,
|
(extEntry = AddExtension(SYNC_NAME,
|
||||||
XSyncNumberEvents, XSyncNumberErrors,
|
XSyncNumberEvents, XSyncNumberErrors,
|
||||||
ProcSyncDispatch, SProcSyncDispatch,
|
ProcSyncDispatch, ProcSyncDispatch,
|
||||||
SyncResetProc, StandardMinorOpcode)) == NULL) {
|
SyncResetProc, StandardMinorOpcode)) == NULL) {
|
||||||
ErrorF("Sync Extension %d.%d failed to Initialise\n",
|
ErrorF("Sync Extension %d.%d failed to Initialise\n",
|
||||||
SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
|
SYNC_MAJOR_VERSION, SYNC_MINOR_VERSION);
|
||||||
|
|
Loading…
Reference in New Issue