~ubuntu-branches/ubuntu/vivid/cctools/vivid

« back to all changes in this revision

Viewing changes to chirp/src/chirp_types.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Hanke
  • Date: 2011-05-07 09:05:00 UTC
  • Revision ID: james.westby@ubuntu.com-20110507090500-lqpmdtwndor6e7os
Tags: upstream-3.3.2
ImportĀ upstreamĀ versionĀ 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
8
/** @file chirp_types.h
 
9
All of the structure and type definitions used by the Chirp API.
 
10
*/
 
11
 
 
12
#ifndef CHIRP_TYPES_H
 
13
#define CHIRP_TYPES_H
 
14
 
 
15
#include "int_sizes.h"
 
16
#include "chirp_protocol.h"
 
17
 
 
18
#include <sys/types.h>
 
19
#include <time.h>
 
20
#include <fcntl.h>
 
21
 
 
22
/** Describes the properties of a file, much like the Unix <tt>stat</tt> structure.
 
23
Note that @ref cst_uid, @ref cst_gid, and @ref cst_mode are provided for backwards compatibility, but are
 
24
ignored by Chirp when enforcing access control.  See @ref chirp_reli_setacl and @ref chirp_reli_getacl
 
25
for more information about enforcing access controls.
 
26
@see chirp_reli_stat, chirp_reli_lstat, chirp_reli_fstat, chirp_reli_open
 
27
*/
 
28
 
 
29
struct chirp_stat {
 
30
        INT64_T cst_dev;        /**< The device number on which the file is stored. */
 
31
        INT64_T cst_ino;        /**< The inode number of the file. */
 
32
        INT64_T cst_mode;       /**< The Unix mode bits of the file. */
 
33
        INT64_T cst_nlink;      /**< The number of hard links to this file. */
 
34
        INT64_T cst_uid;        /**< The Unix UID of the file's owner. */
 
35
        INT64_T cst_gid;        /**< The Unix GID of the file's group varship. */
 
36
        INT64_T cst_rdev;       /**< The device number, if this represents a device. */
 
37
        INT64_T cst_size;       /**< The size of the file, in bytes. */
 
38
        INT64_T cst_blksize;    /**< The recommended transfer block size for accessing this file.  */
 
39
        INT64_T cst_blocks;     /**< The number of blocks consumed by this file in the file system.  Note that this value has nothing to do with @ref cst_blksize.  The size of the actual storage blocks is given by <tt>f_bsize</tt> in @ref chirp_statfs. */
 
40
        INT64_T cst_atime;      /**< The last time the file was accessed, in <tt>time_t</tt> format. */
 
41
        INT64_T cst_mtime;      /**< The last time the file data was modified,  <tt>time_t</tt> format. */
 
42
        INT64_T cst_ctime;      /**< The last time the inode was changed, in <tt>time_t</tt> format. */
 
43
};
 
44
 
 
45
/** Describes the properties of a file system, much like the Unix <tt>statfs</tt> structure.
 
46
@see chirp_reli_statfs, chirp_reli_fstatfs
 
47
*/
 
48
 
 
49
struct chirp_statfs {
 
50
        INT64_T f_type;         /**< The integer type of the filesystem */
 
51
        INT64_T f_blocks;       /**< The total number of blocks in the filesystem. */
 
52
        INT64_T f_bavail;       /**< The number of blocks available to an ordinary user. */
 
53
        INT64_T f_bsize;        /**< The size in bytes of a block. */
 
54
        INT64_T f_bfree;        /**< The number of blocks free. */
 
55
        INT64_T f_files;        /**< The maximum number of files (inodes) on the filesystem. */
 
56
        INT64_T f_ffree;        /**< The number of files (inodes) currently in use. */
 
57
};
 
58
 
 
59
/** Describes a directory entry returned by @ref chirp_reli_readdir */
 
60
 
 
61
struct chirp_dirent {
 
62
        char *name;                     /**< The name of the directory entry. */
 
63
        struct chirp_stat info;         /**< The properties of the directory entry. */
 
64
        struct chirp_dirent *next;
 
65
};
 
66
 
 
67
/** Describes the type of a bulk I/O operation. Used by @ref chirp_bulkio */
 
68
 
 
69
typedef enum {
 
70
        CHIRP_BULKIO_PREAD,  /**< Perform a chirp_reli_pread.*/
 
71
        CHIRP_BULKIO_PWRITE, /**< Perform a chirp_reli_pwrite.*/
 
72
        CHIRP_BULKIO_SREAD,  /**< Perform a chirp_reli_sread.*/
 
73
        CHIRP_BULKIO_SWRITE, /**< Perform a chirp_reli_swrite.*/
 
74
        CHIRP_BULKIO_FSTAT,  /**< Perform a chirp_reli_fstat.*/
 
75
        CHIRP_BULKIO_FSYNC,   /**< Perform a chirp_reli_fsync.*/
 
76
} chirp_bulkio_t;
 
77
 
 
78
/** Describes a bulk I/O operation.
 
79
An array of chirp_bulkio structures passed to @ref chirp_reli_bulkio describes a list of multiple operatons to be performed simultaneously.  Not all fields are relevant to all operations.
 
80
*/
 
81
 
 
82
struct chirp_bulkio {
 
83
        chirp_bulkio_t type;       /**< The type of I/O to perform. */
 
84
        struct chirp_file *file;   /**< The file to access for all operations. */
 
85
        struct chirp_stat *info;   /**< Pointer to a data buffer for FSTAT */
 
86
        void   *buffer;            /**< Pointer to data buffer for PREAD, PWRITE, SREAD, and SWRITE */
 
87
        INT64_T length;            /**< Length of the data, in bytes, for PREAD, WRITE, SREAD, and SWRITE. */
 
88
        INT64_T stride_length;     /**< Length of each stride for SREAD and SWRITE. */
 
89
        INT64_T stride_skip;       /**< Distance between start of each stride for SREAD and SWRITE. */
 
90
        INT64_T offset;            /**< Starting offset in file for PREAD, PWRITE, SREAD, and SWRITE. */
 
91
        INT64_T result;            /**< On completion, contains result of operation. */
 
92
        INT64_T errnum;            /**< On failure, contains the errno for the call. */
 
93
};
 
94
 
 
95
/** Descibes the space consumed by a single user on a Chirp server.
 
96
@see chirp_reli_audit
 
97
*/
 
98
 
 
99
struct chirp_audit {
 
100
        char    name[CHIRP_PATH_MAX];   /**< The identity of the user. */
 
101
        INT64_T nfiles;                 /**< The number of files owned by that user. */
 
102
        INT64_T ndirs;                  /**< The number of directories owned by that user. */
 
103
        INT64_T nbytes;                 /**< The total bytes consumed by that user. */
 
104
};
 
105
 
 
106
/** Describes the progress of an active storage job through its lifetime.
 
107
@see chirp_job_state, chirp_reli_job_wait, chirp_reli_job_list
 
108
*/
 
109
 
 
110
typedef enum {
 
111
        CHIRP_JOB_STATE_BEGIN=0,        /**< The job has been created, but not yet committed */
 
112
        CHIRP_JOB_STATE_IDLE=1,         /**< The job has been committed, and is free to run. */
 
113
        CHIRP_JOB_STATE_RUNNING=2,      /**< The job is currently running. */
 
114
        CHIRP_JOB_STATE_SUSPENDED=3,    /**< The job has been temporarily suspended. */
 
115
        CHIRP_JOB_STATE_COMPLETE=4,     /**< The job ran all the way to completion. */
 
116
        CHIRP_JOB_STATE_FAILED=5,       /**< The job could not be run at all. */
 
117
        CHIRP_JOB_STATE_KILLED=6,       /**< The job was forcibly killed by the owner or administrator. */
 
118
} chirp_job_state_t; 
 
119
 
 
120
/** Gives a readable string corresponding to a job state.
 
121
@return A constant string corresponding to the job state, e.g. "BEGIN".
 
122
*/
 
123
 
 
124
const char * chirp_job_state_string( chirp_job_state_t state );
 
125
 
 
126
/** Describes the current state of an active storage job on a Chirp server.
 
127
@see chirp_reli_job_wait, chirp_reli_job_list
 
128
*/
 
129
 
 
130
struct chirp_job_state {
 
131
        INT64_T jobid;                          /**< The unique job identifier */
 
132
        char    command[CHIRP_PATH_MAX];        /**< The actual command to be run */
 
133
        char    owner[CHIRP_PATH_MAX];          /**< The owner of the job */
 
134
        chirp_job_state_t state;                /**< The current state of the job. */ 
 
135
        int     exit_code;                      /**< If completed, the exit code of the job. */
 
136
        time_t  submit_time;                    /**< The time at which @ref chirp_reli_job_begin was invoked */
 
137
        time_t  start_time;                     /**< The time at which the job most recently began executing */
 
138
        time_t  stop_time;                      /**< The time at which the job completed or was aborted. */
 
139
        int     pid;                            /**< If running, the local process ID of the job. */
 
140
};
 
141
 
 
142
/** A callback function typedef used to display a directory or access control list.
 
143
A function matching this type is called by @ref chirp_reli_getdir
 
144
to display or otherwise act upon each line in a directory or access control list.
 
145
@param path The short name of the file, directory, or ACL to display.
 
146
@param arg  A convenience pointer corresponding to the <tt>arg</tt> passed from @ref chirp_reli_getdir.
 
147
@see chirp_reli_getdir, chirp_reli_getacl
 
148
*/
 
149
 
 
150
typedef void (*chirp_dir_t) ( const char *path, void *arg );
 
151
 
 
152
/** A callback function typedef used to display a detailed directory.
 
153
A function matching this type is called by @ref chirp_reli_getlongdir
 
154
to display or otherwise act upon each line in a directory listing.
 
155
@param path The short name of the file or directory to display.
 
156
@param info The details of the named file.
 
157
@param arg  A convenience pointer corresponding to the <tt>arg</tt> passed from @ref chirp_reli_getlongdir.
 
158
@see chirp_reli_getlongdir
 
159
*/
 
160
 
 
161
typedef void (*chirp_longdir_t) ( const char *path, struct chirp_stat *info, void *arg );
 
162
 
 
163
/** A callback function typedef used to display a job state.
 
164
A function matching this type is called by @ref chirp_reli_job_list
 
165
to display or otherwise act upon all active storage jobs in a server.
 
166
@param state The name and detailed state of one job.
 
167
@param arg  A convenience pointer corresponding to the <tt>arg</tt> passed from @ref chirp_reli_job_list
 
168
@see chirp_reli_job_list
 
169
*/
 
170
 
 
171
typedef void (*chirp_joblist_t) ( struct chirp_job_state *state, void *arg );
 
172
 
 
173
/** A callback function typedef used to display a file's location(s).
 
174
A function matching this type is called by @ref chirp_reli_locate
 
175
to display or otherwise act upon each location at which a given file is stored.
 
176
@param location The location of a file (usually hostname:local_path).
 
177
@param arg  A convenience pointer corresponding to the <tt>arg</tt> passed from @ref chirp_reli_locate.
 
178
@see chirp_reli_locate
 
179
*/
 
180
 
 
181
typedef void (*chirp_loc_t) ( const char *location, void *arg );
 
182
 
 
183
#endif