aio: Change prefix of PgAioResultStatus values to PGAIO_RS_

The previous prefix wasn't consistent with the naming of other AIO related
enum values. It seems best to rename it before the users are introduced.

Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CAAKRu_Yb+JzQpNsgUxCB0gBi+sE-mi_HmcJF6ALnmO4W+UgwpA@mail.gmail.com
This commit is contained in:
Andres Freund 2025-03-22 17:30:44 -04:00
parent 58fdca2204
commit ca3067cc57
4 changed files with 14 additions and 14 deletions

View File

@ -216,7 +216,7 @@ pgaio_io_acquire_nb(struct ResourceOwnerData *resowner, PgAioReturn *ret)
if (ret) if (ret)
{ {
ioh->report_return = ret; ioh->report_return = ret;
ret->result.status = ARS_UNKNOWN; ret->result.status = PGAIO_RS_UNKNOWN;
} }
return ioh; return ioh;
@ -669,7 +669,7 @@ pgaio_io_reclaim(PgAioHandle *ioh)
ioh->handle_data_len = 0; ioh->handle_data_len = 0;
ioh->report_return = NULL; ioh->report_return = NULL;
ioh->result = 0; ioh->result = 0;
ioh->distilled_result.status = ARS_UNKNOWN; ioh->distilled_result.status = PGAIO_RS_UNKNOWN;
/* XXX: the barrier is probably superfluous */ /* XXX: the barrier is probably superfluous */
pg_write_barrier(); pg_write_barrier();
@ -829,13 +829,13 @@ pgaio_result_status_string(PgAioResultStatus rs)
{ {
switch (rs) switch (rs)
{ {
case ARS_UNKNOWN: case PGAIO_RS_UNKNOWN:
return "UNKNOWN"; return "UNKNOWN";
case ARS_OK: case PGAIO_RS_OK:
return "OK"; return "OK";
case ARS_PARTIAL: case PGAIO_RS_PARTIAL:
return "PARTIAL"; return "PARTIAL";
case ARS_ERROR: case PGAIO_RS_ERROR:
return "ERROR"; return "ERROR";
} }

View File

@ -164,8 +164,8 @@ pgaio_result_report(PgAioResult result, const PgAioTargetData *target_data, int
PgAioHandleCallbackID cb_id = result.id; PgAioHandleCallbackID cb_id = result.id;
const PgAioHandleCallbacksEntry *ce = &aio_handle_cbs[cb_id]; const PgAioHandleCallbacksEntry *ce = &aio_handle_cbs[cb_id];
Assert(result.status != ARS_UNKNOWN); Assert(result.status != PGAIO_RS_UNKNOWN);
Assert(result.status != ARS_OK); Assert(result.status != PGAIO_RS_OK);
if (ce->cb->report == NULL) if (ce->cb->report == NULL)
elog(ERROR, "callback %d/%s does not have report callback", elog(ERROR, "callback %d/%s does not have report callback",
@ -220,7 +220,7 @@ pgaio_io_call_complete_shared(PgAioHandle *ioh)
Assert(ioh->target > PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT); Assert(ioh->target > PGAIO_TID_INVALID && ioh->target < PGAIO_TID_COUNT);
Assert(ioh->op > PGAIO_OP_INVALID && ioh->op < PGAIO_OP_COUNT); Assert(ioh->op > PGAIO_OP_INVALID && ioh->op < PGAIO_OP_COUNT);
result.status = ARS_OK; /* low level IO is always considered OK */ result.status = PGAIO_RS_OK; /* low level IO is always considered OK */
result.result = ioh->result; result.result = ioh->result;
result.id = PGAIO_HCB_INVALID; result.id = PGAIO_HCB_INVALID;
result.error_data = 0; result.error_data = 0;

View File

@ -202,7 +202,7 @@ AioShmemInit(void)
ioh->report_return = NULL; ioh->report_return = NULL;
ioh->resowner = NULL; ioh->resowner = NULL;
ioh->num_callbacks = 0; ioh->num_callbacks = 0;
ioh->distilled_result.status = ARS_UNKNOWN; ioh->distilled_result.status = PGAIO_RS_UNKNOWN;
ioh->flags = 0; ioh->flags = 0;
ConditionVariableInit(&ioh->cv); ConditionVariableInit(&ioh->cv);

View File

@ -73,10 +73,10 @@ typedef union PgAioTargetData
*/ */
typedef enum PgAioResultStatus typedef enum PgAioResultStatus
{ {
ARS_UNKNOWN, /* not yet completed / uninitialized */ PGAIO_RS_UNKNOWN, /* not yet completed / uninitialized */
ARS_OK, PGAIO_RS_OK,
ARS_PARTIAL, /* did not fully succeed, but no error */ PGAIO_RS_PARTIAL, /* did not fully succeed, but no error */
ARS_ERROR, PGAIO_RS_ERROR,
} PgAioResultStatus; } PgAioResultStatus;