Commit 91e91a40 authored by Rob Latham's avatar Rob Latham Committed by Pavan Balaji
Browse files

make shared file pointer code "large datatype" safe



this internal-to-romio code was using 'ints' to store things like
"datatype_size * count" calculation.  Promote that and all called paths
to ADIO_Offset
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@mcs.anl.gov>
parent e192ccc5
......@@ -86,7 +86,7 @@ void ADIOI_BG_WriteStridedColl(ADIO_File fd, const void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_BG_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp, int *error_code);
void ADIOI_BG_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp, int *error_code);
void ADIOI_BG_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
void ADIOI_BG_Flush(ADIO_File fd, int *error_code);
......
......@@ -19,7 +19,7 @@
shared_fp by the number of etypes to be accessed (incr) in the read
or write following this function. */
void ADIOI_BG_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
void ADIOI_BG_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
int *error_code)
{
ADIO_Offset new_fp;
......
......@@ -86,7 +86,7 @@ void ADIOI_BGL_WriteStridedColl(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_BGL_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp, int *error_code);
void ADIOI_BGL_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp, int *error_code);
void ADIOI_BGL_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
void ADIOI_BGL_Flush(ADIO_File fd, int *error_code);
......
......@@ -19,7 +19,7 @@
shared_fp by the number of etypes to be accessed (incr) in the read
or write following this function. */
void ADIOI_BGL_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
void ADIOI_BGL_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
int *error_code)
{
ADIO_Offset new_fp;
......
......@@ -74,7 +74,7 @@ void ADIOI_NFS_ReadStrided(ADIO_File fd, void *buf, int count,
ADIO_Offset offset, ADIO_Status *status, int
*error_code);
void ADIOI_NFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp,
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp,
int *error_code);
void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
......
......@@ -12,11 +12,11 @@
shared_fp by the number of etypes to be accessed (incr) in the read
or write following this function. */
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
int *error_code)
{
ADIO_Offset new_fp;
int err;
ssize_t err;
MPI_Comm dupcommself;
static char myname[] = "ADIOI_NFS_GET_SHARED_FP";
......
......@@ -30,7 +30,7 @@ Unlock
void ADIOI_NFS_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code)
{
int err;
ssize_t err;
MPI_Comm dupcommself;
static char myname[] = "ADIOI_NFS_SET_SHARED_FP";
......
......@@ -18,10 +18,10 @@ void ADIOI_BG_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp, int
shared_fp by the number of etypes to be accessed (incr) in the read
or write following this function. */
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
void ADIOI_NFS_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
int *error_code);
void ADIO_Get_shared_fp(ADIO_File fd, int incr, ADIO_Offset *shared_fp,
void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset incr, ADIO_Offset *shared_fp,
int *error_code)
{
ADIO_Status status;
......
......@@ -15,9 +15,9 @@
*/
void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
{
ADIO_Offset curr_fsize, alloc_size, size, len, done;
ADIO_Offset curr_fsize, alloc_size, size, len, done, ntimes;
ADIO_Status status;
int i, ntimes;
int i;
char *buf;
ADIO_Fcntl_t *fcntl_struct;
static char myname[] = "ADIOI_GEN_PREALLOC";
......@@ -48,7 +48,7 @@ void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_ReadContig(fd, buf,
len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
(int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
so it fits in an int parameter */
MPI_BYTE, ADIO_EXPLICIT_OFFSET, done,
&status, error_code);
......@@ -62,7 +62,7 @@ void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
return;
}
ADIO_WriteContig(fd, buf,
len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
(int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
so it fits in an int parameter */
MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
......@@ -77,7 +77,7 @@ void ADIOI_GEN_Prealloc(ADIO_File fd, ADIO_Offset diskspace, int *error_code)
for (i=0; i<ntimes; i++) {
len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
ADIO_WriteContig(fd, buf,
len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
(int)len, /* len is ADIO_Offset but is <= ADIOI_PREALLOC_BUFSZ (16M),
so it fits in an int parameter */
MPI_BYTE, ADIO_EXPLICIT_OFFSET,
done, &status, error_code);
......
......@@ -14,8 +14,8 @@
void ADIOI_Get_eof_offset(ADIO_File fd, ADIO_Offset *eof_offset)
{
unsigned filetype_size;
int error_code, filetype_is_contig, etype_size;
ADIO_Offset fsize, disp, sum=0, size_in_file, n_filetypes, rem;
int error_code, filetype_is_contig;
ADIO_Offset fsize, disp, sum=0, size_in_file, n_filetypes, rem, etype_size;
int flag, i;
ADIO_Fcntl_t *fcntl_struct;
MPI_Aint filetype_extent;
......
......@@ -94,7 +94,8 @@ static int file_to_info(int fd, MPI_Info info)
{
char *buffer, *token, *key, *val, *garbage;
char *pos1=NULL, *pos2=NULL;
int flag, ret;
int flag;
ssize_t ret;
char dummy;
struct stat statbuf;
......
......@@ -397,7 +397,7 @@ void ADIO_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
void ADIO_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype,
ADIOI_Fns **ops, int *error_code);
void ADIO_Get_shared_fp(ADIO_File fd, int size, ADIO_Offset *shared_fp,
void ADIO_Get_shared_fp(ADIO_File fd, ADIO_Offset size, ADIO_Offset *shared_fp,
int *error_code);
void ADIO_Set_shared_fp(ADIO_File fd, ADIO_Offset offset, int *error_code);
void ADIO_Set_view(ADIO_File fd, ADIO_Offset disp, MPI_Datatype etype,
......
......@@ -73,11 +73,11 @@ int MPI_File_iread(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI
int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *buf, int count,
MPI_Datatype datatype, char *myname, MPI_Request *request)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
MPI_Count datatype_size;
ADIO_Status status;
ADIO_File adio_fh;
ADIO_Offset off;
ADIO_Offset off, bufsize;
MPI_Offset nbytes=0;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......
......@@ -43,7 +43,8 @@ Output Parameters:
int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Request *request)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
ADIO_Offset bufsize;
ADIO_File adio_fh;
static char myname[] = "MPI_FILE_IREAD_SHARED";
MPI_Count datatype_size, incr;
......
......@@ -80,10 +80,10 @@ int MPIOI_File_iwrite(MPI_File fh,
char *myname,
MPI_Request *request)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
MPI_Count datatype_size;
ADIO_Status status;
ADIO_Offset off;
ADIO_Offset off, bufsize;
ADIO_File adio_fh;
MPI_Offset nbytes=0;
......
......@@ -44,9 +44,9 @@ Output Parameters:
int MPI_File_iwrite_shared(MPI_File fh, const void *buf, int count,
MPI_Datatype datatype, MPIO_Request *request)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
ADIO_File adio_fh;
int incr;
ADIO_Offset incr, bufsize;
MPI_Count datatype_size;
ADIO_Status status;
ADIO_Offset off, shared_fp;
......
......@@ -70,10 +70,10 @@ int MPIOI_File_read(MPI_File fh,
char *myname,
MPI_Status *status)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
MPI_Count datatype_size;
ADIO_File adio_fh;
ADIO_Offset off;
ADIO_Offset off, bufsize;
void *xbuf=NULL, *e32_buf=NULL;
MPIU_THREAD_CS_ENTER(ALLFUNC,);
......
......@@ -42,7 +42,8 @@ Output Parameters:
int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
{
int error_code, nprocs, myrank, incr;
int error_code, nprocs, myrank;
ADIO_Offset incr;
MPI_Count datatype_size;
int source, dest;
static char myname[] = "MPI_FILE_READ_ORDERED";
......
......@@ -39,10 +39,10 @@ Output Parameters:
int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
MPI_Datatype datatype)
{
int error_code, nprocs, myrank, incr;
int error_code, nprocs, myrank;
MPI_Count datatype_size;
int source, dest;
ADIO_Offset shared_fp;
ADIO_Offset shared_fp, incr;
ADIO_File adio_fh;
static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN";
void *xbuf=NULL, *e32_buf=NULL;
......
......@@ -42,11 +42,10 @@ Output Parameters:
int MPI_File_read_shared(MPI_File fh, void *buf, int count,
MPI_Datatype datatype, MPI_Status *status)
{
int error_code, bufsize, buftype_is_contig, filetype_is_contig;
int error_code, buftype_is_contig, filetype_is_contig;
static char myname[] = "MPI_FILE_READ_SHARED";
int incr;
MPI_Count datatype_size;
ADIO_Offset off, shared_fp;
ADIO_Offset off, shared_fp, incr, bufsize;
ADIO_File adio_fh;
void *xbuf=NULL, *e32_buf=NULL;
......
Markdown is supported
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