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_MAXENCODING (4096)
51 #define chirp_stat_encode(s, info) \
52 do {\
53  int n = 0;\
54  n += sprintf((s)+n, "%" PRId64, (info)->cst_dev);\
55  n += sprintf((s)+n, " %" PRId64, (info)->cst_ino);\
56  n += sprintf((s)+n, " %" PRId64, (info)->cst_mode);\
57  n += sprintf((s)+n, " %" PRId64, (info)->cst_nlink);\
58  n += sprintf((s)+n, " %" PRId64, (info)->cst_uid);\
59  n += sprintf((s)+n, " %" PRId64, (info)->cst_gid);\
60  n += sprintf((s)+n, " %" PRId64, (info)->cst_rdev);\
61  n += sprintf((s)+n, " %" PRId64, (info)->cst_size);\
62  n += sprintf((s)+n, " %" PRId64, (info)->cst_blksize);\
63  n += sprintf((s)+n, " %" PRId64, (info)->cst_blocks);\
64  n += sprintf((s)+n, " %" PRId64, (info)->cst_atime);\
65  n += sprintf((s)+n, " %" PRId64, (info)->cst_mtime);\
66  n += sprintf((s)+n, " %" PRId64, (info)->cst_ctime);\
67 } while (0)
68 
69 
74 struct chirp_statfs {
75  INT64_T f_type;
76  INT64_T f_blocks;
77  INT64_T f_bavail;
78  INT64_T f_bsize;
79  INT64_T f_bfree;
80  INT64_T f_files;
81  INT64_T f_ffree;
82 };
83 
84 #define CHIRP_STATFS_MAXENCODING (4096)
85 #define chirp_statfs_encode(s, info) \
86 do {\
87  int n = 0;\
88  n += sprintf((s)+n, "%" PRId64, (info)->f_type);\
89  n += sprintf((s)+n, " %" PRId64, (info)->f_bsize);\
90  n += sprintf((s)+n, " %" PRId64, (info)->f_blocks);\
91  n += sprintf((s)+n, " %" PRId64, (info)->f_bfree);\
92  n += sprintf((s)+n, " %" PRId64, (info)->f_bavail);\
93  n += sprintf((s)+n, " %" PRId64, (info)->f_files);\
94  n += sprintf((s)+n, " %" PRId64, (info)->f_ffree);\
95 } while (0)
96 
99 struct chirp_dirent {
100  char *name;
101  int lstatus;
102  struct chirp_stat info;
103  struct chirp_dirent *next;
104 };
105 
110  struct chirp_stat info;
111  int errsource;
112  int err;
113 };
114 
118  struct chirp_searchent entry;
119  const char *current;
120  buffer_t B;
121 };
122 
123 #define CHIRP_SEARCH struct chirp_searchstream
124 
127 #define CHIRP_SEARCH_STOPATFIRST (1<<0)
128 #define CHIRP_SEARCH_METADATA (1<<1)
129 #define CHIRP_SEARCH_INCLUDEROOT (1<<2)
130 #define CHIRP_SEARCH_PERIOD (1<<3)
131 #define CHIRP_SEARCH_R_OK (1<<4)
132 #define CHIRP_SEARCH_W_OK (1<<5)
133 #define CHIRP_SEARCH_X_OK (1<<6)
134 
137 #define CHIRP_SEARCH_ERR_OPEN 1
138 #define CHIRP_SEARCH_ERR_READ 2
139 #define CHIRP_SEARCH_ERR_CLOSE 3
140 #define CHIRP_SEARCH_ERR_STAT 4
141 
144 #define CHIRP_SEARCH_DELIMITER '|'
145 #define CHIRP_SEARCH_DEPTH_MAX 200
146 
149 typedef enum {
157 
162 struct chirp_bulkio {
164  struct chirp_file *file;
165  struct chirp_stat *info;
166  void *buffer;
167  INT64_T length;
168  INT64_T stride_length;
169  INT64_T stride_skip;
170  INT64_T offset;
171  INT64_T result;
172  INT64_T errnum;
173 };
174 
179 struct chirp_audit {
181  INT64_T nfiles;
182  INT64_T ndirs;
183  INT64_T nbytes;
184 };
185 
194 typedef void (*chirp_dir_t) (const char *path, void *arg);
195 
205 typedef void (*chirp_longdir_t) (const char *path, struct chirp_stat * info, void *arg);
206 
215 typedef void (*chirp_loc_t) (const char *location, void *arg);
216 
217 
220 typedef int64_t chirp_jobid_t;
221 #define PRICHIRP_JOBID_T PRId64
222 #define SCNCHIRP_JOBID_T SCNd64
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:166
struct chirp_file * file
The file to access for all operations.
Definition: chirp_types.h:164
INT64_T f_bsize
The size in bytes of a block.
Definition: chirp_types.h:78
INT64_T f_blocks
The total number of blocks in the filesystem.
Definition: chirp_types.h:76
INT64_T ndirs
The number of directories owned by that user.
Definition: chirp_types.h:182
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:172
#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:102
Perform a chirp_reli_fsync.
Definition: chirp_types.h:155
INT64_T length
Length of the data, in bytes, for PREAD, WRITE, SREAD, and SWRITE.
Definition: chirp_types.h:167
char name[CHIRP_PATH_MAX]
The identity of the user.
Definition: chirp_types.h:180
INT64_T nfiles
The number of files owned by that user.
Definition: chirp_types.h:181
INT64_T f_bfree
The number of blocks free.
Definition: chirp_types.h:79
Describes a bulk I/O operation.
Definition: chirp_types.h:162
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:108
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:169
char * name
The name of the directory entry.
Definition: chirp_types.h:100
Perform a chirp_reli_pwrite.
Definition: chirp_types.h:151
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:205
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:215
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:194
Descibes the space consumed by a single user on a Chirp server.
Definition: chirp_types.h:179
INT64_T stride_length
Length of each stride for SREAD and SWRITE.
Definition: chirp_types.h:168
char path[CHIRP_PATH_MAX]
Path of the matching file.
Definition: chirp_types.h:109
Keeps track of the state of a search stream.
Definition: chirp_types.h:117
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:149
INT64_T f_files
The maximum number of files (inodes) on the filesystem.
Definition: chirp_types.h:80
INT64_T f_ffree
The number of files (inodes) currently in use.
Definition: chirp_types.h:81
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:220
Perform a chirp_reli_fstat.
Definition: chirp_types.h:154
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:150
Describes the properties of a file system, much like the Unix statfs structure.
Definition: chirp_types.h:74
chirp_bulkio_t type
The type of I/O to perform.
Definition: chirp_types.h:163
Definition: buffer.h:23
INT64_T nbytes
The total bytes consumed by that user.
Definition: chirp_types.h:183
INT64_T f_bavail
The number of blocks available to an ordinary user.
Definition: chirp_types.h:77
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:101
INT64_T offset
Starting offset in file for PREAD, PWRITE, SREAD, and SWRITE.
Definition: chirp_types.h:170
INT64_T f_type
The integer type of the filesystem.
Definition: chirp_types.h:75
struct chirp_stat * info
Pointer to a data buffer for FSTAT.
Definition: chirp_types.h:165
struct chirp_stat info
The properties of the matching file.
Definition: chirp_types.h:110
Describes a directory entry returned by chirp_reli_readdir.
Definition: chirp_types.h:99
Perform a chirp_reli_swrite.
Definition: chirp_types.h:153
INT64_T result
On completion, contains result of operation.
Definition: chirp_types.h:171
Perform a chirp_reli_sread.
Definition: chirp_types.h:152
INT64_T cst_blocks
The number of blocks consumed by this file in the file system.
Definition: chirp_types.h:44