From: Dean Roehrich Date: Wed, 7 Mar 2001 22:43:23 +0000 (+0000) Subject: Update dmapi test suite, add Makefiles, remove Conscript files. X-Git-Tag: v1.1.0~1299 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=79a080ec4926c5f029f9132c696d95140dc6292c;p=users%2Fhch%2Fxfstests-dev.git Update dmapi test suite, add Makefiles, remove Conscript files. update --- diff --git a/dmapi/src/common/cmd/read_invis.c b/dmapi/src/common/cmd/read_invis.c index ea01855ac..4caeb712a 100644 --- a/dmapi/src/common/cmd/read_invis.c +++ b/dmapi/src/common/cmd/read_invis.c @@ -37,6 +37,7 @@ #ifdef linux #include #include +#include #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); diff --git a/dmapi/src/common/cmd/set_region.c b/dmapi/src/common/cmd/set_region.c index c4ed4ae84..ce5125a84 100644 --- a/dmapi/src/common/cmd/set_region.c +++ b/dmapi/src/common/cmd/set_region.c @@ -34,6 +34,7 @@ #ifdef linux #include +#include #endif /*--------------------------------------------------------------------------- diff --git a/dmapi/src/common/cmd/set_return_on_destroy.c b/dmapi/src/common/cmd/set_return_on_destroy.c index b670d9b8f..309d210ef 100644 --- a/dmapi/src/common/cmd/set_return_on_destroy.c +++ b/dmapi/src/common/cmd/set_return_on_destroy.c @@ -34,6 +34,7 @@ #ifdef linux #include +#include #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++; diff --git a/dmapi/src/common/cmd/write_invis.c b/dmapi/src/common/cmd/write_invis.c index 0dcbd3090..cf482488a 100644 --- a/dmapi/src/common/cmd/write_invis.c +++ b/dmapi/src/common/cmd/write_invis.c @@ -35,6 +35,7 @@ #ifdef linux #include #include +#include #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); diff --git a/dmapi/src/common/lib/dmport.h b/dmapi/src/common/lib/dmport.h index b7722f6a5..22e085b99 100644 --- a/dmapi/src/common/lib/dmport.h +++ b/dmapi/src/common/lib/dmport.h @@ -326,7 +326,7 @@ typedef struct dm_timestruct dm_timestruct_t; #ifdef linux -#include +#include /* In the dm_fileattr_t structure, Veritas used 'timeval' structures for all the time fields while XDSM uses 'time_t' structures. Define some symbols diff --git a/dmapi/src/common/lib/find_session.c b/dmapi/src/common/lib/find_session.c index 2e3d6e1e4..5035351a4 100644 --- a/dmapi/src/common/lib/find_session.c +++ b/dmapi/src/common/lib/find_session.c @@ -32,6 +32,9 @@ #include +#ifdef linux +#include +#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. */ diff --git a/dmapi/src/common/lib/print.c b/dmapi/src/common/lib/print.c index daec180c9..945256665 100644 --- a/dmapi/src/common/lib/print.c +++ b/dmapi/src/common/lib/print.c @@ -39,6 +39,7 @@ #include #ifdef linux +#include #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)) diff --git a/dmapi/src/common/lib/util.c b/dmapi/src/common/lib/util.c index 9e92eed4b..84686bcd1 100644 --- a/dmapi/src/common/lib/util.c +++ b/dmapi/src/common/lib/util.c @@ -27,6 +27,7 @@ #include #ifdef linux +#include #include #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); diff --git a/dmapi/src/sample_hsm/migfind.c b/dmapi/src/sample_hsm/migfind.c index afd24f8ea..350c9bdc8 100644 --- a/dmapi/src/sample_hsm/migfind.c +++ b/dmapi/src/sample_hsm/migfind.c @@ -30,6 +30,10 @@ #include +#ifdef linux +#include +#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); diff --git a/dmapi/src/sample_hsm/migin.c b/dmapi/src/sample_hsm/migin.c index 32551f00a..12b04a1dc 100644 --- a/dmapi/src/sample_hsm/migin.c +++ b/dmapi/src/sample_hsm/migin.c @@ -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; diff --git a/dmapi/src/sample_hsm/migout.c b/dmapi/src/sample_hsm/migout.c index f62b1ecfd..c7a901945 100644 --- a/dmapi/src/sample_hsm/migout.c +++ b/dmapi/src/sample_hsm/migout.c @@ -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); } diff --git a/dmapi/src/sample_hsm/mls.c b/dmapi/src/sample_hsm/mls.c index 838793b23..2afdbe202 100644 --- a/dmapi/src/sample_hsm/mls.c +++ b/dmapi/src/sample_hsm/mls.c @@ -183,13 +183,8 @@ mr_info( printf("\n"); for (i=0; i +#ifdef linux +#include +#include +#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; /* diff --git a/dmapi/src/sample_hsm/wbee.c b/dmapi/src/sample_hsm/wbee.c index 07b7a0c58..95566e1a3 100644 --- a/dmapi/src/sample_hsm/wbee.c +++ b/dmapi/src/sample_hsm/wbee.c @@ -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. diff --git a/dmapi/src/simple/dm_create_session.c b/dmapi/src/simple/dm_create_session.c index a30165bf8..5ac9b6229 100644 --- a/dmapi/src/simple/dm_create_session.c +++ b/dmapi/src/simple/dm_create_session.c @@ -32,12 +32,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/simple/dm_destroy_session.c b/dmapi/src/simple/dm_destroy_session.c index 68ed8c571..be61dd9e6 100644 --- a/dmapi/src/simple/dm_destroy_session.c +++ b/dmapi/src/simple/dm_destroy_session.c @@ -32,12 +32,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/simple/dm_find_eventmsg.c b/dmapi/src/simple/dm_find_eventmsg.c index d993879d8..feaceb91a 100644 --- a/dmapi/src/simple/dm_find_eventmsg.c +++ b/dmapi/src/simple/dm_find_eventmsg.c @@ -32,12 +32,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/simple/dm_getall_sessions.c b/dmapi/src/simple/dm_getall_sessions.c index 622e0b4a5..dbdcea7f2 100644 --- a/dmapi/src/simple/dm_getall_sessions.c +++ b/dmapi/src/simple/dm_getall_sessions.c @@ -34,12 +34,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/simple/dm_getall_tokens.c b/dmapi/src/simple/dm_getall_tokens.c index 87dd301d9..f091a5756 100644 --- a/dmapi/src/simple/dm_getall_tokens.c +++ b/dmapi/src/simple/dm_getall_tokens.c @@ -33,12 +33,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/simple/dm_query_session.c b/dmapi/src/simple/dm_query_session.c index 3dedb698f..f99455a06 100644 --- a/dmapi/src/simple/dm_query_session.c +++ b/dmapi/src/simple/dm_query_session.c @@ -32,12 +32,17 @@ #include #include #include -#include +#ifdef linux +#include +#include +#else +#include +#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); } diff --git a/dmapi/src/suite1/cmd/get_config_events.c b/dmapi/src/suite1/cmd/get_config_events.c index abf0926b3..bd6a815f0 100644 --- a/dmapi/src/suite1/cmd/get_config_events.c +++ b/dmapi/src/suite1/cmd/get_config_events.c @@ -32,6 +32,10 @@ #include +#ifdef linux +#include +#endif + /*--------------------------------------------------------------------------- Test program used to test the DMAPI function dm_get_config_events(). The diff --git a/dmapi/src/suite1/cmd/handle_to_path.c b/dmapi/src/suite1/cmd/handle_to_path.c index 305023a8f..cae81b6a3 100644 --- a/dmapi/src/suite1/cmd/handle_to_path.c +++ b/dmapi/src/suite1/cmd/handle_to_path.c @@ -119,13 +119,11 @@ main( return(1); } -printf("about to call dm_path_to_handle for %s\n", dirpath); if (dm_path_to_handle(dirpath, &hanp1, &hlen1)) { fprintf(stderr, "dm_path_to_handle failed for %s, (%d) %s\n", dirpath, errno, strerror(errno)); return(1); } -printf("about to call path_to_handle for %s\n", dirpath); if (path_to_handle(dirpath, &hanp1a, &hlen1a)) { fprintf(stderr, "path_to_handle failed for %s, (%d) %s\n", dirpath, errno, strerror(errno)); @@ -138,7 +136,6 @@ printf("about to call path_to_handle for %s\n", dirpath); if( memcmp(hanp1, hanp1a, hlen1) != 0 ){ fprintf(stderr, "dm_path_to_handle != path_to_handle, handles differ\n"); } -printf("about to call dm_path_to_handle for %s\n", objpath); if (dm_path_to_handle(objpath, &hanp2, &hlen2)) { fprintf(stderr, "dm_path_to_handle failed for %s, (%d) %s\n", objpath, errno, strerror(errno)); @@ -150,7 +147,6 @@ printf("about to call dm_path_to_handle for %s\n", objpath); return(1); } -printf("about to call handle_to_path\n"); if (dm_handle_to_path(hanp1, hlen1, hanp2, hlen2, buflen, pathbufp, &rlenp)) { if (errno == E2BIG) { diff --git a/dmapi/src/suite1/cmd/print_event.c b/dmapi/src/suite1/cmd/print_event.c index f2e67a99d..7d009af23 100644 --- a/dmapi/src/suite1/cmd/print_event.c +++ b/dmapi/src/suite1/cmd/print_event.c @@ -58,7 +58,7 @@ static int set_events (dm_sessid_t, void *, size_t); static int clear_events (dm_sessid_t, void *, size_t); int finish_responding(dm_sessid_t); int establish_handler(void); -void exit_handler (void); +void exit_handler (int); #define MAXNAMELEN 256 @@ -175,7 +175,7 @@ main( * If we get here, cleanup after the event_loop failure */ cleanup: - exit_handler(); + exit_handler(0); return(1); } @@ -360,7 +360,8 @@ handle_message( { int pkt_error = 0; int error; - int respond, response, respcode; + dm_response_t response; + int respond, respcode; dm_namesp_event_t *msg_ne; #if !VERITAS_21 dm_mount_event_t *msg_me; @@ -896,13 +897,11 @@ set_disposition( /* Metadata events. */ DMEV_SET(DM_EVENT_ATTRIBUTE, eventlist); -#if 0 -#if ! defined ( __sgi ) && ! defined ( VERITAS_21 ) +#if ! defined ( __sgi ) && ! defined ( VERITAS_21 ) && !defined(linux) DMEV_SET(DM_EVENT_CANCEL, eventlist); /* not supported on SGI */ #endif -#ifndef __sgi +#if !defined( __sgi) && !defined(linux) DMEV_SET(DM_EVENT_CLOSE, eventlist); /* not supported on SGI */ -#endif #endif DMEV_SET(DM_EVENT_DESTROY, eventlist); @@ -977,13 +976,11 @@ set_events( /* Metadata events. */ DMEV_SET(DM_EVENT_ATTRIBUTE, eventlist); -#if 0 -#if ! defined ( __sgi ) && ! defined ( VERITAS_21 ) +#if ! defined ( __sgi ) && ! defined ( VERITAS_21 ) && ! defined(linux) DMEV_SET(DM_EVENT_CANCEL, eventlist); /* not supported on SGI */ #endif -#ifndef __sgi +#if !defined( __sgi) && !defined(linux) DMEV_SET(DM_EVENT_CLOSE, eventlist); /* not supported on SGI */ -#endif #endif DMEV_SET(DM_EVENT_DESTROY, eventlist); @@ -1161,7 +1158,7 @@ establish_handler(void) * Shutdown the session using the global "sid" variable. */ void -exit_handler(void) +exit_handler(int x) { int error; void *fs_hanp; @@ -1187,7 +1184,7 @@ exit_handler(void) event_loop(sid, 0 /*waitflag*/); err_msg("Shutting down the session\n"); - if (sid != NULL) { + if (sid != 0) { error = dm_destroy_session(sid); if (error == -1) { errno_msg("Can't shut down session - use 'mrmean -kv' to clean up!"); diff --git a/dmapi/src/suite1/cmd/respond_event.c b/dmapi/src/suite1/cmd/respond_event.c index 59447cfef..a0a361bee 100644 --- a/dmapi/src/suite1/cmd/respond_event.c +++ b/dmapi/src/suite1/cmd/respond_event.c @@ -89,7 +89,7 @@ main( sid = atol(argv[1]); token = atol(argv[2]); - response = atol(argv[3]); + response = (dm_response_t)atoi(argv[3]); reterror = atol(argv[4]); if (dm_init_service(&name) == -1) { diff --git a/dmapi/src/suite1/cmd/rwt.c b/dmapi/src/suite1/cmd/rwt.c index 429ffe2e7..963cef7e4 100644 --- a/dmapi/src/suite1/cmd/rwt.c +++ b/dmapi/src/suite1/cmd/rwt.c @@ -163,8 +163,16 @@ main( exit(1); } if (seek_off != offset) { - fprintf(stderr, "seeked to offset %d, actually " - "arrived at %d\n", offset, seek_off); + fprintf(stderr, +#ifdef __sgi + "seeked to offset %lld, actually " + "arrived at %lld\n", + (int64_t)offset, (int64_t)seek_off); +#else + "seeked to offset %d, actually " + "arrived at %d\n", + offset, seek_off); +#endif exit(1); } } diff --git a/dmapi/src/suite1/cmd/set_fileattr.c b/dmapi/src/suite1/cmd/set_fileattr.c index f22e47eaa..1e071aff5 100644 --- a/dmapi/src/suite1/cmd/set_fileattr.c +++ b/dmapi/src/suite1/cmd/set_fileattr.c @@ -234,7 +234,7 @@ get_absolute_date( if (strlen(ptr) != 8 && strlen(ptr) != 14) return(0); strncpy(date, ptr, 8); - date[9] = '\0'; + date[8] = '\0'; l = atol(date); if (l < MIN_HD_DATE) return(0); diff --git a/dmapi/src/suite1/cmd/struct_test.c b/dmapi/src/suite1/cmd/struct_test.c index 9453d21ea..50ef681f7 100644 --- a/dmapi/src/suite1/cmd/struct_test.c +++ b/dmapi/src/suite1/cmd/struct_test.c @@ -35,7 +35,7 @@ #include #ifdef linux -#include +#include #else #include #endif diff --git a/dmapi/src/suite2/src/check_dmapi.c b/dmapi/src/suite2/src/check_dmapi.c index ddd977d2a..d6849e746 100644 --- a/dmapi/src/suite2/src/check_dmapi.c +++ b/dmapi/src/suite2/src/check_dmapi.c @@ -33,7 +33,7 @@ #include #include #ifdef linux -#include +#include #else #include #endif @@ -141,11 +141,9 @@ main( * EXAMINE /usr/include/sys/dmi.h: *-------------------------------- */ -#ifdef linux -#define DMAPI_HDR "/usr/include/linux/dmapi.h" -#else +#ifdef __sgi #define DMAPI_HDR "/usr/include/sys/dmi.h" -#endif + if (stat(DMAPI_HDR, &stat_buf)==-1){ if (errno==ENOENT) { printf( "You are missing a vital DMAPI file: %s\n", DMAPI_HDR); @@ -162,6 +160,7 @@ main( printf("(You appear to have the correct version of %s\n", DMAPI_HDR); } } +#endif /*-------------------------- * RESOLVE KERNEL PRESENCE: diff --git a/dmapi/src/suite2/src/dm_test_daemon.c b/dmapi/src/suite2/src/dm_test_daemon.c index d26be9f87..662051755 100644 --- a/dmapi/src/suite2/src/dm_test_daemon.c +++ b/dmapi/src/suite2/src/dm_test_daemon.c @@ -70,7 +70,7 @@ static int set_events (dm_sessid_t, void *, size_t); static int clear_events (dm_sessid_t, void *, size_t); int finish_responding(dm_sessid_t); int establish_handler(void); -void exit_handler (void); +void exit_handler (int); /* * Keep these global so the exit_handler and err_msg routines can get to them @@ -197,7 +197,7 @@ main( * If we get here, cleanup after the event_loop failure */ cleanup: - exit_handler(); + exit_handler(0); return(1); } @@ -381,7 +381,8 @@ handle_message( { int pkt_error = 0; int error; - int respond, response, respcode; + dm_response_t response; + int respond, respcode; dm_namesp_event_t *msg_ne; #if !VERITAS dm_mount_event_t *msg_me; @@ -1030,10 +1031,10 @@ set_disposition( /* Metadata events. */ DMEV_SET(DM_EVENT_ATTRIBUTE, eventlist); -#if ! defined ( __sgi ) && ! defined ( VERITAS ) +#if ! defined ( __sgi ) && ! defined ( VERITAS ) && ! defined(linux) DMEV_SET(DM_EVENT_CANCEL, eventlist); /* not supported on SGI */ #endif -#ifndef __sgi +#if !defined(__sgi) && !defined(linux) DMEV_SET(DM_EVENT_CLOSE, eventlist); /* not supported on SGI */ #endif DMEV_SET(DM_EVENT_DESTROY, eventlist); @@ -1109,10 +1110,10 @@ set_events( /* Metadata events. */ DMEV_SET(DM_EVENT_ATTRIBUTE, eventlist); -#if ! defined ( __sgi ) && ! defined ( VERITAS ) +#if ! defined ( __sgi ) && ! defined ( VERITAS ) && !defined(linux) DMEV_SET(DM_EVENT_CANCEL, eventlist); /* not supported on SGI */ #endif -#ifndef __sgi +#if !defined(__sgi) && !defined(linux) DMEV_SET(DM_EVENT_CLOSE, eventlist); /* not supported on SGI */ #endif DMEV_SET(DM_EVENT_DESTROY, eventlist); @@ -1291,7 +1292,7 @@ establish_handler(void) * Shutdown the session using the global "sid" variable. */ void -exit_handler(void) +exit_handler(int x) { int error; void *fs_hanp; diff --git a/dmapi/src/suite2/src/invis_test.c b/dmapi/src/suite2/src/invis_test.c index b4221944d..bfc065efb 100644 --- a/dmapi/src/suite2/src/invis_test.c +++ b/dmapi/src/suite2/src/invis_test.c @@ -173,9 +173,9 @@ main( } if( Vflag ) - printf("using length = %lld\n", length ); + printf("using length = %llu\n", length ); if( length > BUFSZ ){ - fprintf(stderr, "length(%lld) > BUFSZ(%lld)\n", length, BUFSZ); + fprintf(stderr, "length(%llu) > BUFSZ(%d)\n", length, BUFSZ); exit(1); } diff --git a/dmapi/src/suite2/src/test_dmattr.c b/dmapi/src/suite2/src/test_dmattr.c index f927e190f..fa8a6a899 100644 --- a/dmapi/src/suite2/src/test_dmattr.c +++ b/dmapi/src/suite2/src/test_dmattr.c @@ -339,7 +339,7 @@ main( |* Beginning improper-input testing. *| \*************************************/ sprintf(test_file, "%s/DMAPI_attribute_test_file.ERRNO", - dir_name, i); + dir_name); sprintf(command, "cp %s %s\n", ls_path, test_file); system(command); @@ -518,7 +518,7 @@ main( sprintf(test_file, "%s/DMAPI_attribute_test_file.ERRNO", - dir_name, i); + dir_name); sprintf(command, "rm %s\n", test_file); system(command); printf("\t(errno subtests complete)\n"); diff --git a/dmapi/src/suite2/src/test_eventlist.c b/dmapi/src/suite2/src/test_eventlist.c index 56039ae09..0ba5aa707 100644 --- a/dmapi/src/suite2/src/test_eventlist.c +++ b/dmapi/src/suite2/src/test_eventlist.c @@ -243,7 +243,8 @@ main( dm_set_eventlist(sid, hanp, hlen, 0, &eventset, DM_EVENT_MAX)) /*---------------------------------------------------------*/ - /* PROBLEM: too-small buffer doesn't produce E2BIG +#if 0 + PROBLEM: too-small buffer does not produce E2BIG { dm_eventset_t *small_evsp = malloc(0); if (dm_handle_to_fshandle(hanp, hlen, &fshanp, &fshlen)) { @@ -262,6 +263,7 @@ main( DM_EVENT_INVALID, Vflag); } } +#endif /*---------------------------------------------------------*/ SHAREDTEST("get", hanp, hlen, test_token, dm_get_eventlist(sid, hanp, hlen, test_token, diff --git a/dmapi/src/suite2/src/test_fileattr.c b/dmapi/src/suite2/src/test_fileattr.c index 8ba0fd53e..866f3e397 100644 --- a/dmapi/src/suite2/src/test_fileattr.c +++ b/dmapi/src/suite2/src/test_fileattr.c @@ -136,7 +136,7 @@ comp_stat ( dm_stat_t expected, else good++; if (found.dt_size != expected.dt_size) { fprintf(stderr, - "ERROR: get #%d, expected size %ld, but found %ld\n", + "ERROR: get #%d, expected size %lld, but found %lld\n", i, expected.dt_size, found.dt_size); } else good++; @@ -305,14 +305,13 @@ main( GET_MASK, &dmstat)) { fprintf(stderr, "ERROR: dm_get_fileattr failed on pass #%d, %s\n", - ERR_NAME); + i, ERR_NAME); } else { comp_stat(stat_arr[i], dmstat, i); } } -#if 0 /*-----------------------------------------------------*\ |* Get_dirattrs loop *| \*-----------------------------------------------------*/ @@ -368,7 +367,6 @@ main( fprintf(stderr, "report: get_dirattrs successfully " "found %d files in %d loops.\n", i, loops); } -#endif /*-----------------------------------------------------*\ |* Get_bulkattr loop *| @@ -492,12 +490,15 @@ main( dm_set_fileattr(sid, NULL, hlen, DM_NO_TOKEN, SET_MASK, &fileattr)) /*---------------------------------------------------------*/ - /* PROBLEM: 32 ones as a mask does not produce a "bad mask" - /* EINVAL. If it doesn't, I suspect nothing will. +#if 0 + PROBLEM: 32 ones as a mask does not produce a "bad mask" + EINVAL. If it does not, I suspect nothing will. + ERRTEST(EINVAL, "set (bad mask) [BROKEN]", dm_set_fileattr(sid, hanp, hlen, DM_NO_TOKEN, 0xFFFFFFFF, &fileattr)) +#endif /*---------------------------------------------------------*/ ERRTEST(EINVAL, "set (bad token)", @@ -544,12 +545,15 @@ main( dm_get_fileattr(sid, hanp, hlen, DM_NO_TOKEN, GET_MASK, (dm_stat_t *)(-1000))) /*---------------------------------------------------------*/ - /* PROBLEM: 32 ones as a mask does not produce a "bad mask" - /* EINVAL. If it doesn't, I suspect nothing will. +#if 0 + PROBLEM: 32 ones as a mask does not produce a "bad mask" + EINVAL. If it does not, I suspect nothing will. + ERRTEST(EINVAL, "get (bad mask) [BROKEN]", dm_get_fileattr(sid, hanp, hlen, DM_NO_TOKEN, 0xFFFFFFFF, &dmstat)) +#endif /*---------------------------------------------------------*/ ERRTEST(EINVAL, "get (bad token)", @@ -564,7 +568,7 @@ main( dm_handle_free(hanp, hlen); -#if 0 + /*------------------------------------*\ |* ## dm_get_dirattrs() subtests ## *| \*------------------------------------*/ @@ -642,7 +646,6 @@ main( /*---------------------------------------------------------*/ /*---------------------------------------------------------*/ } -#endif /*------------------------------------*\ |* ## dm_get_bulkattr() subtests ## *| diff --git a/dmapi/src/suite2/src/test_hole.c b/dmapi/src/suite2/src/test_hole.c index c3d18f9ac..0e938665c 100644 --- a/dmapi/src/suite2/src/test_hole.c +++ b/dmapi/src/suite2/src/test_hole.c @@ -293,12 +293,15 @@ main( dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 30000, length, &roff, &rlen)) /*---------------------------------------------------------*/ - /* PROBLEM: No error is produced. - /* off+len >= filesize should produce E2BIG... +#if 0 + PROBLEM: No error is produced. + off+len >= filesize should produce E2BIG... + ERRTEST(E2BIG, "probe (to past EOF)", dm_probe_hole(sid, hanp, hlen, DM_NO_TOKEN, 15000, 150000, &roff, &rlen)) +#endif /*---------------------------------------------------------*/ SHAREDTEST("probe", hanp, hlen, test_token, dm_probe_hole(sid, hanp, hlen, test_token, diff --git a/dmapi/src/suite2/src/test_invis.c b/dmapi/src/suite2/src/test_invis.c index 57d447308..dada7d026 100644 --- a/dmapi/src/suite2/src/test_invis.c +++ b/dmapi/src/suite2/src/test_invis.c @@ -192,13 +192,11 @@ main( continue; } -printf("test_invis/%d: checking length(%d)>0\n", __LINE__, length); if (length > curlength) { -printf("test_invis/%d: bufp malloc(%d)\n", __LINE__, length); if(curlength>0) free(bufp); if ((bufp = malloc(length)) == NULL) { - fprintf(stderr, "malloc of %d bytes failed\n", length); + fprintf(stderr, "malloc of %llu bytes failed\n", length); continue; } curlength = length; @@ -226,7 +224,7 @@ printf("test_invis/%d: bufp malloc(%d)\n", __LINE__, length); test_file); } else { -#if 0 +#ifdef __sgi if ((statbuf.st_atim.tv_sec == checkbuf.st_atim.tv_sec) && (statbuf.st_atim.tv_nsec == checkbuf.st_atim.tv_nsec) && (statbuf.st_mtim.tv_sec == checkbuf.st_mtim.tv_sec) && @@ -262,7 +260,6 @@ printf("test_invis/%d: bufp malloc(%d)\n", __LINE__, length); else { /* Be sure the buffer is filled with the test char */ error_reported = 0; -printf("%s/%d: i=%d\n", __FILE__, __LINE__, i); for (k=0; k