fs_crypto_file_set_domain()

Updated: April 19, 2023

Set the domain of a file or directory

Synopsis:

#include <fs_crypto_api.h>
#include <sys/fs_crypto.h>

int fs_crypto_file_set_domain( const char *path,
                               int pdomain,
                               int *preply );

Arguments:

path
The path to the file or directory whose domain you want to set.
domain
The number of the domain that you want to assign the file or directory to, or 0 (FS_CRYPTO_UNASSIGNED_DOMAIN) if you don't want the item to be in any domain, and hence unencrypted.
preply
A pointer to a location where the function can store additional success or error information.

Library:

libfscrypto

Use the -l fscrypto option to qcc to link against this library.

Description:

The fs_crypto_file_set_domain() function sets the domain number for the given file or directory, storing the number in the location that domain points to.

Note: In order to use filesystem encryption, download the Encrypted Filesystem package from the QNX Software Center.

In order for you to successfully set the domain:

This function sets the variable pointed to by preply to one of the following values:

FS_CRYPTO_REPLY_ALREADY
The file or directory is already assigned to the given domain.
FS_CRYPTO_REPLY_BAD_FILE
The path isn't for a directory or a regular file.
FS_CRYPTO_REPLY_COMPLETE
The function retrieved the domain number.
FS_CRYPTO_REPLY_ERRNO
See the error code for more information.
FS_CRYPTO_REPLY_INVALID
The command wasn't completed successfully.
FS_CRYPTO_REPLY_NOT_ZERO
The path is for a regular file, and the file's size isn't zero.
FS_CRYPTO_REPLY_READONLY
The filesystem is mounted as read-only.
FS_CRYPTO_REPLY_UNKNOWN_DOMAIN
There's no domain with the given number.

Returns:

EOK
Success.
EINVAL
Invalid arguments.

This function can also return any of the errors indicated by devctl() or open(), or any errno values returned by the underlying filesystem.

Classification:

QNX Neutrino

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes