Symantec logo

vxfs_ap_query2

NAME

vxfs_ap_query2 - return information about a specific allocation policy

SYNOPSIS

cc -I /opt/VRTS/include -L /opt/VRTS/lib
-l vxfsutil -ldld

#include <sys/types.h>

#include <vxfsutil.h>

int vxfs_ap_query2(int fd, char *policyname, struct fsap_info2 **infopp);

AVAILABILITY

VRTSvxfs

DESCRIPTION

vxfs_ap_query2() fills the fsap_info2 structure with the information for the policy specified by name policyname. The file descriptor fd specifies the mount point or any file in the file system. The caller is responsible for freeing the fsap_info2 structure by calling vxfs_ap_free2().

struct fsap_info2 {

char ap_name[FSAP_NAMESZ];

uint32_t ap_flags;

uint32_t ap_order;

uint64_t ap_chunk;

uint32_t ap_ncomp;

uint32_t ap_pad;

union {

char apc_vols[1][FSVOL_NAMEZ];

char apc_subp[1][FSAP_NAMEZ];

} ap_comp;

};

#define ap_vols ap_comp.apc_vols

#define ap_subp ap_comp.apc_subp

Possible values for ap_flags are:

FSAP_ANYUSER

The policy can be assigned by non-privileged users. By default, only privileged users can assign policies.

FSAP_SUBPOLICIES

The policy definition will contain the names of other allocation policies in its component list. Without this flag, the component list will contain volume names. A policy can refer to either subpolicies or volumes, but not to both.

Possible values for ap_order are:

FSAP_ORDER_ASGIVEN

Allocations are done from the components in the order in which they are given in the allocation policy.

FSAP_ORDER_LEASTFULL

Allocations are done from the volume specified in the allocation policy that has the most free blocks.

FSAP_ORDER_ROUNDROBIN

Allocations are done from a component that is selected in a round-robin fashion from those specified in the allocation policy.

FSAP_ORDER_BALANCE

Allocations are done from a volume that is selected at random from those specified in the allocation policy. When a volume is selected, the allocation is limited to a maximum chunk size.

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

NOTES

This API supports file system versions 6.0 and above.

RETURN VALUES

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

ERRORS

EFAULT

One or more of the specified pointer arguments points to an illegal address.

ENOENT

The specified policy does not exist.

ENOTSUP

This operation is not supported by the disk layout version of the specified file system. Use vxupgrade(1m) to enable this operation.

EXAMPLES

The following pseudo-code queries a policy:

#include <vxfsutil.h>

/*

* Query a policy.

*/

int

query_policy()

{

struct fsap_info2 *fsap = NULL;

int fd;

int err = 0;

if ((fd = open("My_mountpoint", O_RDONLY)) < 0) {

return errno;

}

if (err = vxfs_ap_query2(fd, "My_policy_name", &fsap)) {

goto out;

}

/*

* Do something with the policy.

*/

do_something(fsap);

out:

close(fd);

if (fsap) {

vxfs_ap_free2(fsap);

}

return err;

}

SEE ALSO

vxfs_ap_alloc2(3), vxfs_ap_assign_ckpt(3), vxfs_ap_assign_file(3), vxfs_ap_assign_fs(3), vxfs_ap_define(3), vxfs_ap_define2(3), vxfs_ap_enforce_file(3), vxfs_ap_enumerate(3), vxfs_ap_enumerate2(3), vxfs_ap_free2(3), vxfs_ap_query(3), vxfs_ap_query_ckpt(3), vxfs_ap_query_file(3), vxfs_ap_query_fs(3), vxfs_ap_remove(3), vxfs_vol_add(3), vxfs_vol_deencapsulate(3), vxfs_vol_encapsulate(3), vxfs_vol_enumerate(3), vxfs_vol_remove(3), vxfs_vol_resize(3), vxfs_vol_stat(3)