Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Environment

Functions for managing yuneta directory paths and file permissions.

Source: kernel/c/root-linux/src/yunetas_environment.h


register_yuneta_environment()

Registers the yuneta environment with root directory, domain directory, and file permission masks.

int register_yuneta_environment(
    const char *root_dir,
    const char *domain_dir,
    int xpermission,
    int rpermission
);

Parameters

KeyTypeDescription
root_dirconst char *Root directory path.
domain_dirconst char *Domain (realms) directory path.
xpermissionintPermission mask for directories and executable files (e.g. 02775).
rpermissionintPermission mask for regular files (e.g. 0664).

Returns

0.


yuneta_xpermission()

Returns the permission mask for directories and executable files.

int yuneta_xpermission(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

The xpermission value registered with register_yuneta_environment().


yuneta_rpermission()

Returns the permission mask for regular files.

int yuneta_rpermission(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

The rpermission value registered with register_yuneta_environment().


yuneta_root_dir()

Returns the main root directory path.

const char *yuneta_root_dir(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

Root directory path string.


yuneta_domain_dir()

Returns the domain directory path (base path for realms).

const char *yuneta_domain_dir(void);

Parameters

KeyTypeDescription
--This function does not take any parameters.

Returns

Domain directory path string.


yuneta_realm_dir()

Builds the path for a realm directory: root_dir/domain_dir/subdomain.

char *yuneta_realm_dir(
    char *bf,
    int bfsize,
    const char *subdomain,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
subdomainconst char *Subdomain name.
createBOOLTRUE to create the directory if it does not exist.

Returns

Pointer to bf, or NULL if create is TRUE and directory creation failed.


yuneta_realm_file()

Builds the path for a file inside a realm directory.

char *yuneta_realm_file(
    char *bf,
    int bfsize,
    const char *subdomain,
    const char *filename,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
subdomainconst char *Subdomain name.
filenameconst char *File name.
createBOOLTRUE to create the parent directory if it does not exist.

Returns

Pointer to bf.


yuneta_log_dir()

Builds the path for the logs directory: root_dir/domain_dir/logs.

char *yuneta_log_dir(
    char *bf,
    int bfsize,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
createBOOLTRUE to create the directory if it does not exist.

Returns

Pointer to bf.


yuneta_log_file()

Builds the path for a log file.

char *yuneta_log_file(
    char *bf,
    int bfsize,
    const char *filename,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
filenameconst char *Log file name.
createBOOLTRUE to create the parent directory if it does not exist.

Returns

Pointer to bf.


yuneta_bin_dir()

Builds the path for the bin directory: root_dir/domain_dir/bin.

char *yuneta_bin_dir(
    char *bf,
    int bfsize,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
createBOOLTRUE to create the directory if it does not exist.

Returns

Pointer to bf.


yuneta_bin_file()

Builds the path for a binary file.

char *yuneta_bin_file(
    char *bf,
    int bfsize,
    const char *filename,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
filenameconst char *Binary file name.
createBOOLTRUE to create the parent directory if it does not exist.

Returns

Pointer to bf.


yuneta_store_dir()

Builds the path for a store directory: root_dir/store/dir/subdir.

char *yuneta_store_dir(
    char *bf,
    int bfsize,
    const char *dir,
    const char *subdir,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
dirconst char *First-level directory name.
subdirconst char *Second-level directory name.
createBOOLTRUE to create the directory if it does not exist.

Returns

Pointer to bf.


yuneta_store_file()

Builds the path for a file in a store directory.

char *yuneta_store_file(
    char *bf,
    int bfsize,
    const char *dir,
    const char *subdir,
    const char *filename,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
dirconst char *First-level directory name.
subdirconst char *Second-level directory name.
filenameconst char *File name.
createBOOLTRUE to create the parent directory if it does not exist.

Returns

Pointer to bf.


yuneta_realm_store_dir()

Builds the path for a realm store directory: root_dir/store/service/owner/realm_id/tenant/dir.

char *yuneta_realm_store_dir(
    char *bf,
    int bfsize,
    const char *service,
    const char *owner,
    const char *realm_id,
    const char *tenant,
    const char *dir,
    BOOL create
);

Parameters

KeyTypeDescription
bfchar *Output buffer.
bfsizeintBuffer size.
serviceconst char *Service name.
ownerconst char *Owner identifier.
realm_idconst char *Realm identifier.
tenantconst char *Tenant identifier.
dirconst char *Directory name.
createBOOLTRUE to create the directory if it does not exist.

Returns

Pointer to bf.