cctools
chirp_types.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
12 #ifndef CHIRP_TYPES_H
13 #define CHIRP_TYPES_H
14 
15 #include "chirp_protocol.h"
16 
17 #include "buffer.h"
18 #include "int_sizes.h"
19 
20 #include <fcntl.h>
21 #include <sys/types.h>
22 
23 #include <inttypes.h>
24 #include <stdint.h>
25 #include <time.h>
26 
34 struct chirp_stat {
35  INT64_T cst_dev;
36  INT64_T cst_ino;
37  INT64_T cst_mode;
38  INT64_T cst_nlink;
39  INT64_T cst_uid;
40  INT64_T cst_gid;
41  INT64_T cst_rdev;
42  INT64_T cst_size;
43  INT64_T cst_blksize;
44  INT64_T cst_blocks;
45  INT64_T cst_atime;
46  INT64_T cst_mtime;
47  INT64_T cst_ctime;
48 };
49 
50 #define chirp_stat_encode(B, info) \
51  do {\
52  buffer_putfstring(B, "%" PRId64, (info)->cst_dev);\
53  buffer_putfstring(B, " %" PRId64, (info)->cst_ino);\
54  buffer_putfstring(B, " %" PRId64, (info)->cst_mode);\
55  buffer_putfstring(B, " %" PRId64, (info)->cst_nlink);\
56  buffer_putfstring(B, " %" PRId64, (info)->cst_uid);\
57  buffer_putfstring(B, " %" PRId64, (info)->cst_gid);\
58  buffer_putfstring(B, " %" PRId64, (info)->cst_rdev);\
59  buffer_putfstring(B, " %" PRId64, (info)->cst_size);\
60  buffer_putfstring(B, " %" PRId64, (info)->cst_blksize);\
61  buffer_putfstring(B, " %" PRId64, (info)->cst_blocks);\
62  buffer_putfstring(B, " %" PRId64, (info)->cst_atime);\
63  buffer_putfstring(B, " %" PRId64, (info)->cst_mtime);\
64  buffer_putfstring(B, " %" PRId64, (info)->cst_ctime);\
65  } while (0)
66 
67 
72 struct chirp_statfs {
73  INT64_T f_type;
74  INT64_T f_blocks;
75  INT64_T f_bavail;
76  INT64_T f_bsize;
77  INT64_T f_bfree;
78  INT64_T f_files;
79  INT64_T f_ffree;
80 };
81 
82 #define chirp_statfs_encode(B, info) \
83  do {\
84  buffer_putfstring(B, "%" PRId64, (info)->f_type);\
85  buffer_putfstring(B, " %" PRId64, (info)->f_bsize);\
86  buffer_putfstring(B, " %" PRId64, (info)->f_blocks);\
87  buffer_putfstring(B, " %" PRId64, (info)->f_bfree);\
88  buffer_putfstring(B, " %" PRId64, (info)->f_bavail);\
89  buffer_putfstring(B, " %" PRId64, (info)->f_files);\
90  buffer_putfstring(B, " %" PRId64, (info)->f_ffree);\
91  } while (0)
92 
95 struct chirp_dirent {
96  char *name;
97  int lstatus;
98  struct chirp_stat info;
99  struct chirp_dirent *next;
100 };
101 
106  struct chirp_stat info;
107  int errsource;
108  int err;
109 };
110 
114  struct chirp_searchent entry;
115  const char *current;
116  buffer_t B;
117 };
118 
119 #define CHIRP_SEARCH struct chirp_searchstream
120 
123 #define CHIRP_SEARCH_STOPATFIRST (1<<0)
124 #define CHIRP_SEARCH_METADATA (1<<1)
125 #define CHIRP_SEARCH_INCLUDEROOT (1<<2)
126 #define CHIRP_SEARCH_PERIOD (1<<3)
127 #define CHIRP_SEARCH_R_OK (1<<4)
128 #define CHIRP_SEARCH_W_OK (1<<5)
129 #define CHIRP_SEARCH_X_OK (1<<6)
130 
133 #define CHIRP_SEARCH_ERR_OPEN 1
134 #define CHIRP_SEARCH_ERR_READ 2
135 #define CHIRP_SEARCH_ERR_CLOSE 3
136 #define CHIRP_SEARCH_ERR_STAT 4
137 
140 #define CHIRP_SEARCH_DELIMITER '|'
141 #define CHIRP_SEARCH_DEPTH_MAX 200
142 
145 typedef enum {
153 
158 struct chirp_bulkio {
160  struct chirp_file *file;
161  struct chirp_stat *info;
162  void *buffer;
163  INT64_T length;
164  INT64_T stride_length;
165  INT64_T stride_skip;
166  INT64_T offset;
167  INT64_T result;
168  INT64_T errnum;
169 };
170 
175 struct chirp_audit {
177  INT64_T nfiles;
178  INT64_T ndirs;
179  INT64_T nbytes;
180 };
181 
190 typedef void (*chirp_dir_t) (const char *path, void *arg);
191 
201 typedef void (*chirp_longdir_t) (const char *path, struct chirp_stat * info, void *arg);
202 
211 typedef void (*chirp_loc_t) (const char *location, void *arg);
212 
213 
216 typedef int64_t chirp_jobid_t;
217 #define PRICHIRP_JOBID_T PRId64
218 #define SCNCHIRP_JOBID_T SCNd64
219 
222 #define CHIRP_DIGEST_MAX 128
223 
224 #endif
225 
226 /* vim: set noexpandtab tabstop=4: */
INT64_T cst_dev
The device number on which the file is stored.
Definition: chirp_types.h:35
void * buffer
Pointer to data buffer for PREAD, PWRITE, SREAD, and SWRITE.
Definition: chirp_types.h:162
struct chirp_file * file
The file to access for all operations.
Definition: chirp_types.h:160
INT64_T f_bsize
The size in bytes of a block.
Definition: chirp_types.h:76
INT64_T f_blocks
The total number of blocks in the filesystem.
Definition: chirp_types.h:74
INT64_T ndirs
The number of directories owned by that user.
Definition: chirp_types.h:178
INT64_T cst_nlink
The number of hard links to this file.
Definition: chirp_types.h:38
INT64_T cst_size
The size of the file, in bytes.
Definition: chirp_types.h:42
INT64_T errnum
On failure, contains the errno for the call.
Definition: chirp_types.h:168
#define CHIRP_PATH_MAX
The maximum length of a full path in any Chirp operation.
Definition: chirp_protocol.h:20
struct chirp_stat info
The properties of the directory entry.
Definition: chirp_types.h:98
Perform a chirp_reli_fsync.
Definition: chirp_types.h:151
INT64_T length
Length of the data, in bytes, for PREAD, WRITE, SREAD, and SWRITE.
Definition: chirp_types.h:163
char name[CHIRP_PATH_MAX]
The identity of the user.
Definition: chirp_types.h:176
INT64_T nfiles
The number of files owned by that user.
Definition: chirp_types.h:177
INT64_T f_bfree
The number of blocks free.
Definition: chirp_types.h:77
Describes a bulk I/O operation.
Definition: chirp_types.h:158
INT64_T cst_blksize
The recommended transfer block size for accessing this file.
Definition: chirp_types.h:43
Describes a result from a search operation.
Definition: chirp_types.h:104
INT64_T cst_uid
The Unix UID of the file&#39;s owner.
Definition: chirp_types.h:39
INT64_T cst_atime
The last time the file was accessed, in time_t format.
Definition: chirp_types.h:45
INT64_T stride_skip
Distance between start of each stride for SREAD and SWRITE.
Definition: chirp_types.h:165
char * name
The name of the directory entry.
Definition: chirp_types.h:96
Perform a chirp_reli_pwrite.
Definition: chirp_types.h:147
void(* chirp_longdir_t)(const char *path, struct chirp_stat *info, void *arg)
A callback function typedef used to display a detailed directory.
Definition: chirp_types.h:201
void(* chirp_loc_t)(const char *location, void *arg)
A callback function typedef used to display a file&#39;s location(s).
Definition: chirp_types.h:211
Describes the properties of a file, much like the Unix stat structure.
Definition: chirp_types.h:34
void(* chirp_dir_t)(const char *path, void *arg)
A callback function typedef used to display a directory or access control list.
Definition: chirp_types.h:190
Descibes the space consumed by a single user on a Chirp server.
Definition: chirp_types.h:175
INT64_T stride_length
Length of each stride for SREAD and SWRITE.
Definition: chirp_types.h:164
char path[CHIRP_PATH_MAX]
Path of the matching file.
Definition: chirp_types.h:105
Keeps track of the state of a search stream.
Definition: chirp_types.h:113
INT64_T cst_ino
The inode number of the file.
Definition: chirp_types.h:36
INT64_T cst_gid
The Unix GID of the file&#39;s group varship.
Definition: chirp_types.h:40
chirp_bulkio_t
Describes the type of a bulk I/O operation.
Definition: chirp_types.h:145
INT64_T f_files
The maximum number of files (inodes) on the filesystem.
Definition: chirp_types.h:78
INT64_T f_ffree
The number of files (inodes) currently in use.
Definition: chirp_types.h:79
INT64_T cst_rdev
The device number, if this represents a device.
Definition: chirp_types.h:41
int64_t chirp_jobid_t
The type of Chirp job identifiers.
Definition: chirp_types.h:216
Perform a chirp_reli_fstat.
Definition: chirp_types.h:150
This file defines the binary values mandated by the Chirp Protocol specification, used by both the cl...
INT64_T cst_mode
The Unix mode bits of the file.
Definition: chirp_types.h:37
String Buffer Operations.
INT64_T cst_ctime
The last time the inode was changed, in time_t format.
Definition: chirp_types.h:47
Perform a chirp_reli_pread.
Definition: chirp_types.h:146
Describes the properties of a file system, much like the Unix statfs structure.
Definition: chirp_types.h:72
chirp_bulkio_t type
The type of I/O to perform.
Definition: chirp_types.h:159
Definition: buffer.h:26
INT64_T nbytes
The total bytes consumed by that user.
Definition: chirp_types.h:179
INT64_T f_bavail
The number of blocks available to an ordinary user.
Definition: chirp_types.h:75
INT64_T cst_mtime
The last time the file data was modified, time_t format.
Definition: chirp_types.h:46
int lstatus
The result of lstat on the entry.
Definition: chirp_types.h:97
INT64_T offset
Starting offset in file for PREAD, PWRITE, SREAD, and SWRITE.
Definition: chirp_types.h:166
INT64_T f_type
The integer type of the filesystem.
Definition: chirp_types.h:73
struct chirp_stat * info
Pointer to a data buffer for FSTAT.
Definition: chirp_types.h:161
struct chirp_stat info
The properties of the matching file.
Definition: chirp_types.h:106
Describes a directory entry returned by chirp_reli_readdir.
Definition: chirp_types.h:95
Perform a chirp_reli_swrite.
Definition: chirp_types.h:149
INT64_T result
On completion, contains result of operation.
Definition: chirp_types.h:167
Perform a chirp_reli_sread.
Definition: chirp_types.h:148
INT64_T cst_blocks
The number of blocks consumed by this file in the file system.
Definition: chirp_types.h:44