//-*-c++-*--------------------------------------------------------------
//  lvidTest.cpp
//   Tests out the different size possibilities of the LVID.
//
//      Unpublished Confidential Information of Hewlett-Packard
//      Company. Do not disclose.  Copyright (c) Hewlett-Packard
//      Company 1995. All rights reserved
// 
// The contents of this software are proprietary and confidential to
// the Hewlett- Packard Company, and are limited in distribution to
// those with a direct need to know.  Individuals having access to
// this software are responsible for maintaining the confidentiality
// of the content and for keeping the software secure when not in use.
// Transfer to any party is strictly forbidden other than as expressly
// permitted in writing by Hewlett-Packard Company.  Unauthorized
// transfer to or possession by any unauthorized party may be a
// criminal offense.
//
//                  RESTRICTED RIGHTS LEGEND
//
//      Use,  duplication,  or disclosure by the U. S. Government is
//      subject to restrictions as set forth in subparagraph (c) (1)
//      (ii) in the Rights in Technical Data and Computer Software
//      clause in DFARS 252.227-7013 or any other successor clause.
//
//                      HEWLETT-PACKARD COMPANY
//                      3000 Hanover St.
//                      Palo Alto, CA  94304 U.S.A.
//
//      Rights for non-DOD U.S. Government Departments and Agencies
//      are as set forth in FAR 52.227-19 (c) (1,2) or any other
//      successor clause.
//
//  CLASSES:
//   ClassName1
//   ClassName2
//  
//----------------------------------------------------------------------
//
// $Source: /projects/HMS/nsr/udfAncil/descrTst/lvidTest.cpp,v $
// $Revision: 1.6 $     $Author: hmgr $
// $State: Exp $        $Locker:  $
// $Date: 96/04/24 01:44:43 $
//

#ifdef OLD_CORE
    #include "nsrlib/nsrlib.h"
#else
    #include "nsrLib.h"
#endif

static const int BUFLEN = 8192;

#include <stdio.h>
#include <stdlib.h>

main(int argc, CHAR_PTR argv[])
{
    if (argc < 2)
        printf("Usage: lvidTest <numCartridges>\n");
    else {
        UINT32 maxSurfaces = 2 * atoi(argv[1]);
        LogicalVolumeIntegrityDesc *lvidp;
        UINT32 np,nt,dl,nss,nls,onss,onls;

        printf("%4s %4s %5s %4s %4s\n","Cart","ICBt","LVIDl"," 512","1024");
        for (np = 2; np <= maxSurfaces; np+=2) {
            onss = onls = 0;
            for (nt = 0; nt <= (np+1)/2; nt++) {

                lvidp = new LogicalVolumeIntegrityDesc(np,nt);
                dl  = lvidp->descLen();
                nss = (dl + 511)/512;
                nls = (dl + 1023)/1024;
                if ((nss != onss) || (nls != onls))
                    printf("%4d %4d %5d %4d %4d\n", np/2, nt, dl, nss, nls);
                onss = nss;
                onls = nls;
                delete lvidp;
            }
        }
    }
}

