Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4177825iog; Tue, 21 Jun 2022 13:50:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uvwGuByWtMkyR/GIsNjfsxhlE1N4DXqYFXP1NviFnsGB6E15Rr2gO9QqQYzG422g+KZBO4 X-Received: by 2002:a65:41ca:0:b0:408:aa25:5026 with SMTP id b10-20020a6541ca000000b00408aa255026mr27563800pgq.96.1655844608865; Tue, 21 Jun 2022 13:50:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655844608; cv=pass; d=google.com; s=arc-20160816; b=A72tB/0vmzcrF1Br6CaT9PahT0k6Dhxkb71ZhIxFeX9htUPM/6XC2UTLGLxmgGvBzC 2/5oz6cSX4iOuKsRSf1YFDzwbhR/OsVddz/FE+z6Fytrrqo4Mr/EntsD/38wY8FxZxqu KR3vxHJFa8qI+8SadxnK8so2Q2MkTc+2NyZ8ncMd423Ir3OE2weG0FtuNsGxvUXiJ211 oo+ydw021bSChREf/Ih+2arHVzxsjKOZrxzWsSKvtcwep1QgNlXSdID8ABEp0Jfd1tOt IkwCqW/QZaSG2NayHjUAEm9nf5xMRHw1f7ln5nCqik2VtxjQx124/iz5/J+lRVr/7Oe8 JhVA== 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=ia9oOscYOrLuwo+JA0rnvPsi53u/NyYT7SEg4b+WUU4=; b=nnSSlIuzJDJVmscO6WBXA9706tplt7QaACOOHWWFB/F6vataLguHOlsg4VWBy4IG1g B9IB6MDOrJYzurrCyuG28O4r4ZBk61A7IUKzeELxBfdOE8BAAjtzSipSejHfAkieZqE0 S3Bo8T9Yx34mLJKkhId1Lgm0c+nQPFeteEs6wDt9ZocjyQQ3loXSvSF10iHa4/9/9R9E xHeHOsMFY1prTwR7m4GGtZjucUhNHd5o3QV6QAISmSeNWgMCLWDknoHFhNIxTXCMFjRI PTKKsy+zvyQ9JqxLfaLqRFoymu7S3rgSIE93Lpzi50s6t6UvOvpRxD/8UyO+rih5RvfD Pkag== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=goaehf2b; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=V8d6V5Lr; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 u15-20020a170902a60f00b0016758d47029si3340334plq.518.2022.06.21.13.49.56; Tue, 21 Jun 2022 13:50:08 -0700 (PDT) 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=goaehf2b; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=V8d6V5Lr; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S1354509AbiFUUsx (ORCPT + 99 others); Tue, 21 Jun 2022 16:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354461AbiFUUsH (ORCPT ); Tue, 21 Jun 2022 16:48:07 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEB402EA3A for ; Tue, 21 Jun 2022 13:47:41 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25LJ5LR3018710; Tue, 21 Jun 2022 20:46:59 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=ia9oOscYOrLuwo+JA0rnvPsi53u/NyYT7SEg4b+WUU4=; b=goaehf2bVvi9CqpRzt2pDqaKkqeZPfULybDEI4llSpiuYVKWpxo/f4P0bcmOssU03zNP tHyW2s02h5RiXkVEfVDx6bEug9dLdTJyWlMC1n1VWfKRvQj2mpWBWe6tbPSj2iwC0zWn epaubapY0/c+hCap1rZ2dKUUkF+QYERIZbj36ToXZeEsDmlVSG6tEsgrpCTwLwsPP2Rf rNI4WA3Iiq9BqUadfFkKjPm0UzpR9fFg0RlH/EIIBzXVh4g8uPcyEB+PxYyQY5MlXqHJ teDj9NL/9NwLlBx8eFQkxYW0rGdOPd6sTRsB+424KDQiILw4vRBgebdF6Vo1Gp8MU6xZ 0w== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3gs6asxpvb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jun 2022 20:46:57 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 25LKeaMd010747; Tue, 21 Jun 2022 20:46:56 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com with ESMTP id 3gtg3vkgkk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jun 2022 20:46:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QxSYIWvYo/GJidys3DY0ubuIa8BKt7e5xYZjc45tNwG7Did/j4/O0b7GY5cHj+yun3liMeVUzmyxNlwiFiHvVSQ04e+zlqdsggbZCZOBEPMQJli1LpjFg1tOFOSMrm8/u60ZbdhHbQa30I1qFuQL1F7Y5z921RhIBQ7vL+7qMbqoIO/sZzE57WvRWKrQadF7UTSnOqVve6Rn5nfEOGq2kg0kWml1tuNalPc8lVlZY4sEJ/gVTYUqhuxsGj9fHFIgcVPf8O1w40kguQobysnMzRNPaG8xT8pZ5ME69L46zxGrFQjhfP7BBF2HeS4f8AHfvsAxnB4zQVrGIRQuU4x6ug== 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=ia9oOscYOrLuwo+JA0rnvPsi53u/NyYT7SEg4b+WUU4=; b=KyB1882YGWeY0ix9M7p5CCs8rALR9/xuqW6vcZnW0dmH9SvgeueobgEB+OKFeguGqctJTeXhy4xewo+bI7Hg9CZcOrdHwFUozMHkKUxUVRUqtoNKaRTpvz/wACekwypZigSlfDYt56ahWM2TY4o0JIBHQJSyPjGGun/lE3d7V1ZQuJ8r5lrr0EHtjNtInCXE1GLS2KUvKbUAML0rKHE+FfqRNzvV0O2OkaJ9GhKnebOmjSnLNthxOqiZrf2bONE0hQy3hBFblHq+UQ0JemL7KaBFG6P+syQtO815ESXaSQThkXorGVVJrJM5S9HKs0nvhKFajIrbQjKRq8w71/7nmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; 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=ia9oOscYOrLuwo+JA0rnvPsi53u/NyYT7SEg4b+WUU4=; b=V8d6V5Lrz5ZSZKDFBhb+AHETnNcmbXRraY8qkQWaZm3+Rtq5Y4DRR8c0nKoSJgPh62dSuR8j0CFX+/tk7j3MsGeiPZ1Ve88Thz9n2rNk6b3+5s58kMOrN2q4OEgpmyI06CkuHLy43U/NdNaYkfqx2ZQWTjeCa+hjGWsotl2r4y0= Received: from SN6PR10MB3022.namprd10.prod.outlook.com (2603:10b6:805:d8::25) by BL0PR10MB3074.namprd10.prod.outlook.com (2603:10b6:208:77::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Tue, 21 Jun 2022 20:46:48 +0000 Received: from SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::f59a:175d:d24:949c]) by SN6PR10MB3022.namprd10.prod.outlook.com ([fe80::f59a:175d:d24:949c%7]) with mapi id 15.20.5353.022; Tue, 21 Jun 2022 20:46:48 +0000 From: Liam Howlett To: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton , "damon @ lists . linux . dev" , SeongJae Park , David Hildenbrand Subject: [PATCH v10 01/69] Maple Tree: add new data structure Thread-Topic: [PATCH v10 01/69] Maple Tree: add new data structure Thread-Index: AQHYhbAGg+gpSQEsM0CkUMNXYLXH/g== Date: Tue, 21 Jun 2022 20:46:47 +0000 Message-ID: <20220621204632.3370049-2-Liam.Howlett@oracle.com> References: <20220621204632.3370049-1-Liam.Howlett@oracle.com> In-Reply-To: <20220621204632.3370049-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.35.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f4446941-e92d-4b75-b3bc-08da53c7290c x-ms-traffictypediagnostic: BL0PR10MB3074:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: czl+vkA7EnIwMjvIFLTWicfztyDL9tcjyD3cuBtUIOYUApuiOgnntugLIdmlz2aRHc3AU511SVVU2L71XAvvk+WiaiINVVjjwe1g1mD1LTTLyua7sLXCAJHxqlCmBMpsFOFrnEZaKpO43btG5IspehkeQUECdvcWTLvNvWQh8CfHmcjpBk/S1j3t4f004tWSoKoqzYr+AATOGNPvaK56F33sBIcSJr0c8ir+o608kCFhJmopGxBLammPYwi+Qi/PQLNRLSC6LziLSwblFKUc756yN69BLhWFQDQNNVKjfKyFgI3lXoKTo0IxMbXKMoL2osRXxeT1ytprOOyApFdz13pyXwnLiOAPuLoEZrdadYakahlAQ1PInCZfOVG1kCD0xUTomvBiyHBLLf5cZQBmk+OM35lETmWwKXP0y9x8ncfFmKKhzN3zte8RkI0E+OG59i9jF+FrEhy+ROJ0dFwDqGCv4lqd5lLZLSDVCrV8i3NkgWXIR6zWadRjpF6K2oOk8jU9cmDhIEl/Le31rZSKVVReea2zkOLorcD7fNtlHqLddgaH4EWiZ/6CVT0TlASkozjUwVV2NcmUuUDuICOk2hM3twjOq5OMaCnnUDVxaWSObTljXVxax9ZLRDatiDOdSYIaq9nUE3G5SnSrUoz/roWrYaBpaPhxztkJd43xKhxW5CwM21n34JPCgwu9nK6bTlmgZWCMtOVo8a0eSZK2WK7BvIoNIyvK3FV0Efv5yG40yaHcLvzlG/+nHpNvuh5gfOweR5293NzReTr05jc/lOG2C/dp3XHyh4oJ3QPCQvbhSpS14JznOxHfnI/2xuwi6rW9ZNtTprfIDWgNM/jMvFizkj83ITRvQMfvxhLm5og= 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:(13230016)(136003)(39860400002)(396003)(366004)(376002)(346002)(2616005)(186003)(6506007)(71200400001)(26005)(66476007)(8676002)(38070700005)(1076003)(41300700001)(86362001)(83380400001)(36756003)(2906002)(122000001)(6512007)(966005)(66946007)(478600001)(110136005)(30864003)(76116006)(8936002)(38100700002)(66556008)(64756008)(44832011)(91956017)(316002)(6486002)(66446008)(5660300002)(579004)(559001)(309714004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?WW95TFZOUTJ4Nk9ZNDJZek5lTHNieHNWN1podzhyZlFJd0J0ZUhOV0ZwUHNS?= =?utf-8?B?bWJCRmsvZkxqN0lPYjFjbWlBYUVpZkFOaEJYNGNOOXo2WFNEbithYzJzZ3Fz?= =?utf-8?B?ek82UFNLS2ZaZVE0V2lCRzRlS2tPRDh5dEJXMzAreU8vMGc2WlJuL3RtSmpW?= =?utf-8?B?Y01HNVNZYzJLV3lsTzFaSE5wbWNnZFdUNlBCMk1VVCs5aDk4NFUreFB4U2hX?= =?utf-8?B?SllBUGdGSWFLZG01SDBxUCtaU1dMQ0FYRTJxSTRaUENyM2pyZ0hmSzQ5ZE9t?= =?utf-8?B?T2ZVVTZCa0tTMjZkdjRPWStlcHVmN1FJN2ty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B?Q3kyS2lBUkIyTFNiNmhuVDdOdkQwUGhnOGZ3VGVRZ0wwZTRTWGpRVDVhVldu?= =?utf-8?B?RzBKVUZRQk9scG05Rk53bVN6RUc0UkorNDFjR3Z1YllpZUtsOG8rcktQV2o0?= =?utf-8?B?TVMrNktvdC9HUE5vOW96Q1B4ZlZwQnZFa2VpT0N4VlpNMWtqcXJsMVllaFdp?= =?utf-8?B?UjU3S2RhK1VJd21nNm5jL1FFZThhcEVIbmwxWFBUYkNjS3VLRzM5eVI2MGNW?= =?utf-8?Q?OP0zNdZYvF3TP1Po=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <7F557C0F62950D4DB72B6B181B4E0CE2@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: f4446941-e92d-4b75-b3bc-08da53c7290c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jun 2022 20:46:47.8017 (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: umYkUdXyPIvAO6HNgupVehrXuhK0UiqVXhY5ELA7SEWY4no9XuBkSHhKVwRm7dKp3SbiUWogIgjQKPYpzzvKTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR10MB3074 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.883 definitions=2022-06-21_09:2022-06-21,2022-06-21 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206210087 X-Proofpoint-ORIG-GUID: Bc8nH0mAlZm5TbmmHht8cLqIl2aygitb X-Proofpoint-GUID: Bc8nH0mAlZm5TbmmHht8cLqIl2aygitb 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_H2,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 RnJvbTogIkxpYW0gUi4gSG93bGV0dCIgPExpYW0uSG93bGV0dEBPcmFjbGUuY29tPg0KDQpQYXRj aCBzZXJpZXMgIkludHJvZHVjaW5nIHRoZSBNYXBsZSBUcmVlIi4NCg0KVGhlIG1hcGxlIHRyZWUg aXMgYW4gUkNVLXNhZmUgcmFuZ2UgYmFzZWQgQi10cmVlIGRlc2lnbmVkIHRvIHVzZSBtb2Rlcm4N CnByb2Nlc3NvciBjYWNoZSBlZmZpY2llbnRseS4gIFRoZXJlIGFyZSBhIG51bWJlciBvZiBwbGFj ZXMgaW4gdGhlIGtlcm5lbA0KdGhhdCBhIG5vbi1vdmVybGFwcGluZyByYW5nZS1iYXNlZCB0cmVl IHdvdWxkIGJlIGJlbmVmaWNpYWwsIGVzcGVjaWFsbHkNCm9uZSB3aXRoIGEgc2ltcGxlIGludGVy ZmFjZS4gIElmIHlvdSB1c2UgYW4gcmJ0cmVlIHdpdGggb3RoZXIgZGF0YQ0Kc3RydWN0dXJlcyB0 byBpbXByb3ZlIHBlcmZvcm1hbmNlIG9yIGFuIGludGVydmFsIHRyZWUgdG8gdHJhY2sNCm5vbi1v dmVybGFwcGluZyByYW5nZXMsIHRoZW4gdGhpcyBpcyBmb3IgeW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3VtZW50YXRpb24vY29y ZS1hcGkvaW5kZXgucnN0ICAgICAgICAgICAgICB8ICAgIDEgKw0KIERvY3VtZW50YXRpb24vY29y ZS1hcGkvbWFwbGVfdHJlZS5yc3QgICAgICAgICB8ICAyMTcgKw0KIE1BSU5UQUlORVJTICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgMTIgKw0KIGluY2x1ZGUvbGludXgvbWFw bGVfdHJlZS5oICAgICAgICAgICAgICAgICAgICB8ICA2ODUgKysNCiBpbmNsdWRlL3RyYWNlL2V2 ZW50cy9tYXBsZV90cmVlLmggICAgICAgICAgICAgfCAgMTIzICsNCiBpbml0L21haW4uYyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAyICsNCiBsaWIvS2NvbmZpZy5kZWJ1 ZyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgIDE1ICsNCiBsaWIvTWFrZWZpbGUgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfCAgICAzICstDQogbGliL21hcGxlX3RyZWUu YyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwgNzA0MSArKysrKysrKysrKysrKysrKw0K IHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS8uZ2l0aWdub3JlICAgICAgICAgICB8ICAgIDIgKw0K IHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS9nZW5lcmF0ZWQvYXV0b2NvbmYuaCB8ICAgIDEgKw0K IHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS9saW51eC9tYXBsZV90cmVlLmggICB8ICAgIDcgKw0K IHRvb2xzL3Rlc3RpbmcvcmFkaXgtdHJlZS9tYXBsZS5jICAgICAgICAgICAgICB8ICAgNTkgKw0K IC4uLi9yYWRpeC10cmVlL3RyYWNlL2V2ZW50cy9tYXBsZV90cmVlLmggICAgICB8ICAgIDUgKw0K IDE0IGZpbGVzIGNoYW5nZWQsIDgxNzIgaW5zZXJ0aW9ucygr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gIOKUrCAgIOKUrCAgICAg4pSsICAg IOKUrCAgICDilKwgICAg4pSsICAgIOKUrA0KKyAqICAgICAgICAgICDilIIgICDilIIgICDilIIg ICDilIIgICAgIOKUgiAgICDilIIgICAg4pSCICAgIOKUgiAgICDilJTilIAgSW1wbGllZCBtYXhp bXVtDQorICogICAgICAgICAgIOKUgiAgIOKUgiAgIOKUgiAgIOKUgiAgICAg4pSCICAgIOKUgiAg ICDilIIgICAg4pSU4pSAIFBpdm90IDE0DQorICogICAgICAgICAgIOKUgiAgIOKUgiAgIOKUgiAg IOKUgiAgICAg4pSCICAgIOKUgiAgICDilJTilIAgUGl2b3QgMTMNCisgKiAgICAgICAgICAg4pSC ICAg4pSCICAg4pSCICAg4pSCICAgICDilIIgICAg4pSU4pSAIFBpdm90IDEyDQorICogICAgICAg ICAgIOKUgiAgIOKUgiAgIOKUgiAgIOKUgiAgICAg4pSU4pSAIFBpdm90IDExDQorICogICAgICAg ICAgIOKUgiAgIOKUgiAgIOKUgiAgIOKUlOKUgCBQaXZvdCAyDQorICogICAgICAgICAgIOKUgiAg IOKUgiAgIOKUlOKUgCBQaXZvdCAxDQorICogICAgICAgICAgIOKUgiAgIOKUlOKUgCBQaXZvdCAw DQorICogICAgICAgICAgIOKUlOKUgCAgSW1wbGllZCBtaW5pbXVtDQorICoNCisgKiBTbG90IGNv bnRlbnRzOg0KKyAqICBJbnRlcm5hbCAobm9uLWxlYWYpIG5vZGVzIGNvbnRhaW4gcG9pbnRlcnMg dG8gb3RoZXIgbm9kZXMuDQorICogIExlYWYgbm9kZXMgY29udGFpbiBlbnRyaWVzLg0KKyAqDQor ICogVGhlIGxvY2F0aW9uIG9mIGludGVyZXN0IGlzIG9mdGVuIHJlZmVycmVkIHRvIGFzIGFuIG9m ZnNldC4gIEFsbCBvZmZzZXRzIGhhdmUNCisgKiBhIHNsb3QsIGJ1dCB0aGUgbGFzdCBvZmZzZXQg aGFzIGFuIGltcGxpZWQgcGl2b3QgZnJvbSB0aGU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