1592 }
1593
1594 /* ARGSUSED */
1595 static int
1596 rfs4_fattr4_fs_locations(nfs4_attr_cmd_t cmd, struct nfs4_svgetit_arg *sarg,
1597 union nfs4_attr_u *na)
1598 {
1599 int error = 0;
1600 fs_locations4 *fsl;
1601
1602 if (RFS4_MANDATTR_ONLY)
1603 return (ENOTSUP);
1604
1605 switch (cmd) {
1606 case NFS4ATTR_SUPPORTED:
1607 if (sarg->op == NFS4ATTR_SETIT || sarg->op == NFS4ATTR_VERIT)
1608 error = EINVAL;
1609 break; /* this attr is supported */
1610
1611 case NFS4ATTR_GETIT:
1612 fsl = fetch_referral(sarg->cs->vp, sarg->cs->cr);
1613 if (fsl == NULL)
1614 (void) memset(&(na->fs_locations), 0,
1615 sizeof (fs_locations4));
1616 else {
1617 na->fs_locations = *fsl;
1618 kmem_free(fsl, sizeof (fs_locations4));
1619 }
1620 global_svstat_ptr[4][NFS_REFERRALS].value.ui64++;
1621 break;
1622
1623 case NFS4ATTR_FREEIT:
1624 if (sarg->op == NFS4ATTR_SETIT || sarg->op == NFS4ATTR_VERIT)
1625 error = EINVAL;
1626 rfs4_free_fs_locations4(&na->fs_locations);
1627 break;
1628
1629 case NFS4ATTR_SETIT:
1630 case NFS4ATTR_VERIT:
1631 /*
1632 * read-only attr
1633 */
1634 error = EINVAL;
1635 break;
1636 }
1637 return (error);
1638 }
1639
1640 /* ARGSUSED */
1641 static int
1642 rfs4_fattr4_hidden(nfs4_attr_cmd_t cmd, struct nfs4_svgetit_arg *sarg,
|
1592 }
1593
1594 /* ARGSUSED */
1595 static int
1596 rfs4_fattr4_fs_locations(nfs4_attr_cmd_t cmd, struct nfs4_svgetit_arg *sarg,
1597 union nfs4_attr_u *na)
1598 {
1599 int error = 0;
1600 fs_locations4 *fsl;
1601
1602 if (RFS4_MANDATTR_ONLY)
1603 return (ENOTSUP);
1604
1605 switch (cmd) {
1606 case NFS4ATTR_SUPPORTED:
1607 if (sarg->op == NFS4ATTR_SETIT || sarg->op == NFS4ATTR_VERIT)
1608 error = EINVAL;
1609 break; /* this attr is supported */
1610
1611 case NFS4ATTR_GETIT:
1612 {
1613 kstat_named_t *stat =
1614 sarg->cs->exi->exi_ne->ne_globals->svstat[NFS_V4];
1615
1616 fsl = fetch_referral(sarg->cs->vp, sarg->cs->cr);
1617 if (fsl == NULL)
1618 (void) memset(&(na->fs_locations), 0,
1619 sizeof (fs_locations4));
1620 else {
1621 na->fs_locations = *fsl;
1622 kmem_free(fsl, sizeof (fs_locations4));
1623 }
1624 stat[NFS_REFERRALS].value.ui64++;
1625 break;
1626 }
1627 case NFS4ATTR_FREEIT:
1628 if (sarg->op == NFS4ATTR_SETIT || sarg->op == NFS4ATTR_VERIT)
1629 error = EINVAL;
1630 rfs4_free_fs_locations4(&na->fs_locations);
1631 break;
1632
1633 case NFS4ATTR_SETIT:
1634 case NFS4ATTR_VERIT:
1635 /*
1636 * read-only attr
1637 */
1638 error = EINVAL;
1639 break;
1640 }
1641 return (error);
1642 }
1643
1644 /* ARGSUSED */
1645 static int
1646 rfs4_fattr4_hidden(nfs4_attr_cmd_t cmd, struct nfs4_svgetit_arg *sarg,
|