FileACE C APIs

Describes the FileACE C APIs.

The FileACE C APIs are defined in the hdfs.h header file and are as described below.

hdfsSetAces

Sets the ACEs for a file or directory.

Syntax

int hdfsSetAces(hdfsFS fs, const char *path, hdfsFileAces *faces, int isSet, int isRecursive);

Parameters

  • fs: The configured filesystem handle.
  • path: The path to the file or directory for which the ACEs need to be set.
  • faces: The ACEs to set.
  • isSet: Set to 0 to merge with any existing ACEs. Set to 1 to replace all existing ACEs.
  • isRecursive: Set to 1 to apply ACEs recursively if set on a directory.

Return Value

0 on success, else an error code.

hdfsGetAces

Gets the ACEs from a file or directory.

Syntax

int hdfsGetAces(hdfsFS fs, const char *path, void *aceBuf, int bufLen, hdfsFileAces *faces);

Parameters

  • fs: The configured filesystem handle.
  • path: The path to the file or directory from which the ACEs need to be fetched.
  • aceBuf: The buffer to hold the ACEs.
  • bufLen: Length of the ACE buffer (aceBuf).
  • faces: The structure that contains the returned ACEs.

Return Value

The value is 0 upon success. Otherwise, the ERANGE error occurs, which indicates that the buffer is too small to hold the ACE entries.

hdfsDeleteAces

Deletes all ACEs from a file or directory.

Syntax

int hdfsDeleteAces(hdfsFS fs, const char *path);

Parameters

  • fs: The configured filesystem handle.
  • path: The path to the file or directory from which the ACEs need to be deleted.

Return Value

The value is 0 upon success. Otherwise, an error occurs, as appropriate.