Update dmapi test suite, add Makefiles, remove Conscript files.

update
This commit is contained in:
Dean Roehrich
2001-03-07 22:43:23 +00:00
parent ee971e7cb0
commit 79a080ec49
36 changed files with 194 additions and 196 deletions
+2 -3
View File
@@ -37,6 +37,7 @@
#ifdef linux
#include <string.h>
#include <malloc.h>
#include <unistd.h>
#endif
/*---------------------------------------------------------------------------
@@ -67,8 +68,6 @@ char *Progname;
static void
usage(void)
{
int i;
fprintf(stderr, "usage:\t%s [-o offset] [-l length] "
"[-s sid] pathname\n", Progname);
exit(1);
@@ -138,7 +137,7 @@ main(
sufficiently big boundary.
*/
if ((bufp = memalign(4096, length)) == NULL) {
fprintf(stderr, "malloc of %d bytes failed\n", length);
fprintf(stderr, "malloc of %llu bytes failed\n", length);
exit(1);
}
memset(bufp, '\0', length);
+1
View File
@@ -34,6 +34,7 @@
#ifdef linux
#include <string.h>
#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
+1 -3
View File
@@ -34,6 +34,7 @@
#ifdef linux
#include <string.h>
#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
@@ -62,8 +63,6 @@ char *Progname;
static void
usage(void)
{
int i;
fprintf(stderr, "usage:\t%s [-s sid] pathname [attr]\n", Progname);
exit(1);
}
@@ -82,7 +81,6 @@ main(
size_t hlen;
char *name;
int opt;
int i;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
+2 -4
View File
@@ -35,6 +35,7 @@
#ifdef linux
#include <string.h>
#include <malloc.h>
#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
@@ -68,8 +69,6 @@ char *Progname;
static void
usage(void)
{
int i;
fprintf(stderr, "usage:\t%s [-c char] [-o offset] [-l length] "
"[-s sid] pathname\n", Progname);
exit(1);
@@ -92,7 +91,6 @@ main(
dm_ssize_t rc;
char *name;
int opt;
int i;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
@@ -143,7 +141,7 @@ main(
sufficiently big boundary.
*/
if ((bufp = memalign(4096, length)) == NULL) {
fprintf(stderr, "malloc of %d bytes failed\n", length);
fprintf(stderr, "malloc of %llu bytes failed\n", length);
exit(1);
}
memset(bufp, ch, length);
+1 -1
View File
@@ -326,7 +326,7 @@ typedef struct dm_timestruct dm_timestruct_t;
#ifdef linux
#include <linux/dmapi.h>
#include <dmapi.h>
/* In the dm_fileattr_t structure, Veritas used 'timeval' structures for all
the time fields while XDSM uses 'time_t' structures. Define some symbols
+3 -1
View File
@@ -32,6 +32,9 @@
#include <lib/hsm.h>
#ifdef linux
#include <string.h>
#endif
/*******************************************************************************
*
@@ -84,7 +87,6 @@ find_test_session(
u_int nelem;
size_t rlen;
int error;
int rc;
u_int i;
/* Retrieve the list of all active sessions on the host. */
+5 -7
View File
@@ -39,6 +39,7 @@
#include <lib/hsm.h>
#ifdef linux
#include <string.h>
#define MAXNAMELEN 256
#endif
@@ -46,14 +47,10 @@
* Define some standard formats for the printf statements below.
*/
#define HDR "%s: token %d sequence %d\n"
#define HDR "%s: token=%d sequence=%d\n"
#define VALS "\t%-15s %s\n"
#define VALD "\t%-15s %d\n"
#ifdef __sgi
#define VALLLD "\t%-15s %lld\n"
#else
#define VALLLD "\t%-15s %ld\n"
#endif
/*
@@ -220,7 +217,6 @@ print_one_message(
dm_eventmsg_t *msg)
{
int pkt_error = 0;
int error;
dm_namesp_event_t *msg_ne;
void *hanp1, *hanp2, *namp1, *namp2;
u_int hlen1, hlen2, nlen1, nlen2;
@@ -295,6 +291,7 @@ print_one_message(
printf(HDR, "truncate", msg->ev_token,
msg->ev_sequence);
break;
default: break;
}
print_one_data_event(msg_de);
@@ -552,7 +549,8 @@ handle_message(
dm_sessid_t sid,
dm_eventmsg_t *msg)
{
int respond, response, respcode;
dm_response_t response;
int respond, respcode;
int error = 0;
if (print_one_message(msg))
+1 -28
View File
@@ -27,6 +27,7 @@
#include <lib/hsm.h>
#ifdef linux
#include <string.h>
#include <time.h>
#define S_IAMB (S_IRWXU|S_IRWXG|S_IRWXO)
#endif
@@ -255,11 +256,7 @@ print_victim(
printf("%d\t", hlen);
hantoa(hanp, hlen, handle_str);
printf("%s ", handle_str);
#ifdef __sgi
printf("\t%lld \n", fsize);
#else
printf("\t%ld \n", fsize);
#endif
}
@@ -894,11 +891,7 @@ print_state(
/* Print all the stat block fields. */
fprintf(stdout, "dt_dev 0x%x\n", dmstat->dt_dev);
#ifdef __sgi
fprintf(stdout, "dt_ino %llx\n", dmstat->dt_ino);
#else
fprintf(stdout, "dt_ino %x\n", dmstat->dt_ino);
#endif
fprintf(stdout, "dt_mode (type) %s\n",
mode_to_string(dmstat->dt_mode));
fprintf(stdout, "dt_mode (perm) 0%o\n", dmstat->dt_mode & S_MASK);
@@ -906,11 +899,7 @@ print_state(
fprintf(stdout, "dt_uid %d\n", dmstat->dt_uid);
fprintf(stdout, "dt_gid %d\n", dmstat->dt_gid);
fprintf(stdout, "dt_rdev 0x%x\n", dmstat->dt_rdev);
#ifdef __sgi
fprintf(stdout, "dt_size %lld\n", dmstat->dt_size);
#else
fprintf(stdout, "dt_size %d\n", dmstat->dt_size);
#endif
fprintf(stdout, "dt_atime %s\n",
date_to_string(dmstat->dt_atime));
@@ -920,11 +909,7 @@ print_state(
date_to_string(dmstat->dt_ctime));
fprintf(stdout, "dt_blksize %d\n", dmstat->dt_blksize);
#ifdef __sgi
fprintf(stdout, "dt_blocks %lld\n", dmstat->dt_blocks);
#else
fprintf(stdout, "dt_blocks %d\n", dmstat->dt_blocks);
#endif
#if defined(__sgi) || defined(linux)
fprintf(stdout, "dt_xfs_igen %d\n", dmstat->dt_xfs_igen);
@@ -955,33 +940,21 @@ print_line(
dm_stat_t *dmstat)
{
fprintf(stdout, "0x%x|", dmstat->dt_dev);
#ifdef __sgi
fprintf(stdout, "%llx|", dmstat->dt_ino);
#else
fprintf(stdout, "%x|", dmstat->dt_ino);
#endif
fprintf(stdout, "%s|", mode_to_string(dmstat->dt_mode));
fprintf(stdout, "0%o|", dmstat->dt_mode & S_MASK);
fprintf(stdout, "%d|", dmstat->dt_nlink);
fprintf(stdout, "%d|", dmstat->dt_uid);
fprintf(stdout, "%d|", dmstat->dt_gid);
fprintf(stdout, "0x%x|", dmstat->dt_rdev);
#ifdef __sgi
fprintf(stdout, "%lld|", dmstat->dt_size);
#else
fprintf(stdout, "%d|", dmstat->dt_size);
#endif
fprintf(stdout, "%s|", date_to_string(dmstat->dt_atime));
fprintf(stdout, "%s|", date_to_string(dmstat->dt_mtime));
fprintf(stdout, "%s|", date_to_string(dmstat->dt_ctime));
fprintf(stdout, "%d|", dmstat->dt_blksize);
#ifdef __sgi
fprintf(stdout, "%lld|", dmstat->dt_blocks);
#else
fprintf(stdout, "%d|", dmstat->dt_blocks);
#endif
#ifdef __sgi
fprintf(stdout, "%d|", dmstat->dt_xfs_igen);
+5 -9
View File
@@ -30,6 +30,10 @@
#include <lib/hsm.h>
#ifdef linux
#include <getopt.h>
#endif
#define NUMLEN 16 /* arbitrary max len of input size */
#define MAX_K (((u_int)LONG_MAX + 1) / 1024)
#define MAX_M (((u_int)LONG_MAX + 1) / (1024*1024))
@@ -76,7 +80,7 @@ verify_size(
size = strtol(str,0,0);
if (size < 0 || size >= LONG_MAX ) {
printf("Size %d is invalid \n", size);
printf("Size %lld is invalid \n", size);
return(1);
}
@@ -85,21 +89,13 @@ verify_size(
cp++;
if (*cp == 'k' || *cp == 'K') {
if ( size >= (u_int) MAX_K) {
#ifdef __sgi
printf("Size %lld is invalid\n", size);
#else
printf("Size %ld is invalid\n", size);
#endif
return(1);
}
size *= 1024;
} else if (*cp == 'm' || *cp == 'M') {
if ( size >= (u_int) MAX_M) {
#ifdef __sgi
printf("Size %lld is invalid\n", size);
#else
printf("Size %ld is invalid\n", size);
#endif
return(1);
}
size *= (1024*1024);
+8 -7
View File
@@ -47,7 +47,7 @@ void event_loop(dm_sessid_t);
int set_events(dm_sessid_t, void *, size_t);
int mk_daemon(char *);
void spawn_kid(dm_sessid_t, dm_token_t, char *);
void migin_exit(void);
void migin_exit(int);
void usage(char *);
@@ -226,7 +226,7 @@ out:
if (msgbuf != NULL)
free(msgbuf);
migin_exit();
migin_exit(0);
}
/*
@@ -253,11 +253,12 @@ spawn_kid(
sprintf(sidbuf, "%d", sid);
sprintf(tokenbuf, "%d", token);
if (Verbose) {
fprintf(stderr, "execl(%s, %s, %s, -s, %s, -t, xs, 0)\n",
WORKER_BEE, WORKER_BEE, action, sidbuf, tokenbuf);
fprintf(stderr, "execl(%s, %s, %s, -s, %s, -t, %s, 0)\n",
WORKER_BEE, WORKER_BEE, action, sidbuf,
tokenbuf);
}
if (execl(WORKER_BEE, WORKER_BEE, action, "-s", sidbuf,
"-t", tokenbuf, NULL))
"-t", tokenbuf, NULL))
{
(void)dm_respond_event(sid, token, DM_RESP_ABORT,
errno, 0, 0);
@@ -311,7 +312,7 @@ int
mk_daemon(
char *logfile)
{
int fd, pid;
int fd;
int i;
struct rlimit lim;
struct sigaction act;
@@ -369,7 +370,7 @@ mk_daemon(
}
void
migin_exit(void)
migin_exit(int x)
{
dm_sessid_t *sidbuf, *sid;
void *infobuf;
-14
View File
@@ -478,24 +478,17 @@ extract_fields(
while (!isalnum(*cp))
cp++;
if( cp != ibuf )
printf("%s/%d: found leading whitspace to skip\n", __FILE__, __LINE__);
start = cp;
while (isalnum(*cp))
cp++;
*cp = '\0';
printf("%s/%d: start=(%s)\n", __FILE__, __LINE__, start);
len = strtol(start, 0, 0);
if (len > HANDLE_LEN) {
err_msg("%s/%d: Handle length %d too long in input line", __FILE__, __LINE__, len);
return(1);
}
printf("%s/%d: len=%ld\n", __FILE__, __LINE__, len);
*hlen = len;
/*
@@ -512,12 +505,8 @@ printf("%s/%d: len=%ld\n", __FILE__, __LINE__, len);
cp += len*2;
*cp = '\0';
printf("%s/%d: handle buf is (%s)\n", __FILE__, __LINE__, hanp );
atohan( hanp, (void**)&handle_buf, &len );
printf("%s/%d: len now=%ld\n", __FILE__, __LINE__, len);
/* skip over white space */
while (!isalnum(*cp))
@@ -529,11 +518,8 @@ printf("%s/%d: len now=%ld\n", __FILE__, __LINE__, len);
cp++;
*cp = '\0';
printf("%s/%d: file len=%s\n", __FILE__, __LINE__, start);
*fsize = strtol(start, 0, 0);
printf("%s/%d: fsize=%ld\n", __FILE__, __LINE__, *fsize);
return(0);
}
-11
View File
@@ -183,13 +183,8 @@ mr_info(
printf("\n");
for (i=0; i<ret; i++) {
printf("\tRegion %d:\n", i);
#ifdef __sgi
printf("\t\toffset %lld, ", rgn[i].rg_offset);
printf("size %lld, ", rgn[i].rg_size);
#else
printf("\t\toffset %ld, ", rgn[i].rg_offset);
printf("size %ld, ", rgn[i].rg_size);
#endif
printf("flags 0x%x", rgn[i].rg_flags);
printf(" ( ");
if (rgn[i].rg_flags & DM_REGION_NOEVENT)
@@ -214,7 +209,6 @@ event_info(
void *hanp,
size_t hlen)
{
u_int i;
u_int ret;
dm_eventset_t eventlist;
@@ -318,13 +312,8 @@ alloc_info(
printf("(resident): ");
if (ext[i].ex_type == DM_EXTENT_HOLE)
printf("(hole): ");
#ifdef __sgi
printf("offset %lld, ", ext[i].ex_offset);
printf("len %lld\n", ext[i].ex_length);
#else
printf("offset %ld, ", ext[i].ex_offset);
printf("len %ld\n", ext[i].ex_length);
#endif
}
} while (more == 1);
return(0);
+6 -1
View File
@@ -25,6 +25,11 @@
#include <lib/dmport.h>
#ifdef linux
#include <string.h>
#include <getopt.h>
#endif
extern char *optarg;
extern int optind, opterr, optopt;
extern int errno;
@@ -225,7 +230,7 @@ get_sessions(
u_int *nsidp)
{
dm_sessid_t *sidbuf;
int more, error;
int error;
u_int nsids, nret;
/*
+1 -1
View File
@@ -245,7 +245,7 @@ check_lockstate(
errno_msg("Can't query file access rights");
return(1);
}
#ifdef __sgi
#if defined(__sgi) || defined(linux)
/*
* There are no access rights on the SGI. 1 means it's
* there.
+8 -3
View File
@@ -32,12 +32,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/errno.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
dm_sessid_t oldsid = DM_NO_SESSION;
@@ -65,6 +70,6 @@ main( int argc, char **argv )
ret = dm_create_session( oldsid, sessinfo, &newsid);
printf( "ret=%d\n", ret );
printf( "newsid=%d\n", newsid );
exit(0);
}
+8 -2
View File
@@ -32,12 +32,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/errno.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
dm_sessid_t sid = 0;
@@ -64,4 +69,5 @@ main( int argc, char **argv )
ret = dm_destroy_session( sid );
printf( "ret=%d\n", ret );
exit(0);
}
+8 -2
View File
@@ -32,12 +32,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/errno.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
dm_sessid_t sid = 0;
@@ -84,4 +89,5 @@ main( int argc, char **argv )
ret = dm_find_eventmsg( sid, token, buflen, &msg, &rlen );
printf( "ret=%d\n", ret );
printf( "rlen=%d\n", rlen );
exit(0);
}
+8 -2
View File
@@ -34,12 +34,17 @@
#include <sys/errno.h>
#include <string.h>
#include <malloc.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
dm_sessid_t *sidbuf;
@@ -88,5 +93,6 @@ main( int argc, char **argv )
printf("%d ", sidbuf[i]);
}
printf("\"\n");
exit(0);
}
+9 -3
View File
@@ -33,12 +33,17 @@
#include <stdlib.h>
#include <sys/errno.h>
#include <malloc.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
dm_token_t *tokenbuf;
@@ -81,7 +86,8 @@ main( int argc, char **argv )
printf("tokens=\"");
for( i = 0; i < rnelem; i++ ){
printf("%d ", tokenbuf+i);
printf("%d ", (int)(tokenbuf+i));
}
printf("\"\n");
exit(0);
}
+8 -2
View File
@@ -32,12 +32,17 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/errno.h>
#include <linux/dmapi_kern.h>
#ifdef linux
#include <dmapi.h>
#include <getopt.h>
#else
#include <sys/dmi.h>
#endif
int
main( int argc, char **argv )
{
extern char *optarg;
extern int optind;
int c;
int ret;
char *sessinfo;
@@ -78,4 +83,5 @@ main( int argc, char **argv )
printf( "rlen=%d\n", rlen );
if( ret != -1 )
printf( "sessinfo=%s\n", sessinfo );
exit(0);
}

Some files were not shown because too many files have changed in this diff Show More