sd_dcmp.c revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <fcntl.h>
#include <nsctl.h>
#define BLK_CMP 16
#define min(a, b) ((a) > (b) ? (b) : (a))
int bflag = 0;
int
int argc;
char *argv[];
{
int count;
int c;
if (argc < 3) {
(void) printf("Usage: spd_dcmp {-b} <path1> <path2> \n");
(void) printf(" -b : Break on Finding the first Mismatch\n");
exit(1);
}
switch (c) {
case 'b':
bflag = 1;
break;
}
}
if (bflag) {
} else {
}
if (!sdfd1) {
perror("nsc_open");
}
if (fd1 < 0) {
perror("open");
}
if (bflag) {
} else {
}
if (!sdfd2) {
perror("nsc_open");
}
if (fd2 < 0) {
perror("open");
}
if (r < 0 || blocks == 0) {
perror("can't get filesize1");
return (1);
}
if (r < 0 || blocks2 == 0) {
perror("can't get filesize2");
return (1);
}
curpos = 0;
if (r < 0) {
perror("read");
} else if (r == 0)
break;
if (r < 0) {
perror("read");
} else if (r == 0)
break;
(void) printf("\nERROR: data mismatch filepos:%d bl\n",
curpos);
if (bflag) {
exit(1);
}
}
if (!bflag) {
count ++;
if ((count % 64) == 0) {
if (count < 3200) {
(void) printf(".");
} else {
(void) printf(". %10d bl %7d MB\n",
count = 0;
}
}
}
}
if (!bflag) {
}
exit(0);
}