afsio is a command to pipe data into or out of afs files

afsio bypasses the cache manager to achieve higher throughput.
However, it uses the cache manager to stat or create files over the
AFS path.

Besides 'apropos' and 'help' there are 3 subcommands:

'write'	pipes data into a new or empty AFS file

'append' pipes data at the end of an existing AFS file

'read' pipes data out of an AFS file

for 'write' there is an option '-md5' which calculates on the fly
the md5 chscksum and prints it to stdout. (Useful when you create
long time archives to keep it separately for later ...)

for 'write' there is also an option '-synthesize <size>' to do just
performance tests. It creates a file which contains at the
begin of each 4 KB block the offset printed in ascii.

for all subcommands exists a '-verbose' option which writes to
stderr data rate and timing information.

All three subcommands may also be used prefixed with 'fid' accepting
then a Fid instead of an AFS path. With the 'fid' prefix also a '-cell'
option is allowed.

Reviewed-on: http://gerrit.openafs.org/555
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Hartmut Reuter 2009-09-30 10:06:14 +02:00 committed by Derrick Brashear
parent db23268f68
commit 4e3d3d5049
5 changed files with 1607 additions and 0 deletions

View File

@ -283,10 +283,12 @@ typedef struct afsUUID afsUUID;
*/
#ifdef AFS_NT40_ENV
#define AFS_INT64_FMT "I64d"
#define AFS_UINT64_FMT "I64u"
#define AFS_PTR_FMT "Ip"
#define AFS_SIZET_FMT "Iu"
#else
#define AFS_INT64_FMT "lld"
#define AFS_UINT64_FMT "llu"
#define AFS_PTR_FMT "p"
#define AFS_SIZET_FMT "u"
#endif

View File

@ -201,6 +201,8 @@ extern afs_int32 volutil_PartitionName2_r(afs_int32 part, char *tbuffer, size_t
extern char *volutil_PartitionName(int avalue);
extern afs_int32 util_GetInt32(register char *as, afs_int32 * aval);
extern afs_uint32 util_GetUInt32(register char *as, afs_uint32 * aval);
extern afs_int64 util_GetInt64(char *as, afs_int64 * aval);
extern afs_uint64 util_GetUInt64(char *as, afs_uint64 * aval);
extern afs_int32 util_GetHumanInt32(register char *as, afs_int32 * aval);
/* winsock_nt.c */

View File

@ -341,3 +341,92 @@ util_GetHumanInt32(register char *as, afs_int32 * aval)
return 0;
}
afs_int64
util_GetInt64(char *as, afs_int64 * aval)
{
afs_int64 total;
int tc;
int base;
int negative;
total = 0; /* initialize things */
negative = 0;
/* skip over leading spaces */
while ((tc = *as)) {
if (tc != ' ' && tc != '\t')
break;
}
/* compute sign */
if (*as == '-') {
negative = 1;
as++; /* skip over character */
}
/* compute the base */
if (*as == '0') {
as++;
if (*as == 'x' || *as == 'X') {
base = 16;
as++;
} else
base = 8;
} else
base = 10;
/* compute the # itself */
while ((tc = *as)) {
if (!ismeta(tc, base))
return -1;
total *= base;
total += getmeta(tc);
as++;
}
if (negative)
*aval = -total;
else
*aval = total;
return 0;
}
afs_uint64
util_GetUInt64(char *as, afs_uint64 * aval)
{
afs_uint64 total;
int tc;
int base;
total = 0; /* initialize things */
/* skip over leading spaces */
while ((tc = *as)) {
if (tc != ' ' && tc != '\t')
break;
}
/* compute the base */
if (*as == '0') {
as++;
if (*as == 'x' || *as == 'X') {
base = 16;
as++;
} else
base = 8;
} else
base = 10;
/* compute the # itself */
while ((tc = *as)) {
if (!ismeta(tc, base))
return -1;
total *= base;
total += getmeta(tc);
as++;
}
*aval = total;
return 0;
}

View File

@ -66,6 +66,11 @@ fs.o: fs.c ${INCLS} AFS_component_version_number.c
fs: fs.o $(LIBS)
${CC} ${CFLAGS} -o fs fs.o ${TOP_LIBDIR}/libprot.a $(LIBS) ${XLIBS}
afsio.o: afsio.c ${INCLS} AFS_component_version_number.c
afsio: afsio.o $(LIBS)
${CC} ${CFLAGS} -o afsio afsio.o ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libafsint.a $(LIBS) ${XLIBS}
livesys.o: livesys.c ${INCLS} AFS_component_version_number.c
livesys: livesys.c $(LIBS)

1509
src/venus/afsio.c Normal file

File diff suppressed because it is too large Load Diff