usr/src/uts/common/fs/zfs/zfs_fuid.c
changeset 11935 538c866aaac6
parent 11574 42fda5f95dac
child 11963 061945695ce1
equal deleted inserted replaced
11934:fdae577692c4 11935:538c866aaac6
   387 }
   387 }
   388 
   388 
   389 void
   389 void
   390 zfs_fuid_map_ids(znode_t *zp, cred_t *cr, uid_t *uidp, uid_t *gidp)
   390 zfs_fuid_map_ids(znode_t *zp, cred_t *cr, uid_t *uidp, uid_t *gidp)
   391 {
   391 {
   392 	*uidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_phys->zp_uid,
   392 	uint64_t fuid, fgid;
   393 	    cr, ZFS_OWNER);
   393 	sa_bulk_attr_t bulk[2];
   394 	*gidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_phys->zp_gid,
   394 	int count = 0;
   395 	    cr, ZFS_GROUP);
   395 
       
   396 	if (IS_EPHEMERAL(zp->z_uid) || IS_EPHEMERAL(zp->z_gid)) {
       
   397 		SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zp->z_zfsvfs),
       
   398 		    NULL, &fuid, 8);
       
   399 		SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zp->z_zfsvfs),
       
   400 		    NULL, &fgid, 8);
       
   401 		VERIFY(0 == sa_bulk_lookup(zp->z_sa_hdl, bulk, count));
       
   402 	}
       
   403 	if (IS_EPHEMERAL(zp->z_uid))
       
   404 		*uidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_uid, cr, ZFS_OWNER);
       
   405 	else
       
   406 		*uidp = zp->z_uid;
       
   407 	if (IS_EPHEMERAL(zp->z_gid))
       
   408 		*gidp = zfs_fuid_map_id(zp->z_zfsvfs,
       
   409 		    zp->z_gid, cr, ZFS_GROUP);
       
   410 	else
       
   411 		*gidp = zp->z_gid;
   396 }
   412 }
   397 
   413 
   398 uid_t
   414 uid_t
   399 zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
   415 zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid,
   400     cred_t *cr, zfs_fuid_type_t type)
   416     cred_t *cr, zfs_fuid_type_t type)