00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 #include "ad_zoidfs.h"
00009 #include "adio_extern.h"
00010 #include "ad_zoidfs_common.h"
00011 
00012 void ADIOI_ZOIDFS_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct,
00013                int *error_code)
00014 {
00015     int ret;
00016     zoidfs_attr_t attr;
00017     ADIOI_ZOIDFS_object *zoidfs_obj_ptr;
00018     static char myname[] = "ADIOI_ZOIDFS_FCNTL";
00019 
00020     zoidfs_obj_ptr = (ADIOI_ZOIDFS_object*)fd->fs_ptr;
00021 
00022     switch(flag) {
00023     case ADIO_FCNTL_GET_FSIZE:
00024     attr.mask = ZOIDFS_ATTR_SIZE;
00025         NO_STALE(ret, fd, zoidfs_obj_ptr,
00026                  zoidfs_getattr(zoidfs_obj_ptr, &attr, ZOIDFS_NO_OP_HINT));
00027     if ( !(attr.mask & ZOIDFS_ATTR_SIZE) || (ret != ZFS_OK ) ) {
00028         
00029         *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00030                            MPIR_ERR_RECOVERABLE,
00031                            myname, __LINE__,
00032                            ADIOI_ZOIDFS_error_convert(ret),
00033                            "Error in zoidfs_getattr", 0);
00034         
00035     }
00036     else {
00037         *error_code = MPI_SUCCESS;
00038     }
00039     fcntl_struct->fsize = attr.size;
00040     return;
00041 
00042     case ADIO_FCNTL_SET_DISKSPACE:
00043     ADIOI_GEN_Prealloc(fd, fcntl_struct->diskspace, error_code);
00044     break;
00045 
00046     
00047     case ADIO_FCNTL_SET_ATOMICITY:
00048     default:
00049     *error_code = MPIO_Err_create_code(MPI_SUCCESS,
00050                        MPIR_ERR_RECOVERABLE,
00051                        myname, __LINE__,
00052                        MPI_ERR_ARG,
00053                        "**flag", "**flag %d", flag);
00054     
00055     }
00056 }
00057 
00058 
00059 
00060