Ńň i'dWc@sTdZddkZddklZddklZeiddeƒZ dei fd„ƒYZ ei e ƒZ e iZe e_de_e iZe e_e eife_e iZee_e ei eƒfe_e iZde_e fe_e iZde_e fe_dZdZdZdZdZdZdZd„Zd„Z dS(se vdevs.py - private interface to /usr/lib/libzfs.so to retreive vdev information from a given zpool. i˙˙˙˙N(tnvlistp(tNVLists/usr/lib/libzfs.sot use_errnotNotUsedcBseZRS((t__name__t __module__(((s ../vdevs.pyR+stsparest NVLIST_ARRAYtl2cachetchildrentis_logtUINT64tpathtSTRINGt vdev_treetNVLISTt whole_diskcCsßt|tƒo |f}nxť|D]ł}t|jo<|d }|d }d||f}t||t|ƒq$|itdƒdjo d}n|t}||itdƒdjf}|i |gƒi |ƒq$WdS( s traverse() - recursive function to update the vdev_dict as each vdev_tree is analyzed for children vdev_map - dictionary containing vdev mappings child_list - nvlist array of children from a vdev_tree nvlist vdev_label - vdev redundancy type to map the children to ttypeR tidR s%s-%ditlogsN(stypeR (sidR ( t isinstanceRtCHILDRENttraversetgettIS_LOGtNonetPATHt WHOLE_DISKt setdefaulttappend(tvdev_mapt child_listt vdev_labeltchildt child_typetchild_idR tentry((s ../vdevs.pyRNs      c Cs_tƒ}tƒ}|djo|Sz)t||ƒ}|djo|Szött|dƒtƒ}|t}x[|it gƒD]G}|t }||it dƒdjf}|i dgƒi |ƒq€Wx[|itgƒD]G} | t }|| it dƒdjf}|i dgƒi |ƒqŢWt||tdƒWdt|ƒXWdt|ƒX|S(s– _get_vdev_mapping() - private function to interface with libzfs.so for retrevial of vdev information pool - name of the zpool to access itsparetcachetnoneN(tdictt libzfs_initRt zpool_openRtzpool_get_configtFalset VDEV_TREERtSPARESRRRRtCACHERRt zpool_closet libzfs_fini( tpoolRtg_zfst zpool_handlet zpool_configtroot_vdev_treeR%R R$R&((s ../vdevs.pyt_get_vdev_mappingks2        (RR(RR(R R(R sUINT64(spathsSTRING(RR(RsUINT64(!t__doc__tctypestCtlibnvpair.cstructRt libnvpairRtCDLLtTruet_LIBZFSt StructureRtPOINTERtNotUsedpR)trestypeRt argstypesR*tc_char_ptargtypesR+R0R1R.R/RRRR-RRR7(((s ../vdevs.pyts<