chirp_types.h
Go to the documentation of this file.
/*
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef CHIRP_TYPES_H
#define CHIRP_TYPES_H
#include "chirp_protocol.h"
#include "buffer.h"
#include "int_sizes.h"
#include <fcntl.h>
#include <sys/types.h>
#include <inttypes.h>
#include <stdint.h>
#include <time.h>
struct chirp_stat {
INT64_T cst_dev;
INT64_T cst_ino;
INT64_T cst_mode;
INT64_T cst_nlink;
INT64_T cst_uid;
INT64_T cst_gid;
INT64_T cst_rdev;
INT64_T cst_size;
INT64_T cst_blksize;
INT64_T cst_blocks;
INT64_T cst_atime;
INT64_T cst_mtime;
INT64_T cst_ctime;
};
#define chirp_stat_encode(B, info) \
do {\
buffer_putfstring(B, "%" PRId64, (info)->cst_dev);\
buffer_putfstring(B, " %" PRId64, (info)->cst_ino);\
buffer_putfstring(B, " %" PRId64, (info)->cst_mode);\
buffer_putfstring(B, " %" PRId64, (info)->cst_nlink);\
buffer_putfstring(B, " %" PRId64, (info)->cst_uid);\
buffer_putfstring(B, " %" PRId64, (info)->cst_gid);\
buffer_putfstring(B, " %" PRId64, (info)->cst_rdev);\
buffer_putfstring(B, " %" PRId64, (info)->cst_size);\
buffer_putfstring(B, " %" PRId64, (info)->cst_blksize);\
buffer_putfstring(B, " %" PRId64, (info)->cst_blocks);\
buffer_putfstring(B, " %" PRId64, (info)->cst_atime);\
buffer_putfstring(B, " %" PRId64, (info)->cst_mtime);\
buffer_putfstring(B, " %" PRId64, (info)->cst_ctime);\
} while (0)
struct chirp_statfs {
INT64_T f_type;
INT64_T f_blocks;
INT64_T f_bavail;
INT64_T f_bsize;
INT64_T f_bfree;
INT64_T f_files;
INT64_T f_ffree;
};
#define chirp_statfs_encode(B, info) \
do {\
buffer_putfstring(B, "%" PRId64, (info)->f_type);\
buffer_putfstring(B, " %" PRId64, (info)->f_bsize);\
buffer_putfstring(B, " %" PRId64, (info)->f_blocks);\
buffer_putfstring(B, " %" PRId64, (info)->f_bfree);\
buffer_putfstring(B, " %" PRId64, (info)->f_bavail);\
buffer_putfstring(B, " %" PRId64, (info)->f_files);\
buffer_putfstring(B, " %" PRId64, (info)->f_ffree);\
} while (0)
struct chirp_dirent {
char *name;
int lstatus;
struct chirp_stat info;
struct chirp_dirent *next;
};
struct chirp_searchent {
char path[CHIRP_PATH_MAX];
struct chirp_stat info;
int errsource;
int err;
};
struct chirp_searchstream {
struct chirp_searchent entry;
const char *current;
buffer_t B;
};
#define CHIRP_SEARCH struct chirp_searchstream
#define CHIRP_SEARCH_STOPATFIRST (1<<0)
#define CHIRP_SEARCH_METADATA (1<<1)
#define CHIRP_SEARCH_INCLUDEROOT (1<<2)
#define CHIRP_SEARCH_PERIOD (1<<3)
#define CHIRP_SEARCH_R_OK (1<<4)
#define CHIRP_SEARCH_W_OK (1<<5)
#define CHIRP_SEARCH_X_OK (1<<6)
#define CHIRP_SEARCH_ERR_OPEN 1
#define CHIRP_SEARCH_ERR_READ 2
#define CHIRP_SEARCH_ERR_CLOSE 3
#define CHIRP_SEARCH_ERR_STAT 4
#define CHIRP_SEARCH_DELIMITER '|'
#define CHIRP_SEARCH_DEPTH_MAX 200
typedef enum {
CHIRP_BULKIO_PREAD,
CHIRP_BULKIO_PWRITE,
CHIRP_BULKIO_SREAD,
CHIRP_BULKIO_SWRITE,
CHIRP_BULKIO_FSTAT,
CHIRP_BULKIO_FSYNC
} chirp_bulkio_t;
struct chirp_bulkio {
chirp_bulkio_t type;
struct chirp_file *file;
struct chirp_stat *info;
void *buffer;
INT64_T length;
INT64_T stride_length;
INT64_T stride_skip;
INT64_T offset;
INT64_T result;
INT64_T errnum;
};
struct chirp_audit {
char name[CHIRP_PATH_MAX];
INT64_T nfiles;
INT64_T ndirs;
INT64_T nbytes;
};
typedef void (*chirp_dir_t) (const char *path, void *arg);
typedef void (*chirp_longdir_t) (const char *path, struct chirp_stat * info, void *arg);
typedef void (*chirp_loc_t) (const char *location, void *arg);
typedef int64_t chirp_jobid_t;
#define PRICHIRP_JOBID_T PRId64
#define SCNCHIRP_JOBID_T SCNd64
#define CHIRP_DIGEST_MAX 128
#endif
/* vim: set noexpandtab tabstop=8: */
buffer.h
String Buffer Operations.
chirp_protocol.h
This file defines the binary values mandated by the Chirp Protocol specification, used by both the cl...
CHIRP_PATH_MAX
#define CHIRP_PATH_MAX
The maximum length of a full path in any Chirp operation.
Definition chirp_protocol.h:20
chirp_dir_t
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
chirp_loc_t
void(* chirp_loc_t)(const char *location, void *arg)
A callback function typedef used to display a file's location(s).
Definition chirp_types.h:211
chirp_longdir_t
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
chirp_jobid_t
int64_t chirp_jobid_t
The type of Chirp job identifiers.
Definition chirp_types.h:216
chirp_bulkio_t
chirp_bulkio_t
Describes the type of a bulk I/O operation.
Definition chirp_types.h:145
CHIRP_BULKIO_SREAD
@ CHIRP_BULKIO_SREAD
Perform a chirp_reli_sread.
Definition chirp_types.h:148
CHIRP_BULKIO_FSTAT
@ CHIRP_BULKIO_FSTAT
Perform a chirp_reli_fstat.
Definition chirp_types.h:150
CHIRP_BULKIO_FSYNC
@ CHIRP_BULKIO_FSYNC
Perform a chirp_reli_fsync.
Definition chirp_types.h:151
CHIRP_BULKIO_PREAD
@ CHIRP_BULKIO_PREAD
Perform a chirp_reli_pread.
Definition chirp_types.h:146
CHIRP_BULKIO_SWRITE
@ CHIRP_BULKIO_SWRITE
Perform a chirp_reli_swrite.
Definition chirp_types.h:149
CHIRP_BULKIO_PWRITE
@ CHIRP_BULKIO_PWRITE
Perform a chirp_reli_pwrite.
Definition chirp_types.h:147
chirp_audit
Descibes the space consumed by a single user on a Chirp server.
Definition chirp_types.h:175
chirp_audit::nbytes
INT64_T nbytes
The total bytes consumed by that user.
Definition chirp_types.h:179
chirp_audit::ndirs
INT64_T ndirs
The number of directories owned by that user.
Definition chirp_types.h:178
chirp_audit::nfiles
INT64_T nfiles
The number of files owned by that user.
Definition chirp_types.h:177
chirp_audit::name
char name[CHIRP_PATH_MAX]
The identity of the user.
Definition chirp_types.h:176
chirp_bulkio
Describes a bulk I/O operation.
Definition chirp_types.h:158
chirp_bulkio::offset
INT64_T offset
Starting offset in file for PREAD, PWRITE, SREAD, and SWRITE.
Definition chirp_types.h:166
chirp_bulkio::length
INT64_T length
Length of the data, in bytes, for PREAD, WRITE, SREAD, and SWRITE.
Definition chirp_types.h:163
chirp_bulkio::result
INT64_T result
On completion, contains result of operation.
Definition chirp_types.h:167
chirp_bulkio::stride_length
INT64_T stride_length
Length of each stride for SREAD and SWRITE.
Definition chirp_types.h:164
chirp_bulkio::errnum
INT64_T errnum
On failure, contains the errno for the call.
Definition chirp_types.h:168
chirp_bulkio::info
struct chirp_stat * info
Pointer to a data buffer for FSTAT.
Definition chirp_types.h:161
chirp_bulkio::stride_skip
INT64_T stride_skip
Distance between start of each stride for SREAD and SWRITE.
Definition chirp_types.h:165
chirp_bulkio::buffer
void * buffer
Pointer to data buffer for PREAD, PWRITE, SREAD, and SWRITE.
Definition chirp_types.h:162
chirp_bulkio::type
chirp_bulkio_t type
The type of I/O to perform.
Definition chirp_types.h:159
chirp_bulkio::file
struct chirp_file * file
The file to access for all operations.
Definition chirp_types.h:160
chirp_dirent
Describes a directory entry returned by chirp_reli_readdir.
Definition chirp_types.h:95
chirp_dirent::name
char * name
The name of the directory entry.
Definition chirp_types.h:96
chirp_dirent::lstatus
int lstatus
The result of lstat on the entry.
Definition chirp_types.h:97
chirp_dirent::info
struct chirp_stat info
The properties of the directory entry.
Definition chirp_types.h:98
chirp_searchent
Describes a result from a search operation.
Definition chirp_types.h:104
chirp_searchent::info
struct chirp_stat info
The properties of the matching file.
Definition chirp_types.h:106
chirp_searchent::path
char path[CHIRP_PATH_MAX]
Path of the matching file.
Definition chirp_types.h:105
chirp_searchstream
Keeps track of the state of a search stream.
Definition chirp_types.h:113
chirp_stat
Describes the properties of a file, much like the Unix stat structure.
Definition chirp_types.h:34
chirp_stat::cst_nlink
INT64_T cst_nlink
The number of hard links to this file.
Definition chirp_types.h:38
chirp_stat::cst_blocks
INT64_T cst_blocks
The number of blocks consumed by this file in the file system.
Definition chirp_types.h:44
chirp_stat::cst_size
INT64_T cst_size
The size of the file, in bytes.
Definition chirp_types.h:42
chirp_stat::cst_dev
INT64_T cst_dev
The device number on which the file is stored.
Definition chirp_types.h:35
chirp_stat::cst_atime
INT64_T cst_atime
The last time the file was accessed, in time_t format.
Definition chirp_types.h:45
chirp_stat::cst_ctime
INT64_T cst_ctime
The last time the inode was changed, in time_t format.
Definition chirp_types.h:47
chirp_stat::cst_blksize
INT64_T cst_blksize
The recommended transfer block size for accessing this file.
Definition chirp_types.h:43
chirp_stat::cst_gid
INT64_T cst_gid
The Unix GID of the file's group varship.
Definition chirp_types.h:40
chirp_stat::cst_rdev
INT64_T cst_rdev
The device number, if this represents a device.
Definition chirp_types.h:41
chirp_stat::cst_mtime
INT64_T cst_mtime
The last time the file data was modified, time_t format.
Definition chirp_types.h:46
chirp_stat::cst_ino
INT64_T cst_ino
The inode number of the file.
Definition chirp_types.h:36
chirp_stat::cst_mode
INT64_T cst_mode
The Unix mode bits of the file.
Definition chirp_types.h:37
chirp_stat::cst_uid
INT64_T cst_uid
The Unix UID of the file's owner.
Definition chirp_types.h:39
chirp_statfs
Describes the properties of a file system, much like the Unix statfs structure.
Definition chirp_types.h:72
chirp_statfs::f_bfree
INT64_T f_bfree
The number of blocks free.
Definition chirp_types.h:77
chirp_statfs::f_bsize
INT64_T f_bsize
The size in bytes of a block.
Definition chirp_types.h:76
chirp_statfs::f_bavail
INT64_T f_bavail
The number of blocks available to an ordinary user.
Definition chirp_types.h:75
chirp_statfs::f_files
INT64_T f_files
The maximum number of files (inodes) on the filesystem.
Definition chirp_types.h:78
chirp_statfs::f_type
INT64_T f_type
The integer type of the filesystem.
Definition chirp_types.h:73
chirp_statfs::f_blocks
INT64_T f_blocks
The total number of blocks in the filesystem.
Definition chirp_types.h:74
chirp_statfs::f_ffree
INT64_T f_ffree
The number of files (inodes) currently in use.
Definition chirp_types.h:79