1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2002 Cluster File Systems, Inc.
5 * Author: You Feng <youfeng@clusterfs.com>
7 * This file is part of Lustre, http://www.lustre.org.
9 * Lustre is free software; you can redistribute it and/or
10 * modify it under the terms of version 2 of the GNU General Public
11 * License as published by the Free Software Foundation.
13 * Lustre is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Lustre; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef __LP_UTILS_H__
24 #define __LP_UTILS_H__
26 #include "lustre/lustre_user.h"
31 printf("%s: Process %d (%s)\n", timestamp(), rank, hostname); \
33 printf("\tFAILED in %s:%d:%s()\n", __FILE__, __LINE__, __func__); \
35 printf("\tFAILED in %s()\n", __func__); \
38 MPI_Abort(MPI_COMM_WORLD, 1); \
41 #define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH
42 #define MAX_FILENAME_LEN 512
50 extern char hostname[];
51 extern char *timestamp();
54 extern inline void begin(char *str);
55 extern inline void end(char *str);
57 extern void dump_diff(char *orig_buf, char *buf, int len, long off);
58 extern void lp_gethostname(void);
60 extern void create_file(char *name, long filesize, int fill);
61 extern void fill_file(char *name, long filesize);
66 \tfields\t\tvalue\told value\n \
67 \tst_dev\t\t%d\t%d\n \
68 \tst_ino\t\t%d\t%d\n \
69 \tst_mode\t\t%o\t%o\n \
70 \tst_nlink\t%d\t%d\n \
71 \tst_uid\t\t%d\t%d\n \
72 \tst_gid\t\t%d\t%d\n \
73 \tst_rdev\t\t%x.%x\t%x.%x\n \
74 \tst_size\t\t%lu\t%lu\n \
75 \tst_blksize\t%d\t%d\n \
76 \tst_blocks\t%u\t%u\n \
77 \tst_atime\t%d\t%d\n \
78 \tst_mtime\t%d\t%d\n \
81 #define LP_STAT_ARGS \
83 (int)state->st_dev, (int)old_state->st_dev, \
84 (int)state->st_ino, (int)old_state->st_ino, \
85 state->st_mode & 07777, old_state->st_mode & 07777, \
86 (int)state->st_nlink, (int)old_state->st_nlink, \
87 state->st_uid, old_state->st_uid, \
88 state->st_gid, old_state->st_gid, \
89 (int)((state->st_rdev >> 8) & 0xff), (int)(state->st_rdev & 0xff), \
90 (int)((old_state->st_rdev >> 8) & 0xff), (int)(old_state->st_rdev & 0xff), \
91 (unsigned long)state->st_size, (unsigned long)old_state->st_size, \
92 (int)state->st_blksize, (int)old_state->st_blksize, \
93 (unsigned int)state->st_blocks, (unsigned int)old_state->st_blocks, \
94 (int)state->st_atime, (int)old_state->st_atime, \
95 (int)state->st_mtime, (int)old_state->st_mtime, \
96 (int)state->st_ctime, (int)old_state->st_ctime
98 extern void check_stat(char *filename, struct stat *state, struct stat *old_state);
99 extern void remove_file(char *name);
100 extern void remove_file_or_dir(char *name);
101 extern void fill_stride(char *buf, int buf_size, long long rank, long long _off);
103 #endif /* __LP_UTILS_H__ */