From patchwork Mon Dec 19 10:20:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2880EC4332F for ; Mon, 19 Dec 2022 10:35:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHP-0003L5-GW; Mon, 19 Dec 2022 05:21:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGf-0003Ad-9V for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGa-0007Nh-HJ for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:08 -0500 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJA0m7P003812; Mon, 19 Dec 2022 10:20:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=3J2NROZnClrvuX5c5BEezlgW8s+8HRmDzv9cpo+LHXE=; b=TWuxxvnwCzYLMsDojYpQhsFVoJK6SDsaT1NtvEPgZ7oGlZ4PMC0/KQWvmZYsWIPo+Tr1 A+I8x30R4TFs6auJJ3y0v3FuzwuOiB5naRoKsdM3JjWG5D96I7IudTUdwpWjGa1Il/E1 0PljYdC3W+z8pGe5ee/fHOlFYhQCobYgK84vWq5UtJwlrDNxR+35zinJo4CajGpXr4dP jYG7IisNuTFe8Qi7QxZzi7kL/Bt8uAzEqkzhRsrqOwpGOU3XN1HLcazWskruzsR74J+4 Z8aAD2dv7Fh37qwF1EhMvJBEs/0Izgc1g525yvUnVl/Kimv5XNCaQQmeDph+DuFOdCty EQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh301hdgm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:20:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b3QDYyHGT8XP8Y//iauGY1TxjB/wKyKEY0mXo+VbzjJnWtsjta6CwfKNY2ZFjZC9fq2Fyboz3f59Bf843uWI1I6CQWSdMiSB5P+BcfSHv1sKivaJTPjgipVmKw/ppEH/eeCuEayDjcW2WFqp3EWwf7TjJvPFbEU0XoiVxZRwlGuMdXl5wfy/LF/SRzg9QYhyyotH97BvXgRAs/3BAq1F4FWwQO7GN5/pphKmKhTiHcaAVuNcaH/OOtKi6/bui4UINeuANav/lly1o1s0RzN1NbW7A6iPsRLdHc4EEvaMFlmpOrRHSP0kFe6vkpRzMlzwL6Y9tDGmY/yno8AELIC+Sw== 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=3J2NROZnClrvuX5c5BEezlgW8s+8HRmDzv9cpo+LHXE=; b=L6eJ3YKNotJBPxJ4LnMUSLO2Ttv2gKwAmR7Z0rzM7Gcu0gDMMT0XVy9nGxpdpHj87JtkR67C4wE0B8Ty0hl5nDRlCokCrTJvKEOlZVa5jrVbGRCAG4CBeyz9gcm0ZBY0TEYqBnXDXQCY0yCkGyeL2HTbnwT9OpvQisYOkRKjqeRss23JcVwgJPYARryEyyVjU8575syVGln9bvsSbFRmr7isnd6LSnJ2a1dVfqc7rsGmNlo8MCql3O5jbqSA65D34XZs79uB/z1YORmJLuOpDbHlVejQFDzAvu3IJDOisa+dal9iO7rDtFt4RvyRg4D3813FAAmZyyS2SWuvUMJVWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:46 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:46 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Will Cohen Subject: [PATCH v3 01/17] qemu/xattr.h: Exclude for Windows Date: Mon, 19 Dec 2022 18:20:05 +0800 Message-Id: <20221219102022.2167736-2-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e128311-314d-4c1a-bcfb-08dae1aab17e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 59wDUlhYi4CVIKr97v19SHfKAX6XI2KupiaxhpH7FDMdF7Fn2NN6nFzJWBzSvshaHqyl6+K0Swq1LrZL7omnUREkimErPouChH1RSHYlKGbfSo8rtvagll0QdjRhEDPzu2k42ijzPeyed96oQ431X8XqxCJ5a7DLTXYU3BVYk7Zv6ayZGDAJCDAwM8hQTSpgNAWOX3QzgkSzYFtutZaEwJHR8F8z/yzHupv2oWhkpNbnOkUZS8g5P7mopk/cdJnAAN7WFgFdvFHGVFDuUCOcT6J1UqoBGCQU93cU4Tt0/gNpREDRWvZvVBp29uqSfjRNZI+w7m7bScgY8y6gYwfnqvJBZ7FNYNNgARPyC2dsz654nHjYwwbkAsiQ20sPDYPoifKK7gKhF8Pnte43YFF92IUGebbTOIDCDCu+ztdmyqr/wL3J60W3yIB2DJblEEXHeoLamsVyUjCL7e01Z/sc1K9D4DZL1Q3pZ/3N6YTGjuyLmW4RKRSiDHKL+LHAu2e50f3tqmE2g3cd5Ag934VjU+Gm2em78qcOq1bjTfmvn5BDNTjuYM2E0CMUQqiPdxugvsSdhhwBVBrcGTb4r+dR/i48vc774wL2tQIkn7CgKKnYtwOoCglpcQq1edC+1dR+73/TxGM28dENdTnnZwAKuoKHfyctakTMXaHOLxY3jlbyhQPEwMWVEWSbQxb0KR4rGiRgm74Xm7Qvq6TLtLOgaQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(8936002)(4744005)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(54906003)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: R0Rv2/Wfex3fg7LHneig8YlJNf/4RnHfCTX8+mjq3Y/k84+8MbOUOMkGrZJuYm2w843BFJ4b91fd64m2HU4vV6S7ooDynievX+eQgno15Gdgt4DMSmVaS19i0NoQgllxUoX3hXniDAHT+ztECu7KdiQ1tDkz/y4oF0MKRlrDNzBKkSNDN7fJp0h4OMR56wc1tNE1sbI0F6q5IU8Rx0YG/MbvvVrsoYfrFQl3tOQa0Sd319ov/vZmC68R5BLLyqwAWJ3Ehi2B1uy7IerTH9rcjUnKYjmzdnWGa9hEA3xaP2c0Mvk2lGND99NenEkNcPPu+f82e/nIpGFHm0G8cDMp968sJezsLn7oJVksz7FN3Ih7n9914KX+XxbHnZZWQKwlMb7dinlPbnuhrglFnpNQi81Ny+dhKiEeb1ZR8TN2qlQuRnBESgze8741JWyPIp1fkRzOlXqG8rhPL83FaUvnByXqY77QAKwIMQ9Vv97kiz54Vl/pQ+rdIMRixtmbiaINpQQkizP5zUXOE16ccjRlQ6jfG1Rs1pIHfEykGXVUzz2ZZr5QJB5ai1fb+YuwTwt0IUV1Agbmjtq4yoKP1NvD+vJ/4WwGr+sUoDXeaOa61N7utzyAKWzGdGRX6XjIV9ZAaUgkpCmg1dKz3wqOrH1+j2IWGGDiPlLf4oiefhtnJtmOUni8RvHIf8fN6Wlm74STuBMu1+ScKgLmvyi/jzlSQKEnSqPrx4k8NWgBpX2LOGWP2Z0gVfJ6yjVOGI0tyTGW0hQ8U3oIX0yMCVHRVsnfo25v/F4gnSDtyN4tcdmKM4y+fwbJhKZIAY8KS/AOxjN7rM6KwrZF96GpG7U53lbl3brEIQLwM0Xq/kkqn8M0bd9PdGszKZNQLOnWDbbN0tpNCxLFk9f88+ifdjxJSkUju7M0jHeBW34wJN06MFgGD6g0ZJVfjQS/TSlUf79OUdT04NGtu3oPaTChpvSFxFFaC2+/I5uyr3f40wdZrcYXxV4e09QEzDAeWOE9ndTyMdtB16+puN6btSzcLFlD7SQaysEV0L1SnkcbwOiML0TLyT5il+/SBcrLMFjUJG/GOB8Ap1cSC3Eszi3LG5zZmxeOLGiQNhO/845g32V+ZxpRRnpWrAMJc3ieDsmJpovntD7qwaoitdxlo9zPTqrFL0v4uhs5LHyaNGXXxgmmyeOILOkgIbNvANuoOb4sGcHC/PXQJPpsTOnofDnF+7btMIVrpl/cvIvH5GZnDJh+Ow14dQvQXl8dQiJuVcD4g1U9GbKgCcvHbZ+RC8AKwfIB2OUVO7cKjwFxmCBiw41pzaRXvgRdON3bZuUHilTjetnV/j2LEplYkPjbyh46LWIbyFT3nS7PXamGJ06d6Ez4r2Une2MWOM4DVzbZlTc5nQ4erewHcbQOsMDBOFdYlnt+0qWNc0l3rbqv64fdjETrydn1AAO530tzMfOv6tgSmY4IfQos+bD5Zv1ElMoCKPdliEPu2QvHr7mnOmu0IBLZ1LN/p8tFCIy7mxXYLE2vtFvaYt3V8YUSp7Zk6JcXLq6ZEDgmEvKRVPzZoMIJNEyCZ3IfUqOXE5MoQx263E5Y5cCqJNvSjzOzJVi7pSaUkMi2wm3GpQ== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e128311-314d-4c1a-bcfb-08dae1aab17e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:46.8360 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 03vPqkrrOSi0xFKJiRfWVxFS6bllS1x5MHYUQT34Z3u3jV4qM8EQQVenxBu0LNP2+fWKRsEkiqbBW9XuAlUDxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-ORIG-GUID: a_Embh3W71v1dyNB6qBa4aDQhfOLCnrq X-Proofpoint-GUID: a_Embh3W71v1dyNB6qBa4aDQhfOLCnrq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=679 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Windows does not have . Signed-off-by: Bin Meng --- (no changes since v1) include/qemu/xattr.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/qemu/xattr.h b/include/qemu/xattr.h index f1d0f7be74..b08a934acc 100644 --- a/include/qemu/xattr.h +++ b/include/qemu/xattr.h @@ -25,7 +25,9 @@ # if !defined(ENOATTR) # define ENOATTR ENODATA # endif -# include +# ifndef CONFIG_WIN32 +# include +# endif #endif #endif From patchwork Mon Dec 19 10:20:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B133AC4167B for ; Mon, 19 Dec 2022 10:23:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHB-0003Fo-IC; Mon, 19 Dec 2022 05:21:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGh-0003Ak-4L for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGa-0007N0-Uh for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:10 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ8ll8t020840; Mon, 19 Dec 2022 10:20:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=iwQ0R/yWlmKEf7imNX6mBrEsuYMI1SqX+GjLYpCPnWQ=; b=Hwg8lA5Klk1FLHi7UdxqOVsxtpIimu5nkOO91EW04ZBAZJk6kSmeGJNQLZcQ36sm0atv uFtLofidMKA2pEMD3vT/n7bwytNREbGOn0RFEIq3B7dByP61OcwpuLh29ul3a4ImhhNZ LVk34Tfldti/oYZL6FfqLcke4/MYWdqvPx09xVxoskMD9JOijINtR8xWwdsDAaFlkZxO XgPiMQbHWcnD45kwEZtwCGD0qh12RGizNpbCuWGdwKf33H77ZhUSeHm9AdMBr/JmRxQq OztAUPx9WevRgbilIRqPjjtdzzto5MyT4DNsnVqYBFDlWOjczQ4RYi7ReqjErd6panAD Jg== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2173.outbound.protection.outlook.com [104.47.55.173]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b74-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:20:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KsEJyStlrv9Y1+hoBc+e21txdlDAxwTCoEmda/2bEhTc5W0/gl8yyhJ2IpHuV2FzG5oC8E0Sd67P+SV4xXKJXlmyOlDhh3IxFiWBWYaKIxr2oeqpUYw0DlsebRbxq1XbeNHyR/nml0vn1PibKfjWS7ap4LaXgnO6ka8nUvU8EeaMdB/ZojodNFh10HGnZutk/JMZ48abZ9ywvT7i7gwVdFxbFeXgvlCpO44A2QZpAppt27d7BAFj6C+0liClNJbjIYn8l6m91n8U005mJx3+XtfDb23/UyJlG8o1SMKG+kIu4g4iLWOzi8754KPKJ3GN35gSLGhx/E7Rf4IHP+Y87A== 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=iwQ0R/yWlmKEf7imNX6mBrEsuYMI1SqX+GjLYpCPnWQ=; b=iLSATNI0Q0sTwJ7g6CpwrznCK4FyEHnU2YS/j+8pQ0mwx0UtuixhnBZ6MRYicA+j2lmcwGt8ujfuhpvzJIP+Qk6B57AuJGDmkKWHj+1BgwFR7eDqmQ2mJro1qJ8KI81+NpzQFxYm8Il6e3z30xIYCaKrRGt11olVVvWdGv2wKOSvcJLmcbEp827yJzleAcKInfMqFD47Mtm5YQi9RPo+ugHAEk8MqkSaV06gMlImpRc2YxyaG01ylQFqzvpMw3L4rTGhtibx21SKoh3emg1P1UAKQNye1gT0NYqAxvUN9rmBkZQdRvtNsAPadaiqxziknTfagjCBA5QvLHf9Cl5YmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:48 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:48 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Subject: [PATCH v3 02/17] hw/9pfs: Drop unnecessary *xattr wrapper API declarations Date: Mon, 19 Dec 2022 18:20:06 +0800 Message-Id: <20221219102022.2167736-3-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a42f6a9-569e-4933-4d32-08dae1aab2ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8JmU3Yhuc3SnUPSRH889DBWzRDne/SDnOKpDj7UZNu4khbClrCNlRJK0/taWdiSJ6UBA7Mxwz8tWKUzibuAUSS38mWh12d740r1uetyTzS+jgKmZDsoV6fvc9UuJIIaBl0jbORUuz1wsD5RCs+DvvMSiMpmNZxOdehVRa/QF6znmccxN1hSv5JKnUnfElommoj3cuHIsOFI7BIEyez+NMrvBK4zE25Go1FqnseXwJAnkvfd5TM0n+9JgFE0CGg1f8ILycnW9YT3JJ33k/wv7xogTRiH48kQMMoFBTi4A6rY8dITikS00oYN2g7zsNRVrZjCzg/H0rt4Z23AEQiHih20AUAhxH/fW6khLfbNdxnO0Hk/I/qQVtL4qfCUJhUlSYLKsmFbR45qYeaOGxIeCtgp0sdf0kFzRRQKUo/jnks8f2rzZdfHuoeAOsofriqv3CBm//ca4YCGtikIEyOWVuLIpQwKduhl1cgzS6uS9fS8FwlS5q3Jg08zMnnzQ+ItoHSICcwEjTqAiZgVGhDFxC98dRy3n0g5sNfDfSjkrnUnF9YLD/HW31JbDr20xttJFqqOXWKMMh7bbAU/k+znpPqU0C+FP8P5zE066wZHg5vv5QJtyEXhJyp5gNqpAN/QGWTY8i7ROdksu8c4sfa7QXlhufeu2vuFdxpn2SxQ5qwzxrkkREdevOOoxiefAPgGkhxMM5hLAnO+FDzw9QGp/Bw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5bITlT081/nzDiNbEcDb4IaAh8po2SqAGCjEfLtcg8GLTeXnZN9G6xgnSBY9OKe/CkAKY3jLhwW03Fk+KH1+vqgyT4o3yxrT0ptoJMbx4ENmMqsQlMIdchdYbvViJVbikZ6eYpCTKgQid19bFJPLWnmwORI/5YReltxgMzlXfcbz0e7gx33WaVi9NJHtb7X278tCYFYkF/u9uu9U8c+VE6RSGKr08MMcI0SHvctq5SKD1doIRdU8qsM92rA1IwCswDyRs784xvoz5rHJ9fiMm5o+pwxBVWrRp9abpf654GO2mu6z00uuforUxzU1onvqkJqHCRo1YgL4xrVVw8y2Eme9lGv2CpPtUt3+8usEJiaYLggQ5hQIiaKjmwLoectMGwjP439yrxJJqpYhtK34JWyuRT4MfXMGS7+l/yNACk5XCj4ZkORKLoDkB2gsoGbRshDTQH8+/Z66WMyniBgy+RJR9QIutOI9FhgiTD4weqRgfFehxI1omAY4Qcu71aI0my7o/nlWncr+PQ+QJqefNcGo2WiNK5FZBamXJ+DV9xH0PWQjvPFNo/4Sz98nNNjMhaDNUyeKbA5n1cr2b6ju8AEMUcV9Pth8L3WULP+iDSyucmhJGqY3+GeU8BtFM1HXTL+AMr5dB41I2jP/laxuPar0QCIymCI6CLoD4T1WccjmPRB13kvg30TxkTw8jqM9tH2HGrdt2Gd3l+pOKB0BIVIg/WQDRzKT9Q4HpSU8I2+mwc/S0toBLxrEg7jP2oiotFvdHCJXkqeeq8miQdZdYoXkyA0MffyUFp9TO2qCllYsRHmzkNbE/QUSlDmoonJIWXg8va0BtGkdnSOSV/RPXzZFwC3yC8RaJb4JDg61y7OUitxB79y0g/XeBuex8mYY6U07mV4J7rVHzHhkcokvSUk56BsjuBE5kN90tBukBq/ZmBCj8rpUHqdq18GQyNNahmApsWhWGO50BMFO+qZk2qecte/WtCnzrZGh19UcK0Yk1nZpNQJh9bWjtSdMHKTcn6EF5tfmh71Z0uXIqu9FdbfXq5Dw3MHYw2daiEXQq7s1mbQEOnsybi0aWdZypGrYwd91qoA6oH7TC1TLlhJaKgcw0NuCUU2NIibF0M7wTUUEVdq0Nyct7SK+0K+fnrBxdgOqf7Cw9yAet+mUubJgEWreKAtVW+TYruOFXIn8+CoUC+Y3u8Y88YM/dCWUPEo94H2JFL5xcuO1rFWs/7oYQgjKVctTGRGwKbgZ/ZKRyRhs7ONQcihkPfL1Ii/cVLEaw6aQOEczo0yrFYUrbye/hMM476gUz5v4X2328zKPan9r/lgf7+78rdP6xAGnMGZNfogI5uqs8sCAlqPIKASH/cF3wGZLfkQp2O1PGVXOl1gnmZHhdMIL0Fabpyhe+C/D8+MJ35fGzQUgPAZ7noSTssKxNGRhRax1t+qeelrTecKzYUDaj9DxS51VPJC1GZfGv7TBj9Hbm+kuWIWPKctdzmsLeAtyvBGUrtOM257/YjVBY5cjV5nIn93P/9Zy5VRWZCLf4+QRUYBRA+csZ41TbfiAjp+rqcabyHR/ZpUNXOerNrbTdgU9KYBZrR2j7Nu4aIxJG8hTichmb8TvCwuquQ== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a42f6a9-569e-4933-4d32-08dae1aab2ab X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:48.7744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2/xZpgQ/Jzj2zZQKa2Me9kJHi76aXFenKoLzjR1qRYsbTerAcJhxlDyqRQeHJefGaYQQMtVAFKDMSDwb8+FAUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: YhDuYg8R8nF0pitj2oKezhkd7qYjbLxd X-Proofpoint-ORIG-GUID: YhDuYg8R8nF0pitj2oKezhkd7qYjbLxd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=910 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org These are not used anywhere in the source tree. Drop them. Signed-off-by: Bin Meng Reviewed-by: Greg Kurz --- (no changes since v1) hw/9pfs/9p-util.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c3526144c9..ccfc8b1cb3 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -90,19 +90,8 @@ static inline int errno_to_dotl(int err) { #ifdef CONFIG_DARWIN #define qemu_fgetxattr(...) fgetxattr(__VA_ARGS__, 0, 0) -#define qemu_lgetxattr(...) getxattr(__VA_ARGS__, 0, XATTR_NOFOLLOW) -#define qemu_llistxattr(...) listxattr(__VA_ARGS__, XATTR_NOFOLLOW) -#define qemu_lremovexattr(...) removexattr(__VA_ARGS__, XATTR_NOFOLLOW) -static inline int qemu_lsetxattr(const char *path, const char *name, - const void *value, size_t size, int flags) { - return setxattr(path, name, value, size, 0, flags | XATTR_NOFOLLOW); -} #else #define qemu_fgetxattr fgetxattr -#define qemu_lgetxattr lgetxattr -#define qemu_llistxattr llistxattr -#define qemu_lremovexattr lremovexattr -#define qemu_lsetxattr lsetxattr #endif static inline void close_preserve_errno(int fd) From patchwork Mon Dec 19 10:20:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2132BC4167B for ; Mon, 19 Dec 2022 10:31:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHG-0003JS-PS; Mon, 19 Dec 2022 05:21:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGh-0003Am-4t for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGc-0007Pu-NI for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:10 -0500 Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9StvV005147; Mon, 19 Dec 2022 02:20:52 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=p4PqmM8VRzaiQongGzltUo2mhDuqdEHEEZ/RVds/fAE=; b=jZpv1XxZCHUIExjN23f/LrEVmjujKWH+1E2kDSlKx68ywZSI6qg/Z0N9k35VRljraaN8 7yY6Zk0+iN/KUCf3PPkb59l/mPTCPeenaW5xzzzjboNFRn75cqdHVUfLxLmACqHAD8oK 4kMXERrBwjj+QzyNg9uLiLpS+9pODRV9DHTlzYNuwgp0i17VvL9JSKy+mf276EQFxHwv ElaRIGtR7vgPrPu+rR/abqNH60YGG/rIb1aaopk9I5PDjnVdP/Txcx/R9pBsFIexcAXS LNJDP3oocMOAMk2Z+4s5vHlJqjhF5DMLjfC7PPXQoJ3mF5sU4+mdj79hazOBKLcivA9x wA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mhe5q937h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 02:20:52 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KdCaArnrN4YxkCHqTeZxyYZnvv/XlV/ec7lHPjJbaTuX+mOgab6xpT9yAFJwSTyGONwXFYpvCfWkQsMBpkg0H0zInBsC2+6Pqh9mTruyCptGwxSEoIIsIzEFkVIFuRT25cKNyj/2cl10KmC7sdeK4+iLMed1ApXqZTxAZWy1S+vvtvskW57phPG45WkTN8ek6gG4B9ywnre1g8r7mpD1W5q/KqJiBREhkfVeaeUFzYd5RdntjHxvPD/SXRNMgNSLYHI3PkijqJ6HIwPn+AGX53J/ola/v4uWqgH6YSFyRoFPplRNf9Z2sZOPold5Gvy56rj8HP9OfMaDZXvH2IwSbg== 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=p4PqmM8VRzaiQongGzltUo2mhDuqdEHEEZ/RVds/fAE=; b=Pyxd0N0GWV8x8oiobNxd/staMn5rHUiyeq0u6EQPU9gePfJJa8OhgNexPNeTWkmo354ucur+XytMNOKLfLY7Lp7iycaxt2ZBZ7BUbKXA2fvkU39nTq/ud12oZX6aS2sS3DctpCD3SMzzwmoTFu9zOZ6GHSnRNC/cTJk5ZGZjkeaioQL35VUgNcf4UT8Kt+rrK3qsTCEJNAa4OlO5MFvQ+Ytc7BwtQVe0A7uj8DWD00lqqZ63yI+w3Fm9kdkvQkUsHteFgXpYzOjOr6JPqq1r4n75Qzd8H6ZDNO4DByOPBkwvLFkjug96pziMB/1gM32a54LiUVAPt8BLMQQXQLvYgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:50 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:50 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Subject: [PATCH v3 03/17] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper Date: Mon, 19 Dec 2022 18:20:07 +0800 Message-Id: <20221219102022.2167736-4-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 37dc777e-8aeb-40ed-5b1f-08dae1aab3d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g9PqJp47/6BueysOj8aJlXHJOPC44U7YJSPajZ1sdiW4KjGewplR1MK7A8Fy8W3Ia9gQdOBxnPaTEB1pDcp65LLtULJZR62/qSbEC6BuaUOpigucgUHZMpcFIo55/yOtdZE56EejE92zZtCF5QEaLPuD0mMRmcVFekqWGSPBkowSySsRsd88Rg/hwL+F67t2ZEYghsyzQyuV4c5Jo4Hn8LxgRdcZxxNputFies6R+tf9ei4iX+li0JecTisAbSQeTq6TwMHxKfnj/u8z8lIT84mwwmN5llKUM3geRpwSi0S2MTAbreWmDLv0P1m/VgW4t4vqwQzwasQJ1nnE8OKigdHsFwbth2V2Jr1cq0hppYi0VSimUoRsqBcbeCvd1zOFpiQXyK1JwAS9k4BEtvCOUS3XC5I51F56ik1CmpJ1kKUVNwwpGVzLyCg2pDB/lrgEwFaZXhRXYRmuiUJahOJnL0fTBydFhkf/aTtSIQEh+pRr1g4hV12lU12SsnDub0ZY1993YkUCr9zTGqlYvUrnrHbMNjfDvjjBtFnDYYGy/nyVn+qLSMNxzSRh06cPjj/LpACwcIWV7QPvvoDR9Ke5g19jjbL0Ht/7YE3MecnMjp3lxka/BW8YzQ6fEtSUUqM2LAkIS5EkxlrEIJVQIUaOogkPuvDs8cucXFUxQEu2o1mUSWDQj6I7OY34zc9arc6SrcLp7E7xmN6IPXZ6fEEw9w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n5y3md2XXIGCpuMRCWbnDQvS8eAMrtFSyTzXvGEX21K+ZEhIw8oKsM2ZX4+qtGy/kzQT7hsEwLzxLsJ+kzlQrR71vzXZooZMMW/c+pePnRIKyEz1uNUL4dS2eSFyP7AXQotxNTRxG6HvIBrauDEm2n1XjUc19eqNZZXkN8EJcoa8tSZkpVI/4fLs6byp7vraFYROkhtPOby1R8fnkY6/nRy//mta+2VYz/5wOSKXYj6bwJl4SqgR2/qMmZN2m1FWkB+epXytmoRleiIj/FgJfzARnw/4McxAmHlRE3oWicN5+UM49hcRHnx8XHXLzdv4vRjdTGj9B/wmXTC4LywBtvKabgRdPgIcb+TJM7Tf1gd8yorftnPBFRSmjDnENQMB5rvdn+++DhNEO+KNnuB0zi/b3k7kPK1PCcYkUeQmSn6fUgVuXVbh/gxEbQxW/oJBVPQp3hHPYe6FhpHJMHCvTE132z+KqYkZRh5L46OsqO8vhXo2cXGcJEWbMmnqsPeAstg+U5wHDr/FTmyUtuMLpBkVIvwTd1oJYo6VNu/Yot4x3xwo1rXq8XgcA82+Sst/YlW2CnjPhzVR9CspcZVlp6+TwsyN0XqDv+lJZOBPjUurWLp/AFOjKzxgD9HlhbMLVxpD3pRn2W82Ne3gc0WRPIBvlC4FJXTPnWomgv1VnwzlHtS/tl4TItmTOTvVt/vWZZ2fpXgMqqsScrlWXYqAABbFLTTZjpy7Vm4u6MdsqKez5Oi988LNCS94s1u5iNkKQ8reCfg9qlkm89K8/Di79bgZo2G8fAyXidq00chSmWqtbJloVSCXiBOoTpSSknCQEaJ+TBWbUeJ7kXEXMiPcQHW5B9nzDfh27P12XmHyqadI43rraKoczl67i+GUveePzTh+csaB2YGfEM0CFtyKSfxO+CzMkRNJUJvRDcmuJi/3SU/IjyvfUIXe7O/7itXjnigti8W7eP81nHRrzL4+vf7U5q9G9EeTMPBDN7gjPJHxRWkZOkqJXARmWrnBKWSRF4vUo2DS6WicZ8qB5yIWKMAOWojzOLdsjjnWTA1fUDA9geb2zXpclwz6kWaF/ZGJivGCjdCRRSxTx2f1160tGNdKxvypDa4KEfCFv0OShCXOE+WEPa+aDB2viHyZekXzyNEEhPmplRzHH0Q8nkBbGFaWdxmMl9bG0n2kccMZPWk4tffaPOpgC05pcI65blOp6qzcpbN2zF8LuAITfYOqNxT/D04ob1SlhhNy5MC7YXgqHBJT2wJaKH2sqpROEdjmAsyUzCf9EsgCpXfiLi1gE4n65994Hz1i9aMO+1/8Kcm86hKbNoCwcwg25gLJJ/uPt33WT85egXf2gmdsc5uDqpL5YxjYvEfRBKBBis+/lVCGdV1kWCF6aMmx/y82VO6h/61e1bkRK+Sg6pjZz23yhqaFEo8GCpVJgfquCnZCeVwNWNoDbjG45rmhItgGZK7I+G1HlQb2ospJpLdFqy9x8ya6Rpd7A0FhedKLBn8G4orfzlZZtjvAd2SThP8/iilth2aMee3hLWHI6eE4Q7krdB4xwSSoYWITILHbIsCGr9FBio7ohIQicOuFV/6gN6eL2VyQuCOZC2gLZvMtmdVfxg== X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37dc777e-8aeb-40ed-5b1f-08dae1aab3d0 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:50.5375 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: a588AQn5M4/cZ4tGFwxUYApz5mQ70XEyhLcUoy26tJ9F/ZubmaVr24wVI+KR/X8ui0RkM2iAbGigsaA+JHI1/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-ORIG-GUID: 5BcluoAdz8l8k4fsVuNdZwQZL5nAJkQk X-Proofpoint-GUID: 5BcluoAdz8l8k4fsVuNdZwQZL5nAJkQk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=747 phishscore=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org xxxat() APIs are only available on POSIX platforms. For future extension to Windows, let's replace the direct call to xxxat() APIs with a wrapper. Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-util.h | 15 +++++++++++---- hw/9pfs/9p-local.c | 32 ++++++++++++++++---------------- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index ccfc8b1cb3..c314cf381d 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -94,6 +94,13 @@ static inline int errno_to_dotl(int err) { #define qemu_fgetxattr fgetxattr #endif +#define qemu_openat openat +#define qemu_fstatat fstatat +#define qemu_mkdirat mkdirat +#define qemu_renameat renameat +#define qemu_utimensat utimensat +#define qemu_unlinkat unlinkat + static inline void close_preserve_errno(int fd) { int serrno = errno; @@ -103,8 +110,8 @@ static inline void close_preserve_errno(int fd) static inline int openat_dir(int dirfd, const char *name) { - return openat(dirfd, name, - O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTIL); + return qemu_openat(dirfd, name, + O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTIL); } static inline int openat_file(int dirfd, const char *name, int flags, @@ -115,8 +122,8 @@ static inline int openat_file(int dirfd, const char *name, int flags, #ifndef CONFIG_DARWIN again: #endif - fd = openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, - mode); + fd = qemu_openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, + mode); if (fd == -1) { #ifndef CONFIG_DARWIN if (errno == EPERM && (flags & O_NOATIME)) { diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d42ce6d8b8..d2246a3d7e 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -103,14 +103,14 @@ static void renameat_preserve_errno(int odirfd, const char *opath, int ndirfd, const char *npath) { int serrno = errno; - renameat(odirfd, opath, ndirfd, npath); + qemu_renameat(odirfd, opath, ndirfd, npath); errno = serrno; } static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) { int serrno = errno; - unlinkat(dirfd, path, flags); + qemu_unlinkat(dirfd, path, flags); errno = serrno; } @@ -194,7 +194,7 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_path, struct stat *stbuf) goto out; } - err = fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); + err = qemu_fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); if (err) { goto err_out; } @@ -253,7 +253,7 @@ static int local_set_mapped_file_attrat(int dirfd, const char *name, } } } else { - ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { return -1; } @@ -349,7 +349,7 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) */ /* First, we clear non-racing symlinks out of the way. */ - if (fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW)) { + if (qemu_fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW)) { return -1; } if (S_ISLNK(stbuf.st_mode)) { @@ -734,7 +734,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { - err = mkdirat(dirfd, name, fs_ctx->dmode); + err = qemu_mkdirat(dirfd, name, fs_ctx->dmode); if (err == -1) { goto out; } @@ -750,7 +750,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { - err = mkdirat(dirfd, name, credp->fc_mode); + err = qemu_mkdirat(dirfd, name, credp->fc_mode); if (err == -1) { goto out; } @@ -990,7 +990,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int omap_dirfd, nmap_dirfd; - ret = mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { goto err_undo_link; } @@ -1085,7 +1085,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs_path, goto out; } - ret = utimensat(dirfd, name, buf, AT_SYMLINK_NOFOLLOW); + ret = qemu_utimensat(dirfd, name, buf, AT_SYMLINK_NOFOLLOW); close_preserve_errno(dirfd); out: g_free(dirpath); @@ -1116,7 +1116,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, if (fd == -1) { return -1; } - ret = unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); + ret = qemu_unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); close_preserve_errno(fd); if (ret < 0 && errno != ENOENT) { return -1; @@ -1124,7 +1124,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd != -1) { - ret = unlinkat(map_dirfd, name, 0); + ret = qemu_unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno != ENOENT) { return -1; @@ -1134,7 +1134,7 @@ static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, } } - return unlinkat(dirfd, name, flags); + return qemu_unlinkat(dirfd, name, flags); } static int local_remove(FsContext *ctx, const char *path) @@ -1151,7 +1151,7 @@ static int local_remove(FsContext *ctx, const char *path) goto out; } - if (fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { + if (qemu_fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { goto err_out; } @@ -1296,7 +1296,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, return -1; } - ret = renameat(odirfd, old_name, ndirfd, new_name); + ret = qemu_renameat(odirfd, old_name, ndirfd, new_name); if (ret < 0) { goto out; } @@ -1304,7 +1304,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int omap_dirfd, nmap_dirfd; - ret = mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret = qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { goto err_undo_rename; } @@ -1321,7 +1321,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *olddir, } /* rename the .virtfs_metadata files */ - ret = renameat(omap_dirfd, old_name, nmap_dirfd, new_name); + ret = qemu_renameat(omap_dirfd, old_name, nmap_dirfd, new_name); close_preserve_errno(nmap_dirfd); close_preserve_errno(omap_dirfd); if (ret < 0 && errno != ENOENT) { From patchwork Mon Dec 19 10:20:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD7BAC4332F for ; Mon, 19 Dec 2022 10:23:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DH0-0003Cy-PZ; Mon, 19 Dec 2022 05:21:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGh-0003Al-4b for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGc-0007Q7-4y for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:10 -0500 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ8jsme020578; Mon, 19 Dec 2022 10:20:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=Xy/0/TnZzqrfJjp7JG4s8BGGuRiy5TjlmKMjhpcBLTA=; b=HH5Qqi2kxr5py9Q771+YkZV3dFJUzrCNVv8dSrseDEjcBqDWHfsBMRBYoyvSrFylrV6f jfxxxZAz1MgXXgcUbAizpKEn2AgXdlXH/f3a05WF/q3b31xPT0LMky8YzXPYnOldqZKq 23abioKZnuE8GB91D4D+yoXVxXSmjtUlTpAWZkmu/+QkNfd8kz8Hu7hUAeqcfLcwyBef cNkd+2Txte9aH59lDAgMjuzZaAlzYwVML1yPcvZtYz+FjEnFZ2m2xtq/6K9Ku/txujQ8 Ry52TNz+npUyT4CD4Suca5r533swin63qNkj0JeHP7b4MgfxKH4V9p/LI7+YfwwkA1Wl wQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh301hdgp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:20:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KOFaKVuRBUMInKftQzBUacx9NuHqkI8ergccW5wbQzl/LY/RCGAL+l79GEmY+DAaRl6yMgZdIeQwTGQvaqgIK2AgWBhoCq4Kq8DWmBUltKr/NN4IwhKq5K26k/C/UiQ4lG8aqwLP3CRUEHmaV+vAgMnbcGHE4zVJF8WeAC0Z1+TV/VNcBvBVytPtVKJr2USGYblS2oEGXWdgrD+1ynfNvyNWZESTIHC6U+1d4MdHSYCATjLv2tcascU0KBQRFK51m6gjuHTu7/qDFYjsm4NbzQ1Q8Pn7vksESz6RJGEtRXZtlJJFsjXWerEk0+p7h2nGm1ctsFIZjnxbbZHuKoJD9Q== 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=Xy/0/TnZzqrfJjp7JG4s8BGGuRiy5TjlmKMjhpcBLTA=; b=eT5HKYQpwsnz2hR0IIKc9JC9WwF1GwydafU9Gj5FFhLiEJL5R6bAUz1TFTm5wnUXLXTtWFDE+S3mVmehsff8tqrIaEtyDphUDi6Dq0DV3RaS8rhWMpikrxaSIJudjrLFRV4k81Xl/K/gIokpgGjh9Mqwd7J/3LMe6htvTl+IzXB0PB6CoyoF8+PQRy5Dp4S0MKOUDeOhmWQVPRMYUaEv1UI85vZ5SmP0E+/wSY2WEsevO4cYE1pEIuhNQANu9HXNHrzLzGAGQGRgveaD0Ipu9Zbe7ydw8nbSRIZDW4RQOo8W6WqdR0dKjOC490o8JFtlCCWjWuAM05JXWbK0AxpjkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:52 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:52 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 04/17] hw/9pfs: Add missing definitions for Windows Date: Mon, 19 Dec 2022 18:20:08 +0800 Message-Id: <20221219102022.2167736-5-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e466fa9-da68-4296-994b-08dae1aab4fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vzxki5wCEESSDfvC1chThlTEXBfBVr9QbN1s2mYvRypF+DqphCf4f3eqUK5NzQsF/4UsRTTrtUPRXhAivSmHtslGnTzO3G1EXWW+nObmzhI3PXtDKAoX0yfbz6qzdGZzv9dbsDqp6k529Op5PfgD26UKNlKTrHEAgR0B2NNDuTW310bTeTIGeHzfPK+eoz9Mbjlicm8+ghBFxSciUIIsf3F7bnECEnEBylQGhgkiXsxkSb7n+ofLB+lGrU7jc29ActzPMOBRnd3tF86avlgKN7/axVw5SfQ485KbnLpD8nNY62mfS+W6lR1p22bw7tYKqcv/aM7W3i7Y2yxSJdWfyReaXZv07Bk1c7A3HlRRroLnKYSz08wJVys3xJ34bg2flBCrlfH8bTtqHZ7bilJGu61+mo+19VD+agBVbDNs8OiLdsUZguC9gVWFcjjm4AKFoiLeH31ArDwJFfw2OLurKAqN2iXEvb/r69gWL/9/j0RgsDUBKrnK9OqW7Kuo4BkBHQMgV3VcZ3UjUZ2nQcgeeECaqbGucUJkKKEUxqSkKjPCYgFMcRa1IcmIzr9wZG958oV7t6pNdDKbSo2BScVyWsRgT/vuTFtT0qGxNMXARF8X/0K3pvtDEz2Zp7LUtFZ4JuCvoSPvYTectSimLdPuW4VPeyxhDez0j2yzEKfAoM0nOUyh/PRCcf+mkFszZ9LM0Agj5K1sWGPeZztmYz+bd0EuajJySsymNfRb3jGLatg= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(966005)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wfj809IJ7MIRiVpKlnneXF29187iO0sh0QVxlUqaaeUUxIV5mynVhGr4seYzlWDeph1s+TAPwCtx44uUMrmq7cLFE6cJhpukPen/+GoKK8mlaNR64d1Y6WeEiuv5urRCyGVo8c8DAo0GJNAf8BMof3+osv5sUrgNQ4fQElEQ/OQL5NR/PEq1ppTOFvBcUb7YxH0W4S6A+dhVsC0D1ro5itIQkYxpFB7gIs9ciSzOkKHLcFC13UwDJ//6i7f0jxDIHG/R6yCV8IoHWu37Ucf/EFAU3ddlJV7bPiAGUvKM5XN0giGs8+ixPiQ4Z3ILUC11rbqm09Wi2n7C5UHZWZy3VhG1Q7PA73qSVMZQ2xopAk4QiXuTxEjjLHJQglazovcLGVu2TXKSg4shEvit06yWQ68SSRYSWRmgpwnkYSj2O1a90j7OwSNkc2tGiiO3tYlkQhwm2O+1liqUFWr1Si1IOVxUTRn+uFtL33Ct3LhRquM7Jv/UhuUvTzKBxM/wWimUFDXNdIffow4AhTZiEBj+x1mND8jnewL4cLouejTThMNp8fJrUA8gWm/QPPFT+oqudRrHyTRzEtdcE3DGgdsxazBy7gwVFE6QMeb1x1UrTUiHEgtFyIg/2F+jHFBvcNovsdB/hLC/ZZswijik9YIL/xJwO0vEbmdeNmYcpw1u9tADRTV21n/RDSNRovU6T0ciZV/QBFaPIPpBxaNi6np4MkhXFJ+uO1qnIFwnPdIWb9c+lLTpyhadM/pWVF8d7u3mwOVsfscgY2WmM4bDYZ4Ej7ovuxW+qFJW5+CXo9Y7cdOeD5kRMxR9yRvtuun9notwwd34Bm+olPNj2ZtPTD7a1EFEpvKwsYR1mW2Z8+QK6Eni1dZojYsr6/hq5DUUi6B6mipI9gMyl4MZam7AzRGohOj8Z6XbEfEBLOTrLtQtXaa7RFhfKPhtmrP0ccvAoPvjZEIiAVDb1Yw9kbbgzyMbJsPh8IwCdUxvwo06WRRnXfGChpHlXawMmiDhaJgYF8kEfZuAEbXBVnzJCfacJEtYyVNQHPgIXld3RfBwG6VHAWlcpUEJcaxsYnkNPhCRMxWnaupGY/rVhKXdhJvhuuJyx6dvaxbXBTu94fvKmpQLNxHk8aZ50p2/weWt6bb4wG4/KbivpRlTr4szBTR8M8bumUh3INL/HR8/+Jz59y+5bt4BEmosoVwYJ/hNSW6wQxvS2zeLj8KozikEvoE/rqK4t7FZ12Rpg3Fgi0Lz1D7KbSmQfRRdtH8MvkTMLn6yD9VBM8G+mHm8kjaACjopGigpY9b2x2URoZqzpOQNljcTxN1JOQgeEZZsJYfQHfk9uIif0cFeFXtAbyej7NrSFnKzKtlvx8URBYAtAHHhNIODYwHUZJyGSMtOnC8Wt+S0UnJkM9oI7F0Ttlzbm1KJ8hnsbBVzvGHkAhoTfNqdPd2ygt+8P0k3i4tVYcqo5e1VLImEEBuwSb6A8wYXqZlLn2j3OeEETKa+0r56bfN4cEK75EdOcrE0YNuzqJTYVw5YUqynxOsX+lHdo8E3g6l3Ed6glJchPvUYbB2uC9s8mjXF7KdOL7KmWO5HRqXXM3FvDClm X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e466fa9-da68-4296-994b-08dae1aab4fe X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:52.5495 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Co06lN7EMecZ2e4tQ0EPlgTWP5YCf+eJ410k5jS+whWzgC2o5aLk3rYSxRrP2zfI85IhaXjGXoZc77RY7vn20g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-ORIG-GUID: WRvdzJDDGbE4NVFefp_fFniQamweS6Nb X-Proofpoint-GUID: WRvdzJDDGbE4NVFefp_fFniQamweS6Nb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=756 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some definitions currently used by the 9pfs codes are only available on POSIX platforms. Let's add our own ones in preparation to adding 9pfs support for Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- fsdev/file-op-9p.h | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/fsdev/file-op-9p.h b/fsdev/file-op-9p.h index 4997677460..7d9a736b66 100644 --- a/fsdev/file-op-9p.h +++ b/fsdev/file-op-9p.h @@ -27,6 +27,39 @@ # include #endif +#ifdef CONFIG_WIN32 + +/* POSIX structure not defined in Windows */ + +typedef uint32_t uid_t; +typedef uint32_t gid_t; + +/* from http://man7.org/linux/man-pages/man2/statfs.2.html */ +typedef uint32_t __fsword_t; +typedef uint32_t fsblkcnt_t; +typedef uint32_t fsfilcnt_t; + +/* from linux/include/uapi/asm-generic/posix_types.h */ +typedef struct { + long __val[2]; +} fsid_t; + +struct statfs { + __fsword_t f_type; + __fsword_t f_bsize; + fsblkcnt_t f_blocks; + fsblkcnt_t f_bfree; + fsblkcnt_t f_bavail; + fsfilcnt_t f_files; + fsfilcnt_t f_ffree; + fsid_t f_fsid; + __fsword_t f_namelen; + __fsword_t f_frsize; + __fsword_t f_flags; +}; + +#endif /* CONFIG_WIN32 */ + #define SM_LOCAL_MODE_BITS 0600 #define SM_LOCAL_DIR_MODE_BITS 0700 diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 2fce4140d1..ada9f14ebc 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -3,13 +3,56 @@ #include #include +#ifndef CONFIG_WIN32 #include +#endif #include "fsdev/file-op-9p.h" #include "fsdev/9p-iov-marshal.h" #include "qemu/thread.h" #include "qemu/coroutine.h" #include "qemu/qht.h" +#ifdef CONFIG_WIN32 + +/* Windows does not provide such a macro, typically it is 255 */ +#define NAME_MAX 255 + +/* macros required for build, values do not matter */ +#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links */ +#define AT_REMOVEDIR 0x200 /* Remove directory instead of file */ +#define O_DIRECTORY 02000000 + +#define makedev(major, minor) \ + ((dev_t)((((major) & 0xfff) << 8) | ((minor) & 0xff))) +#define major(dev) ((unsigned int)(((dev) >> 8) & 0xfff)) +#define minor(dev) ((unsigned int)(((dev) & 0xff))) + +/* + * Currenlty Windows/MinGW does not provide the following flag macros, + * so define them here for 9p codes. + * + * Once Windows/MinGW provides them, remove the defines to prevent conflicts. + */ + +#ifndef S_IFLNK +#define S_IFLNK 0xA000 +#define S_ISLNK(mode) ((mode & S_IFMT) == S_IFLNK) +#endif /* S_IFLNK */ + +#ifndef S_ISUID +#define S_ISUID 0x0800 +#endif + +#ifndef S_ISGID +#define S_ISGID 0x0400 +#endif + +#ifndef S_ISVTX +#define S_ISVTX 0x0200 +#endif + +#endif /* CONFIG_WIN32 */ + enum { P9_TLERROR = 6, P9_RLERROR, From patchwork Mon Dec 19 10:20:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076462 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BF7CC4332F for ; Mon, 19 Dec 2022 10:32:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHC-0003Fv-7g; Mon, 19 Dec 2022 05:21:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGl-0003BV-Az for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:19 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGh-0007SG-Rk for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:15 -0500 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9x60I003509; Mon, 19 Dec 2022 02:20:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=ueCPGOqsKfGC52IPvxW7Ib7DoVqflAATz+WJn7mNfNU=; b=dURwqF2Q97LueMtRR2KV/Sl87czrutLzFyDIoHQ3EwVBn/TgS5lOLCBNzg8NvP/aIhm5 smJ2bCYvW5EEcsXPKtpJm5VNDMaX4zM4AUD6K9zuewzxrYyHeg9bQGT3N/O0Cqp8KCRB 6rKRMl47Sv6N/WufXf8Bwqp5XMA1186+OOeqInYkSDLwiq5yPSw0Sg9NxIKsT08XF5H/ qwQ/SW7AkeAUJ1s4oQ10w96xoi8X7Of4Uvuc146nQmmxe7XfENnydpz+LeYoAlh2Fjna hjA2Cf9JDyb8TQTE93nu4LwtXWl0NNxR2sX9kfUPJyGuZqegDPiKytyY43ZPmVHiT2mh Hw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh9x8s77r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 02:20:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PwyxW5tDL4o+E+Dmqs7npz2l6SawSuNHelSaO89EL3vFhmXXr23DzoGUfLfQmpOm3eenicQhD9I4lcpauadtnx5tKgtVGs+AWy9VKRHPOfxURAk02BE4imJRd4ZJlsFUxKKwNjGvOGGRrYF9DBqBh7BfEteNmdgO7WfLWo1A0rqvXAci8Kd7srbTti2xvrQ5/VXZDPtpIZ8VDz4QLxlDKlp7QMMI0apzTvWlySMiN/Np+3wZTYf2xSpQRG63kevyzB8H4jizQzg+4hvGDcjhKC38/f1aacLgcVwcFIqp3JVVOFtDASmJbhPrZL5/k4DDzyyjLBGyJ869xuZ1UWqBug== 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=ueCPGOqsKfGC52IPvxW7Ib7DoVqflAATz+WJn7mNfNU=; b=jqFFj4c+LZGoNnoZFiCb/tMVzU4MOsVKNSQ/ySTv+s71EWcxLs/cCLv5XGIdyVeM9wJ12+x3Ir0OcITzZuyg37JyP9tPATnaMzQ+jEAjKCdd+4Y0Bd9/QHod/L4KHDHsaatlbEBvrxwiadR1osGrfTW8CC6DbhDz+HB95YhYWSyYZoRyQmEPXOH7B2yvLhOqioybf5XqMjRJ1EvloEcYnzeQr4b3h1Kl1y0HIrR3l4hvtjwsSE+/FwHXU+QQX8xwjpsIZCd8O4v8FaA8jHZPHPaA9dmbbC8CEL+Z7pxEEKhUeVq75+Pa4GzNZgh6vb361whHpokKEMCwn7p6BW1TCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:54 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:54 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 05/17] hw/9pfs: Implement Windows specific utilities functions for 9pfs Date: Mon, 19 Dec 2022 18:20:09 +0800 Message-Id: <20221219102022.2167736-6-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 21bde913-e97d-4787-9ffd-08dae1aab62f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ylJilmEChnbTxvByq7aAldF6xPHiJd91PChGPBBlWRt0KAx2vXTd0gOSysBKTH64rDO24N6DidMEMKrFAJV5k7swwz1I1w+ruUq1tWL3dDye5Ve8jNBMfkKUUlQjWt8X+A6CQC6yN9VvnbErsqCQuiPwmGYwGM75WML5o/3BWfrDBAkScY9U5JjnpvE4FvOZgDiWjFOqi1g50tje2kcBnvCZmCsBl7RSFnUCkyv7KgtrCkICi7QyaHRsqOaa8mBYw0WqWQtqx3b0dzyL4QYoaKhj5opV7dYNk7huazbVONmvpajH+QsjoQSXLoR5TGQvOZF/iscFNqJQ+E3xR/2y8FlXL6wdfh0SvwozO+JyPlHH9UK+ozyZPaBpx9TPsRhk//t+k3dOVdt/nCqCugsDOcxNQl6ZeUN3AlnNEgLiTAyCehPsQFevW9WOZsy3iKCQjJd3uuFJrQ10x/CdRlHRgReIJLDJCs7PytlXL6Nxba6xe2IkLYDS37E/uu0hw9+wmeA6Nw14HKZRnUF2Z+dU9HP3zlJAHHVODHtl1V+lYDT+IpjXM4d6irEzjud7AHp77LZucQXgoRGTW9V/PyJ1gY8BQvWhR49xD01qovxNGrL/zOTZ5RYuHgInO8C0fFt2kpQ8XbBHeaH7e07gndjyBY9TRzS71d8cc1vqoFCnp5IW1iOdI52TmpMc5OpVVI/ThthkFovHzUDK4Q0r28vqBg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(30864003)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W40G+WdLfzAhg7AT52LhIt4efgz4fCURIaD0Rg8uIg1ch0bDhOrixEeWgOlHtUrSptA9l8cxD/HsahzbYwCPt/i8neY4jNIcc9ih5VN+cq7i9NMhmdaXqb/8QDdejVlckGH+CCXNc68ohQ+TJGjFvbWDHl8OvU7l3vxEb7jCE6TX6s06dU0xmFy5ZCSGkYhnT1I9ZXb2E/oLecrzmc2mKSywBvODR/h+aVHlNp2/Y2q5eGqNZX7sJ1RY4g0VaZ/Wd68SwZGQzMV7j6JZJN2vJXt/h2IqWnCVHIMeoITE1c0Eht8Un4e01leudT4fOENBHlhncQ9Q9hkNXMVxM1TD8O2FXWVf7yagPlTmBvXBCDYv1+quxPF573kJMPJoMpG7fTuDxtV1ufUq3bdcn9Ob4mk2u6JtuE1sv2WGC1lepvPpDkibRphVfSmHLoyUx8MmSMaz3xr6SuDQq72rWe2Gsg6kxnXonLPveSSALFW3hcGWgEJBkjmu4x77HzdO13ds3gpYT4+OdsppYe0N1kerGdkRYRy4ySDyW0bK1Y9oe1GrmMB6wL2GOPh6RYbhUOJyxIz3akAh3WalhNasl0YwzBkxNHdsId9GdjCWdT14zM1u0e/U+1MoPP34L23EBL9fYWpLVR7jo70nrVE/wQXwEAjY8HPSA1mPY9/4s0wdcrGjos1tOHmhHjdbReMQY/W7N4SfCyFcGFWVdWDROIoYK5w+iO2jzE7uvnrNV1cP78l1FXMg7ErjLAptG7oyhN+5k2D5DKsKRg/70YKDlT/xS6NcxA8jx9BKiCF0knc44bV74GLU0CGCgrkqPme88E8wCgq3lwhLZs4dMvcTmCeYvKMVNG6n9s+018HSkKTvuZ3NOyWbZhtwZ4qOhpb86PUL4tNwYdJ7OCmX6agfcOYe09YLDZNCX650yG+oHEmzZ7lXWuTs1PeRqR740I7ab12fYunoHBAS4MT3p+5Zh62BdtR4w6LsBAI/jaTBEMK1u2kGXAnyC5ePjBgfTxka/AaQ3lhjsJn6VCRLUMYNy0MblPaNiAlDNo7u0/qd/i0G7A4qRhflZZYuEmL1rax07IUVEJwpHQsgtpqqptLWH+jBIaY75BY2ufwzYnmqgoMnDnjSmEMmpH2kHgS2kK4qxRb9TPpHMb1QaFxWrOsk5NRAaTvmNIOyjsBQjGLakEZINg7y1V5r8D5nxiW03N2Gha8PoOfsbfbBP5cJnVeivaZzLHrlvDvXSeVnl1QneW9V1LNm1V9ApCH/eyKMshHD6k8+/akQ9JdNkuSRi/Q7VZIrvkPIYOfy7bXl5F8QLJy+rTWeGppFeEz0CQjhAC27Xx8Ghft693DHrP4VEx+xTIwJoxNfyBvcPR3vrsBmHLdxuTrQeOp8bByFTtHPAr/1YREbH9prt5ECo2qBoFVjtTe2t/7g9ZNqqb3iCwbB1a3loxbrsFb03uOW9INv98tYY/+bJLnBIrNke1fiNtxz/yVACOEFUY/Wzr8j4M4HfTDmZ/oq3Qkqi69OuYTlvBxBZK4RQLTPe8XzUJ2YAGdeusc409xnht4BuZuXC4npFR1Py/6wIV96fFY8cyl97W4aPMZ8 X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 21bde913-e97d-4787-9ffd-08dae1aab62f X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:54.6891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k3R6qBpR67Kd68Z1nxqdCj21tddNZ2TTmEuSGcItpPw9I3OXW0zGXL1PkIbrFQczgJ2nVKOlCijmPABYNHCDrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: w7jaQ3VbuijSNol3CVcr83iGXI79F208 X-Proofpoint-ORIG-GUID: w7jaQ3VbuijSNol3CVcr83iGXI79F208 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Windows POSIX API and MinGW library do not provide the NO_FOLLOW flag, and do not allow opening a directory by POSIX open(). This causes all xxx_at() functions cannot work directly. However, we can provide Windows handle based functions to emulate xxx_at() functions (e.g.: openat_win32, utimensat_win32, etc.). NTFS ADS (Alternate Data Streams) is used to emulate 9pfs extended attributes on Windows. Symbolic link is only supported when security model is "mapped-xattr" or "mapped-file". Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-local.h | 7 + hw/9pfs/9p-util.h | 32 +- hw/9pfs/9p-local.c | 4 - hw/9pfs/9p-util-win32.c | 931 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 969 insertions(+), 5 deletions(-) create mode 100644 hw/9pfs/9p-util-win32.c diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index 32c72749d9..77e7f57f89 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -13,6 +13,13 @@ #ifndef QEMU_9P_LOCAL_H #define QEMU_9P_LOCAL_H +typedef struct { + int mountfd; +#ifdef CONFIG_WIN32 + char *root_path; +#endif +} LocalData; + int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, mode_t mode); int local_opendir_nofollow(FsContext *fs_ctx, const char *path); diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c314cf381d..90420a7578 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -88,18 +88,46 @@ static inline int errno_to_dotl(int err) { return err; } -#ifdef CONFIG_DARWIN +#if defined(CONFIG_DARWIN) #define qemu_fgetxattr(...) fgetxattr(__VA_ARGS__, 0, 0) +#elif defined(CONFIG_WIN32) +#define qemu_fgetxattr fgetxattr_win32 #else #define qemu_fgetxattr fgetxattr #endif +#ifdef CONFIG_WIN32 +#define qemu_openat openat_win32 +#define qemu_fstatat fstatat_win32 +#define qemu_mkdirat mkdirat_win32 +#define qemu_renameat renameat_win32 +#define qemu_utimensat utimensat_win32 +#define qemu_unlinkat unlinkat_win32 +#else #define qemu_openat openat #define qemu_fstatat fstatat #define qemu_mkdirat mkdirat #define qemu_renameat renameat #define qemu_utimensat utimensat #define qemu_unlinkat unlinkat +#endif + +#ifdef CONFIG_WIN32 +char *get_full_path_win32(HANDLE hDir, const char *name); +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size); +int openat_win32(int dirfd, const char *pathname, int flags, mode_t mode); +int fstatat_win32(int dirfd, const char *pathname, + struct stat *statbuf, int flags); +int mkdirat_win32(int dirfd, const char *pathname, mode_t mode); +int renameat_win32(int olddirfd, const char *oldpath, + int newdirfd, const char *newpath); +int utimensat_win32(int dirfd, const char *pathname, + const struct timespec times[2], int flags); +int unlinkat_win32(int dirfd, const char *pathname, int flags); +int statfs_win32(const char *root_path, struct statfs *stbuf); +int openat_dir(int dirfd, const char *name); +int openat_file(int dirfd, const char *name, int flags, mode_t mode); +#endif static inline void close_preserve_errno(int fd) { @@ -108,6 +136,7 @@ static inline void close_preserve_errno(int fd) errno = serrno; } +#ifndef CONFIG_WIN32 static inline int openat_dir(int dirfd, const char *name) { return qemu_openat(dirfd, name, @@ -154,6 +183,7 @@ again: errno = serrno; return fd; } +#endif ssize_t fgetxattrat_nofollow(int dirfd, const char *path, const char *name, void *value, size_t size); diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d2246a3d7e..c95ede0dcb 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -53,10 +53,6 @@ #define BTRFS_SUPER_MAGIC 0x9123683E #endif -typedef struct { - int mountfd; -} LocalData; - int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, mode_t mode) { diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c new file mode 100644 index 0000000000..7a270a7bd5 --- /dev/null +++ b/hw/9pfs/9p-util-win32.c @@ -0,0 +1,931 @@ +/* + * 9p utilities (Windows Implementation) + * + * Copyright (c) 2022 Wind River Systems, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +/* + * This file contains Windows only functions for 9pfs. + * + * For 9pfs Windows host, the following features are different from Linux host: + * + * 1. Windows POSIX API does not provide the NO_FOLLOW flag, that means MinGW + * cannot detect if a path is a symbolic link or not. Also Windows do not + * provide POSIX compatible readlink(). Supporting symbolic link in 9pfs on + * Windows may cause security issues, so symbolic link support is disabled + * completely for security model "none" or "passthrough". + * + * 2. Windows file system does not support extended attributes directly. 9pfs + * for Windows uses NTFS ADS (Alternate Data Streams) to emulate extended + * attributes. + * + * 3. statfs() is not available on Windows. qemu_statfs() is used to emulate it. + * + * 4. On Windows trying to open a directory with the open() API will fail. + * This is because Windows does not allow opening directory in normal usage. + * + * As a result of this, all xxx_at() functions won't work directly on + * Windows, e.g.: openat(), unlinkat(), etc. + * + * As xxx_at() can prevent parent directory to be modified on Linux host, + * to support this and prevent security issue, all xxx_at() APIs are replaced + * by xxx_at_win32(). + * + * Windows does not support opendir, the directory fd is created by + * CreateFile and convert to fd by _open_osfhandle(). Keep the fd open will + * lock and protect the directory (can not be modified or replaced) + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/error-report.h" +#include "9p.h" +#include "9p-util.h" +#include "9p-local.h" + +#include +#include + +#define V9FS_MAGIC 0x53465039 /* string "9PFS" */ + +/* + * build_ads_name - construct Windows ADS name + * + * This function constructs Windows NTFS ADS (Alternate Data Streams) name + * to . + */ +static int build_ads_name(char *namebuf, size_t namebuf_len, + const char *filename, const char *ads_name) +{ + size_t total_size; + + total_size = strlen(filename) + strlen(ads_name) + 2; + if (total_size > namebuf_len) { + return -1; + } + + /* + * NTFS ADS (Alternate Data Streams) name format: filename:ads_name + * e.g.: D:\1.txt:my_ads_name + */ + + strcpy(namebuf, filename); + strcat(namebuf, ":"); + strcat(namebuf, ads_name); + + return 0; +} + +/* + * copy_ads_name - copy ADS name from buffer returned by FindNextStreamW() + * + * This function removes string "$DATA" in ADS name string returned by + * FindNextStreamW(), and copies the real ADS name to . + */ +static ssize_t copy_ads_name(char *namebuf, size_t namebuf_len, + char *full_ads_name) +{ + char *p1, *p2; + + /* + * NTFS ADS (Alternate Data Streams) name from enumerate data format: + * :ads_name:$DATA, e.g.: :my_ads_name:$DATA + * + * ADS name from FindNextStreamW() always has ":$DATA" string at the end. + * + * This function copies ADS name to namebuf. + */ + + p1 = strchr(full_ads_name, ':'); + if (p1 == NULL) { + return -1; + } + + p2 = strchr(p1 + 1, ':'); + if (p2 == NULL) { + return -1; + } + + /* skip empty ads name */ + if (p2 - p1 == 1) { + return 0; + } + + if (p2 - p1 + 1 > namebuf_len) { + return -1; + } + + memcpy(namebuf, p1 + 1, p2 - p1 - 1); + namebuf[p2 - p1 - 1] = '\0'; + + return p2 - p1; +} + +/* + * get_full_path_win32 - get full file name base on a handle + * + * This function gets full file name based on a handle specified by to + * a file or directory. + * + * Caller function needs to free the file name string after use. + */ +char *get_full_path_win32(HANDLE hDir, const char *name) +{ + g_autofree char *full_file_name = NULL; + DWORD total_size; + DWORD name_size; + + if (hDir == INVALID_HANDLE_VALUE) { + return NULL; + } + + full_file_name = g_malloc0(NAME_MAX); + + /* get parent directory full file name */ + name_size = GetFinalPathNameByHandle(hDir, full_file_name, + NAME_MAX - 1, FILE_NAME_NORMALIZED); + if (name_size == 0 || name_size > NAME_MAX - 1) { + return NULL; + } + + /* full path returned is the "\\?\" syntax, remove the lead string */ + memmove(full_file_name, full_file_name + 4, NAME_MAX - 4); + + if (name != NULL) { + total_size = strlen(full_file_name) + strlen(name) + 2; + + if (total_size > NAME_MAX) { + return NULL; + } + + /* build sub-directory file name */ + strcat(full_file_name, "\\"); + strcat(full_file_name, name); + } + + return g_steal_pointer(&full_file_name); +} + +/* + * fgetxattr_win32 - get extended attribute by fd + * + * This function gets extened attribute by . will be translated to + * Windows handle. + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = {0}; + DWORD dwBytesRead; + HANDLE hStream; + HANDLE hFile; + + hFile = (HANDLE)_get_osfhandle(fd); + + full_file_name = get_full_path_win32(hFile, NULL); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return dwBytesRead; +} + +/* + * openat_win32 - emulate openat() + * + * This function emulates openat(). + * + * this function needs a handle to get the full file name, it has to + * convert fd to handle by get_osfhandle(). + * + * For symbolic access: + * 1. Parent directory handle should not be a symbolic link because + * it is opened by openat_dir() which can prevent from opening a link to + * a dirctory. + * 2. Link flag in is not set because Windows does not have this flag. + * Create a new symbolic link will be denied. + * 3. This function checks file symbolic link attribute after open. + * + * So native symbolic link will not be accessed by 9p client. + */ +int openat_win32(int dirfd, const char *pathname, int flags, mode_t mode) +{ + g_autofree char *full_file_name1 = NULL; + g_autofree char *full_file_name2 = NULL; + HANDLE hFile; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + int fd; + + full_file_name1 = get_full_path_win32(hDir, pathname); + if (full_file_name1 == NULL) { + return -1; + } + + fd = open(full_file_name1, flags, mode); + if (fd > 0) { + DWORD attribute; + hFile = (HANDLE)_get_osfhandle(fd); + + full_file_name2 = get_full_path_win32(hFile, NULL); + attribute = GetFileAttributes(full_file_name2); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + close(fd); + } + } + + return fd; +} + +/* + * fstatat_win32 - emulate fstatat() + * + * This function emulates fstatat(). + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int fstatat_win32(int dirfd, const char *pathname, + struct stat *statbuf, int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile = INVALID_HANDLE_VALUE; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + BY_HANDLE_FILE_INFORMATION file_info; + DWORD attribute; + int err = 0; + int ret = -1; + ino_t st_ino; + + full_file_name = get_full_path_win32(hDir, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) { + err = EACCES; + goto out; + } + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + goto out; + } + + ret = stat(full_file_name, statbuf); + + if (GetFileInformationByHandle(hFile, &file_info) == 0) { + errno = EACCES; + goto out; + } + + /* + * Windows (NTFS) file ID is a 64-bit ID: + * 16-bit sequence ID + 48 bit segment number + * + * But currently, ino_t defined in Windows header file is only 16-bit, + * and it is not patched by MinGW. So we build a pseudo inode number + * by the low 32-bit segment number when ino_t is only 16-bit. + */ + if (sizeof(st_ino) == sizeof(uint64_t)) { + st_ino = (ino_t)((uint64_t)file_info.nFileIndexLow + | (((uint64_t)file_info.nFileIndexHigh) << 32)); + } else if (sizeof(st_ino) == sizeof(uint16_t)) { + st_ino = (ino_t)(((uint16_t)file_info.nFileIndexLow) + ^ ((uint16_t)(file_info.nFileIndexLow >> 16))); + } else { + st_ino = (ino_t)file_info.nFileIndexLow; + } + + statbuf->st_ino = st_ino; + +out: + if (hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * mkdirat_win32 - emulate mkdirat() + * + * This function emulates mkdirat(). + * + * this function needs a handle to get the full file name, it has to + * convert fd to handle by get_osfhandle(). + */ +int mkdirat_win32(int dirfd, const char *pathname, mode_t mode) +{ + g_autofree char *full_file_name = NULL; + int ret = -1; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, pathname); + if (full_file_name == NULL) { + return ret; + } + + ret = mkdir(full_file_name); + + return ret; +} + +/* + * renameat_win32 - emulate renameat() + * + * This function emulates renameat(). + * + * this function needs a handle to get the full file name, it has to + * convert fd to handle by get_osfhandle(). + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int renameat_win32(int olddirfd, const char *oldpath, + int newdirfd, const char *newpath) +{ + g_autofree char *full_old_name = NULL; + g_autofree char *full_new_name = NULL; + HANDLE hFile; + HANDLE hOldDir = (HANDLE)_get_osfhandle(olddirfd); + HANDLE hNewDir = (HANDLE)_get_osfhandle(newdirfd); + DWORD attribute; + int err = 0; + int ret = -1; + + full_old_name = get_full_path_win32(hOldDir, oldpath); + full_new_name = get_full_path_win32(hNewDir, newpath); + if (full_old_name == NULL || full_new_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_old_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute = GetFileAttributes(full_old_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + err = EACCES; + goto out; + } + + CloseHandle(hFile); + + ret = rename(full_old_name, full_new_name); +out: + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * utimensat_win32 - emulate utimensat() + * + * This function emulates utimensat(). + * + * this function needs a handle to get the full file name, it has to + * convert fd to handle by get_osfhandle(). + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int utimensat_win32(int dirfd, const char *pathname, + const struct timespec times[2], int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile = INVALID_HANDLE_VALUE; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + DWORD attribute; + struct utimbuf tm; + int err = 0; + int ret = -1; + + full_file_name = get_full_path_win32(hDir, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* open file to lock it */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) { + err = EACCES; + goto out; + } + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + errno = EACCES; + goto out; + } + + tm.actime = times[0].tv_sec; + tm.modtime = times[1].tv_sec; + + ret = utime(full_file_name, &tm); + +out: + if (hFile != INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * unlinkat_win32 - emulate unlinkat() + * + * This function emulates unlinkat(). + * + * this function needs a handle to get the full file name, it has to + * convert fd to handle by get_osfhandle(). + * + * Access to a symbolic link will be denied to prevent security issues. + */ + +int unlinkat_win32(int dirfd, const char *pathname, int flags) +{ + g_autofree char *full_file_name = NULL; + HANDLE hFile; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + DWORD attribute; + int err = 0; + int ret = -1; + + full_file_name = get_full_path_win32(hDir, pathname); + if (full_file_name == NULL) { + return ret; + } + + /* + * open file to prevent other one modify it. FILE_SHARE_DELETE flag + * allows remove a file even it is still in opening. + */ + hFile = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute = GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute == INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + err = EACCES; + goto out; + } + + if (flags == AT_REMOVEDIR) { /* remove directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) == 0) { + err = ENOTDIR; + goto out; + } + ret = rmdir(full_file_name); + } else { /* remove regular file */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) != 0) { + err = EISDIR; + goto out; + } + ret = remove(full_file_name); + } + + /* after last handle closed, file will be removed */ + CloseHandle(hFile); + +out: + if (err != 0) { + errno = err; + } + return ret; +} + +/* + * statfs_win32 - statfs() on Windows + * + * This function emulates statfs() on Windows host. + */ +int statfs_win32(const char *path, struct statfs *stbuf) +{ + char RealPath[4] = { 0 }; + unsigned long SectorsPerCluster; + unsigned long BytesPerSector; + unsigned long NumberOfFreeClusters; + unsigned long TotalNumberOfClusters; + + /* only need first 3 bytes, e.g. "C:\ABC", only need "C:\" */ + memcpy(RealPath, path, 3); + + if (GetDiskFreeSpace(RealPath, &SectorsPerCluster, &BytesPerSector, + &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) { + errno = EIO; + return -1; + } + + stbuf->f_type = V9FS_MAGIC; + stbuf->f_bsize = + (__fsword_t)SectorsPerCluster * (__fsword_t)BytesPerSector; + stbuf->f_blocks = (fsblkcnt_t)TotalNumberOfClusters; + stbuf->f_bfree = (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_bavail = (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_files = -1; + stbuf->f_ffree = -1; + stbuf->f_namelen = NAME_MAX; + stbuf->f_frsize = 0; + stbuf->f_flags = 0; + + return 0; +} + +/* + * openat_dir - emulate openat_dir() + * + * This function emulates openat_dir(). + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int openat_dir(int dirfd, const char *name) +{ + g_autofree char *full_file_name = NULL; + HANDLE hSubDir; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + DWORD attribute; + + full_file_name = get_full_path_win32(hDir, name); + if (full_file_name == NULL) { + return -1; + } + + attribute = GetFileAttributes(full_file_name); + if (attribute == INVALID_FILE_ATTRIBUTES) { + return -1; + } + + /* check if it is a directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) == 0) { + return -1; + } + + /* do not allow opening a symbolic link */ + if ((attribute & FILE_ATTRIBUTE_REPARSE_POINT) != 0) { + return -1; + } + + /* open it */ + hSubDir = CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + return _open_osfhandle((intptr_t)hSubDir, _O_RDONLY); +} + + +int openat_file(int dirfd, const char *name, int flags, mode_t mode) +{ + return openat_win32(dirfd, name, flags | _O_BINARY, mode); +} + +/* + * fgetxattrat_nofollow - get extended attribute + * + * This function gets extended attribute from file in the directory + * specified by . The extended atrribute name is specified by + * and return value will be put in . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fgetxattrat_nofollow(int dirfd, const char *path, + const char *name, void *value, size_t size) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + DWORD dwBytesRead; + HANDLE hStream; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, path); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return dwBytesRead; +} + +/* + * fsetxattrat_nofollow - set extended attribute + * + * This function set extended attribute to file in the directory + * specified by . + * + * This function emulates extended attribute by NTFS ADS. + */ + +int fsetxattrat_nofollow(int dirfd, const char *path, const char *name, + void *value, size_t size, int flags) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + DWORD dwBytesWrite; + HANDLE hStream; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, path); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0) { + errno = EIO; + return -1; + } + + hStream = CreateFile(ads_file_name, GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream == INVALID_HANDLE_VALUE) { + errno = EIO; + return -1; + } + + if (WriteFile(hStream, value, size, &dwBytesWrite, NULL) == FALSE) { + errno = EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return 0; +} + +/* + * flistxattrat_nofollow - list extended attribute + * + * This function gets extended attribute lists from file in the + * directory specified by . Lists returned will be put in . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t flistxattrat_nofollow(int dirfd, const char *filename, + char *list, size_t size) +{ + g_autofree char *full_file_name = NULL; + WCHAR WideCharStr[NAME_MAX + 1] = { 0 }; + char full_ads_name[NAME_MAX + 1]; + WIN32_FIND_STREAM_DATA fsd; + BOOL bFindNext; + char *list_ptr = list; + size_t list_left_size = size; + HANDLE hFind; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + int ret; + + full_file_name = get_full_path_win32(hDir, filename); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + /* + * ADS enumerate function only has WCHAR version, so we need to + * covert filename to utf-8 string. + */ + ret = MultiByteToWideChar(CP_UTF8, 0, full_file_name, + strlen(full_file_name), WideCharStr, NAME_MAX); + if (ret == 0) { + errno = EIO; + return -1; + } + + hFind = FindFirstStreamW(WideCharStr, FindStreamInfoStandard, &fsd, 0); + if (hFind == INVALID_HANDLE_VALUE) { + errno = ENODATA; + return -1; + } + + do { + memset(full_ads_name, 0, sizeof(full_ads_name)); + + /* + * ADS enumerate function only has WCHAR version, so we need to + * covert cStreamName to utf-8 string. + */ + ret = WideCharToMultiByte(CP_UTF8, 0, + fsd.cStreamName, wcslen(fsd.cStreamName) + 1, + full_ads_name, sizeof(full_ads_name) - 1, + NULL, NULL); + if (ret == 0) { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { + errno = ERANGE; + } + CloseHandle(hFind); + return -1; + } + + ret = copy_ads_name(list_ptr, list_left_size, full_ads_name); + if (ret < 0) { + errno = ERANGE; + CloseHandle(hFind); + return -1; + } + + list_ptr = list_ptr + ret; + list_left_size = list_left_size - ret; + + bFindNext = FindNextStreamW(hFind, &fsd); + } while (bFindNext); + + CloseHandle(hFind); + + return size - list_left_size; +} + +/* + * fremovexattrat_nofollow - remove extended attribute + * + * This function removes an extended attribute from file in the + * directory specified by . + * + * This function emulates extended attribute by NTFS ADS. + */ +ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, + const char *name) +{ + g_autofree char *full_file_name = NULL; + char ads_file_name[NAME_MAX + 1] = { 0 }; + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, filename); + if (full_file_name == NULL) { + errno = EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, filename, name) < 0) { + errno = EIO; + return -1; + } + + if (DeleteFile(ads_file_name) != 0) { + if (GetLastError() == ERROR_FILE_NOT_FOUND) { + errno = ENODATA; + return -1; + } + } + + return 0; +} + +/* + * local_opendir_nofollow - open a Windows directory + * + * This function returns a fd of the directory specified by + * based on 9pfs mount point. + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * This function convert handle to fd by _open_osfhandle(). + * + * This function checks the resolved path of . If the resolved + * path is not in the scope of root directory (e.g. by symbolic link), then + * this function will fail to prevent any security issues. + */ +int local_opendir_nofollow(FsContext *fs_ctx, const char *dirpath) +{ + g_autofree char *full_file_name = NULL; + LocalData *data = fs_ctx->private; + HANDLE hDir; + int dirfd; + + dirfd = openat_dir(data->mountfd, dirpath); + if (dirfd == -1) { + return -1; + } + hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, NULL); + if (full_file_name == NULL) { + close(dirfd); + return -1; + } + + /* + * Check if the resolved path is in the root directory scope: + * data->root_path and full_file_name are full path with symbolic + * link resolved, so fs_ctx->root_path must be in the head of + * full_file_name. If not, that means guest OS tries to open a file not + * in the scope of mount point. This operation should be denied. + */ + if (memcmp(full_file_name, data->root_path, + strlen(data->root_path)) != 0) { + close(dirfd); + return -1; + } + + return dirfd; +} + +/* + * qemu_mknodat - mknodat emulate function + * + * This function emulates mknodat on Windows. It only works when security + * model is mapped or mapped-xattr. + */ +int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +{ + if (S_ISREG(mode) || !(mode & S_IFMT)) { + int fd = openat_file(dirfd, filename, O_CREAT, mode); + if (fd == -1) { + return -1; + } + close_preserve_errno(fd); + return 0; + } + + error_report_once("Unsupported operation for mknodat"); + errno = ENOTSUP; + return -1; +} From patchwork Mon Dec 19 10:20:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96D94C4167B for ; Mon, 19 Dec 2022 10:28:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHB-0003Fm-EB; Mon, 19 Dec 2022 05:21:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGk-0003BP-0s for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:19 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGh-0007S7-4z for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9x60J003509; Mon, 19 Dec 2022 02:20:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=ZpyrFFZOAgdR/kh33Ho10x+oJuaLY7AI0lRUoLN5U7Q=; b=o81iWG83CYsijjC1nq6f6wPgQU9byZy/4SgpOSGagWSqjuWtnHLNa/cRnBm1Z16YhhW/ Cn/9ChCDhcm8lf6O7b8kvfP5JW0d/BpygjTTdWG7ejleheeWjp+X+I50x6P9zLe2MWnG zV0ndPTFLLyvXsWDf9w/2PqjzQdH1U859rywgZUnc8ViPnuEnSNhegbIvzvnkkmFclf9 /qRuvlDzw3hC9hw4x7oVnwQ/UIp2bWmjQV/oj8MnVP/3Ob+un0Mox5KajlEPjibZ9Lu7 RnGuKqy9O1kTQuc/7zVW8qXJ/j1sYLvWUeSBLGJd8CNKyvmMhquZQG3q4d4BgTvvEKxi bw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh9x8s77r-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 02:20:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oB+KIrg0bShBiifvfDXJ/rw9kfMGmlE6gyHG9qfevmEpsZUMdn/B10SK96+pO6OA3d/yxU2Uj2LG3y3cKIDd3tUmk+o+fxgNjZi/H3zSDhR903n9jD/JVV8YjOQ+5ZIsTFGiioW8OWxhLnexfmbnzTbOxQKwPIf7gHV3+UGWLZhzqhdPk1EkVgchOsI8GwsCk8D/hBCbXdD7/dHiLCH1fG1Fbe740obC9eE1Gs08Qc17iB04lcSe125WIOLU+ALecpGMWbpkxYVblG6pNrcGIP6E9RlK2KRIuPM+9jwR3KFMkMdgnhENq7Rz/UptnUcSDtQKEHTxhHBhLzXtj4Ft3w== 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=ZpyrFFZOAgdR/kh33Ho10x+oJuaLY7AI0lRUoLN5U7Q=; b=E2+BMFrNt+OJ+CuT1oeSVo+cBerX2u/D/A7sCXsBW0KAJcP2XGVHQkyTmo368A6DtRC08MLSOGUeegzcE4ai7NOHktPcYdtlB18ssC2k/NARmV+MRUiZlLXbsUOhtJqWvHRYSEmPGT1p/gnlVb/0AptQW3vG/AhGOdX92nbeZUN57iCnS1IxL/PQYT3OwNumf0brod9/qESAMgTEQZ19pXwsSkxSKKzINtFOI7yWXEVyPJPRnleQgt3TnpopCS7vUv3TwVWjkUu4+WV0ZK92mdt1U+6NejrGpBhF+7gtcROxtuiavJhS9k1CDlUp6TNe6kMAKb0sjd1lF675W3e6gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:56 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:56 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 06/17] hw/9pfs: Update the local fs driver to support Windows Date: Mon, 19 Dec 2022 18:20:10 +0800 Message-Id: <20221219102022.2167736-7-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 0cd1ceec-69dc-4898-7e26-08dae1aab778 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HT3HCsYBD86d9/0nv6Bd/GMrctMEpuofHbTsT3BaYm5PSmMa3RKrgSD/VVeH+nV+wplkMcM+HswTIFtBlbWhc6/99X0tY6OdTvIV1EwzoJXrMoj0VM2AQgTmj1YmSYqs88i8Elp8v4apvy1b7qVSsg3t9ghd+KCqKLrYNOb2d+6NSjMk2qcqnad+El0az0p5jtIS6j8dIPKq7mqFlJ6MHSdWGA4sReT9u1hh7c/FZjqacpakPxhYCiYCc2dZydUmjypBZU7uEMv3pVNMtInsQktcE69vYjEiIc0IKuRiim7gInB5bugriW7VXiZQAZTuU14mXK2NXhC8cIYclvh6QREqCb8OMwhRKuticLy/aYvIeGzOVtrTNH2C4leFZRmae5adC0KLr3BQBcwopQMaQ9SC2OnwaPgZMYiEM64zsgWHsnCvhNLVxaP83tkgX/boJrIu6rlask2IofUtqjvdPZvvMtWVbjWRjkOly3xazd8AtMMnGQJN5D8UgkDB3HVqngyB28XqsDRKfqe9qqMiEwYEYBa84XA2lRfGfa7cfSFzEH2dm5R1Dw6+bX+puOrwCnuzbqfdnx8XEj73qcgrbT78y/u+q3agRXgnCZ+xkEaKlnS1sHQ4JzR5e/jde/lpq77szovBR9yXMxhJUw1TKQFlmgwPneatzDpibIIu2YuIfbkHVtWo3ymy/SETr0Yb7zs73Ssv+sbV5LVfWJPBxQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(30864003)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(15650500001)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KCx9c3KLXm2h0b0HtDLIl2u32M2dhnfRIe3OOknclDFApTNJzTvio4ZMtlUdnzFI1iO9F0EZ4r46ShX5ABOOq8FHkxcOm8rC3eOoNJXYTkiN9VzRJS2hyNzEbU1V8wKupI8CjQ48c2u3EKDryiSlQQ2vi84gOYCfbOtHSNA4l/h18y7BWGLaT+0iwj782JawEXZOswRuG8dPHXRd985P1fGn37agXHsQODB7VMgepgAKf0jZJeeKQgLCYE5/5yE8c3weiDXuixIERWSRNOuf2WsLMfK2ilrlTOCjrEaTf9DgvpOWkIVCV7oYIEQlx21wXLxkcPuD4cBX/AhP+o44xNDQ8EyVpW5Nktj8eti9o15XOsm3ReajJBn08eTkEYznyW31A+UHai0yjk6Tbn9jU3rIu80sl1IRrVLm6qk7NSVovLkfOnLcr6OWfh3rtLbRHztEsB9ZPJMG+A/87U8wJP6ELj4A7dKfxGTCPMGjcVB/kckOWG/euJmDr0G3v6TGEPMXWjAOrUtdR4OKcSEv1jrzzvHilGKd4zP5fZ/fNMwv/FQZEsH9ssgceSNxfHUrgMncxZ/D0itxwdV4OJIXSSXwmkCoGg/kyZNGFb8zhcWgZxIMru9c2C2SlxueEpXCCshe+mZAVnqhgnxTt/l82rCgjMPTAwVQu3AQv+2aIkoqCW+4dCDJhWvMLM1+q3oJ9WTaavn/+XGQMG//sq8qTk8YMVwdc0uG5V1r0zYlgms1w3rM6wGgdWqPhWUUyThY/JcjURWWkAycPgkpewCXs4MtSaP2HQCu9dQUqYlvVu+wV20j/ZrzlvmFFUsJJn0HsVjNFDeYN+iosN7rD5YHXmqpSbJxEvL7smA8bDqKLZVWnkWAQb900DbgdkIQho/1z2ZSS68uutnOryd+8pV+hgmExnFlQ4MwRMb3kwXZQ5SnSCorqnD8dPEDgy/eUVaT1Qwyv8pwg6l96k3sazqcYXJIPildG2zmbiWaLnUDfpO3XwMz79n3ofokJ9elkeusSc0C9XQdp8ronQfAg1EnwBEds8wrif11de5uKNN/b0x1DIAaHif4jb93ZzIsoEyww7k7JUVxgWZIWQZZAZqjf6Vk54VYhAgD737jsnqe+Bw00xu/793lkSDyP5au7ygqkZLbCeo4lchEP/f+5Fl3ErHaEOW7lGuIc6aNBx5/ewXXnaZdbwrhHQZv4bHB2KhertkDa6rYYsriu7VLQ6n31qLRx5ykfptoJKTCO1Th/2gaqHYIC46UcU3ZWEv0CTxui38aqwRxQdeRPHADC4bANglx3MNKJdECooZSWsjjrYROf64SThGFxzFmTTq9Q0jRsTQOuVv/2RtDK988p7EcV7qhud0cmjkZtsQSFENNnmFpiWNLQ78pZbvPwgmaZNNXFAcAFvD3hxhhDnEjBUYMLpAYaDw6O/QXm4V9EX4GsDjrbdSY/33dDvxtjQu5RFEtGlLqmrDmgFY9V5M7CvfDAO8R6eWpelWk+UWCgLfkWsLC4ml8viXTx/uJ2MMkStzlG9luhsU+dPCDCE6647creXjBgbYv4uEQ+jKLQmuMSzqcFSMEhyQLDy/BR+HZXmGh X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0cd1ceec-69dc-4898-7e26-08dae1aab778 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:56.8143 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U6of3tFEquY5k8DIcSBb/Ae1Ni0nlx265x/wIHH7utYpGU6C44lnU7IM6BwMzrB58v7x+B4wdpAdYkkK7zSK1w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: M9ia-YFAMwz5sg6WhPYDPr3rCx9pAryz X-Proofpoint-ORIG-GUID: M9ia-YFAMwz5sg6WhPYDPr3rCx9pAryz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_PDS_OTHER_BAD_TLD=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Update the 9p 'local' file system driver to support Windows, including open, read, write, close, rename, remove, etc. All security models are supported. The mapped (mapped-xattr) security model is implemented using NTFS Alternate Data Stream (ADS) so the 9p export path shall be on an NTFS partition. Symbolic link and hard link are not supported when security model is "passthrough" or "none", because Windows NTFS does not fully support them with POSIX compatibility. Symbolic link is enabled when security model is "mapped-file" or "mapped-xattr". inode remap is always enabled because Windows file system does not provide a compatible inode number. mknod() is not supported because Windows does not support it. chown() and chmod() are not supported when 9pfs is configured with security mode to 'none' or 'passthrough' because Windows host does not support such type request. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-local.h | 1 + hw/9pfs/9p-local.c | 350 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 343 insertions(+), 8 deletions(-) diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index 77e7f57f89..5905923881 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -17,6 +17,7 @@ typedef struct { int mountfd; #ifdef CONFIG_WIN32 char *root_path; + DWORD block_size; #endif } LocalData; diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index c95ede0dcb..d399c3439a 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -21,11 +21,13 @@ #include "9p-xattr.h" #include "9p-util.h" #include "fsdev/qemu-fsdev.h" /* local_ops */ +#ifndef CONFIG_WIN32 #include #include #include #include #include +#endif #include "qemu/xattr.h" #include "qapi/error.h" #include "qemu/cutils.h" @@ -38,7 +40,9 @@ #include #endif #endif +#ifndef CONFIG_WIN32 #include +#endif #ifndef XFS_SUPER_MAGIC #define XFS_SUPER_MAGIC 0x58465342 @@ -90,10 +94,12 @@ int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, return fd; } +#ifndef CONFIG_WIN32 int local_opendir_nofollow(FsContext *fs_ctx, const char *path) { return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0); } +#endif static void renameat_preserve_errno(int odirfd, const char *opath, int ndirfd, const char *npath) @@ -236,7 +242,7 @@ static int local_set_mapped_file_attrat(int dirfd, const char *name, int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; - int map_dirfd = -1, map_fd; + int map_dirfd = -1; bool is_root = !strcmp(name, "."); if (is_root) { @@ -300,10 +306,12 @@ update_map_file: return -1; } - map_fd = fileno(fp); +#ifndef CONFIG_WIN32 + int map_fd = fileno(fp); assert(map_fd != -1); ret = fchmod(map_fd, 0600); assert(ret == 0); +#endif if (credp->fc_uid != -1) { uid = credp->fc_uid; @@ -335,6 +343,7 @@ update_map_file: return 0; } +#ifndef CONFIG_WIN32 static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) { struct stat stbuf; @@ -396,6 +405,7 @@ static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) close_preserve_errno(fd); return ret; } +#endif static int local_set_xattrat(int dirfd, const char *path, FsCred *credp) { @@ -436,6 +446,7 @@ static int local_set_xattrat(int dirfd, const char *path, FsCred *credp) return 0; } +#ifndef CONFIG_WIN32 static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd, const char *name, FsCred *credp) { @@ -452,6 +463,7 @@ static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd, return fchmodat_nofollow(dirfd, name, credp->fc_mode & 07777); } +#endif static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) @@ -472,6 +484,12 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, close_preserve_errno(fd); } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + error_report_once("readlink is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + tsize = -1; +#else char *dirpath = g_path_get_dirname(fs_path->data); char *name = g_path_get_basename(fs_path->data); int dirfd; @@ -486,6 +504,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, out: g_free(name); g_free(dirpath); +#endif } return tsize; } @@ -524,9 +543,41 @@ static int local_opendir(FsContext *ctx, return -1; } +#ifdef CONFIG_WIN32 + char *full_file_name; + + /* + * Windows POSIX API does not provide opendir(). + * MinGW emulate opendir() by itself. + * So at here, it should always close the dirfd returned from + * local_opendir_nofollow(), because the dirfd is not related to the MinGW's + * directory fd. + * + * dirfd returned from local_opendir_nofollow() is created by CreateFile() + * and coverted by _open_osfhandle(). MinGW's closedir() does not close it. + */ + HANDLE hDir = (HANDLE)_get_osfhandle(dirfd); + + full_file_name = get_full_path_win32(hDir, NULL); + + close(dirfd); + + if (full_file_name == NULL) { + return -1; + } + stream = opendir(full_file_name); + g_free(full_file_name); +#else stream = fdopendir(dirfd); +#endif + if (!stream) { +#ifndef CONFIG_WIN32 + /* + * dirfd is closed always in above code, so no need to close it here. + */ close(dirfd); +#endif return -1; } fs->dir.stream = stream; @@ -569,13 +620,17 @@ again: #endif if (ctx->export_flags & V9FS_SM_MAPPED) { +#ifndef CONFIG_WIN32 entry->d_type = DT_UNKNOWN; +#endif } else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { if (local_is_mapped_file_metadata(ctx, entry->d_name)) { /* skip the meta data */ goto again; } +#ifndef CONFIG_WIN32 entry->d_type = DT_UNKNOWN; +#endif } return entry; @@ -583,7 +638,94 @@ again: static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off) { +#ifndef CONFIG_WIN32 + seekdir(fs->dir.stream, off); +#else + off_t count; + struct dirent *findentry; + struct dirent *entry; + size_t namelen[3] = { 0 }; + off_t direntoff[3] = { -1, -1, -1 }; + char *d_name[3]; + int i; + + /* + * MinGW's seekdir() requires directory is not modified. If guest OS is + * modifying the directory when calling seekdir(), e.g.: "rm -rf *", + * then MinGW's seekdir() will seek to a wrong offset. + * + * This function saves some old offset directory entry name, + * and looks up current entry again, and compares the offset. + * + * If the new offset is less than the old offset, that means someone is + * deleting files in the directory, thus we need to seek offset backward. + * + * If the new offset is larger than the old offset, that means someone is + * creating files in the directory, thus we need to seek offset forward. + */ + + direntoff[0] = telldir(fs->dir.stream); + + /* do nothing if current offset is 0 or EOF */ + if (direntoff[0] == 0 || direntoff[0] < 0) { + seekdir(fs->dir.stream, off); + return; + } + + d_name[0] = g_malloc0(sizeof(entry->d_name) * 3); + d_name[1] = d_name[0] + sizeof(entry->d_name); + d_name[2] = d_name[1] + sizeof(entry->d_name); + + /* save 3 nearest entries and offsets */ + for (i = 0; i < 3; i++) { + entry = &fs->dir.stream->dd_dir; + + memcpy(d_name[i], entry->d_name, entry->d_namlen); + namelen[i] = strlen(d_name[i]) + 1; + + direntoff[i] = telldir(fs->dir.stream); + + entry = readdir(fs->dir.stream); + if (entry == NULL) { + break; + } + } + + /* look up saved entries again */ + for (i = 0; i < 3 && direntoff[i] != -1; i++) { + rewinddir(fs->dir.stream); + count = 0; + while ((findentry = readdir(fs->dir.stream)) != NULL) { + count++; + + if (memcmp(findentry->d_name, d_name[i], namelen[i]) == 0) { + if (count + i == direntoff[i]) { + seekdir(fs->dir.stream, off); + goto out; + } else if (count + i < direntoff[i]) { + off = off - (direntoff[i] - count) - i; + if (off <= 0) { + off = 0; + } + seekdir(fs->dir.stream, off); + goto out; + } else { + off = off + (count - direntoff[i]) - i; + seekdir(fs->dir.stream, off); + goto out; + } + } + } + } + + /* cannot get anything, seek backward */ + off = off - 1; seekdir(fs->dir.stream, off); + +out: + g_free(d_name[0]); + return; +#endif } static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs, @@ -649,7 +791,14 @@ static int local_chmod(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) ret = local_set_mapped_file_attrat(dirfd, name, credp); } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + error_report_once("chmod is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + ret = -1; +#else ret = fchmodat_nofollow(dirfd, name, credp->fc_mode); +#endif } close_preserve_errno(dirfd); @@ -693,6 +842,12 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + error_report_once("mknod is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + goto out; +#else err = qemu_mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); if (err == -1) { goto out; @@ -701,6 +856,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, if (err == -1) { goto err_end; } +#endif } goto out; @@ -750,10 +906,12 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, if (err == -1) { goto out; } +#ifndef CONFIG_WIN32 err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } +#endif } goto out; @@ -770,7 +928,12 @@ static int local_fstat(FsContext *fs_ctx, int fid_type, int err, fd; if (fid_type == P9_FID_DIR) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + return -1; /* Windows do not allow opening a directory by open() */ +#else fd = dirfd(fs->dir.stream); +#endif } else { fd = fs->fd; } @@ -822,10 +985,10 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, return -1; } - /* - * Mark all the open to not follow symlinks - */ +#ifndef CONFIG_WIN32 + /* Mark all the open to not follow symlinks */ flags |= O_NOFOLLOW; +#endif dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); if (dirfd == -1) { @@ -855,10 +1018,12 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, if (fd == -1) { goto out; } +#ifndef CONFIG_WIN32 err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } +#endif } err = fd; fs->fd = fd; @@ -925,6 +1090,21 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { +#ifdef CONFIG_WIN32 + /* + * Windows symbolic link requires administrator privilage. + * And Windows does not provide any interface like readlink(). + * All symbolic links on Windows are always absolute paths. + * It's not 100% compatible with POSIX symbolic link. + * + * With above reasons, symbolic link with "passthrough" or "none" + * mode is disabled on Windows host. + */ + errno = ENOTSUP; + error_report_once("symlink is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + goto out; +#else err = symlinkat(oldpath, dirfd, name); if (err) { goto out; @@ -942,6 +1122,7 @@ static int local_symlink(FsContext *fs_ctx, const char *oldpath, err = 0; } } +#endif } goto out; @@ -955,6 +1136,11 @@ out: static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + error_report_once("link is not available on Windows host"); + return -1; +#else char *odirpath = g_path_get_dirname(oldpath->data); char *oname = g_path_get_basename(oldpath->data); int ret = -1; @@ -1024,6 +1210,7 @@ out: g_free(oname); g_free(odirpath); return ret; +#endif } static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) @@ -1054,8 +1241,15 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) if ((credp->fc_uid == -1 && credp->fc_gid == -1) || (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { +#ifdef CONFIG_WIN32 + errno = ENOTSUP; + error_report_once("chown is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + ret = -1; +#else ret = fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, AT_SYMLINK_NOFOLLOW); +#endif } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) { ret = local_set_xattrat(dirfd, name, credp); } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { @@ -1167,6 +1361,12 @@ out: static int local_fsync(FsContext *ctx, int fid_type, V9fsFidOpenState *fs, int datasync) { +#ifdef CONFIG_WIN32 + if (fid_type != P9_FID_DIR) { + return _commit(fs->fd); + } + return 0; +#else int fd; if (fid_type == P9_FID_DIR) { @@ -1180,11 +1380,14 @@ static int local_fsync(FsContext *ctx, int fid_type, } else { return fsync(fd); } +#endif } static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) { - int fd, ret; + int ret; +#ifndef CONFIG_WIN32 + int fd; fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0); if (fd == -1) { @@ -1192,39 +1395,65 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf) } ret = fstatfs(fd, stbuf); close_preserve_errno(fd); +#else + LocalData *data = (LocalData *)s->private; + + ret = statfs_win32(data->root_path, stbuf); + if (ret == 0) { + /* use context address as fsid */ + memcpy(&stbuf->f_fsid, s, sizeof(intptr_t)); + } +#endif + return ret; } static ssize_t local_lgetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_get_xattr(ctx, path, name, value, size); +#endif } static ssize_t local_llistxattr(FsContext *ctx, V9fsPath *fs_path, void *value, size_t size) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_list_xattr(ctx, path, value, size); +#endif } static int local_lsetxattr(FsContext *ctx, V9fsPath *fs_path, const char *name, void *value, size_t size, int flags) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_set_xattr(ctx, path, name, value, size, flags); +#endif } static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path, const char *name) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path = fs_path->data; return v9fs_remove_xattr(ctx, path, name); +#endif } static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, @@ -1387,6 +1616,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *dir, return ret; } +#ifndef CONFIG_WIN32 #ifdef FS_IOC_GETVERSION static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) @@ -1436,11 +1666,90 @@ static int local_ioc_getversion_init(FsContext *ctx, LocalData *data, Error **er #endif return 0; } +#endif -static int local_init(FsContext *ctx, Error **errp) +#ifdef CONFIG_WIN32 +static int init_win32_root_directory(FsContext *ctx, LocalData *data, + Error **errp) { - LocalData *data = g_malloc(sizeof(*data)); + HANDLE hRoot; + char *root_path; + DWORD SectorsPerCluster; + DWORD BytesPerSector; + DWORD NumberOfFreeClusters; + DWORD TotalNumberOfClusters; + char disk_root[4] = { 0 }; + + hRoot = CreateFile(ctx->fs_root, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (hRoot == INVALID_HANDLE_VALUE) { + error_setg_errno(errp, EINVAL, "cannot open %s", ctx->fs_root); + return -1; + } + + if ((ctx->export_flags & V9FS_SM_MAPPED) != 0) { + wchar_t fs_name[MAX_PATH + 1] = {0}; + wchar_t ntfs_name[5] = {'N', 'T', 'F', 'S'}; + /* Get file system type name */ + if (GetVolumeInformationByHandleW(hRoot, NULL, 0, NULL, NULL, NULL, + fs_name, MAX_PATH + 1) == 0) { + error_setg_errno(errp, EINVAL, + "cannot get file system information"); + CloseHandle(hRoot); + return -1; + } + + /* + * security_model=mapped(-xattr) requires a fileystem on Windows that + * supports Alternate Data Stream (ADS). NTFS is one of them, and is + * probably most popular on Windows. It is fair enough to assume + * Windows users to use NTFS for the mapped security model. + */ + if (wcscmp(fs_name, ntfs_name) != 0) { + CloseHandle(hRoot); + error_setg_errno(errp, EINVAL, "require NTFS file system"); + return -1; + } + } + + root_path = get_full_path_win32(hRoot, NULL); + if (root_path == NULL) { + CloseHandle(hRoot); + error_setg_errno(errp, EINVAL, "cannot get full root path"); + return -1; + } + + /* copy the first 3 characters for the root directory */ + memcpy(disk_root, root_path, 3); + + if (GetDiskFreeSpace(disk_root, &SectorsPerCluster, &BytesPerSector, + &NumberOfFreeClusters, &TotalNumberOfClusters) == 0) { + CloseHandle(hRoot); + error_setg_errno(errp, EINVAL, "cannot get file system block size"); + return -1; + } + + /* + * hold the root handle will prevent other one to delete or replace the + * root directory during runtime. + */ + + data->mountfd = _open_osfhandle((intptr_t)hRoot, _O_RDONLY); + data->root_path = root_path; + data->block_size = SectorsPerCluster * BytesPerSector; + + return 0; +} + +#endif + +static int local_init(FsContext *ctx, Error **errp) +{ + LocalData *data = g_malloc0(sizeof(*data)); +#ifndef CONFIG_WIN32 data->mountfd = open(ctx->fs_root, O_DIRECTORY | O_RDONLY); if (data->mountfd == -1) { error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); @@ -1451,7 +1760,17 @@ static int local_init(FsContext *ctx, Error **errp) close(data->mountfd); goto err; } +#else + if (init_win32_root_directory(ctx, data, errp) != 0) { + goto err; + } + /* + * Always enable inode remap since Windows file system does not + * have inode number. + */ + ctx->export_flags |= V9FS_REMAP_INODES; +#endif if (ctx->export_flags & V9FS_SM_PASSTHROUGH) { ctx->xops = passthrough_xattr_ops; } else if (ctx->export_flags & V9FS_SM_MAPPED) { @@ -1471,6 +1790,16 @@ static int local_init(FsContext *ctx, Error **errp) return 0; err: +#ifdef CONFIG_WIN32 + if (data->root_path != NULL) { + g_free(data->root_path); + } +#endif + + if (data->mountfd != -1) { + close(data->mountfd); + } + g_free(data); return -1; } @@ -1483,6 +1812,11 @@ static void local_cleanup(FsContext *ctx) return; } +#ifdef CONFIG_WIN32 + if (data->root_path != NULL) { + g_free(data->root_path); + } +#endif close(data->mountfd); g_free(data); } From patchwork Mon Dec 19 10:20:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076452 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96D63C4332F for ; Mon, 19 Dec 2022 10:28:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHB-0003Fl-Cp; Mon, 19 Dec 2022 05:21:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGl-0003BW-Hy for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:19 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGj-0007SZ-Je for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:15 -0500 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ8ML3I018813; Mon, 19 Dec 2022 02:21:00 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=KXtzgryUPbFK1F7ykYUTKpNRY2j/TZeYnB9X8WUxZLU=; b=Y90gTLKpCe1ZlCGyMY+tStM1TF7sTm5oigjP7o2DJkbrIkT86lfxU8duU5an6fIeVADv KHHLvc94lsBPE3boc1SHpGdh9Q73vdbQRqr8lSb3h4hKGLx2l/sngt1xBn9qTz9dY3Ni +waYI1d0PhAedLBzgPHPZGbHAKJZnfZ4fNV2mxtJ84YHFDVDOAgLL7cEHGWBnLcdG8jd bi/+oDYoTWJW7XFJAuBVEO9fhI/Tsav5csghIqT7iDVK9y+gwC7MZOXGzgteVCE39pEW V9+Dk+64VgyEcYkBhWdO6b/utvNgRFRKHBI9sSvKHxsrhQ9qjxXfIKUlK8dbcW5m/w6a tQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh9x8s77t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 02:21:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZG7Hdhe74ghxoTd7GAo/aC7QkCFBcAj7fUMZcxu718xr8DnMT/IRqgvGSoYE6MKGEg0N3wWzKMB3i5sKqyQU/vTCRy4BC5+g2DLgfM6FgYpSZjECsWiRD90Cr2uBn5vQo6QBe8Ep1xGL8LE+oOBOVh58oK+N0AcTAhuWShEH257JO5QkLfutFBx/zELD5L/gvDpPnTZSPx/WIbR6IzB+/8pr0woA6vDWZwQthyCY0Dx7rBVtaCDfLvc8VV6Eu7xLJEHZ3RKKDF0R9BPtADO9DwWE1//1oB1ys2KhJboQtK6d0n6jvpsMCOygG0u8uqAx8J/DArUt49GiVgWfg+2gOA== 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=KXtzgryUPbFK1F7ykYUTKpNRY2j/TZeYnB9X8WUxZLU=; b=fE02AngCgCZUfT0/K7bW8cKwURrrcTitHQggLB0rlkQAwO0UO8MiF5gk7hB6alvHL2BRcJubbda6VDN1ahuPoIIwxSdSG/OaONfuQ+7iUdmdhCSwycz5ZVIww//pzQOUABV6LmuyOBxY0uZnKf0o7YUidhprsFah7cf7qQqG8YZbd/qGG3HXriAgIW/xq/YT67e+ECWtDn8Zmyw143UAv6zo/v/E1r76nhbOArcOG2CONDhbjos8sZb037TiKLN3Pb5Wf7mCNEE8pU7en7OORsV4zgl7hU4W1sB94FM+XShL2Yac4tFaM5jqru5H/0J29x8JSYG9FNLPGZXHnBmVEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:59 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:59 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 07/17] hw/9pfs: Support getting current directory offset for Windows Date: Mon, 19 Dec 2022 18:20:11 +0800 Message-Id: <20221219102022.2167736-8-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 68f98123-1933-4356-7749-08dae1aab8ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c8Ah954EiayayUPzy5C3FsZ9N4TmEfc4pOIovn/Lk1hZUyFWVWrjM7DZCD6UryGN9D3/rlwYhK1kUwEhYpVEXchWa9KW3hxB584J5uY8+Uvhwiou64Grm8uJcNBcNFEPW4Z95uDAJPX4RBwoeiSzJre7SM3ZhldR4N6qrRw6iD+oPlSNrFMiiFJtnLl6ETXsh61E/uVJNkv7KsH6se3W0X6ObXmk/TKkCNJzZfU/KDeRqZkqRk2GKLSSN5aral+5KKtJqMIH5Yzg+wZDbwysvDO7AfBAZ0pUkFkdNhcSMIUnor5OPBe2oUE9KTynaYtQkQNyYZxkg9W8TmT63AJjytRgciYYpy6o5kiaIIALicCCPXC8hdfTc2xNaQvPmu7cHpbC/78zeQi8zz/CpKfLRMJg2i0VjQXEr8bZNjh1v9UERpKH3CUo5MM6ppZlekKCppLKoQYxOLfPj0ailgizM4UtL9sy5LD0c6yJ7hOZn/q88ah+HTCqhGVtlwzr6DPd72U4mVssZA9DUCbmAtM8EgqRdpQ6IIbjx7Y7VHgzm+8DBDXLuYnPsDglD6Dn6/37anRP9h5k8Zinlk8uv6muAYJqqwfEWz5yaw/m9rPDdBlJ8gIHkT6Lc0FdPr0UdipPckZBkZJLzyFvFcK3RJoGPSym1Ww5kRdm+AN+JIHtdwuq6eA2jWLU2dF/rSmyntUtuvVFd6bHEODqLW/92+01cg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f0aeBEj4D4OF7QxWw6hZQppu/tgYDLZxvY0rFCJLyTfYDWU7yawjVKBzkh42vM+JR0SfK9IVIIbBH0FD9/ZdOPQWfjFdTOvZ63iloxaO77hy1wip8jsuqOqnMaEo/9nTlFRdKRB2z49bjpANw8OUmTjFrQfGF12xebwMBEIF2qnAMIEvNu+mA8jqhlLtL+hHRwaP5GcFfa0wcvKaIYNKIPvjqfWkLkJ/vxso1P5ix1Yslv6zCeB4eodhKF/HsAwn18BjuqTZP94YuJ0B8TJOKXqlK3lUoBdp2/HKToykX07ebf1JOr8NmWJjD+Q+ZgYoo0WHpgBUPifA95aTQASmUYdfPzj4jTkajXwGSxYULkiGEgUelRZ2md9O3gczwabnja2S9/z6CvC0ZSNMT15QtGqewq4OLoj8MEqjVXg5fgHIgn45UlqzkUc3tyzFo/PnKy4NO6QoP445X3TQ9PnqSwLCOIXNQkcfKaE2BQ5YtyaKY1QDmpyFFOYgwyP65hCcq97Ho0kkfWgocFSsY5+vVOSeMW8cRE5KGL3afbS46GBHYFYt4zGBokw1A33L1pnsPYE28i3nrqkvpcWqZmZgxbUzdj07/s0+cZOyTGoG94bGP2Msg1zqrcC46aH9qXuulMwJ5fdxXZ14Pm4HDp60KDlTixAcckj/3WxRDHqA8vBhLKDXWbe27uBJ3tjWpxS+OW4NLxlc0YE7+Icot7Mu+0OO64qpQf05TYJ9qUULADoxsas0DQrJanA8F32YKdxleYMPDzz0uP5wQnkqusVdbR6Dd8Hcr0Vn7h8PYokFjnzyMWEk+fc+LvwtjVyTFIWXV2aZoTQl6k6RFw1jXsg0odS9oja7/OxpZZrLqeMaCxJbO21Kf+kc5hLsZLZYHnNF8vmDWFevb5F3i8UwaWHDhjxgiiYk7VVK7shsnkMMU+eBXMZBUbWJYoL9AbTlstNQnPgy2njv/tAbKrhrGwd8s0gdBmp10AhGKu8WB5r3bkE217gcpbfpDbCS1e8vys7fl6IofcWx2AIFr0O/suwHVOmH42g0TJZQ3EPjwnWYSw2OqcnMq54uMVXwUHNfjKmlxfOW9E9cAeH6B39BPsA7UNhJS8WNnp1h4DWYVbpi/R+F0j3AEbjRyJjjRfcwA2zeKZtJVjkgAwFTgnEBArD4QQHJsTbawuDmoRpaw0FGbZhCTdPzPSQYHs0SZXPyRBXRO8nPp2+pI+RdRKNwyOkRb06xzHEnCkwK0eN1/eOohzzszN3c9ka5uhKipDOlw4+gyy3WhWa0yPSQRTE4+f+bHYXXn+ZBm5L5RXM4SHPakveADr1c/AeymMw2jtOL484xkqLueqPEyysP6Wg8pp+3K/43EG1xZizcDTlahhocbz4jU/Fvy1+W8joKXtPKKvvHixt5eD8Tb9ziKSc9Wc7mNlhnCZPNkIh5zLUwM3hEoaiD5AZR7U0BZ+Lu1MxSe1A3+cxJDWAoPupN8WL2f9fyI6mYsGUCOFAQOgomYSdhf49psP0/OqZMWhjPEPw10XX+MjNJ5/yOf4cHNTK4rpZRapUvucu44C6II4MP5cEJLLiT971tP1RE5SGQ1MaTa9K8 X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68f98123-1933-4356-7749-08dae1aab8ba X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:59.1291 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mvHSYSmdShcziDv4pyOZZfqF15ohueuI+491pSV/q+gAMVUuZyJOclmB+e5vIIEFmJnNDMiNCfp4Eae3rjECfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: nMvP7Ywh27j9fnAzobaRF9MOSXxx8-pm X-Proofpoint-ORIG-GUID: nMvP7Ywh27j9fnAzobaRF9MOSXxx8-pm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi On Windows 'struct dirent' does not have current directory offset. Update qemu_dirent_off() to support Windows. While we are here, add a build time check to error out if a new host does not implement this helper. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-util.h | 11 ++++++++--- hw/9pfs/9p-util-win32.c | 7 +++++++ hw/9pfs/9p.c | 4 ++-- hw/9pfs/codir.c | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 90420a7578..e395936b30 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -127,6 +127,7 @@ int unlinkat_win32(int dirfd, const char *pathname, int flags); int statfs_win32(const char *root_path, struct statfs *stbuf); int openat_dir(int dirfd, const char *name); int openat_file(int dirfd, const char *name, int flags, mode_t mode); +off_t qemu_dirent_off_win32(void *s, void *fs); #endif static inline void close_preserve_errno(int fd) @@ -200,12 +201,16 @@ ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, * so ensure it is manually injected earlier and call here when * needed. */ -static inline off_t qemu_dirent_off(struct dirent *dent) +static inline off_t qemu_dirent_off(struct dirent *dent, void *s, void *fs) { -#ifdef CONFIG_DARWIN +#if defined(CONFIG_DARWIN) return dent->d_seekoff; -#else +#elif defined(CONFIG_LINUX) return dent->d_off; +#elif defined(CONFIG_WIN32) + return qemu_dirent_off_win32(s, fs); +#else +#error Missing qemu_dirent_off() implementation for this host system #endif } diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c index 7a270a7bd5..3592e057ce 100644 --- a/hw/9pfs/9p-util-win32.c +++ b/hw/9pfs/9p-util-win32.c @@ -929,3 +929,10 @@ int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) errno = ENOTSUP; return -1; } + +off_t qemu_dirent_off_win32(void *s, void *fs) +{ + V9fsState *v9fs = s; + + return v9fs->ops->telldir(&v9fs->ctx, (V9fsFidOpenState *)fs); +} diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 072cf67956..be247eeb30 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2336,7 +2336,7 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu, count += len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); - saved_dir_pos = qemu_dirent_off(dent); + saved_dir_pos = qemu_dirent_off(dent, pdu->s, &fidp->fs); } v9fs_readdir_unlock(&fidp->fs.dir); @@ -2537,7 +2537,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, qid.version = 0; } - off = qemu_dirent_off(dent); + off = qemu_dirent_off(dent, pdu->s, &fidp->fs); v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c index 93ba44fb75..d40515a607 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -168,7 +168,7 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fidp, } size += len; - saved_dir_pos = qemu_dirent_off(dent); + saved_dir_pos = qemu_dirent_off(dent, s, &fidp->fs); } /* restore (last) saved position */ From patchwork Mon Dec 19 10:20:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076460 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0CB0C4332F for ; Mon, 19 Dec 2022 10:30:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHD-0003Gs-Aj; Mon, 19 Dec 2022 05:21:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGm-0003BY-JL for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:19 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGj-0007Sb-QQ for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:16 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9dUcV026145; Mon, 19 Dec 2022 10:21:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=rUPnDVFwWRPcTdt3f7ZLadQvvwIT0QOnCyIbXSmVOeA=; b=nH4aMrcj+jy58+/ZKq3bP4fyWyAMeKcRGqbdBVy8WmAm8ay767Z8LosrA5RhXYp2T30T RPZwrcqanx1yFlaTZ0WqkgvUMQQFmlH0SIMP1w7qJ1PvTP/04kbuI2rNQE/ooLTv8mw6 Uoyl/swTMHVChGQLfIgKE2MgohNAa7unujqZ0ZRlEKwcs6QyDRHSHgZZLi/juh4MLsTC 7c7IgrN4zmV7/CYhnjs/ojQBZYz0dZW+MQG6ykwNRQr9qExzz6Cvyn2j/kyA1+5+B2oF //2E5H1KAd7Egk3mu4sZ4DHAB23u4+jbu6Qw+CyHzqsgccoql+ZxrlLSctTnwJZa+frN iQ== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b78-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Juy/j7XJQ56NhperjWrbJbm1dlUHzdFnuBqbmS/ogoGqiR6KsUH342anMvu5hnrypzn26UR82Dy5XX8X4NihMnW1WSMivRJnevbtHQIA48Bux4DpPbIfykdG4gvPvyH7hJRQd1FipbQ1IV/60shFmLypN0DDwScowhPmSA08qUUZ3aVD1DeqkRzPm4zhRYR2sRi7nb1wCHqzGQBGnzB+l1V5XR1fufOuXCGbiFng6T5kLNJh92dcGtFlGItVcWO63RuNz7XR0rbnHwofIVirBwjd7wut5KpZ9aX8gLgVDSF7C/TlZlVzFnG+z9MWOYLOaJ//p/72YHnbt7WjZ7j/Eg== 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=rUPnDVFwWRPcTdt3f7ZLadQvvwIT0QOnCyIbXSmVOeA=; b=Z1l97Wqowzr/wdK/J4EfUdX6OUUOJOJ7/yyyUmt4fCzDFNxfS3ORbm3tWjDBVr6xTjYQttNyd61y0NMVR9LufufP+FeklAc+say4u+cqkzW00KTtDtYaKjZbBMtk27dEm64ewR23EB7v2o+WDYYRQF6et1iuFRMi/U2WW3nLzOnrjVlDjDMPV2mu+QFb4pJl4gG07mfb9Pl1Oam155wi8QtWAELuuH1t07KOsZp65cdF/1hk/DT/uKA/9SRrt8Z6fjL4i9jeh0V2m8XP47XZZJgZN7UyWmkFCfdvLgl2c3HckyccxUOlRrUdSsbMihhaS0GiPCwHW31hpsMv6/M0sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:01 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:01 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 08/17] hw/9pfs: update helper qemu_stat_rdev() Date: Mon, 19 Dec 2022 18:20:12 +0800 Message-Id: <20221219102022.2167736-9-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 75e5faf8-1eb9-4bc7-e708-08dae1aaba19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vb7/+gkmRZUev/PvkGUuOuw9h6IauIWRkKDqrbDVhDUX9EvkWcIYnJ4bcWdIKnS+P8cJHw/D0qiMY4AbHBTGIGzDsbPV9vw2zr55pxWpRX8AW3OyqLLig69M7WbT0vMR0DdYyXEK2xrh69ZEFYnDTbMrl8X8wmS1+pzavBgleWS5vVazQCNHaU5ghlGUhXBcSoxTYN5MrpD4LyKHmyUfp94M9FTJzvtdACvB4kcbGLxXVcV5wkBc+XxJbAxtMd4rjrSfsyKAKZiGvY4awVDgutYmfUriWBBjv4oJBnBbjDbs4UeiOrLeE/sfB9MY6VsL+UFJVBaPGFglfBdel1Hsb7AKs3czTEwEKDZ67qWk0KNIWprg/xlLFMYIT9wm52yiPPhRHI7I19AYhG6FhESmDLOI9ewzhTExVEasGKxCUveayAuuOos0Kontaa/F8BhgGqg0usAmG5LOgrHGxs+CRGpFy9k+cMGZTKUyzfi8nOaaGq1dV3Y6Wd3MyVZVkmLRC/yEMgKtVuDrcren/hMpIj/oD0y3D/NBTwFBiDNtCRF0i7mulyWrQvtcPC//At5gLuMOEcrNb8iAgm5qiid+CY96cVI75UPf7SN/eJNuSmjtIhgPiqe9w3E7QO0rPy1BDs9vKanH8S5EO4o03OC0ulAHymTmrf82QbPdJG/7ulTzZoRN86fNgj34wXlxXg4n X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zuQYj0+HGqZiEXpb9RvKZ71cMsKG+a7Abk4uQ8bESj17NStfR4cs5XLJbUYK8bGmMipr8jRbvycU8EieqVeUcjgGfOPsnckUXUCQsFckQPjr1BRBLLKdSSDhAfZOIp8aZ0wiCLnl2ZqPNYa3vc45bv/qjwsTzbnidSajmwGpMTeTycc7Ycq9BIsDKhanFlj0ki24Z7PI6iqNDlgklmsMWG5Mjczjl4XlrQ1Q6UEAAhyrQB3iFw8OxakhbhTBo3Dmx/nj0aNja9rSgXWCSkUKxosW4A0Fw4LQ20ni5gR+sCK4sjyfnqvc4ovVAxHKBsCXEIGi+fVLqzSLaSYGuGKBNAa9zDkje1Vq3cWk1MzaO4oI+7/rNqqOnlKhrai4yt9xw2Ul1tydhkdRiPPtsiYEcfKOFA4b6ajk+OACw6UdemgLH9F8/TjhycZsuZD69YaHe6+cMn6Q16pV0uqgFi32d9X+UkuPZu5FEGgUvkXRVLxrjHfaJUaGG1GKGNq2deDOQug6mXKcQYzNEhyN1wsL5PBu30wWH/BDs1Jprt2ZalM2haEMJEqlqJsCGfLSeppkfvn95xC4K9u1uvjUaeCFky8V4FjZyJDocbGa6xpNk9JQXlnIq4gwCrKE6vKnAXl/z5omByU1lQXmjCb5uAZcf1H31NxMYzpsVrrwy3rx5+2+PMb1zSI9hNd96T1PnoBPolNBAJ451wrJ9mcEkEsCFkICQu19Rr0ZQAvrRXPWXCVJIORrR1a/zDIt69YKOu9ITaNL67sEzFDvMPhcVhahKaE64Z3dRZ67TECtfqaja9L6/FYD66qHtEBn6o8vQcIqXQEDmTByJvCjrEb+i1EzsVs73EzhisXjJctPaOd3Mmi1Lv9SfBLsy6gJoaDWtUVVxzwpJlIvzEGFXaAaAFaVSknNswgEb45/uRryF5dVplG3RzOvJbrpzxQLYZNyubc711S+u3ugj2Xa/IEbjRREtenUxPt+V0EVjW/hv8AzGNxGFf+2X2SF8VItnlz7LIOIuctUCQ/tge/dV1e3sQY8BkLcraJr364wxHrB3aAH4OGibyJ+VbULVz12Hl4lergNdVbhCvcFX/kPmx2wY7G5rc2bTB+8VQ4HYOPG9iB9cJ74hTSTBDOM6GWuJ2FfWduMT1NviMaXYQ4n+HSPuxirBoxcE80Je8ZWVtIjvZEiIujuXCFgKtpZ9MX/qBi5U97llfCVzckP4lTpA+CcLtjjurjnzQoY6HJfXgUBsc0lL+ZDCRhpQAanoDjhCv3QhA1u80Op87mqFR2WmeW/29/oE88tqvnRrmlgYRz9MRDhWVig8KvUdQlBIETPNrHDEpstjF6dZWkKjeeWLuW2V3/JgawxCce3BpOBewFPT5ZwfGLDAGa+9uVkhWMrmrCJjZZaTra0TEwsspqtxXbx0TS11JI6/vLFZ20OQLvhsJQQesy68CIrJy9LWURluhAlncRUbS+DxRUiictMKA3HX6bY5EqGyz4CZsMq+36lRJ3g8va5tNXY4K0POtp0wr9y/WTcLPlnyeeeKJQ76vATdSFEO6gSVJ6R0vdfy/xNeH4QgQYFqEldK+wUHZBaNGFZLusT X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75e5faf8-1eb9-4bc7-e708-08dae1aaba19 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:01.1014 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RJGs3g3PTptjCBZnMEQc4MJhz+qp4iyUfGc5TnXmbGSeMw2/mU0XOJ8rkkgsNPvuz4/S4gQBsZmj4VD+TeNqwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: EuwFioBB5vyWFygA-ZxFa6rivaCbjd3a X-Proofpoint-ORIG-GUID: EuwFioBB5vyWFygA-ZxFa6rivaCbjd3a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As Windows host does not have stat->st_rdev field, we use the first 3 characters of the root path to build a device id. Co-developed-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-util.h | 20 +++++++++++++++++--- hw/9pfs/9p-util-win32.c | 18 ++++++++++++++++++ hw/9pfs/9p.c | 5 +++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index e395936b30..b8e5c037a2 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -19,7 +19,7 @@ #define O_PATH_9P_UTIL 0 #endif -#if !defined(CONFIG_LINUX) +#ifdef CONFIG_DARWIN /* * Generates a Linux device number (a.k.a. dev_t) for given device major @@ -51,10 +51,12 @@ static inline uint64_t makedev_dotl(uint32_t dev_major, uint32_t dev_minor) */ static inline uint64_t host_dev_to_dotl_dev(dev_t dev) { -#ifdef CONFIG_LINUX +#if defined(CONFIG_LINUX) || defined(CONFIG_WIN32) return dev; -#else +#elif defined(CONFIG_DARWIN) return makedev_dotl(major(dev), minor(dev)); +#else +#error Missing host_dev_to_dotl_dev() implementation for this host system #endif } @@ -128,6 +130,7 @@ int statfs_win32(const char *root_path, struct statfs *stbuf); int openat_dir(int dirfd, const char *name); int openat_file(int dirfd, const char *name, int flags, mode_t mode); off_t qemu_dirent_off_win32(void *s, void *fs); +uint64_t qemu_stat_rdev_win32(void *fs_ctx); #endif static inline void close_preserve_errno(int fd) @@ -244,6 +247,17 @@ static inline struct dirent *qemu_dirent_dup(struct dirent *dent) return g_memdup(dent, sz); } +static inline uint64_t qemu_stat_rdev(const struct stat *stbuf, void *fs_ctx) +{ +#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN) + return stbuf->st_rdev; +#elif defined(CONFIG_WIN32) + return qemu_stat_rdev_win32(fs_ctx); +#else +#error Missing qemu_stat_rdev() implementation for this host system +#endif +} + /* * As long as mknodat is not available on macOS, this workaround * using pthread_fchdir_np is needed. qemu_mknodat is defined in diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c index 3592e057ce..54c10069b9 100644 --- a/hw/9pfs/9p-util-win32.c +++ b/hw/9pfs/9p-util-win32.c @@ -936,3 +936,21 @@ off_t qemu_dirent_off_win32(void *s, void *fs) return v9fs->ops->telldir(&v9fs->ctx, (V9fsFidOpenState *)fs); } + +uint64_t qemu_stat_rdev_win32(void *fs_ctx) +{ + uint64_t rdev = 0; + LocalData *data = ((FsContext *)fs_ctx)->private; + + /* + * As Windows host does not have stat->st_rdev field, we use the first + * 3 characters of the root path to build a device id. + * + * (Windows root path always starts from a driver letter like "C:\") + */ + if (data) { + memcpy(&rdev, data->root_path, 3); + } + + return rdev; +} diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index be247eeb30..36916fe581 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1266,7 +1266,8 @@ static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu, V9fsPath *path, } else if (v9stat->mode & P9_STAT_MODE_DEVICE) { v9fs_string_sprintf(&v9stat->extension, "%c %u %u", S_ISCHR(stbuf->st_mode) ? 'c' : 'b', - major(stbuf->st_rdev), minor(stbuf->st_rdev)); + major(qemu_stat_rdev(stbuf, &pdu->s->ctx)), + minor(qemu_stat_rdev(stbuf, &pdu->s->ctx))); } else if (S_ISDIR(stbuf->st_mode) || S_ISREG(stbuf->st_mode)) { v9fs_string_sprintf(&v9stat->extension, "%s %lu", "HARDLINKCOUNT", (unsigned long)stbuf->st_nlink); @@ -1346,7 +1347,7 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, v9lstat->st_nlink = stbuf->st_nlink; v9lstat->st_uid = stbuf->st_uid; v9lstat->st_gid = stbuf->st_gid; - v9lstat->st_rdev = host_dev_to_dotl_dev(stbuf->st_rdev); + v9lstat->st_rdev = host_dev_to_dotl_dev(rdev); v9lstat->st_size = stbuf->st_size; v9lstat->st_blksize = stat_to_iounit(pdu, stbuf); v9lstat->st_blocks = stbuf->st_blocks; From patchwork Mon Dec 19 10:20:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076454 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFDEEC4332F for ; Mon, 19 Dec 2022 10:29:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHE-0003IY-Mx; Mon, 19 Dec 2022 05:21:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGo-0003BZ-21 for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:23 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGl-0007Sw-Kw for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:17 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJAECTG003542; Mon, 19 Dec 2022 10:21:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=JiN1VhiqfcVIjGVp/gcgMows6Q3QhyKARN3vrouX3p8=; b=VB68/nLluG/fLPY0nmqCVMHCpiCq0eU7aEx4UHEz/0ttBvtcMImiA/+eOpZ8rgqPBvTr WoOykhGzvpJ21dSTPd1IQDQmhLXM6Gt7oKjYc58iyRCX7v+MMTwkvq/aM6vJW30nZAD/ WfXJy4nujTcUBSiG7MvLF3q2hZj7wJdCYIAe80Q7wYDE3Aj4vAtmudKRBxipEzZfE+Ab CO+sbyJrbxIdDhKQc6679ahKZw022xuSvqNzi4FlGWfVmLzCvvqkqgaJa4QDXovdPKkX GBQ0Fd++Qmrn532/ZJLFr01suLahcKIXM9u5IfOKqVeizUnJUDNcmJd5J8kJ0wz4ymGw 8Q== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikud2iI+K5i0w6Yjl965a2nLXINyWe6L/nc7aRwTW81E4QAHuDejuILuqhpOZgXZjPE7Ml1NRa5Sw0lICbp8OiPUK6JvMkDY+/U6kq3GQImHjL+KQ2fDaxNeLDIsBlW1CGqcGZcJVFWfPVTbtk0Tv4D7NLQ2wKHFvNa/s8aeJVVVBhBYkjqLA5PSM1tYTNGbFOQnMSoH1M0gUceRz2WAtM5Jvl/SKcXtfEJA4dpj5Rt9ndLth31MEoBLYtNT8M5SPbpoRZyL02TI45BA8vwCv1SptCF+eM7WKwMO+DGkvRRtLIDBMUstEVOoH0sCNyKN/mTzjRtvXzmOXftMfyv2Iw== 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=JiN1VhiqfcVIjGVp/gcgMows6Q3QhyKARN3vrouX3p8=; b=RkZmBSa8jOmBN6YYUhcUmF5sWp/H6XNmenziE7rr/KVyCXA08rhcEsXrItJg9LmAAojEdmBeyGzU0bxAR4Geck929u3+z9U41gm9BC2tyGdlmnGdCLPW0FMDi4U170Xl5Nyj1TxmV+6fY76Luwu63cuL8K+jRR5DsWWt/ooItmGnzhf+fkrr5Lo47yFWyNWWF1togIwZN6Wk350MBTkKqnE3H+UzSdI/KOLXTWHc5iNIaezdZCSg6737kzkMKikI5ABy0vjtxapMe1EiCBUQPdiRkiTyuf3hMG5g8DOMDuOjcFluyzsqeZO8FjT4c4dWAZLEV1bbhZm7Y/UVrL6pnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:03 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:03 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 09/17] hw/9pfs: Add a helper qemu_stat_blksize() Date: Mon, 19 Dec 2022 18:20:13 +0800 Message-Id: <20221219102022.2167736-10-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 07bc7935-0098-4240-dc3d-08dae1aabb48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dnjjdFss78Nmzm8yOZ/Yi9cQXwqIN8WOwNBzpMG2jl2glqn0LPmtM8teHj5BWYtVKMi3jbB0y40oClh5tOgSHBQ4r53eq5mFpAnmf8pM9efEMN3qge+UzYGAKCt4aOJacHRSOyQjd0tcXCJ5DRAU7KftJKh1mZetsKRqiziaER449FUp7Mv8LuSHLA9WbInWaa/alqIo1+5V/3CgnPv2qyP4oioIdiCKObF1OfKL+vUUmSOjoMhaWtrk7LTDqZUXLtYgcLA6Vz6VMY0pRiEPy3TbWL/4PVRzU9qUwPq/1sAudmSOP/1FWQzKaeBU/ROZaNWY1/cCWW3ab+qfpaaGOqK4E/F3RaE9OyCAwrG/yS2XSg8+yPcg89jVFWIj+hPdvTeheMUhZP1neQjaULsyn/Grc8sGqc9t007DntOaESbjlQqMAo7X3iXl3njHyCf58yKLcIauNdxhwPSvSWgYWkh4Hqp8qkJYdHo/+bjt94gBdf2Y797XVAcTIbx5oZ68slqn6RqY7MmGbYyHBlYvlZzpS61Q6VPKTjvkyP7Jo6Rp9cQdYlDI1/lWCKsvskEQH+fMO2OAI0fN+VRDwKmpFv4o42IK6QgWr244IooXrFOtiofC/Bzj/VcN+u85wxbLAg1h2ws7OePY0waKUeq/4oDOD9YZigoakDm5FN+Y2zXrxNGr3cjr9LGck/Sk2/3tYP41GgWRXC9ewnFCsDIGIw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fnffA+bYNZBZH8VwV178o72l8aYecEPzjNvgeQxDCJIR35kD3h2JDaAbK5WSAFXprGiuk1pLQfjEy1rtdry9OPsehwGzgLi5uXYCtv73oaMylLa3WMzqLd8l1iI9zmXzwaHTAnQMo8MnhuCHlR0hTHz+8G1mQaVQ9PCNnKbbXJUNB+rBQWDPSjgMAOVFyFGWVSjj7iq6AHa3gR8u3Z4xhI9357/pSvxHx6ykc06ZzNqBek9xKXYBBBDREuUb6OjvRaTet5Hes8sQstH+khW3dFWPYjud1ciNA6NZdbQrtpSyvnSkAtz8u5tjLJrnZFF+31Sptizx2JjHNQLhhNUQ7k3aUPIjQnW13anC9HjPJaU0ErUg4xvba7/VZUGaeZAUKYN+mMySRIf4/D8Z7n6R4+eh36pLNw/G8fMh1THm5ntrR33p2Oj5dLHloPCpEBA6ySOwBD5H9PezgSnIIYvpKr5f+G3Aw4mPSXO7ZAW1HHztVqcuTa3NzxwvzpCtKnZvR8lxfOkzmrd0Q6ErEDGLcIk+U8sl1j7aCNCa7/77yuRmPFAGh7q1fW74xWTlu6eqM0xrajpFJVsTzr21Vk6eb/84gJfmPImcHauqME564E/P8CYajBecz98zejh/q9uLSgSNPwiDUe0UV3gEZUk+StMTwrSg/l8NfmCEbUcJiHGDBQqxeEZSQY4vOEAQ6nsCIsWyNDEH+lvBr4qc6NpaZqUhqOf4gXA6n6SHnZAypRpnDvPzdDgAzsCVQa+E/zXf8W1DMxxf3z5mrBJ3+hAvmEujcVsxmzuw0DTLOxFaV2EqNZrR7V6TN30ESPKMErXDrno7YDhULAXO1cjH9elhLAZJYegu5Nk2l83kp+jVS6JqBy/vniaO+kyw/xpXmJwgMfkahnSvhoHYWbLU3EqSnwLn+h1m8z7bMHsVVAGyJlH5bbtlazqSmWZFicGJ779c+YfW7aOxd4XBy6FXpRaP6z//GKqp7zE6ZKX5/+S9txUBUeTWt0zw8HRpPvVA15TLY7r9OEnUC5KUNdcIZAG58L8lnmTFspKl6p6rpaaJveuCjMnTEEqonZldD29NaHdJ9qQmYapg/w/6kXCShYqIn7KJcjZ9a8x77kSay/Z297OewIIGfqKoYhl7GwyAS/f/cJvlQUnP4wfGIUs0CEWIJMxUxFSpgIuTWl4v0CI+KK8hfgoW/GYIfZhIX+qZh1kqjsRVv1DXeUcZL5Ai7zm4qT4dq2BD8MAa5nbF0ncVKn7qrTfbMIfJAPdxzT/uKyK4lR/P2K1Jms5Ak9crQQ87Ed1Xpp8pfmKF/YsnzKAJb8KOMjoU0r1ZBlpqtWYp0uyF3RB8gXv76SFo2teQYJW4uEZMcKAbXhSClivoPyqJ6g4hAqRKrSJOd8TruHRtitVyV9dIrNeWMKWrihP488tnS5Oz0ek9tLCCcn2hpeTfvaprPkRDf1VhRkKPELUd3Bv5OPkiC6O+TywsVXI6XobT2W0ioxMrnZFz1ki21Ic6CYNTTElaSd8hhCkO1ZNEiuQggdNVuOVtp7ZDDU7aLpNkJNxEZHJQw3aEpfUD/sG2e84Vcv/36sNE90TpB7ahOMIq X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 07bc7935-0098-4240-dc3d-08dae1aabb48 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:03.0713 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L7X6Yusq7PrAyazKAwE0E9ZAIscOwbJkLxKFcBXl4H3xLAIpRO25Av8nLeYDY0kRI1ueD4slSiMeXuoiEY7g8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: At-AW_3KR023UAyz_rJQxGSWzjpgCtk3 X-Proofpoint-ORIG-GUID: At-AW_3KR023UAyz_rJQxGSWzjpgCtk3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org As Windows host does not have stat->st_blksize field, we use the one we calculated in init_win32_root_directory(). Add a helper qemu_stat_blksize() and use it to avoid direct access to stat->st_blksize. Co-developed-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-util.h | 12 ++++++++++++ hw/9pfs/9p-util-win32.c | 7 +++++++ hw/9pfs/9p.c | 13 ++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index b8e5c037a2..ff16e74f5d 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -131,6 +131,7 @@ int openat_dir(int dirfd, const char *name); int openat_file(int dirfd, const char *name, int flags, mode_t mode); off_t qemu_dirent_off_win32(void *s, void *fs); uint64_t qemu_stat_rdev_win32(void *fs_ctx); +uint64_t qemu_stat_blksize_win32(void *fs_ctx); #endif static inline void close_preserve_errno(int fd) @@ -258,6 +259,17 @@ static inline uint64_t qemu_stat_rdev(const struct stat *stbuf, void *fs_ctx) #endif } +static inline uint64_t qemu_stat_blksize(const struct stat *stbuf, void *fs_ctx) +{ +#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN) + return stbuf->st_blksize; +#elif defined(CONFIG_WIN32) + return qemu_stat_blksize_win32(fs_ctx); +#else +#error Missing qemu_stat_blksize() implementation for this host system +#endif +} + /* * As long as mknodat is not available on macOS, this workaround * using pthread_fchdir_np is needed. qemu_mknodat is defined in diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c index 54c10069b9..07e1fcc4f1 100644 --- a/hw/9pfs/9p-util-win32.c +++ b/hw/9pfs/9p-util-win32.c @@ -954,3 +954,10 @@ uint64_t qemu_stat_rdev_win32(void *fs_ctx) return rdev; } + +uint64_t qemu_stat_blksize_win32(void *fs_ctx) +{ + LocalData *data = ((FsContext *)fs_ctx)->private; + + return data ? (uint64_t)data->block_size : 0; +} diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 36916fe581..def85a57fa 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1335,12 +1335,14 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, int32_t blksize) static int32_t stat_to_iounit(const V9fsPDU *pdu, const struct stat *stbuf) { - return blksize_to_iounit(pdu, stbuf->st_blksize); + return blksize_to_iounit(pdu, qemu_stat_blksize(stbuf, &pdu->s->ctx)); } static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, V9fsStatDotl *v9lstat) { + dev_t rdev = qemu_stat_rdev(stbuf, &pdu->s->ctx); + memset(v9lstat, 0, sizeof(*v9lstat)); v9lstat->st_mode = stbuf->st_mode; @@ -1350,7 +1352,16 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, v9lstat->st_rdev = host_dev_to_dotl_dev(rdev); v9lstat->st_size = stbuf->st_size; v9lstat->st_blksize = stat_to_iounit(pdu, stbuf); +#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN) v9lstat->st_blocks = stbuf->st_blocks; +#elif defined(CONFIG_WIN32) + if (v9lstat->st_blksize == 0) { + v9lstat->st_blocks = 0; + } else { + v9lstat->st_blocks = ROUND_UP(v9lstat->st_size / v9lstat->st_blksize, + v9lstat->st_blksize); + } +#endif v9lstat->st_atime_sec = stbuf->st_atime; v9lstat->st_mtime_sec = stbuf->st_mtime; v9lstat->st_ctime_sec = stbuf->st_ctime; From patchwork Mon Dec 19 10:20:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90E9EC4332F for ; Mon, 19 Dec 2022 10:38:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHQ-0003LM-6j; Mon, 19 Dec 2022 05:21:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGs-0003Bk-Hp for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:25 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGp-0007TR-7j for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:20 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ8ll8u020840; Mon, 19 Dec 2022 10:21:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=g563yM1dO4FRXYmwgQzW4faqLmoq9XWY38e28zrZGSA=; b=qlC3hDvYWIO6TWF1cYa+P7Yyo8gxH/+TAODVZH9YF/uK5XdqoAXM4maqmoJUlZYHpIJE tS8sxPKuoRsUSVN8UZaEJd/GIagLOUNgWPcd9oEleJy2w20p9kbv38b7NzPQKoMzNYvL kBblcw2o3zAuYgH2O6uckBciKzQIA95QEUg7xkyME/U3qzCaRrw0eCh348L7ejPQD8j0 zfCZAFG1UxbIzM0k4qMsLPXVpnpDnjnYymbtAWC/LcpRWUFCUrKgJdIjPjiJBqhKLz0S YJSdj//UdaG46MIUtCM2UTMP7S4Ze2dZX0jvDTXGbBt0+0hVo1teC+CK9iduTOB6t6Wx 7w== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JmNy2noqtjiWNHgiwidlHaGxSnmPVng68gPZBnFjuRo8PPYfuF+oF8FwU3McQgvWPux03Xrexy1dx7/Ml3hi7cHWqcfsKRLXoqxj/3j1P5In5YbWPiasMGwR9UKUAVcXk9QLzBdEkIdHa/9EAH2XlxuM4iu0HExyMKNdycXcU/tzvnwD6dpcSpgRt7VcSRSwOTJ33d67lFPGCgrs2nT3WeQ/G7cJ0DVl5C/Rk78HNXRlq/cXwsf2BeA+E98JxY6xUQoTlWskJGI0mrD+582AvwBACWrekRoV9o2rJYD4BwR1Sycl6bW6WxH/CZd7FO8rDoKPz3lYpMdhKRxuBghcfQ== 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=g563yM1dO4FRXYmwgQzW4faqLmoq9XWY38e28zrZGSA=; b=iiGok9pHnLDCovqegroNFIQ1aauk18YjEV0oPjcb/acR6Hntsvkki3Mcdkf8afTi2CkA+8JTqzJFtyds9w5u6JGc8rFIuVlVEuIuGF1ig4oPcFf8tnZkrSyUwNYUqzgCNY6YsXUTGKujwqKzj5+UJbiIhrMX2Dw/RPFSwOgY4Y3DHDUoM1BNcjnu8dzkdh0nIaEZ0CfLCgcqdmpucBT6EhfBDUOLmkeI9WatNN+CT1hWGcUfkC8xmPD7fm33SdaGfzhylnt1qjv7W1EpOK4Y9C7InUYpj0Rks4ECESpph1h88BOiiWeW45zzd4yOBkd1vtDvuAKhFMMmVzWvM+QeFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:05 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:05 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 10/17] hw/9pfs: Disable unsupported flags and features for Windows Date: Mon, 19 Dec 2022 18:20:14 +0800 Message-Id: <20221219102022.2167736-11-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: c865bed6-b122-460f-7077-08dae1aabca2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hvwX0n3mMEIHlNFhH50CEbLq5UIO0S83EsERTyjkRQyJdhDtFhTU+0RlMdKZQ2alTorcPwarMwYilgfG4MSnt7TYUW4jmWkg3xRkxjJEms7MOsyFfxL0ZcWR/5/DIi4h62QUvJdfQSVRFOBFiqx6tmUbOapmRLHRR+kT7wqZLpltglD9NmH0DKXvH1layLDCeG17PrwQol+gWYmYaoTZLlFKB/r4k6XxQC5XKcCgXbD5Azt2zbXS1L5dMCDzamr4bdcvJbgVAlCOICKUGEoo0wqvFXG1jSVLy0DRaGzDhMjL7770FlrMTWnnFFEAA0bX8yU5TTxOGP/rzToRjYDRhAzxVdWimPfNaD5q9A1SK/bNRZjCSIq+dtYUBWoh6O6MU8klapVRm+tiR4Ox03JiIZ1PYqgPJ1TfEfJaDIOuI8GstpRMrU594e4rY2OKUQDa6KRyDHBvb4fo5HtO25167bhp+COCHWSXiW97M2aUBI53aob5xtL5UGcC6hTRSBeAKKlWpefLZ4Gm07ysgvhPtWe0jye/CccTFCzgmeamXPEv+6O7CZ5uwW78mT7hAc61X1G6wgKSWouN7YLkU2ANidSA+QqgEugFCQv5HUDETmK83iUMcrZYQj0eApiwqkwOnlPDPnBYnZzCohC9FmYECljWAyt9zJDWTTyI9Q/hG18chAMw6RQONy/wVBomLdI6rA4FxiZJBOO0QOcnS0/nCg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GcjArosQ+m0xJpHm8HBLlI6JMQpQphhU+WOdcCsoRN8mLnfOh8nvZxT1rP7F7QeUq7MYOL9N9SjcLFEmkzj206F8QQv14WT5nl8oT3M/vIwDkW2f8fGcdcoaZtAfBIbdonpC0YZM+4ZW9xbkmRiYeo6jBFZCBGm1wLFzsD9sXeQch4BLyZnOErm+P3IwUe2grwNAcgD2xN8jj8fMi8uSFFlR65W1duf0LF1FaTey43KtHocEbXtMAg+hc6KNFwkBesZFnprfNDlZYys1p448Oq1d+SwUcLscc2G25TsfNKTaoNnBF4ZYw3K6HoX+PhTS1XQ9NREoKxOSCQ4soTtSo5fTV4bbJdFmr0mpeR/PlBExGjE+vl3U/519e+7ki77ARP+35TpARuICuszBLQkXYWIAegP7KSAiea4OPjwSAEIJ3JEEkNfjViS/JRlHr+odsFaTdkCwmo0DZj0/6Pkmg0q6V8sBpzuzhMouX3vULaBZG9ieeYvqpGfb9gutlENKc1VhBfENhZS9ikeOASwUkxVqCdI5ZwJR+1eBoIKx4R3uYBAcyVJvFoUkZv7HQKgsD9nHYZrNJL2fVb/EkWCppyORsFDlPQ09vzorMlS2TIwtRzvEdWrgQiy8s4R7tUe5KCv69cgiT3qCuBhpVeTIJ8OUW1JkQAGIssxQn4q9rvE7dEufFYKrZ4nWXZoGOZeUNdOWgNlHGjSscj+DlGiSBNDKsLAUPUHeF1daR0deL3KbN1S6Z7D2Ea3jfrAObY/NWoN3eav+womfi7nhFwP1s9rOxMsh0pdHRfN9PfAhbpYh03/QMe+pSxDIdviITUO3+wthcz4BHpk7DwF96rno6FIXImBf/m+QISu5yRvn6vOuoEj7/s2lkk7PuGkeN6PauhLo+N5ijcRyi2VlXbXeTB/vCd5gyQKFg6/tV9cwxXok6D30s1aMsU04Klnyp3mYYIy67LPqKhXQPfA5DWA7hwL08G/Rnn9Si0lQ9T7siclg/6c0260zAXOqzzt3SdGdiCfAXDK833cu4jemdX8S7yv4fldMtd9AcVpfVyqsmtbJ41FxjJ7OhYLWuaHOwJWS9Rhi8BCm7mt4/WEakq0VrsXbah+cDDRafDILLGW3X1MBkNkqsMkFb6uyReZuLbcSGtuCNVfVxdfxlUQ1fRjZN1t+07fglSdGMv5rUMPI1qxFTAhH4V2PjzXvqJRiMwR9RmULWe+g5F5SCNDFeWOwUCeTQcMgcdIMAiRlSnZKRUk9M/9Y6xBO/FKK/YY6Qmdr40ov3njdSQ9cSiUi5G4GVB++Vsb+UlCKd+2UJvTQ15hSHuYBrU3y5UgGGLpMymzGxSAyNHLL/wyC6cDW7DhZHeqOgUio4PR1s/mcPjcPKcDDCJLzbzL62GciiRSN6rryL5LMkaDDKlOKEKd97uOEvtvZ4BTpHqhHMEVQhCflLs5bG3C1Spm/03ZqYlhrF5bGtUq3A+9HfcKh9bFKVCGA+mIq1AYHA+VKiR71lMW/JdbwL/Do4W4PWlFpABN9PxFBBQPcC7vnwfitoIr2e2ei6vw895K+gxjYSJC5sbSQmAM0xS6ikIM2JeFXTn8aurgp X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c865bed6-b122-460f-7077-08dae1aabca2 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:05.3516 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pgCItmwWtL2G8l9K3DdalSP6B63BySvZLU3/XPYJ8GzInzuQhQ7W2wMZ0ngMKttcJ/43cdpHPH7XKq9U72+Ihw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: tpSp5-ESVS-eLfsY9_vCnkQdHLSI-Yxr X-Proofpoint-ORIG-GUID: tpSp5-ESVS-eLfsY9_vCnkQdHLSI-Yxr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some flags and features are not supported on Windows, like mknod, readlink, file mode, etc. Update the codes for Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p.c | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index def85a57fa..2497a06f43 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -39,6 +39,11 @@ #include "qemu/xxhash.h" #include +#ifdef CONFIG_WIN32 +#define UTIME_NOW ((1l << 30) - 1l) +#define UTIME_OMIT ((1l << 30) - 2l) +#endif + int open_fd_hw; int total_open_fd; static int open_fd_rc; @@ -132,13 +137,17 @@ static int dotl_to_open_flags(int flags) DotlOpenflagMap dotl_oflag_map[] = { { P9_DOTL_CREATE, O_CREAT }, { P9_DOTL_EXCL, O_EXCL }, +#ifndef CONFIG_WIN32 { P9_DOTL_NOCTTY , O_NOCTTY }, +#endif { P9_DOTL_TRUNC, O_TRUNC }, { P9_DOTL_APPEND, O_APPEND }, +#ifndef CONFIG_WIN32 { P9_DOTL_NONBLOCK, O_NONBLOCK } , { P9_DOTL_DSYNC, O_DSYNC }, { P9_DOTL_FASYNC, FASYNC }, -#ifndef CONFIG_DARWIN +#endif +#if !defined(CONFIG_DARWIN) && !defined(CONFIG_WIN32) { P9_DOTL_NOATIME, O_NOATIME }, /* * On Darwin, we could map to F_NOCACHE, which is @@ -151,8 +160,10 @@ static int dotl_to_open_flags(int flags) #endif { P9_DOTL_LARGEFILE, O_LARGEFILE }, { P9_DOTL_DIRECTORY, O_DIRECTORY }, +#ifndef CONFIG_WIN32 { P9_DOTL_NOFOLLOW, O_NOFOLLOW }, { P9_DOTL_SYNC, O_SYNC }, +#endif }; for (i = 0; i < ARRAY_SIZE(dotl_oflag_map); i++) { @@ -179,8 +190,11 @@ static int get_dotl_openflags(V9fsState *s, int oflags) * Filter the client open flags */ flags = dotl_to_open_flags(oflags); - flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT); -#ifndef CONFIG_DARWIN + flags &= ~(O_CREAT); +#ifndef CONFIG_WIN32 + flags &= ~(O_NOCTTY | O_ASYNC); +#endif +#if !defined(CONFIG_DARWIN) && !defined(CONFIG_WIN32) /* * Ignore direct disk access hint until the server supports it. */ @@ -1117,12 +1131,14 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsString *extension) if (mode & P9_STAT_MODE_SYMLINK) { ret |= S_IFLNK; } +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SOCKET) { ret |= S_IFSOCK; } if (mode & P9_STAT_MODE_NAMED_PIPE) { ret |= S_IFIFO; } +#endif if (mode & P9_STAT_MODE_DEVICE) { if (extension->size && extension->data[0] == 'c') { ret |= S_IFCHR; @@ -1203,6 +1219,7 @@ static uint32_t stat_to_v9mode(const struct stat *stbuf) mode |= P9_STAT_MODE_SYMLINK; } +#ifndef CONFIG_WIN32 if (S_ISSOCK(stbuf->st_mode)) { mode |= P9_STAT_MODE_SOCKET; } @@ -1210,6 +1227,7 @@ static uint32_t stat_to_v9mode(const struct stat *stbuf) if (S_ISFIFO(stbuf->st_mode)) { mode |= P9_STAT_MODE_NAMED_PIPE; } +#endif if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) { mode |= P9_STAT_MODE_DEVICE; @@ -1369,7 +1387,8 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, v9lstat->st_atime_nsec = stbuf->st_atimespec.tv_nsec; v9lstat->st_mtime_nsec = stbuf->st_mtimespec.tv_nsec; v9lstat->st_ctime_nsec = stbuf->st_ctimespec.tv_nsec; -#else +#endif +#ifdef CONFIG_LINUX v9lstat->st_atime_nsec = stbuf->st_atim.tv_nsec; v9lstat->st_mtime_nsec = stbuf->st_mtim.tv_nsec; v9lstat->st_ctime_nsec = stbuf->st_ctim.tv_nsec; @@ -2492,6 +2511,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent; struct stat *st; struct V9fsDirEnt *entries = NULL; + unsigned char d_type = 0; /* * inode remapping requires the device id, which in turn might be @@ -2553,10 +2573,13 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu, V9fsFidState *fidp, v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); +#ifndef CONFIG_WIN32 + d_type = dent->d_type; +#endif /* 11 = 7 + 4 (7 = start offset, 4 = space for storing count) */ len = pdu_marshal(pdu, 11 + count, "Qqbs", &qid, off, - dent->d_type, &name); + d_type, &name); v9fs_string_free(&name); @@ -2912,8 +2935,12 @@ static void coroutine_fn v9fs_create(void *opaque) v9fs_path_copy(&fidp->path, &path); v9fs_path_unlock(s); } else if (perm & P9_STAT_MODE_SOCKET) { +#ifndef CONFIG_WIN32 err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); +#else + err = -ENOTSUP; +#endif if (err < 0) { goto out; } @@ -3983,7 +4010,7 @@ out_nofid: #if defined(CONFIG_LINUX) /* Currently, only Linux has XATTR_SIZE_MAX */ #define P9_XATTR_SIZE_MAX XATTR_SIZE_MAX -#elif defined(CONFIG_DARWIN) +#elif defined(CONFIG_DARWIN) || defined(CONFIG_WIN32) /* * Darwin doesn't seem to define a maximum xattr size in its user * space header, so manually configure it across platforms as 64k. @@ -4000,6 +4027,8 @@ out_nofid: static void coroutine_fn v9fs_xattrcreate(void *opaque) { + V9fsPDU *pdu = opaque; +#ifndef CONFIG_WIN32 int flags, rflags = 0; int32_t fid; uint64_t size; @@ -4008,7 +4037,6 @@ static void coroutine_fn v9fs_xattrcreate(void *opaque) size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; - V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); @@ -4061,6 +4089,9 @@ out_put_fid: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + pdu_complete(pdu, -1); +#endif } static void coroutine_fn v9fs_readlink(void *opaque) From patchwork Mon Dec 19 10:20:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A8FDC4332F for ; Mon, 19 Dec 2022 10:37:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHR-0003Ld-4g; Mon, 19 Dec 2022 05:21:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGu-0003Bq-4o for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:25 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGs-0007Tp-Aw for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:23 -0500 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJAHZas012947; Mon, 19 Dec 2022 02:21:09 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=/XbfOYap+3mEAI2SyyOjxeojVnvdsqoHhEGjnq+BoGE=; b=l8aVBWkFkYzGDsdXImJS5tm3vab6NipfiEeLO3dvSAOLGHqi3wogcC1hLyaS7kgKTNit QtMthVCs9qG+rOPj4fYm8WnfdHkiKqrC+lEhNhOd4kVvBnJ+exLBT7zhp3KN8kp4f5cR H93iJ7XURThsTk985PT8W02N0eB5BApoU9n0K7lyR1GpcXKKBlDKKBWM2mNKdlxKbqxc kpgfJ+XSpB7hUhNN4jffUKwpJnG5HoFPQO5XGZQHFBaeOoTt2IAqlNrMk13u3vfzx/wK LhJKAG+LiKXTLa4yqrPoJJOvrdMt7L5xprmLFAViKkhuUjeCZ/sAROZKr4AequKpjr/m vg== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh9x8s77w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 02:21:09 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ak8p3wn9eydoC1gw483sEFS1K0+QAx9Rx3efKEN1cih2kFIIR/48YRpEzNPoTr8wFmF1QSJ0u3faoJV41ucnWujL2Fc9/BlZ+CcErDtUtZ+XWVl42H2Gbxg2kslXTmxuVvT1V6FMiyCwWqhKx/U+40jngj4Scf+V25k3WhUDMsJHa6K2YzhT9B8JqeJ9DJpztSwoW2wgACMuP9WSkuqHlZIQ8mh8SolJjxHPRjR5BHHtOpEMwS24tk6hhzOxBV7jWFASQsHlxFg4GksbKGXZKXzAvGfCyPLuCYhCqD3Lnfiu2377SBdm/g/KmaT4asJXIDZ4FxUjkU1jkMzA/VvvbA== 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=/XbfOYap+3mEAI2SyyOjxeojVnvdsqoHhEGjnq+BoGE=; b=nj2NRn+Yp7UWcr7pyop7SC/r48kXPgUjSMs7vjqujaRE+07rIQ44pL65W5jhYfPpWmP4X8Ws4VpPadNGJ6CBt8WPJcqd5bGru+QD5ZKlQVdUk3x/0zQP6qFHqMK8UgYYwU0O+oIc/WJGtybSvbVj92YJhoMJD7BMdHSsfcnQiGUuEKtZwTuDeOgjFBU3FfRwrZAj4TqmONnIL3qcAI4XqeuzUhjikyAuosXMM1+pNi8U5NMDFGIz1qcplZxl/5xBiljv/l+8Cfrg6ZviB0MIkJ19CidcqHnlFtAI2uc6xTalIdRKmKv760+msU6LnzWeHI8nAQRtoHWWfT7/Vj5JhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:07 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:07 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 11/17] hw/9pfs: Update v9fs_set_fd_limit() for Windows Date: Mon, 19 Dec 2022 18:20:15 +0800 Message-Id: <20221219102022.2167736-12-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b10aff1-ad51-4b88-c4bd-08dae1aabdd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AqDMttLxZHRtMA1xxZKbiODVwiA3MkHfMib9L8lZTCnU5iiWgYmQFWg8C6XprE2xUwlFdM+wwg1vAgYbqrfe7lmJjGetYla/7BAaBOsSfF+RJmJVaM3UjPbOtL+pmoD1c4vLBBnJlwloG6puD++W03v2Wu3W2DQVR/w6M3VZ2tq9RCRTqwraypaA1B93ZlpLzAVFDc03zdICi2he8a26JALknIFuHPTS0BQfQSzKABVaMxW/eutLNJNOyxTehQR+Sbq+D8kql5CdcbsRYZF93UqWNXDXtfsIioicQYUx4wLqC8ASWp3rUcsQ7Ybxlxd9oSnCaMkJmKe8RQ22DFRA4OVgOPPQMGULeT0RC9C0HaI4+6eaVLePQxPI2QRKrBBHAC5ap+l4mIKvPnoaF1OysgTHTM+gl683+V8/y9DiaBsMMQafUiHK1uTrk8/+7mEYt2h2lESN1Jvwt3lc+AOecsomgJWl4XTlU5ainePxUlqq9Hn6T9K9w3VfCUEwxMvosiO+WspLHLujoWYrpNVu6DPwsmJxHGEJEg5wXn2ba0BiY7qnN46bDS7BhTpQzIJKAdFBEnshWId73nDyFCgYf0gKF6j4InTZdXpXDnsy/MMFU/W4NlJ4LaQ/YFMXh/njHv2NCOzsf0+vGHVErCXDutCe7ZdshcI7b4Cw7NuwO0iH4mQdPK6CRf2wYDMZOoZz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +YwGV/ZOdpaECcd85iNjdmvI6PDYfVRwT1WXVcUBwCrQxDDxa2wxw0RLpAtQB4sWUUvtnEOcIjzNosvNq8aUxZg2CAjIQNaZzfPVoez3Jy/g+TztR83oOhST5CAnLgzColpssiNzjmR1KU8FOmnIm1SaEMPyaK+a4q8FVcNPMdXRWvToKstHQsTCkDLEDNC9+7PXQm9/b2FrHI1XX0WOvPkmeURrCUSAAj4Yl8+hgImj2jfFSACN2kwIulry7sdYt0T3GP7E6nsq2YYUfg9UYGsSGHh7L4sZwwD619cCy0SiEuZCfz9Yj7p88szx7hvlOl7ghx4rrAkVJT7eM3Cr5D57FGqsDC4u9HWRCgVKJ7v690/yNGGOCItkx9sM2PMba0yQN8wymTmt07X4TEhtC2RB3baWNlUkhmz+U/b7o/K5t22SKs5Esm+613UElNw2FPPPP0R07D/MLHTMbH+sSDwdXYJEUoUL2VMB6FcXvLv7u2La99ELoc/K5B0HmPfHGqEXL6I62QUpM3/r3B6/OfDHjp70zWHgTm/pBgrUEpJAwh4V7ON5SsGjFSZ6IjP9ACFD51sfKQoOEnLjt9QskZerCetMEmn4C4AtgdNjMjZA5LcEwxRZHtQuUe43C2mfu3mxs+R7QIMh1kL4jgz/1R1lg68ZSRSPAlp9MdEaxl5txCC0RwDykJy8u+9F6lDE7iiyZIO9EwxK8W4bWRb/amQhVt67R02jwkXpjZjGfdI1UsFTy68h0/TJkxT7UMQeMungjvduibwg0XLwMAzwG3nNpvqmuIDCGV4U3cI8nzrz27QsybQ0Y1JaSf7uSdtC14zayli9op/BVrPaE7uQS8iwVntfuiKCMrrYKi8HplqplOhLGO5ctiMa2zQiss0PbWcWIs5b0ieZnGTLnyvYZGo0z/zHaM8qQ+VwNdTP0ySpKVcihLTplshezN33OLHdIrG7b9meXKdP4FWcuzhifMyAUVn5iNdYwI+Py+JEHeZcj7bi5otGeU8GegwPqkWveHIPmpurwD31irDALqloxynaqHYXb5cC/rrEXt/++aWnyAlSxiDI3xetufECTpbOcqRbHS4C0JT9dtrzaCK0TdkH/NS3730bwXYSi/c9isAOlY49PXv7H0DH5ebN233QeLZ89MqVkrfU730Z/NCsZwOxIRLikLCtmRW817tR3XS6Sldj5/RF2Qc/aO3nVEB6PDQ4/kIEzg2oS99ipF1M/4+1Y6hUIuFzTMFqc4IqkJ/VUi0+wHNmfxHWaKrJGwHaO3IXnF2544P/zERB8fM1ktd7LwI/eJmieABiVgIFHXpLRgzTcnZfTBwwEr3wUO7Su0gkkfJFQe+83NV7oF5mq3U2nw502hWKTjkXhYss/34IGcE65lSsJfeubP0+567gBI9hG7XSUdcTM6n5OHmmLQnpFAf42h+wJDn2Tha61I7+q5aHHRz8NWMrlRVIDgtAJ5rj4QY/XLHGNkHj5tQWqIAllYrxqht8CAUoAP0G6XFLOUJjc/JmmqCZd0qCn+e9P+ngMoTEC5caQwRKJzLWYKyshzZfZD69hq1gFhwAUhNLNJdpeM6ywj1fr6xVyXPY X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b10aff1-ad51-4b88-c4bd-08dae1aabdd3 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:07.3684 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0s/eMIZ4cZk6F2rdZpxtgVWV+3n/AV0rAq8e74ddCP+IQ1y4QMHyh96UCEEz8C3gWRLc4WXtzhZuxJt3g9fPeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: K2bpMfCtPOlJNrzzJju2sm-Xzxwxg59W X-Proofpoint-ORIG-GUID: K2bpMfCtPOlJNrzzJju2sm-Xzxwxg59W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Use _getmaxstdio() to set the fd limit on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 2497a06f43..b55d0bc400 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -4396,11 +4396,28 @@ void v9fs_reset(V9fsState *s) static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) { + int rlim_cur; + int ret; + +#ifndef CONFIG_WIN32 struct rlimit rlim; - if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { + ret = getrlimit(RLIMIT_NOFILE, &rlim); + rlim_cur = rlim.rlim_cur; +#else + /* + * On Windows host, _getmaxstdio() actually returns the number of max + * open files at the stdio level. It *may* be smaller than the number + * of open files by open() or CreateFile(). + */ + ret = _getmaxstdio(); + rlim_cur = ret; +#endif + + if (ret < 0) { error_report("Failed to get the resource limit"); exit(1); } - open_fd_hw = rlim.rlim_cur - MIN(400, rlim.rlim_cur / 3); - open_fd_rc = rlim.rlim_cur / 2; + + open_fd_hw = rlim_cur - MIN(400, rlim_cur / 3); + open_fd_rc = rlim_cur / 2; } From patchwork Mon Dec 19 10:20:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B101C4332F for ; Mon, 19 Dec 2022 10:23:41 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHS-0003Le-2L; Mon, 19 Dec 2022 05:21:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGz-0003Dn-VD for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:31 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGx-0007Vt-Sz for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:29 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9dUcW026145; Mon, 19 Dec 2022 10:21:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=aC5SOPayUo/VGWIHCcxSV4cInvSd2clRALxgRa5dDJM=; b=j4jcxUaJKt7RghQrPSqhaDMatYz/yRXktZKckph8buQgdqCAe/lxA7Vmp3uUEIkO2E4b ZCmLz5upozwbRaXylSGdL67H+SF7iD+cbLx7kav+zAmvibHw0t6+ZvVdHp/oye1Y0b/1 LSI7juivblApikMDcY41ZVUfN2m9MUD6bngd6szVBrcMYN9i2m8QYRplxJWlrzUT2tEC cJNkqDeknNLRYmDsVgSdqUF8+48CHDKQ+6Xdn6C8rzLM5o40QFlVWS5h6O6lqjFyJB/W MU6eqmNBjVY9VSQhA5lwgKLavSSDhoCTucEkHXweN0xQjaBaexjkk+AvWZqdMlc6K1HZ xw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n16dUeVNqsYCmJi4eGQMLzkoja9Q02PdM4CttlJhUuA7yp4bSJPveOfzlw4izkyFKFXOIQ7Z7ZwrW43gP/BNkZEuueFttSpsxg0PfkaAPWXcLC6WtTax+CR7Z21vdOv6joqtsC9dSwmUsJUTxtLJ8C76C5v4g/TVWD7NKyY1BqCC0LRtMYjkSegIAk7FBivdPMk9e14nJoO9Aw7E5SeQLI53uuyDiV2aX0MSPSvkzPo2aZrf2Rk84agwePbEioHWUcu78hzrdkferixrL34espgcmcLnYM45HGdoodbmo2AsOhDcaRQJg358u7FhOXalM5wmhzhHNuHFbgKQyfLfxA== 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=aC5SOPayUo/VGWIHCcxSV4cInvSd2clRALxgRa5dDJM=; b=bXW4G4Prr7cEMqnodGss3WMsJPlsP92uuEpmoAeYT1e9/V104w0Z96gGy9C58uNzzsHjgS0I8BC0k8u4gQV0YxEtNIRXs4X6NZ7VG3VSQ6R0GBGh6LO4Ser8n7Oo4O1auZxwYzOtDhp8DJnDCvSbw/A//TitbiKxP8VLujdw2xtiv6agWFCmQui5UMf6vfKAlvMKXWXwLVI1wlqk8+d88AevGXi0rEk93rwuCu68WQiB7Hfrqj7DquEVtuePDk7AAzYWSvZR0uqVJ6tzdepcENcVwfuOYcmxGR0ICU/xa/m6hXSANsd8Gpj/EjCKKoV+4XlLfLEO2C+jOcJsRRHGCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:09 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:09 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 12/17] hw/9pfs: Add Linux error number definition Date: Mon, 19 Dec 2022 18:20:16 +0800 Message-Id: <20221219102022.2167736-13-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 14e21197-ae58-4890-7ab7-08dae1aabf07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LN+nKDRMeiyTcvvCCpn6NSvBzF+0SxlI8EVwAJFzhix1Ul8A2TZ9t9EXqJLcvsogAGTLm4Bl4GSyHfYWwr0rer/4IejRkguNuDX4hB49tuLuFXObhzrQYrzg66FyoY30J8qp3rXP2kkyZyLEP811Uu0DkGjxElCKmIk5woITBbhn4gWi61G8V2vEXfc+BN/z1Lxu+JxLPGV82u5vR2Cchzr8aNQlPr5vTTVAQPUoW9ozMk7UEr12Y7Qc7j5Hgbsb9NfI5sd+1QHMLZS6T3qArdGoGV7gbbfrBERLyNTls9woskHqOakcbdfN2MBF3yRrQYMjJwzjeHIjqro7oJCNWOqDlz5H+VCFIBh+7zRvf6I8ekVVj3BeOmsJKhOYngmZcX4R79zoWQj5gzNvifnj7ninbqGMSyRHx63E62k56IWJq3W8uBk/UFofChxUfgrO19LV+8/QAZLlfh1dS7OpRY3w4qll4lHDoBoctAWhMy7Lvtj/xVTxST+QbCEjU2MJHTIRSLmNPFhojfDlTh5OtGDtrW0n/Vj5kidtie55jlapadHuk4W2abgtHBZwzoZYNi1mQIHoZut3VP8NKbxtvU7aY6DFxoiOykIDJjmIcphmFwlQN3beW84F+K1Q06FJ0QaQzCXmD10BU1ah0g4IeVC6UwEQNUZcWe5RTNzxixA1k6fmWzMxnr6V1UR3AM9d X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Rg/w2iQFEki2Se+isVy00Bx9+fGolAMvP9nzSFVM3fVDQoma33Jtlm1WaMb9AQokFtv3XD+ccntKpQBTy8SLcpr9BlLGsDjcrhJWkNBE7hcn6qv9k6B4G636oO482HJS37MR/bES6qa4Cq6vZ50a+yxKjWNeQEtVqONiNFUNPHspFqSYL2VXL0S/PizteySKXld3qsL9xQx3qYSwjC21FkVseU91k90qR9IZFc5Ipwj8QiTkOhqOnaTYveOCAH0vqh6TeEjShtF+L73UqyvfaFSOMbsZeTA9JKR2/vEfBoytLPwCRCcyOYSxoO9xw6eHYWSqbDSKaG1m9TiUbHDJE9sF6Mf0/z4H2dba14Rg0AxaUlIYmvQbLfGASIYj9cYVKJn8jxEpe2jPQPKVJliaL1ll+zGdIhwDwHlfnAo16zOPHJ8+keNaLiVHgGl253rhrU8bCKw+wqVpKYzRjxeiwnN0MNg5NT6W+hHlR5+Ts4mBvWmHAktPSsX8Hax/ZZlxyW9DwoTSbPzJYqmGyAeUilqIerxOctulf+yaHPTq8jkE79DNOwpZtGK3xUqQ1Wxjf2aTQDyuCV/EPgRuHUAzctVJGbM9yY6E0QiFfBrfL0ft7BzS0mR6VbZUwUnahbuEkSl0HTealt/rf+v9e5eSZ6xXfydcH8jxCK26+Dsxjo1W70+LeIbD2Joe0T63I4xwmSum1RVqXl+mMtGkdSnBGLuJLufl8CFDNbHdR5TBFrTc1cWc9Y4LC3ulCJpdhM7PKDbemeRx02/gAuKUbqNLEKfRIMXfxlDOOoRua+9Reo42F0PidpKH/hwPkFMeivG0ndYuGzWEFA1mVg/UWRz5rRXbblmmIg+XwJcSjZnuzNgurUVd5qU4ef8HkVO9plbYHIxxfFqoxaYdmD5Ly21SePaaQrgVgIuZV3lVbZyXXhXDDfMYJrlW5nyNDPzpvUdlU47x6wWmZ8PeI6woWC7y9QFVi7XYSa4NDb54iM4pwBxse++gg3TgBGub6Tzap6yD3OG3FI/mnvz36zg6lTzyGkA08VMzRKtzL4pXxHxPJVwSoXRU3AgB9fAc5/Vmv8HJ7lRJwB275GFeI5DX1jzVmRwocRSEY7iQAIFE/u/LaG/UKNaUUtcNKWeyUsavTODs8QSvB9gtSNRhykTYTDXkakuZEBIauFTVhI52b7WdwVbEICI/rARD3R6nRuO7pmhhmaP0F2pFYC7AniVPKMB6M+TsAtirCnd78yRAk9RYXBWD1owePufVt5+/Lm4XfAW73mRyquItGchdh+2AftvokWAZzNYwNieYsfQp/4zsyb35zKARbrw1CfIH+IAlYLYTEuiA6bgG/KNPCgxeSyG15+1Gm9CNixCy2h6Do7IP1ZigTjaykHUQFzbrQj+L3/KXhsKSNKEQl8eV/7rEEYeyxKPi5tHCyfV3iT8sl/HzhECfyQeFIVHjQF6js4mVvlnowusnTakWclDpZQwHOpro6m8L5pfOH4OxHZj2D3bgKP9cN2k8GxlcmhUHcRRU9xklg7jbxKLStdKjDvzlieG1EGkGhzcnIUkJPlKty+aIVCfgPeV0/+sNgylTULM5PgDP X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14e21197-ae58-4890-7ab7-08dae1aabf07 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:09.4162 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 97eTwTE00qbJ3hUysOuUdEKZjW6ZLW2ys/c/7JW8iRPwy+HnKHeaKBtNO27fzjSCbt6CgIRTd6NXSKvJncFq2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: dHO-hNB8EPpRBPe_zyfCRELoRealFLbK X-Proofpoint-ORIG-GUID: dHO-hNB8EPpRBPe_zyfCRELoRealFLbK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi When using 9p2000.L protocol, the errno should use the Linux errno. Currently magic numbers with comments are used. Replace these with macros for future expansion. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-linux-errno.h | 151 +++++++++++++++++++++++++++++++++++++++ hw/9pfs/9p-util.h | 24 +++---- 2 files changed, 162 insertions(+), 13 deletions(-) create mode 100644 hw/9pfs/9p-linux-errno.h diff --git a/hw/9pfs/9p-linux-errno.h b/hw/9pfs/9p-linux-errno.h new file mode 100644 index 0000000000..56c37fa293 --- /dev/null +++ b/hw/9pfs/9p-linux-errno.h @@ -0,0 +1,151 @@ +/* + * 9p Linux errno translation definition + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include + +#ifndef QEMU_9P_LINUX_ERRNO_H +#define QEMU_9P_LINUX_ERRNO_H + +/* + * This file contains the Linux errno definitions to translate errnos set by + * the 9P server (running on non-Linux hosts) to a corresponding errno value. + * + * This list should be periodically reviewed and updated; particularly for + * errnos that might be set as a result of a file system operation. + */ + +#define L_EPERM 1 /* Operation not permitted */ +#define L_ENOENT 2 /* No such file or directory */ +#define L_ESRCH 3 /* No such process */ +#define L_EINTR 4 /* Interrupted system call */ +#define L_EIO 5 /* I/O error */ +#define L_ENXIO 6 /* No such device or address */ +#define L_E2BIG 7 /* Argument list too long */ +#define L_ENOEXEC 8 /* Exec format error */ +#define L_EBADF 9 /* Bad file number */ +#define L_ECHILD 10 /* No child processes */ +#define L_EAGAIN 11 /* Try again */ +#define L_ENOMEM 12 /* Out of memory */ +#define L_EACCES 13 /* Permission denied */ +#define L_EFAULT 14 /* Bad address */ +#define L_ENOTBLK 15 /* Block device required */ +#define L_EBUSY 16 /* Device or resource busy */ +#define L_EEXIST 17 /* File exists */ +#define L_EXDEV 18 /* Cross-device link */ +#define L_ENODEV 19 /* No such device */ +#define L_ENOTDIR 20 /* Not a directory */ +#define L_EISDIR 21 /* Is a directory */ +#define L_EINVAL 22 /* Invalid argument */ +#define L_ENFILE 23 /* File table overflow */ +#define L_EMFILE 24 /* Too many open files */ +#define L_ENOTTY 25 /* Not a typewriter */ +#define L_ETXTBSY 26 /* Text file busy */ +#define L_EFBIG 27 /* File too large */ +#define L_ENOSPC 28 /* No space left on device */ +#define L_ESPIPE 29 /* Illegal seek */ +#define L_EROFS 30 /* Read-only file system */ +#define L_EMLINK 31 /* Too many links */ +#define L_EPIPE 32 /* Broken pipe */ +#define L_EDOM 33 /* Math argument out of domain of func */ +#define L_ERANGE 34 /* Math result not representable */ +#define L_EDEADLK 35 /* Resource deadlock would occur */ +#define L_ENAMETOOLONG 36 /* File name too long */ +#define L_ENOLCK 37 /* No record locks available */ +#define L_ENOSYS 38 /* Function not implemented */ +#define L_ENOTEMPTY 39 /* Directory not empty */ +#define L_ELOOP 40 /* Too many symbolic links encountered */ +#define L_ENOMSG 42 /* No message of desired type */ +#define L_EIDRM 43 /* Identifier removed */ +#define L_ECHRNG 44 /* Channel number out of range */ +#define L_EL2NSYNC 45 /* Level 2 not synchronized */ +#define L_EL3HLT 46 /* Level 3 halted */ +#define L_EL3RST 47 /* Level 3 reset */ +#define L_ELNRNG 48 /* Link number out of range */ +#define L_EUNATCH 49 /* Protocol driver not attached */ +#define L_ENOCSI 50 /* No CSI structure available */ +#define L_EL2HLT 51 /* Level 2 halted */ +#define L_EBADE 52 /* Invalid exchange */ +#define L_EBADR 53 /* Invalid request descriptor */ +#define L_EXFULL 54 /* Exchange full */ +#define L_ENOANO 55 /* No anode */ +#define L_EBADRQC 56 /* Invalid request code */ +#define L_EBADSLT 57 /* Invalid slot */ +#define L_EBFONT 58 /* Bad font file format */ +#define L_ENOSTR 59 /* Device not a stream */ +#define L_ENODATA 61 /* No data available */ +#define L_ETIME 62 /* Timer expired */ +#define L_ENOSR 63 /* Out of streams resources */ +#define L_ENONET 64 /* Machine is not on the network */ +#define L_ENOPKG 65 /* Package not installed */ +#define L_EREMOTE 66 /* Object is remote */ +#define L_ENOLINK 67 /* Link has been severed */ +#define L_EADV 68 /* Advertise error */ +#define L_ESRMNT 69 /* Srmount error */ +#define L_ECOMM 70 /* Communication error on send */ +#define L_EPROTO 71 /* Protocol error */ +#define L_EMULTIHOP 72 /* Multihop attempted */ +#define L_EDOTDOT 73 /* RFS specific error */ +#define L_EBADMSG 74 /* Not a data message */ +#define L_EOVERFLOW 75 /* Value too large for defined data type */ +#define L_ENOTUNIQ 76 /* Name not unique on network */ +#define L_EBADFD 77 /* File descriptor in bad state */ +#define L_EREMCHG 78 /* Remote address changed */ +#define L_ELIBACC 79 /* Can not access a needed shared library */ +#define L_ELIBBAD 80 /* Accessing a corrupted shared library */ +#define L_ELIBSCN 81 /* .lib section in a.out corrupted */ +#define L_ELIBMAX 82 /* Attempting to link in too many shared libs */ +#define L_ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define L_EILSEQ 84 /* Illegal byte sequence */ +#define L_ERESTART 85 /* Interrupted system call should be restarted */ +#define L_ESTRPIPE 86 /* Streams pipe error */ +#define L_EUSERS 87 /* Too many users */ +#define L_ENOTSOCK 88 /* Socket operation on non-socket */ +#define L_EDESTADDRREQ 89 /* Destination address required */ +#define L_EMSGSIZE 90 /* Message too long */ +#define L_EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define L_ENOPROTOOPT 92 /* Protocol not available */ +#define L_EPROTONOSUPPORT 93 /* Protocol not supported */ +#define L_ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define L_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define L_EPFNOSUPPORT 96 /* Protocol family not supported */ +#define L_EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define L_EADDRINUSE 98 /* Address already in use */ +#define L_EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define L_ENETDOWN 100 /* Network is down */ +#define L_ENETUNREACH 101 /* Network is unreachable */ +#define L_ENETRESET 102 /* Network dropped connection because of reset */ +#define L_ECONNABORTED 103 /* Software caused connection abort */ +#define L_ECONNRESET 104 /* Connection reset by peer */ +#define L_ENOBUFS 105 /* No buffer space available */ +#define L_EISCONN 106 /* Transport endpoint is already connected */ +#define L_ENOTCONN 107 /* Transport endpoint is not connected */ +#define L_ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define L_ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define L_ETIMEDOUT 110 /* Connection timed out */ +#define L_ECONNREFUSED 111 /* Connection refused */ +#define L_EHOSTDOWN 112 /* Host is down */ +#define L_EHOSTUNREACH 113 /* No route to host */ +#define L_EALREADY 114 /* Operation already in progress */ +#define L_EINPROGRESS 115 /* Operation now in progress */ +#define L_ESTALE 116 /* Stale NFS file handle */ +#define L_EUCLEAN 117 /* Structure needs cleaning */ +#define L_ENOTNAM 118 /* Not a XENIX named type file */ +#define L_ENAVAIL 119 /* No XENIX semaphores available */ +#define L_EISNAM 120 /* Is a named type file */ +#define L_EREMOTEIO 121 /* Remote I/O error */ +#define L_EDQUOT 122 /* Quota exceeded */ +#define L_ENOMEDIUM 123 /* No medium found */ +#define L_EMEDIUMTYPE 124 /* Wrong medium type */ +#define L_ECANCELED 125 /* Operation Canceled */ +#define L_ENOKEY 126 /* Required key not available */ +#define L_EKEYEXPIRED 127 /* Key has expired */ +#define L_EKEYREVOKED 128 /* Key has been revoked */ +#define L_EKEYREJECTED 129 /* Key was rejected by service */ +#define L_EOWNERDEAD 130 /* Owner died */ +#define L_ENOTRECOVERABLE 131 /* State not recoverable */ + +#endif /* QEMU_9P_LINUX_ERRNO_H */ diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index ff16e74f5d..0ef67a53ce 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -60,8 +60,11 @@ static inline uint64_t host_dev_to_dotl_dev(dev_t dev) #endif } +#include "9p-linux-errno.h" + /* Translates errno from host -> Linux if needed */ -static inline int errno_to_dotl(int err) { +static inline int errno_to_dotl(int err) +{ #if defined(CONFIG_LINUX) /* nothing to translate (Linux -> Linux) */ #elif defined(CONFIG_DARWIN) @@ -71,18 +74,13 @@ static inline int errno_to_dotl(int err) { * FIXME: Only most important errnos translated here yet, this should be * extended to as many errnos being translated as possible in future. */ - if (err == ENAMETOOLONG) { - err = 36; /* ==ENAMETOOLONG on Linux */ - } else if (err == ENOTEMPTY) { - err = 39; /* ==ENOTEMPTY on Linux */ - } else if (err == ELOOP) { - err = 40; /* ==ELOOP on Linux */ - } else if (err == ENOATTR) { - err = 61; /* ==ENODATA on Linux */ - } else if (err == ENOTSUP) { - err = 95; /* ==EOPNOTSUPP on Linux */ - } else if (err == EOPNOTSUPP) { - err = 95; /* ==EOPNOTSUPP on Linux */ + switch (err) { + case ENAMETOOLONG: return L_ENAMETOOLONG; + case ENOTEMPTY: return L_ENOTEMPTY; + case ELOOP: return L_ELOOP; + case ENOATTR: return L_ENODATA; + case ENOTSUP return L_EOPNOTSUPP; + case EOPNOTSUPP: return L_EOPNOTSUPP; } #else #error Missing errno translation to Linux for this host system From patchwork Mon Dec 19 10:20:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82ADEC4332F for ; Mon, 19 Dec 2022 10:23:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHH-0003Jl-Ha; Mon, 19 Dec 2022 05:21:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGt-0003Bp-Qz for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:25 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGs-0007Te-A0 for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:23 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9dUcX026145; Mon, 19 Dec 2022 10:21:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=4zL4466Iig+Ejjjyyw0zvP/MB6WqMx5USzaQ70doLGA=; b=EWjIGAM6piGXkMzzM8ePe+KgNbZbWTTeQQToxbomNT2m/Ibgl2mhTm+sav4Udq7idPOA Mf/rKa888tFFGUAAjjNT7Kyz38BLAYk9Z106JpF43F7ej65mnqUVk/pyBebyKFGMHpqa 8FfPYgKRrCq9+H/haedYh3FcJGt9Mh8ClVBWRaa8wgX5diymVKRn5Mmtv772GsV2T7BT 5lgZDLZ4ZDs0QpCOxBind/y62JNaY2YkFB8/fepkLjeYctvsK8yLUAXFVciINOq/J1u4 sMd93sPmRUIpTfm1frSqZvYiWGwsTBXc36fJ+YODU7IKHA5ostioPA8EDJrIDenCuwHM JA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7e-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=js17YSsAb77n76NHqgX5lxiqwZvrBmGvdYC0gt5Uu3M479XbiF7kl/X8oqZNE6AI1tPlcGFdgDltoRXgt/ugp1XEpGCSnKdPVvvMcUitPkbW9ByN3BjIMc0xODu5SUapSBaWjxckfIxQt8mMyVaj+5DgZAwvF5Wk27CefeHnJ/Qo+vgGqT3x5rZXsOsXb8paALJraP1D+zQFAgwAa9Da+77ImslszC4mzOhhxQYMWVsel7Cao00STFfkQekUPL0mgNgOvNRzUd2tN5wZ/440nQRMzEKtgv4YegMU4ydPiD9Ji5XhIb+beabXrQFStRwnxfKeUfRrjpPyWP2h0wPwNA== 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=4zL4466Iig+Ejjjyyw0zvP/MB6WqMx5USzaQ70doLGA=; b=Rh5+WkR4vTCmkQbpT3N3n+HfNVs0esRRfqc8EqHK1+9QQROFktD0KFyuZhNo8GYS5hdLtOLPgwI1VsV+5dti6/o3VV/xYJsMcNp3wwMqwuh0IOF36Pr5XsrpgKDB+krxTzhYZEqQZtxm6CTMuQtm5HPHxXHhCSNii13PZkBCz6uIahdfoORHLSflC+Yp6PnVUcj41FOm8XsE8lNalRWUIydnMWrFdoaMCFxpoDLaTcjXGafXBXBSVsVOeX4r6wtV4UvtBzGB3HtwpsRa7GewJDL92WfI+5q6XJalyIa5+LScz6C7FF8z+Vu+PwpkifzEfwXDmHblEIq6FVv1aVmceQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:11 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:11 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 13/17] hw/9pfs: Translate Windows errno to Linux value Date: Mon, 19 Dec 2022 18:20:17 +0800 Message-Id: <20221219102022.2167736-14-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: 32f5fcda-9454-4d2d-a416-08dae1aac03f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GRwhj5MZzTPDCwbGUGfXYMB9oOiWu9p9LxjCGUTh9Z1h1+TKC8hPE144VomAZm77EtEIrJDloG6D3oVojDu6MkIpCQivbIksQqZwSCSHgqefhJ3riCJKjhnN+R6g3D2+C97w/CvCSW0uZ/vEjMuw3xlh+7p2DgxhqaWJT/JaFH6CxMV09sBoWRVAHXXT1aHbyB96FrVpF6JZ9acIOcS/1xumOwcsszppQa7x1yHGfpHBq+s5nZzeeprHFVz20fMynK0QxKf8k2LwjFxYwA8pLlUEj/BfOm8gohwa1PoYptSQPRH4iFSU5aStAmRfe7d7kkVhavDyRHWfBfyJChyI0d6Kf6tQDOoHmdaDGk/LoSBrStcQ/krDueziF4y+DLCfQAr3+VcOBi8qWpTetSkUPo4bEVCHF//dqEHodOeon2adYIGTVzZr2F+ItTBhI6F+FuZggGf54DSl0eU5425zMDC4+vdb74Rvv7Cnsg9eNC6h/wOzUw8wwaJtjW4c1CYRqoQU3HAyIlz3u+lE/x13lxh7ZMcbLmjshQYWR2pcquNYWlUZwilXhptUCa81PgK+5XaK6iWac2VsYgUgDJM2980DI+S3n5BV0RoJSTLCDLMqasrmJLTyavoTD6tzAVRI3C66dLZNuXRmMJyyvtzHg7wkGMwfPeJODl4/pIoccy7weHRPAaTOO/mTHtx2dwY1NYuM0jSozHRfhC3W5hGIjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(107886003)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bK2iB3vITOrun0/POuA8ZQGJoIcWUkkSiBpoV8c5xC6aMHyFxji6wg+VgBl/3v64GLUysBeu4BntbXRbkIIfDQ8NIOyz/3YJlKHauIgWhrxgZo6Z9nA3d+YWYm91l+HXE0yyvxjhj9ixpDKSitxREHmv5TXibvFJwUWXoBbBIbYNILsrz0vvVJYvLzv5xnGU0tL0ree9xbrA6yN3o3YykJ31LA3KeVFoe+ojgBpx7298WsmvCKXzrMc7xbhVRJsw0p/fcqEYCbFD0R+wBNUBGRfoeoCw1IQR3VSUPTAs2Rimlq1KekJZh3tISbm7di/ECn0auP36GhoA+cB4RQ6u1gD5TYQPH2/so2rwlxa/8SmWEWmBRpYzgSCPMKk1fGyzOMkwRRGnm6PklW4mmjLsblJjQV5r0AtDTcbultkGwnwA7IfpWXTFb1bmTmwIlH4zKCtMDojIDUDqWgQOo+z8xm6NS1sl+zPObr6fZCgkazDt8KfXY7JuhBig7a4pIRY15ZAJPZ8s9fNAoDoENTiDO1KWiBkQcb3erI4ozV5DKyjl6eR0b+8Q1bRdQsDUnsG8sO0oVB0xDMR6jLOhY6mtJK7ZJqAbNJUGxlYdw/CwUxzVNQ4IJV5Lgrkcg/EgY+cD8mtbyX82cgNMgQvRzLoFMkIGB5A+6pe/wOk5IDHxy6PfAYAedvU7LxY0tcy+B37rAjjYZTLMibQ2or0GxHUueDwj8wyTsBfA24yuf8b7fWHi6jOKKst9+MUMU8E0YnHJIGcQmfAT3X0vPSLo2aEGJ+7tM7QUT4hhYVOIegGxbGnQw0dJu9MQ4sJ+UW9TRci/5QHxgSb4TD3d8pTxgbXY/NHTIk1GCyQRr7BAAg0I45plzAWof8SmKuCSpD8tlUkIuGRdsOOc7CzDApNsH26EPpnzJ+rThcIHAeirt4VVs16/2ZMfiUewC6lUGlr5atfa6PF15h0hj8s15535dRmlYmPF4JOGphPu9emUbmrLdgrSVJG49YpouBMa9hRxXkXnbC0LOwCEjO6zpwDyhzDFlH7h3Yf4jboYGO/BMEMCaQEs3n7YswClOeu8wYnzXf+yQOScMx39rmjueSg2+Doih2pI00iDQy0QKS4O7wPWLZKErv9I2WiXQGCLUncSmwEdPk9znZgxj5QKqbdslH4vlL+IVyAA07nFQwOmXzxDZtxTF5lyaTcZdaPJLohcW4bHsuyO41jCXbkq6uky1K9t3JINRjIGCaBhXvfi5yRtZJK0+G/VQUOQrWp9fj45oaMmL10Dju2mOL8B9GmNzB0lGvQV8TfsysH3o9Mqnw7olRosb3LNhm56UciGVqxuagynQUn/M1PFtr5Unmppf7/F1KqpGcQlOxR0oWHGcrjZVQ1bM2+K7h0MOtc6S1m5A2hpZaMPpQtC0NBBa6jHowjwAvenjUVm/fy2aqCKIh2gpwYuozFMsffiHLHZGB6KQ1szSJFrqITfSYA5Bd/xMhwvEr9G6o4KfaD5NBjcGt1oL5S3NFJb9WX/cg/sCYm5bCF+GqaQFQfDxDWLqy7Z2z7MroLQsJkxYPgC3EQ9HSKqvs7aUAZoifMm4bI+aQXZaVLv X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32f5fcda-9454-4d2d-a416-08dae1aac03f X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:11.3838 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7n6PXo2SU13MElaSrFCUm+u98xZkWjVyzqMXc5vKTxTA4/oUCtcEIQZdrDhstPrPtNIV9+YkVffUaHEo1p0vLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: aVc3XwcCiWqRGhqBST1znutXzQXVInqP X-Proofpoint-ORIG-GUID: aVc3XwcCiWqRGhqBST1znutXzQXVInqP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=709 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Some of Windows error numbers have different value from Linux ones. For example, ENOTEMPTY is defined to 39 in Linux, but is defined to 41 in Windows. So deleting a directory from a Linux guest on top of QEMU from a Windows host complains: # rmdir tmp rmdir: 'tmp': Unknown error 41 This commit provides error number translation from Windows to Linux. It can make Linux guest OS happy with the error number when running on top of QEMU from a Windows host. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) hw/9pfs/9p-util.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 0ef67a53ce..4f386f40f2 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -67,9 +67,9 @@ static inline int errno_to_dotl(int err) { #if defined(CONFIG_LINUX) /* nothing to translate (Linux -> Linux) */ -#elif defined(CONFIG_DARWIN) +#elif defined(CONFIG_DARWIN) || defined(CONFIG_WIN32) /* - * translation mandatory for macOS hosts + * translation mandatory for different hosts * * FIXME: Only most important errnos translated here yet, this should be * extended to as many errnos being translated as possible in future. @@ -78,9 +78,17 @@ static inline int errno_to_dotl(int err) case ENAMETOOLONG: return L_ENAMETOOLONG; case ENOTEMPTY: return L_ENOTEMPTY; case ELOOP: return L_ELOOP; +#ifdef CONFIG_DARWIN case ENOATTR: return L_ENODATA; case ENOTSUP return L_EOPNOTSUPP; case EOPNOTSUPP: return L_EOPNOTSUPP; +#endif +#ifdef CONFIG_WIN32 + case EDEADLK: return L_EDEADLK; + case ENOLCK: return L_ENOLCK; + case ENOSYS: return L_ENOSYS; + case EILSEQ: return L_EILSEQ; +#endif } #else #error Missing errno translation to Linux for this host system From patchwork Mon Dec 19 10:20:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B9D8C4167B for ; Mon, 19 Dec 2022 10:33:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHQ-0003La-C6; Mon, 19 Dec 2022 05:21:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DH0-0003Dv-68 for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:31 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGy-0007Vx-Pz for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:29 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9dUcY026145; Mon, 19 Dec 2022 10:21:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=M2j3E7ngWrmbtYmE4yi5nz0iPjbdn8UqvgKMNy/r2a4=; b=Oqo2cvKP1T+gbllOx5Q/TC5h3r2xybjwmOq+iRm1IRdh2MjQDF8enWGPsM+AgOEX2O+B z8X1PmhGRyp1SWhT8plvUxcer2PjxntqV7aBYizrIciR0moKTAARkaAwo/NgQivZCftx 06tXJcieXIR0G6VkNMAeW2O3Fl2H+7YG+4rDsjxcmXR46MeGGr5hJymM9mNhbHuK67NE Fqp8oFveIzA7bXGySu5Du83CiO9ML/ZUp2ZwR8ov808DYDlpZxoZRAc3trRBsNgtq5Fq 33qn08p9BbswIp4pVkuQLqB2+qu39SOE4Fu8OOqAH/lHKF2TZMw4jK/7dcVgEB7e+nNe dg== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7e-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GhouIMMEeDqVkh3LIFKpupPx4JIY1yeB5T7+gZYe45cMhxuIInEGWw9jbG95TsWw/EsqUzW/E8tlpU4muzUyB2p/YdAQlwdOp4+dldq3sMdSdxV2Jr0w/MXOoTfnk5sHETweA0J3W8o4k+53MAC0LEihvlBqFJQ5M49ojqQL36VFsxRd4nqX7icUd8bEXZ82MroK60r78O3jHRg33qAuSVP6tZY2sSa4Zvw+eW7tZ3PH1zuF5nv6/ch5RppB0K0eFTi+/USxbMgqs9nx0Ad/6aPue609irNURYzZQP5nHrqFkakf+7TWzdNGmYDGyhQYpC5pCUtqxNS2TvRM4tHvaA== 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=M2j3E7ngWrmbtYmE4yi5nz0iPjbdn8UqvgKMNy/r2a4=; b=lr4Nn948rcbNqhYb+sQ9nfbiXbBJ41BRjCZTxc8mUHxCMIppR3AprYQYCJNduSSU9uJN4Y39WniT+Ilgm5LLDO7xUBEdH/SU/3RoRN8yD/GjQd+SOKebZks9e27p7TNFOLSh1QIl9aHtzEymWMY+zdKKbWM2NvRCJywWj1Zpd7cykCSlg7PKQ67oa7SYorRY8t0ZjsRgfVUHOwAYmSEGswvA/DM69/DfC0g7z0MSbig5TF6y+b4bX1m4KFZ8N4s4nH0kGa3YkPfIuwN23/pCmF+dRmU5Er9sKUR9TINEm8VlCbQHiF2tznQ8PWVJD8T33ff0iai0nfKWerOBNktheg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:13 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:13 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi Subject: [PATCH v3 14/17] fsdev: Disable proxy fs driver on Windows Date: Mon, 19 Dec 2022 18:20:18 +0800 Message-Id: <20221219102022.2167736-15-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: e9a920ba-a8f7-489e-5331-08dae1aac173 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wBGQa6tlj+wg/FwCM2Bh63dMzZ0OZIP4svgO16oeiSoAD3CwXQuKr9Gek10XTuiaOk1NXss5udkqj8WnWlQgKJKcBj/b/NicaSkLF0TcmL6v2jRYNRvpQTlYJJ2YDW7I2Y0JmW/XyVBLB5xeRBcU4gVxseXkgaDhsRTop6g99qZsu4GwRsfw9VS9KXG+C6Qrpvj6cMOkEyO5SiYFcKySWeEG3Y+uVQBkm0tztUgHWApI0hsNl8TfcKik5AAb9sGCddKCc4ihRbTHSKFyEeJEG1DiHnMCFTUkcRFPROIvuQ7v9hDqcq59OG4em40ceK2oK9eL4sX7fusVmxDBu9+4ZZTTHg3D/skE61s4WYtHBI9WAAA2ChrBN2jbI3Stqka3B8pKUFSuFRUaLXp/eswslAKkMBTvL0PezjGZHaXZi3H7jKiW/mo2NBsPTxHyaF9mMO4sSskkvYWtN9p6YQee9OcYL6u53Ys5ENGLwJVjlVNyG8KAZuUHvcOIv3Dab/ggUtowD+qh/a9U42QrbTAxisbw0roK1uCGhSDiVX81mVnq43nh6Pa3+xyEAaUCyjQ7XXcbQMXyPs3+KwL6H0/9jfatAYz/pnjgLgJn7R4z1B2d5Gdwp6L0W4vT6JymlgSypqjzhigT2adguxCMb1ZH5iMtBkZMnMtT/2bV5uaLhVAS4ZGP+xmoMsRDMAhXUB7/ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(107886003)(8936002)(4744005)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(52116002)(316002)(478600001)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Om2fG7wwNUSGMq22SFsT2OMzOQ5Y/QUvT2IBmHmHlVBuw60qHifHOZHuFQLKfJwhaUq9RaG9V2TD/d6rw9e+fwB4RXA660xLfix+EEHnMLs99s7shogvrpnt0jL6eN0eKpmMK/vr9lO+szQxiRihu/88n/uHf4eHKE/GSAEqj7kqbNhEcvMpfyCSYTPEE7XV4nTSFdua6YXTOstVouxtRm95nnfmDPKWTbNzJ/ZPXFbbOxHTbJWSFk+Jt6HNABIzTbmO9fCGfvIfE0vFWKs9X8df2JDyVxByvH4qdGUg55WzYELs9D6L94q3PoyeLzph3WURZpPPCIeFqdRWw0Cnl2XVstL4TBZvCeB9ceMpy5DduvgBHp51rpY2ZFB0B9Aovwgx9HiqU60lqdcYXRCzNdUOpLWEoVTlpG0uTX1HdcYYlOBJwEvoisXZwaZdrUbp/cWlqjawaClZCg7b0GjrvRZGji4OWBx9bbCgrBc4UmZ6ue4icf8Fhsj1HwaTIotc7JbDgT572MWqbud//tZ8fbiy/B2IbbZKHqg9qJXInzAoxWRunSPZZTMUt6vLyuq4vPiIKE/TYw9lS3QRl1jo/A+MUFGPhDEfPSayhifSrxHACBos/oXkO2RXpRgJSdEoDUXtLTQ58KNCptWvSdfCgyAmT4NJ2WA71KUvFu7DVibVDz8MEIfWcwFLEFexNMiJlQLeSUHfkPrXsS6MWNMNRm7y7+DPd3CB0KwWCpfr7o+gndHT4YDEnuqE6Sxsog5NrqLvXjne60wiymYnBSpI+7unnX+RToXmFjKCAa9i5Lfxpn++IsU78m/hVBCfCJ89L+C7HQuLcHi6g3SdD4AxNxCItOOoSygMWZSg15TBas+m/uvK19aeFGiS+JRa9BIKTr7iSnzht6CcyZKIcFZoZmwPVDqkSOxBbnq2CL/XIoHJuGk8ipTB7wGQnqni3Qp3xUpZVCdQAAgZtcELGl4CL9aYvuSnyUT0F1MIa9L3P+2YXKgO0TL+5yMeJoeznMh108x/52TBsKgFu9w131K8pFQsC6gPfx36AZ7710VTDupHLGnkrpW3DyBeFeSSgIRMC1cZ2i/4SiJ5qV/V/OgprWzEbWCJm4KOZhQ4yZZFwHt8uPHn2/LpZ0csduLmnnbpikpzCAb4qqPEvw3DuVrQ0LcEl5aF4J+zugHK0xBW4pkrFdA3sXWhOtSUNpQJZmIRnv7VuhU5B4s9x8/kTKJKmY6MFblUltsLGuxgSjCy8HphgbrEd5mf3S9amXvOoWQ9dG6JXayHgyPpVJZojDNzoVimEs9VBChzheROlu7ZOjGFeXjb3C156OanSejbJe1+Dr6zTbJcxtpDM9bjqDkZ7v4+xHktq7EIRVFDB4UirqjbyreqDWgkvqUE4zQsZiFaW3BrWtXBuhAcUBNTqX0esOm33X9z+vczG5V9uxEEjWFwpDTvp5RO5ZDD1JyeNmsU5Mm6VIhsU72Rf3ZkzH5UtVaYT7eqM4/az+oRdHbuUI/AxAK+j1ik6A6N4TJuT6+azVwuG386QJfakLCjNAgVEXKcqJmMD+FNfNRm+a+0IZxfwlGkd5SjwbEwRw4yAycJ X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e9a920ba-a8f7-489e-5331-08dae1aac173 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:13.5408 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WwYsc8t6QO0+t03W9W5Xgk14YpVlfjMeqyo4pae+yXNnDfvtAwnW/475ji/Ft6/NVUrItolHJA0/w0RBAzl2SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-GUID: 0xERC2_gDiVAnoX6A5f3BDvRgrqOt4rJ X-Proofpoint-ORIG-GUID: 0xERC2_gDiVAnoX6A5f3BDvRgrqOt4rJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=752 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi We don't plan to support 'proxy' file system driver for 9pfs on Windows. Disable it for Windows build. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) fsdev/qemu-fsdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 3da64e9f72..58e0710fbb 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -89,6 +89,7 @@ static FsDriverTable FsDrivers[] = { NULL }, }, +#ifndef CONFIG_WIN32 { .name = "proxy", .ops = &proxy_ops, @@ -100,6 +101,7 @@ static FsDriverTable FsDrivers[] = { NULL }, }, +#endif }; static int validate_opt(void *opaque, const char *name, const char *value, From patchwork Mon Dec 19 10:20:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076455 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70018C4332F for ; Mon, 19 Dec 2022 10:30:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHI-0003Jz-8R; Mon, 19 Dec 2022 05:21:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DH4-0003Ej-BH for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:37 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DH2-0007WF-Qb for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:34 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9mDb8010303; Mon, 19 Dec 2022 10:21:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=PPS06212021; bh=xlnfjBVVSlTgt8rLyj8y5aIPzqOjQBeoW/Whh3osAzk=; b=EIAMbFKk3f+RKuUf0I4pAwLNYSqPiYpy4G5SP/ahACpqVTLS7HSbAkJgFFwk38aN0oxM PtZm34idRlC4glLVuukTz0d7aj0Ie3fRUC4gbKCcNcDBwAyvQWGVpkDAaoFcID00Oo/r a8b60BaU5R3ZlhRtb7GEEkSsaWb9U2ZjM+Gev5lKkgEwzFG5XjjM/P2ku8TzN7zIRXAg L0IjMeuloRimUz2ahyd1ONLh47F8EGcoeMj18+YUjrjmNdaLe4b2P6D3whzFfTx20GSS KeL8PfwjZmzlXZoP3eDwb4zTYxHnwGznzL1nF+No3Z3li4eel73Q7wl72itVses3H3lF ow== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BTd2mSHgVjnuWm1tFqHT2Qm0s00Lx2Hd7y10Kr2EWN8qF4NDPKCqHvA4p5obH762MCfMZOdCUwIldMcxIxVXDJCf8+Qf9eRvqtBvdCKiDSijpfxhxG0jNSAIdwGpsKnICJg2HW/ToLV9+9tjCvKv5pNls+nZMJ2Fr80ebQMx48zjYiJ8zE1WtvOZeV7/EtOZQZT55+Zzc5UZnH5gml+Y+PThHcbUZCQ5Z86sBYEpYE2X3bTF2fDKLsbH74XNh0CUd74ynvlmfDOrGaY5JgQhJIp5CcQoUktLEc7eQX0pePQ08q8EJlwCjjT+YNC3Ah8WjrGwTyJ7Gb5Bbu0AmwmJeA== 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=xlnfjBVVSlTgt8rLyj8y5aIPzqOjQBeoW/Whh3osAzk=; b=ch0z6GWTxsz+r3hbmHOmCOfomTQ2evrtykr3M448b6aonPjCJyuiLP5TntMjQNWNdVtHgkTa3/COVX+8ZLTgyl8YPywxq2kIrw3J6pP2dLIq6Rz7Nh2utP9fuqXfE5u+971XdBa1en6LQzcK/U5fP6jvDK9ZLaJYbJKjEx/hiWxCM/zZDPz6N5tBfD+ynOs4qoOv6ojDtb7cAlgUWXet8NlEaeIarF373RXx8h++bGgFJN+2VN3gS124CHrFBX2eQirwwssKI0ESSxMAh0PSnbBub3X5SgYwi99CUa6XPFzRNKGoHY39XijfwFWRRJdrn9eRAy50BkldIC1ZYEQcpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by CH3PR11MB7201.namprd11.prod.outlook.com (2603:10b6:610:143::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:16 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:15 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 15/17] hw/9pfs: Update synth fs driver for Windows Date: Mon, 19 Dec 2022 18:20:19 +0800 Message-Id: <20221219102022.2167736-16-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|CH3PR11MB7201:EE_ X-MS-Office365-Filtering-Correlation-Id: 69fb60c4-a32d-4390-751a-08dae1aac2d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a0B0xh10O/3sfCcX4vd0wTulY8Y2usvGQeTJtpGRVUm96r7+ycCxCzVyaCclU0FaCyz6SWvum0mR9yzQEPvi/Jd6iudCNp7kbzrRWsmqtsfhwFaKwXQ9JQK0fcvYFQ4A3QcjB0bEqXr8FJDJ/JiC/NbXCwhiSX3RBp6xPlB0MP/PAdRoEpmHyVdsbDVW+cf7DDosCfnW/6IScirn9Ecuqka/Oh7JruxM52JSyurY7orZ497wDLX7+ymotYGPislA/JOoWamFikK5YGmbj9/v4K4sYwc6baju9fClRZCfTbIYj54+7q3ZV9VTB55Fthcgd2eEkTDvioFBnLJ5Pt1Wa7G0eEzQQ5jOi88z/fwfgDphdlJSs6XsDYpL9vdh1OIyWwlKPulltcdEFNC9mbu/cs8CMB4KpDCUigo3nh1KzMlzkp+9re8YqeTQ61GlKK7nJGR1EHnULAPnthSzI44X70sl0SNfWJq5Y+u4BU3GoPwa68PQrR8Zi1ylJ6mKoVDN0tXlczAi/34H6r5ZsUsmUjx6Wuy7PojoIMmFplND9gXitkmzzB6lY2iJIB2cg3vs+HZUdO3XAFzn4A0v0Ad+6AyTc7IJrkurt9Csgt9johWe9b5p306DpWLTlEd03TVnNu/v5vS2vEkoYGMHrHoN0e507KoSbfiRZFBmrQkIcSE3Flkk0SNUwNiLr1dN86/41ufNghMkegFowdb/qzD+Pg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(39850400004)(346002)(366004)(396003)(136003)(451199015)(478600001)(41300700001)(38100700002)(38350700002)(26005)(186003)(52116002)(1076003)(2616005)(6506007)(36756003)(86362001)(6486002)(4326008)(2906002)(66476007)(66946007)(6512007)(66556008)(8676002)(5660300002)(8936002)(44832011)(83380400001)(316002)(110136005)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?mKTEo8O+2rsiDs8YlDRFt3Ir4jn7?= =?utf-8?q?QR8J8cSHFKGMi01ihWTMA/XtrlhSs+nGIBwJfJn7Vl6tgghPG3eQkH8srhkInzP20?= =?utf-8?q?emWi/1a1mQE1E9+G2swE2wGrZcB9Crya+JaQdJD6Nn6B9MACgbYhiHxhnrR2O/q7I?= =?utf-8?q?Ee6OsQX0dWVrri09sDYAFoJRCdV0YLGJQ3h7UV10Bh0cHqHH9sRBpBPRDJtWN4jVc?= =?utf-8?q?vBaNDS5h/jo3XlAWy94WeUaY7yC7HLUdqEKzsefRs8C5ObqKP4WjGIGCToHfiQc3S?= =?utf-8?q?Q+T/Gzwl6q9K+7xysZ7KE1hDXqYxq5fTZMqiiXRmrnWHNQ9aGG4siyDvBE9rodACT?= =?utf-8?q?ktqoJ0riMrpdWpE3PqBeM6Xr8ErtBUr9pXxKvSw/TaQhTzhuKsQtpgfBmE5+lqPeL?= =?utf-8?q?Y4e7FMAjSzG/ogwNOnxUeET77P9zGsMavwaCmTg/Oj9lejBGtefWcRyRwemQpgHDS?= =?utf-8?q?0QdE7fLzKZ65XVAKfInacAmCszc32KHJuHtW5QkUF2kzUbHAaRAsxFXjuvoFZxDrh?= =?utf-8?q?zXPQjlUAkFWPhpjZ9Zavke5UyFuZvy2OTqBbN88LdTvdFCvEjzsSqNJVpnx+kqeVW?= =?utf-8?q?om7XjWJQtRXlNYaeO57o8X1k/SUuVusgAI1nko4WGKTnS6UBNawkIZao44RaNIkri?= =?utf-8?q?bJeaF2YVKxIMtl4QlRCpOR7ah07iTW6lGfdpt4Y+XGJKX1kB7iuruPF5uFKnNVmj+?= =?utf-8?q?XXZ64p3jQSZy7dix27TWgPOuKA1lsLwA+y54rYoaOHrFopwRSg+9ib6E72U7Gvztw?= =?utf-8?q?8J0Iy6aR8GxWY2UfTl3yLZ2DNfKbMIdX2Tb61+T5O+FGKkfkFBO/L3FQGg9jYBKNL?= =?utf-8?q?pdDdmbSRJAQLK6ztve/g5AhiSIQKaWj9muCFU8b63Idt8aR0hmVrh3aOLrAH8+BD+?= =?utf-8?q?eB5TLYrF9ZdfvJEhh5fYavjOkFuGfKRJpHLIbO4p73N9hY82Cvi85XezMzJhZqffB?= =?utf-8?q?qpKtZYgEi101OMEmeGr5IxH0erosqpfiLPXOWwPEQrYbTuRW99oXMju3OZvS/PDQd?= =?utf-8?q?ukPfBqcRwEcmeUn1JBL19wjqKkUQQXcIZasYVkp5QvV9ZLsIFRIr42ddCt9vHQq/W?= =?utf-8?q?PJ9i0DVgeLT+iE+95TAx9JEtC7012KXZzauI2p2uCk6B4LVP6QIo+LWrBWrpCrm5f?= =?utf-8?q?uDHJ+xx/G6u+wSL8Bfa77Nr4NlbXOLdlN3s6eWqghfsJbLM7qGykO8xpRtF94ELUT?= =?utf-8?q?jb19T2IwFg3eFZVX/NSKSIybG8PH/tX/aCmXA2cv2xPpuqirr7VMsy3EqT0bRyyfY?= =?utf-8?q?OxOEpouZe/YfE5FcfsIgcwA0J2ackp2wvoGfN44oKs7kb6Fq6bkyPcMJ96yUsrk4M?= =?utf-8?q?rv3iS3F91kzgPzSeBlbiFDfUrWBDsuWmC7+7g/bJ4qHo5C2KH9MFWiI16dlmnkqjd?= =?utf-8?q?FQtLZBSL4E/6Vzdn+qrxWkYaAl0A0blFb7ALhn//jutCfRP0XXJqzMWb0mxvL/p91?= =?utf-8?q?Mi7uRinMtIzqWRaHte9aZpYOlNxMOuWXYDQIac7bz2tyamnLivNwtCyo7Zn0MiQFB?= =?utf-8?q?sWJsP86YeSXP?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69fb60c4-a32d-4390-751a-08dae1aac2d6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:15.8526 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zhoFJSSxVC1HsIhywlr8c+4lgvDjlz/Z9SNlSTSMdzKMIN8FL/UMt3+brTa+//Vfa4sD8Gs+9eT2x/8nvWLeZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7201 X-Proofpoint-GUID: i421xtYQpW9JGH3Zt6_YJS8G0ZujSorJ X-Proofpoint-ORIG-GUID: i421xtYQpW9JGH3Zt6_YJS8G0ZujSorJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Adapt synth fs driver for Windows in preparation to running qtest 9p testing on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé --- (no changes since v1) hw/9pfs/9p-synth.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-synth.c b/hw/9pfs/9p-synth.c index 38d787f494..dcf8c1624d 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -146,8 +146,10 @@ static void synth_fill_statbuf(V9fsSynthNode *node, struct stat *stbuf) stbuf->st_gid = 0; stbuf->st_rdev = 0; stbuf->st_size = 0; +#ifndef CONFIG_WIN32 stbuf->st_blksize = 0; stbuf->st_blocks = 0; +#endif stbuf->st_atime = 0; stbuf->st_mtime = 0; stbuf->st_ctime = 0; @@ -230,7 +232,8 @@ static void synth_direntry(V9fsSynthNode *node, entry->d_ino = node->attr->inode; #ifdef CONFIG_DARWIN entry->d_seekoff = off + 1; -#else +#endif +#ifdef CONFIG_LINUX entry->d_off = off + 1; #endif } From patchwork Mon Dec 19 10:20:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076436 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E45AC4332F for ; Mon, 19 Dec 2022 10:22:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHF-0003JR-Kr; Mon, 19 Dec 2022 05:21:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGw-0003CP-Mv for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:28 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGt-0007VS-W3 for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:26 -0500 Received: from pps.filterd (m0250812.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9mDb9010303; Mon, 19 Dec 2022 10:21:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=EhzGH2k4YwfRO4tEM52bj5LThqSxVk3rVHoc+y1mtTo=; b=bxX8TBcRdLdWy1HszSEkOMFxJGRhHUhGEkMpOeNN4Q1MQX5rWIgJc8iwudX+8ssKtYKl rWoZzuM2B82Mtv46Ja1ed1b38xPOiQyhTS8Wvk1lyoVm509G/H7D4XpibeeBM17kljbu MbOHYfL+atnuqSuK9hdotajVCH3HddrPbnYQixkDPIHfXqxjDQhTxfHcWt3+FVF6EKvf 28bWGo3zDw8qi4GlGDagmmspQWJM70Xkta/vTWckwVTNTze+MFCc4Goi6YaAi0VNkRtd cci188QsvaMRwGeAi9x3PYHGP07SItX1CjTrksMSFkCYnnBd7PWNaaoLZNt2bIqQwOPC XQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh4r99b7g-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PmLFGW/am9DaRyDz2puj6ggsRctVgPVvHSB2h0sWUseTSOYDFLxS3bsZROjodXA9ZI0YBpHfHaAPmxOUcVQlsi88BRdwrx5kemwXBOiijINtJeBnQY9WpjaWYyw66RtkouCd8Yz61nLn27qdlAsv/u/bao5i5zhIPglA6L9DMB1k8U9T+u3uAYWYMppLb7cZKCdwxzAGYyDqA3a0ACY7YYfWBwmPcSLrGdJlCm7jKT+APx+KHdLMeJLOuhzDpm8MjeG+WmsPs7iEk7qvF8OBV0+e2dO46kjY5L3FW7dfGna8hO2cz3jbqjl0P4kZFOMQo7/rWrUKhMIk/N+kij7jng== 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=EhzGH2k4YwfRO4tEM52bj5LThqSxVk3rVHoc+y1mtTo=; b=E00yhZSIa8cRwFD6+vdUyabwszIl4c050mQ+1WAVvzjn3ZxOMf926v+z6Twhgn0KHA0djCHtNuq17C5XVxDy7Jl0ghs56aIfuM9wIE43fgexFwY/Uf6BQTNiue4HX//W0i/7duysfQ+qlUS88HIBycRiybwmlt5pEaGBgHMGtW+pTc9hcAGUuTTW3dE+KTrji5Ffsx+xREB5ERqP54rTcwkjT9AllUzO2rb7tkXnScnChJ1rv638qo5P9idAt2aUeGX08nYkYzrorJ3jQ9Am0HLUPaZ3r8zTuJDIPQejtBA9iVmRyoHFMSOEcNpjxSO8AkQKVCF/yOGj8cHESVmFew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by CH3PR11MB7201.namprd11.prod.outlook.com (2603:10b6:610:143::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:19 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:18 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi , Xuzhou Cheng , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v3 16/17] tests/qtest: virtio-9p-test: Adapt the case for win32 Date: Mon, 19 Dec 2022 18:20:20 +0800 Message-Id: <20221219102022.2167736-17-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|CH3PR11MB7201:EE_ X-MS-Office365-Filtering-Correlation-Id: 559c6400-10c8-4ac5-50f5-08dae1aac4a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: i+jlr+NQ9JW7CRpmqOJH+SFk7GvZQkJhzgd5AgBPWVAdq5QAsP2Gbs6jWw4oxX8UEtyZkXn7hPEYqbUNkHRW3Eci3dpXC4ndKBMn/mITfP2dfL7/rZ4gV7TMSIZDluAlKrZdJXf64kyC9odEUUPG/KcJRvzvCy7f7LDtxog/MpneZpEuG1fYg7WFAxcm0C+EZkOv01G9bZAVnWDCjvo4UJVG12T2Mc9LWaUdm/4e506nY+HJ735TheEGi22BAaM/lYfsGuA/EwP44jveFbeHby/GoDIJnQBcpnw6xTNF9NRO4Os+vCqS0pGEH0C58dOBFoslLCj+t5BjSsB9DZELFddzeNouvq2siYB2PZHwMNfJ+CjyTYP5PFw05/g4Xqu0VV6drUKZR9gy5LzcVr9DQN+I/jLkS+vLWdTre7T2S071nHPUMt+t/cH13mR1D6C+VDRdLZmXq7K94tokYEP9sg7hfxYNh6xz2QBMswhTtbWbPmP8LaXo3y4lSnyrh+eXhtmtAufI+MWrkKRmhFYuV9Ers7tyMzz7nv8e0t5qMVGZps+8n6fnGuzwe7semfvAO5hjk3hkpp4ESNv/ucM0w7tDRHXI2rTsdfSyDc3fUyIw4yXXLvhlJEvAbPmGWfRuC1rgNua//Njrlorg5yvkyrjLWIcJd1uFxfW1gc0WGrMkvm2diMOFM6zHF5xCZWGY X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(39850400004)(346002)(366004)(396003)(136003)(451199015)(478600001)(41300700001)(38100700002)(38350700002)(26005)(186003)(52116002)(1076003)(2616005)(6506007)(36756003)(86362001)(6486002)(4326008)(2906002)(66476007)(66946007)(6512007)(66556008)(8676002)(5660300002)(8936002)(6666004)(44832011)(316002)(110136005)(4744005)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vqTPrH8N6CPwQz3syyKJjiFLShulrWfGH8ucNsRVxmP6FGVEVOvyeHozUYWW7QrlbGNFgnqKNsZ++mbFxmntzUrpe4F9xpvnwQyX7AN47VoI4HK7CR2H+8JKdnhP6j5ooPRWwBeS0YHlCNRGqWgRsGtYNBmeR8UDUi0vOFk5pa1hExBfMMZaV0l/hiaSbzYYi2wYoKzjUHEIqpwb06NhcpPC/IDg0PLGdmldp8NkYN8Flt3Yfdr6gq9MOmFw6rUr2VrXsPejtY02bLYfrKfYHqLJOJ9ZBqy3KU9kNNBg7+5NOmJwdfB0ylm+73PxarRMTbjKbC51kntTDHorItXtOGb+qB3NW1FaHQFr/23L6e4INNzT+2n+mahGd48nDgFEqopPcW9+8+o6vB3ZeLMfrQ0weT0SPR961IueQYsAzywF/NuhDmZ7fGg3wNFdmVH5lwWbDbP2BbEPZY8/4Z5MXserr/z/j2pcelnWkTWZphzinTBlQ3dCgOW0uuhqs4AjO4JqOXLWePdV/tgHqTs8vaI6nAUs+6EmDFhghfFaXWapso+dreVj0EbI45kedqTW/ncqwDd9nWg+YgISROjU0nzpdizKlCFKAUnYk4irDscNtzRM4/4O7borleTtOHpx0AX2UI2JjPdai2/7K41TNUXoO4L4YJ60FQjqwcrgmkjB0UJfGMv36Op0DtEo8Y1bJEbz4Xi2LFHRZ5ntvOBTeMjdj7uMfMezDFsCjFK4f+PmcpUrYP6Ovuf5IBeMeXCki+InK6ChInuKNRvOU9qgrD0ceWvDuc47cI6dqVfflYtOHKxZMihZDOHv6e76Ix82KSzfpYlQHKpw9MDdNUdV7DNRqaYC0+FnD+0SvORo4uyOoRiu/gMPuZuHJ+U7vG1ZO2Qjge3emCb3iio+RkZFOizeG+vHH23wJayN7j1v8j4n2gLjsGLxVO+YvJtfIieHwRz8NqvZ10eW5tIjH6b7u2UcbqkEjQwsL3bnmq8mnYEqygs3bR24I0TIEOQBbyy6qd5X+vA+6M4e/0gnp5UgwcEaaBoBqDlmb4E8Zvz/0xtIhLVGyk/6dCm/Mo7ixyInJYDOswXn6tEg5c25Ed++91AOm2B7p4rdnwmwlP+DbpmCZLYE+c0NeIKnvEc4w0ufTakK3MBqjidKieHTq0G+jEKyTW1UpFrowco6GOcHTmxMq4RzMpe1V7GrZFBNGq+Qx/AJ9tF0tMcHxjETEUihYhYwoQb9A6OsBAmRvjFlUzl7mGlbIC0Ik5woGMTaF4byc8OLyqPvnFvXTiqTXgStSqtPRMbgCYbFWAEuHYkeCMeCI5tPxvg9lwaSh/wXEJQq55qA8k6rCMV0YMIxHx7fHfeXy2SOGVA4VG/UXA5q95MN37/gplX6dlpvvpZbaXbf7D5og+z3+SW7qvHDxhq1RTABb35P4CHBdVNGRQc07nWkZAllu3feqvGjqYa5csMF6FMzcuBowrJfK549bglDSTXCvdjmpc7r/05bUMgl9hL7PYIsJwV1ezgiLNrzo2I/DsxoWAqoIwK1Wud4RAiVkPIZCsed1cVnZckIayfxoGoD+MVKhH1MTdKREByxuTxH X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 559c6400-10c8-4ac5-50f5-08dae1aac4a0 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:18.9171 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2aTlRXqwfRgWFHXGZPwqY7SG3bTjolnJxMdoO7Wk6OO61p9HMJ1OpgMFMeQAqteXdJGKFagQg4BwggbHo70Mbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7201 X-Proofpoint-GUID: kz9OJaWbvCAmXUVdR890QkPz7fu6Wghl X-Proofpoint-ORIG-GUID: kz9OJaWbvCAmXUVdR890QkPz7fu6Wghl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 mlxscore=0 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Windows does not provide the getuid() API. Let's create a local one and return a fixed value 0 as the uid for testing. Co-developed-by: Xuzhou Cheng Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng Reviewed-by: Thomas Huth --- (no changes since v1) tests/qtest/libqos/virtio-9p-client.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/qtest/libqos/virtio-9p-client.h b/tests/qtest/libqos/virtio-9p-client.h index 78228eb97d..a5c0107580 100644 --- a/tests/qtest/libqos/virtio-9p-client.h +++ b/tests/qtest/libqos/virtio-9p-client.h @@ -491,4 +491,11 @@ void v9fs_rlink(P9Req *req); TunlinkatRes v9fs_tunlinkat(TunlinkatOpt); void v9fs_runlinkat(P9Req *req); +#ifdef CONFIG_WIN32 +static inline uint32_t getuid(void) +{ + return 0; +} +#endif + #endif From patchwork Mon Dec 19 10:20:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF261C4332F for ; Mon, 19 Dec 2022 10:22:16 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DHG-0003JT-QK; Mon, 19 Dec 2022 05:21:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DH5-0003Ep-5a for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:37 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DH3-0007WO-HW for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:34 -0500 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJ9uJ1k027775; Mon, 19 Dec 2022 10:21:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=PPS06212021; bh=kO364TjRE2+3rUbnbGQZB7EL5tyDvIdFZo8eACVoncw=; b=XWaFHwbFUi5DzZZ7wcUwigB8/uT2VvhViG2Zs6AXmnT896wO8PAymBF+td6U/Wu85fxL j3auT91fU9C7cFGHKGnzSXpVV0nK/auFs8LJaNeuXHGR9iDISYVbs1qv1rRmF0zLBbkd o6V+nnwUXLUHbhoZgjiVR1beGgo8FnArKAwunrc3pBESAg6lDJhOhTNUG39v33TbGFx8 C9nQjxgdPFbkRPs9i0UUzXL5wexcNVwamsdxypuD6vrpfREhsp5JhqsC5gXhpD8aVOCQ lOy5bOhIJbfbDTyjgN9+neWpCUg6GuFiP0zEJbw8pNTRb4Q+0Z1WjULwR+sdrOvxY+Fa 2w== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh301hdgx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:21:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lf+y2dmiwZ+q8H5hE+jCESQMNXf6C0DFQtsGDIXE9/iteUU/c0u3kVTqV8HZRXJ5Qbai/GQ2q60jco/8WGU5Og7NQ79twOr39BLLyDNYqGrRHpmdzKFTNd7/4xx8Zxhte6Rx9eUGIEUvX1gUjN6/SQODYz1zmPn1GiCn1PRHgcJgHg3NVJ6e8imz8VNIDuPyeLRXKfq19O0m1mAYXqgN01UpGWHLNYbuWpHdPtezEyIWI6dErWHK8h65livj1ON5iNpS7er5pVTXHwTMYd7auVCWxgNO/+Gppj3ajd/r5M7LYlMaG7Pf+pmXFh4J3XvMoU7ARxyRXMyPlWZJOyQp3w== 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=kO364TjRE2+3rUbnbGQZB7EL5tyDvIdFZo8eACVoncw=; b=Ey7G2NoOMaK5lgZDTvafG1qYJhBfK3+jpLmwGU1tFa6y9m1ZEtTXIyNzx/7HEUxvvjQYmCp8BHem4FRqf/7s+BE2H0qQPpt1oOvO3DZfq4Z4il7AW9UqwbMQb5nknLX/pqADIRBpQdqoGqL6u4SZdLlIcggQcnSlqjrVqkNs4TFfe9y9IwTovvcS8192C5sylVUmKHx4HFkFu/F5fzMAP//mgt/HR2G+1UqS5UVQfS2pdcn8w6VFnC4Yd2IUhunOCgBdyHtyn0GBij2I6cSXlYwMmYphZbFjhXCIM3g0q9eU57TXRCnEuuzRgbDBOzZDjxfQ8kw+2ll5LVUFMCcDhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by CH3PR11MB7201.namprd11.prod.outlook.com (2603:10b6:610:143::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:21:22 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:21:22 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: Guohuai Shi , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH v3 17/17] meson.build: Turn on virtfs for Windows Date: Mon, 19 Dec 2022 18:20:21 +0800 Message-Id: <20221219102022.2167736-18-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221219102022.2167736-1-bin.meng@windriver.com> References: <20221219102022.2167736-1-bin.meng@windriver.com> X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|CH3PR11MB7201:EE_ X-MS-Office365-Filtering-Correlation-Id: b7e06652-caa3-4d05-75b8-08dae1aac699 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vo/lJAR9gUMQq7vVO9UKWBB2sUrbJ85ijcgcW9cS5punGrB2tl12GrN3avAaoXNQ3yUU4Dee6fiGo5PXNGWmsuwvG7F9QMdrRcLv9/zoc7ZcugnUjkK0wHWJPq6Vm/IsUpArA44dIaorL8n/9ElFS8Ln3QRRXwk03w+8DQdPTdV54l949koiweZuFGuUgh0ZmcwHqkHrrjGKxAw7qD5Ttw8MsUTfDXWMvt67L3hkiBNdwleJ8dQM3GjHooOFcbAkebPUBBDoVrL3MJzI3fRPEGdattReEibpvPQTGPxbmW7R4JNfIsP6b9suSO7sO9Kd5UNaMQCGAN/y0xclSTmlT4x1aqwYWlhp8TmApPR5jTrhOYrYIEZAIUoMM1CsEs5LBE3qw4Fp8aSRgBWffKmq1wbRTko6bnmzOcu+xITJiHKHK3i8aC5o3b2Q3YiuMw4hZIuDDx3y9p1lX+FlmxvcezeLPr3bN2DMEJT6bUVik0gnWxTxAuWEIFcCc2Sj4ufLp9W8uUWktT5MVAHXqza5KnVIJ0Ah1CU1woLn+q2du1Q1YGCAJelfP4gbCI8vBhP/IzwS3WbzAby8NPn+njJBi3rK9jsIA6VQXPhlQxjcvx7hd97FEUOJ8W3SKMLHKf2F2UrcHUckx8CPPPcpB1SrTWEW7SKBVGPvu5JHSJaKBEXi/usTxVwMUD8S7e/RbV4T X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(39850400004)(346002)(366004)(396003)(136003)(451199015)(478600001)(41300700001)(38100700002)(38350700002)(26005)(186003)(52116002)(1076003)(2616005)(6506007)(36756003)(86362001)(6486002)(4326008)(2906002)(66476007)(66946007)(6512007)(66556008)(8676002)(5660300002)(8936002)(44832011)(83380400001)(316002)(110136005)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WC+iivk3AXlTxeTsp5DYkVl4Z3gzuWxdbzLVs8yUc0sktFU7fmrkvzKxc151WKLxjI8nBZ0eDtW/wCNinb8v3r4hoiL4uEKRtnNEsrfasrRdEB4b5foAWmHL+mqEG1afHb5/sG8ifHWg1JbaJW/sHgfYVY+MYD5+fq6pMbFQGECyLCrj4OawjVi6sCaAJJMmooz9ksJGpm9u485/YNJlW0XUcOYjlLZTSETdvWMMCiXuMU4D73YuOocFEMyfXZYdGOGwOgZmbvGVdVbfQtP/NcPMVZHDWh5mOo1cZ0owfuUrI3h4Y/5EQ64cvKOWScwb49aGAb15bse5yIfsNzqMeGMweu78p99xhz6fCRYXW8oXdY0wOVinPFUKRrZNH64fCxziwdmfaDiJUpb9oLi1vjR51hqriwAcQtNzK6cjHhIxv5v+TBHIr6Tf8FI32xNnp/8m09U0ugduY2RenX7CXJ7j1B0jJDMwhpgwekpHWLTDMYu/IHsju3ppvvAVZ4dhy/gWrwXkiTqHPI2HxVrWtKWZNZyCpr4o5ntWJIqC9f+oSGfrljJTBD0V3XsT/pTXS5oh8QBMgQ3wpsF/Q+JTQYNgsXtNFE3I9yOoYqVVIPKMmPZmX0xRMzZnubXLa01utaeRvhrDCxtHHXz9IwsDHHn8vLawfXHFwgpduIG0JB/hM7FentJ8WbwbqpYXMKJkJcCBq8yC4v0HOiOh18arD9p78cBR9AYgD7Xcdlyq6S0wybURweXOpF3fYBnszfS2fhK6IhpsxKAAs5cUtOD93LthmOFhoxSbeOCk6o+8KDJ8Sbzv8KaEjtCpTYhAQ+nsFAmruugmccBo8HKbiwippsi+UGd/2ciELVPIznbAuRaiYox4aTyQxt+sBJAYihz1nWMTAwpGSHtm8nc+BSM3v+W3ZhCqvHgf54cIf9HQVNuzq8F/kIqDxumFE8P1x1LrcYTUTc/e7yELSjn9wvX8UtmDvGVYx29Qkgdu31anTfcggravQ2x+mcfIq8CROyc0cIbJL14IbjegwaQ3JYYBgFbjGWFpvjtnI4V/rz7FpqkWBV/+pmU9u7ZJmwbByB41qPz1Ptd/2c+LjyiKJgQTIhXxcOZu9O4BoiE6kZJYsLoVUXGmM3n0/w2Ldg84oCgMoAgx6LDiyhavVNoDBOjF9nj4CXeFosy4IDoY4dsUUqOSwzxcy07SECpNbgYEAg48Z782PrwSmCBAhdoQVe+9huKQ56PRCmB6pPIj5jQ2tbba4SVIPvJCf8CkPewG7Z6CAhGDkuH6BwNLqy/TuTG/wsYiTrpPe7BEwtDYlx5JEF6dT+IZO45MuMi/G5of0mxRYUcorW9MXffCX0RTt0t7SrWMEqS4WrTdYmrQK4AtDDzFHTWCkAH05kyhc0MAcIdePmVurjovklv4e68DbYisRa+kUTyuj5jZ7sNJ2eANFWbUbPMS6pU3SMaUTsojHaYBWXN9QcS3omj9D3FVNH8U8ctganOt07paNqH2sSkeJ0NveXVtWCjzBLVl5wcAQUnw3Rktezeet/mH3bd5gUXMHTZNDpGfFWyhpaZ/KQ1x5q8C6y5oTPZL4YogFicM0zfB X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7e06652-caa3-4d05-75b8-08dae1aac699 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:21:22.0387 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Mune/3QppHyWgsZq9rvpE5IDJRJsbi4anrQGKHxQzzMcqOzVHPZtNVXUtnzQZMq5BtJomw+ZEDztU0ZH5XhYhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7201 X-Proofpoint-ORIG-GUID: QmyDWUVccgk_f7_1yRfyFDuKGww-dd0N X-Proofpoint-GUID: QmyDWUVccgk_f7_1yRfyFDuKGww-dd0N X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=829 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190092 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Guohuai Shi Enable virtfs configuration option for Windows host. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- (no changes since v1) meson.build | 10 +++++----- fsdev/meson.build | 1 + hw/9pfs/meson.build | 8 +++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 5c6b5a1c75..532625bdbe 100644 --- a/meson.build +++ b/meson.build @@ -1743,16 +1743,16 @@ dbus_display = get_option('dbus_display') \ .allowed() have_virtfs = get_option('virtfs') \ - .require(targetos == 'linux' or targetos == 'darwin', - error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ - .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'), + .require(targetos == 'linux' or targetos == 'darwin' or targetos == 'windows', + error_message: 'virtio-9p (virtfs) requires Linux or macOS or Windows') \ + .require(targetos == 'linux' or targetos == 'windows' or cc.has_function('pthread_fchdir_np'), error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \ - .require(targetos == 'darwin' or (libattr.found() and libcap_ng.found()), + .require(targetos == 'darwin' or targetos == 'windows' or (libattr.found() and libcap_ng.found()), error_message: 'virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel') \ .disable_auto_if(not have_tools and not have_system) \ .allowed() -have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools +have_virtfs_proxy_helper = targetos != 'darwin' and targetos != 'windows' and have_virtfs and have_tools if get_option('block_drv_ro_whitelist') == '' config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '') diff --git a/fsdev/meson.build b/fsdev/meson.build index b632b66348..2aad081aef 100644 --- a/fsdev/meson.build +++ b/fsdev/meson.build @@ -8,6 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files( ), if_false: files('qemu-fsdev-dummy.c')) softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss) softmmu_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss) +softmmu_ss.add_all(when: 'CONFIG_WIN32', if_true: fsdev_ss) if have_virtfs_proxy_helper executable('virtfs-proxy-helper', diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build index 12443b6ad5..aaa50e71f7 100644 --- a/hw/9pfs/meson.build +++ b/hw/9pfs/meson.build @@ -2,7 +2,6 @@ fs_ss = ss.source_set() fs_ss.add(files( '9p-local.c', '9p-posix-acl.c', - '9p-proxy.c', '9p-synth.c', '9p-xattr-user.c', '9p-xattr.c', @@ -13,8 +12,11 @@ fs_ss.add(files( 'coth.c', 'coxattr.c', )) -fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c')) -fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-util-darwin.c')) +fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-proxy.c', + '9p-util-linux.c')) +fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-proxy.c', + '9p-util-darwin.c')) +fs_ss.add(when: 'CONFIG_WIN32', if_true: files('9p-util-win32.c')) fs_ss.add(when: 'CONFIG_XEN', if_true: files('xen-9p-backend.c')) softmmu_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss)