genseq Device Configuration Subroutine

Purpose

Generates a unique sequence number for creating a device's logical name.

Syntax

#include <cf.h>
#include <sys/cfgodm.h>
#include <sys/cfgdb.h>
int genseq (prefix)
char *prefix;

Parameters

Item Description
prefix Points to the character string containing the prefix name of the device.

Description

The genseq device configuration subroutine generates a unique sequence number to be concatenated with the device's prefix name. The device name in the Customized Devices (CuDv) object class is the concatenation of the prefix name and the sequence number. The rules for generating sequence numbers are as follows:

  • A sequence number is a nonnegative integer. The smallest sequence number is 0.
  • When deriving a device instance logical name, the next available sequence number (relative to a given prefix name) is allocated. This next available sequence number is defined to be the smallest sequence number not yet allocated to device instances using the same prefix name.
  • Whether a sequence number is allocated or not is determined by the device instances in the CuDv object class. If an entry using the desired prefix exists in this class, then the sequence number for that entry has already been allocated.

It is up to the application to convert this sequence number to character format so that it can be concatenated to the prefix to form the device name.

Return Values

If the genseq subroutine succeeds, it returns the generated sequence number in integer format. If the subroutine fails, it returns a value of -1.

Files

Item Description
/usr/lib/libcfg.a Archive of device configuration subroutines.