vxfs_ap_assign_file_pat - assign a pattern-based allocation policy for a directory
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/sparcv9
-l vxfsutil -ldl
For both applications:
int vxfs_ap_assign_file_pat(int fd, struct fsap_pattern_table *pat_assign, uint32_t flags);
vxfs_ap_assign_file_pat() assigns the pattern table for a directory specified by fd. If the directory has an existing pattern table, the table is replaced. After successfully setting the table, when a regular file is created in this directory, 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, taking precedence over inheriting per-file allocation policies. The flags in the matching pattern entry are applied to the allocation policy of the file being created.
To use this function, specify -l vxfsutil while linking. Specify the /opt/VRTSvxfs/lib directory for 32-bit executables, or the /opt/VRTSvxfs/lib/sparcv9 directory for 64-bit executables.
When a subdirectory is created, the subdirectory can inherit the pattern table of its parent directory, if the table is inheritable.
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:
Number of patterns to be set. If specified as zero, the call deletes the pattern table.
Array of patterns (fsap_pattern_entry structures).
Possible values for fsap_pattern_entry are:
Pattern entry flags. Possible values for pe_flags are:
Sets the flags of newly created files' allocation policies to inherit.
Does not set the flags of newly created files' allocation policies.
The user ID to match. Possible values for pe_uid are:
Matches any user ID.
0 or greater
Matches the specified user ID.
The group ID to match. Possible values for pe_gid are:
Matches any group ID.
0 or greater
Matches the specified group ID.
Specifies the filename component to match. Must be a non-null string to perform a match.
Specifies the data policy name string. The name cannot contain "\n" or "/".
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 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.
The pe_flags entry of the struct fsap_pattern_entry is unused and must be passed as zero (0).
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:
Subdirectories created in the directory specified by fd inherit the directory's pattern table.
Possible values for flags are:
The flags field must be passed with a value of 0.
vxfs_ap_assign_file_pat() returns zero on success, non-zero on failure.
Invalid policy name. The name has invalid characters.
The named policy does not exist.
The number of patterns or pattern data exceeds the maximum allowed.
The user cannot access the policy. The policy is defined as ROOT only.
An I/O error occurred during the operation.
The fd field does not point to a directory.
There is not enough space to complete the operation.
No appropriate licenses are installed.
The specified file system is mounted read-only.