DECdfs for OpenVMS Management Guide


Previous Contents Index


Appendix E
Information for Programmers

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:

  1. Add: #include <devdef.h>
  2. Change the item list code to: DVI$_DEVCHAR2
  3. Change the test of the return value to: if (device_stat & DEV$M_DFS)


Previous Next Contents Index