home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
xdfs2.exe
/
XDFS2.C
next >
Wrap
C/C++ Source or Header
|
1995-08-25
|
4KB
|
153 lines
/**************************************************************************
** File: xdfs2.c
**
** Desc: Example program for making Direct File System calls.
**
** This program displays the file map information on the file
** specified on the command line.
**
**
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
**
**
** QMK386 options used:
**
** None
**
** Programmers:
**
** Ini Who Firm
** ---------------------------------------------------------------------
** DWH Dirk W. Howard Novell Developer Support
**
**
** History:
**
** When Who What
** ---------------------------------------------------------------------
** 8-23-1995 DWH First code.
**
*/
/**************************************************************************
** Prototypes and macro definitions
*/
#ifndef PPC
/*------------------------------------------------
** NetWare Intel include files
*/
#include <stdio.h>
#include <dfs.h>
#include <fcntl.h>
#include <share.h>
#include <sys\stat.h>
#include <string.h>
#else
/*------------------------------------------------
** NetWare Power PC include files
*/
#include <nwtypes.h>
#include <stdio.h>
#include <nwdfs.h>
#include <fcntl.h>
#include <share.h>
#include <sys\stat.h>
#include <string.h>
#endif
/*------------------------------------------------
** Macro substitutions
*/
#define MAX_TABLE 1
/**************************************************************************
** main procedure
*/
void main( int argc, char *argv[] )
{
LONG lCount;
LONG lFH;
LONG lCompCode;
LONG lFileBlock;
char caFilename[ 80 ];
char sparseFlag = ' ';
struct FileMapStructure mapTable;
if ( argc < 2 )
{
printf( "Usage: LOAD %s <filename>\r\n", argv[0] );
return;
}
strcpy( caFilename, argv[1] );
/* Open file */
lFH = DFSsopen( caFilename, O_RDONLY | O_EXCL, SH_COMPAT,
S_IWRITE | S_IREAD, 0x00000040, 0 );
if ( lFH == -1 )
{
printf( "XDFS2: Error in DFSsopen for %s\n\r", caFilename );
perror( "DFSsopen" );
return;
}
/* DFSReturnFileMappingInformation */
lFileBlock = 0;
printf( "File Mapping Info * = Sparse file hole \r\n"
"File : %s\r\n\r\n"
" Volume Block File Block Blocks Contiguous\r\n",
caFilename );
do
{
lCompCode = DFSReturnFileMappingInformation( lFH, lFileBlock, &lCount,
MAX_TABLE, &mapTable );
if ( lCompCode != 0 )
{
printf( "XDFS2: Error in DFSReturnFileMappingInformation %ld\r\n",
lCompCode );
DFSclose( lFH );
return;
}
if ( lFileBlock == mapTable.fileBlock )
{
printf( "%c %08ld %08ld %08ld\r\n",
sparseFlag, mapTable.volumeBlock, mapTable.fileBlock,
mapTable.numberOfBlocks );
sparseFlag = ' ';
lFileBlock = lFileBlock + mapTable.numberOfBlocks;
}
else
{
lFileBlock = mapTable.fileBlock;
sparseFlag = '*';
}
} while ( lCount != 0 );
/* Close file */
DFSclose( lFH );
}