NWSMTSGetOpenModeOptionString

Returns TSA-specific open mode option strings.

Syntax

  #include <smsutapi.h> 
  #include <smstsapi.h> 
   
  CCODE NWSMTSGetOpenModeOptionString (
     UINT32   connection, 
     UINT8    optionNumber, 
     STRING   optionString);
  

Parameters

connection

(IN) Specifies the connection information returned by NWSMTSConnectToTargetService or NWSMTSConnectToTargetServicEx.

optionNumber

(IN) Specifies the open mode option number (0- 23) to return.

optionString

(OUT) Specifies the string that describes the option specified by optionNumber (must be NWSM_MAX_STRING_LEN bytes).

Return Values

See Section 9.3, Target Service Return Values for more information.

The following table lists the return values associated with the function.

0x00000000

Successful

0xFFFDFFB9

NWSMTS_UNSUPPORTED_FUNCTION

0xFFFDFFCB

NWSMTS_OPEN_MODE_TYPE_NOT_USED

0xFFFDFFDE

NWSMTS_INVALID_OPEN_MODE_TYPE

0xFFFDFFE7

NWSMTS_INVALID_CONNECTION_HANDL

0xFFFEFFFF

NWSMDR_INVALID_CONNECTION

Remarks

Before NWSMTSGetOpenModeOptionString is called, the engine must be connected to a TSA and Target Service.

The options returned by NWSMTSGetOpenModeOptionString allow the engine to open different parts of the data set on a per data set basis (see Backup Open Mode Options List). For example, the data set's attributes or trustee information. The engine applies the open mode options on an individual basis when NWSMTSWriteDataSet is called.

optionNumber represents the bit position within the TSA-specific open mode option bit map. This value is used by NWSMTSOpenDataSetForBackup and NWSMTSOpenDataSetForRestore.

The following table lists the open mode options.

Option

Value

Description

0

0x00000100

NWSM_NO_DATA_STREAMS: Do not read/write the data set's data streams (e.g., file data).

1

0x00000200

NWSM_NO_EXTENDED_ATTRIBUTES: Do not read/write the data set's extended attributes.

2

0x00000400

NWSM_NO_PARENT_TRUSTEES: Do not read/write the parent's trustees.

3

0x00000800

NWSM_NO_CHILD_TRUSTEES: Do not read/write the child's trustees.

4

0x00001000

NWSM_NO_VOLUME_RESTRICTIONS: Do not read/write the resource's restrictions.

5

0x00002000

NWSM_NO_DISK_SPACE_RESTRICTIONS: Do not read/write the resource's space restrictions.

6

0x00004000

NWSM_INCLUDE_MIGRATED_DATA: Restore migrated data (the migration key is ignored).

7

0x00008000

NWSM_DELETE_EXISTING_TRUSTEES: Delete all trustees of a data set before restoring the data sets.

8

0x00010000

NWSM_EXPAND_COMPRESSED_DATA_SET: Expand data sets that are currently compressed on the host (backup only).

9

0x00020000

NWSM_EXCLUDE_MIGRATED_DATA: Do not backup migrated data, however do backup its migration key and directory entries.

10

0x00040000

NWSM_PRESERVE_ACCESS_TIME : Preserves the access time of the data set after a backup session.

11

0x00080000

NWSM_NO_HARDLINK_DATA : Do not backup the data of consecutive hard link nodes of a particular hardlink network, except for the first encountered node.

If a TSA does not support a TSA-specific open mode option, optionString returns NULL and NWSMTSGetOpenModeOptionString returns successfully (see Backup Open Mode Options List).

The order of the returned strings corresponds to the order of the following bit map starting from bit 8-string one represents bit zero while string two represents bit one, etc.:

Call NWSMTSGetOpenModeOptionString repeatedly until all TSA-specific open mode strings are returned. optionNumber is converted to a bit mask and is used to index a string table.

See Also

NWSMTSOpenDataSetForBackup, NWSMTSOpenDataSetForRestore

Example

  #include <smsutapi.h> 
  #include <smstsapi.h> 
   
  typedef struct TSA_SPECIFIC_OPEN_MODE 
  { 
     NWBOOLEAN selected; 
     UINT32 openMode; 
     char openModeString[NWSM_MAX_STRING_LEN]; 
     struct TSA_SPECIFIC_OPEN_MODE *next; 
  } TSA_SPECIFIC_OPEN_MODE; 
   
  UINT8 optionNumber = 0; 
  char optionString[NWSM_MAX_STRING_LEN]; 
  TSA_SPECIFIC_OPEN_MODE *TSAOpenModes = NULL, *last, *tmp; 
  UINT32 openMode, chosenOpenModes; 
   
  for (optionNumber = 0, openMode = 0x100; optionNumber <= 23; optionNumber++, 
        openMode <<= 1) 
  { 
     if (NWSMTSGetOpenModeOptionString(connection, optionNumber, 
        (STRING)optionString) != 0) 
     break; 
   
     if (!*optionString) 
        continue; 
   
     TMp = (TSA_SPECIFIC_OPEN_MODE *)calloc(1, sizeof(TSA_SPECIFIC_OPEN_MODE)); 
     TMp->openMode = openMode; 
     strcpy(tmp->openModeString, optionString); 
   
     if (TSAOpenModes) 
     { 
        last->next = TMp; 
        last = TMp; 
     } 
   
     else 
        TSAOpenModes = last = TMp; 
   } 
   
  /* Create the strings for the generic open modes-see "Backup Open Mode Options List" and the “Remarks” for more 
  information */  
   
  /* Display the open mode options to the user, get the user's selections and set it into chosenOpenModes, then pass 
  chosenOpenModes to NWSMTSOpenDataSetForBackup or NWSMTSOpenDataSetForRestore. */
  

The following is a simplified example of returning the TSA-specific open mode strings.

  /* optionNumber is initialized to zero to indicate to start from the first open mode option string. 
  It is then incremented from 0 through 23 to get all the strings.
  openMode contains the open mode bit mask that represents the open mode option. 
  It is initialized to 0x1000 because the first TSA-specific option starts at bit 8 of the open mode bit map. */ 
   
  for (optionNumber = 0, openMode = 0x100; optionNumber <= 23; optionNumber++, openMode <<= 1) 
  { 
     if (NWSMTSGetOpenModeOptionString(connection, optionNumber, 
           (STRING)optionString) != 0) 
        break; 
   
     if (!*optionString) 
        continue; 
  /* Continue takes care of any TSA-specific open mode options that may not be supported. */ 
     /* Copy openMode and optionString to a link list used to build the remaining portion of the open modes option list. */ 
   
    ... 
  }