From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140698; cv=pass; d=zohomail.com; s=zohoarc; b=Ge8uJeJGYHKbuz/o5N24PB8sMZEMPJ+jD/eALQuLJNlThFsheLeS1ZDlSO+/DpdSNYKEkoWa54M+UMiPlw3Z2OWrXHHch7fqyOcsQ+o7FyiEDiKBq3AhjEWwZdSVJfzP9y+ZUpVMs61lgezcCOxfopVFz4ePhMLM6PVPzriJfSM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3J2NROZnClrvuX5c5BEezlgW8s+8HRmDzv9cpo+LHXE=; b=XqmObs+a30fsxj+5VwvvTHYa4KS4OZ1uM/Mku5IaAahuY5vP7A4Tp0WHF85kMrRAz6orGY2etHvMhfPk3Y6UDlvBqwXNOB61sWPLivlv51OVziteBi0UJyKWNxxKCyyZwazxBSuOMIIne3jdlea2p0yhZJVnvfpiEavKQrQt9CQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140698261497.15592809750444; Thu, 10 Nov 2022 20:24:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZc-0000Y2-Mf; Thu, 10 Nov 2022 23:23:24 -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 1otLZY-0000V4-1V for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:20 -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 1otLZV-0001ZL-9x for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:19 -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 2AB4N0iJ024928; Fri, 11 Nov 2022 04:23:00 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:00 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22:49 +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.5813.013; Fri, 11 Nov 2022 04:22:49 +0000 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=n7/GQu9ei74NAisd7t7hkWwupoGMSSUMdyit7zCfuja2gmCc7kmakGHW5w8jV00jFeFD Mb6g4vBn8r4Qlxfq5xOXOyNBbIwXkM8L3sV+iQ4/ctZc3kRAEliJb8yrLe4/RbcS8TVt glKtS+HnCGzC+HVSO7vZaL2nBWhg0klJWQt2EvCz8Fsdoz+OA4qWNEofkXbVB27ta7j4 G1teiDwZhKkX9Nu3T+DL+7N3bwQIaQlXMou1rJoXUcFrzDq3XCOczzRkvNw8sjCpH1yp fo3dNa2g8wAoGHyPGCxDvtyCC9ve2p/auL9cDh78TwfyENNHB8TQ0/UhZW+YtkVGdOBQ pg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DU4kFg9PaUYbLNRZYXMhUxPxjxHJt/TcpPSPHvj7l6Yiewm8VtVoUGOkbS9ghwzqWMs4lwCYRxThZ3OaYcujB31aUr+yb/S4CqX/P4gIGsEfSDTl2L160F+2MlhgjreEpr2eC38rHsBti8pWemQzDaEuzvHgVUFlV33berwxz+xcX4nDf25b7lpu99Wr18WhyKJFpb4/EYVNglzfob9+nAcEjQ2r965fQowETLqokS374uEnZAepesYqN4Nvd6WBtmqhD6WMXAdPX83OW460MSzHs3kDkaUxo+j3q4Lg634CI9mUjx9S7K/qXv/PEWJKaDJpW7lm0Nr9ily07XwThQ== 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=hW21Hm0d/aI+jdEFLE5VPxI4IwEeNSxq6K+aXdfpHq0mCvU5voF3SFTh1kMW5KiG9n6N6kE+jagzihRyqHa32DvICjW6nh1pbXeXS+JafJ86fKN8hcGz602/+iiYCOZT13r2c2TzeQ2kjP3P/N/nZhcOootqDCog+UD4bKodxguins/Jf+sIjbVW00rhRLOmp4lRsDDb60Zod+I6/sGUcSal59d494U1vkbT5sMpSLp/0HTU9Zcl288I9vYJfh/HgBHPkRcaxaI/XiIa+npe7JKLgsQj+FdyaGWh3Tf78TWUjC6iwdVidlgFtY/XVrZ26YCWhQjED83SQxMumEzeNg== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz , Keno Fischer , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/19] qemu/xattr.h: Exclude for Windows Date: Fri, 11 Nov 2022 12:22:07 +0800 Message-Id: <20221111042225.1115931-2-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 89c12892-0948-4a36-fd51-08dac39c6405 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c4KZM8CdJVsskPYh/oVm84k8Eug5M9yPn7Tbgnxzedd1QbBFEEM2m51tx2Zmkkf8D2hrlcM58htp7ddPD4Cv6X4Da4U5SyTFKnxzlb8NvrZokF/qY5hrW5LdQ6ysPy137knGvvYLvwu8j3l92kg5sUixT0fm/CoBUssy+DpGgCyFR/nYEmvHh1RLdVLwIJH4eO3chjviJ//wGD/gGOueHFJ5JqXIa+dUl28Re4bInnzILO2h3D7b250Vecr0haSjJdgygv5lB5yq4vOUvTJOexLEL6ueyUwpOKHrEW/JAHyfSK6yn+tqYVDcOlNuxvggSSxvhZZAlehhN+dQRI2qb3CkjTuLlZ+yJNo0NkoraW5ArkiyeriIU355JLb3hSOFGq5mvEhh43NgxI4FWr1lpq51Oz9x/gNbDY1UfzdlrOq2y03xDMWDXjnaVITZ4C/e3u3KswJgFw7Fn6ZTJEbOwiGfMIxgzGSrXRnYG6BqPM0CBtJgDXuIM+MVw0zWOnMLbaR1crSf2W6NY2EyKYsgadRHzUycQnIcoGVviu4Akn25Shr8GT7UZRZ8P1fphvO3hNw5IRvRRmkgNIOVUNRM9qGRkCHlcge9kg96hb6+2bCcDO4tuh6ns8P56T5y1YrFybywlCNhIEdpZgJtZilElwOlsxJ4mViYGPn6Bqbw4jMWgGvQAS06/Vh8brTop0D3LBDh8ATmnDruVg+2SRff6iNFQO+cAuJXBVML4dOGQO1fIiqDddRUOlq+E3enXYbX+gACv5T2VO2ySLfY9SWOQw== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(4744005)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SHS+5MbVpgOQyDmajYNoAkzb2YhL4zZHUvhIl6NZbvhjR/pGpzzJgSgBKIqa?= =?us-ascii?Q?zN8e10fScnN97yJDP6UdA/cUUb6a9jIl/z2lglWfOlaKpSXyD3Gxr4uxJbY9?= =?us-ascii?Q?b5drlUVsHE8z02RILLhoBPnxGuDkrMCyNhvB0CBEKrNyE8VNCcRPvo/s1lbV?= =?us-ascii?Q?cab0Q0wvaMko2zKvJdllyvr0+JJIJ42XpfjmqenE147bzaUVMBo0twolSrJJ?= =?us-ascii?Q?LywWZr/fSOnfH/HWB+12TbD0waN6Gy/Hhn8gECtaHErgXvtUruSjmxntrItN?= =?us-ascii?Q?ytsxnkhjI5ntLi3t2jCc99jXOUYFTj8TKp8wLxwLzeV0DJE+KliFN2V829rg?= =?us-ascii?Q?ilTo+OOhhnQgkNdfkHvOFcBxrCmiWoVzVK7sAzHXMgSkKhOM5LhgBMmll8JB?= =?us-ascii?Q?0jyemF4QUXW6ggN/A4d9sL/K65n4ZOOteLusKuhiHNAzQFpBNMYwngCymRdr?= =?us-ascii?Q?00e1yCIABUhupDGEkRuPAhcBYneDr4Y3uxbx2FYk2Ev2sCYK4w45mOi9XswY?= =?us-ascii?Q?FpcWWKPjdUjBj7MBgAK2GI19NTVg8/NxQ8xD7nOzgr3u2tRc4nq5NuiA1nF8?= =?us-ascii?Q?JxnP4cvthaZFcz1w4ED2KsWipES9tuNJ9sDVBecnRrgmq5RAnr66XEM/pOz1?= =?us-ascii?Q?Qcv8s7lAZzfeNDuf2f3WjyWUDOREI+5BeujC+uuhlZhbjdw1q/kyuIayLict?= =?us-ascii?Q?VjnfvwmLfsFBo0NMYXVGoMEl9JMfZlM9A3IQuqvZ6khQnxWCtlE/2JrxShIl?= =?us-ascii?Q?SBWPDe4PBDfEfKe7NG2tDXDy3dF6dgf4neKtP8r/UYYQyGu2dSn5KVJeyLAV?= =?us-ascii?Q?uNtlnkVuhI3b4J0Bt3vhe/7KaVAALTXeTx83SNRBPL9RXeEo2fLHIpv/qfZq?= =?us-ascii?Q?sdpoTJcigjJ8D40FL1s6BokQW/v7IOMm0A48NW0qCZ1MznIV5nQ7L+yIfNGi?= =?us-ascii?Q?h58Cy6k+5YTtXVPVMSRJpZL3UXLaqwpJ8/4zYsGykXd06iyWLOWPxdyxMKm9?= =?us-ascii?Q?nXCr5NE2NJrNnWC2DQr4ChHC2KHPdbNZ0lH+LVOFRsLXTFH83BinVGFV8JJM?= =?us-ascii?Q?nWgGSPJV9NT7DDCaheBxqdRLVb1/IESi7ZWdsYdDDKDz3hqPWYBd2WkuTpL7?= =?us-ascii?Q?3k8hm3ElwZvfe/68yrFshFoQiM4zu1BNJY8HLl+62m3YkGIjnf2l8CElOYG1?= =?us-ascii?Q?J3+30UBEA3RFnrLX9qsYJ08NQ7A1oRXD6vejZhiXN3Fy9Q6aMQEN63/oglH3?= =?us-ascii?Q?CwCI04r+l2M6RfceZCNdwWoa+ILWAeFV9oe0zXrQYR2w6VlWfaqyXw7/NAvO?= =?us-ascii?Q?P4hdb9r0SudKYHG5+O7UeJaTF9ZeBloo+CwA/fd0LLBmOVhfZtTmy+EZL68X?= =?us-ascii?Q?3KUxIwLlB4mv8XkJ60qMkci99exD2uUVDoK0NwOxPji62/fvu/Bt2fW3GPKo?= =?us-ascii?Q?sDlln9zWJtYC2xE2ngcUYJMNV/l3KMDD+kOi2zLTZSdVRob4NhIwU3sAtbGq?= =?us-ascii?Q?vb81W5g3fetwLtUuQlfQTKy93utyWCEfn5QV4y8Akl8NQm8ULHxymTGdbUJ2?= =?us-ascii?Q?a+P0U/cDTtLcNrwdLnAov+LZbbi28q40H9ZkDWkNJ0y9/OsIrXt11fQKqoLe?= =?us-ascii?Q?5A=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89c12892-0948-4a36-fd51-08dac39c6405 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:48.9600 (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: dI7xpfSlQBoH+dBfjRNvVPYh/IRYCDL1qDgPVoz0oczjDl9ccm7/LyN0gg4JE+RQOI+koByU8gxW5SXTa8AiPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: ggP3nISzijyCas2SHjfWXlGPD5vVUcJ1 X-Proofpoint-ORIG-GUID: ggP3nISzijyCas2SHjfWXlGPD5vVUcJ1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=549 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140699184100007 Content-Type: text/plain; charset="utf-8" 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 =20 #endif --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140645; cv=pass; d=zohomail.com; s=zohoarc; b=lzCEtDyImmzBCBi4HiKVJrEzs2Ulmp4j5SwFdQXVgP8A9EPktggQ9fO6ctBvyOWer550YnO9Q4/CZsCaYybyALzZ1eU97JdkGAN6NVxVL97Xv0pxhF6WQhSEqcDN1P2pHL1M5HlMmAG1oN+gif0venQs3aR5gcZu9AFsdoZtLCM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140645; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/uG133JgMTeEcLUb0aMTqUIK7dCdL9iQpNTDfZLiPAo=; b=W+/Bz1rrW2++9ZkG6EOJVTaP8vJqbYN18tzJkqtZCV2eYY/3U4en399k8FYqAeLqIqP2MWfLYfzv3q/Larc6yVsgGa7Q4Qvlt+1qrCn/UP8Jy5B3IeXuxI9MG43GXy0yPJTnilKSgkNxMo+j8mXkqYgAHoMWj0jBZ0ZqC2fHsLM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140645382311.3271958875856; Thu, 10 Nov 2022 20:24:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZY-0000VC-B5; Thu, 10 Nov 2022 23:23:20 -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 1otLZX-0000Ud-1e for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 1otLZV-0001ZH-Gj for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:18 -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 2AB4N0iK024928; Fri, 11 Nov 2022 04:23:00 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:00 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22: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.5813.013; Fri, 11 Nov 2022 04:22:50 +0000 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=/uG133JgMTeEcLUb0aMTqUIK7dCdL9iQpNTDfZLiPAo=; b=fu0+dycVvny0iADlypkLwnkTrzgiz7vR4US/T23oaacpa9tFBeAukc7TWVBK8HNonIY/ sjvUcuW/jeCDdB5YihQ8/aehwKHFM4sC+GdY547y8Zv0W1/ETROZ+RpTQLSU7I4ZP9Aa LaADBlrrNOR/XqP9oJKEr6JCFPnBsSb56VIVxoy55z5yBaSy4Hm5xJIoG5rG5kmsv/zl 9msxYxU3IAyJR6ArnFwF2rjszM8vvEvSfN5WgZmiWx1CPUJRbMFlhQ8qTSS75dKtuLoR 5Maej/v2OzCzxUDCXhvZ3PoSNBrN1EaoGtYB+GPEWSAJRN+z7lTsbY8U94Q/83039cm+ TQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuB/kqteNb1ih+5wrBi9VDFlDK0HQk3nerpR5fs+jKa9S2m5vNlXPU4XNTYnmGvQLhO67hiAGJTozJRcZAElipnk6h9iDE2EvO72YkSinuIoXH9tRm4KBn4r2nh+xFm44fQEpoOiWmjoVnYDm/KEgDaf7LeXh7694t6tSzBTyUbY2ezveO8A4tfc7DeWmhSJNkj+Nb9Hr7nglxozc32kYrDRU/r0f3JgawMPx0RU3NJPhLNLhpgVsriSxDDiFFCfNov+c3OAeteuF6QsCkv3JxVxzzw6ydidfZyZVI6xhCtb3eClvfa6xb4s1v5NfIaT6RecqED8FYzVBillD2VDTw== 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=/uG133JgMTeEcLUb0aMTqUIK7dCdL9iQpNTDfZLiPAo=; b=IZtdnmiertHxVHqt2oLdgmgfwvZ19icmz+3z6MIGca9UdoVAkJ81VUuBiAMPNan6ARfTlOSDyqQp1pZpIzAfgNlGffP9ccfI452y/ePBMedy4OAQQjLOXXvIOcp7YiPakF9dRHDbvPsjtWT+8PYcZAA1zDdRUDKa29YeGDmWZjC1Aa67nZfCQA8+rm5b303Mxx6nbfvLV/1/Cgjymd0KclXe1z8fpLL9ZznAHg9bswPpBMVPEwCxiyWCl4xFtoEO/MXVDUfR5koz/UjAN5PL1OJkNhJqyGxSinBvQRJpsckoDqamp2KQ9Z8QwUSD4G5WW1VPcIIuuK7IGedLUsBG3Q== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 02/19] hw/9pfs: Drop unnecessary *xattr wrapper API declarations Date: Fri, 11 Nov 2022 12:22:08 +0800 Message-Id: <20221111042225.1115931-3-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: dbb24cf6-d6d5-4685-daa8-08dac39c6521 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NjjrpruNY4ysBjlrQXzLp86AZaaSWCSOM9ph/Yz5A4T7SGmTVWfd7UFFsLz8hYXx4AZCrpOcKfM/AnYMIp3CLXj3KgQxDE3ocHedoo+AusodAiXPGZWNM92Dvx8jmhhdYYOLGvNvIu6MiExNYUQ1DB19OI4E4NG6b5OT2HxGQzDORfMNQK8GMlCcjwjvZ9RSqsHVwIqyoxq8ph8qjSJRTn3uRWOfbV2z08fKI1m+w5UFMj+ve8a6lO3SLgjmxLgMP56aExSMX3/eq7CMrbAD9kE+YqjhOHKIS0zwukGpWOirwYRKjVN9KNAGo63Nd/vAlwHIaiGxT4tctbwfu/1ZfdTyN9ZfXbjpQC+ZseOHa7u0OPhL1N5fdZGi6xtlGYXiC+QVZcsoESlI4/F9p4xJeSXvdtaaxujj9f/iZmR9h2BxmEJDzVoLIlPhnJNhnrwGn1o88ahJqZvJYt5VZTRCwu7Gok941R0w5Ov86pca1coSZ1nZ5BEqOsaG5X4+5f4L4Zyzg4nta7jy1NGt8lowT1hh45p7XCtcIDjTzzLwFeNvO32uMhwB4KZE+0+4Lw8rGzYcKTsXFlPv5jtUrS2WYT4ugWG+7JTPhOGfAE4qUBorLH7jgjd+kghzwXVgipsGSyh+oWr8UgU2dasGdpqCrAJBRTeUrafoWcaKCDf7YpEXzobcrCI43KeNWofzVxTGu5mlKBHGesGRJSUZMOZ++lLbMRtL/lzAs/MIkLaRYrOM7AyoA+P/DDy56T9rOclq 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?19LgT4ywt8rMhkiZonbHIMsqpLODriz/Ze6hxRzCwv1y5M1QT3HuCAUsVN6S?= =?us-ascii?Q?/o59i6SVjl1wK52th2t2jqY5En4p7Lz4AwHje+hPLKM6fYFkbG792Tnysxuu?= =?us-ascii?Q?ZS+SuytOKA/1xzB+K33doXz0ugdfAfTfqxNNbd6DLchmXfP16B6C7BTRX+/4?= =?us-ascii?Q?Q3wluWwU4jUhXfzjfbXnahSDRtD24BpuNqR6E82fK9Apa6QQ2kfFZmHq9Btx?= =?us-ascii?Q?bi5DqVbkIWYHQZQsaNCxvB46Mpfx4cWjnt9RPZWYR8GVrgxpRI2+++McgXPj?= =?us-ascii?Q?CL6pn+8rkdaOxKCeL5nyfWVCrFz/mlhqjy8xlaHRVLxMrCvZ8bdfkvxr2xAS?= =?us-ascii?Q?2Bj3v+aV3l3u6ebsWKa/4bqut1A+t7VmkshtsMLfFVf3Wzmim91VCXINkIoP?= =?us-ascii?Q?REDqkT8IuuvzP+ScjiEse/lSTpJJZj1a9vl+1akZ//9dS1n4QLi4H0IydAlz?= =?us-ascii?Q?mh8H0HjLe84GOLoCium/J9tGuBZnOcrEO+F7/w5edb7nvyJ4GfrbYlaPqofH?= =?us-ascii?Q?AGexpWh0F5uOkxej4q2tE1NAFCHHYoOwnILoDwOdoKFu+XuG2t5GoBZtoIG0?= =?us-ascii?Q?cCZ2rqq8sckDZxbMwBkf0lBRFFeE6HaQcEh3i8zFBG2WBiZxEa+8Zq9GCCHB?= =?us-ascii?Q?8/j2WODvzgCyAl/DPn9BhTGCLhjL8X1RsXhctEcILFdl+b6XAzr1nQD379py?= =?us-ascii?Q?Sv0C4IuaJ5SM+jfgNfauuB2FKvK7JJVEwZ/X7WA2Zk2rvpoQjkR6Z4G9LJxm?= =?us-ascii?Q?x9BYtvZSFvATow6LLMMO7mOKNF8Qsot2I9oe7f9QGE87OvQcHUWm01tDTvPv?= =?us-ascii?Q?DY1I3BaLmT+J9AeiDbLlrQinKcTFlf1kg9z58QMg1qAUrvltW76insRTc27r?= =?us-ascii?Q?bTWIUC3NvF0yS6NY5m3wed1OQYtCQVPM73zVNgponJ1DI5E1jAfBsYxGRaY9?= =?us-ascii?Q?JKbE/6GMMiHOs3kyrdT5jk2k2N85zOTEJTl5I8gGE9RLQsY9ZdrCJgVmHtC3?= =?us-ascii?Q?ppds6bYTo3BWY9eGplXCAAZQLcnXvDJLxxoDaFgqvm+4kMqCC05UZXKy8Ior?= =?us-ascii?Q?hGxduWgmwtcmK+iUuupe+hWXRs0qmrf1uEh1l/5CRotYTbqX7Pl+5TVKnR8p?= =?us-ascii?Q?u7w5WX5/ihzWG8/RpbtsRKe7T0FYC8oUBu00xjOqpPqcEr2q0X8qyoHf/k2g?= =?us-ascii?Q?2BZSb+Sle2tPPi/AkQ1CtETBgsD+xqhBaqVTOrOkzoUInBwg7kVFE0KhUPPe?= =?us-ascii?Q?HeFVsOSM2MUmzhLx/79zemQRJTVrqSJ7Ba88evH2M+TSJeTLYt3bOKeRRVok?= =?us-ascii?Q?6GfaxC6jy7VugrX3iZGT20f405GGopyxcKVV3cHicaMWPgzbUVFEuR/NOX1Y?= =?us-ascii?Q?9A8qvfzK0r27E82gobKlspOA+NiQ5JlxgNpmArlgZGe76XDCHHaERNCrTMi5?= =?us-ascii?Q?t20Rh/kQbeNn2c/ncjAgAW1RM60X9wF7SipH/sn9aZKXq5ZZmp9YCm0w8CnV?= =?us-ascii?Q?np6+9tPe67FaC+3FNEQL/bn3BHb8U6OdaR5u9ZV/cLQjmVsmgmkQbOcAwixZ?= =?us-ascii?Q?TJTic/9wkddD1QwnYvUHt9ZqZdZeMb9uonO3J4su?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbb24cf6-d6d5-4685-daa8-08dac39c6521 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:50.8033 (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: avef87tCw3zD5alIVoKYnSbWwyNKOyzPLUOQpfAhHgn4C2pMTP5NJ/TK6xbscFIyPdHdghzaVpnggk+WjDifPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: zVqecsJl7wN0ilygiCparkhzCC9JS2u6 X-Proofpoint-ORIG-GUID: zVqecsJl7wN0ilygiCparkhzCC9JS2u6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=707 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140647048100001 Content-Type: text/plain; charset="utf-8" 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) { =20 #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 =20 static inline void close_preserve_errno(int fd) --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140676; cv=pass; d=zohomail.com; s=zohoarc; b=laL0QoAmDG67DU0g2qe8IFl22GdSj5P77/6/aq/vGV5MHcQX+mWvuvhn1i6rhxZ/QbenG7D0v39HXeofQblwD4OzvONCpnPuSw0lnqgNnA7eKyO425UttOPIJwqIzoxoW13XUSA5PYy40sb/JwDvMSdnoILvW68Yog9E8VYJn7U= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140676; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p4PqmM8VRzaiQongGzltUo2mhDuqdEHEEZ/RVds/fAE=; b=T49AAJ3+oXK7j1pFdE0HBb2xwwc6zTeUK1ETeDROOitnjdkVWhOIvfs1gBKMgoNVsdP0vlwgHOvRDKLmvFtyG6G+ZyrQN5hEOJSAQBc1UVfm9OfT34rQNa67NVnNe/urUltrmyi9JuoR+f9KBzwTTrXoUeCJVpYgeMNMlGqRO30= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140676142946.3336500329505; Thu, 10 Nov 2022 20:24:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZX-0000Uo-EI; Thu, 10 Nov 2022 23:23:19 -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 1otLZV-0000UV-P1 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:17 -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 1otLZT-0001Yz-Uf for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:17 -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 2AB4N0iL024928; Fri, 11 Nov 2022 04:23:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:01 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22: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.5813.013; Fri, 11 Nov 2022 04:22:52 +0000 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=p4PqmM8VRzaiQongGzltUo2mhDuqdEHEEZ/RVds/fAE=; b=LW/rfcNqI5apCbFV23d3PzaQCoDxNr1L362HvVPVvDExe8xFleodKBCSYw2gsQmXTDGe YEcnoPZVttcIjtpvwqTC5RDJoLnp53/GAYsLEn8clY9flLwsIP+3aNnGBMuQZfakbWqL B07NcZzUagY0VUXo+lQMDeh0ikUA+zbSb+ca63nAj3vcWkQMdTiKN7wC1nwuAeYX7xcH yMSps40R4Nssr1f83klo6UNvkfXIIZCAzHjwWhwuOv1voa3qqlb7rHxUXITY4dNgVVFK EsdlABKANhSOiPL/W7lujK7xjSHgcRV/z4wR0ODKH65HFwwGlbVGOxXDST3HOidsfIME jw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jal5Om/27kLfIa3MvDiQ6QeGymaM/2ZtT7se2AtSqts925kACgB7C3dRGFlr+krhXi/7vqqWDix/WyQ8DJoRAkaAZPZgc+/SHGpYjkFS3g54MZXrjvZ6boSYPKvCQVpJR71rgqCvV72S5lhZ8+WMfR60zxpvVjsBz5K/pe1tZdBvMN63VERjRcmYVw93kTBRSo+GHFbMV81bJ5KIHR1ZOjnhfGCproSIXRIC/xIJlIjzjp4bC5YCLDig88ti/zjIgPWLUo9T33V0zm56kRRS3kZnasxUJDrF/7TCcATLfxVdkKnWTnkXUZPz9CKeF/dKhjviZmg14Zm99phvf+lQtw== 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=BkWqKzM/lPZFKeIQcFm7GyYK0olCS8tcM9XN9n0WoLU8itZ+Q7iC9ct1TGVCFPpWG2FvlS/fv/VtGXlfq5KKSavHKIt/9pt17nA28fwdt52bRVwdgg9LH93HChnyl/tBvcJp01N9ZBvpuIVcVkAyq5c8bDaG2fhUHaW9jddX1ulIkqNqPIGHKgv8ceyajZ7+LqHSyxeA5B4/rsb/ZMGYW0xPRQ6lKoN6iWXXcK1dL01I6J8K11RtKJiB7EoBnwPGsf4+dhJr3Dwtlxg3jongFm4Pvbgnril7siRVQVf/n/HyNqk/o8W3gczP6+e7wZwy7dLpXJQTnu0pQXmOsExbqA== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 03/19] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper Date: Fri, 11 Nov 2022 12:22:09 +0800 Message-Id: <20221111042225.1115931-4-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 7505de7b-ae2e-4555-30ec-08dac39c663b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tx2oCDlRlHEd/G8yP/6pWHFAw0P3P+sQNrXZoaQARQkQqaVT0BeXh01wgBMDtU8rwOOlvSmOs/NkA0DFpRU/SM3qDJEfrKIA0j7MFgpNueFUvoeHliN2kJrl8GLVY8nB+mbD0gIaMJ/1Gl8tVXpyZwOw8kXdAfMBbkMfhrtsJdQSqVfSXI6n+kfMCmZe9DGs3MutEfzuuqTR4oSMNBzhHKnyj0XrQUCuTmtLqz0dY/9KIz6vAj4wR/nH404L7XbnuqaT3qlTXnQycPSm3vg8crYZBNNZiUP7eGPEAsYsNZFmpUVjZPMTi0AhMIajzoaPbV2JeVcOcF/OFtHm8/ytt7mPi9BE6noDmH2HVMWxGhDIIcfoo5qAnNRINcq/cCVV3mTCSyFmrh1Fs7XCZRe+41PFAKgCz+GSr9hE6gSTrgwgO4E8D4qQpAXJ+YeQPqhBOVlxOrMtD/qCM12uCDcl3HJevdKdIBTKm0HiNXljIuY1YdriCPHpFPx8wHiVtmMjHvnOyHkaFTKf/37W2LOYHHHxQH9AM31prW/V544cQVhXuj5lZ97rKjoro4yKhBUeVKamrBdg2uuO3Ucm0sTG+2f6AS4v6ljIKw6CF9thd8FhPoM6eWzMNFkcp/XY0TiNy/Zp9RsZfSYhqOgnolriA60KUBnMESOX2d0Y07iEcSZMko2qVruyUg6HycMf3BFoibg9VumaptOrDWOVFhtWkwPO2aTY0MTRPi+mq2IOEzPvnsPUHl7FkYQJC0Y+tfnjV5VbD5b47cle4ZpLJ2e6Bg== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HiJRUJVyacNdD77PPrPC4Qew0orkTeV5K9s6jVRRJFKkVLlPJ2Ryaqj32qtT?= =?us-ascii?Q?ua5D1amsf1qzGU4jyHS1fQHdLlmKWlslyd3j3m/crMXA9iY2aUHqhWmBqDBM?= =?us-ascii?Q?A8MbodVCiq9DvcmNB+uU86f/JNYEMOImPve0aU/8wqWp4zNUyEbEzhOD8/L4?= =?us-ascii?Q?8JOc7X/9B7/lMEQb1uW8R+KAIiUR5bSPznzYvH18WQS3cTSu7DkjVJnAWkGv?= =?us-ascii?Q?j2PBEDnmoqBm17cbx6rbRztcv0W0bx+wfWU22nyDp0JnWWsnDw+kH+QRr0+W?= =?us-ascii?Q?Nhyj8/4vSvQ0jZOmiNba/QHeNjfakfixCOs2yle3WjWEBAX8Cs2mIPfrXgXT?= =?us-ascii?Q?hUY935bDJ1wQn8g6f23usSjWJkBq1mv+Rpn+XczRLdxaVxMeI8VkbtJoyXGY?= =?us-ascii?Q?LpMfI0ju8djAcLrNt4WDef42m2i5xIIl41FVoHrTY6BHBVAkBKoAIMDvAZMJ?= =?us-ascii?Q?YEpOZK2Py4uoSKocyzB1MNOpLpHIWC4Yvyfi4ihI1E1u4ElhWF510sGMQkJt?= =?us-ascii?Q?H2nCub349b7oFQlnGlfnjbxnp65waFBK9bfgDGJ++KgAjKQJN5LEosS+AWmB?= =?us-ascii?Q?QCB0kmNQ1AbfDXpnuQsG6JYx9QBDCuTFxSylPAw/zLWBSIzV2AefLdPqYcFB?= =?us-ascii?Q?C9qi4wWjQbE29ROPz5p3so2MPj2HGCYWcLAuyhX8ZHvRpmSy15ZEjULmcHDn?= =?us-ascii?Q?i1KsEjoLCS3sC4/m12kTUqMBiz5Y2vJOnmOCN+mXwg8uffbh5W70LwIT7cAw?= =?us-ascii?Q?O2VKIqHe9gDiUaJIyHPSY2ZPTjXbqTJ4VgkvSOchXu6oGIhNkUh0cTHWnxOR?= =?us-ascii?Q?jug8E4ygz8nqITlZrwNc4FxGqBwrtc/9prBrrAe3JKu0aaDwrVhal48V0CZV?= =?us-ascii?Q?u6Cz0ELk2NswlTXQIeahs3mV6kv/okIzL6mF/d+Ay4JQQFaXlxBCR6BhAW74?= =?us-ascii?Q?gROZZ4nPjWWxp0rhYQZDt0TmiPwNiuh2E0asSXLDtqK4FNbJm8ibYX0HBe89?= =?us-ascii?Q?yUXvClvoqOj040PsMmUJVhs6wk3+VH2eCuUjLLWeLcjgvH7CQgZ2jBZpl4WC?= =?us-ascii?Q?66DVZC2qwyS2G04Ghcc1cUR+VAjA1RGkIM873/Ta1Eotw3OsrCO8Kdh0IFAC?= =?us-ascii?Q?+XeE4QCGfgUJZoZgEO0s/Sly0dbKpOkwVEtc9plJZ+Os20mfbLaO5dePgSa4?= =?us-ascii?Q?kpYnHEBmSrDvjqM/Uaq5T9tSxGFSoRvZsU0wR6eZ8CsustthU2qrz9SrU5ZT?= =?us-ascii?Q?lPpJfvuWxZSGau2AvkofeqAGGX9/DTINZkXPZ0XN7XzOhQRRV1MYRTwr8u0H?= =?us-ascii?Q?car4j10Hs3Oqn4HU7jzncntQgHIrCMNNOG78cXnNOl2zR2x07OLYfuuRLFmh?= =?us-ascii?Q?EfSIx4dKpuTj1RNh6KpTZkJHVQRRwPW8ILfOkpLoWyWwEzFgn/qjW7CK9V1p?= =?us-ascii?Q?wq6u1+alYKEZzH74T+BU57WiFmceEmchcizVMsy9Q3zPR2pgopLoGOLuGkGd?= =?us-ascii?Q?pHVDfMkdG1AMB7z8KbsTWUfQEjav9Q/UJUS7StgqsWJGYMeplOAkoAgDppTq?= =?us-ascii?Q?6FMWepQ+oCaBv7SJeGCWwI+j+g26bQ6kJ/aKKzwl?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7505de7b-ae2e-4555-30ec-08dac39c663b X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:52.5222 (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: TrDyz4yNX5gdGA4a5sBUI4r/X5tZLBJM78j4pMxsZpNINbvqbWoBNg4Qde+i//G13Kxkj4KaKQ2sSFuoFKSO6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: JFuDdXqJE621Gq4L7R4YB5YxNSb7LIH3 X-Proofpoint-ORIG-GUID: JFuDdXqJE621Gq4L7R4YB5YxNSb7LIH3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=595 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140677111100003 Content-Type: text/plain; charset="utf-8" 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 =20 +#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 =3D errno; @@ -103,8 +110,8 @@ static inline void close_preserve_errno(int fd) =20 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_UTI= L); } =20 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 *na= me, int flags, #ifndef CONFIG_DARWIN again: #endif - fd =3D openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONBLOCK, - mode); + fd =3D qemu_openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONB= LOCK, + mode); if (fd =3D=3D -1) { #ifndef CONFIG_DARWIN if (errno =3D=3D 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 =3D errno; - renameat(odirfd, opath, ndirfd, npath); + qemu_renameat(odirfd, opath, ndirfd, npath); errno =3D serrno; } =20 static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) { int serrno =3D errno; - unlinkat(dirfd, path, flags); + qemu_unlinkat(dirfd, path, flags); errno =3D serrno; } =20 @@ -194,7 +194,7 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *fs_= path, struct stat *stbuf) goto out; } =20 - err =3D fstatat(dirfd, name, stbuf, AT_SYMLINK_NOFOLLOW); + err =3D 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, cons= t char *name, } } } else { - ret =3D mkdirat(dirfd, VIRTFS_META_DIR, 0700); + ret =3D qemu_mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno !=3D EEXIST) { return -1; } @@ -349,7 +349,7 @@ static int fchmodat_nofollow(int dirfd, const char *nam= e, mode_t mode) */ =20 /* 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, =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { - err =3D mkdirat(dirfd, name, fs_ctx->dmode); + err =3D qemu_mkdirat(dirfd, name, fs_ctx->dmode); if (err =3D=3D -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 =3D mkdirat(dirfd, name, credp->fc_mode); + err =3D qemu_mkdirat(dirfd, name, credp->fc_mode); if (err =3D=3D -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; =20 - ret =3D mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret =3D qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno !=3D EEXIST) { goto err_undo_link; } @@ -1085,7 +1085,7 @@ static int local_utimensat(FsContext *s, V9fsPath *fs= _path, goto out; } =20 - ret =3D utimensat(dirfd, name, buf, AT_SYMLINK_NOFOLLOW); + ret =3D 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 =3D=3D -1) { return -1; } - ret =3D unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); + ret =3D qemu_unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); close_preserve_errno(fd); if (ret < 0 && errno !=3D ENOENT) { return -1; @@ -1124,7 +1124,7 @@ static int local_unlinkat_common(FsContext *ctx, int = dirfd, const char *name, } map_dirfd =3D openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd !=3D -1) { - ret =3D unlinkat(map_dirfd, name, 0); + ret =3D qemu_unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno !=3D ENOENT) { return -1; @@ -1134,7 +1134,7 @@ static int local_unlinkat_common(FsContext *ctx, int = dirfd, const char *name, } } =20 - return unlinkat(dirfd, name, flags); + return qemu_unlinkat(dirfd, name, flags); } =20 static int local_remove(FsContext *ctx, const char *path) @@ -1151,7 +1151,7 @@ static int local_remove(FsContext *ctx, const char *p= ath) goto out; } =20 - if (fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { + if (qemu_fstatat(dirfd, name, &stbuf, AT_SYMLINK_NOFOLLOW) < 0) { goto err_out; } =20 @@ -1296,7 +1296,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *o= lddir, return -1; } =20 - ret =3D renameat(odirfd, old_name, ndirfd, new_name); + ret =3D qemu_renameat(odirfd, old_name, ndirfd, new_name); if (ret < 0) { goto out; } @@ -1304,7 +1304,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *o= lddir, if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int omap_dirfd, nmap_dirfd; =20 - ret =3D mkdirat(ndirfd, VIRTFS_META_DIR, 0700); + ret =3D qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno !=3D EEXIST) { goto err_undo_rename; } @@ -1321,7 +1321,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *o= lddir, } =20 /* rename the .virtfs_metadata files */ - ret =3D renameat(omap_dirfd, old_name, nmap_dirfd, new_name); + ret =3D qemu_renameat(omap_dirfd, old_name, nmap_dirfd, new_name); close_preserve_errno(nmap_dirfd); close_preserve_errno(omap_dirfd); if (ret < 0 && errno !=3D ENOENT) { --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140694; cv=pass; d=zohomail.com; s=zohoarc; b=bYc8OpgLV9LQkR+k6McbRG/+h4/GxTyMJdasWbMCxHqMxPZT/fIlp2TGWMaXcXkRoc6Yc3FN+nHOb/vwvSirrcE2kp50vgpJhRFqCSijA0Rdx8PsY+shxHqbrI4dW1hxj4J9iJulPfZ+ZrmIfKcKqBwA0hM+cPqiU5VDTv1Pfsg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140694; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UtEzJOqW8iIbBBj7/HaMvsgPYrEDv8luASoWw86jxRo=; b=KY9aAJUdshg8cuiAq3YzgXjWJ4XpJ3l1Xnje+XleYPJWwzjMa78dJgMEsjpqFRe9+CAoqdp9tRangf/ttwcYTgumOdPmKKgZXDTswH9bmHD2qM/mvmYkDQ9v8Eb9p2shmE3Ac+sOr8dkINPmnLzMkVU1jswaVpTFsx/kaJ4OIg8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140694659950.3174016218454; Thu, 10 Nov 2022 20:24:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZP-0000Tr-Pd; Thu, 10 Nov 2022 23:23:11 -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 1otLZO-0000TX-AH for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:10 -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 1otLZL-0001Y6-OK for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 2AB4N0iM024928; Fri, 11 Nov 2022 04:23:01 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:01 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22:55 +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.5813.013; Fri, 11 Nov 2022 04:22:55 +0000 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=UtEzJOqW8iIbBBj7/HaMvsgPYrEDv8luASoWw86jxRo=; b=kUMRfjAxf9k8T12NVGoK/tjYDpdItDCmho5n3SlFc+XzLPuGR8Ioa7pcOVbp2UOeznt/ FDjOZy6rNuCcCBuXStNSfZKwMiHN7nxU6JrASLcl79j4Jy3i9Em2gpJsairNlakh7sBK BQDBX2NZD5kFFBxmEuTk3aVCb1I8K7mFRuL4fIPa10VNjd+loevbt3wBZqtytZz9/vDz NabWtwX9ybIpMHgfNNGd3h7nymGdTG79ZhlLoVGAV2tqFQP2TDrA0+EcOzv/IZtfhRmz aITepp/GalSbeeLqRUsJagLHEf3Y+ZKGqa2Yb2kZdsP2ING0q7yWW47xg8oXFuFUJMvI Kg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PbAGdkZm9JWO9zJe05Iki2BouLxB3JmdqK883SjhDBgVHdjR5AGaFF3AqAy6ZZZChFdPhUwRorCVM6j/Jcr/CGS1acWlDh/hwq5TbPvKvLY17ry6uhknAnjcnM/anEaFbluq8XvYvuXAD4tW/1u9K124WHb5IHSfMnTr73FXLSJ9+tNwUiGi0cvbSWj2bfbJBhZ6N7oYRIf0Jh7c/K3+3/zLYGye4B8jjB3etSrhKF7to1cWTi8F/3H9fo2u7dlfgirWefcE10skY0fR0HnpVrfO0AWe73sZ4/G4Ss2oh9TD45nJQx3BFJbJL/Hyg1s+IIPNXAqh5dP4OqRGviekRA== 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=UtEzJOqW8iIbBBj7/HaMvsgPYrEDv8luASoWw86jxRo=; b=MKFs76CVyHmrPxGyIUuuHePXpC62eK/vU2ABgBUiL7AEnuXiF3v8hqYKg4Ri/SKOFnuVkOIKSi6SOV0O0DPzYt9uXU9Cf7nCAf5ZOtkj1jyi0bChrlHcXuE9kk5i7d9cEmhWESradGiHZnJxd8rKiuoVHrkP1u/FSyytW+5iKZHF2J3sewigDUDJTwJ9nYWh6MXi0W3blFR3wQ8OqUcRxCHCRULTZZuiEUagTP69o8qAWPDlCGt77W+uOSJ/cOdvU9lmnLOmP8GnuWk/HVsIQoRTc7XDXwXchu0D51SKuUNsQQqBU6h7Ely5HFK70kuDkPMlUbRw9bdO3jBfk5Xb1Q== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v2 04/19] osdep.h: Introduce a QEMU file descriptor type Date: Fri, 11 Nov 2022 12:22:10 +0800 Message-Id: <20221111042225.1115931-5-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 051449a4-04b1-4b2b-429c-08dac39c67af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OQq27Wj01RYivX9GrDc1Y+REsaXGJVSxIeigNCBTaefWQPsDye1kYo2i1K3u8LXJdeDQS33Jo4omSNgu9phwvFUt8bCieGSbqUu3TUjPoq3v53QGs6p6dVwVCdRcEPDMYwrGV+zx67yzcTA0rH5GQpulP3hMuhOtrC+X5j75v5ETBsh3VsayjCMEyNCcozhR0Mz8uZFLQFQgUr1EtizyM61d5Mbrqzctiz37S79ZKITrPyQvn3pBhQBXYPDkr7mHwU837c5i2zHY0VFbteV7Pq0tgTd3GVZyI7lX5D4Vc7KRjAnSuTRHaVGTFRyTD3FFX7bAUVV242uQfoYR5eAsKK/Fi7aegOJ2dRPHRzIVVe3zB9d1o71MEIPs1R4ySaeRacrjImY1wBUwD4iN5/7s3XHrT/2/RqqHXhWqqzxNGY6LLiljPJXVXOyB12a6rL1aV4bU0p4mWkcjc4j9LaFq5ibNxIPhpB0+8Mv2tKd6B1WoN2RUU3A8bw0clU9TQm74Hw0ftb+zy96qeCJi9qB0Z85qsnIHKXAi4sSKZo0FczXcm48/cWem+tbMUVgqwabcKfX+wZro443hdL/WCvBkdZV8xrZt0v6tHYSvGM02flqM3MqlDzXuP6VvOg8hltRgTbX+3X9VroXjuluDZ0XEYHXhaBApgKjcokaoHYMov9Zf4xhyMGKyhGpyU1XHy0O/tVzL3//7gcWMtWEkOIWrq3YHMaRuFMv8i9ltzUWV4u1dzC/BsPShFzz+ttR5lqkIGA2QNiwba2rX4p3gnlUPcg== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?uoAQWzgap6fZZO4c3zqlCAyv99/01cvyuiJIUASIFAKJxVU4jODPkVZxENix?= =?us-ascii?Q?oXJfvd/w0BO9XYXn6H3ELjsxmrijm8BDWNy2XfvBwNmUkRRji0KU/SYdhGqH?= =?us-ascii?Q?EPW6/upu5AkVCwB77eCWLUuGOey2VKIEUfjg4s+hXYNcWvbp/IOfVo/dxcOe?= =?us-ascii?Q?hyJW0bd/IRpSmrhU/4urKGy6p67ynsxEQnom/BiTgNkAppI1/XkV0bFB8oDm?= =?us-ascii?Q?qNG1WG4lDU0VJz5ysQHb1Z8mWhvBrtQv0zI0JRnL0+OghCkcOGaErEc1dxd/?= =?us-ascii?Q?PcRS5p7NZy156f1z5VBj34e0a/Puv4z+WMvMf+XNiJezLv68rNogjuk5aLzC?= =?us-ascii?Q?4wA3rvIxRq9QENCAVza+wWynJU0t3RhX6GXyiYK5e45tIsxcbNQ7mlsvBM7E?= =?us-ascii?Q?XZuAaoqhktQojDLya/4GHFI8BPo2zAB39L4q8fMSPaNz8yDqWFbErRUnaMy4?= =?us-ascii?Q?3pUBaxN4IiS4Tq+2/pwsRl4PKqpW1jZ9T/Nv1Y6YcMfBzcaWue7ZNxRLrbQd?= =?us-ascii?Q?qILjUh8XEOgpaGVUZKze83CY1CA12iBOjtnFpzLtgAIfvpn2yM66VsCmsI6j?= =?us-ascii?Q?F/NocPun1e17tQvHfzuFqKMhB/+iDF6IGLSSNIhPDF8A8ynxO0jZoLFR0Oiq?= =?us-ascii?Q?Ge5akA7bGgtYLK7F5DMPz55UXQzYvzTPhQaJgxpWw1kfSxg7nCNlUEkwGoMx?= =?us-ascii?Q?QvA7SJfraTFNQX6Ti57+E9Rz4bPr45alFGhogNHPG6wfC+t04RNZbsScwkjA?= =?us-ascii?Q?243B+nw0LOVl/YXiaMUt7QazhPq0VyCUftQ1/0jJ2QWsF34g17M1VTSGK7PZ?= =?us-ascii?Q?HDppGhrKw16zovhHVX9QnddyY25Th3aIe9sAe1zQ1QObdp+6h4derw+wuEpk?= =?us-ascii?Q?RgzzHAiyZ+2T1GTcTIEMfzsuA7+EMV6Qs0JEKHjtu0dUPNDp038OYLrePJKB?= =?us-ascii?Q?DGMv0195yPzMValVLdym9VEqT/Y2N7rg4uOL0zx2kVQnIG1mvVTtRy5wX7+f?= =?us-ascii?Q?bQ21i4jKvLKIRiD1AKGIUdg5LGp3Cox0qrSfV/mEb8q2oNP2EChulA6LShdV?= =?us-ascii?Q?2m5Gibr2KdC0lIlVOwrIn58jBXNXEBrahFyTYsdaG9YSXuY1FyiSw/i+b26g?= =?us-ascii?Q?aKtdTf7bJ0upbkzW/wnVXz//XGOShIdbV++KeX7dKHOZDiGyWSzlgeGsB0in?= =?us-ascii?Q?wGMDgHEmIyhabGFoMLss5k7BMDibAbnhXqtgUkzuiviWWap0tSVBwpA5Sfac?= =?us-ascii?Q?PYJ0xVc6d8i8esAjX71kseVfJYkB1RdLDXwA10Mb7j0x+nx7+3S9Fg3eCYM5?= =?us-ascii?Q?Ofj4Jmh3ZE49ubxp5IrHGjLH48kpZWErtLv0vEiT0h9pm0Q28gJtZ6+yIdUx?= =?us-ascii?Q?5UFP+SlJlwSaDpcxdVZZjhM/INvGXFbPeVg5Vmfux5OkvkGYLu2ubksUNRx2?= =?us-ascii?Q?QEtyM76QcwoXsB9fKC1k2vcEIGVsIkOqQT3tK2NvP/rHOubMlAbU5uXQwuoJ?= =?us-ascii?Q?EfpUjvzCKlS9RieEdF7TQMgBHIEfhaM9/N77z8WKe+PmaFCMPcgBOj/YfMkU?= =?us-ascii?Q?0yfLA8PlxsVw1hGnTF2JpgV+OSoJiFVfzxe3iKMP?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 051449a4-04b1-4b2b-429c-08dac39c67af X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:55.0867 (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: UNftmdphQ/hBFHWkPa40Mdu5kJwzTGvdFE5WhXgXWujQY19MD8eTN9Qub/xSM9/GKWr+wdluDQqb6mLLfebqBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: Yygb_MXUg9n_o-ntCPxkVErSDuFufo07 X-Proofpoint-ORIG-GUID: Yygb_MXUg9n_o-ntCPxkVErSDuFufo07 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1011 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=562 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140695160100001 Content-Type: text/plain; charset="utf-8" Introduce a new QemuFd_t type to represent a file descriptor for different platforms. On POSIX platforms, this is a file descriptor On Windows, this is a file handle. Signed-off-by: Bin Meng --- Changes in v2: - Change to introduce QemuFd_t in osdep.h include/qemu/osdep.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b9c4307779..45fc8bb5d9 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -705,6 +705,32 @@ static inline int platform_does_not_support_system(con= st char *command) } #endif /* !HAVE_SYSTEM_FUNCTION */ =20 +/* + * QEMU file descriptor type + * + * On POSIX platforms, this is a file descriptor (int). + * On Windows, this is a file handle (HANDLE). + */ +#ifndef _WIN32 +typedef int QemuFd_t; +#define QEMU_FD_INVALID -1 +#else +typedef HANDLE QemuFd_t; +#define QEMU_FD_INVALID INVALID_HANDLE_VALUE +#endif + +/** + * qemu_fd_invalid - determine if a given QEMU file descriptor is invalid + * + * @fd: the value of a QEMU file descriptor + * + * Returns true if a given QEMU file descriptor is invalid, otherwise fals= e. + */ +static inline bool qemu_fd_invalid(QemuFd_t fd) +{ + return (fd =3D=3D QEMU_FD_INVALID); +} + #ifdef __cplusplus } #endif --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140760; cv=pass; d=zohomail.com; s=zohoarc; b=bDaPrfCEXTEWLeNxasTw0I2QMM9J7QyIJaggEQPfbtmvnW5GkYNlYcTukiMZBtyQCNQ0jfjkOljCfdrRb4piuZlCxQhuFqAxalp2uf4Eu9nF/8+pik1D4DoGOEreMr3Dkjsp8S2UZZ4OZdLeC7YcQMMpCBDWgkq3qXDCZ39fnYg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eO+j4U8lYVJulhU9rfL8NCdALTNM9uSn/kJ7Mrgg3KQ=; b=Tl+IpVLaXVdjtcgyOxXTAPCmXBiR+pOI5wcEhZva+UQwK7Yveyq7On05ITNBzl/H7FQ4FfLaIb2OvbXrtMlS7LO/3X4ndZ2vbjtYcnnIoxOqqzmPZVMtp4hH/D4M7BgFENASQd+7wverSEzQKC0NxhEwCkB35OQvkbR0CICLvps= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140760955316.94018204622273; Thu, 10 Nov 2022 20:26:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZZ-0000Vb-3A; Thu, 10 Nov 2022 23:23:21 -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 1otLZX-0000Um-AS for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 1otLZU-0001Z2-Ac for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:19 -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 2AB4N0iN024928; Fri, 11 Nov 2022 04:23:02 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:02 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22:57 +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.5813.013; Fri, 11 Nov 2022 04:22:56 +0000 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=eO+j4U8lYVJulhU9rfL8NCdALTNM9uSn/kJ7Mrgg3KQ=; b=flesH5sTX58rUuKsfNGljbVCDNsU+jGvC0tyh2DLO+r00OVUjVpyyNCY6Mp+jNdJ456n n9oC6ijTQu1OqGlEDCzhJKMf4aIhnMZykOjg3k+ZPkZ8Nzc+behRAzbelMrF7yltlfgD S/Lxs0tDB1410QruSJHha5EY83uMg+y8ITsLKyPPUrR/5UoH7VAffuctxJYxrudEAPHj ISy9j7LtyrPFMs45vdM6azRmVOr1h1JFbZAPfCdqLQ0b7RC+WwZ3sygEE37e7GZ/IjJ+ uE7bmWvLQkAscbCTVFY2Ucj6z7vMTRlGBcvczk9GQzSUnKll0Cv9ZO0mz5SWBxMkRFsV KA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EQlA7GoDLnBlCTac4aqc0JH6PsqmIos1JHnFFojiQ9dQnmtXPlSKxnYUzomp1F5G/sf+yh54dpSGiHDt8yTFSPuoNlXWIxz4tZ4rYEmHyITS5lBR9lNfd2fP6i5aaMXw451H2EPpl33X+DG0MqF88GMywa+QfqJfp3mt/D8J0fbyb1LSQUqaduXFWPvHb2dxosADxkFlfRIMuvarrowec7j5r6+UVC+0RE+7VtRs02Rqt1YHAPyNiV9pwETFP22a/o+9+0KlOvnOMjjWIHVP3kTLfS9NYGosU0P5j9iZA/NdZELcqBPnhTN4EDDFgqGhAnmrpuuUjpK38UuqDADCAA== 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=eO+j4U8lYVJulhU9rfL8NCdALTNM9uSn/kJ7Mrgg3KQ=; b=EP6g99lKbHAKORBtokD/leCXnaKMTxienybZHleUOovv5w80PFEtAepDUtQJziZLGg48PXaq1LGpPe1weFuEcZdu+SJCYJuxG/v8Eb818j9LdGMV2OvBC+5MX5cHkDJbNybpB2c8IYUuZc0g0Xv1C/AUe1Cjp7DEbS80f6k5vvIJsuTTlAL5uXfn+lCmIftq98xrFtPotARcYAbXDKFHL9eIRaHXV5PSATgRYnOGksuw5fZMA7qUg0c/Cgd/ih0xsXXDOL6Qtq2Q86MT6fxSzxAq3xJ5QWchmhqlPr6Bt5B72qOfqFwSBQeSuEE9hyjxHv6tnnTapPIbaH7amu+C3w== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 05/19] hw/9pfs: Update 9pfs to use the new QemuFd_t type Date: Fri, 11 Nov 2022 12:22:11 +0800 Message-Id: <20221111042225.1115931-6-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 54f4ee7d-b7c5-43e3-effd-08dac39c68ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6wueHGXveE5YEJ9zq73UvU4lY8Lt2i/miYBMZTls4F96Hr9l8ANajSwqi6F3RsursILssVo/tQKaipdWzYXPZI3irjegTQ6RwKu0f/hHLPjF8KxbxlomEkXt9FQJf/jRlfb1e8SbjvnX8VLLBZ0v91rmLONsPxPHN7zU2lcNR8Zym7H9SdiRJ6CGyCNOGI9WOPPXW3FOhusYEIRaO8bU23YdqGNMDGP+JcNiMMHZjUT7Lzq0OqNrQD/C8s0a6XBbL6qV1O4FrgeMTRRetmmuW4ZGUXSpvpGS9ZTF1h5Gk0zIRT4klRAq9pe9492f54kXq4gxxhecwc2y6sAJozSQ542mCK/TgVC6ACfu3vZLVVxcx01OmOD8DXqh158TGezFbq2wiS0YZBiJzI7mTq+B/M0/3i3zAdsPErcztNK9icZM5UbiLDNZG/F0JV+FvTxrISmrN3w8Z8R6fE6Sy1SOkeOfFejYamsTgymc7PrsWMMyQxrhgf+WmcTZA6xyGoxJxyCfCwlPPc5u1yToemrAYYmIjg+cLkHjTlHELMQpRl7sUAtzCzfZaRbsDjkgVsyGmM0wTadkLTepSq1mENO2C6rCVvQrQibUFMQ2wbYQdkg/PqwhBkxfmUI4q0bdBFZwQHe/y7hHEI4CC0oNAIcRxB1I6I5w4BPkVbpdoBt8Sn8JtCCxdeXWg3g/IJ7ZPuyUs4FpSNWKPEPnOA2tvYXIbCuSmer3P9fuPPRpPsyNzrqMXASFcQPMxN5yIRqqeco0pmHFnj3G7d+ngo1ua2cd7Q== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(30864003)(41300700001)(15650500001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dladdF7Et8Q2SgHAAwBXrAuv61LTA0r3ZeMO4Tk8nURWTSXVaTrG458KRFtu?= =?us-ascii?Q?M1fswtJSrjc15iwxgsLiyc7XEnNjk0JV8RILIae1mP9Duos2xPzqaivQXct7?= =?us-ascii?Q?oyO9I1nX6LreXz1mtSPFyiY63ocXkQ7iU74lfQx8fWGM2zDkRo3DjCcwLUsl?= =?us-ascii?Q?5ZhfiClvzAR0nXXchVIUd1YRzWj6VVAFTXNjZmM+YqR8isMrUxLgK5Je48db?= =?us-ascii?Q?W+7dF2b7S9c/o3m3Vl5pfp4nrQJa1WsTJNzQeRGNdjT2bCugpRWf8uiAXftR?= =?us-ascii?Q?hPGJqKR7rZn/DpMWEwHItNaEU5I6oSq8VsysI+l2sExdTRZthXCk3G8IPEVB?= =?us-ascii?Q?6fpdaZL2p9sbvdZwEQIQGhDvPae9fsqklJ8MVXfRCSyX0u6lXYpP+kpXj0Gl?= =?us-ascii?Q?AwNtHw+INj42PNfFm+XFFIVsJKoXoK/dGHb5xe5MWkJYdxLCOC/2NGZuzb/0?= =?us-ascii?Q?j37dbnFJrA07s1LtOrtsUkxaIONCMwaQ5IDecivqbqSt/6dawbW3PZTLX04D?= =?us-ascii?Q?s22wxfzHaSXbFZSnNLUhnH8cfeDC6b4XyjAkjK5jeXYdB5FDan9i+iBKn1Ik?= =?us-ascii?Q?cpMk44Q5iHVEOJ5yVGQazDnr25ZsWr6QcKdICWIBNz3xaNNKQrJLbg5OlgOq?= =?us-ascii?Q?5vgAL2hxoIkj18h3DZJlyjAOYK0dt3j/gGk3PFg6h4tYm3tMSv07GZ0DFVUJ?= =?us-ascii?Q?6NkqFPnJQfXwKJ9C3YgkcKhg3enLiGqoCX6E74Se4OIM8sBUyxUfG5bJq2Xn?= =?us-ascii?Q?PQUjufJKV6/zK7NL2qisKmuvfFn6zkA7Oey9uo7im359Y53k/8QW9ZXuYiX0?= =?us-ascii?Q?U62AytnCpUMo0RU7QkGhiNtuUeDFBWPg/t33sug0EE8my8aF7UY2J4Ty0Xs+?= =?us-ascii?Q?XnRZH0wl3L2DmDyPH7QXT7k4MMlYGB91dqmCOUbdZFccLA7hGt6hK9TU1pzB?= =?us-ascii?Q?/WAf1KMMp/5/ox0aWXOkJiy5C2bWitCdtw/UKr06cpH+MwRFVb+4UJBiZCYE?= =?us-ascii?Q?aCYwiRwbxhsBtr8rrP7Uey15rt7Cys5Kw6luym+GbaYUkTcnk6k0K6HJAwAo?= =?us-ascii?Q?fQKnufvXoRXR/POEScVn4ARoGuPVPTV6o7uH61qQUysq+Xjwi2SCQ18mXZPe?= =?us-ascii?Q?Hoxt0ibuIK7pEJ+ThSnO6678NIof/ELMxxGqAsxhfAj6VPLDhLjq4laxD8ur?= =?us-ascii?Q?dSsLxdzCQpAsDfGdf/5BJMJzJzFH7up4eIFUO1dEuij2M+RAzpftfbqN12BG?= =?us-ascii?Q?JuyRkVpAvazD01xnEdlyCds7hn/IZGn9LU9rlVRAJa1BljlbHhl0BH5rVnaR?= =?us-ascii?Q?mAUNT3uBQfkU2UZV60T567rE7SSnbjeykD5Yr6uHQUAwAQ2XKWYSRMqdV/Ec?= =?us-ascii?Q?/ruKZ5e//3Hf4PwhWbCzDyCUJLk7pJcBtjggNccMp1Z6Qudfibe/et2AKqvX?= =?us-ascii?Q?vqXtNhYV8MxTPtkghIq1QF4lreGn5VRRpqWoRIUf9Zazce9aKbs/uOoei9n7?= =?us-ascii?Q?cW7k8O7sy8A4uloDm1P8g/pC5X2z7zwQOASD6gtsg3vDEP7XkPrTy1KlQtcm?= =?us-ascii?Q?OYOaFW8sQRmiY7vLmjpsndfqG92f2iVQ8AU9MakW?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54f4ee7d-b7c5-43e3-effd-08dac39c68ca X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:56.9459 (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: RpQ3Qs9rW5qlRG5a3QWWvDD+OYNuZwYE66GaqPLSv8x2m7+qaJ0EKFXILOi/NwDjxyeQZNaRCHzFB8vibeMlWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: BhplmFcIvXXolupRXi0PUh5MOPGeaR6k X-Proofpoint-ORIG-GUID: BhplmFcIvXXolupRXi0PUh5MOPGeaR6k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=916 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140761604100001 Content-Type: text/plain; charset="utf-8" With this new QemuFd_t type, it significantly reduces the number of deviated code paths when adding Windows support. Signed-off-by: Bin Meng --- Changes in v2: - Use the new QemuFd_t type hw/9pfs/9p-local.h | 6 +- hw/9pfs/9p-util.h | 26 +++--- hw/9pfs/9p-local.c | 174 ++++++++++++++++++++------------------- hw/9pfs/9p-util-darwin.c | 14 ++-- hw/9pfs/9p-util-linux.c | 14 ++-- hw/9pfs/9p-xattr.c | 16 ++-- 6 files changed, 129 insertions(+), 121 deletions(-) diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index 32c72749d9..66a21316a0 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -13,8 +13,8 @@ #ifndef QEMU_9P_LOCAL_H #define QEMU_9P_LOCAL_H =20 -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); +QemuFd_t local_open_nofollow(FsContext *fs_ctx, const char *path, int flag= s, + mode_t mode); +QemuFd_t local_opendir_nofollow(FsContext *fs_ctx, const char *path); =20 #endif diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c314cf381d..3d6bd1a51e 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -101,30 +101,31 @@ static inline int errno_to_dotl(int err) { #define qemu_utimensat utimensat #define qemu_unlinkat unlinkat =20 -static inline void close_preserve_errno(int fd) +static inline void close_preserve_errno(QemuFd_t fd) { int serrno =3D errno; close(fd); errno =3D serrno; } =20 -static inline int openat_dir(int dirfd, const char *name) +static inline QemuFd_t openat_dir(QemuFd_t dirfd, const char *name) { return qemu_openat(dirfd, name, O_DIRECTORY | O_RDONLY | O_NOFOLLOW | O_PATH_9P_UTI= L); } =20 -static inline int openat_file(int dirfd, const char *name, int flags, - mode_t mode) +static inline QemuFd_t openat_file(QemuFd_t dirfd, const char *name, + int flags, mode_t mode) { - int fd, serrno, ret; + int serrno, ret; + QemuFd_t fd; =20 #ifndef CONFIG_DARWIN again: #endif fd =3D qemu_openat(dirfd, name, flags | O_NOFOLLOW | O_NOCTTY | O_NONB= LOCK, mode); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { #ifndef CONFIG_DARWIN if (errno =3D=3D EPERM && (flags & O_NOATIME)) { /* @@ -155,13 +156,13 @@ again: return fd; } =20 -ssize_t fgetxattrat_nofollow(int dirfd, const char *path, const char *name, - void *value, size_t size); -int fsetxattrat_nofollow(int dirfd, const char *path, const char *name, +ssize_t fgetxattrat_nofollow(QemuFd_t dirfd, const char *path, + const char *name, void *value, size_t size); +int fsetxattrat_nofollow(QemuFd_t dirfd, const char *path, const char *nam= e, void *value, size_t size, int flags); -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(QemuFd_t dirfd, const char *filename, char *list, size_t size); -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(QemuFd_t dirfd, const char *filename, const char *name); =20 /* @@ -219,6 +220,7 @@ static inline struct dirent *qemu_dirent_dup(struct dir= ent *dent) #if defined CONFIG_DARWIN && defined CONFIG_PTHREAD_FCHDIR_NP int pthread_fchdir_np(int fd) __attribute__((weak_import)); #endif -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev); +int qemu_mknodat(QemuFd_t dirfd, const char *filename, mode_t mode, + dev_t dev); =20 #endif diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d2246a3d7e..22377a3105 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -54,18 +54,18 @@ #endif =20 typedef struct { - int mountfd; + QemuFd_t mountfd; } LocalData; =20 -int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, - mode_t mode) +QemuFd_t local_open_nofollow(FsContext *fs_ctx, const char *path, int flag= s, + mode_t mode) { LocalData *data =3D fs_ctx->private; - int fd =3D data->mountfd; + QemuFd_t fd =3D data->mountfd; =20 - while (*path && fd !=3D -1) { + while (*path && !qemu_fd_invalid(fd)) { const char *c; - int next_fd; + QemuFd_t next_fd; char *head; =20 /* Only relative paths without consecutive slashes */ @@ -94,20 +94,21 @@ int local_open_nofollow(FsContext *fs_ctx, const char *= path, int flags, return fd; } =20 -int local_opendir_nofollow(FsContext *fs_ctx, const char *path) +QemuFd_t local_opendir_nofollow(FsContext *fs_ctx, const char *path) { return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0); } =20 -static void renameat_preserve_errno(int odirfd, const char *opath, int ndi= rfd, - const char *npath) +static void renameat_preserve_errno(QemuFd_t odirfd, const char *opath, + QemuFd_t ndirfd, const char *npath) { int serrno =3D errno; qemu_renameat(odirfd, opath, ndirfd, npath); errno =3D serrno; } =20 -static void unlinkat_preserve_errno(int dirfd, const char *path, int flags) +static void unlinkat_preserve_errno(QemuFd_t dirfd, const char *path, + int flags) { int serrno =3D errno; qemu_unlinkat(dirfd, path, flags); @@ -117,9 +118,10 @@ static void unlinkat_preserve_errno(int dirfd, const c= har *path, int flags) #define VIRTFS_META_DIR ".virtfs_metadata" #define VIRTFS_META_ROOT_FILE VIRTFS_META_DIR "_root" =20 -static FILE *local_fopenat(int dirfd, const char *name, const char *mode) +static FILE *local_fopenat(QemuFd_t dirfd, const char *name, const char *m= ode) { - int fd, o_mode =3D 0; + QemuFd_t fd; + int o_mode =3D 0; FILE *fp; int flags; /* @@ -134,7 +136,7 @@ static FILE *local_fopenat(int dirfd, const char *name,= const char *mode) return NULL; } fd =3D openat_file(dirfd, name, flags, o_mode); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return NULL; } fp =3D fdopen(fd, mode); @@ -145,16 +147,16 @@ static FILE *local_fopenat(int dirfd, const char *nam= e, const char *mode) } =20 #define ATTR_MAX 100 -static void local_mapped_file_attr(int dirfd, const char *name, +static void local_mapped_file_attr(QemuFd_t dirfd, const char *name, struct stat *stbuf) { FILE *fp; char buf[ATTR_MAX]; - int map_dirfd; + QemuFd_t map_dirfd; =20 if (strcmp(name, ".")) { map_dirfd =3D openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd =3D=3D -1) { + if (qemu_fd_invalid(map_dirfd)) { return; } =20 @@ -187,10 +189,10 @@ static int local_lstat(FsContext *fs_ctx, V9fsPath *f= s_path, struct stat *stbuf) int err =3D -1; char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); - int dirfd; + QemuFd_t dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -233,14 +235,14 @@ out: return err; } =20 -static int local_set_mapped_file_attrat(int dirfd, const char *name, +static int local_set_mapped_file_attrat(QemuFd_t dirfd, const char *name, FsCred *credp) { FILE *fp; int ret; char buf[ATTR_MAX]; int uid =3D -1, gid =3D -1, mode =3D -1, rdev =3D -1; - int map_dirfd =3D -1, map_fd; + QemuFd_t map_dirfd =3D QEMU_FD_INVALID, map_fd; bool is_root =3D !strcmp(name, "."); =20 if (is_root) { @@ -259,7 +261,7 @@ static int local_set_mapped_file_attrat(int dirfd, cons= t char *name, } =20 map_dirfd =3D openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd =3D=3D -1) { + if (qemu_fd_invalid(map_dirfd)) { return -1; } =20 @@ -296,7 +298,7 @@ update_map_file: /* We can't go this far with map_dirfd not being a valid file desc= riptor * but some versions of gcc aren't smart enough to see it. */ - if (map_dirfd !=3D -1) { + if (!qemu_fd_invalid(map_dirfd)) { close_preserve_errno(map_dirfd); } } @@ -305,7 +307,7 @@ update_map_file: } =20 map_fd =3D fileno(fp); - assert(map_fd !=3D -1); + assert(!qemu_fd_invalid(map_fd)); ret =3D fchmod(map_fd, 0600); assert(ret =3D=3D 0); =20 @@ -339,10 +341,11 @@ update_map_file: return 0; } =20 -static int fchmodat_nofollow(int dirfd, const char *name, mode_t mode) +static int fchmodat_nofollow(QemuFd_t dirfd, const char *name, mode_t mode) { struct stat stbuf; - int fd, ret; + QemuFd_t fd; + int ret; =20 /* FIXME: this should be handled with fchmodat(AT_SYMLINK_NOFOLLOW). * Unfortunately, the linux kernel doesn't implement it yet. @@ -362,16 +365,16 @@ static int fchmodat_nofollow(int dirfd, const char *n= ame, mode_t mode) /* Fallback for systems that don't support O_PATH: we depend on the fi= le * being readable or writable. */ - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { /* In case the file is writable-only and isn't a directory. */ if (errno =3D=3D EACCES) { fd =3D openat_file(dirfd, name, O_WRONLY, 0); } - if (fd =3D=3D -1 && errno =3D=3D EISDIR) { + if (qemu_fd_invalid(fd) && errno =3D=3D EISDIR) { errno =3D EACCES; } } - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } ret =3D fchmod(fd, mode); @@ -380,7 +383,7 @@ static int fchmodat_nofollow(int dirfd, const char *nam= e, mode_t mode) * link, O_PATH | O_NOFOLLOW causes openat(2) to return a file descrip= tor * referring to the symbolic link. */ - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } =20 @@ -401,7 +404,7 @@ static int fchmodat_nofollow(int dirfd, const char *nam= e, mode_t mode) return ret; } =20 -static int local_set_xattrat(int dirfd, const char *path, FsCred *credp) +static int local_set_xattrat(QemuFd_t dirfd, const char *path, FsCred *cre= dp) { int err; =20 @@ -440,7 +443,7 @@ static int local_set_xattrat(int dirfd, const char *pat= h, FsCred *credp) return 0; } =20 -static int local_set_cred_passthrough(FsContext *fs_ctx, int dirfd, +static int local_set_cred_passthrough(FsContext *fs_ctx, QemuFd_t dirfd, const char *name, FsCred *credp) { if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, @@ -464,10 +467,10 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fs= Path *fs_path, =20 if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { - int fd; + QemuFd_t fd; =20 fd =3D local_open_nofollow(fs_ctx, fs_path->data, O_RDONLY, 0); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } do { @@ -478,10 +481,10 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fs= Path *fs_path, (fs_ctx->export_flags & V9FS_SM_NONE)) { char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); - int dirfd; + QemuFd_t dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -507,10 +510,10 @@ static int local_closedir(FsContext *ctx, V9fsFidOpen= State *fs) static int local_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { - int fd; + QemuFd_t fd; =20 fd =3D local_open_nofollow(ctx, fs_path->data, flags, 0); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } fs->fd =3D fd; @@ -520,11 +523,11 @@ static int local_open(FsContext *ctx, V9fsPath *fs_pa= th, static int local_opendir(FsContext *ctx, V9fsPath *fs_path, V9fsFidOpenState *fs) { - int dirfd; + QemuFd_t dirfd; DIR *stream; =20 dirfd =3D local_opendir_nofollow(ctx, fs_path->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -640,10 +643,10 @@ static int local_chmod(FsContext *fs_ctx, V9fsPath *f= s_path, FsCred *credp) char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); int ret =3D -1; - int dirfd; + QemuFd_t dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -667,7 +670,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir= _path, const char *name, FsCred *credp) { int err =3D -1; - int dirfd; + QemuFd_t dirfd; =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -676,7 +679,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir= _path, } =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -719,7 +722,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir= _path, const char *name, FsCred *credp) { int err =3D -1; - int dirfd; + QemuFd_t dirfd; =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -728,7 +731,7 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir= _path, } =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -816,9 +819,9 @@ static int local_fstat(FsContext *fs_ctx, int fid_type, static int local_open2(FsContext *fs_ctx, V9fsPath *dir_path, const char *= name, int flags, FsCred *credp, V9fsFidOpenState *fs) { - int fd =3D -1; + QemuFd_t fd =3D QEMU_FD_INVALID; int err =3D -1; - int dirfd; + QemuFd_t dirfd; =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -832,7 +835,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir= _path, const char *name, flags |=3D O_NOFOLLOW; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -840,7 +843,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir= _path, const char *name, if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { fd =3D openat_file(dirfd, name, flags, fs_ctx->fmode); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { goto out; } credp->fc_mode =3D credp->fc_mode | S_IFREG; @@ -856,7 +859,7 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *dir= _path, const char *name, } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { fd =3D openat_file(dirfd, name, flags, credp->fc_mode); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { goto out; } err =3D local_set_cred_passthrough(fs_ctx, dirfd, name, credp); @@ -882,7 +885,7 @@ static int local_symlink(FsContext *fs_ctx, const char = *oldpath, V9fsPath *dir_path, const char *name, FsCred *cre= dp) { int err =3D -1; - int dirfd; + QemuFd_t dirfd; =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -891,19 +894,19 @@ static int local_symlink(FsContext *fs_ctx, const cha= r *oldpath, } =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 /* Determine the security model */ if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int fd; + QemuFd_t fd; ssize_t oldpath_size, write_size; =20 fd =3D openat_file(dirfd, name, O_CREAT | O_EXCL | O_RDWR, fs_ctx->fmode); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { goto out; } /* Write the oldpath (target) to the file. */ @@ -962,7 +965,7 @@ static int local_link(FsContext *ctx, V9fsPath *oldpath, char *odirpath =3D g_path_get_dirname(oldpath->data); char *oname =3D g_path_get_basename(oldpath->data); int ret =3D -1; - int odirfd, ndirfd; + QemuFd_t odirfd, ndirfd; =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { @@ -971,12 +974,12 @@ static int local_link(FsContext *ctx, V9fsPath *oldpa= th, } =20 odirfd =3D local_opendir_nofollow(ctx, odirpath); - if (odirfd =3D=3D -1) { + if (qemu_fd_invalid(odirfd)) { goto out; } =20 ndirfd =3D local_opendir_nofollow(ctx, dirpath->data); - if (ndirfd =3D=3D -1) { + if (qemu_fd_invalid(ndirfd)) { close_preserve_errno(odirfd); goto out; } @@ -996,12 +999,12 @@ static int local_link(FsContext *ctx, V9fsPath *oldpa= th, } =20 omap_dirfd =3D openat_dir(odirfd, VIRTFS_META_DIR); - if (omap_dirfd =3D=3D -1) { + if (qemu_fd_invalid(omap_dirfd)) { goto err; } =20 nmap_dirfd =3D openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd =3D=3D -1) { + if (qemu_fd_invalid(nmap_dirfd)) { close_preserve_errno(omap_dirfd); goto err; } @@ -1032,10 +1035,11 @@ out: =20 static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) { - int fd, ret; + QemuFd_t fd; + int ret; =20 fd =3D local_open_nofollow(ctx, fs_path->data, O_WRONLY, 0); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } ret =3D ftruncate(fd, size); @@ -1048,10 +1052,10 @@ static int local_chown(FsContext *fs_ctx, V9fsPath = *fs_path, FsCred *credp) char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); int ret =3D -1; - int dirfd; + QemuFd_t dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -1078,10 +1082,11 @@ static int local_utimensat(FsContext *s, V9fsPath *= fs_path, { char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); - int dirfd, ret =3D -1; + QemuFd_t dirfd; + int ret =3D -1; =20 dirfd =3D local_opendir_nofollow(s, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -1093,13 +1098,13 @@ out: return ret; } =20 -static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *na= me, - int flags) +static int local_unlinkat_common(FsContext *ctx, QemuFd_t dirfd, + const char *name, int flags) { int ret; =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int map_dirfd; + QemuFd_t map_dirfd; =20 /* We need to remove the metadata as well: * - the metadata directory if we're removing a directory @@ -1110,10 +1115,10 @@ static int local_unlinkat_common(FsContext *ctx, in= t dirfd, const char *name, * mode. We just ignore the error. */ if (flags =3D=3D AT_REMOVEDIR) { - int fd; + QemuFd_t fd; =20 fd =3D openat_dir(dirfd, name); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } ret =3D qemu_unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); @@ -1123,7 +1128,7 @@ static int local_unlinkat_common(FsContext *ctx, int = dirfd, const char *name, } } map_dirfd =3D openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd !=3D -1) { + if (!qemu_fd_invalid(map_dirfd)) { ret =3D qemu_unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno !=3D ENOENT) { @@ -1143,11 +1148,11 @@ static int local_remove(FsContext *ctx, const char = *path) char *dirpath =3D g_path_get_dirname(path); char *name =3D g_path_get_basename(path); int flags =3D 0; - int dirfd; + QemuFd_t dirfd; int err =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -1188,10 +1193,11 @@ static int local_fsync(FsContext *ctx, int fid_type, =20 static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *st= buf) { - int fd, ret; + QemuFd_t fd; + int ret; =20 fd =3D local_open_nofollow(s, fs_path->data, O_RDONLY, 0); - if (fd =3D=3D -1) { + if (qemu_fd_invalid(fd)) { return -1; } ret =3D fstatfs(fd, stbuf); @@ -1276,7 +1282,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *o= lddir, const char *new_name) { int ret; - int odirfd, ndirfd; + QemuFd_t odirfd, ndirfd; =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE && (local_is_mapped_file_metadata(ctx, old_name) || @@ -1286,12 +1292,12 @@ static int local_renameat(FsContext *ctx, V9fsPath = *olddir, } =20 odirfd =3D local_opendir_nofollow(ctx, olddir->data); - if (odirfd =3D=3D -1) { + if (qemu_fd_invalid(odirfd)) { return -1; } =20 ndirfd =3D local_opendir_nofollow(ctx, newdir->data); - if (ndirfd =3D=3D -1) { + if (qemu_fd_invalid(ndirfd)) { close_preserve_errno(odirfd); return -1; } @@ -1302,7 +1308,7 @@ static int local_renameat(FsContext *ctx, V9fsPath *o= lddir, } =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int omap_dirfd, nmap_dirfd; + QemuFd_t omap_dirfd, nmap_dirfd; =20 ret =3D qemu_mkdirat(ndirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno !=3D EEXIST) { @@ -1310,12 +1316,12 @@ static int local_renameat(FsContext *ctx, V9fsPath = *olddir, } =20 omap_dirfd =3D openat_dir(odirfd, VIRTFS_META_DIR); - if (omap_dirfd =3D=3D -1) { + if (qemu_fd_invalid(omap_dirfd)) { goto err; } =20 nmap_dirfd =3D openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd =3D=3D -1) { + if (qemu_fd_invalid(nmap_dirfd)) { close_preserve_errno(omap_dirfd); goto err; } @@ -1373,7 +1379,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *d= ir, const char *name, int flags) { int ret; - int dirfd; + QemuFd_t dirfd; =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(ctx, name)) { @@ -1382,7 +1388,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *d= ir, } =20 dirfd =3D local_opendir_nofollow(ctx, dir->data); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -1446,7 +1452,7 @@ static int local_init(FsContext *ctx, Error **errp) LocalData *data =3D g_malloc(sizeof(*data)); =20 data->mountfd =3D open(ctx->fs_root, O_DIRECTORY | O_RDONLY); - if (data->mountfd =3D=3D -1) { + if (qemu_fd_invalid(data->mountfd)) { error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); goto err; } diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c index 95146e7354..f85cfd26bb 100644 --- a/hw/9pfs/9p-util-darwin.c +++ b/hw/9pfs/9p-util-darwin.c @@ -11,8 +11,8 @@ #include "qemu/error-report.h" #include "9p-util.h" =20 -ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *= name, - void *value, size_t size) +ssize_t fgetxattrat_nofollow(QemuFd_t dirfd, const char *filename, + const char *name, void *value, size_t size) { int ret; int fd =3D openat_file(dirfd, filename, @@ -25,7 +25,7 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *filen= ame, const char *name, return ret; } =20 -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(QemuFd_t dirfd, const char *filename, char *list, size_t size) { int ret; @@ -39,7 +39,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *file= name, return ret; } =20 -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(QemuFd_t dirfd, const char *filename, const char *name) { int ret; @@ -52,8 +52,8 @@ ssize_t fremovexattrat_nofollow(int dirfd, const char *fi= lename, return ret; } =20 -int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size, int flags) +int fsetxattrat_nofollow(QemuFd_t dirfd, const char *filename, + const char *name, void *value, size_t size, int f= lags) { int ret; int fd =3D openat_file(dirfd, filename, O_PATH_9P_UTIL | O_NOFOLLOW, 0= ); @@ -110,7 +110,7 @@ out: return err; } =20 -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +int qemu_mknodat(QemuFd_t dirfd, const char *filename, mode_t mode, dev_t = dev) { int preserved_errno, err; =20 diff --git a/hw/9pfs/9p-util-linux.c b/hw/9pfs/9p-util-linux.c index db451b0784..8dd9da10b6 100644 --- a/hw/9pfs/9p-util-linux.c +++ b/hw/9pfs/9p-util-linux.c @@ -19,8 +19,8 @@ #include "qemu/xattr.h" #include "9p-util.h" =20 -ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *= name, - void *value, size_t size) +ssize_t fgetxattrat_nofollow(QemuFd_t dirfd, const char *filename, + const char *name, void *value, size_t size) { char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); int ret; @@ -30,7 +30,7 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *filen= ame, const char *name, return ret; } =20 -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(QemuFd_t dirfd, const char *filename, char *list, size_t size) { char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); @@ -41,7 +41,7 @@ ssize_t flistxattrat_nofollow(int dirfd, const char *file= name, return ret; } =20 -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(QemuFd_t dirfd, const char *filename, const char *name) { char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); @@ -52,8 +52,8 @@ ssize_t fremovexattrat_nofollow(int dirfd, const char *fi= lename, return ret; } =20 -int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name, - void *value, size_t size, int flags) +int fsetxattrat_nofollow(QemuFd_t dirfd, const char *filename, + const char *name, void *value, size_t size, int f= lags) { char *proc_path =3D g_strdup_printf("/proc/self/fd/%d/%s", dirfd, file= name); int ret; @@ -64,7 +64,7 @@ int fsetxattrat_nofollow(int dirfd, const char *filename,= const char *name, =20 } =20 -int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev) +int qemu_mknodat(QemuFd_t dirfd, const char *filename, mode_t mode, dev_t = dev) { return mknodat(dirfd, filename, mode, dev); } diff --git a/hw/9pfs/9p-xattr.c b/hw/9pfs/9p-xattr.c index 9ae69dd8db..062bf2d1f0 100644 --- a/hw/9pfs/9p-xattr.c +++ b/hw/9pfs/9p-xattr.c @@ -78,13 +78,13 @@ ssize_t v9fs_list_xattr(FsContext *ctx, const char *pat= h, char *orig_value, *orig_value_start; ssize_t xattr_len, parsed_len =3D 0, attr_len; char *dirpath, *name; - int dirfd; + QemuFd_t dirfd; =20 /* Get the actual len */ dirpath =3D g_path_get_dirname(path); dirfd =3D local_opendir_nofollow(ctx, dirpath); g_free(dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { return -1; } =20 @@ -168,11 +168,11 @@ ssize_t local_getxattr_nofollow(FsContext *ctx, const= char *path, { char *dirpath =3D g_path_get_dirname(path); char *filename =3D g_path_get_basename(path); - int dirfd; + QemuFd_t dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -196,11 +196,11 @@ ssize_t local_setxattr_nofollow(FsContext *ctx, const= char *path, { char *dirpath =3D g_path_get_dirname(path); char *filename =3D g_path_get_basename(path); - int dirfd; + QemuFd_t dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 @@ -223,11 +223,11 @@ ssize_t local_removexattr_nofollow(FsContext *ctx, co= nst char *path, { char *dirpath =3D g_path_get_dirname(path); char *filename =3D g_path_get_basename(path); - int dirfd; + QemuFd_t dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (qemu_fd_invalid(dirfd)) { goto out; } =20 --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140683; cv=pass; d=zohomail.com; s=zohoarc; b=mpSX6hD4IuTiN42oY4KEMW42dS4VYxKbbp6higXd/Pbzg0aBKOei3/Y25DSrP0Ke9hoqvV50bRBJERB9wCFA0UkiVD/on7wiF+oyFXBfhH6jlzeSMZlOoThdkzNSQFyhv0QSedmyeBr7T6rjWjyRxvtFgKNlOU94lHbfkIgtLi0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140683; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gNc9mXTr/EyEiKJ6AiSyzYNMP3zaIbsnD4BKi7tOfKg=; b=bQYl1boehdvRTbmMCuBOab9ghdwpw5WKdh/6DZTLo5nBKHADIAi7ylZ+gq8nTicJly5RwfjLoY91ON0jwm/u6yubK0lXhW0vw/qAvv6Xcl5kZjARBtwi7JwV93XP4NkvdNYPI71qYSZ+nIEULBV1LdZPtmPZc9VMA+1x77q+XKo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140683262156.47813886740812; Thu, 10 Nov 2022 20:24:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZZ-0000Vo-6J; Thu, 10 Nov 2022 23:23:21 -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 1otLZX-0000Ul-9W for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 1otLZU-0001ZD-S1 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:19 -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 2AB4N0iO024928; Fri, 11 Nov 2022 04:23:03 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:02 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:22: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.5813.013; Fri, 11 Nov 2022 04:22:58 +0000 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=gNc9mXTr/EyEiKJ6AiSyzYNMP3zaIbsnD4BKi7tOfKg=; b=OA4f54ZJNXVphr9gAkN5CFtbCc0kd34MBKipyc4lPFYd4Ey1Aq5fz6ZB9TAHLatoMRnp YjrgCx5UkM0Pu061JyvNI5A/KMq2VY0zbh2zZFhZg7dmN0SVkQx3VcLbsej3T2n1KIor xw80BHmLQR5/bpO0ilIWyta+082Rv9pnCpSXnBL22JSMMobNEvfTdso0zmtYGNKYZZL7 mbiYIVXmjZybRN29kNhJJhzYLcQWVkiR2MGvSAADq3NakDSifp78Uj55NQYLuBbwtgB7 3nigQYCVGsaYP3+8yxTFxVgjjpfG0ctUW/uNsoQlIjPVEWLyIdBFFsrzlraZr6BlEWOP jA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ha7PXRpeAla0Z1aYm58TKqGZjuLT2fWHrMDCDjYQWx/M6cZ9iAChauy+ROXMjUiBCZqe4J/LyfOLwwsFv6qs45zQVitzn2OAPKPT1HqaETPdJ37R435zBcSHW7GNhu9vbuHQ/TMsuEwclzIqFtWcg5lqqzHqK7swTgpL09pcIJ3JTJvsA8qUYreYhbyrlz34WLnaLOX+ibE+b7FOnGru1pxy0QmKv1huuHVd75wDFB333vDmY/8JFMIyYOWcp0xzfrn6Ai9RBLdaX/EsbvXFXDPOeVqIv728Yx5rNFAENVyZTQ+qTgB/LvRnTvBqc9J0CGqJn21JGKL3+Gmz+IMaCg== 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=gNc9mXTr/EyEiKJ6AiSyzYNMP3zaIbsnD4BKi7tOfKg=; b=JepxFwEjeXkvwxqBqxbXMWXXe3EMmlCLVD7C9OZO0bO37+OoFA23+M/X/7XnmhYO00poHbehXGbEb+X1zKhlXg18Kfl3zSyzntSC9Iv0c9H2+CWiF1q8r/mODd1nZDztPvyz90iG1BuBXTTLvLjY4iWOFWdHIscCL82i3ELnhOgOVDBU5TLHaS15W8uJSWqXiiKmzCZNS7eI61+Fx96yyOPuOF1z+DwQPuaUuqhxTdtAEzEbZyoLJVOanWg+d/6MjQ52WZgy03YdD//bij4E6E6VVJcbIzgx4shKQT/FXq6ZqxcGorBh9wipCLMkRuXYz0vQHTv8DtE9+tyQzY52VQ== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 06/19] hw/9pfs: Add missing definitions for Windows Date: Fri, 11 Nov 2022 12:22:12 +0800 Message-Id: <20221111042225.1115931-7-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 5398c00b-8bfa-4718-c69c-08dac39c6a0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ufM0HiCE4ndWHvwNR9DrnZmBewCVRGwQvZAxKM0Vs/P66EbGwQhPC83ruxPZ6gz3h+frAFVLSEZ5buIbrMyXsWs72OYIfOk1UzukNGlUXB0BnHXQC6LnY71rSD8cslQDgtGbSNb8SAdFjopOFPX3fD4Qcpm3KgPJfaJJl4TW5w6DC8ipFkmvkq+K984PtWg0NqbmDIYsGKSRPWdK24VLIzHgeljtoTreQGPIkILFdjwjLtlM1VD9N9PVCoXFywRsIBZbsMELSUC4rFHu3+NsQzZYIUeUBSSW2S13JzWYhF8y4p/aA4q1u5xaiBRLDYgcwSJ5lDXgSfiHVzhYVx81sfGBzp4apNxhWUOYdf8iE39NgWNFfHqr13sFNeJnXHzNWRedKJ7JkTPgJ1dFY1UTF52PN8eO4tsPLsbQenf0eZ6MgBLuYrzTqt5bHSn+1uhrzbUjqCp2al9d+ZNLT4AKE2nR2vEW1EcNN7nFL4XxNhASYPTFhKPNb3ZmqM01IjxBQNDJ8fx/ThThHrm5yncBaleQ1KHmET6ALm0sMFHT6fEs5AtTGQF1yLjFMic7LIBWd5r7iAhAoOykOBQnl35ystsuel8uhNirkCoMsT9Y5YGJSEhZdK3WDiz2dzvyAo26GdsZFXkaAKCX5Kne8BTcncH/aLj0UkXYB2925l8AaMsSEBDmDyXvmwczB9MtGhQfteXFcLHsdg6TqnTolqpK3XsPPYSLvNArcsEqRs0OOmdFcOqZ8VNHfbYhjJBTbeiJYNHGeEUYVcabJFZxSg2IH7sn7LcRtHO6FT3Ek1B9/SM= 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(966005)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZFiYL+H/o1Zv8Ywfl/Jz7HT2tUP/1Wp+/35BFTVg/ISwYKYbrWgF6Dh9Eue4?= =?us-ascii?Q?T+/YbVm9DjSBT0d/2DVHXFkpba+MLipXCD4fYKJeN7zh1CwWxLWmpFqftoXC?= =?us-ascii?Q?rzxT2DtGhGSNyGSEyUVNfiodpwpJitcMEmKequJJpPkjKP+LbejtL3zFLrHk?= =?us-ascii?Q?WbGpIgT3qTgYpm7Cfad45SIlmvZ4qsVVWATCWZV2sLLmjXigXrVhWo/aXCcV?= =?us-ascii?Q?+EXfwS+BnBFzhJmr3WhZ/0m3SuQN3JJj9gXLfC4pNUAfOAhfJMFMho7Qa1WO?= =?us-ascii?Q?VjLy4H6exOwuC+XdxPDDJSq2P86/m9kTvQtwtGAI3HxIku6Hqk/goJcg3yh8?= =?us-ascii?Q?U7czxoQ9Bs/DQnGNroL6PhrFV1esfdtJcTeBqHu5SyFwQohs8UgsB2cOm8uF?= =?us-ascii?Q?FEd3PVIzJMQWJtPksNTWy9RdKaltVJIwkR+kSlK6LiPjaKxrEWZ4KfXvTg8n?= =?us-ascii?Q?bzHyZzB/Whhy0U81oqhKt1+28X4jlB0Sgsd2bPCT/gZT0K54nT+howBef9DZ?= =?us-ascii?Q?PJcqwz4muxCvjaGNFHwfoBI1VFfYGJ6JkI4G/MSLhav6Yf12dMuslXnDBwPR?= =?us-ascii?Q?a7b+Xg6lOyjEDZCssaasxRvM1qnhC45APy1hXT3ppsZwY8idYw0oOue5QSsJ?= =?us-ascii?Q?LyQUx6f6IYWPogIO+fITojT+mOen0IHGaFzeB3RdiCj4PCIL8NiIlLzhOY27?= =?us-ascii?Q?9vYXtU95CjvcRcBYzZ1uAtDwnf52OaXTnOnhLncfZdOdGOTmWnSxtHT45Jd1?= =?us-ascii?Q?TJvs7xaFHBY0K2T0dqCtQLqnX4DlUAc/cwdF+27C/qhraBuJ48ghVA4QOLvI?= =?us-ascii?Q?7acVqKFtS+oOnmZyWgJ9i/6adEIqHgYOnJswcgXBxiVz/qbOEuRaUM7hSBaR?= =?us-ascii?Q?8Wo8VtQL50Lf+6WJn16EbqtXaWutII4bcXbwbjMzI4+sGhdQ+80xs4Sry3l1?= =?us-ascii?Q?ufYDc8wtr9kT260N6lurMwsITZrUp3bvJ2QhX+9VEyJicLaD1wptiDi3I5Ue?= =?us-ascii?Q?v7C6wypAastFo0qExrbb32y/TvnEL8UV9inOklpMx9OriEGGJaAlbvznaXDT?= =?us-ascii?Q?yi7CPg/J6skezAGXKg8p/1p3FhbKeybuOWXW5uTawosf5JebES7OeOX3Ec1m?= =?us-ascii?Q?K1wv+6ZO85IY+WSgzYRVLyi4xHtEyO7na7eTfEXvLvBXkmYV/qED9jw/y6Vh?= =?us-ascii?Q?alxq6dN9iaTcUJxy/3V18PYeXuNLbFN18WIdeRvsx1ltjk1Vef+xwjWMb5qZ?= =?us-ascii?Q?Is+wSPBoeH7ET9IPlZlyPNF6EdY1HWigtdGPXq/ndDwOQEjg/ftCG1vcza9S?= =?us-ascii?Q?mjBayX2NooaL0xCJI+YciPWPOzSZ1wsOV1eALdXVwlWx2myNdHqm6n8ohGdE?= =?us-ascii?Q?vmQ9IqYsN4AiSc6gWMZq1XTx98ITV/WgXZZjqBMjZBxxi/VCjzWr+kmUwG91?= =?us-ascii?Q?gSy0m8hRzf2mOE8go4TCLchkDSqfqpPmLZcjV3pDYMb8CN39fLCAoTwwsz27?= =?us-ascii?Q?dA6awsYOG9p5Q3/uPLtt9cq3S7I08/aEth9KVoXnzPtDdA1KTADrU8cO2t7h?= =?us-ascii?Q?+TD4TvvZwXkWcneVcE7KkkQJ5jKb5Wod/N3GvVn+?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5398c00b-8bfa-4718-c69c-08dac39c6a0a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:22:58.9326 (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: BLMgCJIpkYeQE8NeaMysK/apU514htT4EqErg7xBXrP0WGDhZwbV4cZf366iz98jSDqm73iZaaWnZ3qCq+RjGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: sPQ9gfdlgHQZeFIyNjBjpEVu6rdXzt0L X-Proofpoint-ORIG-GUID: sPQ9gfdlgHQZeFIyNjBjpEVu6rdXzt0L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=535 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140685139100003 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Add S_IFLNK related macros to support symbolic link fsdev/file-op-9p.h | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 66 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 =20 +#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 =20 diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index 2fce4140d1..957a7e4ccc 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -3,13 +3,46 @@ =20 #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" =20 +#ifdef CONFIG_WIN32 + +#define NAME_MAX MAX_PATH + +/* 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))) + +#ifndef S_IFLNK +/* + * 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 conflic= ts. + */ +#define S_IFLNK 0xA000 +#define S_ISUID 0x0800 +#define S_ISGID 0x0400 +#define S_ISVTX 0x0200 + +#define S_ISLNK(mode) ((mode & S_IFMT) =3D=3D S_IFLNK) +#endif /* S_IFLNK */ + +#endif /* CONFIG_WIN32 */ + enum { P9_TLERROR =3D 6, P9_RLERROR, --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140730; cv=pass; d=zohomail.com; s=zohoarc; b=U3K85X+18cNMQlV7nTkaxjoRI140QaX0/cX36n4OouQXCZRz3kfu9XN3xf4tAuQ7ahkKDNfC+FVm5+L4P3q0o3U5yJ3+Y6xJtJuo2pEGv4GnlxGwDlUhy+t6v/QqOXN5uhxoXP50LzS9kZvihvwRkic75kpzvE4Wd3/qRWpuIJ8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140730; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=g4+5Nk34AbaSJWhXTaDd8OGNDH5bMbDEK3ah/RPsGKg=; b=M5hLLtXyT4g10tAgLUDjEjZ95fCHKvIButfYfr2nehCqaD9SIvRlWZO1/MkbGfzVV3NEeDZ5Ic51Ou3cSRHyFe3N4XyX25r8GP6ceVkn2jzA3DjcCLT8BsONH6xzaZvGLujtFJ6rBsOFfYKSlNlAbeQGDtyl1ZXyFnckEdry1lk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140730062163.2748861791473; Thu, 10 Nov 2022 20:25:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZc-0000Xs-Bv; Thu, 10 Nov 2022 23:23:24 -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 1otLZa-0000WU-Gc for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:22 -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 1otLZX-0001ZT-2n for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:22 -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 2AB4N0iP024928; Fri, 11 Nov 2022 04:23:03 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knd21ndvc-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:03 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:01 +0000 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=g4+5Nk34AbaSJWhXTaDd8OGNDH5bMbDEK3ah/RPsGKg=; b=KQu2ZhfrxRDhOsrVcgZpazIUPFRdp//AH4BIbaTDJlJdL3Maui941LqvQTJk8yR63GLG bYQtpscoGv5MAJxT2Qssa8n870T7TPhNFqrVWHhKXMPtYn4w4m9VqJyXO12ikdfzqfgs iRP8DCX199ZlAsFQ8S+xdaA3EAo8EajFQwIlvHiqV2PTC4+AfhhTBIVRtyy1Brw0wr3p Q21VQiidigx0veZZ4PkSzQJ+CQmogK+akPRovZZ9GyPDPsWmhdeKTnWJoJIOhzUaDHje ubEWrR/TelXeui5yZyZAbqDq81uS3DPKxdmLOOUFGBVgx+BV2x1nuST/JKZ2v/Y8oK56 0w== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lxMeMmP6Qav9gC/eaNb06UV9VvjUrI5CAd8U0k9ybH1s77Gek6Vs1vyWRknsjZXHrzW7vjAyZtT4E27QIq7K9o3PrWZLOeN8M2X/pBwPEP9Tnpek3oACCRgTKoNbX2K8uEso4ElWMWDzjDyyrMbE67Ib4fziMEaNnWSgVzwKk8R6+/ByWWkediDp3siP5eNWFr3Kf9wmz3WyrHlgCCrojcIQ6a+zG2MnpaojNkrnQZSuZg9qtd+RAQrm4qnPxlM180RVFKtWPijLejcV9E8M0vZ3dnFWMgRpUrwbP5w7d9ntOaKLJq//rO5kHW+TZxtC7YqQOpARx+kj8cH/sPEkZg== 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=g4+5Nk34AbaSJWhXTaDd8OGNDH5bMbDEK3ah/RPsGKg=; b=g6etALYu/GfiJD90eUeNAqU8kBUetVa31SRLYXnIrTh6f6Ip9Kbju3MSvH1CVlW38JYkMa1jR+YNcomrh4+PMh5qxoQoZcbQZ2U4Tu1hFCLrp6Z3kPw0elDVkCOcII56K7aEcoiQUK55vDQWGb/gRtGN2BIFg79DYrKyT3rHgmhyeDmZdG2NGorhT/PDgqgEeAO2QYz99OMUafYayVIeawjMh5bF55hhlfowjTwJMkcGK8XnZ27zMbpoKBcEO6EZvS2PbA46WbFdMhI9ACu8kYuzekVIY4/Om0C53OCCJcIIN57DtYZVG9IgF9UXP5WeotLIZhFSn741lMspqs1iZg== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 07/19] hw/9pfs: Implement Windows specific utilities functions for 9pfs Date: Fri, 11 Nov 2022 12:22:13 +0800 Message-Id: <20221111042225.1115931-8-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 99f85fc1-90f9-4681-b30f-08dac39c6b39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5x7h3wdCerShEvUu80pr1rtRuvpqsh0LUWtqrj8rXrdJzuqkoMuzTtndBWXxa3i4A3+8VJaBqq7GhwcXf6zbmS4X3wHacn1KFjeOU1/A3aO1ULO9YXazmXcukw6iOrKCRCZ9SumDNpg1zPP9XZ7lm6T9+Vmg8FiJpPua6nw0UYFwZdF4Ep/px787HyXP+CmbQg5EjkclK4WLByFOqJVvmu+Z4pcJlvhxTfZnMOxrk5ik5Luhzwcw3RM64nk+qrdM0xV2l8ih0S1dQQ2QpEeqmEt1Art7XmoXuCRXB6rKf8UzvbCrO3SPv1DUVemfA0xX5bSg7YKpuWpsvS0EZX/v7csafF2X98+w/8DUsvc/hdzC1Pcfpd3YGVougTh3uo2vrPmENu0YtWNCQQshjeZjozpQIC+ZBAB6sh8xKyyABGuizwpQ5VRxI7Cm9PAThhbEK+FyvaJZsMMQ4mQpeaOwFetnSu/JWXkbfq9tpFh1sOjPfD/Y9tsBqrcdFJlc6n5Y07NqJFpBRMIbwmpNWur6fN42dNqiFzspIQ6cjyfp+Hxy2RVHHxOVh8OX/FEjPEiYYDNlF2U2KuIIPSBxzNm83owzMCY45a32Xr9ElJiPG90itciktlDw3Bs6Dllwm29bqIs4sZfdqBsc0uTEqmz3Ocdr+W4miJjtRMKqOtrIdEaWWRgiy9gg43zIgu9j5LKP5LwPEmG9kKEw6W4WF6QZTSUFfBj8Iq8xXuM4cmExCXw366gXkKbBNetp5bSIuU2EVWouZfRihRQaE14D8LgpPIrJ7k3Z+tyMqpaUIu2De5g= 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(30864003)(41300700001)(6916009)(2906002)(54906003)(5660300002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?nn0jAHhJJYVj59WYRnfYuLqVtNOAEeLSg/bfbc5S6VoGmu9KPhCLkFGV2f9U?= =?us-ascii?Q?mkGW2iYDo4TBnNVn7DWafNL1xVGSrb4j3TN9VpTsgt65tmb6uenyrj+CMINX?= =?us-ascii?Q?cXE7gvMBHAIygbDYzlRX3JF9/714y2uy/QotMQUn71+PtsW9Ab28Efdwc6hX?= =?us-ascii?Q?gVN7ObgSH7bSALcM+zNMbiEyzZxwJQpQG8aW7UnhV7aNTrqpoal99HzuVKIG?= =?us-ascii?Q?wa2w6NYWn7GjB4tlGuPv/hgAoVTewoNbYJ3Uqi2YDrEP6WttFFEihKDY2tkg?= =?us-ascii?Q?si8rXal3gZDfCPb1XBy7mXEdAF4xuoCvDGMbtu9/D4uOH0dVn7/2u67POUCj?= =?us-ascii?Q?/eQzaC9nPp9mvdm4PngQArWF36eFKEi4jebGYM2SZvjz9Cz5xOKr2U0qSFgO?= =?us-ascii?Q?e5wtBq0yfXkoLavFh0V78RLVm5Ru9ND9m6iU003lyxLC7XPVDch8M4dxpPhb?= =?us-ascii?Q?ht/hLKwsG4E++/Db0+dbBr7dSU+eVfBiFepGH1Wab+GaUmm3exBQzDFtpaGF?= =?us-ascii?Q?a/dQUae7n3GhjkXw2V3rcKsidtpcFYhz4oG+Kgn0WeKWvH1OIT2lBLSri5Nk?= =?us-ascii?Q?QCo4fPgysokPkAySXUleUvkWslJ0qeN+3iwKWLjjtUMS4anTPhehbJ0Ylrfv?= =?us-ascii?Q?lUnu5EKcITJFQwgDcSX4Wnvi3GAeDsZby+cBtTcgdH03Lt436rAN4adRW5mh?= =?us-ascii?Q?oxvZ348aof5q612N9d/pxBjJX0ahusLWN9fIEP5LFIHxalD1QhwP9U3Hm+85?= =?us-ascii?Q?oR41SMOxiqmUcsRObLf1GVbgwAIQ3w96DQJt1y7WITOERSz+yAof0eqKzRgC?= =?us-ascii?Q?etYqel9az/Y7osuNyXmw26NV/M0oQjR5WrZQq44X8SKa1dwLO94Vy01kLish?= =?us-ascii?Q?hbhKQKKlhlP9nCiSYHisNNECRdWq0uZnCT4bu8vjIcp6wCJxq8HrfxgG2D76?= =?us-ascii?Q?2nlIbRHb1rmFlfrJbama4TtViLNgfdkotU+8OGBYtrWWQuFKNw96kBLQv/2o?= =?us-ascii?Q?OrJJZ7oBmobz/yz8b6gNNGe+DbiiYxVbhPpxrRpF5ludx6x5iaUQzhowzcmX?= =?us-ascii?Q?adb29CGM9LdfGDqT5bLt8mi80HGKsscc7EYWoM0p8aVRdZrHW1p8G1ZqLutr?= =?us-ascii?Q?G6QEP6dbLcYAMhhkWd5NBzzuFcL+UZmUP08D56qNqi/FvIdMojiP+ZDxUkl4?= =?us-ascii?Q?nXNX95/X7ngwX+ZjgxPBcuKX4YCkiTH7qQLK9YeRll/rQSQ7YA1OflprViEJ?= =?us-ascii?Q?a02Z6JG87F8wnuBCcnoVp1Ks04TIi4ELEFR72l4PT7zeBnLFff1nU5v5pejh?= =?us-ascii?Q?rp7tnmM3Wc7HNPGQst5x/N2q4frtL2aSWtLO/BECj+USBbqkyeRLoO5qJuE1?= =?us-ascii?Q?2adh6lOiZTDkJhxBmOYirvYtonW2S2mCtXXQE4nJsb3p/WGCT8cQWY8FHpZr?= =?us-ascii?Q?fJQmHQmgQr4oeDEtqhxsnuTx51hLlyRfWhGKaltyUlvKALkL1uoSpLTwsLP4?= =?us-ascii?Q?Mcl0crgcWdqP91AcsPSkYtFFygFcURnFky2mYniDl+D/FYhr1OYMsz23AM4j?= =?us-ascii?Q?bnEGlCmRVf7YaMlK9kP04LnvM0T62RTMWwWxHueH?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99f85fc1-90f9-4681-b30f-08dac39c6b39 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:01.0585 (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: 8ECBGhClZSMkhJbKbbwMPF4U3dt9pxd5YbknUuvrFovxoswUJMIicCdgGcF2iKiLMPhPsp2j/vgLFa2Ua3SZqA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: e_QCzm5h0h2ylJCjFj54oshcvnkrXuOM X-Proofpoint-ORIG-GUID: e_QCzm5h0h2ylJCjFj54oshcvnkrXuOM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140731492100001 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Support symbolic link when security model is "mapped-xattr" or "mapped-fi= le" hw/9pfs/9p-local.h | 7 + hw/9pfs/9p-util.h | 38 +- hw/9pfs/9p-local.c | 4 - hw/9pfs/9p-util-win32.c | 934 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 978 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 66a21316a0..eb4f39ddc2 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 =20 +typedef struct { + QemuFd_t mountfd; +#ifdef CONFIG_WIN32 + char *root_path; +#endif +} LocalData; + QemuFd_t local_open_nofollow(FsContext *fs_ctx, const char *path, int flag= s, mode_t mode); QemuFd_t local_opendir_nofollow(FsContext *fs_ctx, const char *path); diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 3d6bd1a51e..5fb854bf61 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -88,26 +88,61 @@ static inline int errno_to_dotl(int err) { return err; } =20 -#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 =20 +#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(QemuFd_t fd, const char *name); +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size= ); +QemuFd_t openat_win32(QemuFd_t dirfd, const char *pathname, int flags, + mode_t mode); +int fstatat_win32(QemuFd_t dirfd, const char *pathname, + struct stat *statbuf, int flags); +int mkdirat_win32(QemuFd_t dirfd, const char *pathname, mode_t mode); +int renameat_win32(QemuFd_t olddirfd, const char *oldpath, + QemuFd_t newdirfd, const char *newpath); +int utimensat_win32(QemuFd_t dirfd, const char *pathname, + const struct timespec times[2], int flags); +int unlinkat_win32(QemuFd_t dirfd, const char *pathname, int flags); +int statfs_win32(const char *root_path, struct statfs *stbuf); +QemuFd_t openat_dir(QemuFd_t dirfd, const char *name); +QemuFd_t openat_file(QemuFd_t dirfd, const char *name, int flags, + mode_t mode); +#endif =20 static inline void close_preserve_errno(QemuFd_t fd) { int serrno =3D errno; +#ifndef CONFIG_WIN32 close(fd); +#else + CloseHandle(fd); +#endif errno =3D serrno; } =20 +#ifndef CONFIG_WIN32 static inline QemuFd_t openat_dir(QemuFd_t dirfd, const char *name) { return qemu_openat(dirfd, name, @@ -155,6 +190,7 @@ again: errno =3D serrno; return fd; } +#endif =20 ssize_t fgetxattrat_nofollow(QemuFd_t 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 22377a3105..24e21141d5 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -53,10 +53,6 @@ #define BTRFS_SUPER_MAGIC 0x9123683E #endif =20 -typedef struct { - QemuFd_t mountfd; -} LocalData; - QemuFd_t local_open_nofollow(FsContext *fs_ctx, const char *path, int flag= s, 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..ed3d519937 --- /dev/null +++ b/hw/9pfs/9p-util-win32.c @@ -0,0 +1,934 @@ +/* + * 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 late= r. + * 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 Mi= nGW + * cannot detect if a path is a symbolic link or not. Also Windows do n= ot + * provide POSIX compatible readlink(). Supporting symbolic link in 9pf= s on + * Windows may cause security issues, so symbolic link support is disab= led + * completely for security model "none" or "passthrough". + * + * 2. Windows file system does not support extended attributes directly. 9= pfs + * for Windows uses NTFS ADS (Alternate Data Streams) to emulate extend= ed + * attributes. + * + * 3. statfs() is not available on Windows. qemu_statfs() is used to emula= te 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 u= sage. + * + * 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 hos= t, + * to support this and prevent security issue, all xxx_at() APIs are re= placed + * by xxx_at_win32() and Windows handle is used to replace the director= y fd. + * + * Windows file system does not allow replacing a file or directory if = it is + * referenced by a handle. Keep the handle open will lock and protect t= he + * parent directory and make the access to files atomically. + * + * If we don't protect (lock) the parent directory, the parent director= y may + * be replaced by others (e.g.: a symbolic link) and cause security iss= ues. + */ + +#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 =3D 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 e= nd. + * + * This function copies ADS name to namebuf. + */ + + p1 =3D strchr(full_ads_name, ':'); + if (p1 =3D=3D NULL) { + return -1; + } + + p2 =3D strchr(p1 + 1, ':'); + if (p2 =3D=3D NULL) { + return -1; + } + + /* skip empty ads name */ + if (p2 - p1 =3D=3D 1) { + return 0; + } + + if (p2 - p1 + 1 > namebuf_len) { + return -1; + } + + memcpy(namebuf, p1 + 1, p2 - p1 - 1); + namebuf[p2 - p1 - 1] =3D '\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(QemuFd_t fd, const char *name) +{ + g_autofree char *full_file_name =3D NULL; + DWORD total_size; + DWORD name_size; + + full_file_name =3D g_malloc0(NAME_MAX); + + /* get parent directory full file name */ + name_size =3D GetFinalPathNameByHandle(fd, full_file_name, + NAME_MAX - 1, FILE_NAME_NORMALIZE= D); + if (name_size =3D=3D 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 !=3D NULL) { + total_size =3D 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 =3D NULL; + char ads_file_name[NAME_MAX + 1] =3D {0}; + DWORD dwBytesRead; + HANDLE hStream; + HANDLE hFile; + + hFile =3D (HANDLE)_get_osfhandle(fd); + + full_file_name =3D get_full_path_win32(hFile, NULL); + if (full_file_name =3D=3D NULL) { + errno =3D EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0)= { + errno =3D EIO; + return -1; + } + + hStream =3D CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, N= ULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream =3D=3D INVALID_HANDLE_VALUE && + GetLastError() =3D=3D ERROR_FILE_NOT_FOUND) { + errno =3D ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) =3D=3D FALSE) { + errno =3D EIO; + CloseHandle(hStream); + return -1; + } + + CloseHandle(hStream); + + return dwBytesRead; +} + +/* + * openat_win32 - emulate openat() + * + * This function emulates openat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So openat_win32() has to use a directory handle instead of a directory = fd. + * + * 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 fl= ag. + * Create a new symbolic link will be denied. + * 3. This function checks file symbolic link attribute after open. + * + * So symbolic link will not be accessed by 9p client. + */ +QemuFd_t openat_win32(QemuFd_t dirfd, const char *pathname, int flags, + mode_t mode) +{ + g_autofree char *full_file_name1 =3D NULL; + g_autofree char *full_file_name2 =3D NULL; + HANDLE hFile =3D INVALID_HANDLE_VALUE; + int fd; + + full_file_name1 =3D get_full_path_win32(dirfd, pathname); + if (full_file_name1 =3D=3D NULL) { + return hFile; + } + + fd =3D open(full_file_name1, flags, mode); + if (fd > 0) { + DWORD attribute; + hFile =3D (HANDLE)_get_osfhandle(fd); + + full_file_name2 =3D get_full_path_win32(hFile, NULL); + attribute =3D GetFileAttributes(full_file_name2); + + /* check if it is a symbolic link */ + if ((attribute =3D=3D INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + errno =3D EACCES; + hFile =3D INVALID_HANDLE_VALUE; + close(fd); + } + } + + return hFile; +} + +/* + * fstatat_win32 - emulate fstatat() + * + * This function emulates fstatat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So fstatat_win32() has to use a directory handle instead of a directory= fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int fstatat_win32(QemuFd_t dirfd, const char *pathname, + struct stat *statbuf, int flags) +{ + g_autofree char *full_file_name =3D NULL; + HANDLE hFile =3D INVALID_HANDLE_VALUE; + BY_HANDLE_FILE_INFORMATION file_info; + DWORD attribute; + int err =3D 0; + int ret =3D -1; + ino_t st_ino; + + full_file_name =3D get_full_path_win32(dirfd, pathname); + if (full_file_name =3D=3D NULL) { + return ret; + } + + /* open file to lock it */ + hFile =3D CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DEL= ETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile =3D=3D INVALID_HANDLE_VALUE) { + err =3D EACCES; + goto out; + } + + attribute =3D GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute =3D=3D INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + errno =3D EACCES; + goto out; + } + + ret =3D stat(full_file_name, statbuf); + + if (GetFileInformationByHandle(hFile, &file_info) =3D=3D 0) { + errno =3D 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) =3D=3D sizeof(uint64_t)) { + st_ino =3D (ino_t)((uint64_t)file_info.nFileIndexLow + | (((uint64_t)file_info.nFileIndexHigh) << 32)); + } else if (sizeof(st_ino) =3D=3D sizeof(uint16_t)) { + st_ino =3D (ino_t)(((uint16_t)file_info.nFileIndexLow) + ^ ((uint16_t)(file_info.nFileIndexLow >> 16))); + } else { + st_ino =3D (ino_t)file_info.nFileIndexLow; + } + + statbuf->st_ino =3D st_ino; + +out: + if (hFile !=3D INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err !=3D 0) { + errno =3D err; + } + return ret; +} + +/* + * mkdirat_win32 - emulate mkdirat() + * + * This function emulates mkdirat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So mkdirat_win32() has to use a directory handle instead of a directory= fd. + */ +int mkdirat_win32(QemuFd_t dirfd, const char *pathname, mode_t mode) +{ + g_autofree char *full_file_name =3D NULL; + int ret =3D -1; + + full_file_name =3D get_full_path_win32(dirfd, pathname); + if (full_file_name =3D=3D NULL) { + return ret; + } + + ret =3D mkdir(full_file_name); + + return ret; +} + +/* + * renameat_win32 - emulate renameat() + * + * This function emulates renameat(). + * + * Windows POSIX API does not support openning a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So renameat_win32() has to use a directory handle instead of a director= y fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int renameat_win32(HANDLE olddirfd, const char *oldpath, + HANDLE newdirfd, const char *newpath) +{ + g_autofree char *full_old_name =3D NULL; + g_autofree char *full_new_name =3D NULL; + HANDLE hFile; + DWORD attribute; + int err =3D 0; + int ret =3D -1; + + full_old_name =3D get_full_path_win32(olddirfd, oldpath); + full_new_name =3D get_full_path_win32(newdirfd, newpath); + if (full_old_name =3D=3D NULL || full_new_name =3D=3D NULL) { + return ret; + } + + /* open file to lock it */ + hFile =3D CreateFile(full_old_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DEL= ETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute =3D GetFileAttributes(full_old_name); + + /* check if it is a symbolic link */ + if ((attribute =3D=3D INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + err =3D EACCES; + goto out; + } + + CloseHandle(hFile); + + ret =3D rename(full_old_name, full_new_name); +out: + if (err !=3D 0) { + errno =3D err; + } + return ret; +} + +/* + * utimensat_win32 - emulate utimensat() + * + * This function emulates utimensat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So utimensat_win32() has to use a directory handle instead of a directo= ry fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +int utimensat_win32(QemuFd_t dirfd, const char *pathname, + const struct timespec times[2], int flags) +{ + g_autofree char *full_file_name =3D NULL; + HANDLE hFile =3D INVALID_HANDLE_VALUE; + DWORD attribute; + struct utimbuf tm; + int err =3D 0; + int ret =3D -1; + + full_file_name =3D get_full_path_win32(dirfd, pathname); + if (full_file_name =3D=3D NULL) { + return ret; + } + + /* open file to lock it */ + hFile =3D CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DEL= ETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS + | FILE_FLAG_OPEN_REPARSE_POINT, + NULL); + + if (hFile =3D=3D INVALID_HANDLE_VALUE) { + err =3D EACCES; + goto out; + } + + attribute =3D GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute =3D=3D INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + errno =3D EACCES; + goto out; + } + + tm.actime =3D times[0].tv_sec; + tm.modtime =3D times[1].tv_sec; + + ret =3D utime(full_file_name, &tm); + +out: + if (hFile !=3D INVALID_HANDLE_VALUE) { + CloseHandle(hFile); + } + + if (err !=3D 0) { + errno =3D err; + } + return ret; +} + +/* + * unlinkat_win32 - emulate unlinkat() + * + * This function emulates unlinkat(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So unlinkat_win32() has to use a directory handle instead of a director= y fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ + +int unlinkat_win32(QemuFd_t dirfd, const char *pathname, int flags) +{ + g_autofree char *full_file_name =3D NULL; + HANDLE hFile; + DWORD attribute; + int err =3D 0; + int ret =3D -1; + + full_file_name =3D get_full_path_win32(dirfd, pathname); + if (full_file_name =3D=3D NULL) { + return ret; + } + + /* open file to prevent other one modify it */ + hFile =3D CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DEL= ETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + + attribute =3D GetFileAttributes(full_file_name); + + /* check if it is a symbolic link */ + if ((attribute =3D=3D INVALID_FILE_ATTRIBUTES) + || (attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + err =3D EACCES; + goto out; + } + + if (flags =3D=3D AT_REMOVEDIR) { /* remove directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) =3D=3D 0) { + err =3D ENOTDIR; + goto out; + } + ret =3D rmdir(full_file_name); + } else { /* remove regular file */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) !=3D 0) { + err =3D EISDIR; + goto out; + } + ret =3D remove(full_file_name); + } + + /* after last handle closed, file will be removed */ + CloseHandle(hFile); + +out: + if (err !=3D 0) { + errno =3D 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] =3D { 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) = =3D=3D 0) { + errno =3D EIO; + return -1; + } + + stbuf->f_type =3D V9FS_MAGIC; + stbuf->f_bsize =3D + (__fsword_t)SectorsPerCluster * (__fsword_t)BytesPerSector; + stbuf->f_blocks =3D (fsblkcnt_t)TotalNumberOfClusters; + stbuf->f_bfree =3D (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_bavail =3D (fsblkcnt_t)NumberOfFreeClusters; + stbuf->f_files =3D -1; + stbuf->f_ffree =3D -1; + stbuf->f_namelen =3D NAME_MAX; + stbuf->f_frsize =3D 0; + stbuf->f_flags =3D 0; + + return 0; +} + +/* + * openat_dir - emulate openat_dir() + * + * This function emulates openat_dir(). + * + * Windows POSIX API does not support opening a directory by open(). Only + * handle of directory can be opened by CreateFile(). + * + * So openat_dir() has to use a directory handle instead of a directory fd. + * + * Access to a symbolic link will be denied to prevent security issues. + */ +QemuFd_t openat_dir(QemuFd_t dirfd, const char *name) +{ + g_autofree char *full_file_name =3D NULL; + HANDLE hSubDir; + DWORD attribute; + + full_file_name =3D get_full_path_win32(dirfd, name); + if (full_file_name =3D=3D NULL) { + return INVALID_HANDLE_VALUE; + } + + attribute =3D GetFileAttributes(full_file_name); + if (attribute =3D=3D INVALID_FILE_ATTRIBUTES) { + return INVALID_HANDLE_VALUE; + } + + /* check if it is a directory */ + if ((attribute & FILE_ATTRIBUTE_DIRECTORY) =3D=3D 0) { + return INVALID_HANDLE_VALUE; + } + + /* do not allow opening a symbolic link */ + if ((attribute & FILE_ATTRIBUTE_REPARSE_POINT) !=3D 0) { + return INVALID_HANDLE_VALUE; + } + + /* open it */ + hSubDir =3D CreateFile(full_file_name, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_D= ELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + return hSubDir; +} + +QemuFd_t openat_file(QemuFd_t 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(QemuFd_t dirfd, const char *path, + const char *name, void *value, size_t size) +{ + g_autofree char *full_file_name =3D NULL; + char ads_file_name[NAME_MAX + 1] =3D { 0 }; + DWORD dwBytesRead; + HANDLE hStream; + + full_file_name =3D get_full_path_win32(dirfd, path); + if (full_file_name =3D=3D NULL) { + errno =3D EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0)= { + errno =3D EIO; + return -1; + } + + hStream =3D CreateFile(ads_file_name, GENERIC_READ, FILE_SHARE_READ, N= ULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream =3D=3D INVALID_HANDLE_VALUE && + GetLastError() =3D=3D ERROR_FILE_NOT_FOUND) { + errno =3D ENODATA; + return -1; + } + + if (ReadFile(hStream, value, size, &dwBytesRead, NULL) =3D=3D FALSE) { + errno =3D 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(QemuFd_t dirfd, const char *path, const char *nam= e, + void *value, size_t size, int flags) +{ + g_autofree char *full_file_name =3D NULL; + char ads_file_name[NAME_MAX + 1] =3D { 0 }; + DWORD dwBytesWrite; + HANDLE hStream; + + full_file_name =3D get_full_path_win32(dirfd, path); + if (full_file_name =3D=3D NULL) { + errno =3D EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, full_file_name, name) < 0)= { + errno =3D EIO; + return -1; + } + + hStream =3D CreateFile(ads_file_name, GENERIC_WRITE, FILE_SHARE_READ, = NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hStream =3D=3D INVALID_HANDLE_VALUE) { + errno =3D EIO; + return -1; + } + + if (WriteFile(hStream, value, size, &dwBytesWrite, NULL) =3D=3D FALSE)= { + errno =3D 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(QemuFd_t dirfd, const char *filename, + char *list, size_t size) +{ + g_autofree char *full_file_name =3D NULL; + WCHAR WideCharStr[NAME_MAX + 1] =3D { 0 }; + char full_ads_name[NAME_MAX + 1]; + WIN32_FIND_STREAM_DATA fsd; + BOOL bFindNext; + char *list_ptr =3D list; + size_t list_left_size =3D size; + HANDLE hFind; + int ret; + + full_file_name =3D get_full_path_win32(dirfd, filename); + if (full_file_name =3D=3D NULL) { + errno =3D EIO; + return -1; + } + + /* + * ADS enumerate function only has WCHAR version, so we need to + * covert filename to utf-8 string. + */ + ret =3D MultiByteToWideChar(CP_UTF8, 0, full_file_name, + strlen(full_file_name), WideCharStr, NAME_MA= X); + if (ret =3D=3D 0) { + errno =3D EIO; + return -1; + } + + hFind =3D FindFirstStreamW(WideCharStr, FindStreamInfoStandard, &fsd, = 0); + if (hFind =3D=3D INVALID_HANDLE_VALUE) { + errno =3D 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 =3D WideCharToMultiByte(CP_UTF8, 0, + fsd.cStreamName, wcslen(fsd.cStreamName)= + 1, + full_ads_name, sizeof(full_ads_name) - 1, + NULL, NULL); + if (ret =3D=3D 0) { + if (GetLastError() =3D=3D ERROR_INSUFFICIENT_BUFFER) { + errno =3D ERANGE; + } + CloseHandle(hFind); + return -1; + } + + ret =3D copy_ads_name(list_ptr, list_left_size, full_ads_name); + if (ret < 0) { + errno =3D ERANGE; + CloseHandle(hFind); + return -1; + } + + list_ptr =3D list_ptr + ret; + list_left_size =3D list_left_size - ret; + + bFindNext =3D 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(QemuFd_t dirfd, const char *filename, + const char *name) +{ + g_autofree char *full_file_name =3D NULL; + char ads_file_name[NAME_MAX + 1] =3D { 0 }; + + full_file_name =3D get_full_path_win32(dirfd, filename); + if (full_file_name =3D=3D NULL) { + errno =3D EIO; + return -1; + } + + if (build_ads_name(ads_file_name, NAME_MAX, filename, name) < 0) { + errno =3D EIO; + return -1; + } + + if (DeleteFile(ads_file_name) !=3D 0) { + if (GetLastError() =3D=3D ERROR_FILE_NOT_FOUND) { + errno =3D ENODATA; + return -1; + } + } + + return 0; +} + +/* + * local_opendir_nofollow - open a Windows directory + * + * This function returns a Windows file handle 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 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. + */ +HANDLE local_opendir_nofollow(FsContext *fs_ctx, const char *dirpath) +{ + g_autofree char *full_file_name =3D NULL; + LocalData *data =3D fs_ctx->private; + HANDLE hDir; + + hDir =3D openat_dir(data->mountfd, dirpath); + if (hDir =3D=3D INVALID_HANDLE_VALUE) { + return INVALID_HANDLE_VALUE; + } + + full_file_name =3D get_full_path_win32(hDir, NULL); + if (full_file_name =3D=3D NULL) { + CloseHandle(hDir); + return INVALID_HANDLE_VALUE; + } + + /* + * 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)) !=3D 0) { + CloseHandle(hDir); + hDir =3D INVALID_HANDLE_VALUE; + } + + return hDir; +} + +/* + * 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(QemuFd_t dirfd, const char *filename, mode_t mode, dev_t = dev) +{ + if (S_ISREG(mode) || !(mode & S_IFMT)) { + HANDLE hFile =3D openat_file(dirfd, filename, O_CREAT, mode); + if (hFile =3D=3D INVALID_HANDLE_VALUE) { + return -1; + } + close_preserve_errno(hFile); + return 0; + } + + error_report_once("Unsupported operation for mknodat"); + errno =3D ENOTSUP; + return -1; +} --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140678; cv=pass; d=zohomail.com; s=zohoarc; b=Crq+mQr/2yVqfAEdEkR8NhIaLQ4Uq4svzspni9H+tBvIe2fjbNYnE+k3qOwwgsNpgyCuBfpUrw/Sbh9JAKqwES1JYuAeESCjnNeFxMkt+Cbwx8rcuH7TzTC86nr2wbNa7AhAeCOWcOLbVAB6/4PLOsHO60d2GvngBBimrzeGhi8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140678; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s601e/7v4tldu0dGoFfcjj104NlHNzgzG04TEzou+Io=; b=WFcEEAiAV1g2iYGPB57Yckoq2sBZ1Zd1Cz4RPEdOxDXrhaj9fS8v7U1pHMZs0lLzueITaEWLyUYuFeM4OAjes8+perFk8Ri+ctypdB4paDeSQTWtCXAmIfNWfdgYV+8JXTKpXtBOcMciGcBr8CVMnA9/vo/AF817iUBYRHTh+F8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140678738569.1990994304704; Thu, 10 Nov 2022 20:24:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZb-0000Wx-LT; Thu, 10 Nov 2022 23:23:23 -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 1otLZa-0000W8-A1 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:22 -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 1otLZX-0001Zj-Bs for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:22 -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 2AB4N5DM004957; Thu, 10 Nov 2022 20:23:06 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9m3-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:06 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:03 +0000 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=s601e/7v4tldu0dGoFfcjj104NlHNzgzG04TEzou+Io=; b=cQq72DevbIdQ8LkyTaMS0vn8KT1FWj3vNwkUWRHkmEkfO8s76Rz0lJ9fBMWYFkDTdkGN u9sFv2BT1DpgjRUqVKNLQM2slnwx1oviFlWZL95xrzor+VnghzdmGoN599ildP+INOXY s21yOFS5avjBDMMRKUN1rukAZjdXP1UXKkOq0ms1of5IT2FrLXXK98sPSGMVllQ4HGs0 NZ+MsQIj+fdCurVf0xOzPdtw0fITLGufX+soz0AiMx175+IWttdwWomwKEKM+I4XyO7c p2QCTBvtaE9O0Iyhijc81RVvlQTzwpY6b8c2xdUA0XNpBtWNbYS8WqoHNik3pQJ5e2VD Qg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jnqmCvDDhk4DR3BTAtuJRpeNMLiLiqrHqJvvAnTGhfNoBDf++9eEt1AUY10ra3Oh6Xe6cfFvqQogBNvKNLlVoJzAUgRrJ+A7o427aSb3jWdFDKocJDQnHZn54hbja3OgGQLHPpK0PqxXcF+4QjZRP1B8coUgZ2L/DE5dvX/xyD7yhDXYQArqZGEVf/gNDc2gxFbmz9c3KGXhBp61hWnkIpldUpIR3x8N9TEJ5k/IgeXF84PUjDtDisSVofpVy1ntPqpkiuTi9L2xCEXu5xMTAZTL5naeoTQiwUi6iwOgX9AaSZj3nzy2eAXoMgXXdnOSSOqCUHPziBtitA6UDemCdw== 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=s601e/7v4tldu0dGoFfcjj104NlHNzgzG04TEzou+Io=; b=gmhJ1MIdOq1/LYqmsD3PGDaOp755KzZL2X03n9s78hn39cqqkBIs2GriFVzFm3zsss3Xk64PXg8/ib4QLvV6b3rdVTy9AVhXOC6hVUFI74dIGnNFvK7dCAciXNf6L5BxwApyxGRhmXNH0ZRWJd+Ci/nbfJpZWdr3pYUGqet3mY7i56OzAr3lShXyvKJu/lfqhVqd7tdUkHrTeJDBJR1Q7uTeHjog/CTXAeUWBfocb3986N4AgyHQGVzBEzyOjCQ5EVJqbx4q5vlWYFAX1E8BAft+h3vTflALy/DB2WwKAiMahYk67NSP8UT+ygSaCUIn+IQj5MFaiEokGQfARFcVhQ== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 08/19] hw/9pfs: Update the local fs driver to support Windows Date: Fri, 11 Nov 2022 12:22:14 +0800 Message-Id: <20221111042225.1115931-9-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: e741222e-37a8-4b00-ac5c-08dac39c6c9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RnMprc5k+4HRVnimlrcO8k1li2eQy7VyKQv5aaSIRY+Co/y9vn4uxpDDi1isgTk8/pIOc97wJtMA/ohR78UM/pFmboZxvtowYvYAClZYnhYEqeTsP8UTNO/gK3Wc6SpZ8ssIWQeCZBZcEO6dOcWQ6Zt2BGBnn/inOLNb9PVJ42UNL18dawSbyt4W+7L4HCXOvfM9YVPgTAuzhx4bQ6VlCjgZPntY8R6kr7XsyDrB045HH0VI9i04k2d97x6pooPGfa4e76ZbdziXuw01D+38jp1tBshQJcekBysYJ2ABdNJLL35HnHizRSac4JyK0KbMRRYoG+47AJ9C3n1I4ze+0Cm/0rvWidQ1LBs5GF4G/fnqUqTEnqJUyHw5bh/bCI6XQY/Ai7AGehZNIEc1r3S6xRZIhv3DOyklhPpfToRiuiu2Fu4HFQa88l8fQJM2WsIDUf2HDK6K70zGeAiKUuNv6Aro3DvCejL79FswB/vucQFrE1PC0Lsb3BCpvOt+pgE5SDhU66yD9m/jUNvyVt/UcPqyO00wxyTokzDwqI8pHdB5xp/cpaZKzrjaBoTeiHdVC0OicfG68SccXqOdLhcFTp1ATHfEJbf07o0x7MY/s1fJM1t+OIOeFStOWKi2VY5WzSn9A87qTT386xmWpHwY10/W7RHUJsZi6m+ZTL2h+B48iM8+48k2HgMSqE/oNRSUoWY0HRqQjC7X+m3u7q0a7/C2JI6Z4H9XiEtl+umQ8CF/T5LxOFVgXVqHZSeXvLSFYeU8V/tA++nd2+TSmXDvCQ== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(30864003)(41300700001)(15650500001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?iwmWvxGoqkQZDOUeaTgE+rfcUKiRwXiS2zJDbZjEw5O9IuHleUq2LhHyIZno?= =?us-ascii?Q?jQv2N9nXc6XNXWgDFsnLcvm/oRmkIsJV7EFKg6hWUk6TzaCxhVHZMeZ4Rr4S?= =?us-ascii?Q?1UByxXRvAuBqiwUwfT9/BRbEmDnnaUtQzvtMeX2XBI191UoMtFh54ZZzx8TF?= =?us-ascii?Q?BlSGbm6tFDnKJuMkMtN7/J3zynOOL8Zt+kp4g3zFRvsPYTqD1tTY3PAM4FDd?= =?us-ascii?Q?8J9Fi/NrTD6Y8YJg5ujpad7oQeeBl2HWD0YTmPfBhod0RDnf1ygpGKYeCotu?= =?us-ascii?Q?HqFk7+twJc/ZWytFrPr+0CDPpmGmqJwvZfwKY97pFT9cohe9+2p30tS5TkNQ?= =?us-ascii?Q?lTi47bA2BLxjem9wfanXaEQ8E2nhyolUZTnD3wsrbJRqya4lWfTT/cmyyOJv?= =?us-ascii?Q?Ch4Qa/aSU5k8N+zKd5V2zkJRdOEsSD83Q2ajp/emPvFDt/sgr7tb1kajKtuR?= =?us-ascii?Q?fRt+kD/9O3m3I/DSRb1ZZmGpxdt0bd2RzxwgfvKokX8O6x28sUbRuBN+C3lV?= =?us-ascii?Q?V8+Lg7rsXjVvGd/HnJXSZoMpX4w/xTBrmYVdAib1KN7Pp43qynLzdrPm0HB0?= =?us-ascii?Q?v/53XAZ1H+LVkWzo6eJKMjyWPvHC2FlZa1ei7AzvZsCZamFf1qQtsr/DydHl?= =?us-ascii?Q?PSFP6Clzeb/rckf38aPVTn9E8AOif3vSXoNNwA3S46WmvjCTrn0KrlHk6KRZ?= =?us-ascii?Q?5CpIN2WVtvv6NM7qFHUoKnKOO8QYBbvl382ImEl9ORGGFMrW/PExlE/13Xhk?= =?us-ascii?Q?NDYixvZ0v5QrrSLamxXctaIpKDO4UFQs61aCPZVQEL7xC1Tu3VoGX3S4xzM3?= =?us-ascii?Q?NwloHg4EKOXM3YOM0K7yMZ5k7fvzKfmN+asWw1ocGDerK6vQ2o13fPyp3ghn?= =?us-ascii?Q?9+MwMLifhxptJPDKAI3igPqZ0JIctRmozSMTJBDo7XdZcKj38kK46WsWELu0?= =?us-ascii?Q?NwJhBOZ24YtM1gr1NcMGHKPt6b5MljNoX0z5WJtdpKl5g94p62en0FDhKsNb?= =?us-ascii?Q?lPrRs/VyC2rurIRBxDZezz4NpYVtFtKJb7iEGJ8LBzsD8Ppy5821d4yfiTDW?= =?us-ascii?Q?ZDkBvM/YJ5LSFfznUbup65Jsf5FoUd8+fowj+qdiwvSFQEmwOWVN4UPWN+XE?= =?us-ascii?Q?VzFS5XHqbvNACrayk1kDIANiXCWHhM3QREF17GlMIq82spsg6pUIiX7YvE6F?= =?us-ascii?Q?oBkpcbOwlQo2beDlQNDu/GJD57H/2l4EsLn89AucA2R/gU3nTeHYqc3HjtpH?= =?us-ascii?Q?A7B0oQEM2UFf/0lcSd1hAEg7HP7IsT0YVRWR6KCoPxEnSs7CXT4NkW8jeAN4?= =?us-ascii?Q?+91aO04VFKdB3oy2EYQxXoDkBAvv2R4NmVciRBGmJdtAppzoFcXqIRatgA2N?= =?us-ascii?Q?NXfPS3/sQBeWClj3C6BBmMvmHo+kshkN6SaF6qy8vlUPAAdV7tZ8pmecbAMq?= =?us-ascii?Q?hKMBL8Z20jk8xExOwBv5DZ6h6Ph7lGSkKUhDQHyy+7wUqnH12s+Rjn+U4jKj?= =?us-ascii?Q?34HgiZTf4B1ouoVQZ647+LG20TZOS8vaPm5UQRyO2BfZ8HQy4INRRCnj7qmE?= =?us-ascii?Q?6U0vxss8WPCHWTvothaHPbXCpje038pC+5vphl92?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e741222e-37a8-4b00-ac5c-08dac39c6c9f X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:03.2783 (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: NFAPtHnaSpwvF+tOUyqIxvfKInr77qwEvpWqNG8btEIcSCEr48jf9I5hSM5lcrlo3Zm1ZVe7xuo21wsLympAxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: 2bODpACHrIISw1HeC9Y_GM8FKDv5pdjP X-Proofpoint-GUID: 2bODpACHrIISw1HeC9Y_GM8FKDv5pdjP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=942 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 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, PDS_OTHER_BAD_TLD=2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140679117100005 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Update to support symbolic link when applicable - Warn user if a specific 9pfs operation is not supported hw/9pfs/9p-local.h | 1 + hw/9pfs/9p-local.c | 388 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 378 insertions(+), 11 deletions(-) diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index eb4f39ddc2..311067d9af 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -17,6 +17,7 @@ typedef struct { QemuFd_t mountfd; #ifdef CONFIG_WIN32 char *root_path; + DWORD block_size; #endif } LocalData; =20 diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 24e21141d5..20e3091cd7 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -1,5 +1,5 @@ /* - * 9p Posix callback + * 9p callback * * Copyright IBM, Corp. 2010 * @@ -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 =20 #ifndef XFS_SUPER_MAGIC #define XFS_SUPER_MAGIC 0x58465342 @@ -90,10 +94,12 @@ QemuFd_t local_open_nofollow(FsContext *fs_ctx, const c= har *path, int flags, return fd; } =20 +#ifndef CONFIG_WIN32 QemuFd_t local_opendir_nofollow(FsContext *fs_ctx, const char *path) { return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0); } +#endif =20 static void renameat_preserve_errno(QemuFd_t odirfd, const char *opath, QemuFd_t ndirfd, const char *npath) @@ -135,10 +141,20 @@ static FILE *local_fopenat(QemuFd_t dirfd, const char= *name, const char *mode) if (qemu_fd_invalid(fd)) { return NULL; } +#ifdef CONFIG_WIN32 + int _flags =3D mode[0] =3D=3D 'r' ? O_RDONLY : 0; + int _fd =3D _open_osfhandle((intptr_t)fd, _flags); + assert(_fd !=3D -1); + fp =3D fdopen(_fd, mode); + if (!fp) { + close(_fd); + } +#else fp =3D fdopen(fd, mode); if (!fp) { close(fd); } +#endif return fp; } =20 @@ -238,7 +254,7 @@ static int local_set_mapped_file_attrat(QemuFd_t dirfd,= const char *name, int ret; char buf[ATTR_MAX]; int uid =3D -1, gid =3D -1, mode =3D -1, rdev =3D -1; - QemuFd_t map_dirfd =3D QEMU_FD_INVALID, map_fd; + QemuFd_t map_dirfd =3D QEMU_FD_INVALID; bool is_root =3D !strcmp(name, "."); =20 if (is_root) { @@ -302,10 +318,12 @@ update_map_file: return -1; } =20 - map_fd =3D fileno(fp); +#ifndef CONFIG_WIN32 + QemuFd_t map_fd =3D fileno(fp); assert(!qemu_fd_invalid(map_fd)); ret =3D fchmod(map_fd, 0600); assert(ret =3D=3D 0); +#endif =20 if (credp->fc_uid !=3D -1) { uid =3D credp->fc_uid; @@ -337,6 +355,7 @@ update_map_file: return 0; } =20 +#ifndef CONFIG_WIN32 static int fchmodat_nofollow(QemuFd_t dirfd, const char *name, mode_t mode) { struct stat stbuf; @@ -399,6 +418,7 @@ static int fchmodat_nofollow(QemuFd_t dirfd, const char= *name, mode_t mode) close_preserve_errno(fd); return ret; } +#endif =20 static int local_set_xattrat(QemuFd_t dirfd, const char *path, FsCred *cre= dp) { @@ -439,6 +459,7 @@ static int local_set_xattrat(QemuFd_t dirfd, const char= *path, FsCred *credp) return 0; } =20 +#ifndef CONFIG_WIN32 static int local_set_cred_passthrough(FsContext *fs_ctx, QemuFd_t dirfd, const char *name, FsCred *credp) { @@ -455,6 +476,7 @@ static int local_set_cred_passthrough(FsContext *fs_ctx= , QemuFd_t dirfd, =20 return fchmodat_nofollow(dirfd, name, credp->fc_mode & 07777); } +#endif =20 static ssize_t local_readlink(FsContext *fs_ctx, V9fsPath *fs_path, char *buf, size_t bufsz) @@ -464,17 +486,33 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fs= Path *fs_path, if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE)) { QemuFd_t fd; + int _fd; =20 fd =3D local_open_nofollow(fs_ctx, fs_path->data, O_RDONLY, 0); if (qemu_fd_invalid(fd)) { return -1; } +#ifdef CONFIG_WIN32 + _fd =3D _open_osfhandle((intptr_t)fd, 0); +#else + _fd =3D fd; +#endif do { - tsize =3D read(fd, (void *)buf, bufsz); + tsize =3D read(_fd, (void *)buf, bufsz); } while (tsize =3D=3D -1 && errno =3D=3D EINTR); +#ifdef CONFIG_WIN32 + close(_fd); +#else close_preserve_errno(fd); +#endif } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + error_report_once("readlink is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + tsize =3D -1; +#else char *dirpath =3D g_path_get_dirname(fs_path->data); char *name =3D g_path_get_basename(fs_path->data); QemuFd_t dirfd; @@ -489,6 +527,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPa= th *fs_path, out: g_free(name); g_free(dirpath); +#endif } return tsize; } @@ -512,7 +551,13 @@ static int local_open(FsContext *ctx, V9fsPath *fs_pat= h, if (qemu_fd_invalid(fd)) { return -1; } +#ifdef CONFIG_WIN32 + int _fd =3D _open_osfhandle((intptr_t)fd, 0); + assert(_fd !=3D -1); + fs->fd =3D _fd; +#else fs->fd =3D fd; +#endif return fs->fd; } =20 @@ -527,9 +572,24 @@ static int local_opendir(FsContext *ctx, return -1; } =20 +#ifdef CONFIG_WIN32 + char *full_file_name =3D get_full_path_win32(dirfd, NULL); + if (full_file_name =3D=3D NULL) { + CloseHandle(dirfd); + return -1; + } + stream =3D opendir(full_file_name); + g_free(full_file_name); +#else stream =3D fdopendir(dirfd); +#endif + if (!stream) { +#ifdef CONFIG_WIN32 + CloseHandle(dirfd); +#else close(dirfd); +#endif return -1; } fs->dir.stream =3D stream; @@ -572,13 +632,17 @@ again: #endif =20 if (ctx->export_flags & V9FS_SM_MAPPED) { +#ifndef CONFIG_WIN32 entry->d_type =3D 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 =3D DT_UNKNOWN; +#endif } =20 return entry; @@ -586,7 +650,94 @@ again: =20 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] =3D { 0 }; + off_t direntoff[3] =3D { -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 backwa= rd. + * + * 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 forwar= d. + */ + + direntoff[0] =3D telldir(fs->dir.stream); + + /* do nothing if current offset is 0 or EOF */ + if (direntoff[0] =3D=3D 0 || direntoff[0] < 0) { + seekdir(fs->dir.stream, off); + return; + } + + d_name[0] =3D g_malloc0(sizeof(entry->d_name) * 3); + d_name[1] =3D d_name[0] + sizeof(entry->d_name); + d_name[2] =3D d_name[1] + sizeof(entry->d_name); + + /* save 3 nearest entries and offsets */ + for (i =3D 0; i < 3; i++) { + entry =3D &fs->dir.stream->dd_dir; + + memcpy(d_name[i], entry->d_name, entry->d_namlen); + namelen[i] =3D strlen(d_name[i]) + 1; + + direntoff[i] =3D telldir(fs->dir.stream); + + entry =3D readdir(fs->dir.stream); + if (entry =3D=3D NULL) { + break; + } + } + + /* look up saved entries again */ + for (i =3D 0; i < 3 && direntoff[i] !=3D -1; i++) { + rewinddir(fs->dir.stream); + count =3D 0; + while ((findentry =3D readdir(fs->dir.stream)) !=3D NULL) { + count++; + + if (memcmp(findentry->d_name, d_name[i], namelen[i]) =3D=3D 0)= { + if (count + i =3D=3D direntoff[i]) { + seekdir(fs->dir.stream, off); + goto out; + } else if (count + i < direntoff[i]) { + off =3D off - (direntoff[i] - count) - i; + if (off <=3D 0) { + off =3D 0; + } + seekdir(fs->dir.stream, off); + goto out; + } else { + off =3D off + (count - direntoff[i]) - i; + seekdir(fs->dir.stream, off); + goto out; + } + } + } + } + + /* cannot get anything, seek backward */ + off =3D off - 1; seekdir(fs->dir.stream, off); + +out: + g_free(d_name[0]); + return; +#endif } =20 static ssize_t local_preadv(FsContext *ctx, V9fsFidOpenState *fs, @@ -652,7 +803,14 @@ static int local_chmod(FsContext *fs_ctx, V9fsPath *fs= _path, FsCred *credp) ret =3D 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 =3D ENOTSUP; + error_report_once("chmod is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + ret =3D -1; +#else ret =3D fchmodat_nofollow(dirfd, name, credp->fc_mode); +#endif } close_preserve_errno(dirfd); =20 @@ -696,6 +854,12 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *di= r_path, } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + error_report_once("mknod is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + goto out; +#else err =3D qemu_mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); if (err =3D=3D -1) { goto out; @@ -704,6 +868,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir= _path, if (err =3D=3D -1) { goto err_end; } +#endif } goto out; =20 @@ -753,10 +918,12 @@ static int local_mkdir(FsContext *fs_ctx, V9fsPath *d= ir_path, if (err =3D=3D -1) { goto out; } +#ifndef CONFIG_WIN32 err =3D local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err =3D=3D -1) { goto err_end; } +#endif } goto out; =20 @@ -773,7 +940,12 @@ static int local_fstat(FsContext *fs_ctx, int fid_type, int err, fd; =20 if (fid_type =3D=3D P9_FID_DIR) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + return -1; /* Windows do not allow opening a directory by open() = */ +#else fd =3D dirfd(fs->dir.stream); +#endif } else { fd =3D fs->fd; } @@ -825,10 +997,10 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *d= ir_path, const char *name, return -1; } =20 - /* - * Mark all the open to not follow symlinks - */ +#ifndef CONFIG_WIN32 + /* Mark all the open to not follow symlinks */ flags |=3D O_NOFOLLOW; +#endif =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); if (qemu_fd_invalid(dirfd)) { @@ -858,13 +1030,22 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *= dir_path, const char *name, if (qemu_fd_invalid(fd)) { goto out; } +#ifndef CONFIG_WIN32 err =3D local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err =3D=3D -1) { goto err_end; } +#endif } +#ifdef CONFIG_WIN32 + int _fd =3D _open_osfhandle((intptr_t)fd, 0); + assert(_fd !=3D -1); + err =3D _fd; + fs->fd =3D _fd; +#else err =3D fd; fs->fd =3D fd; +#endif goto out; =20 err_end: @@ -898,6 +1079,7 @@ static int local_symlink(FsContext *fs_ctx, const char= *oldpath, if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { QemuFd_t fd; + int _fd; ssize_t oldpath_size, write_size; =20 fd =3D openat_file(dirfd, name, O_CREAT | O_EXCL | O_RDWR, @@ -905,12 +1087,21 @@ static int local_symlink(FsContext *fs_ctx, const ch= ar *oldpath, if (qemu_fd_invalid(fd)) { goto out; } +#ifdef CONFIG_WIN32 + _fd =3D _open_osfhandle((intptr_t)fd, 0); +#else + _fd =3D fd; +#endif /* Write the oldpath (target) to the file. */ oldpath_size =3D strlen(oldpath); do { - write_size =3D write(fd, (void *)oldpath, oldpath_size); + write_size =3D write(_fd, (void *)oldpath, oldpath_size); } while (write_size =3D=3D -1 && errno =3D=3D EINTR); +#ifdef CONFIG_WIN32 + close(_fd); +#else close_preserve_errno(fd); +#endif =20 if (write_size !=3D oldpath_size) { goto err_end; @@ -928,6 +1119,21 @@ static int local_symlink(FsContext *fs_ctx, const cha= r *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 =3D ENOTSUP; + error_report_once("symlink is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + goto out; +#else err =3D symlinkat(oldpath, dirfd, name); if (err) { goto out; @@ -945,6 +1151,7 @@ static int local_symlink(FsContext *fs_ctx, const char= *oldpath, err =3D 0; } } +#endif } goto out; =20 @@ -958,6 +1165,11 @@ out: static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + error_report_once("link is not available on Windows host"); + return -1; +#else char *odirpath =3D g_path_get_dirname(oldpath->data); char *oname =3D g_path_get_basename(oldpath->data); int ret =3D -1; @@ -1027,6 +1239,7 @@ out: g_free(oname); g_free(odirpath); return ret; +#endif } =20 static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size) @@ -1038,7 +1251,13 @@ static int local_truncate(FsContext *ctx, V9fsPath *= fs_path, off_t size) if (qemu_fd_invalid(fd)) { return -1; } +#ifdef CONFIG_WIN32 + int _fd =3D _open_osfhandle((intptr_t)fd, 0); + assert(_fd !=3D -1); + ret =3D ftruncate(_fd, size); +#else ret =3D ftruncate(fd, size); +#endif close_preserve_errno(fd); return ret; } @@ -1058,8 +1277,15 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *= fs_path, FsCred *credp) if ((credp->fc_uid =3D=3D -1 && credp->fc_gid =3D=3D -1) || (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || (fs_ctx->export_flags & V9FS_SM_NONE)) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + error_report_once("chown is not available on Windows host when" + "security_model is \"none\" or \"passthrough\""); + ret =3D -1; +#else ret =3D fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, AT_SYMLINK_NOFOLLOW); +#endif } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) { ret =3D local_set_xattrat(dirfd, name, credp); } else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { @@ -1172,6 +1398,12 @@ out: static int local_fsync(FsContext *ctx, int fid_type, V9fsFidOpenState *fs, int datasync) { +#ifdef CONFIG_WIN32 + if (fid_type !=3D P9_FID_DIR) { + return _commit(fs->fd); + } + return 0; +#else int fd; =20 if (fid_type =3D=3D P9_FID_DIR) { @@ -1185,12 +1417,14 @@ static int local_fsync(FsContext *ctx, int fid_type, } else { return fsync(fd); } +#endif } =20 static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *st= buf) { - QemuFd_t fd; int ret; +#ifndef CONFIG_WIN32 + QemuFd_t fd; =20 fd =3D local_open_nofollow(s, fs_path->data, O_RDONLY, 0); if (qemu_fd_invalid(fd)) { @@ -1198,39 +1432,65 @@ static int local_statfs(FsContext *s, V9fsPath *fs_= path, struct statfs *stbuf) } ret =3D fstatfs(fd, stbuf); close_preserve_errno(fd); +#else + LocalData *data =3D (LocalData *)s->private; + + ret =3D statfs_win32(data->root_path, stbuf); + if (ret =3D=3D 0) { + /* use context address as fsid */ + memcpy(&stbuf->f_fsid, s, sizeof(intptr_t)); + } +#endif + return ret; } =20 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 =3D fs_path->data; =20 return v9fs_get_xattr(ctx, path, name, value, size); +#endif } =20 static ssize_t local_llistxattr(FsContext *ctx, V9fsPath *fs_path, void *value, size_t size) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path =3D fs_path->data; =20 return v9fs_list_xattr(ctx, path, value, size); +#endif } =20 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 =3D fs_path->data; =20 return v9fs_set_xattr(ctx, path, name, value, size, flags); +#endif } =20 static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path, const char *name) { +#ifdef CONFIG_WIN32 + return -1; +#else char *path =3D fs_path->data; =20 return v9fs_remove_xattr(ctx, path, name); +#endif } =20 static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, @@ -1393,6 +1653,7 @@ static int local_unlinkat(FsContext *ctx, V9fsPath *d= ir, return ret; } =20 +#ifndef CONFIG_WIN32 #ifdef FS_IOC_GETVERSION static int local_ioc_getversion(FsContext *ctx, V9fsPath *path, mode_t st_mode, uint64_t *st_gen) @@ -1442,11 +1703,88 @@ static int local_ioc_getversion_init(FsContext *ctx= , LocalData *data, Error **er #endif return 0; } +#endif =20 -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 =3D g_malloc(sizeof(*data)); + HANDLE mountfd; + char *root_path; + DWORD SectorsPerCluster; + DWORD BytesPerSector; + DWORD NumberOfFreeClusters; + DWORD TotalNumberOfClusters; + char disk_root[4] =3D { 0 }; + + mountfd =3D CreateFile(ctx->fs_root, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_D= ELETE, + NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (mountfd =3D=3D INVALID_HANDLE_VALUE) { + error_setg_errno(errp, EINVAL, "cannot open %s", ctx->fs_root); + return -1; + } + + if ((ctx->export_flags & V9FS_SM_MAPPED) !=3D 0) { + wchar_t fs_name[MAX_PATH + 1] =3D {0}; + wchar_t ntfs_name[5] =3D {'N', 'T', 'F', 'S'}; =20 + /* Get file system type name */ + if (GetVolumeInformationByHandleW(mountfd, NULL, 0, NULL, NULL, NU= LL, + fs_name, MAX_PATH + 1) =3D=3D 0)= { + error_setg_errno(errp, EINVAL, + "cannot get file system information"); + CloseHandle(mountfd); + return -1; + } + + /* + * security_model=3Dmapped(-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) !=3D 0) { + CloseHandle(mountfd); + error_setg_errno(errp, EINVAL, "require NTFS file system"); + return -1; + } + } + + root_path =3D get_full_path_win32(mountfd, NULL); + if (root_path =3D=3D NULL) { + CloseHandle(mountfd); + 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) = =3D=3D 0) { + CloseHandle(mountfd); + 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 =3D mountfd; + data->root_path =3D root_path; + data->block_size =3D SectorsPerCluster * BytesPerSector; + + return 0; +} +#endif + +static int local_init(FsContext *ctx, Error **errp) +{ + LocalData *data =3D g_malloc0(sizeof(*data)); +#ifndef CONFIG_WIN32 data->mountfd =3D open(ctx->fs_root, O_DIRECTORY | O_RDONLY); if (qemu_fd_invalid(data->mountfd)) { error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); @@ -1457,7 +1795,17 @@ static int local_init(FsContext *ctx, Error **errp) close(data->mountfd); goto err; } +#else + if (init_win32_root_directory(ctx, data, errp) !=3D 0) { + goto err; + } =20 + /* + * Always enable inode remap since Windows file system does not + * have inode number. + */ + ctx->export_flags |=3D V9FS_REMAP_INODES; +#endif if (ctx->export_flags & V9FS_SM_PASSTHROUGH) { ctx->xops =3D passthrough_xattr_ops; } else if (ctx->export_flags & V9FS_SM_MAPPED) { @@ -1477,6 +1825,15 @@ static int local_init(FsContext *ctx, Error **errp) return 0; =20 err: +#ifdef CONFIG_WIN32 + if (data->root_path !=3D NULL) { + g_free(data->root_path); + } + + if (data->mountfd !=3D 0 && data->mountfd !=3D INVALID_HANDLE_VALUE) { + CloseHandle(data->mountfd); + } +#endif g_free(data); return -1; } @@ -1488,8 +1845,17 @@ static void local_cleanup(FsContext *ctx) if (!data) { return; } +#ifdef CONFIG_WIN32 + if (data->root_path !=3D NULL) { + g_free(data->root_path); + } =20 + if (data->mountfd !=3D 0 && data->mountfd !=3D INVALID_HANDLE_VALUE) { + CloseHandle(data->mountfd); + } +#else close(data->mountfd); +#endif g_free(data); } =20 --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140672; cv=pass; d=zohomail.com; s=zohoarc; b=gObr681mcW4GLShbzhWCpEO6ghde0BW4vq0S0uL8e7u73cjs2YHy/KumbHK4Bayb5B8txTtJ/p8xgaj2+G7CyitYdNitpwGA79bqNqoqGGQpJfdTSR7FAgJhJZKwScaeOSfPBMJ4QQhfyJEeqwkWQaAUgqiU7+RqrQdeoKQ2PD0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140672; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=z3rAyMTrdhdHyeeGQtwrC7054GNebIFHAns0B5YVblA=; b=Bf0vLCEyT/QAlQ2+64h/ArwQ+zZkkvoxjL6MZhvrp7pzKyJVwDIPqvvQAxKhgdrhDsBrd9QFD+AvdFrJv9qcJgHPnjgrzLTwrCsQ/4ZM0LSzt2om+Eme+wcj569jUDFBQpADVswYpykyhGC7f56gyDaPg9DF4hXwAtPjibGEpus= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140672255493.22878736129417; Thu, 10 Nov 2022 20:24:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZe-0000Z9-LX; Thu, 10 Nov 2022 23:23:26 -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 1otLZb-0000Wr-Gz for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:23 -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 1otLZY-0001Zk-9b for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 2AB4N5DN004957; Thu, 10 Nov 2022 20:23:06 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9m3-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:06 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:05 +0000 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=z3rAyMTrdhdHyeeGQtwrC7054GNebIFHAns0B5YVblA=; b=G+FlcXP8QJF3MmYyeA807LETcQpZgRV5+x5opYVeiKvohKos7ITGhHs/3+LH5UCy7Rvo utmX1yyKLp7Ys/IhFSIMjb2t3kG6ZE80a+DoFV2DtVG7AWXec+Hmr3EzBls6OWAYINQk 8BGKf4aBoS+9W7qaTh1QgubopWnMFBhdJd1MGXfYfGwZWsL0ftKfvcvWfWt8wNORdGgu X3NDgUL8DB6rPTUYz9225HcCT2uvx0pe7hQzD41G7qP91Cv5l6NvZ0xo1XzYs3/MU/hp fMS1Z8YC6iyvcIn3euLWSM6PMtH2kTt0qTfHN1tnoTH8HecZDC8x5LBrtsp1dkM8urXk Zw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ckNkBPhuP4oLGLQ5r26pm91umSaocivAg5J9QetWyz9+Fa2WW3dnbN4JHuCdY2KpFdxXhashUqtm+Lcjok73hza38ZOE7d/F1EFjDO7KB5PzC94MrF/MIOrkFC9k5z6c6TXHneMDnLZR9b+FnYRwv7TqZirz2KcGv91q90EmwDo0/pM6GK/ceXrmY1J3W4CrnVQU4AHP82YAdVZ14YPcUudn9iKr1Y+4qy7I4tgFmt4a0qziuOndD0tLdiLW9pgMhqFI7PQUR/OC4aBNdRxxMygjLST1mvMPNohT6su3faLJTZUUYqZuPY2zb162fo5evZF/mr729NHvbOlna/xv1g== 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=z3rAyMTrdhdHyeeGQtwrC7054GNebIFHAns0B5YVblA=; b=Ag6Rv4muWedItukdE1rwH9C510/sBbXMEPtQWSqj/DtUwsCUaD0Fd8CdMFBJaGRVVv1vPbgq4QcfxpXmeGTiJyR1pV27hI8J2Dqv1UwwH+n13CoTZAJQCOcycIRX1zLOVHGfMf/F2ce7uRcTV6fQUJcRGCzrOvvWCigFJI3Lzv2NswwEqLjklFhYT68RsnZYVcmlkvC9iFQRvLL9+E21gxPn+sEq0h71gLpPYMIurNH65V7uInCt8lCLh7Nd1A0c7sz8Fjq6tEb75QeM3WU9y/1lz6AGnPUgDGlPs3A6DhOz624m8qRIjAKKhG0SyCJknhuR4XLJlqcTzFkhecbCzg== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 09/19] hw/9pfs: Support getting current directory offset for Windows Date: Fri, 11 Nov 2022 12:22:15 +0800 Message-Id: <20221111042225.1115931-10-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: d81e8cf0-4fd2-478d-0528-08dac39c6dd1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HbwEu2biGRf+B/fWSbtQ/ZAPQGNxa+sb/eQb5h3hIh6rAHlxJ346Hm/cMrVE3aBf7wPLvfQooUMhGtSkmE3346Nd1ztGZOtkXy/odh3csA2Arzx8i0M7MhvZNxjqI3rML966NfHv0yQgU0koRQPNqKq7oYljquzBzDSJ/tDvjAJmV6+hV9tHd4RqEEw3BbE9CE52H9jRUkJGy5IIPMhvkWdfZUBWTL6mpHz9Ap8vpb0sZ81uDSv/tDKZC9kVcwp5gBvQywZORH3Dk8lfUYLtoVJaX97lcU7gYUfmOkqw6No6hSqoWEzPorWuSd5GaM1+z0GkUnDiOvTopcg8QA+ZUlhSoTB0Z78HQljmySTBX3aMnHeHE9YLF2zooiaw+0fm/9ZamPtlTyzEROtQ24XanXEJw77B4K6phey4sM4NIm8y7qPdQ0T8yOBrhsKqYHJIe0t9/ZrEelsKNLQktLFaQyC97j1O/DDTChxpLinlERHCnZ9mEjDfu7/09QPpQrrSUg4q/Ss7znLTnWb6TzLA23dUZaHU6it40QpfJDkvmCrKdRIAtwIcPHl4Ah6HYoY033lVzX+GXv0KoxbwznMdfiPrIUv+RpN9EdI4Sqwic5EksDX6i0x36a/Z1rmlL5S0Hj35Jiyqs7InpukGZP37TPAcpFmiiQtMD3s4lrctC37WaVdK9oDJ4x+xf2w603YCwee9NwNfv3Yt/dvcZeE/e5QWOtxNF6fOy9q1nu+c3ozxQhU5x7gYhNR5ozp+xqsDciXss19eB1EKkMXTT+TOBw== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NXaXoHG/AfTMfyTXqc7yRvvRl6mLfxxi/HY9DECg0DUh92TYYPGTFnIyFErI?= =?us-ascii?Q?IoBkw+pkFG+zowhHn+EP/znB2rJgrezUliQf8zYGhvzGmqq0ivxGMwRIu4xA?= =?us-ascii?Q?HTRz3fjTj7shDN9S62rU1aHEHJw1B4wcFUje5qq9k78SYBK0G+LPBHu+g5UT?= =?us-ascii?Q?hkdhqUonUA6mEGbOOrHnBnPBDikuE6e10ACX53NmSu1mcG/UqcJLaZoEjEOz?= =?us-ascii?Q?FSkX2Z6l0qbPrb3wdBDxKnPBLY+mhLawndJ5QCjAjyhp+O6EpjwQ2VGkuVkf?= =?us-ascii?Q?SJUJKXqcosEvB8365z+/lo3df6F35+AfJsDhdQZfEBrR88ac1Bzpc4KlAT3g?= =?us-ascii?Q?4WtQR0VhkRz1ahMACOiJbg8tJ5hE5SLcF6gkCTqpiK1MxEhkQfToncxYdeNW?= =?us-ascii?Q?MFaVQsfM1SFlMawgzgKWEvUzACUJIvNbMyOGtTdIMNUhB68Ua/mcJg/GZ32i?= =?us-ascii?Q?R6dO9pA/uVjZARsJQDiFfQzSuI6Traq9C+Z1G7RWUWtgUrSUUI33SzotO21i?= =?us-ascii?Q?QQoSM31L8imQP94Q2cqUioAnv5qzbiFxCcbJqMmSu/xzbV2JRax89YEt6uP1?= =?us-ascii?Q?rY6SR0+wrPxkhFdo4qo+/RuTqEf2d0bWq6JH5QFWj7k68kpEm4eWn6Ehh4gC?= =?us-ascii?Q?GVRFMewEb/916Mx95r0iXDvuZnqOuDDSMDl/hq0MD71UKClkZWCRcPVRTbko?= =?us-ascii?Q?/tgGdMTYATmWZoCC9kUDXByDuc4hmTIFzI31nAtKm+MoB1G5bzyACTYHcpfM?= =?us-ascii?Q?nCMBpz9WfYARDUb0TEAKZdHRq8S4b1Z4Tcz5KWB08tDYe1vaMh/4GflgIO71?= =?us-ascii?Q?7c1rBS+9JwHHShV5eFv4NsF743QQPBb+a3m9yv++kwgHJd9TNDIXGJLa4g22?= =?us-ascii?Q?4De0GgNoBoQipTlLYBkh7v0zk6bptJt/8g6zkx+mCKN2y6kMgavk7w41jmyb?= =?us-ascii?Q?gKh6nciNM4FaDsCBtn+y39RqIneTR/uHoQGGGKoO2gDmKYr9YTIeLV6XLToa?= =?us-ascii?Q?f08CRfw7Ou2u7XgoNraO2y73XlKosU1K041wPK3HbSAeT46TEeOhaZSyvfj0?= =?us-ascii?Q?Trg5MSwcq9ZlKVAw4S38MpjOn54ph81gczU2L0kiAdvi8OvSoeKl4+3txf+V?= =?us-ascii?Q?j9tfTTwhaGARcpCX9cjvhm1G16vbK9AZw2SPNSaxyAGqxTaebLtNfrkRnrc/?= =?us-ascii?Q?OAZ/QiyC3570eKsXCRprdxTwLJ92DUtaGVdGsZjG+zG5ysMiT2kQPOjdagMP?= =?us-ascii?Q?QRkYxmxU2PYfea5DhY7S5jng3OJ2twNMMatusWoKGGq7Q/Dciw6UXWKyHrcl?= =?us-ascii?Q?tirU4x4RpBTfq3GLWfFMlN9vWEOFluHxd6AVfKTb6KUEYWF8zZaUrXKMr+qd?= =?us-ascii?Q?OfqQoRsG11kV4VWf++LiTqW0yye73KoV5WzJ5mOgjhSohjuoyPFbM5tsLtX1?= =?us-ascii?Q?vLfBAJj3tAJ+C/Gf57paM8e+q0eqIMVujztnnVTbwRjljdTweSi6BmOQ8TQ6?= =?us-ascii?Q?S2IeBVhb6LgkLVz4jwWOF+rtqoz24OdV+fDsVEfmH2qR8uncdK2OrPHAjlHW?= =?us-ascii?Q?MRwtqbZReXDPCi0dBW1T2cm193lMcp9B77gx1G9+?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: d81e8cf0-4fd2-478d-0528-08dac39c6dd1 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:05.2638 (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: ow5INxa3EGC10b7j/W9Pnyb09ZM07AyJG5/EWDXemDRAD/Tdb8sEXoJ4oGQxniuCI2MQ6l4BEqSVj4J+/oYhqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: cfmogL9k35A_b86nCjOWnuKetLx9D8lP X-Proofpoint-GUID: cfmogL9k35A_b86nCjOWnuKetLx9D8lP X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=886 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140673064100003 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Use qemu_dirent_off() directly instead of coroutine 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 5fb854bf61..892465b392 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -129,6 +129,7 @@ int statfs_win32(const char *root_path, struct statfs *= stbuf); QemuFd_t openat_dir(QemuFd_t dirfd, const char *name); QemuFd_t openat_file(QemuFd_t dirfd, const char *name, int flags, mode_t mode); +off_t qemu_dirent_off_win32(void *s, void *fs); #endif =20 static inline void close_preserve_errno(QemuFd_t fd) @@ -207,12 +208,16 @@ ssize_t fremovexattrat_nofollow(QemuFd_t 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 } =20 diff --git a/hw/9pfs/9p-util-win32.c b/hw/9pfs/9p-util-win32.c index ed3d519937..a8b8b8c832 100644 --- a/hw/9pfs/9p-util-win32.c +++ b/hw/9pfs/9p-util-win32.c @@ -932,3 +932,10 @@ int qemu_mknodat(QemuFd_t dirfd, const char *filename,= mode_t mode, dev_t dev) errno =3D ENOTSUP; return -1; } + +off_t qemu_dirent_off_win32(void *s, void *fs) +{ + V9fsState *v9fs =3D 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(V9f= sPDU *pdu, count +=3D len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); - saved_dir_pos =3D qemu_dirent_off(dent); + saved_dir_pos =3D qemu_dirent_off(dent, pdu->s, &fidp->fs); } =20 v9fs_readdir_unlock(&fidp->fs.dir); @@ -2537,7 +2537,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, qid.version =3D 0; } =20 - off =3D qemu_dirent_off(dent); + off =3D qemu_dirent_off(dent, pdu->s, &fidp->fs); v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); =20 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, } =20 size +=3D len; - saved_dir_pos =3D qemu_dirent_off(dent); + saved_dir_pos =3D qemu_dirent_off(dent, s, &fidp->fs); } =20 /* restore (last) saved position */ --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140775; cv=pass; d=zohomail.com; s=zohoarc; b=TUnepD0p3JaoMyvSs7ecEWmnCdaUkEzEP0DG05LNsru9DYKH7qRjEscj9zyv751m51KAC/3GdgyRgr7Yo6bselckQDUfimUGnIsdCOyCHh60hXOkbqv2yf26TAOCD+qSFYpj+ywUEakDeI+T47s1Y1r8oHaWLIZxe9uiGPNWMMc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140775; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HZO+0yGtG3Rr66MSooBmPWDGjGuHB1C3qKMoQtSVztA=; b=bQz3m5CLXAd4geF0EkuZqzKpJffvjXpUPdYMSPSiKnVbuW5BdU85xox4DpETNu1rEaG+Y8YtJqifeuiIYKkX+2+WU4r1TKr2mkeuwx/bgy7OUdfgXNRjIznUGbKpfztsto81sQRoghsyMAlvZOxcFxxWC9IcufWN1OrEFbifhfA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140775579181.40039151830285; Thu, 10 Nov 2022 20:26:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZc-0000Y3-PO; Thu, 10 Nov 2022 23:23:24 -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 1otLZb-0000X3-Mi for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:23 -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 1otLZZ-0001aT-4E for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23: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 2AB4N9pt004974; Thu, 10 Nov 2022 20:23:09 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9m7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:08 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:07 +0000 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=HZO+0yGtG3Rr66MSooBmPWDGjGuHB1C3qKMoQtSVztA=; b=CAmiwHPi3kWMMvkxtyQT0j3YmtYsCb3/DVyCdSFobkPEmn5MdrJyAHDy6XsRpxQMc9eI LeLBWsf7nYzGZpcJPzwDXGLE3BepaUjG1HH1zZF4ERVL5J2dSxUkvVU9Ulj6uEu6ZakW wCbCCMgPtu1VwxDDDDk9hzCQOC4lxp8jO3DnGHR/mhBj3U8P5s7ezF6SVdGF+zPxQFrj Y51gnrQn40Z8fKnQuYvZVH/fXaGxCEBlt55pY7Urah/Tk7JWpw1Kdww2pu2vBsXLoCnv r8pUXtDT1eFsEEUyDO+alyPkAzeLs4aeocOOGgAtvKLh0ZY8f6oQRpbOtwJWeqn69gx2 Og== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C0bJUI1zmPF0mCpgGWRSKhNjixIJAW7qYeOfUT5s+fCvqt3oDF7dbOt3Yg5eAyvGv39gk2vXCZempUINKEuY2oKJIvaYihfwsaNvjdhoKQjibuMDfvZKLY1obpsBXqEaNnvn6kyc6RwwrhW/92f87RGPnus4x/moxJ19fT5p5wPGlQg9tRqxYY3bdBcvhT3z4SKScTxaKF4DTKrqtjCEUMQ4vJdjAzTLDqJk0xraU5SHk3Wabhicxxs2OwGl8qqo4+C3mmmMsRmQRjO7R9I+FtJk5vPWg/QX2XeQ98Pf5tki8Os7IWXeDqS/YqAZFMQ2k/2Bc/BE+NNieGw30X6adA== 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=HZO+0yGtG3Rr66MSooBmPWDGjGuHB1C3qKMoQtSVztA=; b=J+YSTlWdf1Jw9IERNk39Jptg4pJfxuwEERrgLAZfwHUFrwgDsoaBi8gcNizMDL8EHEX8zIQ7qMd9AAmuW5VQEhIv8Slx+XOp3wMA/mg8rTtrHHaQghDA1BNtJLeohrmCoblyPqXeiV7GPxdaqJw0m/Pcf9eX/bhGXC9Tk8tEIoOVZ/PY3UOOODdx3egO2Zara/dC2p3cotu8MIhFM8anwLBafGqh7MFXlkrWa4qkp/JnBSrelWb0UVY9ETp5MdPFM0xf15de8GwSaKwxwcjheptv3czDOTtY+4qyU35VVsK/8W2QtT36lWZSuRdr4looqR5/b1e8u+b4SKcG7LK/cA== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 10/19] hw/9pfs: Add a helper qemu_stat_rdev() Date: Fri, 11 Nov 2022 12:22:16 +0800 Message-Id: <20221111042225.1115931-11-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: cd8291a2-b08e-404c-cc4e-08dac39c6eff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: weqdMuaU4rLTWxxIcFnxNV8I7749zyYQTOidXiq6jiZV08ydJikYMhJJ0AEC7XDGWA7BHMJ3bCRcxHRz/V9Wz8w8MeKSlC0HfN3MALK6ro3wuTQ6Sx7JIief+9rAAGU9NOen5wemEitoojuWFt4gMt9WS5okijLKZi+aWyux5FMEpAlxF0aQthcGB5xgX1yccBmY6yNyMsHMsk1ivkaXYVOq+jYAl2j3iAUGPmfvlbVIBM3tKK6/aLX8Z+t6gGhgH7uRcpHqCIhfVLb+jt2/+AD+V/3JS9vfGedZ8AIDfHDg+IXeRihGhoWSZ/1vZISB4X/OOfbKfmwSPORJ5KTEAy5O0ejnhCEsCdH6zI3NpKP4iUm9wq+uLfGOg82BrKvErhl17Fg1+tYUmTIP7aGPe/gxigRA9JRmsXH5COKxBh6SpaPK7sXvDI7d/x/Fk4Mhc37PGrGE4uZMNE8K35o+LyYBV3IxKIfIi1hX4bhl5KaKcM183zVSoQqqfnYzfidLQFqwK5hKbjH8DbHKqtsfs6LgJh8VL3UnTasvqeAyM0wEv8CoUHWoZoPgBdEi3iSnVbyWNMqpK+G5kESd0Pxmz4Iqt+iAreodJhkq4VIHQiaO2/EyOu4wW7qKdOoSiiWiaGyOMdw7yWsoFqc0vQTId+zSUWYoqiNN9xxg9TYuErrF5nbhfLg7DsgoKvZhJ9p4ZcFiMMlhBP14tNBgiZGkEf7h2OM/68PIJt0bTZj1tosdB4sSQ3h5TQX6aAB+MT4kGBr7XNm+Hlezrilcevh+0Q== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?RJcoGYHiHzlqo3r+IZyGZ1GPCZOMf9KtwxMYltFAkJZC1nBLLxG7T0m5ktiU?= =?us-ascii?Q?AZJQ3OXcNMNS/cBqtyoO7BUvzzzelJ9Hrp/s00OgqUH0V3dwTPoxrpBCIBK8?= =?us-ascii?Q?9MucGZyCL+VSji2Xm/Tr/hCeoR2lhcTeQA9Kbl52L6p8oHKK7EeUnhPb2cNb?= =?us-ascii?Q?PJTqGneNtwm0iw1HZ5hUmkmjRRYNnmdtBhMT4ikv14DlMBv5WanhpX6DxejP?= =?us-ascii?Q?JNXiMO+z2pKcUexYyLcDU2vpwdE8s5s0i5G9qON2sAxVrI+s+jZWYHXk+NAL?= =?us-ascii?Q?GH7WiJopP2nJtD+EzqZwmL8eHAuVbO4hz2/a56z/S28sYg6sOgpPbwQRhpvG?= =?us-ascii?Q?3bXZKJOxfyLhTK4ADKEL0f6I/hcQD3nn9LW6nt56wYB4SdbJDikGPclLIAXW?= =?us-ascii?Q?KktS5WVuNLvU8A1kN5X9qEH9hpuId4ryuoOP7nQetXFJXW9kSpraONdodYn3?= =?us-ascii?Q?ayMnKWwj0HLIjR1vbQAzS3hbW4laUb1SdnJMzq0jZCTWWjBDPlcH6Ms9g13U?= =?us-ascii?Q?H0U7peh7FYg1vSFTwc9wUIIRDnHk0xQUMvFCBNdhbGXpOqycvE5FmnYJuIuy?= =?us-ascii?Q?45eXnQqWiJOkidx6exOhHnpF7Z6z6G3umACqMcIGfsKP5wtbzMyi0U5U368d?= =?us-ascii?Q?BWQZjMUSVnmz1uRs8HeceWqjoY8uQnjh5Hg60L91invK9ANxzq/ZKgdAf5mI?= =?us-ascii?Q?fV/P7EHZniuRaa+PvNNGkMrK9sOmOvhcO46uZewd3Q6AC5zIi5ptzHsd34/b?= =?us-ascii?Q?Mcy9SCKKpOpoN7oIgt34iZJmBbqWO+gF154PMmFblXMKtTCpT+UW7MYi7tVC?= =?us-ascii?Q?M//IQoP/TQz1857PaUX4YzXENHYh5D4AYP/PzMicDQbvospuqLXvikw/wTTR?= =?us-ascii?Q?H3YEZlP6lcJPO93sSnPmeOtYMC03GL13gkOT+OMLz0Ik1IcsPTTtGd197B8p?= =?us-ascii?Q?1BIL+Ze8ifjdhjAg0gVo7eCSvD18kWR85j+LPDXHY91KBWkUHVo8HLrgP3d9?= =?us-ascii?Q?QRLXzHDbEQnczS7F5uN8bawjv9OywHtSGtwOFl6yIhweH50AmwR3kE5f5NKK?= =?us-ascii?Q?JOCJ2ndaVME6LpR1N28QFIgoWB4ntY4Nvj2+SEhWyDc3dQa5G8HzS4+EubGb?= =?us-ascii?Q?fixHwcf/vbe4GFTDvIb+tBfupD7SbVpBi5JV/piwCMYsabNoqsqZJ1p4wSp+?= =?us-ascii?Q?fR2iv7NGIwkisgXJd98T2wrOx9ZZ1wCuBsMQaOzzKbvybQDErXmF8D5NRcPJ?= =?us-ascii?Q?kEX1URAXe72AbEA6nlVLafjrWyF9U8uBIDotDN9l854dQ/HjgVE6EhAV2Ahn?= =?us-ascii?Q?M+cQ11aGecQ9kbygCglkWiMsvnqmLAKvdYWR2OrYOXetE1rsuoqSTM3xjsvf?= =?us-ascii?Q?sAXh3dCEEviNFJTRa/zsdtjb39IokG0jF1Z92ZHDjkuEYi6oxkr9VxkmRh+0?= =?us-ascii?Q?5THEviJckunX06yAaQ3ui0lI+qDnijjvJ4NNLB+i8E+9QSREs6ErBpuF/8h6?= =?us-ascii?Q?AuC6veLeHZU90v9CI2KKICfTs2KPyOO3j2ileZ1MFyuGYbR9YiXD35YI6cT5?= =?us-ascii?Q?k08JgLDuWH0XubkEZP8awJXTXaPfppvjlvp+YxKS?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd8291a2-b08e-404c-cc4e-08dac39c6eff X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:07.2168 (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: jvcUva0u6wMEHw2Splb8awU/3U5CTbFfjfTTXJSKAR2ldkvAgmAD8jOiTiS56QHDAJa+10yyJ0pIHD7fst2gJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: OBCfC4okHcOWlTDB0vyzypLkD0IaGLpC X-Proofpoint-GUID: OBCfC4okHcOWlTDB0vyzypLkD0IaGLpC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=765 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140777626100003 Content-Type: text/plain; charset="utf-8" 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. Add a helper qemu_stat_rdev() to use it to avoid direct access to stat->st_rdev. Co-developed-by: Guohuai Shi Signed-off-by: Bin Meng --- Changes in v2: - new patch: "hw/9pfs: Add a helper qemu_stat_rdev()" hw/9pfs/9p-util.h | 20 +++++++++++++++++--- hw/9pfs/9p-util-win32.c | 15 +++++++++++++++ hw/9pfs/9p.c | 7 +++++-- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 892465b392..c424cb00ca 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -19,7 +19,7 @@ #define O_PATH_9P_UTIL 0 #endif =20 -#if !defined(CONFIG_LINUX) +#ifdef CONFIG_DARWIN =20 /* * 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 } =20 @@ -130,6 +132,7 @@ QemuFd_t openat_dir(QemuFd_t dirfd, const char *name); QemuFd_t openat_file(QemuFd_t 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 =20 static inline void close_preserve_errno(QemuFd_t fd) @@ -251,6 +254,17 @@ static inline struct dirent *qemu_dirent_dup(struct di= rent *dent) return g_memdup(dent, sz); } =20 +static inline uint64_t qemu_stat_rdev(const struct stat *stbuf, void *fs_c= tx) +{ +#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 a8b8b8c832..44c10370ae 100644 --- a/hw/9pfs/9p-util-win32.c +++ b/hw/9pfs/9p-util-win32.c @@ -939,3 +939,18 @@ off_t qemu_dirent_off_win32(void *s, void *fs) =20 return v9fs->ops->telldir(&v9fs->ctx, (V9fsFidOpenState *)fs); } + +uint64_t qemu_stat_rdev_win32(void *fs_ctx) +{ + uint64_t rdev =3D 0; + LocalData *data =3D ((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:\") + */ + memcpy(&rdev, data->root_path, 3); + return rdev; +} diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index be247eeb30..7080503b97 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); @@ -1340,13 +1341,15 @@ static int32_t stat_to_iounit(const V9fsPDU *pdu, c= onst struct stat *stbuf) static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, V9fsStatDotl *v9lstat) { + dev_t rdev =3D qemu_stat_rdev(stbuf, &pdu->s->ctx); + memset(v9lstat, 0, sizeof(*v9lstat)); =20 v9lstat->st_mode =3D stbuf->st_mode; v9lstat->st_nlink =3D stbuf->st_nlink; v9lstat->st_uid =3D stbuf->st_uid; v9lstat->st_gid =3D stbuf->st_gid; - v9lstat->st_rdev =3D host_dev_to_dotl_dev(stbuf->st_rdev); + v9lstat->st_rdev =3D host_dev_to_dotl_dev(rdev); v9lstat->st_size =3D stbuf->st_size; v9lstat->st_blksize =3D stat_to_iounit(pdu, stbuf); v9lstat->st_blocks =3D stbuf->st_blocks; --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140826; cv=pass; d=zohomail.com; s=zohoarc; b=jT3ergXKZwyxiX6GOngcvNInIfssACfDYiqPBltzQyNI+gF+DDo+vQpyBwIyXIEnwgRnqC+sijQAXWi0bRxxHKCJg+C2kImG7kCQIdEuGh/OioNeBy0wn0MTP0lNlUrIMuSv2MbcM5kubwjzBKBwItXtD5VQX0joD0aHai9BDHs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140826; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vsiZrQUtUBTAU4WuT6dlDDfQS+EyxZPRhMhDYhmH78c=; b=HH1zS7mal9S27GJaoD6qeBUZHI8pbomSka77cZp9mKbRhKLzJrM636g6j7It54IrPbL+pOsQVARfsdfMSsMnj8rvYtWoEPatNYAB8Q4qe2AnbOv5EBphkuHmw1qFkRQ2c5MD8Tq6W7Ey41pbQXQ6t08Y598mxrDL2eLvI4P6AZ4= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140826288227.7937349945172; Thu, 10 Nov 2022 20:27:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZe-0000Z8-JI; Thu, 10 Nov 2022 23:23:26 -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 1otLZc-0000Y4-UX for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:24 -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 1otLZb-0001au-3F for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:24 -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 2AB4CtKE030334; Thu, 10 Nov 2022 20:23:11 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knqbkn4dt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:10 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:09 +0000 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=vsiZrQUtUBTAU4WuT6dlDDfQS+EyxZPRhMhDYhmH78c=; b=Lc4uOYIRgDL3c7nZQl0EGTj4JfCvBIVp/qvLY9cPuXMISPfY0v4ojvNg0TREL+XhxIAh rDRZ3O/6EWVm9kxhNL5aFgOJUGj+yqhIuamw1gMcticcp4bvtxnTF63mF+6LxALeLn8I ts9d+WBjg90cGVPq0pxDKKx4ZU1hL4cexNdTVrj3yBzHKFxoI2Jg6G8O3tg/3oDQvzIL AnWq64DzArFN4nIYVM92ZdRrKoLayQ24sOZtC3Ebl+AIv5knGybQHQsnPEDsMpN/KqOZ JLKITzvJVLPv1ZpKK14IG0aL27TQ6ee3neBx0v/mkfXoalyGe3q6oOU9PwzzRO/lt6Ko 8w== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bW3UdsDtgMzEhGPtezXJEnl6X9dxSwbVKHK8OuIKD0Euy+AV57kL8D/rvqy5Y9+sb1ByZNPsRYC1rJVOJcpPFOsI9qkyBE9eqG3qkCQhMZrvtFeWVRrCrH+iZv24mrqpVpWGF2HjpQR5WgFwd0EBJGkMQGWfLlgSxFI7GEB0MHs1TzaC3YsT9Ir9qquH3zputonGSdXBNlajIqUcZ6E32hAwmWENNqDdpvxGutRZx8kmRW9+BS9j+x+whp9FLePLwjahjmujB5lgi3QzDAaeFbTQN42p9IBWr4Qeq9CTzDQhf4nxCknNfB2EPtrTMuJby0PlR+1X1UnEQjWbefZyUw== 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=vsiZrQUtUBTAU4WuT6dlDDfQS+EyxZPRhMhDYhmH78c=; b=WJJaeIkcb5MngxTuqJefQ77KhoDrt1kFSbFTtKXbzeq89gz4mrPuIBBL6aBoZSTkWMXp1ODZJX/3XNA1Bn56eUR/vmjeoW2i95S0FCLMUrfqJUuCJhBJAJEGBO61rQFpQVNUaNASNGxgfV4kBEz/KPS+Dv5iZZgU6Ug1baJgjbZ6QdNCojMqk6r/+8cVyIU4xPGfseYxliedUrj03aU/02wGEk5mQ3fOswczz2oghTMJOW8Lvwy3f3agp+bRAMH/qRd8E5EVOAmddP4uS7b1jBmYyiKhm+Iy3PaMr8Zia/sq+x6H6RTFl91uG/JNsg0MqtqArZjjrL80YZE4iauukA== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 11/19] hw/9pfs: Add a helper qemu_stat_blksize() Date: Fri, 11 Nov 2022 12:22:17 +0800 Message-Id: <20221111042225.1115931-12-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: bb173cf3-1aa3-40ab-ce4a-08dac39c7027 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: k8Zc3lYhpQAFegh6UE1rOaNb7PsuE+XmPJDvhMKtfmEQ4DHKPE3FsrhTK3OzvfN8Qs1jWI9KKUjp/hN+sSzNRp9AIIxkK1FBZAq27gc6HtZwoJ3AlRS1GjGl7MBXaGgYugec2giqgwZwT60swGbdnBP7x3rZ3ceiM19KMcHAMbFK1frLXC934EqfgbscYG15E0uSVfJqvAkdLHiNxtn/Scj0FuIkgsGvR4FtaiiygYnUi3PSPUixXRg1S8huUm0Wi1SEuv6nAmpb0toY/+WrQ81+4h6AVsTH1uh73c1Nn6qTfXSh/TUDx3i5ZoBgAXxJNZEk5/dd0ZQI1NJtWcWC9Q6eSinq1qoQehjIztvQNmsVIEfo8Z5GMcr7+mkeoLBIopdEG2HzJaDx29LBXUY1rxtUlF4dLMVnNT2A7aoJnH90EpveSTAygdCiLwX2SyouOuf80xLxSMpyAj13bNxNcW5FXdPb6qB5PUFrjVunuc1Xk/3HRGPdPCd5/tfWbl131uNpaVYYg7z687z8iAoCgeAyC9LupKtnSH5TgEC12jfL67MSyrFT+xWWJEiXrXLY9l5aUItraOXhcfHxMVt51YSd0nDDQreOWj0liOJ3sKHffgvRPeorZFpeW5O3IBAC7vqbJZ17XpTFHsb2MBXqaDpvne7ayXlryRNItCob+4t0QambCyGqHAzCMb7pFZKodBbJKe99wBVehY/GmI8soWmlt4AcBSkNkZQu6IFpJe5nOFBog8DqLqua0h0bjPryPpuyq6XBXuPLIOUKq3kHeQ== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Em+47rLHY+klanWxWV2j4FgoEqjTSvNfmGfz9xLi7AXIx4i0+RrWdUyXLhQS?= =?us-ascii?Q?sSBOxcTO36oT3snkkxRKsJtsqtr6yTu/vjSF4ZMaAx0nRGM3adr+zgUww5ER?= =?us-ascii?Q?yqIJf7cLbo/kQ9M7zfcVGJp+lu5DRyIFRjy6DmMDF2oDJQm9yy2J3Fl98oJf?= =?us-ascii?Q?DyLOyspreHxoV717zuOAtO5KgZts/+nLOgYTxWR9cwnGptRpBHHcUHUeK5pO?= =?us-ascii?Q?E7MZOrR4kU5GHPQUR+vGkWb1Mk+EEy5X1y3ZviTI4VfbF++0kHNjGOEUr8aH?= =?us-ascii?Q?erNYrg9AE9DvQFu+OlrfdoICAjRKs5pWlpOvuRPext7c8yMd+RShxI2CtiwQ?= =?us-ascii?Q?NujUjpRoQsH96C1yBdacESLHQKFtvmsgt9jfTP0hHhkuF5k1n6dSJSDJE2Oz?= =?us-ascii?Q?hr7+d55Km46BWhGuc9wBH3rO0l3zgUsKaxqLGslEHmiYg6Evda3cuzvfCnsD?= =?us-ascii?Q?6LxwGwUmALMoATr9qWBnh4Ozmz0MaZrsW6pJKkiFI1HZWIPznp4Cjd5jWB75?= =?us-ascii?Q?raMxwwCbyI4NFeclPhXL/HUMEKIpH8QAiog7velt1BQpWwPoGdohbe2Wwt/T?= =?us-ascii?Q?Tz9+iuWA29nPdChKQpfPxqy2x0hEe63ANHfJKmzVwjJYjqO/1UVKVR1H+O2T?= =?us-ascii?Q?G9tQ5JkK5rxn5sivfCYg/uVw6P1i0pRNfMP1ug1b66db/3AB+pOB8jX8larv?= =?us-ascii?Q?iM4CVq65zhsw1hywd4ERznhyg05ltbX1cKnWVBDyoDUhZlcsmHmL8i76BzM+?= =?us-ascii?Q?bL6MYQYW00np2cgSrD9vcC0gIs5DpbVqTumFULpjKA3ozbIyPduML5nBQWEJ?= =?us-ascii?Q?AY1Z59PmNagvjxdmQdhfAgRUSK4X9BhcvHMnOkr89IfLPo1LCnAkA9CNmvF3?= =?us-ascii?Q?x79wQ/8BsLbFJ7XEFObTXRbXNl7zV1taQ/LWZlOnlhDQ86smyPTmQkPR11w6?= =?us-ascii?Q?obL8fPVw4qJ1albRtBnY08eRV/f9i+MGSZT6G0tFKsA1rDDhqLOpVuN2qn7V?= =?us-ascii?Q?NXz5k7ixBWdynZZVJ3otslwSi7vXEIOt0EM9aHQqBbZGstu8V792NksMEMA+?= =?us-ascii?Q?0TEaXyf6j0wvasqOvhpXjPgEpGJUYYIC7qKoVDIBnbmXJuHwe+Np+4uXg11r?= =?us-ascii?Q?mWSJKVUF7FgfWCJKjZ5VWpXQzZQJ3TXH/B/M8ZxNN3KIjU/GhoalOSPjjd2+?= =?us-ascii?Q?BIFeHgEwg3x4nx3IlMjPiAvPeentM5Tgw/eCR9p83vLo0IS17DEvNV5lZmXY?= =?us-ascii?Q?d0KHvbYqGs6o9rgPbXL45Sja6SgC13GTJd9WCYNiAfmuy62j+7Z0xhJr6w2I?= =?us-ascii?Q?hQQbvax4HVflOzlVPbyxyyGpAYVwSj0yMKP/AjFxOqFFAGmwLcrUmmgc37zz?= =?us-ascii?Q?/fSFTvxNwvI6MDcu6M9XJd1I/IMRPg+iKdimJLDtqGUfoFmTjvFZHNhqzQU6?= =?us-ascii?Q?tVVyonrDL5LUAOQo8AuX/tOZXmcnB8ce4c6cWSUkH0oll5b3mwES8RRhHIcM?= =?us-ascii?Q?Ojokdtt7BnZpPPs3QSbxIlfsoh6gzP0XwrXbHOIpuo+oVjRKUH3/BcBhDzuq?= =?us-ascii?Q?OL3cn1VgvDgXWErttLktTWzBZ4XvYCraqH7lJJxe?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb173cf3-1aa3-40ab-ce4a-08dac39c7027 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:09.1567 (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: nTcHv4qHEjEK7WPoiUkZKXMI9WOW4SQEYxCF6aRGEX+NERxAuZpisRHmCyEzPi2cdKDHBTuWAi68MxDRbwCW4A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: lQBsYuNd7BF1-sP5PLSKGq4tbH-jxYqf X-Proofpoint-ORIG-GUID: lQBsYuNd7BF1-sP5PLSKGq4tbH-jxYqf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_02,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=784 bulkscore=0 suspectscore=0 spamscore=0 impostorscore=0 phishscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140827798100003 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - new patch: "hw/9pfs: Add a helper qemu_stat_blksize()" hw/9pfs/9p-util.h | 12 ++++++++++++ hw/9pfs/9p-util-win32.c | 7 +++++++ hw/9pfs/9p.c | 7 ++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index c424cb00ca..df84374b78 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -133,6 +133,7 @@ QemuFd_t openat_file(QemuFd_t 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 =20 static inline void close_preserve_errno(QemuFd_t fd) @@ -265,6 +266,17 @@ static inline uint64_t qemu_stat_rdev(const struct sta= t *stbuf, void *fs_ctx) #endif } =20 +static inline uint64_t qemu_stat_blksize(const struct stat *stbuf, void *f= s_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 44c10370ae..064f878e5e 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) memcpy(&rdev, data->root_path, 3); return rdev; } + +uint64_t qemu_stat_blksize_win32(void *fs_ctx) +{ + LocalData *data =3D ((FsContext *)fs_ctx)->private; + + return (uint64_t)data->block_size; +} diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 7080503b97..169578cc1d 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1335,7 +1335,7 @@ static int32_t blksize_to_iounit(const V9fsPDU *pdu, = int32_t blksize) =20 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)); } =20 static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, @@ -1352,7 +1352,12 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const s= truct stat *stbuf, v9lstat->st_rdev =3D host_dev_to_dotl_dev(rdev); v9lstat->st_size =3D stbuf->st_size; v9lstat->st_blksize =3D stat_to_iounit(pdu, stbuf); +#if defined(CONFIG_LINUX) || defined(CONFIG_DARWIN) v9lstat->st_blocks =3D stbuf->st_blocks; +#elif defined(CONFIG_WIN32) + v9lstat->st_blocks =3D ROUND_UP(v9lstat->st_size / v9lstat->st_blksize, + v9lstat->st_blksize); +#endif v9lstat->st_atime_sec =3D stbuf->st_atime; v9lstat->st_mtime_sec =3D stbuf->st_mtime; v9lstat->st_ctime_sec =3D stbuf->st_ctime; --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140763; cv=pass; d=zohomail.com; s=zohoarc; b=XVXxwpC6O/mPyXqn1weu96GevT7Qu8SCyueP1s1yi615YMYH+Ax/oTukizNnJ1idHOqgECABcJXW/98FMtkmwmacjdFr6gQ0nJi1bsjSHbzvxCNOYkpLphvzigXKuKy8w50TzR7PrA9HIK0cEU3mlt/SPp204q4ae5KEmt62z7A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140763; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oE/jEJRyYyIld6FO/F1csjXJv6UzdqPxqp8YPSsk74E=; b=hTbfCwB86ZK/kx/DUYwnAjKlfOqKRrDRtBT+aE+7GoQLET2lwANyRFZJO2wNYJsXeATBNKTQjIdcFroour6h+SlyOJOt+jwqjgZsJ3YWxOUFVDxsSEMwAxyyOlG7lR7snR1BjwYYa6Ykq6cMVWCy6Q5qODxOU21Aa3aRGPxfqIg= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140763569579.1478706363599; Thu, 10 Nov 2022 20:26:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZh-0000aJ-9c; Thu, 10 Nov 2022 23:23:29 -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 1otLZg-0000Zo-0r for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:28 -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 1otLZe-0001bv-3F for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:27 -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 2AB4JruM011527; Thu, 10 Nov 2022 20:23:13 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knqbkn4dv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:12 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:11 +0000 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=oE/jEJRyYyIld6FO/F1csjXJv6UzdqPxqp8YPSsk74E=; b=eLXmRgI896+b0/KPVUJXwitowAAZiUwNTe83RFlkhQ5SjNJkkPa3Op3pVo703UJnO2W4 3JFFhUvyvEp3cNUCeggeRyayBeZ26R9H4IcWWN+wve8MoYs1XFq5pmZwN1Who/RFqJjq zgu81w+7wwIemh8sMb4dZZhfWU9vRdhJbccIuonFvX+ld2Nw+vypAHpxqbKu4lpfD0Jr y8Fr5RUm+W6IIXrne7sJ8CTtvawj3+oYyW/ipaFCg8x11nmOa3vFyFeSheFBC7hoWJES hly+Hh46l0+JtqVuEmU6NJD3PYCb77/dBcY+96LL6v7BMCEGGSFbWVU+9G1b32NsHIvr 3A== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/mfWejRqzd++UIG35zcW+h6WTwHHVlPVSHZwOUJfOKEymPN7dN9tpGMTY+wmohI6k/k4H1CHUdnwkX0ynAENf+aNVYF4HZCr1oJEsgg+/0wzpn+fFXkej3TixUBsRhnUk0pTspGAufW74YkmRDpEQgsUOSp8v8GU0dzLzlUksZXvNNhKcVCJHN6QdPM78RfRD3zRWa3gx13f+e8S4eDtJChuYQfOCEUvpQCyGoyJ3DpSB+PYOM0Tfinx+aErT/cpBr1V4W5E0LEjP9vcnd0jtPF2LKLdgKni4EBEsV458i06Mn8sBxX87FAVBL6IiOiMOgHnMe24pE5Fm1G5NEFOA== 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=oE/jEJRyYyIld6FO/F1csjXJv6UzdqPxqp8YPSsk74E=; b=MlsNORP0uw7T3vso9FPBFDDJVCeDkdCSUnd7QCqGjqOkoGw9ZFDk5EoefBCsQ1U5vf98reuc2vWsXogXG50cAMhpLpFbMLot2Ltu/RD4B8VU1O7eBPNdykX2v5xEByWwzF5XjWc3KWQAAObAjiRKZCwBOU+YjCtY3neI91nnGKqXkMz4EQXysnItR1O7cudry94CRyICxpQN5j4d95jGaDAzc87elxxaBcm47bpm6GMyd9wKVclgeKn3zorf477DoAVPd9FSIFSad4bvxy+CryoFhYf7oDCo9uEc2M8/6UWoFiJeRq2hv/ePalAIlMjZUMOa1JSjhy7RPo04EvP3uQ== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 12/19] hw/9pfs: Disable unsupported flags and features for Windows Date: Fri, 11 Nov 2022 12:22:18 +0800 Message-Id: <20221111042225.1115931-13-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: d10076c4-96c6-4ef7-700a-08dac39c7154 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2ZBmpo/5U+KdvqTCW8CrgwhIRzyoYBAXC1dWN/wxepAZMGUdkCbLYi8UcYvDlH23Pdp/rF6RCEWihG6xkGG18+rJLDVoneZCQ7L6KemYhLXTFMfT1gPbT9Jk5hEL03HNUO9/y3N2aQZmITKASo+/8jqLaKEn3JjMl9MJc6nuR1brcaMKSaw54ucuAlxD3T/RKyRupYEoiDRyd/ZC6vcE9O0G/eJT6LBxmbf94vEofI3+R/q8iJWrOfbgR8q8CYJ8Jz7yRa6iyqwdeI0Kb0t4jDS+FLidZRN9yOhFBwAKvhxUCt6ZTz+1SyWtx8mKyEO2f7ZYCuEHvrQGP5YkT82O9TkCCzow/v/KnXtEvSmr9FYLJkPalrV6rST5g82RRVsbAPs15dPAhNrFXuJoFUgDK8DH2Ao1A5/7cu0YKUnb+DpcZZw6nmnqfZppw2GQHolJ8OYEB6pS2qeD+TCnKhrZZhzAO2moe41lT8lJlO2KY6YEJQz6JVxpnwCx8K+a8UmW3yh4WKzZhN9le6tBeAwC6dB98dmWo3faaSwdwVYKpKKCoG0pVWNB6gzSWcEDYbPu0NogYI0Gk3spbOEdQfQ6dCCpT5TKh5XqAyBME52wVVY3sYm0U8+YF/kV0fKQoii3PExt+bSLEE9KnnsvkURPdGcRx9Bo2fgKNSb+MnkKh7BMDbo8P2ONaniozxTCHYBbmjbFNasR2SFWb4S0JuUle2yMUXn8fHaXMKLV1ViBZLQXCyPjqE4McKHWWoMNZpy/98Turq6/9Q58spBfWO5D+A== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CdKCpGRk89wJzrsEIZptTk45bGZ89Ft/TWeSTSPNlEEZfU0QmMleWD5gby6F?= =?us-ascii?Q?BHISc52EszoT0yIFJF02IKe1vS1sAxkPmkNNT8GH7es40UVUh3EjUs6gp8mm?= =?us-ascii?Q?wPUeX2w/d4SpJWbtGQRqjJAmMtub8FXogCojataV0rxh9TihhjNwngF92C0c?= =?us-ascii?Q?+PHgWwu0oU9ZtoaFJQUjczrmTD3Ja9Zvel58bCluOG0sYMADxGi7GuR0D4RS?= =?us-ascii?Q?0Qd/hK8loTssumMnV3WBLQo2zaq83VhXKGexkOtpKFP54LeKnCoOUS01+IKT?= =?us-ascii?Q?m4Q/j5b8fSwmmVCKYAHqdsqVAstlxWzqtZBUg9ZmEeZJRswOX+nPXyjaIF0U?= =?us-ascii?Q?3m+EWPR32moJniTLqLXG2CWEFMNusEJr5xYAPhwsKo5SQEz5XmTeh58RVMmd?= =?us-ascii?Q?lupKE+qTgTJI/eqQaihniJwN9N65tSaLbl2cb1X17JiE2uU3zHycfeCDKRNp?= =?us-ascii?Q?r/VZLwyrYTfGdATnQQyju/nW3bQ17ssq2Av2o2tqQK2RAx5C2YbGpIjDvpZg?= =?us-ascii?Q?LAQG1t0bgEwC0awPTiKr9317E4KLmjtoi3mNA44Kd79Wdw3rGx8h7chNi2tn?= =?us-ascii?Q?d/4MQUimeeknoO9hRGvKsHQO0khPUaV0IFaB2uMgw/tLQ6mLekGP/JdR+CM9?= =?us-ascii?Q?bFaq+DwyDMWG/ARfXitnca/6sGtnT9nEUcPCCY8Dofjz/r8UoEEzIgz2EQK0?= =?us-ascii?Q?nWwp4ITu7k0x9Vb7Doj+Kz9TvmXwih4zzaeKu9BGdhZOnc69Ko0eMUQjy8Rv?= =?us-ascii?Q?Aa4xk63feIfNlzGPJPi6Mmkh81YVd5sDGFKkIIqCzPqLLcs/59KxwylR9a05?= =?us-ascii?Q?1xvz7QA4CiBMxL5rm2vADKUHdPZ9mpi3jFcjjY3E/HkW5E0bPZgKLohtAiYh?= =?us-ascii?Q?YKSUWWj0tMcxQfhOnmJ7eoZxLBZrcSeuqr+xnD0Qs1UjvwuA6ZaUAN1J5muY?= =?us-ascii?Q?FOx0l+J+dwWGhdryGwjJvUrMo3SQfSIeSn2C0pg2ttnZz9BtuPSIas9hx7B7?= =?us-ascii?Q?H6VO+q8S6OfhMHacvbN5Oh6hSvyogkmxHeNd/1OL8ffjzwBced89tgpFEqPg?= =?us-ascii?Q?0VeKu044H8dcm2dxx45lONOj4r4Yy98PfzJCi09LKYwfXy5siBGGnY03Gk1S?= =?us-ascii?Q?jDLTIt1fcrnV0nid6VQqiTXufBesLpABliliP7AjJ/tIoW7YmwKXfOgsLvoj?= =?us-ascii?Q?jbXs07CbZzZjKqug3heguGrIVP2aGyVYUPsBuaOonZwI2tXsjXSxL8tFP/uf?= =?us-ascii?Q?jZS0UyzC79RsZNx+gsLWVhxhVNfga3FzSflmjHhteqG26Fef3dDu6BR5Ru3f?= =?us-ascii?Q?1DAxvUw3GWM8/Y3MwFje/8duMqWsvS1C7H4L5fr2iBI8IrGcGcJBGhydkeff?= =?us-ascii?Q?+isaY7rgSiKb8Mj8/FrdeyBXnMVcJph3llktT1fITUn29Gwi09Z567fCIjMu?= =?us-ascii?Q?MKm3uLFETOA54oopnEaYoWbZf3zSSzhNOCbTVORZYYUK+AybXQ2L3znnDJhk?= =?us-ascii?Q?OTNoFc+d5FJ5C7tvG7kKFi6b9ICQhaNSTJlOuqsmtokaLAssyzhE+txm6T/4?= =?us-ascii?Q?OW+GM5jFKOLX+ilaq4ntMI5deazTW9aHo4vQJR3i?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: d10076c4-96c6-4ef7-700a-08dac39c7154 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:11.1582 (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: tQLU3xyb2nuBSe9ocvm4d6KWy4TLnV343SgghzSvpDhNinpGdjyYx11bqh1lM/Rw6cXmppbjHSNJffbjij1fnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: ny6i8Zf_BYpRhP6uLe2RlNX78OATMrgf X-Proofpoint-ORIG-GUID: ny6i8Zf_BYpRhP6uLe2RlNX78OATMrgf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_02,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 spamscore=0 impostorscore=0 phishscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140765575100007 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Use precise platform check in ifdefs to avoid automatically opting-out other future platforms unintentionally 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 169578cc1d..0b5e1fa8d2 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -39,6 +39,11 @@ #include "qemu/xxhash.h" #include =20 +#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[] =3D { { 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 }; =20 for (i =3D 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 =3D dotl_to_open_flags(oflags); - flags &=3D ~(O_NOCTTY | O_ASYNC | O_CREAT); -#ifndef CONFIG_DARWIN + flags &=3D ~(O_CREAT); +#ifndef CONFIG_WIN32 + flags &=3D ~(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, V9fsStr= ing *extension) if (mode & P9_STAT_MODE_SYMLINK) { ret |=3D S_IFLNK; } +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SOCKET) { ret |=3D S_IFSOCK; } if (mode & P9_STAT_MODE_NAMED_PIPE) { ret |=3D S_IFIFO; } +#endif if (mode & P9_STAT_MODE_DEVICE) { if (extension->size && extension->data[0] =3D=3D 'c') { ret |=3D S_IFCHR; @@ -1203,6 +1219,7 @@ static uint32_t stat_to_v9mode(const struct stat *stb= uf) mode |=3D P9_STAT_MODE_SYMLINK; } =20 +#ifndef CONFIG_WIN32 if (S_ISSOCK(stbuf->st_mode)) { mode |=3D P9_STAT_MODE_SOCKET; } @@ -1210,6 +1227,7 @@ static uint32_t stat_to_v9mode(const struct stat *stb= uf) if (S_ISFIFO(stbuf->st_mode)) { mode |=3D P9_STAT_MODE_NAMED_PIPE; } +#endif =20 if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) { mode |=3D P9_STAT_MODE_DEVICE; @@ -1365,7 +1383,8 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const st= ruct stat *stbuf, v9lstat->st_atime_nsec =3D stbuf->st_atimespec.tv_nsec; v9lstat->st_mtime_nsec =3D stbuf->st_mtimespec.tv_nsec; v9lstat->st_ctime_nsec =3D stbuf->st_ctimespec.tv_nsec; -#else +#endif +#ifdef CONFIG_LINUX v9lstat->st_atime_nsec =3D stbuf->st_atim.tv_nsec; v9lstat->st_mtime_nsec =3D stbuf->st_mtim.tv_nsec; v9lstat->st_ctime_nsec =3D stbuf->st_ctim.tv_nsec; @@ -2488,6 +2507,7 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu,= V9fsFidState *fidp, struct dirent *dent; struct stat *st; struct V9fsDirEnt *entries =3D NULL; + unsigned char d_type =3D 0; =20 /* * inode remapping requires the device id, which in turn might be @@ -2549,10 +2569,13 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pd= u, V9fsFidState *fidp, v9fs_string_init(&name); v9fs_string_sprintf(&name, "%s", dent->d_name); =20 +#ifndef CONFIG_WIN32 + d_type =3D dent->d_type; +#endif /* 11 =3D 7 + 4 (7 =3D start offset, 4 =3D space for storing count= ) */ len =3D pdu_marshal(pdu, 11 + count, "Qqbs", &qid, off, - dent->d_type, &name); + d_type, &name); =20 v9fs_string_free(&name); =20 @@ -2908,8 +2931,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 =3D v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); +#else + err =3D -ENOTSUP; +#endif if (err < 0) { goto out; } @@ -3979,7 +4006,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. @@ -3996,6 +4023,8 @@ out_nofid: =20 static void coroutine_fn v9fs_xattrcreate(void *opaque) { + V9fsPDU *pdu =3D opaque; +#ifndef CONFIG_WIN32 int flags, rflags =3D 0; int32_t fid; uint64_t size; @@ -4004,7 +4033,6 @@ static void coroutine_fn v9fs_xattrcreate(void *opaqu= e) size_t offset =3D 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; - V9fsPDU *pdu =3D opaque; =20 v9fs_string_init(&name); err =3D pdu_unmarshal(pdu, offset, "dsqd", &fid, &name, &size, &flags); @@ -4057,6 +4085,9 @@ out_put_fid: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + pdu_complete(pdu, -1); +#endif } =20 static void coroutine_fn v9fs_readlink(void *opaque) --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140893; cv=pass; d=zohomail.com; s=zohoarc; b=lwtCPqdkuUU5wDTtHLrtWHJTAEwEufgwav+enrf3YasOVQV8xFxwr4ZUzOHwzhLc+dcCzbVkGhUswrH1TZ5/hKcZOpUXnZh/FIKyY7zs6oKUt+Ryq1XBFlYjhh86vu0qKo5uORsaXNctrVvJijCsoywgE8EgaO1mKBH2pY1mqns= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140893; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NAClB/vYcrJi/d56y20Tl8wxwlevWX+TEdbP015zj3M=; b=AF75yqtYmyHWELmZOUx4w8QCAkYqXqztGS9Z/lM61QV+QJd/5CQja4KDsmyqDTu9ej5TcDLV1MgGbrvVpohJkPQ7egYEFrIxFwLqxwPNuUe9gIxM5UhG864PMkba4VY/NeHpvXbDdp4RDYrpXvTVqIlOzh83CyNLfG+ZT0gHuus= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140893053613.7554188380267; Thu, 10 Nov 2022 20:28:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZh-0000aI-9R; Thu, 10 Nov 2022 23:23:29 -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 1otLZf-0000Zh-QH for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:27 -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 1otLZe-0001bx-85 for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:27 -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 2AB43I17028685; Thu, 10 Nov 2022 20:23:14 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2169.outbound.protection.outlook.com [104.47.56.169]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9ma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:14 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:13 +0000 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=NAClB/vYcrJi/d56y20Tl8wxwlevWX+TEdbP015zj3M=; b=KH0GRbRTKbZu04i6b0Jjpp1Imrr97UwehAGumU9lBhuf6sA77reSDf1ho3zGSsLLPy39 ge3zDs1YPqIYnDtQyb1zgUa/TXFZo643YGjcukstAA8/bw4HvCnEh8CJP2Uuwhj3gKY7 NrTdvT/AE1vvIyZqIsdcAVSL8c6l/dTFl4tHjVgLME2yhw1XvNeiyylw4lRctB/1rNeK ZxE5LpyYFCFplqFuPxFyWL4uCAIu/fqz8O1LzDbOvExrSoPBNmhBzMaVJS5IhMmPaG4L CcScXshIIzYP3aqaYsGW/+Gp5nFZuzv3GYpym+qa82y7nSsWaqV7HugWqcpkloGN/fPE bg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oLEiS2WIZlVPQl/ZZVSnJBJeouiCWeQslkdJZVLjndBRUbttzbq2jqp16Pehq7Vv40tegc9zHNv6k3mgY37Mxcsolgq1TVKHjcMhnImA2aLUKSxMyp3Y5wuj5Odc3EfEK1JBInwbwsChHA/VohYcwCQZrBxzB8ev4N09tCKkkJkj2HF/N9ZBge5JicWVpJU7Qp0WwEgYQpWNqqOV4GThRm1kzgPWnOqpUiCZUaiGapUrschs08j/Qyrpq+evJOqeik8b+tRM3DMZtBdWEHhEThHuiH90I4qeVm7xPYUX8xAR6A7wjcELA5QKQJKcb9lNhwBuT9Y/IuKoFQ6knfjdsg== 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=NAClB/vYcrJi/d56y20Tl8wxwlevWX+TEdbP015zj3M=; b=Tasbzz/fMZb0jfbftk9nwB/E6HMM7BA73hm490Bv4jbLLljJCPptanBTfkymj+f08/VRRJDUhRfdKaPLrvlw/tjSQlZ66hWppeRtUWRhdjQgSJe80yHG7RUwI8t57BDUWwOucqp6mP24Bv8Q0N4UTpCiPNetQPq+p6NOIo3NojO06bBtpMyu5hKFjdBgKKoESmekhwBw69Cp0SLPzUWY3ZzoizDIy6OOsoxuoqg5zaMv6j0FgG1LPi+O/sKNoWmcEGqU/WdbK/MFaItkWTOZxVvvR0gsOeLu9ByBA50Ux56mtq27c+APPCar+IJRH4sVa9YxYYyUTK/qlnwAmYr1tg== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 13/19] hw/9pfs: Update v9fs_set_fd_limit() for Windows Date: Fri, 11 Nov 2022 12:22:19 +0800 Message-Id: <20221111042225.1115931-14-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 2dd90164-6956-481e-3a1b-08dac39c7283 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95m43/3/O1Yg4f3V+LLlFRoyxeSB7B9AeU6SJb1qAw4b4ag/cO3DyVVX1bxBOdlI7s3dhDpQnCrlNaE343m5t6/hcm6/zK9TYu5XWN6lR8QlY1axT3/H/VN/fYTPLQ6TNmhpPH5+iKHxNJy6eM8tQZJB85u4k53W8I3l4gmdGUuVxCfOfav1FjxVxAbz+FwOEWDFEkAO7VVCSHSSFuWunxa56d9JAQ6f5LXR7AFPBDUAok9zSfuhK1maZR8y929m1QImcn3w2wOxwNzZ1XmxpsAUPVDPgbebVD1N8A/YmHjELBxORaYVIEYhIqOZBoD8U0PXqokfY3vI4KQtIXI31WDjh+/xorclzZMqxV2/SNO1N0IcMikDHXnsqcDGlNo21/i6liMy8o5mWtCF4gde3VAp/RR8FLxFbd882vhAH6oESdXTIP0WiGujSmd/yXc/iCC3ayQ5GxrptdJDcyTXZtF2zIMJeZio7NUFID2qdmbS8R46RA9ys9zSmucK0SwUHF7eeFcJfK35treJLMcgpI74KKp4Es0nveHRfpuCl36odFh6pVBmss1+98+s7hTk7nnjUsSyWO1onVDX0CGX1b6HaDaytIkEOIqoZISsTbVIEC6xekdD4aurFFhqnr90Mttnx+0tvS4uwJTVnViB0lazvG4xxY0pAxbgQxrEqIqlSaQXhDpkWYcZTOEulfCKgnuNhklEgMczAXrp+m1eXNCruIGZsejF14hGF8JB0RMyXg3aDJJGI/KRJZ34C47dCY+CvrmMnj+Ja2cEZZqyDg== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(186003)(6486002)(8936002)(41300700001)(15650500001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bxvHiOak1vtDr3RsLrBaTVO1iZcgEv3vkG/gzkW+OL7pZKKlUISnqfi6rjJZ?= =?us-ascii?Q?n4JbZqvWs5UaXFq9vNyRDO339DHATNNO07rnZQU3KfSIxp2GRde5+i+GfRsa?= =?us-ascii?Q?EWeDDqLXwkugvJC5IsB+g9YfXIwKONcClNy3/T0eCrD64HkRZqJ0l1yhqw8/?= =?us-ascii?Q?MrNLu275RE6uU6UnX9h+/quG5UxyRD2Sv6YZDd0KCDWwZReMtx1LiQhtHn4d?= =?us-ascii?Q?Hx6M1+Kb2KZLxB4Bjh9hANY3XEpUsrj/4p9do11byINvplQ/8okUnY43yJRk?= =?us-ascii?Q?x8pKbN5esjq4mOBjr77IF08EgpBTkRjwLN0/TYVejxH7pKqGgVm7a94fc9Hg?= =?us-ascii?Q?nYx0T4ZwIIay9cTW7BHeCZOj5O9pKIx7srDL768FG+ZbnvJjuqfBM4THNzeT?= =?us-ascii?Q?ychNZkEa4CaLYVED7AMiQv9eXWpLPwbtQrqD4Gkr5sekhqYLxjDd0qR8Ds3E?= =?us-ascii?Q?Mq6bV97arEJ9EjOD0C3kpZJdAL8zddzTial9Oi0Po96O5aNiTp8JQuj0W13a?= =?us-ascii?Q?sPhKd3edR4fyYBfX1NWccGOmEd93eIjuO5c9JdatFN56uOyTZ0pybDuxT0rH?= =?us-ascii?Q?i4qJ60CuYiwmm7XHNV0hNeuhYicJpB1HZxfYcuN+pCRZDTk1hFrAdxuabGMt?= =?us-ascii?Q?qbof56IKRP6F7onCljNohoCzgDLMBcIWUep0hla9ZxiiUaETuttKk1WIh1Gp?= =?us-ascii?Q?dJMwiXHZBgzDGtcY0qsW9J/kx3r5+/fpV20sFs3o9GGYBWH4LS+2gW14IrPv?= =?us-ascii?Q?GjKXandsBxaxjLVJiof2rR1p3AHbv4HrpYbkOdXozScW+d5tx9tMQuUymvtT?= =?us-ascii?Q?i0go8dzWP4N6wNgUNZ+yWSZmn4T1M5W7eZ6rpw+7TKKYk0cH9reAPXk9QWbV?= =?us-ascii?Q?sAELBjSyYaJl4DOEavTf0KbMDQP51LRMTt/rezJUhh4+cbFUT31FY/DBdwX8?= =?us-ascii?Q?sWuTeHzwnIQyAmZy5dWA585jMS1VXszdc6J414hqFNCjmy0lI3OmnJ2FCWYB?= =?us-ascii?Q?WvjajlVxyAVRBAlGSOVa5xIXdLOywW2Ajr+BnsoquyDKsDOZO1W5Qs8uG8kO?= =?us-ascii?Q?ZQdGJq5V57dIO+RHAFv1lwJGZJlpFgXDxeEsCliyB4qBtP0I3G34BfinBgq+?= =?us-ascii?Q?oASYmnT1bUn3rVoPACwSdRNLuywDtBwV6rJjcwFnDFj/Pqy+TUGxFRZs13Gc?= =?us-ascii?Q?OSxY1ALtNco+hO6B0mwN7lZ1ClbDa54SME1vqALyz0I5v3Pc5an+Y79/HOft?= =?us-ascii?Q?IO2/omUOEsdA+TB34dgx4+GIngAa/+/WgRemrPQQ+SjQneCwDccXJ7yRbSXm?= =?us-ascii?Q?23wpDIy4QBSUr5SolK+qrbHA8+ZFRyUCfHwflZPdP6l1Z3hCJlTgp6BU9rst?= =?us-ascii?Q?10KKpl2hFzdv+zJZEX1lvyHU+RAUe3dRY/LEyjHTUMcjCBlVZtp/gmC4d9Tl?= =?us-ascii?Q?+yykBxfzaXJHXSYK1Fg3V4Haz4pFLnmX8dh8c5FyTiUc0dOaBsXOSnplyKOW?= =?us-ascii?Q?EjjPU3JAdREBupj6hbyQ7aV0ocHK7HkLH7Iv9EivUfDN/+fwv90BE5u9ZsB2?= =?us-ascii?Q?3Lw3iCmaLeP6exYuPorTpmW+aVOfTeF6VSoWNM+N?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2dd90164-6956-481e-3a1b-08dac39c7283 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:13.1582 (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: eUHI0C1RUqay7Y4wMcKNNX2qjSMixIl6nfKCzrh+IbX//ogOmyGjNpbST0jFaIYRPcin6fWdwBZTBsSslRWeSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: KUYjvmfBn9TTETq5gSkvyt_ZSiipY-La X-Proofpoint-GUID: KUYjvmfBn9TTETq5gSkvyt_ZSiipY-La X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=801 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140894265100002 Content-Type: text/plain; charset="utf-8" From: Guohuai Shi Use _getmaxstdio() to set the fd limit on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- Changes in v2: - new patch: "hw/9pfs: Update v9fs_set_fd_limit() for Windows" 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 0b5e1fa8d2..be1d2a4f04 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -4392,11 +4392,28 @@ void v9fs_reset(V9fsState *s) =20 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 =3D getrlimit(RLIMIT_NOFILE, &rlim); + rlim_cur =3D 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 =3D _getmaxstdio(); + rlim_cur =3D ret; +#endif + + if (ret < 0) { error_report("Failed to get the resource limit"); exit(1); } - open_fd_hw =3D rlim.rlim_cur - MIN(400, rlim.rlim_cur / 3); - open_fd_rc =3D rlim.rlim_cur / 2; + + open_fd_hw =3D rlim_cur - MIN(400, rlim_cur / 3); + open_fd_rc =3D rlim_cur / 2; } --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140650; cv=pass; d=zohomail.com; s=zohoarc; b=RGq5MlLEQ/v2Hu2O8MWvcuJU4phNqavnkBCOh2WXOi9fMfl4qwxIDAYMD95iIOziDUSMbfJ7efqJvVu7e2Xrfx5teeThwcFWJFT5g/YMLY9jti/YuFBZziEiA7ovKUtLqOPyrCulGhD1g71kpQHFYL++n1T4OUMb8FpeGgNquA0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GuVPlV4qQp+8jvTEQk8lbZWAq5jCINDQDlXwOFBdkqc=; b=HxOwW7bvVWmVRnEGoxj8dhZGT9CkHJykrBBYTXzoKZHf0UGco1U2BW/FHTI4HKHOUBrj5TIrBB3kAAS6gtVo65WnTddlPVqQ8K3dmHJxX7LdQ4T6WFZvbvceI9NTN4ruJrlMPReii2gw5ZXCv7lTatb3yVGrCxhZNTyLj2O2sg8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140650237656.5211383174465; Thu, 10 Nov 2022 20:24:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZm-0000bX-UZ; Thu, 10 Nov 2022 23:23:34 -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 1otLZk-0000bH-QG for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:32 -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 1otLZi-0001ci-IB for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:32 -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 2AB40lZJ022509; Thu, 10 Nov 2022 20:23:18 -0800 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9mb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:17 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23:15 +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.5813.013; Fri, 11 Nov 2022 04:23:15 +0000 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=GuVPlV4qQp+8jvTEQk8lbZWAq5jCINDQDlXwOFBdkqc=; b=rfpM5nkh+1e8nlxpohlIboFzN+4Jrqqwqy0gmk/AoLpgtpDHATi1FIsNW78my8qiHo6C obe5aak75riy02Bzh36lsYmPblK2f8rPabd86Q96MTpCO+ySaxgld/XzPuwkZa4SXqNd pQEDnxSZEpwng3S0+ZQpiGkFWkMwTQmx7yxLPinMeJIn9OS6qYPr0jsLWj+erzTUBEnO KST1PiGwzQbY2eB5JSo6f7UPLNEZmoPGQCsJe8zuWc4V3b4xqNhpirU041M8mNO8IHrm zJLPnfYlUnZmumYMGjSXZTraZr3MmMewMdc3VGar4mBBwr9XpjPTg35MAi3COGvUSG/D vA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RVEmjdcqXv2v2CfkmDPaT5Wymn6a7ZoUo9Htz5+e6CGwTUV34Jd1GEpLviDupwiqBr3axkfkSlCTTW5fCi3mJc3h130yBJTISEXOb0/dG73nW2qFCOU8DQYILZ/zkqRCQHXWzPFYgHwHex2spregKufRhB2JABREPsDf7+VXz7z1IUglZfMh28Fy/6Q3O5Wq1W63VAwUklAvTfe2I8FYlrAKsmqu1gEwRoRL5vMLoez23rV81guD/vJenTsYqA4sBAXWp1I6OPnkZ/AwzhOoIiy5bA2gQbRDW6ev7YBFiqu8uNNstVfuc7aiOhWPDLHxdpTqPzI81DkHx7tsJLFllw== 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=GuVPlV4qQp+8jvTEQk8lbZWAq5jCINDQDlXwOFBdkqc=; b=c3+GcsSkQigYUqGZEvAH/+Q6TqrW7pFBnmFeRw6GTy/EeyspRzj9OZhauI+RVw9MD/JIL1s8pHbvh1mPiWmCvyZ8pc2TV4GKkcwtGkLAPXidmMXbAH9UA1fuLsFKDhUJvouX3ZiGdlRFiSPO1mMBi8jpc/iIADBqOamUKqptvdUVlUe8qXQ+CwMs2Q6oqRQV+xtuhwrl3ph0JOdoOMP/52x6GUs63UCtKauERrthJ7J49c7Ob5lcN2pUqhgnWCZ1wsHrxH5U6WK946XEKVTs34MeLycXVin3HRKw9IbXfENiX5gNY5dZ+fqveUFFV+PKE5kRMNh53e1nllZq3iU8RA== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 14/19] hw/9pfs: Add Linux error number definition Date: Fri, 11 Nov 2022 12:22:20 +0800 Message-Id: <20221111042225.1115931-15-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 82371a24-e348-4d64-89a2-08dac39c73b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vCAriHjDXD3CZPLbVJa9qa+dBkJqjZGk4JXOAyYhImCzyICw064oBvoi7ZRgNMuKwtCxlokhgis8wYDAdFi2xPeRDt8gVfg8/LRHmCcVMIr73StPDCcdXN5Mr76SoEaR0KDqLprlSDFt3XQ67hs/FT/zgsnK+p/duC5jpFRJo3zDWlaZpltLO17Ectxn8/JAPNwrsQJkXBvL1sVZYY8NWOoLKAOHV+juwwiwLsQ20j8htupaBv1eEYHbmqJzg/5To6KZHZI6XN8pGh6JJq7H0yFU34YRpPvjSulnfRNIy4Fpq5lxP9hiXT9llLjsh7DiIz3zTVsz5oweOyc7+fwnlCE9uEeWZCVJKbTN7Ufo8d2NCAFpXdYjznWQJxuSau6db9zuVPV4Z3L6KXe0VyVyGMIjmcYObOAIEmY9wHHD/99lYvi0CXNFm/9EBFnckMqoduP00IvDSdZt0nFmq3s8AsKjMHJv9VCyNoxvAULsdY++kgROUBcgDUWiZgkt3mg9ghp0ZDJCuVeuSkYEj09JQ40NQ5y1dlGlt2WGIq9pWVmA3+hr5rYFjf0I6qTdm1K+0ftlcummFH/sE1exqtPFj7fopP8Jha3ZlKF6aJevcg547wjbUbL20N0GjbjtqrERi/oc7zCxPqLEp7k29q6A9Ca8vNRjJMh+KHhekR+wxxP9G7W5g0MaNvuH95kbw/onUcLXpytWcWxoNeJytmI03s27yqyvk9M9gr4J1LDT0O6ufAGM/jcMMDpFbMQBQPhc 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?aprwv2FNftUmHdNy+Zhm+tLguFwCW+RmhmL8tzUjS8einWO7MLYCnVjp7HAi?= =?us-ascii?Q?TpAXnjh0xSucZY9lvVQT5MNjCW2yyUA/hM0F/XoCXUfz32y5yZBRMswY16mU?= =?us-ascii?Q?Se9M5Hwls3PJteJ74b4SzU6baA5k5p/gp6GpxisQ2hk/RIqLpVNVpzbx2h9h?= =?us-ascii?Q?DSjfMiT36bWGjjlgArHEufPfRg3Okjl9b9DvfAxN2aFPbNp4InLQQlD0YwRH?= =?us-ascii?Q?hw6w5QQPB7NHE8N2b3Ri9d8bZWcxXJUFBQ59vsGy2QDnbPtcYIswBOgj8+lx?= =?us-ascii?Q?zcW4b5p1IFWJrokctDYPK6vnHRRMD1FzY4wkCwjTragySjIH1uhBE2iFujiJ?= =?us-ascii?Q?5hlEhzWgsQMhLd4xPXzeUBdfV90C3QEqAhqVIt9MzXHZ1XVBxeJ6aGJXpok5?= =?us-ascii?Q?aC1jtTa51/iTyj9LUh+kRScIJ/jxe21eqaemsUGOSfVWiF6XbIzx6QT2rKbH?= =?us-ascii?Q?8niBJ0OepvKgDy3bD45pamF0IhY+9gaEvsuIQAB1MrmdGFSV7xK3Jr4sT1hr?= =?us-ascii?Q?YP1tuggcHe1Yl/Oj6sBKkaECQ7r84eNDWEHIj7V1hPc23RP1x2hNgMms3hMQ?= =?us-ascii?Q?9jaK5jKMdcXAqPYEpnS5XhPjjN46nv5iXxTAdB6ur/mLvl0wF5L9SQk3azsY?= =?us-ascii?Q?3Y8qB2HTW2UQBw6rJK2yQKhl8vSDslRvKV1WqqIdZLSSyXJXaBWYHFypDAa2?= =?us-ascii?Q?RtWZnmVofxD0MIxFzf0A+Zzz6a9EF0Ob7iWKfB46xkThMJq4fou7leYHPc/S?= =?us-ascii?Q?42/Sat3a2aozAHdTjlDBJMW4DVJh9ZJCHobwwtr+L9FxXbaoOgcBA3Zcecso?= =?us-ascii?Q?WKHB5ekkuEL1kJEBWQpCPFDR9S8FtQN1zCOILGs1x7tdezLjsa/JdSSuqhOs?= =?us-ascii?Q?27SDbMNzX7hOMxpkjeO8l45O8GkPiltlJPoh+BwE0Cx+SPJVZLgJ395VvM4W?= =?us-ascii?Q?V58p31ulLcXKjQWVIPxF4c3ghAe+ySkSeEQdIbWiGCFWudrZdFRP5/lf5P0Q?= =?us-ascii?Q?BstE40SMO4bHwfHQN3s4gsGInsNp/C+3NThsShzqzuOrIP0BT9grred+RegA?= =?us-ascii?Q?cm8bCDoKCgb1nIB4asHad6HiMQuIvyaWOn2hrlq42gcF/T8s5aAEh4OHe3F/?= =?us-ascii?Q?mupLx6tCFX8P0lrE/m5ouNbFUh09zTrgciM6w3m241WHg0z29mLPHI7jw+hA?= =?us-ascii?Q?FjEusQROXBwWoYt9kWhop3dYieEWWKhFjv/6LPyj0tLN6kTJCGeb7Md+dq/X?= =?us-ascii?Q?t/l4wXIqFc0vT60cMr3LGPFNfILksmQIkQkF5XE8GcWVbZkHcw/7NZONs6TR?= =?us-ascii?Q?vmEsR8bTAf/uIti+TLz5SlMt1WqVt36KvUt5FpB1TKDSMkgifxECMdLxmJ84?= =?us-ascii?Q?3lbsIWQskjpPrrQbUD9eq0eLy8HL7H4HPCjO20KrW42jTJRuN2hDNcSWw6Zx?= =?us-ascii?Q?OmHQXIAm7wZfxys+z2pNcoihFbPUYGCE8MdQQIFAgVPJbed4hf7xHADglubr?= =?us-ascii?Q?2ShuJVq+98+I+DmXPqRYXxHN3BX/uLwt4fS1bTtJrJqRyOuVrGB7Ekv1L5le?= =?us-ascii?Q?dRvcJSz8iYCVhcymoWowyvHkNKm5YRnMvcUjvl4n?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82371a24-e348-4d64-89a2-08dac39c73b4 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:15.2527 (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: yo28KSRODjD3U2l0pGoqCuhDBD6DVGHp4bwXlbj/PUokS9GF5V33FiB8f3JSzdvL2pSkskG9HHbtc4dgf5CcxQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: -m0Muav9F0FxKIRsVUMIvn6pZM-S8WOd X-Proofpoint-GUID: -m0Muav9F0FxKIRsVUMIvn6pZM-S8WOd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=822 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140651015100007 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Use a more compact solution in the switch..case.. block hw/9pfs/9p-linux-errno.h | 151 +++++++++++++++++++++++++++++++++++++++ hw/9pfs/9p-util.h | 25 ++++--- 2 files changed, 163 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 late= r. + * 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 val= ue. + * + * 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 l= ibs */ +#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 resta= rted */ +#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 en= dpoint */ +#define L_EPFNOSUPPORT 96 /* Protocol family not supported */ +#define L_EAFNOSUPPORT 97 /* Address family not supported by protoco= l */ +#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 r= eset */ +#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 sh= utdown */ +#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 df84374b78..c76a53f2a8 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 } =20 +#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,14 @@ 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 =3D=3D ENAMETOOLONG) { - err =3D 36; /* =3D=3DENAMETOOLONG on Linux */ - } else if (err =3D=3D ENOTEMPTY) { - err =3D 39; /* =3D=3DENOTEMPTY on Linux */ - } else if (err =3D=3D ELOOP) { - err =3D 40; /* =3D=3DELOOP on Linux */ - } else if (err =3D=3D ENOATTR) { - err =3D 61; /* =3D=3DENODATA on Linux */ - } else if (err =3D=3D ENOTSUP) { - err =3D 95; /* =3D=3DEOPNOTSUPP on Linux */ - } else if (err =3D=3D EOPNOTSUPP) { - err =3D 95; /* =3D=3DEOPNOTSUPP 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; + default: g_assert_not_reached(); } #else #error Missing errno translation to Linux for this host system --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140716; cv=pass; d=zohomail.com; s=zohoarc; b=L+/7B5axT6FGHpe3B8+5/aB2sgp/Jj0KNvLyGUlNkDFHxCHbPVi/Gi2IbPH0AlnIMcRdM6kx+wtAeAJlgdjNJStNV81QIjmHVzng4TLn2IsCY8plHUw29kc8ILokst4uq1GRd7bJArrF2DXBfFGgU7NUIQE9cbMsLNxG2NyNg4k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140716; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z1EFyfpJay7EWFwsfrL7SqhObwALqYEYSsSwfkLansw=; b=GF/1gn/aHjhPZAcTQDwFd7nrrhxU5hyyB4Uj5cJiCAUJZObuBfWBExH/lf2CWbW4f+uLMdOATGo3lETdi3DnABsjUeHG898lAvSkiOGNJroDGxogdlWnTiadpG5OSw0NOQzzERMHYGMwPGJ1niEoc29/IMZoWm89n5OEv5RsYaE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140716180781.6308545480468; Thu, 10 Nov 2022 20:25:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZm-0000bp-Tl; Thu, 10 Nov 2022 23:23:34 -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 1otLZl-0000bP-GC for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:33 -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 1otLZj-0001ck-Sl for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:33 -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 2AB40lZK022509; Thu, 10 Nov 2022 20:23:18 -0800 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9mb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:18 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23:17 +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.5813.013; Fri, 11 Nov 2022 04:23:17 +0000 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=Z1EFyfpJay7EWFwsfrL7SqhObwALqYEYSsSwfkLansw=; b=GxAtGtaTEh5WCgoQ59DSy7yIaM1Ekm62LmxrXJN4mDawPGK/KpVmoXxAvZwk7HrA01Es 5sUThIrCgAeUF94XD5rv0esnHujoDOjE4o4DGFJaho3BSEnQ60bf0JsmNyDx9GdGKAHY RtwthXXJaGqqj367Onr6fyXEKzgjfdCPt9CxqgHTj7BOk2NwqeRu5qVfH93ep7bAO0wD pZOVBZStUFYZ4evvsFVTphDA6Mbdsh4AyCXNkKDhOKIkchUrcDIxn8crWJ6V4/uO6930 pT+6v14CYnQVI1cJOQ4KvRCdHkobpwTRBcoXH1UwxXisR+9TfHmC+EnLZ0Nkj99x5iQV NQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X6EVTWodOahbJ/Q2uS11qlzvDj5CnP+Qf6v3H0D4A7ZvL9CvolfYFcEaB++0yxamjwe4fJ4ffys8Ow5YdpWzO9Yh/AOBzgjljmL+M5gt9aFx0LRIGrH521zlqWbji4gmk6kNyN4Xgde08rH/ZnkjCa/Qdo4j6FqHuAGaIBLY8CaP8NhPl/54vRwlOOFFh9DLtGQSVFmVPnaro5etq6CADBWAWvWYqApvcQiDRXkWSg8XGfYmgTg95s/pHskUTQ0Dn6e82tSTNDJtOMlJmpVp+0shu3P9/seJGD4Nc3p5uotbQIZ0xHWdtDIO/9L3yrHBXJRRWzQqVWA6xeYh2xhoIw== 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=Z1EFyfpJay7EWFwsfrL7SqhObwALqYEYSsSwfkLansw=; b=GcyvshqrX3RonRvnfEa33UMCNaBPRNsTMBgKAECplwZM5CCEKGLK6oCH9XEPiK35OGfmmx2qCFq7FQk41kNp1wVZt+Lea5MMAaMcaaE4749fcFjKsF81wQsqnikauK9lh3LhEaifqCDHjixs8Fnv284F4WafDY7bBXvuEDCt6kYSEjZfJPFd8569rxnPzBF5NqKK4plqNCNfZFl2IyAjH+2K8NrBZTq7qWGLwCQAnmxzUTkeNfjshLKAEstSd16G74umEwPolkwX8PUPhaIX9xPP9BXBaICks3Iv2G7czT3tRMKfO/86kfOVVrFm1eRAltV4SF+AuNxYO7nPuBv1nA== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 15/19] hw/9pfs: Translate Windows errno to Linux value Date: Fri, 11 Nov 2022 12:22:21 +0800 Message-Id: <20221111042225.1115931-16-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e00c2cf-4df3-40d3-02b3-08dac39c74f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I640c3OTYecY6N/UaqREwrVr/LggXVXvHk+yyDHn+urAz5oQ/Pu0YHqrm8n6btrEp0UP6L7j77mY4/RqycaBo9OSAPAEV1HRO+9rjItdXMv4vo9Iv8lvSnytH7xAEoZodD3s2ZsEqI9wVL0bWfE1v7osbXHWhXJVoTb4rVn5KCkss4XePvv1RU9ItZA4HHPiTyfM1ot2TYb5eIqk+MuSDGFNNd3CE59h8D0KkF5Eg7CkOKsk0QJgd7m+ymvSgYEs69DSjQGqMYXFGKUTbXpU8d8MfQQjQEcyrJklCWXlO9fO3SMdnJlxNFRVhhgtoJoUkJfNiCs8o6/oV/aPh6MxTIrRiQNIFZbXVM8yNjfvoSFs4McapcYLi1ezlnV8jDHNqKtVK+Jzgk/g9jQ343rdv/PdMYV4UvW94EorPtdyh5LR5MMbcfjHUwPf4owHq+Oppg262SvxSiMoDZ1wAQJ1+g9Sbwd8NpHzIq4hphl0lwVqZdHP6j/bNNyGJ8vlNG4oaLsaYXVFu9TP/DIg2DUWIENcwrIOIccixjlzm0vcnfz5lB2S6fQbebvJ4Vo1IA3XFTGw4RmCnX9jxiy+21IYhOfx6UwlPvc6jHReUTNrO0B88O8HqEDtc23yq9nqmpFO6hHM832rgrWhoMdX0HrCIAAcduH0DHXcE231QyD0+ha4iCs8VFEaQwQtIQo9Io4LsTiemW4AfHDbPvSbadzHaq9o1h+9QZFN/Sn+kdMDWdgvnwv0W3ZmxuVzolRqhEsRAbjJLwUHksCTnCB7iQU2Sg== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yHlQR9ws9mEn7woPOcZyYbYp70teHuy7H3/ikhNiFVRIT41YkzCdal/VDofQ?= =?us-ascii?Q?E7MlLHk3sG6MNxLQ4LyJ/ZJJ887xMbbKIrBa1OFGgULYigAV5t0EFz6gc8hl?= =?us-ascii?Q?EHGO5NZOkxMYYGWcW/muTnByhyfJqXJpbte9v5DU8mjH81biRfT6o9xF3Czv?= =?us-ascii?Q?Rriaj+eQS+vKPqDoj+1yW7p2BpsMnuuG2yMV7OO3EBZSurpq+aWTYvJRKc+i?= =?us-ascii?Q?pyGo+bYKpgZga7w88wyrqzpnmYjjADBs807USCLQFnTiM7gfqKsTaK0JsAxT?= =?us-ascii?Q?0LSlQ0aQ1naqGTar3Irybt5VdlyYUKNBBhUqWKPl3q35SdJhcG0lCEbC2nLS?= =?us-ascii?Q?rZJnuDeL2nXh7/LMiuKiMZAQVgDq3o+kDSh3Iro/LhNTwScstnjFqyIJRBdR?= =?us-ascii?Q?18r23V1p6b1IxLGlNA04FAqt3IsX68Gj3/kQb3/WP73zbBuurGAmC6V40fpx?= =?us-ascii?Q?IE0bYYcv5RfEoH0Pn15HCa6n9OQsI083w3wYITE3IxR5vf0HpELT/NR6gpRC?= =?us-ascii?Q?ucrYEIHX2EvAf+VEl1wQEHoY+41VreJSIKcFvziu2ssjvEKhsQ/BgMKE5Hxw?= =?us-ascii?Q?9hitkf1hXTlTHjM6DBJntrXU5WKctJLL5ayuIHiK2KpVvQhc/bZKosCeNku7?= =?us-ascii?Q?div7NmrDU7/gtov7ESgt0FncJCyIS5EDnOFSNhTmSdW9XyymW3HjpLVWDM+e?= =?us-ascii?Q?xbKVhKdCOgL0rBVCmCq7oeh5yEsSeCHHPYtzdC2IyeNym4wtTVjMINJvtl3t?= =?us-ascii?Q?4OnzlvDg1AHRhAPjHv0y1tjwXOGpiiYqsmcMLtuoZQzrx5Jtoak0MqP5Itj2?= =?us-ascii?Q?LNvAdbCsmIc7fpBh9dxBjyyj8xe2xVcne8PnbjfNRd8Q/BBSM4PHr6rstHBo?= =?us-ascii?Q?+oGcDOyAmvYsR4IIMxkUO/GoDKvpMzzzooMKaUl2KRmrbjUAvjrlma1CJ1Bt?= =?us-ascii?Q?Y6UR//S1o6lmcf4Y9BiVPgFl/BFRfjcR1wJSKmpiq0yaeIX1H+E4Sez07WKF?= =?us-ascii?Q?szIL2xID2D96e6p8PM5i++c3LJhXfAFVUTyV2ZlblUL/gln/hLcdGCADM0iN?= =?us-ascii?Q?9lWBjosjvYWGsKT8jjSjf74k3gnS5zqd4E6kLeOnm4YUZt9DHUmc8EoaYdvI?= =?us-ascii?Q?4Ty6tTsLv63d8/b2d9uBr5bqQDsyz1mzWDN6iGYkcKQfYy8zaar2yzeKvknO?= =?us-ascii?Q?SA2wAV1UZmJ6KFK7OfC0xBSsl31NzQTC1ABp8q+F9LL0iK7y1GL69oA0mucV?= =?us-ascii?Q?XrkqP4zqrxZHBrsMlxpwjPvedSKc+krQNhKsSllNJ+30zz/nReZ/yQ7+ONPz?= =?us-ascii?Q?PHe1E1heOQXtVLmgmChzVNLwrphuRXXSMtqPx/SsfDTvW4q9eTioH3yrzGya?= =?us-ascii?Q?7bDsI6wKxzk26rwjcmiNZx3+Y6mEVjceZiciwuM4mUtdwqszpf+9gwquy0VN?= =?us-ascii?Q?LoOlQWC8D9TGHO6DlJwxLs0IoAMmFgTqJLExfdJ9pFXTXt5BIeJu/+tEDeQk?= =?us-ascii?Q?rpHLFzlrkIbc9WUyXrtXpLxz+Sw8Icf4X+ZD5iUot6/XqUFrl1vncnBjrFsV?= =?us-ascii?Q?Co6MtJ+crC9pQrFGouhVSEeyZOiWZxvf0TPf753n?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e00c2cf-4df3-40d3-02b3-08dac39c74f4 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:17.2215 (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: gWpK8xb1gih06q/xcteT6prL83h/4frV2nH3jXjRPzDLBcc2bZUuKOgNzmAIPGsBz2J0liHWbIvSxX3IZtEYOw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: D1eY8fKQEqr1TPajbr8NneuadcrEEqvT X-Proofpoint-GUID: D1eY8fKQEqr1TPajbr8NneuadcrEEqvT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=567 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140717318100003 Content-Type: text/plain; charset="utf-8" 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 c76a53f2a8..598e2980e1 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 default: g_assert_not_reached(); } #else --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140660; cv=pass; d=zohomail.com; s=zohoarc; b=SGc130SLPTWArU78B0cR7FF1dAU6Sab4EdUudlIYBkCKOzs3A15hdpvVIprFGonbnjK+cElGDjl1cWRF1PwYuP72QnbgdcQCXfu/fb6gyHdYx7HqjzWBWJcxJDLkuAAIhYajV5W3JHUmgg9AR/UoWUFVDZCKNdGQmXAJ/x+W9Mg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140660; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M2j3E7ngWrmbtYmE4yi5nz0iPjbdn8UqvgKMNy/r2a4=; b=ZdKWx8uxTTj9Nlz7jAjUatXT7pkURhAkubnZXViRs/x3EnyvOq5jTgc8L/gAoBt+c6jKFPL/oziiKAGvvbLW9UXXJOEfWDoCbrbo9EA2S9ySprQUOle+rMkfyFNQb8YdjBWZhuEZksLb/H2wAb7HrJlrGyohoO7gEv6PsSoKrX0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140660062278.59093459138444; Thu, 10 Nov 2022 20:24:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZp-0000d5-Ed; Thu, 10 Nov 2022 23:23:37 -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 1otLZn-0000c6-Vx for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:36 -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 1otLZl-0001cy-DD for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:35 -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 2AB4N5DO004957; Thu, 10 Nov 2022 20:23:21 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9me-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:20 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23: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.5813.013; Fri, 11 Nov 2022 04:23:19 +0000 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=rrFiNqgNy6ptwe41MA506wGEz5vPr1gNJUrX6GbxeIdOg8Hq4VlF+1wIgliNI1b0oqM5 BPRcrT92b0X7ogp/C1Swd+rJo2J+4ruWd/nw1xZh0uA82KDYsA1E5P6ETK2yLJLEfaUX jzgCS3fEUmYNHh7vjPbZLJdMq/8Q5XtarP6HiNdpvZw5rwSVl8KfwtNzqI81UvfyLQRq ytkr9zeYcdM0FjvZXEazshVtvzjTVQDOcYccoFQyr7O4AQnCjZOIOCJs/T0TsqhxM2+g 6IYye5Skl05LXYyjvzsAex1JXM1wlggqneQAcvBqZI8H65Nsklp/EXvur/YyN4Wo6Tpa XQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPxVvyoqq/OiE+9Eq8EqRkC2pLAzjmmvCGPYDustvyTfYEtRhEHodGGfx6cAL/zsRCM9PVjxTRCSuOQYLQYJqGIhZrSGC5TrrjqSPIFCDqUge741JEHP9BQIHaRmeXh6Q6V9I1MPPqkY4DTspUqlGToHTQSB0vWYoe51xeQL5Aiz9PWjLiI4cZLYLv4ugwinNrNi9KnTuBr6H+2jymHXm56quSfo9js2QBtgqEpJ9LykIiDEUnm+6KGzl/hJ5gOuqfh1Y3bdhjuR2sVoFf2Y6zokIWrZcLjR0ZODz6Y2smFCHPF0Hm3JCGuK9zsCkpJTQEKifN9IB5ItbtTpjXoNSA== 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=bC9pTMbLZSK0/9AKHpg5tzZjcIZalETD81y7dXf1PFv8hbjkVK2kZ8qagxcTfTUoPB8hQrTGt/4zsoZs6ndYyYObs6/5Dyb3q4kmldYF3JdlKOUzZzVjqxxatDIaG/kCluQ2GZV+rSej7SqeL5qEJZ8znk0P0jgD5vWCs28tbeiy2k9nOWGB8wFfrAhWMUB5z5xWrTx1a/rCczt2HnSnRsJMtM1DVlAGDViL9k4wWB3YVichYkijHsGsn+zgF99oqRnrZvDGVrWFQ9Ap5ndMUxljbWkxQdClQRVyXoKFTk/6RViOh32gMVhLGeyQaJ6B+rjqMfACy+4LyyJo6Bydnw== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 16/19] fsdev: Disable proxy fs driver on Windows Date: Fri, 11 Nov 2022 12:22:22 +0800 Message-Id: <20221111042225.1115931-17-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: cab7f9db-755a-4f9c-b7fa-08dac39c7620 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j//FDTAYSQwZ9tG93H64GtqECBxGuhAPdaWePLZ94huLTB8P+H8x1IxFjomT1jL9f2CYnQe1IqKOhmM6bsiKz2VqrI7CvVhtsLY/+rcsJA3XaXPxTPrghasP53DLPk1YFk7yIcLWD8T8Bkji/FJ2dYpfRdBfzGjF49/8bDRb2x0sO0RX2EEjrllF8C8JO1Dg79MwdvhQaM6vXpwxpcMdaeonP1TFuexl5eaP1ujBnVs/tprX83MgGICKp1HRp1NAu/B6tPZpr0h9pzlrXhmNyN/MEQdDWVSfIRNYnOClyzUaWvZRP+sXVMweEenCvFN0mHZPQi0bJp+zYWPZ6R9TsqnHIiXOLEa4R8zO1j6VmbMTaL8QqaHaV+NKHeX7nBGhqWtDnnwZgKQYolBl2FoWcMEtzzTPcyYvPv/20WTVygXUXCxNjKxOy8hfF3DAZir6w+NL6uezskk0KghcDjDD8Q0SCm5jNWMAP75vlAODnVR9Dx8jncREmgBc1yGqWYa4VUZoHNZUVDpckZ1BUSfHqjVBonDJAkEmCmwggaTeXLYk1FwkeEPdObIahTRJNPG0XrTdIA/jJOMcIho2bvmoEfokXV77t2hS+vyaYSy8cqk7v3Cjdc5KIRYQzLERLwHq6M4YLeKhBlonZpYlahrfI0kWs4LWmu9ydW/b2RVEo92xMAkuHTHvHieFFcriXYatyEgGnJs80KySEOP8QEbqtICxQSl0gJ1ecSaThyOnWqiXuGbl/9411XFm4L/7nbkV 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(6666004)(186003)(6486002)(4744005)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?wgJ7vwcOGoQJ/eUTlS4WQ13iNiG2kBWuoSoaors8eSjExVrmobNFUEnXm/wI?= =?us-ascii?Q?fK2+Y97W1Xi1Ev5nqwceQ2c9KaPHPpxE/lxvenuQofYg9Ov4ca+3EUs60DjZ?= =?us-ascii?Q?cczNSp6++CRg+qiQxmVsggUP/ACnygSOaUKj40B2fxwxvVIUhx4EKTju49IO?= =?us-ascii?Q?JYX0PdWPvPKSwq1ILyxA4sCigy+WzP2QCbhG0eYhCcTRb6vxD1iA79M9+iw1?= =?us-ascii?Q?fYzlPNvm5Lo8wARxNkcuAVZHwfIT8OPzUnrYyQkyEvvKUaO7S0/U29/EtAxQ?= =?us-ascii?Q?xxvBq+iykI8Zj2tQG/aPy4C5fIQ3Owdp6tN/iYLrFgA08MA0/nkmGZQgwAk7?= =?us-ascii?Q?RxtS4kUUte97onXa7MQgyAFIq2aEjLyuOS7QAKS9TfyqSfTzd01OQrL9DRbt?= =?us-ascii?Q?bPhcx2hgf7ncsPeQgdtVcRZ6b7qNpoX4R/Pt8lgZRB20WrM12SRfdWJQDixz?= =?us-ascii?Q?WgJ0TALoIT+ZFa6gSRnNwtzO11PXrCawmpt/0d/QpbNGQ8dliSmPHYppve/Z?= =?us-ascii?Q?ZiO7pYirJXN93Yc+puhpAfyo2J3QMK2qepSC7jmZxkbWbS32ciIhXZ/ZhKzC?= =?us-ascii?Q?KmshOvE7+bVTFQ/nl9T+SBmDFcbpzT+2ZElXJJ+A/aV2OwNV0warNczJO+yb?= =?us-ascii?Q?VZIZHHMjnllCkie9Qc2Tx5sah0KlvXj2joXCiWZSa5c6zLUf1k1/iEz20GjE?= =?us-ascii?Q?mfMMFqpPlLnL5OWMdpia15p+1k2lANVs5cNlV6tgYCdK+VoWDEfS8H+c6j0Q?= =?us-ascii?Q?1guAEKaQ8XIN5WmQHHtaWuas32G72a91pRkE+c5MBEhlz48bKThgQacqijY1?= =?us-ascii?Q?Naeq7TlzGY9qgv9ICJOgJIrxVWixyLXsZQDaqEh4qoq4GMcooU6MY+99mCQ+?= =?us-ascii?Q?GYDhOWi2S6hEuYNmXUqLi0YwxGcukcS7CuxJiDMz87W0Hbfj+mDFGj1Bx9WP?= =?us-ascii?Q?5DPUywPQ5iIEn0DdPNe795yZWLTLLLZSsgbDdCwaaum7fTFefxSlFY0i0Fqs?= =?us-ascii?Q?mcDikMNtDxdJb0FTd5Ud9Z4eNH0fCaD3d/P0n/j5hfXWkBBTjlkyXw6MZiBn?= =?us-ascii?Q?VdLO/O2nKNrHMNz0uU2fRscEBjvqYnFE6HZGWAx6VrpwCSHkv6553Vb5w+15?= =?us-ascii?Q?A9nO/2OBTYL72PgI+4Nylcg2L0flpiNPWn1FftlnA/oGKmjDzxNgknXZy+mM?= =?us-ascii?Q?LeF70J3yd6858F12l+jK7CGJl9eKT3OI+fIl/DgCKZY/HOJm4wGCBA1ONREJ?= =?us-ascii?Q?zKmUFDvrIPCnRmHNt4GKyl3v9QPZojVhPcJVOgjT3qpphHcRIfu/OFqu54fj?= =?us-ascii?Q?JoeENH6Ft7nQZaM4pgeyTSyWtLpJNJyBhIZBtNDoe8ze+A6u6Ns3yVwzh0Y7?= =?us-ascii?Q?CSF7tl3rRrsjsNnzYlsAmcWJxWgJJkjC5lM/vcIztjWd5MW4yYw65UzqJFwK?= =?us-ascii?Q?wTPOyFik98plzhq2nXEAzXpHQU5Dm4P3Fvho2ffJk4UWVMzkDCf4rUj5jC3A?= =?us-ascii?Q?5YL4dmedXhblynLUgZOeW7lKNHjPn9MujoS3gPBGMRALSqNgOJ74J/C70SJZ?= =?us-ascii?Q?guWTVTx/ySfSq+pZzf+g/ofGACLdWCWhwZ3IzZGC?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: cab7f9db-755a-4f9c-b7fa-08dac39c7620 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:19.3173 (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: XTAICLoncrPjpCSC5zoDgkaXWJVjYJcr7ooGK2m43bV0NB59f8YeKykyAvhXDu4BSmvgFvsfnwzivEwustNOqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: nz3w7gHC8Qe2YUut-a2lPVKwbA7Y_I8E X-Proofpoint-GUID: nz3w7gHC8Qe2YUut-a2lPVKwbA7Y_I8E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=582 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140661136100003 Content-Type: text/plain; charset="utf-8" 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[] =3D { NULL }, }, +#ifndef CONFIG_WIN32 { .name =3D "proxy", .ops =3D &proxy_ops, @@ -100,6 +101,7 @@ static FsDriverTable FsDrivers[] =3D { NULL }, }, +#endif }; =20 static int validate_opt(void *opaque, const char *name, const char *value, --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140686; cv=pass; d=zohomail.com; s=zohoarc; b=DnhhNqbYaPS0f0cXxAhmoYOBYKMbei7zcs15nsDuBHIclCLkAyfqCeu2akZvBum3OSiimavQp9uAdY7c6gE3lz7Ti5cm0Fa+yVOX8wBlZ772TRaxSXyw5LpUs/CGrohlif2REW/e1k2WQaOswv2Y+f+BKJ1rJJXRO7aRBKIJFHs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140686; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HhvM9ZgPJi+DYq8Q/mtUG28QrtcJGsvXNZ7mGlaWzwA=; b=L1h2fDtfOvP3eE8fjxQlhN12+1pxKnSm9B9ayJDUTKUz0zjsxF+zbbjCG9xyzB+70uIeUm8fixioDNkHtqVOSIq8D7f3dUpw7BqfRk1vZRHMfncE+N5qorta0U9zjumc2OKhTx618XwEkPCB5szzjHsRRkz/k08YmJ+0hfHbYiE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140686817438.9945364112647; Thu, 10 Nov 2022 20:24:46 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZo-0000cv-PC; Thu, 10 Nov 2022 23:23:36 -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 1otLZn-0000br-0T for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:35 -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 1otLZk-0001ct-0m for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:33 -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 2AB4N0iQ024928; Fri, 11 Nov 2022 04:23:22 GMT 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 3knd21ndvj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:22 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23:21 +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.5813.013; Fri, 11 Nov 2022 04:23:21 +0000 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=HhvM9ZgPJi+DYq8Q/mtUG28QrtcJGsvXNZ7mGlaWzwA=; b=q/hw80tBuoKY8YQcpRgVzOvoXSr8UmIkozjr23210Et5+m6TbRLjS4TSfFqyO7Ey7Z5+ /jFJCxiGakNAk0DOu7nbYJkmjSJ8/3pTBunrm91hkffXNJxtkSTz7gZE63DkKHGYDcB9 BFIQ5x/pDSY+cNfBroa46O1W51+QwmeIC7qre830N2S5YgP1rmLizZ/ft2YKb2HHDD94 5Y/Mj2JnEZYC6C/MR5D7jfWHauvgguQXqZyCB0f1YBbcZA2rYaG5oZufVn7gvso1EQIq wZjOwMNH2bb2k1D+EUsc+q3twGghzuRWd6dE8Tyi2hf96x7mPpYdE+J7bTKADy8dl/QJ xw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HJVsus9I4zlYWjW3CilfVL7Nya87qV2ZjMvegaJGSq2OQoFOxkrgYxtGifenvfVIfj07uvspvmsJfUJlz/oUemay+Eh0FPvAuskZGSEOpXesaE1AtipZ46TJOBlpjOUhy65l695YCBBREA8FQxTHaiXv+bS0e45Q80Gjr8/8GQF25g19d02sUvPYgsJWoW+rUZBJNktshI7zcUpE3Ovk4T0af4wwEsTTvnyNA/cbQMyEDaqSo1Ykoajh5mEwSRYfSyzZkRHWQIwRelx6uhMrds/FtkIx4F7f7sa0j5Qy/MwsQdJAH5upehF79GJs2ge68u+L7bfXl7OH7boz1Ka/gw== 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=HhvM9ZgPJi+DYq8Q/mtUG28QrtcJGsvXNZ7mGlaWzwA=; b=Eb/V0peuFcXv5rJI6JT+nKGf5VYrTvWnoJLqCvsVqfbGMPp6z8ObO60qo15+bQQ+ikGrtxIXbWQRDefZ7kmN1rUFBTg0UIriQXqxiyUxjidEke8Qp7Vq8qiR+xZOaxzobFLjuy05gS5e/xJ10qHOXG4udrTDUfZpobMtVG/NP+QyrtJVFQ2zUJVSs+u1vU+aeZyZ59gQGENt2WldySIce6xP6uI2AL8S9f1Yf4o/G+f3ZsC6wuRNcnGsc/q8e8T8D6kktsP+9PCSNL4SJ79mAiIS48A+UMte6kyLGzqVt5yob2CKO+x5p+RFS19dubJx1NmBvEP6as3MEmQGE2KzMQ== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , Greg Kurz Subject: [PATCH v2 17/19] hw/9pfs: Update synth fs driver for Windows Date: Fri, 11 Nov 2022 12:22:23 +0800 Message-Id: <20221111042225.1115931-18-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: e1482a10-dfff-41a3-54b3-08dac39c7760 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MCAIxJhSx8j5j+57bsNU31y1fZMDOCD7hBma0XHYNhAaZrynTGc7lhEqVlw4aRF9kdBMglQRhFixo3wV0QUC/Dh63BgSZ3ic2cTiXCGhYeI618UIyOICZvW75UGAOLt3ecx32ZRqR2sJnIDQ+1I6c9LFNkRVP/HjMpGN4l4ntz7+4HIoKHl5h6jSy08vZ8z82zlISGXkhWy0MjZzbUs/UfXfzBUZYaBtfp2NJnixpIkl8qyDWcUSIWB6+cNKKvR1WVo9O3UXmQ+RQuv76DZcM8TaeTocKdECGZSaQG2scCDK3aG/jhjLqNCvk0YiayRBE6Vz0Dvfe9ovia6mmBGRbWd7j6c4aHubKeltM7QU1LlW+esxKlF2IB2aOBQ/NKyaPP4DFIc+vtmzUDvD8l47Na4IG4ssymOe/Y5FpKpWzf/du6cgIKTvBZYIaMFn29B+3ZxtERs+S4Jgvv7qNcUSnDxwlxDIH1ILjYvTypOTRc/cJuC/NsG6LccLXSEmd49PUX+TCgFu0x3ThIYLYkQpeJnki0Yq7H7uB6uo0NrUrhvnVaL6abNbP6VPNOWZmQ2xNJJs/+EFwAyTw2SNpQQPlaRxJs5FXiBQnOkZWj9vGG/6SBFU5kJbhyX6Js0aU6SONKNdXy5r+teOL97/17GtEZiApgbqp8V/67KKsI/cap51UWKhmhZ3AqV8qPKRJpDtEIN4bMvQH7JOrF/Fgxeo1137qaPci8OtaKJoWY0AWA52nnIjOJCHlmumHXzOWKHogSN0nrENMLVD9dTanZGzUA== 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(186003)(6486002)(4744005)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+HXWuou49PGT2cJKQpH/+NhjYzTVHK3ZZjVI6ynk10KR3ORpugBJkoSgqVZL?= =?us-ascii?Q?ttwJrI2oRuSuQGdthp2QQW6QUbDvoMYPnL9kicTh0VB4QTaK5/uKqMJ+C2oO?= =?us-ascii?Q?RZAyOx/+UsU6NA0GU7u/n1xPKY7YsOJ0A5FOzRMd9zqjqq9t962oLRd5QKge?= =?us-ascii?Q?ZliYy0xCYnmp5rU2ypXf9Rqo5PWnX27STJU/ALxKZP2z19echCuhBxbpkXLg?= =?us-ascii?Q?nRz5XesUrupIBX7A59mU6Yr3eNyF4m4mKyt6lqGeuWTi/RWo4oi/JFfXQQhw?= =?us-ascii?Q?YG1WlNXj92w4eaMFmUosIlbw9maVI6hLHxZyeizYhUqKCtDaKvHziQqs3AhA?= =?us-ascii?Q?YK8Gs7pUYX4wEPASX2W3G3zTWMf1Pph1HJI65/aP+gA0kRS2bWTiJofmPY7a?= =?us-ascii?Q?pIU09SyE5/Gut4couL4xxTjQp2lq2/mvyzgIcoYHW4wvqpF0QGge4GIxHkNQ?= =?us-ascii?Q?1ju+pKwY21kym1dpUarZ4bu9ND/zEKjLFs/nffYfIczIfJExqrVzFXXHEAER?= =?us-ascii?Q?pJP1VS+COqbid7hNV2P33hISJw/exlRzlwiAlw7/NBELTwcXMrfAo4YSH6qx?= =?us-ascii?Q?o1ihiPcexg2Hjtrbg9yAA2tufn3CpPp+0G9Pf8vGQW00646R307IWpVuuig2?= =?us-ascii?Q?amvG9Szaa86v7M34+DRvXKon1ELaTqhwy2wTRaDMqQFoVS4882vro2qyEsPU?= =?us-ascii?Q?kAexu2fbxpnr57jj3QAc8iq7HXL8Y1WquW6g+EvZ9Mqpo/AqBvt4iWfKLqSP?= =?us-ascii?Q?JoH1p4eag7/Ah2vd7m2Qx6ugmGInr6Qhx9KfDqH/MN2XWvtD4P4RfJyaOc9D?= =?us-ascii?Q?basoz3Qgw5yOjCT4jm1qCo7ThJ6wU9W1tiO7JAW1r5T4MsR06r3e6Km3sROh?= =?us-ascii?Q?/oqQGqzPvbqwWR1lvIcU6kfgoVNEQij0lmCJ02urfFWBsXwSgwysjVR6MOsP?= =?us-ascii?Q?dL46ug8q4wXmPU7V+/1/IF8WCBEbdoFMTQ4HgD88c10qFB+Fvp7a/K6pHgMN?= =?us-ascii?Q?rBBJuDO2jk5mDdK4rcHCYA6cpShUBRkjSFhLCi5PZq8hHC+3gKnG05PE62Vl?= =?us-ascii?Q?Yn5qoI2S2zVN3gVNVHFLgL0p6UfHacgk6uBWsxuAZLb+F2UbF63W6JqLg1dt?= =?us-ascii?Q?UAk5Ol80KOw/j9Hnx4+haYTsS/EyP9IM3FX8MifWdVMV2QYy705h7McJtvDa?= =?us-ascii?Q?kUZpfrzhZt4AyPwd0r7gu3tOsMlDnRR400TtUz9VwOU89DNZZXenTzOheCWT?= =?us-ascii?Q?dhVsY4Yv92qcIdxScPGxVbIcYzyGuk5t43Rpt6umwVY1goAWYXUPGLzOcQGo?= =?us-ascii?Q?JM2N73doVJmIgOv22AY03dMGdUkHa4SwQpsMtVVs3t/LZm/+NJObbtWHPadP?= =?us-ascii?Q?RlMX2VkBKwojRrwpMWYsPl6k4qQGendJzYyPhOQ1q3/RnY1GvwwXaDya2oYZ?= =?us-ascii?Q?TSfqxD5xA1ZoAXBfpZ+5F4rPu1PqMRwGkKxpqcZCzNCUIOnqg0JWBRetPHPV?= =?us-ascii?Q?7iniiBnD/dzZHsfYu8fsD47/I1Zp0J9m7a4IxAIy9ye6ioKG+cqtpi3nXvQE?= =?us-ascii?Q?AzrXYwKOLcXNX37CaARqOenu81sTvbkwJrC0TAMb?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1482a10-dfff-41a3-54b3-08dac39c7760 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:21.4118 (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: Edrd3YhQGIB1BLCo58/uVYa3pcbfVkRKP7f9/QJB+4VWxaMGYCdFdpOJYVaKm/4e3S7Qq0s2rKR2t/LjRhy3mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: 9bmFtbLuG-VQuVSyOxWFLKdPzeK3MqPy X-Proofpoint-ORIG-GUID: 9bmFtbLuG-VQuVSyOxWFLKdPzeK3MqPy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=946 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140687139100005 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- (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 1c5813e4dd..6d33eb1cf3 100644 --- a/hw/9pfs/9p-synth.c +++ b/hw/9pfs/9p-synth.c @@ -152,8 +152,10 @@ static void synth_fill_statbuf(V9fsSynthNode *node, st= ruct stat *stbuf) stbuf->st_gid =3D 0; stbuf->st_rdev =3D 0; stbuf->st_size =3D 0; +#ifndef CONFIG_WIN32 stbuf->st_blksize =3D 0; stbuf->st_blocks =3D 0; +#endif stbuf->st_atime =3D 0; stbuf->st_mtime =3D 0; stbuf->st_ctime =3D 0; @@ -236,7 +238,8 @@ static void synth_direntry(V9fsSynthNode *node, entry->d_ino =3D node->attr->inode; #ifdef CONFIG_DARWIN entry->d_seekoff =3D off + 1; -#else +#endif +#ifdef CONFIG_LINUX entry->d_off =3D off + 1; #endif } --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140892; cv=pass; d=zohomail.com; s=zohoarc; b=dQr473XgNKsFKxWKpufT4vpdtZDbtFub/dhNmDPkjBzguvik3e5v2Bd8x0dqGs2l+zWztTVr3RG5DFkkloHLArE+wU/VHK7q2syLupbqojr3rgDh0Vh2EsoN1YDzfmjaAgztas60wmPS6szwgjR2OffPILeoXZw11PTcb4fzklo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rysNIk6lSMrISHuzxrKLFd7qLEqSoQDKkPP11ae2GJ0=; b=bu5y1VtvQ4eHesHJgqq3NOBbaKBFgHgdMKgTaJoWSnNaOK6JAhVtBQavUPTVM5QmvVYbE+Hd90/mhMHDinVPqaJ+KqZOU82nQXTX6HbE2llABq5uyvi8l4qXfWtmaD0jXjnchCIw1iyR9C2clOwf+pBEOzn3CmJoMeA67kDy3+Y= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1668140892761372.5251513441975; Thu, 10 Nov 2022 20:28:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZh-0000af-RK; Thu, 10 Nov 2022 23:23:29 -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 1otLZh-0000a6-5p for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:29 -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 1otLZf-0001cG-Mq for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:28 -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 2AB4Fv80025971; Fri, 11 Nov 2022 04:23:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knet9nbdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 11 Nov 2022 04:23:26 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23:24 +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.5813.013; Fri, 11 Nov 2022 04:23:24 +0000 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=rysNIk6lSMrISHuzxrKLFd7qLEqSoQDKkPP11ae2GJ0=; b=XGlfooJs7m9vWvprOy9lfU8hiQPX7hmXyJsmeHMjSpcxUAnt7A5YkqVCsx4LqMusqpfl n+wQYSrsapYxaUKjeEMZepb5fry3QxOokDqfw4YSGuOHySRzUQB7cmIKGY9Zc7xZ45tK SI/g3RrmAx1riyc9VnaHqnjxg1U1rKvXWoGv/SfXArJvrcdiyZ5kDi1p1FNzEIaHptf/ WWcr7vp0nPMQIqYCcnNMP9eVSJCJKlXB12bgPuCSgnlH5q45uYrPwTIExvphoJyCR2g7 m31z/Pb7JaGFHO9ivkX7EeXp86FMLy+h/6YSOZb1Ny7US+U7BSxiQUaeFRLvpIEvzxTg gg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RP0T9qz0Y7XPjNaksTSGas1bc0LqOKN2urrRoHQYNkrVSs5/ktTSpCGvVtrDDZ24x9ExcBvZ7mwr1WC3npAJ/DoR+rzJKWbZrkYYY1Oqo47AYhKCj833i5otGf8yuiAvzciu11/PuYuLB8OSxdxGq2VXkejpokIkZbrhTQYZKPCGemopalK0Y8yWBsFS85ooRxBFmVryk6WBaDLrv132Rwq4Mr+Uyt6vIJj1r2rPwvI6gctVc+wxTualB21clfakFrQGHuoEfJNOOIq8lQ6oyKpXqF2p0t8u+EEeV8tBjKrXKVBNc1+ODkRH3+8YXjlgYvVW7ddUgPJSrD6tor10kA== 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=rysNIk6lSMrISHuzxrKLFd7qLEqSoQDKkPP11ae2GJ0=; b=VvxPnAXl2x98TebGKqz3dc9uUVIcyU4w3Uoyk/5IaICz17GPTshmLd1YtChFd4Ise42FMc3y/5342iu9CQez6YH4mbDCwIE8OOukQdGFrTEUz6Y1fFPNTPFpGo5vBaB8rWwCrEEa0TSjbiiEWJ8sl4KsTznGP+AnL/2ospGuVN03pYq91462rlVmj9PHETPm0A+g+zoDI+gdzNyshGh3DU9XklVdNBe6uZj3q+xFknRJ43jD2p8ewANUApeqhRRI1B/qSbUOl37QBYvqdLO/C7ZHH2PLFx2vTkC0utQNd+q0hT1zPrXHw1wtZkKtOfZA+gecN/jtvUQ1+0CB87U6Zw== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Xuzhou Cheng , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH v2 18/19] tests/qtest: virtio-9p-test: Adapt the case for win32 Date: Fri, 11 Nov 2022 12:22:24 +0800 Message-Id: <20221111042225.1115931-19-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: c08acbe6-a7b6-499a-aed6-08dac39c78e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yWHcTcuH0xXVcv0RcBMrptJqZzZR6+I0Pdq6P+oKzwa4dZydrhDh2nHJcHp2bOAPpwieDutl1FPeeAiktaRkszzBHj2ngyHaeQnb8dW7jpyvHhDLDPjGNbSGTzCS36FiBOplQMpLj0Gd/w31MOVAyANVY0Jna4/xhuE1z8/A61U/RVek5JorwD/Jt0PY+p17Efd+Gdo4QzVEaxvrG8oHdkD126Lap25/cFgHkQ6G7iMRCBos2yvgeYywGMqy64A3elDLfNUk9o77ThTSRdxcpnPblRjRqZo25M4yj5OsvtPGKgZQBEjzI5PZpea+smfiQ3TFpPR+bU4g+aDYJbVko15nCxlYdocKjd1+IMLD/KPFpPDhhFY9MY1RR5F4iWzItgcsWM3qgMs0s4rjLG4edFMcjXNQ3UKa+Asyvor//iEbnAG9WzvhrPJvWMl757Aw6TnoqBt2temECW5nvOvLwHRQ1RWDKv5iUI1HhJVYtQ7h0c7HwWdsavus9kpNgnwacHJIfdJv4+F8rOlGJ4FYot5SkSgT1KjNVSek99ZkOE3BgTZga7UDqjX/kQYLyOyyoqT8EgNknwh+xNJURGc/IxwnPRfWIAGHz3vErGVKPlE9vi9T2RaSQBQLuhi1WuXgWrqg2iDehQggWt+nPrsqfjAzcejVLWttpsnC2ZxMXe75R4sZadeMR+zaD57sGqlj2cKaXMVmusaDXBY8ii30eokwk+b7tJ4NuqKaab5Bzh0RmFQN3UDD6EionRmrJ+xc 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(186003)(6486002)(4744005)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZdJf7Mocunb6LeUVmgFuZoc75xMoAwwtlTDya6c0fEYVIWkq9Xrb0kBPM4MW?= =?us-ascii?Q?xEcfo1S0i6hxaD6VIh34nK9eLzzSgAY1nj5dpER3MVCvlg8KNV23p8Xom4go?= =?us-ascii?Q?HeoLIFgHOu7QXZC/E2pTLn6wvlYe1b7LGQN2Uz5fjyo5zOXAhKiRFpFnoSLi?= =?us-ascii?Q?ohul6atN91aWaLdylk0Npq+I9K1Fe4uou5YRSgzEv2izfmsKVjws0ffVRTEU?= =?us-ascii?Q?r8DtanaWPA4JDMFyDlBHYhcy3dzdMUg/1AKoIYp7kxvcKfJOf+llZ9pN3QB6?= =?us-ascii?Q?MMLDNH/h92nC0y4nlf4Ebd+1Ym7Uoypbm7NjALT5x2QWhwcxImh4pNu0yRW8?= =?us-ascii?Q?RLWCOQrWrE81M9zHzEKUpq5w4euDkIxYTmMKGWTBX8o4oq7HUet4tY7eik5b?= =?us-ascii?Q?jjj+ecpOaXWnxcTGcvgw9ay5kfRTp/GTFwvnq0pyBWYj9KAHm1f8q8hwzVFY?= =?us-ascii?Q?B7DN4Of4CXw7fw3dKgq1E6dg6rTllYPxPCDTQMr4aPDcSbEHuAPaCADQ+tur?= =?us-ascii?Q?gdSWfJklEj0LdgQ+KdYjdp9LCZ3eou7jqMN8xFkmgNm+ygOHsuoXq7c8vCQ2?= =?us-ascii?Q?li1wPXfsB3QFnOTf5JPfpzcDb0rgoRhtD5jN4strcIQf+QOesH26ui7Q5BWm?= =?us-ascii?Q?+HMKUp4qQzBRdh6HM/K9niKFSizKpRDgGBKBDLD/UKFp6UAcJ2yTJe2pZN6o?= =?us-ascii?Q?Zoz+Y582bcnykDJQ1F3JAN0rEAt+zYxjUxBwNnzBYZz8ZK5/mdkwkewnjCps?= =?us-ascii?Q?OWeBSA8Sn21FWr8VuTLfpuNljl+K8spcOmKu923BYZW4ZiBavsj8bxdOLWSr?= =?us-ascii?Q?EOApGaq45sXy8e0rDBb1Foqjg+TCvGZ7uW0G8nGo2xoY0I/6DZN357vL7HNc?= =?us-ascii?Q?17iYAtPUF5n8f0eRGVuhRsI4/yI6X45jnKwpN6+jUHOzAcdWqhSdQVsvsfl1?= =?us-ascii?Q?9/nSCIiY6nwJd7gxxr2awp1GeTtuiLUISiQvcAtxugFUvSF2xyGqxoz4Goxu?= =?us-ascii?Q?RRsDiure7hUbotCVBUq69lsTf1R8lQjM/CjuoiiXRhBAiqq5LaYKClj3bwt/?= =?us-ascii?Q?fIb1V3sFOCWfsB0i1dLHecutgtmo1gBOhvChS6UnhA6sSx08RG1Aq/s3SfO6?= =?us-ascii?Q?v8m7dPOXIGzntEQb37Hwv1R0e4qUplZPOrzYpCs/H8F4qtUYMHHvUKeHeuZa?= =?us-ascii?Q?9IIRJJAQ8Z8at1mgTus0JEEkA8KWvedyejAMIm03dvNFvGskkVe+Qd3qB8E1?= =?us-ascii?Q?OhI+CyKIf52uMnzIxuNjbkkI5kfAqDof1McFoWIMnS5RAft0G5QvA51Yk9DS?= =?us-ascii?Q?oF32ORsDecoHIO2lPmYhVb43kaE2LT9gslUpKe/B6k1ziJ2wWqV8HI0w/28x?= =?us-ascii?Q?a9Mj4A3ml2A8GXl9jaTHI1xpoeexb2tN3Qs2H8fM7Bs1olgmR5rPUk/TosYX?= =?us-ascii?Q?r6L4KffB3vlWa5nbsd8y33dWkp3NYuHpeRbLmlCKZSw303I/9zxDGqCF6ac1?= =?us-ascii?Q?vlgimaZzCB+GAZS1fZPfiJMEKFu+/4aNMsnIICgPDQDl9yqDd43ixc0CpDi3?= =?us-ascii?Q?ieAl6Menw+VJO6P8318DA2hEXf+HP3WoC9LDblK0?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c08acbe6-a7b6-499a-aed6-08dac39c78e6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:23.9700 (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: qaZlMGgvSyysbFHHIuzQoudwHqS2CctCmwsICCMaGh+pMYjk7NY/L2DWCVEAf5Uc5gNa5DkSHD7d//J1U1kK7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-GUID: BidJZD_F0LqKIfWYF5PqbRVmjIM8XvRl X-Proofpoint-ORIG-GUID: BidJZD_F0LqKIfWYF5PqbRVmjIM8XvRl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 mlxlogscore=992 clxscore=1015 malwarescore=0 phishscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140894264100001 Content-Type: text/plain; charset="utf-8" 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 --- Changes in v2: - Move getuid() to virtio-9p-client.h 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/vir= tio-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); =20 +#ifdef CONFIG_WIN32 +static inline uint32_t getuid(void) +{ + return 0; +} +#endif + #endif --=20 2.25.1 From nobody Tue May 14 08:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass(p=none dis=none) header.from=windriver.com ARC-Seal: i=2; a=rsa-sha256; t=1668140789; cv=pass; d=zohomail.com; s=zohoarc; b=S0Lu849dCj9GrOWscPwW6J4GyryE4h3j3pmtNXOASn/+WGEBYSEsIvYhpD6qgid+NdC+8dBF8xjhfyWiLYS5f2uRPbtKuaMjnFD6irzzt4UjwHdO4frK0VeMmRw4kRUUsivvR7RUgf9Lm/M0St2g4Qq/9DwWNO7R+pYROFe+2WE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1668140789; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SXt4gl9FGVsN8kbuRE4IqSPgVdcZ+ICXN2rhjTe/dE0=; b=mWBCSSINP+fURsdVhFUnYinfzkOu5B/oYPqfG6H72/6NZy9nlcRf/WxF5M4sHbNWXhcJ2PrPMKgoypd3O3x26Pc8mMLz6yKzomYJ4yFBdtN08KW5RM5ToZn41HEYvT7G2gipEjkPksAcMLpm4zB1d/hLR0Zj6I2sLq40NFtKtp0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=windriver.com); dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166814078969887.87213080067227; Thu, 10 Nov 2022 20:26:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otLZy-0000qf-Ap; Thu, 10 Nov 2022 23:23: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 1otLZx-0000o1-2J for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:45 -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 1otLZv-0001f4-Av for qemu-devel@nongnu.org; Thu, 10 Nov 2022 23:23:44 -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 2AB4N9pv004974; Thu, 10 Nov 2022 20:23:28 -0800 Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3knk43d9mf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 10 Nov 2022 20:23:28 -0800 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by SJ0PR11MB5102.namprd11.prod.outlook.com (2603:10b6:a03:2ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Fri, 11 Nov 2022 04:23:27 +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.5813.013; Fri, 11 Nov 2022 04:23:27 +0000 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=SXt4gl9FGVsN8kbuRE4IqSPgVdcZ+ICXN2rhjTe/dE0=; b=YYHEzrCDA3HyoQH0jfJkKZvmfyTYxduS50+K+CrmE+jICGmU6SUBemKDfD0OrQIGHy8Q qCX+Qf13ZYniaL2uZM36iszaf63t0Yf+dzlhwAIJ3Kdaer+7QDxgFuqyWma/lMMk+TdY QQttZ/UPIj4YbcalxOy60jPnfEHfhqFwxhGWj3jq9NrAgIeOTowFAHmGrsGy6EiX3xw7 RByju2a3auubWEnNFsdjhnDm1luytzBN69Tr7Qs8rFYl285qUOs+8G+B6dunHof5HGIZ GZNluB2Gopm+paGLNn5euP2wWeQNHducn7EfU+GH6Rjr924ijUoFLwHojDJWHzA+OpXt RQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bu2OjQiHDG5rnL6tYko+m641R07xWlb8c7KZcC94oIuJJWLX5+OnP7OwquvRWN8bXFsP0h1huF4uGH+Qdfo44ogb0foetvT7SpSpD9xY1F0yJSRhryZqamYhLfLSdl3G5azxRd0QVV8HrqOcC8XUSl0H2M6VJpZ6eLD2VnnjnypotHXDDMF15mnZnh77wZdC5CnCnDRZ6mAj+Mi/gA18nLlQiiO2ggy0zZyAT8/kQzDTqXWpoFTPzQ5ulPos+Xm6bFrsfBYIQZ4PyNxVbCHufeNXyAa9LfVHCE5hjMDYX5NQuhO901fUyKsgR8Uvp7b+f8JsCkWQ2lHO2EczwtZDnQ== 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=SXt4gl9FGVsN8kbuRE4IqSPgVdcZ+ICXN2rhjTe/dE0=; b=AL98cAjQRLdo21Ft1s6uxoeHN768rZy+Dj9g4qvYAnXjrETRhH3GzdqGDTH/DK0ypHUgi3fcSCenRjpSMPMtmPxH6vAnlI3f45ZC1TXy7h4qiLbeOOOmd5Vw8TfR+dcRNSg7OtSK6GYyofR8i9nug9QBrRNgBS+M8tLDl/sJRS3V2OjFMPtEAIfkBSl/RElUIM6zjV3KMLrruOki+j5NQVHDH/7noVeiiQFRSPYfecnV21LHpkKxCC3P56l3opg9WVuDllLiY3ms6SZsNiec3aq+D/qK5xdBSDt3+tF/Z4mZ8ZWs8XnIxIWhpNzgiLEprGkPNYbHQ2J5vHMNG3z/Ww== 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 From: Bin Meng To: qemu-devel@nongnu.org Cc: Guohuai Shi , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Greg Kurz , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PATCH v2 19/19] meson.build: Turn on virtfs for Windows Date: Fri, 11 Nov 2022 12:22:25 +0800 Message-Id: <20221111042225.1115931-20-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111042225.1115931-1-bin.meng@windriver.com> References: <20221111042225.1115931-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SL2P216CA0138.KORP216.PROD.OUTLOOK.COM (2603:1096:101:1::17) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|SJ0PR11MB5102:EE_ X-MS-Office365-Filtering-Correlation-Id: d92f442d-93da-43bf-be87-08dac39c7ad6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XPVREbHM9+tD5WWa1ZPV6yX6F9gQoVK8+2CJrxitxTV+DBoc9RHtIimXT1K45OpgBuVu/ncEF7wHfNejfmXLgl5G0THx7cYO2gkt3/z+gYCUppfCBLiBjyq1diFg03WZJBvRW5evbURWPzB+UeInlJ4SP5CTcwyeSRRsWMR1UeUwIhuIhckdG2ZKJbtZU4ws5sc0iyjCzRVtaZ7Uro4aRvprxB5T40Fg7LNst+t2oezK1kYt19oYzCV8kILLVlKJW6yNYdNPMBR3HoMIYzvT67kUSgGG6uy/rShuPP6wzbBvuQ+VNE1tXDunw5sBu7RhdnPVSSAU+Ik5vd3vl3oDhyWbctJxKiA4H5Acy2emhuEir6mDPNA1PuZtyKbUcMhkzcK5q1oxJY8b26ZbkRVJ9dtbJvWbLxDxO1JMDBzMdDwiC5qfHziHwtQ7oCSFzB6pyz5f6AFbmQM4jpGTLyjCCNjJlZuvEPhDnseLR/AiTJYOIYV4DEs5AlQOihg+X+GaSEi13Xdgwb3Ic/pWQWW+X4X1Nxh4saTSy114NImdawEAl70nHgUWbsQ+OmhAP1vWs1tsa1B15+ECI+i5QrE/j3Bg+5K1X0/X/egsvotkvdjJGy4A9syb59RvGQo/N631erNTTcth+bL3GzZK3s2UFTurUf83fU+i41eJkDVTKPbs+1RciZfhRlWnjXiP3sFxBmEVXRDwlVaAREcFrdDRtPc8jbB+3oOrBYyykjtHZGtVK5LwUJSR/O+21g92W+jn 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)(396003)(346002)(376002)(39850400004)(366004)(136003)(451199015)(66556008)(316002)(86362001)(8676002)(66476007)(66946007)(4326008)(38350700002)(38100700002)(36756003)(44832011)(83380400001)(52116002)(6512007)(2616005)(1076003)(26005)(6506007)(478600001)(186003)(6486002)(8936002)(41300700001)(6916009)(2906002)(54906003)(5660300002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4hifVZgAiWRiPbneWXHMtEQ+UXF1ZmfphO+pawoj98FYpJeW3i59ry+Xdtzg?= =?us-ascii?Q?VxYdu+cNsig+2z2aea4vCUmplUijIYaUKnHvnWGDVmd3D6qemGrDPOykxJro?= =?us-ascii?Q?WG2lcErI05Q3/uhZAvjt5WLnu47qAsD0i/LbJbPg+S16mT5iV9tblX1DK64F?= =?us-ascii?Q?av3Rr8Duu4Kc08q7RiHrkLZ9/LvD6K6FW+a4SpCY+q/zhjIHCOy5K9ITAUGl?= =?us-ascii?Q?DnCmT6u+uwpCU8EGzdsiWp1rSPIceUZsPDVkrqBKyIyhAI5zG1DbLXGDGT9z?= =?us-ascii?Q?a8Mc85CLTqo4sCiyUxTyUg7WIkAmW/p4B/4NXHADx6OuKA7cxFL23SYY3ThM?= =?us-ascii?Q?PEH4uZkpCvgF6Lk4KxbJxLA4dWuZlzeZ09QNxbVzF49xNionN8/23+HLTwSF?= =?us-ascii?Q?24KzbwWlPQHTYuJsYcq8+iEykUhr6bL1585dEi7ZrLfo/M7h1ipPI3G6ih2f?= =?us-ascii?Q?9E2K+L9G1Fx4kf+HRJiKmIcOf4gq/Bn0bsQYK4e0Qo/pTWTzPA3gZyMwhAOA?= =?us-ascii?Q?YgTDkPpf0CfoQwmTQ4M+4sWwj2N9o/i8QhECDef8YeOByd2s4c6sp9+0/6uI?= =?us-ascii?Q?bA9oQUnHZkqENW08Mvp1h/N+5ZASOhZEYvGsZ/8oJuoyCBlCpIrDf5ojc+yC?= =?us-ascii?Q?+WjfHkeb138GDqCblrCcpjiKiYX1Qx6jPj7VKR+fEUKtz0U/FqIAlMDnx9Mb?= =?us-ascii?Q?jf9Pdww4gWrF/72Ko6lNXV6aMq3JaF5pKgpW5fe9+9dkZBu40ZkP6/lXwArr?= =?us-ascii?Q?VRkabj1ulZfRyjPPUOwknMF7lgqKWt74f32EIjBdxBbGXq2Y0NnN9FrfB4qK?= =?us-ascii?Q?Sy+rbNl7XcLUROLRnNkLyx7dsGM4Re1SkV2AJye0Q3td4GGG/BEEm3QTxEQn?= =?us-ascii?Q?8pQHVfqB77HcArj34LcQ/ybxZsnAsrLfYYC21yhmyBNNfZsSL9z0Ke2OcLCK?= =?us-ascii?Q?E5y4sSc6RpGHFntFDi0tD81xGy7cACvCLNLbugN3H7i7XTOvmt2d9PdoD9Is?= =?us-ascii?Q?zU7Gf5fnINFmItg8UuuCkQH73nT9rT3Fs6nMOzJD1Me3iQjbLIf4Nr3lwiee?= =?us-ascii?Q?nFbk06RTe1jTInzzlg1vrDB/ca25/71B1byqiZqznCUWC+J8LleAo5wpXNDq?= =?us-ascii?Q?Xr+LQVNDhUnfZRnUUpGmjJDQD9YUfWoCmpN+uv8wlpAPUe9w0O97ImjiyFFk?= =?us-ascii?Q?IU3Nx7wwcQIqOCC8xOU4mbT7gSAe51UQPUgYi53+9fnZWGv5lnHSk5cTCc6Z?= =?us-ascii?Q?+ke3X8fo3lgB+paQWMlisV0MSJAh/9vI0QJJ7wCdj7224nKXwMKKCs13pVj+?= =?us-ascii?Q?uKaI0qFSR4IkW5HGKT6CqnAIkO4UE370TtwHdsvQn1RVu4o2H7yCrYjcs8oT?= =?us-ascii?Q?Pat4t5zUGAH01qSD6rHWMAGUx95osK3ZdsrT4BHmqNY2mhelsjaVKGk8MCAM?= =?us-ascii?Q?nBssQX34C14+bZL8kd3g0DeIjTwqQmizA1zn23d3NslnxElkXMAg6zXHfRu/?= =?us-ascii?Q?LgSA9d3GTymNiCP+unT1/SoXA/UDfIPGI05S8hvv52QhEDsoj7gwQ+Xv66Tv?= =?us-ascii?Q?ErKRy3w3xTSz6zxGdBjZiUeWlo0LXpmJNsuLGBKJ?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: d92f442d-93da-43bf-be87-08dac39c7ad6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2022 04:23:27.1117 (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: /+Z+FzNOzets0KdmocrW/jA6DC1lWaFbxQ7+I9ypiJOEAhUqHL06mIteuV5sqQNY0N9EfIOr49Om9nNG0Il3vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB5102 X-Proofpoint-ORIG-GUID: NQ3ci6uRpbGqnRmhm8nRY_KUBMXE58ox X-Proofpoint-GUID: NQ3ci6uRpbGqnRmhm8nRY_KUBMXE58ox X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-11_01,2022-11-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 mlxlogscore=678 lowpriorityscore=0 suspectscore=0 priorityscore=1501 phishscore=0 mlxscore=0 adultscore=0 impostorscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211110027 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=83144312e2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1668140791670100001 Content-Type: text/plain; charset="utf-8" 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 cf3e517e56..4b386556c0 100644 --- a/meson.build +++ b/meson.build @@ -1739,16 +1739,16 @@ dbus_display =3D get_option('dbus_display') \ .allowed() =20 have_virtfs =3D get_option('virtfs') \ - .require(targetos =3D=3D 'linux' or targetos =3D=3D 'darwin', - error_message: 'virtio-9p (virtfs) requires Linux or macOS') \ - .require(targetos =3D=3D 'linux' or cc.has_function('pthread_fchdir_np= '), + .require(targetos =3D=3D 'linux' or targetos =3D=3D 'darwin' or target= os =3D=3D 'windows', + error_message: 'virtio-9p (virtfs) requires Linux or macOS or= Windows') \ + .require(targetos =3D=3D 'linux' or targetos =3D=3D 'windows' or cc.ha= s_function('pthread_fchdir_np'), error_message: 'virtio-9p (virtfs) on macOS requires the pres= ence of pthread_fchdir_np') \ - .require(targetos =3D=3D 'darwin' or (libattr.found() and libcap_ng.fo= und()), + .require(targetos =3D=3D 'darwin' or targetos =3D=3D 'windows' or (lib= attr.found() and libcap_ng.found()), error_message: 'virtio-9p (virtfs) on Linux requires libcap-n= g-devel and libattr-devel') \ .disable_auto_if(not have_tools and not have_system) \ .allowed() =20 -have_virtfs_proxy_helper =3D targetos !=3D 'darwin' and have_virtfs and ha= ve_tools +have_virtfs_proxy_helper =3D targetos !=3D 'darwin' and targetos !=3D 'win= dows' and have_virtfs and have_tools =20 if get_option('block_drv_ro_whitelist') =3D=3D '' 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) =20 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 =3D 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) =20 --=20 2.25.1