| Document revision date: 28 June 1999 | |
| ![[Compaq]](../../images/compaq.gif) | ![[Go to the documentation home page]](../../images/buttons/bn_site_home.gif)  ![[How to order documentation]](../../images/buttons/bn_order_docs.gif)  ![[Help on this site]](../../images/buttons/bn_site_help.gif)  ![[How to contact us]](../../images/buttons/bn_comments.gif)  | 
| ![[OpenVMS documentation]](../../images/ovmsdoc_sec_head.gif)  | |
| Previous | Contents | Index | 
The OpenVMS operating system includes functions that allow users and programs to determine whether a device is a DECdfs client device.
The following example shows how to determine whether a disk is a DECdfs client device by using a DCL procedure. The procedure returns "TRUE" for a DECdfs client device and "FALSE" for a non-DECdfs client device, as follows:
| 
$ RUN SYS$SYSTEM:DFS$CONTROL
DFS> MOUNT .FIN.ADMIN.DIV.WILMER DFS_DISK
DFS> EXIT
$ IS_IT_DFS_CLIENT = F$GETDVI ("DFS_DISK", "DFS_ACCESS")
$ SHOW SYMBOL IS_IT_DFS_CLIENT
  SYMBOL IS_IT_DFS_CLIENT == "TRUE"
$ 
 | 
You can determine if DECdfs has been started on the system by checking for the existence of the communications device, DFSRR0:. The following lexical function returns a value of True if the communications driver has been loaded:
| 
F$GETDVI ("DFSRR0","EXISTS") 
 | 
If this call returns False, neither the client nor the server is active. A similar call that specifies device DFSS0 will determine if the DECdfs server driver has been loaded.
You can also write your own program code. If you need to identify a DECdfs client device in a program, you can use a similar $GETDVI macro call specifying DVI$_DFS_ACCESS as the item code.
The following example shows another way to determine whether a disk is a DECdfs client device. The example uses the C programming language and the SYS$GETDVIW system service routine.
| 
/* 
 * Example program to say if the specified device is a DFS-served device. 
 * The first command line arg is checked. 
 */ 
#include <stdio.h> 
#include <stdlib.h> 
#include <sdef.h> 
#include <starlet.h> 
#include <descrip.h> 
#include <string.h> 
#include <dvidef.h> 
 
/* Item list structure definition.                                */ 
struct item_list { 
    unsigned short int  length; /* Item buffer length             */ 
    unsigned short int  code;   /* Item code                      */ 
    void   *address;            /* Item buffer address            */ 
    long   *retlen;             /* length returned                */ 
    long    termin;             /* terminator                     */ 
}; 
 
long    device_stat; 
 
int     main (int argc, char *argv[]) 
{ 
    long    status;                     /* system service return status */ 
    $DESCRIPTOR (devname, "");          /* descriptor for device name */ 
    struct item_list    ilist = { 
        4, 
        DVI$_DFS_ACCESS,                /* item list code */ 
        &device_stat,                   /* ptr to returned value */ 
        0, 
        0 
    }; 
 
    devname.dsc$a_pointer = argv[1];    /* descriptor points to first arg */ 
    devname.dsc$w_length = strlen (argv[1]); 
 
    status = sys$getdviw ( 
            0, 
            0, 
            &devname, 
            &ilist, 
            0, 0, 0, 0); 
 
    if (status != SS$_NORMAL) 
        exit (status);                  /* unknown device, etc. */ 
    if (device_stat) 
        printf ("true\n"); 
    else 
        printf ("false\n"); 
    exit (1); 
} 
 | 
The DECdfs access flag is also maintained in the DEVCHAR2 item. To modify the previous program to test that flag:
| Previous | Next | Contents | Index | 
| ![[Go to the documentation home page]](../../images/buttons/bn_site_home.gif)  ![[How to order documentation]](../../images/buttons/bn_order_docs.gif)  ![[Help on this site]](../../images/buttons/bn_site_help.gif)  ![[How to contact us]](../../images/buttons/bn_comments.gif)  | 
| privacy and legal statement | ||
| 6548_CPRO_009.HTML | ||