Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp205356pxb; Tue, 15 Feb 2022 11:26:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBgG2QUdTzhQQRS0M1qNqqXt7MPI5NWZmBckaqd7jd4sGc4g+B3nU0AuNK9oCEf799eg10 X-Received: by 2002:a05:6402:358e:: with SMTP id y14mr484745edc.136.1644953177773; Tue, 15 Feb 2022 11:26:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644953177; cv=pass; d=google.com; s=arc-20160816; b=rrr99g0Kg0mTBAyrJgBrlhiZxfa36L1Hq2WlWGtMREhEaqDSeGYOqwi+mGrDat5KQU ipIrh1guzsa75PJuAlvLc3vsvTofiRKkaFpBjhwy1q8n2wbH5oQabMmTXaKBwblBHhUx SB6ZwIUVSU2s+fRP44UDCtHPMEjrH9BbuxdhJaICO+maapA1/li72ZOCDTvAvm62E5fw Ljxelt1Hc5z0ecrNWiDESgTuRRg7nK2HFV3llAgPA0avGIO1GrEwbQ4L8s9Xck1mGK7S SLP/8tzP7+H/uVjDN8lkt3JTgqtCf8BWnnvkH2IXM3uUDymoXh3ibcSTpvl0UIj9pGbR POlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:to:from :dkim-signature:dkim-signature; bh=UtfODTA5hEUB3w0g5kfV/ge938jAfM1w8dzVsnedGbI=; b=Wlnjj72GMHEJKdJMG4sUfZJX9I6+aFU3Ad/S1Bk78Bob8vhhMK9B1Hxvmibwqjwu+1 TnsgwiLGlD/5rypMJedM75ZhAycAQqM8/MnxlLDccNfEsMTjMfvHKW/wRE992RTBjboX GJlnjE+S7Z8s4hNGIBc/+XKcKBLJ504w4y7jicgt79hFzi+hu5H1obu4pgoccyZ6Sh7N AnT+b/l0caeZYBRQjlBbDTnadrtDKYVbyFN5Nojwfvv1BWUWVd4JS4RroE5rqveIS9tE qwJx+ReTVJs3/71vsvhJbBAC4BpZPeEwMpzKAcS+pCqeoVujgKYa8OTOZ21kSq2xeceV FBkA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=EoXqDiwR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OqCj1rHN; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq18si1696165ejc.207.2022.02.15.11.25.50; Tue, 15 Feb 2022 11:26:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=EoXqDiwR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OqCj1rHN; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239031AbiBOOoh (ORCPT + 99 others); Tue, 15 Feb 2022 09:44:37 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238964AbiBOOnw (ORCPT ); Tue, 15 Feb 2022 09:43:52 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BF941029DA for ; Tue, 15 Feb 2022 06:43:28 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FD1S50007111; Tue, 15 Feb 2022 14:43:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-id : content-transfer-encoding : mime-version; s=corp-2021-07-09; bh=UtfODTA5hEUB3w0g5kfV/ge938jAfM1w8dzVsnedGbI=; b=EoXqDiwRBGfkJkYqFKXsfOQYC5U3dPsfObjuvkCrMLiTJOETJMAVPYnKvvZvvRR7F3MB esNQhsjIVqBAI663F4GGFNrS+DnZTJt0LE70fIHvdkFCjhUrp2GeY1P+tuz236KBYyuh 8oGNWdiJ6abMeAUsMPHmSnISeBdbIVYu1eqlhl5xMgftIyA2Ef1PWhqzrCsho22/l/XJ WK/otMb3uHm9wKfFE0ZDSJ3GuxSP3VhM3hRynLU41aWFNu5g97w1jLzX5unRqQ1xQbzO Sar5hsDBilU9r8ia7jsNH9VNYln7Si/gB/1w95Xi5c606WYJUjlKUbMViVP5Tn15S+Ah 2g== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3e884r97e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:11 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 21FEeVaP085748; Tue, 15 Feb 2022 14:43:10 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2107.outbound.protection.outlook.com [104.47.58.107]) by userp3020.oracle.com with ESMTP id 3e66bnpja7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 14:43:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mzPg6+/SkLcv1ukU/ac0cR1VhD1WQr6StxZcp4VzK90o7VYglVFNQJt8lod/ja8SgcI7n0Z8cGWKr4umpGcmwYFPgEUBfY5b5qB88EbmgkzPsyAXwPNp1ZrXGfD2Nq6g8IiJwJtCJAMeYbIvOWcwiy9I0Nn2KXEkjhb/EjZLJGD+M86O5Kr46oHnHmH9BGpYsvREtuLp5uVF78ZH2Dz5UFyw0UoHfwtEWGvLuFMGU6OlaORTTLmnWIXKnECnp520jQUjm/kUGZz84qTSehzoQFH/KyBCqyDFi9Ym6Zv0rbmgLkDSmJMS9GpDmvtYeIx+8uMkfdaqBycKtXJD72D60A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UtfODTA5hEUB3w0g5kfV/ge938jAfM1w8dzVsnedGbI=; b=GNNV0o2Ps6vxBePI8dlk2snTQocRpMZ+Ncy8pez/CWG/Wd/lCc4NpnjRjXRp7IFkmHrQTTKBH+dQvrBKPi4spxiPEJVknKbWXDst7cDb8gYMwGdgnu5NTpXwbE6lpSfNnaDh2zZndsoCSnurS0HkoLod0/DoGVCJTDLtGROYnlFPDPMGc9jD7A77W6xm/Pgral+uuJZNSDJKygXgIPx3YNKBSMbijeQnsOREQqx9v70AdPovzwsdsemGL0VmOS3jNmxyWdWZAE5a71VFlCujL5sust2QRsg3v0wPLTsCt238q4Af250lrgWdCmvUvDsUstTrHloNcJgWRl4YnaK+Mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UtfODTA5hEUB3w0g5kfV/ge938jAfM1w8dzVsnedGbI=; b=OqCj1rHNsWoNWtsf6SIgW/pwwEUMmXNr4rMeGyQDS1O83xsXqBbIoirOwSOXYJPKjACpP59iDi4ydJc0oME6tlOvDKzUQ5Z7plPwkfROVgxSqxzBo77ePO3SbCLfj6Z8cy6HyOG2tdDJ5fAnxl3joVWsdswjyTIhG+EwgCCCZkc= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by CY4PR1001MB2197.namprd10.prod.outlook.com (2603:10b6:910:48::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Tue, 15 Feb 2022 14:43:00 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::899e:951a:8129:8ef1%4]) with mapi id 15.20.4975.019; Tue, 15 Feb 2022 14:43:00 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: [PATCH v6 08/71] Maple Tree: Add new data structure Thread-Topic: [PATCH v6 08/71] Maple Tree: Add new data structure Thread-Index: AQHYInpU/hKtaWQ3X0yDuzeh55NMzw== Date: Tue, 15 Feb 2022 14:43:00 +0000 Message-ID: <20220215144241.3812052-8-Liam.Howlett@oracle.com> References: <20220215143728.3810954-1-Liam.Howlett@oracle.com> <20220215144241.3812052-1-Liam.Howlett@oracle.com> In-Reply-To: <20220215144241.3812052-1-Liam.Howlett@oracle.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.34.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8c62e88b-5c44-44a7-4071-08d9f09176f3 x-ms-traffictypediagnostic: CY4PR1001MB2197:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: stkJ1FyFOyZO0Xs3Czs5nFXLXmNWQylJnlwa+m4hCSXWd1laFUTyFEU1kNFpnxy8ZnFp19O1sehceU6Yla+Z123FBmt5v0DPr/unvi4uC4xry6ubAeP4RY+FBpU0u7/MbQY1lnmrKq2S8YKS8OiImwb4uWrF43NoprxmxyoYDBSYyoPD+IDG1TAKssxGu+wxy3sW8GsHCSbTcEtg7SZNLEImOmyUYsTgkgsGz7y5SbZi3QBkTfertwn17jtXAAeUyWbcDOyp+Tw2O8Fc+pI8TDctYGyjj6yOOIRwWw/LDjU3JTjT/CrEt49l+PvdC3PxN2YF19zabGSVKf3Ya9EFyTDh5r8m1Dby/OkPNLsq8Tsz2zt1QShrsUyVhTSnm69Hhnai2HYVhNWQ9YVxCavF3WEwWZOlxkmNckI1VCIrFMS9Voimb1LmbxBfIMqUw2rSzL25LRMQge52RXf6rgmtxtYpmL6vS8/NM7S4eRIYyoDm5NFMIxft87pDq2vPazCTOS9NTrqPI5IF/0vafSt9zqymxgtBd9gDm2vUF+BWoR8/qu0LqaTGHmGOvTqaWAuxfxIJC3PpO5aR1wqn+asvVOvFzqcbid0z2CS+p2ghC8v7yC2o/kR2blr0A7IpSCniLET4yHCbqW6X3dSlL0FnHQGXrmhav/FWi2auh/4CtLfzBVssJr7BK0L0ZsSPhE5oBzHlYoiYpc2OdJe32XiRgodEmwG8PwEPT0IzQZ0/cPNMtUAEbQgl63iP6sNmypEpHQ2Q7gji08VVmGp0Dhthg2dalHynEkuz0kLH5/5Dw5aUfGK1LWf7VitChHkwb6/o x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR10MB3022.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(316002)(186003)(66946007)(91956017)(6506007)(966005)(1076003)(508600001)(36756003)(64756008)(66446008)(8676002)(66476007)(2616005)(76116006)(110136005)(66556008)(6486002)(5660300002)(6512007)(2906002)(86362001)(83380400001)(26005)(38070700005)(71200400001)(38100700002)(122000001)(30864003)(8936002)(44832011)(559001)(579004)(309714004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?eEt1NDgwWnZ6LzlyMUptc1c5bjBqc2dOOVgva3dNWEx5ejBqWHNVNVVIVmxF?= =?utf-8?B?MWVuSUNBWkt3bVhDQWRZYWtZSGx3dFBUSjNzVU40OCs3aE5zTzE3ODN4VGxj?= =?utf-8?B?MmRDTUlVTFZ3UHYzWTFQV0E5eFgxL3ZKVzFaTzJUd1MraXA0NXF2TWVJVGJq?= =?utf-8?B?UDFTL0IrM0ZwSThpYTlIYTRjMktMa3NqOCs3cTN4RUs1Q0ZpNGpIc2xMZHFG?= =?utf-8?B?U1YwQUNtalhxVy8vSWVUbHBxcHZ5UUhSTmZiZjZla2MrRUxCV2ZLT0ltWGJT?= =?utf-8?B?VUpWZHordFNtdndFdENTeE0rSkRBOGFZQ0RKVFdZUmtiNmFRQ3RZMVdITUFF?= =?utf-8?B?OGY1UXJ5TE52SE5IZHNNZ3ZMWjZaS3JVNkFLaHowVlpndHB6QjZrR3I5MC82?= =?utf-8?B?ZStUUHo0N1lrVDhZL2FITGsxRCtwWWhnUjJKcDRlZHVrVDRSaXhpYUZJWFYr?= =?utf-8?B?WjU2S3V0UnVBSUJjOEt4OXhrZnRCbUxObkxCYmxEZzgrdXhqWEtsSHRQMmpB?= =?utf-8?B?QWpGck1QNVc5dGNiOHppUzF0NThmWGxlWDdJTkQ3Y0tCVVBOZmlId09zb0Vz?= =?utf-8?B?NXhRNDBTaG8v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-8?B?YlVYQUI3TXRWV1ZkMkwvVHYyYzk4QXJXYjlYT0N4Mm1NZXNjOWZXek1BUDdn?= =?utf-8?B?T3R3UG16RVRxN2hFeGVabGU3Yi96Z1pLSXNjdmJIY2VDRmlrZEo4enVnakxL?= =?utf-8?B?TUNmSHBjb09ROEEzYnZhU3ptSDliVnY2eW8wZ1o5MG44ME4xMTlLTXk3ZHg1?= =?utf-8?B?MFdxbFdySGQ1Qk9GS2FZMTRwZWlSY0x1UFhGV2FzOTdOM1d3Rk9WT0grNGJw?= =?utf-8?B?cWt6ek1iK1BRQnJyUUtqUWpFMklyT1JYZC8zOWdZVE9ublkzMldUV0xzTEpq?= =?utf-8?B?bUR1ZXRQRVRDUEhVSm5TMDYzMEFVNHpIMnlFb1Jmb0tnaTBrK3NFZ2VIQzUw?= =?utf-8?B?dzFLVW1CeEVrVS9TKzQ5YXlFL2hrOFhaWkxHQXR0ODAxN0p2RmtvNm1INk9m?= =?utf-8?B?cERRNWJNNUhTL04wb2Rrc1FNb2VhdUFmQXJyVWJmRGgwd0plcE5aRDdlU0h6?= =?utf-8?B?SEZuWlZNcEJwWFI1QXZYdFd5cnFqWWo5Vjl1R0hwZWtucUJSaStIbHl6Rldi?= =?utf-8?B?QlpEZjlUaW9JbG9LZ2txUXQzMldGejZvdTUrMmFVeWx6YW1hNzRHSmdoTk9I?= =?utf-8?B?TG83NlhxTGJHb1lPM1hOZVhvdlFxdTJSdjgyN1V5TkhpSkQyVE94WGJyY21U?= =?utf-8?Q?DBHfAHhdWX7jICjnulwVQl4=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <9CDBE016E3258645B256EF2B6F731F93@namprd10.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR10MB3022.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c62e88b-5c44-44a7-4071-08d9f09176f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2022 14:43:00.3869 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qOor8dfNr2tcKZb6g+DXcJiJZjyFu0WB5U2AKdR8hdRglIj42msI8rR5awsB3JHE5m4w/rCVjJbg3C/bZVTmiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1001MB2197 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10258 signatures=673431 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 spamscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150085 X-Proofpoint-GUID: jwiO_ifWhEha-1hbU2Idy5DzY6Xgz8yQ X-Proofpoint-ORIG-GUID: jwiO_ifWhEha-1hbU2Idy5DzY6Xgz8yQ X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RnJvbTogIkxpYW0gUi4gSG93bGV0dCIgPExpYW0uSG93bGV0dEBPcmFjbGUuY29tPg0KDQpUaGUg bWFwbGUgdHJlZSBpcyBhbiBSQ1Utc2FmZSByYW5nZSBiYXNlZCBCLXRyZWUgZGVzaWduZWQgdG8g dXNl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B0aGUgcHJldmlv dXMgYW5kIG5leHQgVk1BIGR1cmluZyBtYW55IHRyZWUgYWx0ZXJhdGlvbnMuDQoNClNpZ25lZC1v ZmYtYnk6IE1hdHRoZXcgV2lsY294IChPcmFjbGUpIDx3aWxseUBpbmZyYWRlYWQub3JnPg0KU2ln bmVkLW9mZi1ieTogTGlhbSBSLiBIb3dsZXR0IDxMaWFtLkhvd2xldHRAb3JhY2xlLmNvbT4NClRl c3RlZC1ieTogRGF2aWQgSG93ZWxscyA8ZGhvd2VsbHNAcmVkaGF0LmNvbT4NCi0tLQ0KIERvY3Vt ZW50YXRpb24vY29yZS1hcGkvaW5kZXgucnN0ICAgICAgICAgICAgICB8ICAgIDEgKw0KIERvY3Vt ZW50YXRpb24vY29yZS1hcGkvbWFwbGVfdHJlZS5yc3QgICAgICAgICB8ICAyMTggKw0KIE1BSU5U QUlORVJTICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgMTIgKw0KIGluY2x1 ZGUvbGludXgvbWFwbGVfdHJlZS5oICAgICAgICAgICAgICAgICAgICB8ICA2ODMgKysNCiBpbmNs dWRlL3RyYWNlL2V2ZW50cy9tYXBsZV90cmVlLmggICAgICAgICAgICAgfCAgMTIzICsNCiBpbml0 L21haW4uYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAyICsNCiBsaWIv S2NvbmZpZy5kZWJ1ZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgIDE2ICsNCiBsaWIv TWFrZWZpbGUgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAzICstDQogbGli L21hcGxlX3RyZWUuYyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNjk2NyArKysrKysr KysrKysrKysrKw0KIHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS8uZ2l0aWdub3JlICAgICAgICAg ICB8ICAgIDIgKw0KIHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS9NYW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W11bQ0KKyAq ICAgICAgICAgICDilIIgICDilIIgICDilIIgICDilIIgICAgIOKUgiAgICDilIIgICAg4pSCICAg IOKUlOKUgCBQaXZvdCAxNA0KKyAqICAgICAgICAgICDilIIgICDilIIgICDilIIgICDilIIgICAg IOKUgiAgICDilIIgICAg4pSU4pSAIFBpdm90IDEzDQorICogICAgICAgICAgIOKUgiAgIOKUgiAg IOKUgiAgIOKUgiAgICAg4pSCICAgIOKUlOKUgCBQaXZvdCAxMg0KKyAqICAgICAgICAgICDilIIg ICDilIIgICDilIIgICDilIIgICAgIOKUlOKUgCBQaXZvdCAxMQ0KKyAqICAgICAgICAgICDilIIg ICDilIIgICDilIIgICDilJTilIAgUGl2b3QgMg0KKyAqICAgICAgICAgICDilIIgICDilIIgICDi lJTilIAgUGl2b3QgMQ0KKyAqICAgICAgICAgICDilIIgICDilJTilIAgUGl2b3QgMA0KKyAqICAg ICAgICAgICDilJTilIAgIEltcGxpZWQgbWluaW11bQ0KKyAqDQorICogU2xvdCBjb250ZW50czoN CisgKiAgSW50ZXJuYWwgKG5vbi1sZWFmKSBub2RlcyBjb250YWluIHBvaW50ZXJzIHRvIG90aGVy IG5vZGVzLg0KKyAqICBMZWFmIG5vZGVzIGNvbnRhaW4gZW50cmllcy4NCisgKg0KKyAqIFRoZSBs b2NhdGlvbiBvZiBpbnRlcmVzdCBpcyBvZnRlbiByZWZlcnJlZCB0byBhcyBhbiBvZmZzZXQuICBB bGwgb2Zmc2V0cyBoYXZlDQorICogYSBzbG90LCBidXQgdGhlIGxhc3Qgb2Zmc2V0IGhhcyBhbiBp bXBsaWVkIHBpdm90IGZyb20gdGhlIG5vZGUgYWJvdmUgKG9yDQorICogVUlOVF9NQVggZm9yIHRo ZSByb290IG5vZGUuDQorICoNCisgKiBSYW5nZXMgY29tcGxpY2F0ZSBjZXJ0YWluIHdyaXRlIGFj dGl2aXRpZXMuICBXaGVuIG1vZGlmeWluZyBhbnkgb2YNCisgKiB0aGUgQi10cmVlIHZh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