Commit 713bd44f authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Fix implicit conversions in pio backend code.

parent aa18ff57
......@@ -296,7 +296,7 @@ int fowMPINONB ( const char *filename )
xdebug("buffersize=%ld", buffersize);
listSetForeach(bibAFiledataM, elemCheck, (void *)filename);
of = initAFiledataMPINONB(filename, buffersize);
of = initAFiledataMPINONB(filename, (size_t)buffersize);
if ((id = listSetAdd(bibAFiledataM, of)) < 0 )
xabort("filename %s not unique", of->name);
......
......@@ -73,14 +73,14 @@ initBFiledataPA(char *filename, size_t bs, int nc)
if (( bfd->handle = open ( bfd->name, O_CREAT | O_WRONLY, 0666 )) == -1 )
xabort("Failed to open %s", bfd->name);
dbuffer_init(&(bfd->fb), (size_t)(nPrefStreams * bs));
dbuffer_init(&(bfd->fb), (size_t)nPrefStreams * bs);
bfd->ctrlBlks = (struct aiocb *) xcalloc(nPrefStreams, sizeof (bfd->ctrlBlks[0]));
bfd->ctrlBlks = xcalloc((size_t)nPrefStreams, sizeof (bfd->ctrlBlks[0]));
for ( i = 0; i < nPrefStreams; i++ )
{
bfd->ctrlBlks[i].aio_fildes = bfd->handle;
bfd->ctrlBlks[i].aio_buf = bfd->fb->buffer + i * bs;
bfd->ctrlBlks[i].aio_buf = bfd->fb->buffer + (size_t)i * bs;
bfd->ctrlBlks[i].aio_reqprio = 0;
bfd->ctrlBlks[i].aio_sigevent.sigev_notify = SIGEV_NONE;
}
......@@ -167,10 +167,10 @@ compareNamesBPA(void *v1, void *v2)
/***************************************************************/
static void
writePA(bFiledataPA *bfd, long amount)
writePA(bFiledataPA *bfd, size_t amount)
{
const struct aiocb *ccBP[1];
int iret;
ssize_t iret;
double startTime;
xdebug ( "file %s, in", bfd->name );
......@@ -191,7 +191,7 @@ writePA(bFiledataPA *bfd, long amount)
xdebug ( "after aio_write(), file %s, aio_nbytes=%zu, aio_offset=%zu,"
"iret=aio_write()=%d",
bfd->name, bfd->ctrlBlks[bfd->currOpIndex].aio_nbytes,
bfd->ctrlBlks[bfd->currOpIndex].aio_offset, iret );
bfd->ctrlBlks[bfd->currOpIndex].aio_offset, (int)iret );
if ( iret == -1 )
{
......@@ -200,7 +200,7 @@ writePA(bFiledataPA *bfd, long amount)
else
xdebug ( "buffer written to %s", bfd->name );
bfd->offset += ( off_t ) amount;
bfd->offset += (off_t)amount;
bfd->prefIndex ++;
if ( bfd->prefIndex >= nPrefStreams )
......@@ -259,7 +259,7 @@ void pioWriterAIO(void)
xdebug ( "nProcsCollNode=%d on this node", nProcsCollNode );
bibBFiledataPA = listSetNew(destroyBFiledataPA, compareNamesBPA);
sentFinalize = (bool*) xmalloc ( nProcsCollNode * sizeof ( sentFinalize ));
sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
for ( ;; )
{
......@@ -329,19 +329,15 @@ void pioWriterAIO(void)
(void *)(intptr_t)rtag.id)))
xabort("fileID=%d is not in set", rtag.id);
amount = messagesize;
xdebug("command: %s, id=%d, name=%s",
command2charP[rtag.command], rtag.id, bfd->name );
bfd->currOpIndex = bfd->nextOpIndex;
bfd->nextOpIndex = ( bfd->nextOpIndex + 1 ) % nPrefStreams;
xmpi(MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
amount, MPI_CHAR, source, tag, commNode, &status ));
writePA ( bfd, amount );
xmpi(MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
messagesize, MPI_CHAR, source, tag, commNode, &status ));
writePA(bfd, (size_t)messagesize);
break;
case IO_Close_file:
......@@ -350,8 +346,6 @@ void pioWriterAIO(void)
(void *)(intptr_t)rtag.id)))
xabort("fileID=%d is not in set", rtag.id);
amount = messagesize;
xdebug(" command %s, id=%d, name=%s",
command2charP[rtag.command], rtag.id, bfd->name);
......@@ -360,9 +354,9 @@ void pioWriterAIO(void)
bfd->nextOpIndex = ( bfd->nextOpIndex + 1 ) % nPrefStreams;
MPI_Recv((void *)bfd->ctrlBlks[bfd->currOpIndex].aio_buf,
amount, MPI_CHAR, source, tag, commNode, &status);
messagesize, MPI_CHAR, source, tag, commNode, &status);
writePA ( bfd, amount );
writePA(bfd, (size_t)messagesize);
if ( ! --(bfd->activeCollectors))
{
......@@ -373,7 +367,7 @@ void pioWriterAIO(void)
break;
case IO_Finalize:
{
int buffer = CDI_UNDEFID, collID;
int buffer, collID;
xmpi ( MPI_Recv ( &buffer, 1, MPI_INT, source, tag, commNode, &status ));
sentFinalize[source] = true;
......
......@@ -104,7 +104,7 @@ static bFiledataPF *
initBFiledataPF(int fileID, int nc)
{
bFiledataPF *bfd;
size_t bfdSize = sizeof (bFiledataPF) + nc * sizeof (bool);
size_t bfdSize = sizeof (bFiledataPF) + (size_t)nc * sizeof (bool);
bfd = xcalloc(1, bfdSize);
bfd->offset = 0;
bfd->finished = false;
......@@ -176,7 +176,7 @@ void fpgPOSIXFPGUARDSENDRECV ( void )
xdebug ( "ncollectors=%d on this node", nProcsCollNode );
bibBFiledataPF = listSetNew( destroyBFiledataPF, fileIDCmpB);
sentFinalize = xmalloc ( nProcsCollNode * sizeof ( sentFinalize[0] ));
sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
for ( ;; )
{
......@@ -476,7 +476,7 @@ int fowPOSIXFPGUARDSENDRECV ( const char *filename )
/* init and add file element */
listSetForeach(bibAFiledataPF, elemCheck, (void *)filename);
afd = initAFiledataPF ( filename, buffersize );
afd = initAFiledataPF(filename, (size_t)buffersize);
if ((id = listSetAdd(bibAFiledataPF, afd)) < 0)
xabort("filename %s not unique", afd->name);
......
......@@ -99,14 +99,13 @@ compareNamesBP(void *v1, void *v2)
/***************************************************************/
static void
writeP(bFiledataP *bfd, long amount)
writeP(bFiledataP *bfd, size_t amount)
{
long written;
size_t written;
xdebug ( "filename=%s, amount=%ld, in", bfd->name, amount );
if (( written = fwrite ( bfd->fb->buffer, 1, amount,
bfd->fp )) != amount )
if ((written = fwrite(bfd->fb->buffer, 1, amount, bfd->fp )) != amount)
xabort("did not succeed writing buffer in %s", bfd->name);
xdebug ( "filename=%s, written=%ld, amount=%ld, return",
......@@ -142,7 +141,7 @@ pioWriterStdIO(void)
xdebug ( "ncollectors=%d on this node", nProcsCollNode );
bibBFiledataP = listSetNew(destroyBFiledataP, compareNamesBP);
sentFinalize = xmalloc ( nProcsCollNode * sizeof ( sentFinalize ));
sentFinalize = xmalloc((size_t)nProcsCollNode * sizeof (sentFinalize[0]));
for ( ;; )
{
......@@ -166,7 +165,8 @@ pioWriterStdIO(void)
{
case IO_Open_file:
messageBuffer = xmalloc ( messagesize * sizeof ( messageBuffer[0] ));
messageBuffer
= xmalloc((size_t)messagesize * sizeof (messageBuffer[0]));
pMB = messageBuffer;
xmpi ( MPI_Recv ( messageBuffer, messagesize, MPI_CHAR, source,
......@@ -177,7 +177,7 @@ pioWriterStdIO(void)
filename = strtok ( pMB, token );
pMB += ( strlen ( filename ) + 1 );
temp = strtok ( pMB, token );
buffersize = strtol ( temp, NULL, 16 );
buffersize = (size_t)strtol(temp, NULL, 16);
pMB += ( strlen ( temp ) + 1 );
amount = (size_t)(messageBuffer + messagesize - pMB);
......@@ -214,20 +214,19 @@ pioWriterStdIO(void)
(void *)(intptr_t)rtag.id)))
xabort("fileID=%d is not in set", rtag.id );
amount = messagesize;
amount = (size_t)messagesize;
xdebug("COMMAND %s, ID=%d, NAME=%s", command2charP[rtag.command],
rtag.id, bfd->name);
xmpi ( MPI_Recv ( bfd->fb->buffer, amount, MPI_CHAR, source, tag,
commNode, &status ));
writeP ( bfd, amount );
xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_CHAR, source, tag,
commNode, &status));
writeP(bfd, amount);
break;
case IO_Close_file:
xdebug("COMMAND %s, FILE%d, SOURCE%d",
command2charP[rtag.command], rtag.id, source);
......@@ -235,13 +234,13 @@ pioWriterStdIO(void)
(void *)(intptr_t)rtag.id)))
xabort("fileID=%d is not in set", rtag.id);
amount = messagesize;
amount = (size_t)messagesize;
xdebug("COMMAND %s, ID=%d, NAME=%s, AMOUNT=%zu",
command2charP[rtag.command], rtag.id, bfd->name, amount);
xmpi(MPI_Recv(bfd->fb->buffer, amount, MPI_CHAR, source, tag,
commNode, &status ));
xmpi(MPI_Recv(bfd->fb->buffer, messagesize, MPI_CHAR, source, tag,
commNode, &status));
writeP ( bfd, amount );
......
......@@ -118,7 +118,8 @@ sendP(remoteFileBuf *afd, int id)
if ( ddebug ) accumWait += ( MPI_Wtime () - startTime );
xmpi(MPI_Issend(afd->db->buffer, amount, MPI_CHAR, commInqSpecialRankNode(),
/* FIXME: amount > INT_MAX unhandled */
xmpi(MPI_Issend(afd->db->buffer, (int)amount, MPI_CHAR, commInqSpecialRankNode(),
tag, commInqCommNode(), &( afd->request )));
/* change outputBuffer */
......@@ -264,7 +265,7 @@ pioSendOpen(const char *filename)
}
/* init and add remoteFileBuf */
afd = initRemoteFileBuf(filename, buffersize);
afd = initRemoteFileBuf(filename, (size_t)buffersize);
if ((id = listSetAdd(bibRemoteFileBuf, afd)) < 0)
xabort("filename %s is not unique", afd->name);
afd->fileID = id;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment