xfs: functional testing of V5-relevant options
[xfstests-dev.git] / lib / datapid.c
index f6be3e769be3d28fd9be86ffe48c7726cd1366ce..15af887167e45ef2a968126102880a113a437884 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * 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 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.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 /************
 
@@ -75,87 +63,8 @@ char *buffer;
 int bsize;
 int offset;
 {
-#if CRAY
-       
-   int cnt;
-   int tmp;
-   char *chr;
-   long *wptr;
-   long word;
-   int woff;   /* file offset for the word */
-   int boff;   /* buffer offset or index */
-   int num_full_words;
-
-    num_full_words = bsize/NBPW;
-    boff = 0;
-
-    if ( cnt=(offset % NBPW) ) {       /* partial word */
-
-       woff = offset - cnt;
-#if DEBUG
-printf("partial at beginning, cnt = %d, woff = %d\n", cnt, woff);
-#endif
-
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-
-       for (tmp=0; tmp<cnt; tmp++) {   /* skip unused bytes */
-           chr++;
-        }
-
-       for (; boff<(NBPW-cnt) && boff<bsize; boff++, chr++) {
-           buffer[boff] = *chr;
-       }
-    }
-
-    /*
-     * full words 
-     */
-
-    num_full_words = (bsize-boff)/NBPW;
-       
-    woff = offset+boff;
-       
-    for (cnt=0; cnt<num_full_words; woff += NBPW, cnt++ ) {
-
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-       for(tmp=0; tmp<NBPW; tmp++, chr++) {
-           buffer[boff++] = *chr;
-       }
-/****** Only if wptr is a word ellined
-       wptr = (long *)&buffer[boff];
-       *wptr = word;
-       boff += NBPW;
-*****/
-
-    }
-
-    /*
-     * partial word at end of buffer
-     */
-
-    if ( cnt=((bsize-boff) % NBPW) ) {
-#if DEBUG
-printf("partial at end\n");
-#endif
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-
-       for (tmp=0; tmp<cnt && boff<bsize; tmp++, chr++) {
-           buffer[boff++] = *chr;
-       }
-    }
-
-    return bsize;
-
-#else
        return -1;      /* not support on non-64 bits word machines  */
 
-#endif
 
 } 
 
@@ -171,112 +80,12 @@ int bsize;
 int offset;
 char **errmsg;
 {
-#if CRAY
-       
-   int cnt;
-   int tmp;
-   char *chr;
-   long *wptr;
-   long word;
-   int woff;   /* file offset for the word */
-   int boff;   /* buffer offset or index */
-   int num_full_words;
-
-
-    if ( errmsg != NULL ) {
-        *errmsg = Errmsg;
-    }
-
-
-    num_full_words = bsize/NBPW;
-    boff = 0;
-
-    if ( cnt=(offset % NBPW) ) {       /* partial word */
-       woff = offset - cnt;
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-
-       for (tmp=0; tmp<cnt; tmp++) {   /* skip unused bytes */
-           chr++;
-        }
-
-       for (; boff<(NBPW-cnt) && boff<bsize; boff++, chr++) {
-           if (buffer[boff] != *chr) {
-               sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
-                   offset+boff, *chr, buffer[boff]);
-               return offset+boff;
-           }
-       }
-    }
-
-    /*
-     * full words 
-     */
-
-    num_full_words = (bsize-boff)/NBPW;
-       
-    woff = offset+boff;
-       
-    for (cnt=0; cnt<num_full_words; woff += NBPW, cnt++ ) {
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-       for(tmp=0; tmp<NBPW; tmp++, boff++, chr++) {
-           if ( buffer[boff] != *chr ) {
-               sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
-                   woff, *chr, buffer[boff]);
-               return woff;
-           }
-       }
-
-/****** only if a word elined
-       wptr = (long *)&buffer[boff];
-       if ( *wptr != word ) {
-           sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
-               woff, word, *wptr);
-           return woff;
-       }
-       boff += NBPW;
-******/
-    }
-
-    /*
-     * partial word at end of buffer
-     */
-
-    if ( cnt=((bsize-boff) % NBPW) ) {
-#if DEBUG
-printf("partial at end\n");
-#endif
-       word = ((LOWER16BITS(pid) << 48) | (LOWER32BITS(woff) << 16) | LOWER16BITS(pid));
-
-       chr = (char *)&word;
-
-
-       for (tmp=0; tmp<cnt && boff<bsize; boff++, tmp++, chr++) {
-           if ( buffer[boff] != *chr ) {
-               sprintf(Errmsg, "Data mismatch at offset %d, exp:%#o, act:%#o",
-                   offset+boff, *chr, buffer[boff]);
-               return offset+boff;
-           }
-       }
-    }
-
-    sprintf(Errmsg, "all %d bytes match desired pattern", bsize);
-    return -1;      /* buffer is ok */
-
-#else
-       
     if ( errmsg != NULL ) {
         *errmsg = Errmsg;
     }
     sprintf(Errmsg, "Not supported on this OS.");
     return 0;
 
-#endif
-
-
 }       /* end of datapidchk */
 
 #if UNIT_TEST