No Message Supplied

This commit is contained in:
Dean Roehrich
2001-08-10 21:28:55 +00:00
parent a6e2abd67c
commit bf83af9f61
5 changed files with 357 additions and 7 deletions
+2 -1
View File
@@ -32,6 +32,7 @@
## http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
##
bin_PROGRAMS = read_invis set_region set_return_on_destroy write_invis
bin_PROGRAMS = read_invis set_region set_return_on_destroy write_invis \
handle_write_invis handle_read_invis
LDADD = $(top_builddir)/src/common/lib/libdmtest.la
+27 -5
View File
@@ -71,7 +71,8 @@ PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
bin_PROGRAMS = read_invis set_region set_return_on_destroy write_invis
bin_PROGRAMS = read_invis set_region set_return_on_destroy write_invis handle_write_invis handle_read_invis
LDADD = $(top_builddir)/src/common/lib/libdmtest.la
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -103,6 +104,18 @@ write_invis_OBJECTS = write_invis.o
write_invis_LDADD = $(LDADD)
write_invis_DEPENDENCIES = $(top_builddir)/src/common/lib/libdmtest.la
write_invis_LDFLAGS =
handle_write_invis_SOURCES = handle_write_invis.c
handle_write_invis_OBJECTS = handle_write_invis.o
handle_write_invis_LDADD = $(LDADD)
handle_write_invis_DEPENDENCIES = \
$(top_builddir)/src/common/lib/libdmtest.la
handle_write_invis_LDFLAGS =
handle_read_invis_SOURCES = handle_read_invis.c
handle_read_invis_OBJECTS = handle_read_invis.o
handle_read_invis_LDADD = $(LDADD)
handle_read_invis_DEPENDENCIES = \
$(top_builddir)/src/common/lib/libdmtest.la
handle_read_invis_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@@ -115,10 +128,11 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
DEP_FILES = .deps/read_invis.P .deps/set_region.P \
.deps/set_return_on_destroy.P .deps/write_invis.P
SOURCES = read_invis.c set_region.c set_return_on_destroy.c write_invis.c
OBJECTS = read_invis.o set_region.o set_return_on_destroy.o write_invis.o
DEP_FILES = .deps/handle_read_invis.P .deps/handle_write_invis.P \
.deps/read_invis.P .deps/set_region.P .deps/set_return_on_destroy.P \
.deps/write_invis.P
SOURCES = read_invis.c set_region.c set_return_on_destroy.c write_invis.c handle_write_invis.c handle_read_invis.c
OBJECTS = read_invis.o set_region.o set_return_on_destroy.o write_invis.o handle_write_invis.o handle_read_invis.o
all: all-redirect
.SUFFIXES:
@@ -204,6 +218,14 @@ write_invis: $(write_invis_OBJECTS) $(write_invis_DEPENDENCIES)
@rm -f write_invis
$(LINK) $(write_invis_LDFLAGS) $(write_invis_OBJECTS) $(write_invis_LDADD) $(LIBS)
handle_write_invis: $(handle_write_invis_OBJECTS) $(handle_write_invis_DEPENDENCIES)
@rm -f handle_write_invis
$(LINK) $(handle_write_invis_LDFLAGS) $(handle_write_invis_OBJECTS) $(handle_write_invis_LDADD) $(LIBS)
handle_read_invis: $(handle_read_invis_OBJECTS) $(handle_read_invis_DEPENDENCIES)
@rm -f handle_read_invis
$(LINK) $(handle_read_invis_LDFLAGS) $(handle_read_invis_OBJECTS) $(handle_read_invis_LDADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
+165
View File
@@ -0,0 +1,165 @@
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#include <ctype.h>
#include <lib/hsm.h>
#include <string.h>
#include <malloc.h>
#include <unistd.h>
/*---------------------------------------------------------------------------
Test program used to test the DMAPI function dm_read_invis(). The
command line is:
handle_read_invis [-o offset] [-l length] [-s sid] handle
where:
'offset' is the offset of the start of the write (0 is the default),
'length' is the length of the write in bytes (1 is the default),
'sid' is the session ID whose events you you are interested in.
'handle' is the ascii representation of the file's handle.
You can use the test tool path_to_handle to get this.
----------------------------------------------------------------------------*/
#ifndef linux
extern char *sys_errlist[];
#endif
extern int optind;
extern char *optarg;
char *Progname;
static void
usage(void)
{
fprintf(stderr, "usage:\t%s [-o offset] [-l length] "
"[-s sid] handle\n", Progname);
exit(1);
}
int
main(
int argc,
char **argv)
{
dm_sessid_t sid = DM_NO_SESSION;
char *han_str = NULL;
dm_off_t offset = 0;
dm_size_t length = 1;
char *bufp = NULL;
void *hanp;
size_t hlen;
dm_ssize_t rc;
char *name;
int opt;
int i;
int error;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
} else {
Progname = argv[0];
}
/* Crack and validate the command line options. */
while ((opt = getopt(argc, argv, "o:l:s:")) != EOF) {
switch (opt) {
case 'o':
offset = atol(optarg);
break;
case 'l':
length = atol(optarg);
break;
case 's':
sid = atol(optarg);
break;
case '?':
usage();
}
}
if (optind + 1 != argc)
usage();
han_str = argv[optind];
if (dm_init_service(&name) == -1) {
fprintf(stderr, "Can't inititalize the DMAPI\n");
exit(1);
}
if (sid == DM_NO_SESSION)
find_test_session(&sid);
/* Get the file's handle. */
if ((error = atohan(han_str, &hanp, &hlen)) != 0) {
fprintf(stderr, "atohan() failed, %s\n", strerror(error));
return(1);
}
if (length > 0) {
/* In case it is a realtime file, align the buffer on a
sufficiently big boundary.
*/
if ((bufp = memalign(4096, length)) == NULL) {
fprintf(stderr, "malloc of %llu bytes failed\n", length);
exit(1);
}
memset(bufp, '\0', length);
}
rc = dm_read_invis(sid, hanp, hlen, DM_NO_TOKEN, offset, length, bufp);
if (rc < 0) {
fprintf(stderr, "dm_read_invis failed, %s\n", strerror(errno));
exit(1);
} else if (rc != length) {
fprintf(stderr, "expected to read %lld bytes, actually "
"read %lld\n", length, rc);
exit(1);
}
for (i = 0; i < rc; i++) {
if (isprint(bufp[i])) {
fprintf(stdout, "%c", bufp[i]);
} else {
fprintf(stdout, "\\%03d", bufp[i]);
}
}
dm_handle_free(hanp, hlen);
exit(0);
}
+162
View File
@@ -0,0 +1,162 @@
/*
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Further, this software is distributed without any warranty that it is
* free of the rightful claim of any third person regarding infringement
* or the like. Any license provided herein, whether implied or
* otherwise, applies only to this software file. Patent licenses, if
* any, provided herein do not apply to combinations of this program with
* other software, or any other product whatsoever.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
* Mountain View, CA 94043, or:
*
* http://www.sgi.com
*
* For further information regarding this notice, see:
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#include <lib/hsm.h>
#include <string.h>
#include <malloc.h>
#include <getopt.h>
/*---------------------------------------------------------------------------
Test program used to test the DMAPI function dm_write_invis(). The
command line is:
handle_write_invis [-c char] [-o offset] [-l length] [-s sid] handle
where:
'char' is the character to use as a repeated pattern ('X' is the default),
'offset' is the offset of the start of the write (0 is the default),
'length' is the length of the write in bytes (1 is the default),
'sid' is the session ID whose events you you are interested in.
'handle' is the ascii representation of the file's handle.
You can use the test tool path_to_handle to get this.
DM_WRITE_SYNC is is not supported.
----------------------------------------------------------------------------*/
#ifndef linux
extern char *sys_errlist[];
#endif
extern int optind;
extern char *optarg;
char *Progname;
static void
usage(void)
{
fprintf(stderr, "usage:\t%s [-c char] [-o offset] [-l length] "
"[-s sid] handle\n", Progname);
exit(1);
}
int
main(
int argc,
char **argv)
{
dm_sessid_t sid = DM_NO_SESSION;
char *han_str = NULL;
dm_off_t offset = 0;
dm_size_t length = 1;
u_char ch = 'X';
void *bufp = NULL;
void *hanp;
size_t hlen;
dm_ssize_t rc;
char *name;
int opt;
int error;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
} else {
Progname = argv[0];
}
/* Crack and validate the command line options. */
while ((opt = getopt(argc, argv, "c:o:l:s:")) != EOF) {
switch (opt) {
case 'c':
ch = *optarg;
break;
case 'o':
offset = atol(optarg);
break;
case 'l':
length = atol(optarg);
break;
case 's':
sid = atol(optarg);
break;
case '?':
usage();
}
}
if (optind + 1 != argc)
usage();
han_str = argv[optind];
if (dm_init_service(&name) == -1) {
fprintf(stderr, "Can't inititalize the DMAPI\n");
exit(1);
}
if (sid == DM_NO_SESSION)
find_test_session(&sid);
/* Get the file's handle. */
if ((error = atohan(han_str, &hanp, &hlen)) != 0) {
fprintf(stderr, "atohan() failed, %s\n", strerror(error));
return(1);
}
if (length > 0) {
/* In case it is a realtime file, align the buffer on a
sufficiently big boundary.
*/
if ((bufp = memalign(4096, length)) == NULL) {
fprintf(stderr, "malloc of %llu bytes failed\n", length);
exit(1);
}
memset(bufp, ch, length);
}
rc = dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN, 0, offset, length, bufp);
if (rc < 0) {
fprintf(stderr, "dm_write_invis failed, %s\n", strerror(errno));
exit(1);
} else if (rc != length) {
fprintf(stderr, "expected to write %lld bytes, actually "
"wrote %lld\n", length, rc);
exit(1);
}
dm_handle_free(hanp, hlen);
exit(0);
}
+1 -1
View File
@@ -40,7 +40,7 @@
Test program used to test dm_handle_to_fshandle(). The command line is:
path_to_fshandle handle
handle_to_fshandle handle
where handle is an object's handle.