test veritas logo


vxfs_ap_assign_fs_pat(3)

NAME

vxfs_ap_assign_fs_pat - assign a pattern-based allocation policy for a file system

SYNOPSIS

cc -I /opt/VRTS/include -L /opt/VRTS/lib

-l vxfsutil -ldl

#include <sys/types.h>

#include <vxfsutil.h>

int vxfs_ap_assign_fs_pat(int fd, struct fsap_pattern_table *pat_assign, uint32_t flags);

AVAILABILITY

VRTSvxfs

DESCRIPTION

vxfs_ap_assign_fs_pat() assigns the pattern table for a file system specified by fd. If the file system has an existing pattern table, the table is replaced. After successfully setting the table, the file system’s pattern table takes effect when a regular file is created anywhere in the file system if the file system’s parent directory does not have a pattern table and the file does not have an allocation policy to inherit. The file’s name and creating process’ UID and GID are matched to the patterns defined in the table in the given order. The first successful match is used to set the allocation policies of the file.

To use this function, specify -l vxfsutil while linking.

The vxfs_ap_assign_fs_pat() call has no effect on individual directories’ pattern tables.

The fd field is the file descriptor of the mount point’s directory.

The pat_assign field is a pointer to a structure that has pattern information to be assigned. Possible values for pat_assign are:
pt_flags Pattern flags.
pt_num Number of patterns to be set. If specified as zero, the call deletes the pattern table.
pt_data[1] Array of patterns (fsap_pattern_entry structures).
Possible values for fsap_pattern_entry are:
pe_flags Pattern entry flags. Possible values for pe_flags are:
FSAP_INHERIT
  Sets the flags of newly created files’ allocation policies to inherit.
0 Does not set the flags of newly created files’ allocation policies.
pe_uid The user ID to match. Possible values for pe_uid are:
FSAP_PATTERN_ID_NONE
  Matches any user ID.
0 or greater
  Matches the specified user ID.
pe_gid The group ID to match. Possible values for pe_gid are:
FSAP_PATTERN_ID_NONE
  Matches any group ID.
0 or greater
  Matches the specified group ID.
pe_filename Specifies the filename component to match. Must be a non-null string to perform a match.
pe_data_policy Specifies the data policy name string. The name cannot contain "\n" or "/".
pe_meta_policy Specifies the meta policy name string. The name cannot contain "\n" or "/".
When a new file is created, the pattern matching matches the file name, user ID, and group ID with each entry in the pattern table in the same order as specified in the table, stopping with the first match. The app_uid and app_gid fields of the fs_ap_pattern_policy structure must contain numbers. The policy names cannot contain "\n" or "/".

The pattern data can have a maximum of 8064 bytes. The number of patterns that can be stored depends on the number of pattern entries, the size of each entry, and the overhead required to store each entry.

Patterns can be checked only at runtime.

NOTES

Assigning or defining an allocation policy can fail because of a conflict with volume flags. The conflict detection attempts to detect all conflicts, but there is no guarantee that all conflicts will be detected.

This API supports file system versions 6.0 and above.

FLAGS

Possible values for pt_flags are:
0 The flags field must be passed with a value of 0.
Possible values for flags are:
0 The flags field must be passed with a value of 0.

RETURN VALUES

vxfs_ap_assign_fs_pat() returns zero on success, non-zero on failure.

ERRORS

EINVAL Invalid policy name. The name has invalid characters.
ENOENT The named policy does not exist.
E2BIG The number of patterns or pattern data exceeds the maximum allowed.
EPERM The user cannot access the policy. The policy is defined as ROOT only.
ENXIO An I/O error occurred during the operation.
ENOTDIR The fd field does not point to a directory.
ENOSPC There is not enough space to complete the operation.
ENOSYS No appropriate licenses are installed.
EROFS The specified file system is mounted read-only.

SEE ALSO

vxfs_ap_query_fs_pat(3), vxfs_ap_assign_file_pat(3)


VxFS 8.0 vxfs_ap_assign_fs_pat(3)