OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_dam_create - Allocate a physical file

Format

ANSI C, C++

#include <dcdami.h>
int dc_dam_create (char *fname, int blksize, int blknum,
                   int pnum, DCLONG flags)

K&R C

#include <dcdami.h>
int dc_dam_create (fname, blksize, blknum, pnum, flags)
char     *fname;
int      blksize;
int      blknum;
int      pnum;
DCLONG   flags;

Description

The function dc_dam_create() allocates a physical file to the OpenTP1 file system.

The size of a physical file is (block length + 8) x (number of blocks + 1).

Calling the function dc_dam_iopen() is unnecessary after the function dc_dam_create() is called.

The following functions cannot be called after the function dc_dam_create() is called:

The size of an output buffer is (block length + 8) x (number of blocks collectively processed).

Arguments whose values are set in the UAP

fname

Specify the name of a physical file to be created in the OpenTP1 file system, with a path name. The path name must be within (special file name + 14) bytes.

blksize

Specify the length of a physical file block.

blknum

Specify the number of physical file blocks.

pnum

Specify the number of blocks collectively processed which is used as an input/output unit.

flags

Specify the access permissions of the owner, the owner group, and another UAP. The access permissions must be specified with the values shown below or the bit strings shown in parentheses.

DCDAM_READ_OWNER (00400): The read permission of the owner is specified.

DCDAM_WRITE_OWNER (00200): The write permission of the owner is specified.

DCDAM_READ_GROUP (00040): The read permission of the group owner is specified.

DCDAM_WRITE_GROUP (00020): The write permission of the group owner is specified.

DCDAM_READ_OTHERS (00004): The read permission of another UAP is specified.

DCDAM_WRITE_OTHERS (00002): The write permission of another UAP is specified.

The following values are assumed when DCNOFLAGS is specified:

DCDAM_READ_OWNER (00400)

DCDAM_WRITE_OWNER (00200)

DCDAM_READ_GROUP (00040)

DCDAM_READ_OTHERS (00004)

Return values

Return value Return value (numeric) Explanation
0 or positive integer 0 or a positive integer indicates the file descriptor.
DCDAMER_NOMEM -1607 The memory became insufficient.
DCDAMER_OPENED -1608 The specified physical file is opened.
DCDAMER_PARAM_FLAGS -1611 The value specified for flags is invalid.
DCDAMER_FILEER -1614 The physical file name is invalid.
DCDAMER_PNUMER -1615 The value specified for the number of blocks collectively processed is invalid.
DCDAMER_EXIST -1617 A physical file having the same name has been already allocated.
DCDAMER_VERSION -1618 The OpenTP1 file system versions used for creation and allocation do not match each other.
DCDAMER_IOER -1620 An input/output error occurred.
DCDAMER_ACCESS -1628 The UAP that called the function dc_dam_create() does not have the access permission for special files.
A DAM file to be allocated is protected with the security facility. The UAP that called the function dc_dam_create() has no access permission.
DCDAMER_LBLNER -1630 The value specified for the block length is not suitable.
DCDAMER_LBNOER -1631 The value specified for the number of blocks is not suitable.
DCDAMER_LFNMER -1632 The physical file is not a character special file, or the device corresponding to the special file does not exist.
DCDAMER_LNOINT -1633 The specified OpenTP1 file has not been initialized as an OpenTP1 file system.
DCDAMER_LFFOVF -1634 When the OpenTP1 file was initialized as an OpenTP1 file system, an attempt was made to allocate more OpenTP1 files (physical files) than specified.
DCDAMER_LFNOVF -1635 The specified value exceeds the maximum number of files which can be opened in the process being executed.
DCDAMER_USED -1636 The physical file specified for fname is being used in online mode, or it is being used by another process.
DCDAMER_SPACE -1640 The OpenTP1 file system does not have a free area large enough to allocate physical files.
DCDAMER_NO_ACL -1646 A DAM file to be allocated is protected with the security facility. There is no ACL for the corresponding file.