b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * CDDL HEADER START
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * The contents of this file are subject to the terms of the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Common Development and Distribution License (the "License").
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * You may not use this file except in compliance with the License.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * See the License for the specific language governing permissions
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * and limitations under the License.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * When distributing Covered Code, include this CDDL HEADER in each
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * If applicable, add the following below this CDDL HEADER, with the
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner]
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * CDDL HEADER END
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * See similar code to parse the nvlist in:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * uts/common/fs/xattr.c : xattr_file_write()
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross error = fgetattr(vp->v_fd, XATTR_VIEW_READWRITE, &nvl);
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Also get the readonly attrs, but don't fail.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross if (fgetattr(vp->v_fd, XATTR_VIEW_READONLY, &nvl) == 0) {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Validate the name and type of each attribute.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Log any unknown names and continue. This will
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * help if additional attributes are added later.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Verify nvlist type matches required type and view is OK
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross (attr_to_xattr_view(attr) == XATTR_VIEW_READONLY))
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * For OWNERSID/GROUPSID, just skip.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Retrieve data from nvpair
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross if (nvpair_value_uint64_array(pair, ×, &nelems)) {
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * If we have several similar optional attributes to
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * process then we should do it all together here so that
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * xoap and the requested bitmap can be set in one place.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * See similar code to build the nvlist in:
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * uts/common/fs/xattr.c : xattr_fill_nvlist()
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross xoptattr_t *xoap; /* Pointer to optional attributes */
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross if (nvlist_alloc(&nvl, NV_UNIQUE_NAME, KM_SLEEP))