Xext: sync: use REPLY_*() macros for preparing / sending replies
Use the new macros for preparing and sending replies to clients. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
5cded6356d
commit
75328e8356
111
Xext/sync.c
111
Xext/sync.c
|
@ -1271,18 +1271,11 @@ ProcSyncInitialize(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSyncInitializeReq);
|
REQUEST_HEAD_STRUCT(xSyncInitializeReq);
|
||||||
|
|
||||||
xSyncInitializeReply rep = {
|
xSyncInitializeReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.majorVersion = SERVER_SYNC_MAJOR_VERSION,
|
.majorVersion = SERVER_SYNC_MAJOR_VERSION,
|
||||||
.minorVersion = SERVER_SYNC_MINOR_VERSION,
|
.minorVersion = SERVER_SYNC_MINOR_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1294,10 +1287,9 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSyncListSystemCountersReq);
|
REQUEST_HEAD_STRUCT(xSyncListSystemCountersReq);
|
||||||
|
|
||||||
xSyncListSystemCountersReply rep = {
|
xSyncListSystemCountersReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.nCounters = 0,
|
.nCounters = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
SysCounterInfo *psci;
|
SysCounterInfo *psci;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
xSyncSystemCounter *list = NULL, *walklist = NULL;
|
xSyncSystemCounter *list = NULL, *walklist = NULL;
|
||||||
|
@ -1314,13 +1306,7 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.length = bytes_to_int32(len);
|
REPLY_FIELD_CARD32(nCounters);
|
||||||
|
|
||||||
if (client->swapped) {
|
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
swapl(&rep.nCounters);
|
|
||||||
}
|
|
||||||
|
|
||||||
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
|
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
|
||||||
int namelen;
|
int namelen;
|
||||||
|
@ -1332,12 +1318,8 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
namelen = strlen(psci->name);
|
namelen = strlen(psci->name);
|
||||||
walklist->name_length = namelen;
|
walklist->name_length = namelen;
|
||||||
|
|
||||||
if (client->swapped) {
|
CLIENT_STRUCT_CARD16_1(walklist, name_length);
|
||||||
swapl(&walklist->counter);
|
CLIENT_STRUCT_CARD32_3(walklist, counter, resolution_hi, resolution_lo);
|
||||||
swapl(&walklist->resolution_hi);
|
|
||||||
swapl(&walklist->resolution_lo);
|
|
||||||
swaps(&walklist->name_length);
|
|
||||||
}
|
|
||||||
|
|
||||||
pname_in_reply = ((char *) walklist) + sz_xSyncSystemCounter;
|
pname_in_reply = ((char *) walklist) + sz_xSyncSystemCounter;
|
||||||
strncpy(pname_in_reply, psci->name, namelen);
|
strncpy(pname_in_reply, psci->name, namelen);
|
||||||
|
@ -1346,12 +1328,7 @@ ProcSyncListSystemCounters(ClientPtr client)
|
||||||
namelen));
|
namelen));
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(rep), &rep);
|
REPLY_SEND_EXTRA(list, len);
|
||||||
if (len) {
|
|
||||||
WriteToClient(client, len, list);
|
|
||||||
free(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1401,34 +1378,23 @@ ProcSyncGetPriority(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSyncGetPriorityReq);
|
REQUEST_HEAD_STRUCT(xSyncGetPriorityReq);
|
||||||
REQUEST_FIELD_CARD32(id);
|
REQUEST_FIELD_CARD32(id);
|
||||||
|
|
||||||
xSyncGetPriorityReply rep;
|
|
||||||
ClientPtr priorityclient;
|
ClientPtr priorityclient;
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (stuff->id == None)
|
if (stuff->id == None)
|
||||||
priorityclient = client;
|
priorityclient = client;
|
||||||
else {
|
else {
|
||||||
rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
|
int rc = dixLookupResourceOwner(&priorityclient, stuff->id, client,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep = (xSyncGetPriorityReply) {
|
xSyncGetPriorityReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.priority = priorityclient->priority
|
.priority = priorityclient->priority
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(priority);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1691,7 +1657,6 @@ ProcSyncQueryCounter(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSyncQueryCounterReq);
|
REQUEST_HEAD_STRUCT(xSyncQueryCounterReq);
|
||||||
REQUEST_FIELD_CARD32(counter);
|
REQUEST_FIELD_CARD32(counter);
|
||||||
|
|
||||||
xSyncQueryCounterReply rep;
|
|
||||||
SyncCounter *pCounter;
|
SyncCounter *pCounter;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -1706,22 +1671,14 @@ ProcSyncQueryCounter(ClientPtr client)
|
||||||
&pCounter->value);
|
&pCounter->value);
|
||||||
}
|
}
|
||||||
|
|
||||||
rep = (xSyncQueryCounterReply) {
|
xSyncQueryCounterReply rep = (xSyncQueryCounterReply) {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
.value_hi = pCounter->value >> 32,
|
.value_hi = pCounter->value >> 32,
|
||||||
.value_lo = pCounter->value
|
.value_lo = pCounter->value
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(value_hi);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(value_lo);
|
||||||
swapl(&rep.length);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.value_hi);
|
|
||||||
swapl(&rep.value_lo);
|
|
||||||
}
|
|
||||||
WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1862,7 +1819,6 @@ ProcSyncQueryAlarm(ClientPtr client)
|
||||||
REQUEST_FIELD_CARD32(alarm);
|
REQUEST_FIELD_CARD32(alarm);
|
||||||
|
|
||||||
SyncAlarm *pAlarm;
|
SyncAlarm *pAlarm;
|
||||||
xSyncQueryAlarmReply rep;
|
|
||||||
SyncTrigger *pTrigger;
|
SyncTrigger *pTrigger;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -1872,9 +1828,7 @@ ProcSyncQueryAlarm(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
pTrigger = &pAlarm->trigger;
|
pTrigger = &pAlarm->trigger;
|
||||||
rep = (xSyncQueryAlarmReply) {
|
xSyncQueryAlarmReply rep = {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length =
|
.length =
|
||||||
bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
|
bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
|
||||||
.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
|
.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
|
||||||
|
@ -1899,19 +1853,13 @@ ProcSyncQueryAlarm(ClientPtr client)
|
||||||
.state = pAlarm->state
|
.state = pAlarm->state
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_FIELD_CARD32(counter);
|
||||||
swaps(&rep.sequenceNumber);
|
REPLY_FIELD_CARD32(wait_value_hi);
|
||||||
swapl(&rep.length);
|
REPLY_FIELD_CARD32(wait_value_lo);
|
||||||
swapl(&rep.counter);
|
REPLY_FIELD_CARD32(test_type);
|
||||||
swapl(&rep.wait_value_hi);
|
REPLY_FIELD_CARD32(delta_hi);
|
||||||
swapl(&rep.wait_value_lo);
|
REPLY_FIELD_CARD32(delta_lo);
|
||||||
swapl(&rep.test_type);
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swapl(&rep.delta_hi);
|
|
||||||
swapl(&rep.delta_lo);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2044,7 +1992,6 @@ ProcSyncQueryFence(ClientPtr client)
|
||||||
REQUEST_HEAD_STRUCT(xSyncQueryFenceReq);
|
REQUEST_HEAD_STRUCT(xSyncQueryFenceReq);
|
||||||
REQUEST_FIELD_CARD32(fid);
|
REQUEST_FIELD_CARD32(fid);
|
||||||
|
|
||||||
xSyncQueryFenceReply rep;
|
|
||||||
SyncFence *pFence;
|
SyncFence *pFence;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -2053,21 +2000,11 @@ ProcSyncQueryFence(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rep = (xSyncQueryFenceReply) {
|
xSyncQueryFenceReply rep = (xSyncQueryFenceReply) {
|
||||||
.type = X_Reply,
|
|
||||||
.sequenceNumber = client->sequence,
|
|
||||||
.length = 0,
|
|
||||||
|
|
||||||
.triggered = pFence->funcs.CheckTriggered(pFence)
|
.triggered = pFence->funcs.CheckTriggered(pFence)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (client->swapped) {
|
REPLY_SEND_RET_SUCCESS();
|
||||||
swaps(&rep.sequenceNumber);
|
|
||||||
swapl(&rep.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue