1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3 *
4 * Copyright (C) 2004 University of Chicago.
5 * See COPYRIGHT notice in top-level directory.
6 */
7
8 #include "ad_nfs.h"
9
10 #ifdef HAVE_UNISTD_H
11 #include <unistd.h>
12 #endif
13
14 /* NFS resize
15 *
16 * Note: we resize on all processors to guarantee that all processors
17 * will have updated cache values. This used to be the generic
18 * implementation used by the majority of the ADIO implementations.
19 */
20 void ADIOI_NFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
21 {
22 int err;
23 static char myname[] = "ADIOI_NFS_RESIZE";
24
25 err = ftruncate(fd->fd_sys, size);
26
27 /* --BEGIN ERROR HANDLING-- */
28 if (err == -1) {
29 *error_code = ADIOI_Err_create_code(myname, fd->filename, errno);
30 return;
31 }
32 /* --END ERROR HANDLING-- */
33
34 *error_code = MPI_SUCCESS;
35 }