Revisit ncmpii_create() for handling NC_CLOBBER and NC_NOCLOBBER modes.

When NC_CLOBBER mode is used, we abandon the possibility to call MPI_File_set_size because this call is expensive. Instead, we delete the file. If unlink() is available, we use it and ignore error code ENOENT. If unlink() is not available, we use MPI_File_delete and ignore error class MPI_ERR_NO_SUCH_FILE.

However, ROMIO as in today does not correctly return MPI_ERR_NO_SUCH_FILE on many file systems. Hence, user may get NC_EOFILE error instead.

For NC_NOCLOBBER, netCDF requires to return error NC_EEXIST if the file exists. When access() is not available, we use MPI_MODE_EXCL mode in MPI_File_open in expecting error class MPI_ERR_FILE_EXISTS returned if the file exists. Again, ROMIO as in today does not correctly return MPI_ERR_FILE_EXISTS. This makes returnning NC_EEXIST as required by netCDF difficult.

A temporary solution is added that lets rank 0 braodcast errno and then check its value against EEXIST. This is still not perfect. Hope ROMIO soon will be fixed on returning erro classes.

Note when both access() and unlink() are available, the above problem does not appear, as rank 0 broadcasts file_exist or error code at the end.



git-svn-id: https://svn.mcs.anl.gov/repos/parallel-netcdf/trunk@1556 c368ceb8-fd28-0410-a457-e46ee1d7cd4a
check for valid path in safe mode

git-svn-id: https://svn.mcs.anl.gov/repos/parallel-netcdf/trunk@1557 c368ceb8-fd28-0410-a457-e46ee1d7cd4a
add a note on the error code MPI_ERR_FILE_EXISTS

git-svn-id: https://svn.mcs.anl.gov/repos/parallel-netcdf/trunk@1558 c368ceb8-fd28-0410-a457-e46ee1d7cd4a