#ifdef linux
#include <string.h>
#include <malloc.h>
+#include <unistd.h>
#endif
/*---------------------------------------------------------------------------
static void
usage(void)
{
- int i;
-
fprintf(stderr, "usage:\t%s [-o offset] [-l length] "
"[-s sid] pathname\n", Progname);
exit(1);
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);
#ifdef linux
#include <string.h>
+#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
#ifdef linux
#include <string.h>
+#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
static void
usage(void)
{
- int i;
-
fprintf(stderr, "usage:\t%s [-s sid] pathname [attr]\n", Progname);
exit(1);
}
size_t hlen;
char *name;
int opt;
- int i;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
#ifdef linux
#include <string.h>
#include <malloc.h>
+#include <getopt.h>
#endif
/*---------------------------------------------------------------------------
static void
usage(void)
{
- int i;
-
fprintf(stderr, "usage:\t%s [-c char] [-o offset] [-l length] "
"[-s sid] pathname\n", Progname);
exit(1);
dm_ssize_t rc;
char *name;
int opt;
- int i;
if (Progname = strrchr(argv[0], '/')) {
Progname++;
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);
#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
#include <lib/hsm.h>
+#ifdef linux
+#include <string.h>
+#endif
/*******************************************************************************
*
u_int nelem;
size_t rlen;
int error;
- int rc;
u_int i;
/* Retrieve the list of all active sessions on the host. */
#include <lib/hsm.h>
#ifdef linux
+#include <string.h>
#define MAXNAMELEN 256
#endif
* 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
/*
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;
printf(HDR, "truncate", msg->ev_token,
msg->ev_sequence);
break;
+ default: break;
}
print_one_data_event(msg_de);
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))
#include <lib/hsm.h>
#ifdef linux
+#include <string.h>
#include <time.h>
#define S_IAMB (S_IRWXU|S_IRWXG|S_IRWXO)
#endif
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
}
/* 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);
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));
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);
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);
#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))
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);
}
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);
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 *);
if (msgbuf != NULL)
free(msgbuf);
- migin_exit();
+ migin_exit(0);
}
/*
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);
mk_daemon(
char *logfile)
{
- int fd, pid;
+ int fd;
int i;
struct rlimit lim;
struct sigaction act;
}
void
-migin_exit(void)
+migin_exit(int x)
{
dm_sessid_t *sidbuf, *sid;
void *infobuf;
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;
/*
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))
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);
}
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)
void *hanp,
size_t hlen)
{
- u_int i;
u_int ret;
dm_eventset_t eventlist;
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);
#include <lib/dmport.h>
+#ifdef linux
+#include <string.h>
+#include <getopt.h>
+#endif
+
extern char *optarg;
extern int optind, opterr, optopt;
extern int errno;
u_int *nsidp)
{
dm_sessid_t *sidbuf;
- int more, error;
+ int error;
u_int nsids, nret;
/*
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.
#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;
ret = dm_create_session( oldsid, sessinfo, &newsid);
printf( "ret=%d\n", ret );
printf( "newsid=%d\n", newsid );
-
+ exit(0);
}
#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;
ret = dm_destroy_session( sid );
printf( "ret=%d\n", ret );
+ exit(0);
}
#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;
ret = dm_find_eventmsg( sid, token, buflen, &msg, &rlen );
printf( "ret=%d\n", ret );
printf( "rlen=%d\n", rlen );
+ exit(0);
}
#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;
printf("%d ", sidbuf[i]);
}
printf("\"\n");
+ exit(0);
}
#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;
printf("tokens=\"");
for( i = 0; i < rnelem; i++ ){
- printf("%d ", tokenbuf+i);
+ printf("%d ", (int)(tokenbuf+i));
}
printf("\"\n");
+ exit(0);
}
#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;
printf( "rlen=%d\n", rlen );
if( ret != -1 )
printf( "sessinfo=%s\n", sessinfo );
+ exit(0);
}
#include <lib/hsm.h>
+#ifdef linux
+#include <string.h>
+#endif
+
/*---------------------------------------------------------------------------
Test program used to test the DMAPI function dm_get_config_events(). The
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));
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));
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) {
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
* If we get here, cleanup after the event_loop failure
*/
cleanup:
- exit_handler();
+ exit_handler(0);
return(1);
}
{
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;
/* 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);
/* 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);
* Shutdown the session using the global "sid" variable.
*/
void
-exit_handler(void)
+exit_handler(int x)
{
int error;
void *fs_hanp;
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!");
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) {
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);
}
}
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);
#include <stdlib.h>
#ifdef linux
-#include <linux/dmapi.h>
+#include <dmapi.h>
#else
#include <sys/dmi.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#ifdef linux
-#include <linux/dmapi_kern.h>
+#include <dmapi.h>
#else
#include <sys/dmi.h>
#endif
* 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);
printf("(You appear to have the correct version of %s\n", DMAPI_HDR);
}
}
+#endif
/*--------------------------
* RESOLVE KERNEL PRESENCE:
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
* If we get here, cleanup after the event_loop failure
*/
cleanup:
- exit_handler();
+ exit_handler(0);
return(1);
}
{
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;
/* 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);
/* 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);
* Shutdown the session using the global "sid" variable.
*/
void
-exit_handler(void)
+exit_handler(int x)
{
int error;
void *fs_hanp;
}
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);
}
|* 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);
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");
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)) {
DM_EVENT_INVALID, Vflag);
}
}
+#endif
/*---------------------------------------------------------*/
SHAREDTEST("get", hanp, hlen, test_token,
dm_get_eventlist(sid, hanp, hlen, test_token,
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++;
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 *|
\*-----------------------------------------------------*/
fprintf(stderr, "report: get_dirattrs successfully "
"found %d files in %d loops.\n", i, loops);
}
-#endif
/*-----------------------------------------------------*\
|* Get_bulkattr loop *|
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)",
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)",
dm_handle_free(hanp, hlen);
-#if 0
+
/*------------------------------------*\
|* ## dm_get_dirattrs() subtests ## *|
\*------------------------------------*/
/*---------------------------------------------------------*/
/*---------------------------------------------------------*/
}
-#endif
/*------------------------------------*\
|* ## dm_get_bulkattr() subtests ## *|
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,
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;
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) &&
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<i; k++){
if (((char *)bufp)[k] == ch) {
if (Vflag) printf(".");
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) &&
|* Beginning improper-input testing. *|
\*************************************/
sprintf(test_file, "%s/DMAPI_invis_test_file.ERRNO",
- dir_name, i);
+ dir_name);
sprintf(command, "cp %s %s\n", ls_path, test_file);
system(command);
sprintf(bufp, "%c", ch);
if (dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN, 0,
(1000000*(unsigned int)(ch)), 1, bufp)==-1){
- printf("Error invis-writing %s at byte %d million: %s\n",
+ printf("Error invis-writing %s at byte %u million: %s\n",
(char*)bufp, (unsigned int)ch, ERR_NAME);
}
else if (dm_read_invis(sid, hanp, hlen, DM_NO_TOKEN,
(1000000*(unsigned int)(ch)), 1, bufp)==-1){
- printf("Error invis-reading at byte %d million: %s\n", ch,
+ printf("Error invis-reading at byte %u million: %s\n",
(unsigned int)ch, ERR_NAME);
}
else if (((char*)bufp)[0]!=ch) {
"at byte %d million.\n", ch, (char*)bufp, ch);
}
-#if 0
+#ifdef __sgi
/* Try writing a character in the 2 gigabyte (2^31) range */
sprintf(bufp, "%c", ch);
if (dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN, 0,
2147840000, 1, bufp)==-1){
printf("Error invis-writing %s at 2 gigabytes: %s\n",
- (char*)bufp, (unsigned int)ch, ERR_NAME);
+ (char*)bufp, ERR_NAME);
}
else if (dm_read_invis(sid, hanp, hlen, DM_NO_TOKEN,
2147840000, 1, bufp)==-1){
- printf("Error invis-reading at 2 gigabytes: %s\n", ch,
- (unsigned int)ch, ERR_NAME);
+ printf("Error invis-reading at 2 gigabytes: %s\n",
+ ERR_NAME);
}
else if (((char*)bufp)[0]!=ch) {
printf("Error: wanted to read %c and instead got %s.\n",
dm_write_invis(sid, NULL, hlen, DM_NO_TOKEN,
0, 0, 0, NULL))
/*---------------------------------------------------------*/
- /* PROBLEM: write_invis refuses to produce EINVAL for
- /* lengths that will not fit in a dm_size_t.
+#if 0
+ PROBLEM: write_invis refuses to produce EINVAL for
+ lengths that will not fit in a dm_size_t.
+
ERRTEST(EINVAL,
"(bad length) write",
dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN,
0, 4096, (long long)0xFFFFFFFFFFFFFFFFLL,
"write invalid length test"))
+#endif
/*---------------------------------------------------------*/
- /* PROBLEM (somewhat fixed): A signal is sent, rather than EFBIG.
- /* Presumably, this signal is needed to comply with...something.
- /* If this is uncommented, the program will abort here, with the
- /* error message "exceeded file size limit".
+#if 0
+ PROBLEM (somewhat fixed): A signal is sent, rather than EFBIG.
+ Presumably, this signal is needed to comply with...something.
+ If this is uncommented, the program will abort here, with the
+ error message "exceeded file size limit".
+
ERRTEST(EFBIG,
"write",
dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN,
0, (long long)0xFFFFFFFFFFLL,
(long long)0xFFFFFFFFFFLL,
"foo foo foo"))
+#endif
/*---------------------------------------------------------*/
-#if 0
+#ifdef VERITAS_21
ERRTEST(EINVAL,
"(bad offset) write",
dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN,
-#ifdef VERITAS_21
0, (dm_size_t) ULONG_MAX, 5,
-#else
- 0, (dm_size_t) ULONGLONG_MAX, 5,
-#endif
"write invalid offset test"))
#else
+#ifndef linux
ERRTEST(EINVAL,
"(bad offset) write",
dm_write_invis(sid, hanp, hlen, DM_NO_TOKEN,
- 0, (dm_size_t) ULONG_MAX, 5,
+ 0, (dm_size_t) ULONGLONG_MAX, 5,
"write invalid offset test"))
#endif
+#endif
+
/*---------------------------------------------------------*/
ERRTEST(EINVAL,
"(bad sid) write",
dm_read_invis(sid, NULL, hlen, DM_NO_TOKEN,
0, 0, bufp))
/*---------------------------------------------------------*/
-#if 0
+#ifdef VERITAS_21
ERRTEST(EINVAL,
"(bad offset) read",
dm_read_invis(sid, hanp, hlen, DM_NO_TOKEN,
-#ifdef VERITAS_21
- ULONG_MAX, 5, bufp))
-#else
- ULONGLONG_MAX, 5, bufp))
-#endif
+ ULONG_MAX, 5, bufp));
#else
+#ifndef linux
ERRTEST(EINVAL,
"(bad offset) read",
dm_read_invis(sid, hanp, hlen, DM_NO_TOKEN,
- ULONG_MAX, 5, bufp))
+ ULONGLONG_MAX, 5, bufp));
+#endif
#endif
+
/*---------------------------------------------------------*/
ERRTEST(EINVAL,
"(bad sid) read",
printf("\t(errno subtests complete!)\n");
}
sprintf(test_file, "%s/DMAPI_invis_test_file.ERRNO",
- dir_name, i);
+ dir_name);
sprintf(command, "rm %s \n", test_file);
system(command);
&loc))
}
/*------------------------------------------------------------*/
- /* mkdir_by_handle is NOT SUPPORTED in current SGI DMAPI
+#if 0
+ mkdir_by_handle is NOT SUPPORTED in current SGI DMAPI
+
{
SHAREDTEST("mkdir_by_handle", fs_hanp, fs_hlen, test_token,
dm_mkdir_by_handle(sid, fs_hanp, fs_hlen, test_token,
dir_hanp, dir_hlen, "FUBAR_DIR"))
}
+#endif
/*------------------------------------------------------------*/
{ dm_eventset_t eventset;
DMEV_ZERO(eventset);