1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*-
2 * vim: ts=8 sts=4 sw=4 noexpandtab
3 *
4 * Copyright (C) 1997 University of Chicago.
5 * See COPYRIGHT notice in top-level directory.
6 */
7
8 #ifndef _AD_ZOIDFS_COMMON_H
9 #define _AD_ZOIDFS_COMMON_H
10 #include "ad_zoidfs.h"
11
12 /* The ESTALE problem:
13 * The IO forwarding protocol can respond to any call with ESTALE, which means
14 * the handle upon which that call operates has expired from the metadata
15 * cache. We thus wrap any zoidfs routine (expr) in this macro.
16 *
17 * ROMIO stores the filename in the ADIOI_File structrue (fd), so we can always
18 * re-lookup in response to ESTALE */
19
20 #define NO_STALE(ret, fd, handle_p, expr) \
21 do { \
22 (ret) = (expr); \
23 while ((ret) == ZFSERR_STALE) { \
24 /* lookup again */ \
25 (ret) = zoidfs_lookup(NULL, NULL, (fd)->filename, \
26 (zoidfs_handle_t*)((fd)->fs_ptr), ZOIDFS_NO_OP_HINT); \
27 if ((ret) == ZFS_OK) { \
28 *((ADIOI_ZOIDFS_object*)handle_p) \
29 = *((ADIOI_ZOIDFS_object*)((fd)->fs_ptr)); \
30 /* re-execute the expr with new handle */ \
31 (ret) = (expr); \
32 } \
33 } \
34 } while (0)
35
36 void ADIOI_ZOIDFS_Init(int rank, int *error_code );
37 void ADIOI_ZOIDFS_makeattribs(zoidfs_sattr_t * attribs);
38 void ADIOI_ZOIDFS_End(int *error_code);
39 int ADIOI_ZOIDFS_End_call(MPI_Comm comm, int keyval,
40 void *attribute_val, void *extra_state);
41 int ADIOI_ZOIDFS_error_convert(int error);
42
43 #endif