vxfs_ap_assign_fs_pat (3)


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


For 32-bit applications:

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

-l vxfsutil -ldl

For 64-bit applications:

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

-l vxfsutil -ldld

For both applications:

#include <sys/types.h>

#include <vxfsutil.h>

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




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. Specify the /opt/VRTSfssdk/5.0/lib directory for 32-bit executables, or the /opt/VRTSfssdk/5.0/lib/64 directory for 64-bit executables.

If the LIBVXFSUTIL_DLL_PATH environment variable is defined, it should be set to the name of the vxfsutil.so file, such as ~/mylib/vxfsutil.so. If undefined, this variable is assumed to point to the 32-bit and 64-bit vxfsutil.so files, /opt/VRTSvxfs/lib/vxfsutil.so and /opt/VRTSvxfs/lib/64/vxfsutil.so, respectively.

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:
  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:
  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:
  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.


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.


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.


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


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.


vxfs_ap_query_fs_pat(3), vxfs_ap_assign_file_pat(3)

VxFS 5.1 SP1 vxfs_ap_assign_fs_pat (3)