zDelete

Deletes one or more file names.

Service:File System Services (64-Bit)
Version:OES 2

Syntax

#include <zPublics.h>

STATUS zDelete(
   Key_t        key,
   Xid_t        xid,
   NINT         nameSpace,
   const void  *path,
   NINT         matchAttribute,
   NINT         deleteFlags);

Parameters

key

(IN) Specifies who is deleting the file. If the path is a relative path, it also specifies the starting directory for resolving the pathname.

xid

(IN) Specifies the transaction. Any deletes that are part of a transaction are not completed until the transaction is committed. For no transaction, set to zNILXID.

nameSpace

(IN) Specifies the starting namespace for the path parameter. In addition to the normal namespace identifiers (zNSPACE_DOS | zNSPACE_MAC | zNSPACE_UNIX | zNSPACE_LONG | zNSPACE_DATA_STREAM | zNSPACE_EXTENDED_ATTRIBUTE), the nameSpace parameter can be augmented by ORing the following mode bits:

  • zMODE_UTF8

    The default character set for the path is Unicode; however, by ORing zMODE_UTF8, UTF-8 character strings can be used.

  • zMODE_DELETED

    Changes the name scanning to look for deleted files in the salvage system, which effectively purges the file.

  • zMODE_LINK

    If the last name in the path is a symbolic link, a junction, or a URL link, the scanning does not follow the link but acts on the link object itself.

path

(IN) Points to the path of the file object to be deleted. If the path is not fully qualified, the key must represent a directory for starting the path parsing. The default character set for the pathname is Unicode unless it is specified by the nameSpace parameter.

matchAttributes

(IN) Specifies the attributes that the existing file must match for the file to be deleted (see Match Attributes Values).

deleteFlags

(IN) Specifies actions to take place on the file object being deleted.

  • zDELETE_PURGE_IMMEDIATE. Do not move the file into the salvage system. Purge it immediately so that it cannot be undeleted.

Return Values

zOK

The operation completed successfully.

non-0

An error occurred (see Section 4.1, Return Values for a description).

Remarks

If the salvage feature is enabled, delete is more like a rename that places the file object in a state where its storage can be reused but it is no longer visible to naming, unless zMODE_DELETED is set in the nameSpaceID.

If wildcards are not being used and an error occurs, the file object is not deleted. If wildcards are being used, check the return values carefully to determine if no file objects were deleted, some file objects were deleted, or other file objects which matched the wildcards were deleted.

If the file object has zFA_IMMEDIATE_PURGE set in its file attributes, if the system default is to purge immediately, or if the file system is full, the file object is deleted completely. Otherwise, it is moved to the file salvage system, where it remains until it is salvaged, until a purge takes place, or until the space is needed for additional live files.

If the file object is a directory container and the directory container is not empty, the delete fails.When a file is deleted, all data streams and/or extended attributes associated with that file are also deleted.

If the salvage system is enabled, zDelete marks the file as zFILE_DELETED so that it can be recovered by zRename.

See Also

zCreate, zLink, zRename