From nobody Thu May 16 01:58:09 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=1666592737; cv=pass; d=zohomail.com; s=zohoarc; b=LBI48XPBXUr0moFv4+MMcRIEzaTgTNN9cUEMrldRj6mhFyJmxdI+rxm/8Olb9+KOX1qhrl9/8OT2mgsfGyt7vYSwgyv7raQzmzlCZHJkwbFQq2UhEZiZT4/Qxr50ftLLN1dPV8e/QZT+KEpTyBeFCmB2jfqYufiIfLNh6Dn2lw0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666592737; 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=MNo6gmgNvmlaFJz8/xTNhlf9gRt8GQNbkh7TRymwHGg=; b=SWOoccZJ7y5B11CPNfXEafkTwzaBYxo77Jj4CF11/rwtib/owZUwImikSkBzA5CmifYIvltSZSTuIBv8RSepXBgQhqzxUOY1krM2rXQN8HIeLWvvQG/TKLIg9EG3czgVg8Sx7sMG+ealbHbon50t2XqGRb61vZAgrxNe4yyjnNg= 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 1666592737712605.5413180697184; Sun, 23 Oct 2022 23:25:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY1-0003uB-9V; Mon, 24 Oct 2022 00:58:49 -0400 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 1ompXo-0003qC-Dm for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:36 -0400 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 1ompXi-00066V-QW for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:36 -0400 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 29O4wKB6020372; Sun, 23 Oct 2022 21:58:20 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcbt51s14-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:19 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:18 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:18 +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=MNo6gmgNvmlaFJz8/xTNhlf9gRt8GQNbkh7TRymwHGg=; b=Ku9ao9ROowVDZOCL/aDMt8BAOuDXzvwLntTcvE+VaEWe/V+mFSE62jTUmy+I3mEsOoGP 3K5ybVNyxICtpz4kp1LkJSW2LxxdOPYFxDJdkAMfIKx0QcL41gnP4yWrDNiunPjjdWOy ByCoizT4sXV/HTwO7p+WcTfL9xHhoVUEI8k8ITpo1Q9R9CQ8khKIOzaWQxoIG+tTNw3Q 9ANn8zGAkv+/QMOprbIKU0DCnVzaLqlMMO5tslRoK8GW8CbnrE9wFyn0JGTSCX5UMtKN 1dXqxmfD2+sqY56Ydd+fIIL8Ey0KtkV8zXmrrPXjsjcaXWNy5pO/KMZDv9SHPrUwQI5s 0g== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KfAMC5jTfjK69gcaePRmhShmpCVMza6sy439Eb/2sPoIPt4SPOBAkGjtNgC8GCI6UKlHTHk5EE0BvcER6QQq5ZkuIr9iZT8Dg1P20b7Wse7YvZ5ZMDHZ3uprfTxGyKjrBpz7UM/n1u1sHkcWsNlpdz9ZbLfV/4bRUhRLctFIE41bLI6sF42HGWQ2RjhCxsKigfbgFqXsBe1CcqDNHLrmxCl0LMBDH8ZewuA5mCiEOuwwxMo5dODKpkDkMgsPghSfDK1jx+/lUzPhme0VakH6My0byen3JrVA2QhhkwFqxBIMKptiGigSGivP/uSi37rWEB5TLfwGsIFeytkyBnWCDg== 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=MNo6gmgNvmlaFJz8/xTNhlf9gRt8GQNbkh7TRymwHGg=; b=fkTPWWBHskd7mJmcmprVSCjcKiFTvzjgWor/D8mkY5PqEf52Jr9Hws3jebxRZ1CvgfRfSrV0VSgpXLke4vTTd5yMvjlQlPwLc27t4Y5xcZjM5mYYUGKjq6qah4ZX2FHUcPX9f8MDMXxYMSsoXwbjCurwqM4229CIe1ziTXUl3Z4H8zflmuBvtFa4ok0vxm/KJY+tXfpHpD1y0wsVEtNysA4DWOFyKQM4Q9nByfnXg0AFHVsjjIFN+PSPr3RyfkIWwM2VFntIhGJXgMJo0sBGub/jYbZM5Ml9OCndv8d3cyX//zTN9DUtGTr9xqVkPrZ3YPNP3DQdvmZ1P2GGFGPNog== 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 , Keno Fischer , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Will Cohen Subject: [PATCH 01/16] qemu/xattr.h: Exclude for Windows Date: Mon, 24 Oct 2022 12:57:44 +0800 Message-Id: <20221024045759.448014-2-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f42da0a-5291-4dee-e079-08dab57c5da8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DyNOX+PVOwJSI9sJN00X2WgRqelElXRYw8ElKIH/Fl28aWQTQJKHwM9NJw6kx+rB1Ga7mToUNkMMZPA49aOPacT3dzCe9/X7m7eRhRxbsuG7xmBLFHrLMqxvw25y9vbxUMasu8+ojF2Iw1vmgz4LfWNrpClIAZdMYsCU8oxgvj2WhHjZ00Me6cqQVLID/GgslNzG7mv6hR1wwGA2BjVp0Opv+f8XNJERafVfLrcPDJ8qdvmnGI7j+fYZjhX4y+kTPaFvCCbNro1tIgaSfXmWxk3vTqNBUtBSiLEQUJy0vGxotbyQIa5CpwUTLmgpksHF69FOVaIhQUpmEVaHdtqkL+sOifGAnGNhWbwFN69WFK63eeKQkXsswQk1pSoQh3Ub1ra2Qu6csFKPig4zMMmsc6g3k4fwz6RMnPC/nXckj2NSBF1avm9FbC2xVcb0Ws2/9lNl1mVN4LON773pxhqaLIqdIqcrZKJE0DWrKXDIZ8b+cSpdJK52P2sl0g3fm13UOfIR1YPwGVskRYF7fP0uDaB+FMQ6bnR0B+l3clKpCpqZU31AWmjtGR9He4vJo0QpIbJIQa93aYsaqrOE+IX0zKt6gKMDfGd32+XXmd2agbzuWVVJCmeCEaq/lZGh26yEOPXnPCo6tLA9/tflJQcljez/rk5majsZPPwgXPNROEx1aLtVviUzZFVCg7qDd5ExYGbb26jTWLnylV2WGY5uPIJGSsctZSk1UMxM/ECyIfgXq4GbIPqE/9qI+cIRsAfI/2qo8PgyX7eROzXfjN50wQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?VPHOnYCAR2xeaSRXMM4L/MXqAJfZrzP7Fj1+8FqkmBFv/nmB7QBLrMmRvaAC?= =?us-ascii?Q?/8RmnF6Iajhf5uDwdy1D8ZvwtWNW3Te9osIEWskT8bVntxvHUH0bzpnBPMhW?= =?us-ascii?Q?NsCCHfpwldXFEZvJLcDjqk31SracT/WAOQy3iCVdvv7ebnPjkGfJbcjrFx/M?= =?us-ascii?Q?P/5K356jkypUueuv71IRorZ2LKK61Z7PM0NFxaNuQUD23XaCIil6AbGkwMYy?= =?us-ascii?Q?9VTtVtl7ThJsHHvKu/sTQzLATNkCeRz86s1tQkX6rVxwAIBSVmnWxaRBO0/7?= =?us-ascii?Q?fyfMjvyXJrmilU5b5K5nMcbvwN2c2d50Z8IkNvq9QKPtg5x1gI6+jRuQp4xH?= =?us-ascii?Q?cPjityJ6J4gJDl5pdZFrZPC59fXSv4QT4daBv9IUgTEVwS3qzx6UfO5bysgX?= =?us-ascii?Q?nbdkJngBmYzIHOSNDdghD4lEaXjT3CsofmYgs/EMMAB6GmQmVOIOIJalDHZ1?= =?us-ascii?Q?b6wRAcTBTojYS/QYYJHkvHHpYbxeXqjjOxF0W0U+tJJ85UTkj9hvebNupnzm?= =?us-ascii?Q?a6hpBSqZnbufN2x5Bx4FTOdLMrtKvoQm24AfnYEW7aPELJ7ahD6htXW64NXK?= =?us-ascii?Q?OeTiQTz37XILR6/AAUZvlnZWiaBHIv+9nt3iyBTKb/dUYUSeRlVbb2TkeDLF?= =?us-ascii?Q?K5Jk6TjYos0eaB/jOEvFSxcpfxZKYrJHg/pzrnXNh55uGpg/8hdN4rM47lFN?= =?us-ascii?Q?Q2ey0xpYSmKpAL/Ti1oEYMTmTytWSqkQiqG1xAdEAedKbDoACkdFCvS8eZ00?= =?us-ascii?Q?/x/Fx6Im9hpCFlMPwa0Gjn+zSn2qy88HH9zwqXgOrhxf84TQGNWPro036efo?= =?us-ascii?Q?6UDOzzWH411Je8QcItvd8Bo5Mi71Sz3pqWz5D9Kzocm0Mcca/3nzD+It24p/?= =?us-ascii?Q?k4qfZzX/hs+85ipLCAfGBDJYEhVAR/cIGugg/FQS2zEU+YLUHNdfGUr1TFf0?= =?us-ascii?Q?44KS5F2RKmk+ixkLNXCIIH8LpjRMEX5PAoFfcy0EbxDni04EylejjkZFSuNs?= =?us-ascii?Q?izUoRD3i4rT/D4+aVIliVhyt+mdYzZQE5GIKfri4hO4onLOdyLwf1vDeEtCs?= =?us-ascii?Q?ZTfib4t7Mb6ROPH2IuBu5G9QprEQv4dW98kpiqfmwIqXpVDgh/ZyyGoBQuo0?= =?us-ascii?Q?+aVx7tbP4cIH012PnwAw2VgZWAsaG+EO4WbPm9eJC6aC/W4hQx0Ukr8rCWra?= =?us-ascii?Q?I+/MBGUNyeUv8LVFfRD5w7THAEGMBrIvjEQnrmCuwBeIkdCMfEzScB6t3XLJ?= =?us-ascii?Q?VKI6EKpBV1r3gPxsgIl9w6t3sMcxvzFDJMstudqLlwI3+TXM/GF/TQ0dQmOU?= =?us-ascii?Q?57AeAAxMB1vhKfEdJZy9z1ec44ezxS5Uz+ougcasdpIHw1iD94z83KueGMhg?= =?us-ascii?Q?INXecl8reARjT/nKB6uxeOIW/zov4af0hW9MCc3sLUOphnOvgt+Ef3gxPpsp?= =?us-ascii?Q?Pi6BM+1jDVSnUIt0OQrr4Djiu1d5Qznir6IuGj4T5GfWpE1ZyXoWBO1cE10j?= =?us-ascii?Q?ITL4h5VAEdHuFDB/Zg2CK6pqIdJMDfZfEiPmM+piNvGzwYiSpE7je0h1NrhD?= =?us-ascii?Q?KuanK7gWN3hG25KYHMqQ/lspcotK2yQqbfVHyH9ofE8ow5o1ZQ5w2Zvtzguw?= =?us-ascii?Q?/A=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f42da0a-5291-4dee-e079-08dab57c5da8 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:18.0610 (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: kqyA3vHLRjB2xFK84XZMUPy9PWXKuYsBDrt1yw214D8AubLOjZrbEwvi4wB9X3xWE7PEjnJUl8MhvQpVeKbSng== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: iwfSrogsvPxD6tXUM83Qx2MOJJsMFwDH X-Proofpoint-GUID: iwfSrogsvPxD6tXUM83Qx2MOJJsMFwDH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=547 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666592739023100001 Content-Type: text/plain; charset="utf-8" Windows does not have . Signed-off-by: Bin Meng --- 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 Thu May 16 01:58:09 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=1666595634; cv=pass; d=zohomail.com; s=zohoarc; b=GrRpFUeU2aworrWOBJItQXMoMtY9rh++OGDQe+e/7MuRUEfJzKn3/lteC5xdJLQZtNVjQi5k/oRRxGxuARQp7cqHxyBYcPixEZfyoAFYzF9hvJbzsWe/SUY/1Ysu6n0iZ4a6QN3le0bhfrHnSykF46Ra93n9zGJ13bKAHbrZSyA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666595634; 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=JUfNkvsNca0vVxdygxUEC2C5ZSCP6t/V/Z28oTxp0ak=; b=bTo7O1W0P7qyNmyQIbuDW0pBXxZHl12G56kxUrfDVZLiXA0izYDGFe/ee9+SOuXvSPLPJlszNC3jz3KgCv++D+2E/8nj06lgJ6kqhDvJ7rmsd98FxjEURrK+nuO7oYlJNEkOwtPEaEf1vZAvwiX4JYXUn4CPHdMkHd/q1xKFvKM= 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 1666595633972789.6644451561781; Mon, 24 Oct 2022 00:13:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY7-00045B-On; Mon, 24 Oct 2022 00:58:55 -0400 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 1ompXp-0003qN-O5 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:38 -0400 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 1ompXn-00067k-Tb for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:37 -0400 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 29O4mkTM015442; Sun, 23 Oct 2022 21:58:22 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksma8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:21 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:20 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:20 +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=JUfNkvsNca0vVxdygxUEC2C5ZSCP6t/V/Z28oTxp0ak=; b=q99Ab1enPsuJL6WRykIF7O6dxPJM52dbtQvN62M96l0Bt/nhtK1up59LuhLx8HSmZUhE cfSQtuD4D6YH/MwdyZwqwnAM/KHJ8LOnsCEKzt1lqMdB3nw/vrg+6K63jdnXNDokaGM+ xLJv3p5izBYUNMLAhQLfyeIhzvNCVcEp/BSS5kmriEdjKefBkduxv0fhx5B/W5xGkwY8 uao509qIDjoyXdcLiwxB2KFiwlOymjYUJEU2isveGe6oSwSYL1Z2WE+N4pewqn1HF097 gKnLIHAyvuvrA8dtkXcmsFAGMwg9LHJRQkMi22vFnq5Vb8n4yDKJw/PFIemeZPatTvuI CA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9KCZ3PzenzWPIgCY4HTW0qAEf+iLQEdKc69i8an2tSWx61oR3cHM5bvzgKQVKFIUI8lx1sum1FqXE8NHEFVYtmhkiUN2ei/EfQ+Y1HLHMJZgenZp+w6YiuZRvU9yQs3qBIQLBjdlD0rKjuJ6rb/ui1HRF18TSPHZLi/KVOREdr0/RfAge7VcPfVwNAaqKGAbQJdViVOEcawcXEP3NMaFt450PJEKh3xqsb9CbOaO/OuIJY6zR2mLZ80+xTKzeUwvd6yWKFQWPQiYnZCbmQGPHRYKfvpntOo0+n3UaueINXYUe30GzgCN/NKo5IhdC1zfQD4Xi90yB4o6EOi0YPUgQ== 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=JUfNkvsNca0vVxdygxUEC2C5ZSCP6t/V/Z28oTxp0ak=; b=eAGka9224hX5bN22+wy0EWPPjxGyjf79500y8yxK5aVTJsqnjWvhJjhrWTFjbFh8UbEd2t4SmQ/+g1axNJFWAzx2DRqUMkJhj7LEqCsALn/1iEEyLEoTalfTtQXVnj1Uk1Lri7Mli5wqEnaDZdfqIFMKZ06RRDgyWlFukKx2FG2IMCDDUInPBTIGJNZFzc21hGwqSIFLrxqs501b/r3FWAgPZyW2k4zfFRMRyZL+wdGe/F0fNxG63LIlHAsd9o4BoSRHlaKVPTFuIuBRJuCSh+5GlXxW+K3C2fYcwrH3eFgwv54zb3Xmgjyu6VPFE2tBYnkJeFyCYuYTs1rLtgILsg== 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 02/16] hw/9pfs: Drop unnecessary *xattr wrapper API declarations Date: Mon, 24 Oct 2022 12:57:45 +0800 Message-Id: <20221024045759.448014-3-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d0f00d9-bc29-451f-e72d-08dab57c5eea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 88JKkbMVugABb/dySD+4W0tecLyK8BhoHGD7JhLgTQPOROj9B+7WMlUhMFJfireXS2Y3pS3PTLnSisNEyk4KyQ30iBAigaQ5SCaUqZiTrSh6dPm2AQUOtto99GfRWWBXJytbK2aZJjWgFArlx14/XYG98OaG7CAx5WAKN1bLSHqBaAUwtWe7gy2mCQef8oofBYxWE3ue3QV5Jw0508/MxrO9qmOcVR5JNyQQtEGubq3n83mWWdYf9uU6EgBkskQo2tMiS1U3wtdks+uv5aZLKfnSKLOZvKDsSLCnhtVcOvbljnbX38keuiGj1jZC6iP/xMhwRNq3cQsJM497bFtO1+SvI/xCxeWZOW3QF6sEXZ5oAVHN60UQdHtGTewgfq3IaJtNmbmyLD5HfsTVIzwF/4tp1gdrNeFEW5IqD9NucqGcNMHUQq0SRD2AX9GgsrYhuofc1lz3s+Cn3wv/yw0QKEdPCSP1zPi/PsCO34F2jVyFk2Zptvz9byqje7NrXhkVvTV9Mn6TAn/biYbTLtuuqV8PcrysBk20+lHhoGvQD+0SSeGuM9/EyaRLXATuvRzhCfWFuWfJAGWvxfJU2huhZmTZAONflhb5WiRcFLGLPCgrzbnhNlOEq6bzelr5mf5+1/APPZzyU9SLVLdJlEq3a85aA0nepHrQr+tc+bnsjzChS8hcMfUvW3iUFAOoI4EvOfs5wggzakyaB38q4Fyx/7M4MJoylcW2N4nAfRWhuqVpTVxsKKQDRQLUXDaClpnShoKITFOPsCzpZjHosWpZzg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8Q94tdp1Gbx1RSdTpaflTn3Nun758yYgeN9YDNOpF+UlrxrDmALOmNp5n9mO?= =?us-ascii?Q?cyt/ext6CTWLyJvYJcZIB4QalAaWQ2sYEB1htdL22JSUFdQEOE5LVTmK6q8z?= =?us-ascii?Q?vjzcukaxnLE5GBgJ5kEV/FxDVMXePeetC3zeTqekIA6KchUhOPMR1xf2NzZM?= =?us-ascii?Q?MjPlUJlwlhRJ7Pbx2kjtwon2/9ykzIZ5c+eicgAl2MQkBGq5jMNeMHHuK/m1?= =?us-ascii?Q?L2I3ZoqO/Ab0kgAM+vLFq+SOjhOhAqmoANfWCu2kf5xFoXXdqYwv6i9C4kDq?= =?us-ascii?Q?dh1Yd5gJldGPMpotvBtfDlHjB0wSpeON3MiI9RvrVo+F8CDfz10jcIT7LaAM?= =?us-ascii?Q?t6qGdGpRAAwqu38FAXm+NqkrYYtXPIhnrtTDZWcNA7zDPF38PHNNnbFx3g8g?= =?us-ascii?Q?FL80GNv4Awa4MWonhnWw3GZB6V1B8fpoyetnOSLr5CtdqoUpOK3vmUnHKJ6Q?= =?us-ascii?Q?3zRwGPF1WAMuuhgRb3yEeQW/DL/qZIOENHYEc312SKchakvLwmKz8Hbk/0eN?= =?us-ascii?Q?CVdGeGU4aPu3mzsCMyX54TQb8Owy7YvIr7FzAv6BWmtHXsfxeJ+uXU2UHueY?= =?us-ascii?Q?K3h7wh/BOztLieRFkEQQ/cUYmYWjX/j5qz0mD9LPNyP9B6M5VP9c/cYDpjrF?= =?us-ascii?Q?bfzj5O88S/wwhoJ/s2qXP++RAcIF0bHGTHUf584JM1ytw+PY/29vIYozohvz?= =?us-ascii?Q?W+/g+c2LnppvquA9x+N0iytWSKrasu0rYrJ0GORcG0LBJhl3PkwvvDIabgmQ?= =?us-ascii?Q?PUG6tr1z07sFrN85c4uKyIiEb5KKq7p16ehGn1ugtL9CPmZS2wGmlp8QkeJW?= =?us-ascii?Q?+BA0TT2TAaCMwGVH7R3WE0Juc47yWI4J5unD6CuS8njklZfYCoX8Lq3NkV6n?= =?us-ascii?Q?E7tiJZq4bG/m6kQITX54NIEESOQ0QYY+yE8Wf10EyyfYbUoE66IXvj/9YLnA?= =?us-ascii?Q?rXDlegXdAVqxHpgExtAw7vkBVFaVOWT4CoUBykIIq2T0wGBxyfi1x0ByvSS7?= =?us-ascii?Q?ShzIAbro4JEDdx/Yk61OHoVRindWCfIr3fDN3TFSWhSEHKmwrbaVVwF5o1r3?= =?us-ascii?Q?311Abz5LG43c0qGBqLqbSnzejBpfmuk21JKXviomdafSSXZKKn+ngB4+2w3A?= =?us-ascii?Q?Z5l9MS+ZtQDHEuO+9liMti5OihrMwldb2h+sEjow7F0MidvhFhcrBTQTS50Q?= =?us-ascii?Q?AcuVRxD9CQSkO2rrXlNSg9a+sIeVxkMOWQuGdJdXBJl7mULvTlKX3brEit5v?= =?us-ascii?Q?YPz97x5YqAquOs6Zibq89NKrxyz0iTDn7g/VmJtER6bucpVuQleKC79611Ry?= =?us-ascii?Q?sHU97jquOCgj6/jGSYQFzgMSX80LtafYJpVCCgGPR8SN5mV67kywV+JTc8yB?= =?us-ascii?Q?yR8OPl9kNuKCDWg0clkoGCWOuc5JIDJxVmx2kCCmsIBbrFQen34XhdIbn7hc?= =?us-ascii?Q?xCdfDQ7CwVTjAQMu4Ub+EVO56SEykEHWJQfz7ZNde+vixMYlmmzvoDQk82z2?= =?us-ascii?Q?Miknj6jQi/0luYQVrXy6/BQVlasTV2PFm3qczcCojwugQn9/hV0QgTTD1Nou?= =?us-ascii?Q?bgnSDQT6HTUnnOGF+aGwdzAY/TQHW6aBSQ9r8unDxCT8Y48EQgr+I/fD6/lL?= =?us-ascii?Q?lA=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d0f00d9-bc29-451f-e72d-08dab57c5eea X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:20.1245 (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: Z5mekhV2aOdmqR+4oan8Sv5XGL/xIx4E4ziwy0MUdS8kXIp3SoDc7Xm1STTAC1++T5bTj4s9RpJrUmZwmCeLzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: tL-nEIQB6GDJicQGSK1IzamLjTrRuq37 X-Proofpoint-GUID: tL-nEIQB6GDJicQGSK1IzamLjTrRuq37 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=713 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666595634761100001 Content-Type: text/plain; charset="utf-8" These are not used anywhere in the source tree. Drop them. Signed-off-by: Bin Meng --- 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 Thu May 16 01:58:09 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=1666590040; cv=pass; d=zohomail.com; s=zohoarc; b=EGuXdadyIAmU/55b89LlVcZGrqqxBmGG+PRFU6nwn5iJSqUyxFzWoLRCM9l+C/dLTpNitIWd+hWdJnDWgkVp0VQYhGQzQxNQ09IH0cKQDUFTlKQ19/j5HeVV9lflE0tIHoG+Hpf59hRe10Oh4rY4vRWO5yHz0PmNEnKaMiqY8dQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666590040; 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=R3zsBy+TCgtsGTT4WRluFlAR+9iL6gS1nLR7/kVXLtw=; b=imeO+mEIVpThkz6wwgdoyfK3ED/XDntc38n/6C0RzBHKIEeFuB12XHdxtc3LuCqLSWiffxi0nctLKmea8jo546NF11COdNumuv1NNuvwpU5Ot4gyhrYZL26mJIUt12MHXjR8iJvtoptbjPU6VnltrUQ57u0UUdrsQz6s5PvDwT0= 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 1666590040735991.6431323698511; Sun, 23 Oct 2022 22:40:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompY9-0004BR-3P; Mon, 24 Oct 2022 00:58:57 -0400 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 1ompXs-0003rx-6t for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:41 -0400 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 1ompXp-00068B-Kh for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:39 -0400 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 29O4rWf0025182; Sun, 23 Oct 2022 21:58:24 -0700 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 3kcg1ksma9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:23 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:22 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:22 +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=R3zsBy+TCgtsGTT4WRluFlAR+9iL6gS1nLR7/kVXLtw=; b=UMeH1pBQA1Oz8Ea0JiuPOT9EDqY9n2O89+1fS1l+2wBPHSTWGj3YrIWLyFtFXdEEByDu ORPTq8GAyQH/JS8BlUeXgTgLKM5EdqkKL6JocUkG/zYKSCMkU84KkpFwBQISK+1XO0I5 +mjyQoSOz6GeH+WTuCDtDJtQhPSQHmY9+ZbWINqilmcK6R8YHLzh9BECQta+5m13Brx9 xcmhOlj2Goge3GjgejGDPozQuY/wc3I9RSXC6err7TQuGfNe5WJbKDrPRbmfBvbTdLxd RcSjESnjAP9cvG+PvBV7lH+m89RkaEDaPtJjq4OIyn+bVrAT1rnXl8mHDs1yq6OOckpz jA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JUMIdd4KymK/Am9eUIY5ie+f5fQwP/NfWlcrsEjlnY+Qh5dDg2d3GSqBVjhzb3OUkn3OeF5EUpajg/TptvT47JByylXiGFtg9i2CQ4VdYpJsbQwJ4DkBf2qxOYjX1YZ/uBf/1I912c2Psm/ANfXhv41od/n6smIqEAyj8H/HhWUR/vs6WMbDkvJzGuk5cp63bxGh2CUxsha9gUu+2MxHH0/1eu5aCWL6D6jxiGWLRY9LqyGGx+fweGDg0f5JnBlxko1381AmE0Y9f9eJbZe9riE176enPtm1WzZCiyREmXtY5arT4LEsHppdYm8N0HQwL/caocw/Jsjqe0powd+Bgg== 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=R3zsBy+TCgtsGTT4WRluFlAR+9iL6gS1nLR7/kVXLtw=; b=fs70tCrx9RQC31vnSbAKdT29WKG4OVUFHNMpfLXV6i/KwWiYmLoZjkVEX3rsZBrTvAH2wfFOfPY0+H02p3A60rb1LYPHVZslfeEexYy7lpKxgDrAhoEmWA/FrdFxqxSbdML1JSUKijhNT6cFe3RwAvIxaBL8RSAAm8NZykRhLqu684PbbjSDPSRr+a6KRK2OOdLw4eiKBdN4iqoan4Rue450MmbZZ4OJdjE8e11vOZ9O1AJQoNUywlpcI4a+FSxKPM4gr4lUogiJ7pe65VQFrp151NJr5jz9GqA6vUyrsWN7Njqq59TAWZzGd8mXq+YwjHDMME7WEPx27IrQtQViwg== 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 03/16] hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper Date: Mon, 24 Oct 2022 12:57:46 +0800 Message-Id: <20221024045759.448014-4-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 6955e678-2ffa-4b35-1800-08dab57c600e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PRCT7ibY0wUD2y3WjFKuQ0xMGIFPoS9MoA3dn/8LTUIINQmDEMfpFcxUipMqM/98nSWMJ9M1iTDFU+CFXnQO2gDc4CPFvbEoDv2yhadhfBcvJi0nk8iPjWQuqt7L6V7q+PWUfet7McT4PoiOOYdylSoS2IednHFAIXhCw85RVd8GgZHyBOSD94H2S0Cp77H2AS+mhQkm768wGWEf+mBxLSHPSVVJo3buwQnxqyMWwWonS15m7PlbR0Hb4HbGojCqrGEDUAQu65Ixce0xqkbLulmHCWSc2B/1w6qdF82caA+OFDZgfKfwpDXsYqhWnsynxcX9QxrltYGXHkrkkO4NN68N/DeDjd/pcl4FXo4oesbTOXw5tIc2J9QfU9ssOUVoLDsE5eNLMTFL1hWLxpxevEUyt7VlBX9k9rukDVayRneQl95P+55mPPEu6hhxzC2N4cP4S+yEynPftRHeihn/4NullGwxaMJhtBwCfYGZoYuDYJDVAyodFXpf5imME0esbsGKmyEDkdL9YhB6B7lIYh0A4W7fk42oKbRr9XIm8qoeWLzgKkeebalFjyZUPdcOqHJ/la7zj06STrPLLIt4ErXg8fJycy5eLR4ncO4eeM9fn0VojIfe+I/1/l4D/4ZlEjTuCXZrfpz4LlVsli3YiaP2HQTqDICWpaapyj5GotYDW+lnaiDQiVYmQmFM+KUH6njkx+y7bsMiOlbPpNrI2JDuDnxbS0kZaz2Kznl4UNJOCjHO10PLgaxxs3kLZUcFfJemvtEfWN0lq/Eavaqn5g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Focq3eQKubbjDqnAYhEBGRYqpIGy7cCHrUQiKhYaUTKjiK/oTJvTGetxY6Jw?= =?us-ascii?Q?jYnitwFQxnmss3Nb3S+Df9RQknT2X1D4A+k7jUkkwQUxcQeQupyiUuVJGrjF?= =?us-ascii?Q?MRgvi1Jupilc8NFr1papyjSPO45uaPBkhRaS/mp9nBDoDBK0JvxjVBc+QOPh?= =?us-ascii?Q?xIbodmptHybWYKsLtqEiLoNvft1Z3ySvFkhFBi1mJWrgvYt1aLKLKMUN+meM?= =?us-ascii?Q?AqsV34P1e0lLy6/nTQIH86QOMGpjy3ptOhkPOTEpEdaTBHPqiR8uW+EkOvnr?= =?us-ascii?Q?JyObp/bsZIh8JwSAqBeLjIUg8VHwivjuE9ZbICxJtQwsBLZ0FpEVocjOVjNZ?= =?us-ascii?Q?FN8Z0NOQSttdHV7tgN06bAZ6qzzu81yE1I9D4ps8rIE0FtReqZ9NmhrAUeVx?= =?us-ascii?Q?dy6FXj+ZBACVlUD8bKxN7isRT9bznPW5tt+e+ypKNSra5u3Dr5Yva+gdOQ5G?= =?us-ascii?Q?kLMw9oX1bMetSBtcSgqbLgwe9iAeln9/O1AD+F93FjwxdsBKuozNOfPy60ee?= =?us-ascii?Q?CdvGfsUmd/bjt76+WuFxY7EWnoaJYaLKQAwTtdslPhKTjyZYGRC41hXGhjj1?= =?us-ascii?Q?1fH5an9cfl4yA+PY1QzcJdnJPbKZdDB4/hog9Z+fQduoSv8osO7NawEosGGv?= =?us-ascii?Q?12/7YnP2344LbK0KUdz2zTK9rIWBjBVOrlQ2weMlAvxr5gJxnQrJnwfKigs+?= =?us-ascii?Q?x1mM3C69m2BO/DC5yZg4rN/K24N96qnF7p6TXSwXmNND//EM0JUMCYDyObov?= =?us-ascii?Q?rMttg33QWNaJTGYvszZKwQ7uIAwRo+9YARmfu4J1CTFtb5cGzx6wrAaN3FIB?= =?us-ascii?Q?zBIMn+QDUNRyTdTl8vvFVjyETeqQmOxLEGwjy/Xli3v8Y/AHyEFfF6U3TFYy?= =?us-ascii?Q?fQDIGsn84KEptXRLfsjpsnLbPv+wnZksnTvfVrwJg0H1r7NDOzdjgjHYqawl?= =?us-ascii?Q?B5Xhn5Js2Hy+EK2I4U5h3/vVLB6OjR1Q2zsHKlNdSRBZW9TdExkJxyihfKEN?= =?us-ascii?Q?j+IAtdFw3iLqokc8ZNpWRheW6fNMGIIEnUlByvfmloOoQVWPizrNM3S/AiI+?= =?us-ascii?Q?C/xrB6JimuTjMDRorFb03E1A5qVLri+gogPNp24YQFGTL4Hg7dHWjj3Pu4/O?= =?us-ascii?Q?qdXZxzeo7xBsBG33LlSjkPM68BbTtZxULgc8Mmpo94gkvtI+HyazKBX+IGrX?= =?us-ascii?Q?IdeHtf1s3t2trdySx6/MqRviqX6iruGmJhx1dx+rLRvPM6mmMaq/3pHQTt2Q?= =?us-ascii?Q?fnhvpL8R8/udZABRQb50Mp9o/Ib0IpnwCIq6KGRwaap+2KYpg2eAdFND9dxR?= =?us-ascii?Q?7MWgAHOaJG11vKVrAM0XH3vqXZcG/8ZDW8xol6Kcx/vM1shObSD+u41+MIZ7?= =?us-ascii?Q?h0xKGIa1v+LEgkk2Ui8Z49VM+v1bG2jQKgUASTGbLdFGhtl7K1yRVwVgMZqE?= =?us-ascii?Q?0O7T6VJThCmrE0qeOAmVFrtqy4VTteQNcYjxsFrKRQ7gDQN5vy7xFIpwOb9h?= =?us-ascii?Q?A6b4LVIE67zr0EzxSKD6f48oiHQYdtJxVJ14iKFi6Ar2qqG8uDHEiLdW2Ros?= =?us-ascii?Q?AaAMM4Bgx4EFc+PtOvZR7Xid8+s/qpGa9qfElc9qb4vMNdQG//vaU6IgA4kN?= =?us-ascii?Q?tg=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6955e678-2ffa-4b35-1800-08dab57c600e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:22.0006 (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: bPNsHkZ8lyar6OyuwbTq1rc2UIyzede1tP5lQTcV5ysg9REWRBOc4kpwRhHB13Cc+8oG30jqBBWakBmrjLrAiw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Iz69Qq1NslHgL9AetrOU5nxu-zTyTQVQ X-Proofpoint-GUID: Iz69Qq1NslHgL9AetrOU5nxu-zTyTQVQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=601 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666590041916100001 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 --- 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 Thu May 16 01:58:09 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=1666588203; cv=pass; d=zohomail.com; s=zohoarc; b=C1cmgu0dmx+u1S2eOoCP9bjjh1xOC7vn/aU3rLLHvlFPDtdATldE0aUDhvJTasgUD+Xa6kLpYKDqjmHDRj2xJkW6smD1kNxn3u/Bs6oTEqbq7uYH8n051QiI6jEa7WRu5IQnuDB4bSU4cLwGm/G3CAO72iseCIiXuog21zmwFEc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666588203; 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=OQo5jnoZPC0PninEK2UB/sHoF3/ivHf4XYEtM2sDYds=; b=Z71gG4B4iRfnhvI0/WVknYfAu5K1cZ8vNlCHKRV3XPq9tNwNW8t+YswCLwpVNAN7pqmgd71h6UbkQaYoeDaaf5GV5qQN6tQjanySMQbw6KszbyKDY5sgxOeA3cCUs3r6v3IY8OM2alfYOF9YwkogSNFVgMWHr5tsUlbUrzO5+wI= 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 1666588203379881.930288542075; Sun, 23 Oct 2022 22:10:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYB-0004Fn-Tl; Mon, 24 Oct 2022 00:59:00 -0400 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 1ompXu-0003tB-Sk for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 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 1ompXq-00068W-Bz for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:42 -0400 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 29O4mRCJ026938; Mon, 24 Oct 2022 04:58:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2102.outbound.protection.outlook.com [104.47.70.102]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:25 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:23 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:23 +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=OQo5jnoZPC0PninEK2UB/sHoF3/ivHf4XYEtM2sDYds=; b=UR9towlvPrYnamW1zKh9tTxPLcjtwbQ/MitxeGZ4PoYHfHRdc5L7xCxse99L7snz4hBg sVBna+ICzBCVBo1shEmPMYvfUa7X/ox2v3g7nbfagtY25aEUMxyBLSm/GGTnsYuEle61 qu6apf3GLo6XLlslUN24ElBQVXsO9P5gA+dt6L3ANsgwTSi/xl1zVpf8pJGIMkg/ZrLG tBCTuN34ffm+Ug4wRDEe7LM6u++fhUK3WEkZrma4zaAYWepjQIsytRutXYad2ygk1Lwz a9/KTjqFBKclG8iQKswb+LWSoBOAbHBVLwBKzEh+0S996m4ox/x21yg2AIKKH3t1NGE4 Ug== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jvSu3G6oL6AgAzH12YLzRTAHP54KuJzHoAgqCc+gfskBJqpvspDP2F/90PB+DXyEybiKKF7enCROXZ4R7M6h8fevI5xZ5XnVc7F3gBM6m2ZY4R0uwvoS4Oqd29CW3t4tMa7GPAYO0vm5O+HCZcXBJayBz3QCQB/ZQyXpthSTejdwkb02gU2uw9aPAduIhYAuQM+/L9YJPNbQ9XZFAsS+kZso5hIhPBSliUVA0jdCI4K7SVagI12XVTKiTuZL1xhBzdDkb1rcz8AIG6Z+B18GksexEui1YYMYi9Jtw4YXN0uyFdjfXLly9zKcEtARHtyIXj427Ez8FjxP6HrqBXTIvw== 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=OQo5jnoZPC0PninEK2UB/sHoF3/ivHf4XYEtM2sDYds=; b=ZVJCibscG4t930FOoDqHoX8wVp56hH7bZxhUwLzEWrDxfNUps9vxuP4eRS2L0ILjSgOAU//+B0WaDpJziLymOkd5i/qz2QLCZmJERTWPVK6SVEFjHn72PKNIR3FqORYBiMM28a4gWP2IBh1krbgiHT2raGkPU9l/10US7LlqP1e+5gOeusgVgOHPxGrfYZKqIqFW5IuneQgZjSLmlV128pcJwRq9EX4cqvrWC7so+qBuh9YC6sY9iLGyQt6ESyG0H/M1vdJsNGyaDWdTCgEI0nuzse9ksqVg92z6hJ6gfhY4wgarx3wicEDfi9FLLu5Baxl6aNAGLb3jKVdp/rshIg== 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 04/16] hw/9pfs: Introduce an opaque type 9P_FILE_ID Date: Mon, 24 Oct 2022 12:57:47 +0800 Message-Id: <20221024045759.448014-5-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 109361d9-d446-41c8-113a-08dab57c6125 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B0MqBfurEe9YK7wYpZETeFt+QJneUQfQIb/WRNdeVSumoIiDpHqV2NSnRWje5EOjSDv0lJgAWHvz0KAz+1CErjM9iMDR6ucQ+RNJOrhr3n7NJy8LRKzf0+q86QwYkbgZbMy8aeMqJ0I6bNxTBGtvMixFSV6EaA/7uQ/UV5jCAwYxN3nYZc3ZbQbRV+zhczqajMEx9bYYZfQjOe3LwnKABcFH4yxMLo5cCe9XYUflVewnAmRJ3lWc6f+zVtcXcVJh+SHfL/r2KvTHh2Ho8R9o4Z1K4+RRS491GRT9U0xHtIi65AZQC5UlatIZPeJpaK1LuGUgHhWc4NZSQRsFJW+y4BlPFQMWI8mu6De3SBABTEz1GkE+0TZ1EamWhlpkQp/GvKGkAD1XdJKGDqRpMuqoFnJds1/wlAYz3pHzPSjKdsdqmVlnN5lKKpstIJ2qc6VTMDWTuDNWfF+/rD2WQje8IxJdOlpwByFAgnRHqW9fXWROAk7KUkQeI/nTVwaszyEMQnC1VjXD33wvsbcudBiPwEFccS8zWB4+n98XEzXqSC6U+g+aL3Ldg51Vdxh3Pgx4Ryx7TiXIWfeRlj5kthUAeJRN3KZspl+/tbiRrlA4YzGK79VsSlAfd4z5FwnnQMM1lObtIOZpRGLMAZA9chZ+Bkn8AhOR7W3UO3hz+STbjNAl1yQh8ulT93/21Gam7XrAeDoy5KAxhAefKCc3tj8N5lvfAj6mWo8RYh/JYs4cyEnwfSU0OSuq+4J/ozdN1+yOcHkowQreL4rnTasq+KmatA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CJh5KcNX38mdKLjaQEpwb3m/sFpkz/1gMbEwMDz7nILa4wz222LsM39PU8KX?= =?us-ascii?Q?LbQN8wZCOyf9eBr/Y3cFKCHmck5TBfLaM1aP3JDSQVdRzoX+5kLusuoO9NxK?= =?us-ascii?Q?G99WtlChw7qqG0+c0WtaE7ST2NdxEGCnR6sGu7McQdwPylGqNB6pSYFepT5B?= =?us-ascii?Q?gj6dJJ5oDRkL1zrAiTnm+sc59/CTVrKChlYFyxpsUaIXxDjW8xjI1uFBLj4j?= =?us-ascii?Q?GV4D2LXc7S9jqIqy30xN3peBC90hJvj2P8tVX2X/H43DgMg9ssuoSpGy+arV?= =?us-ascii?Q?JDsVEt7WhauDuRtRMypINP8ZUXetC4o57sqSde32rY5FklGqeqmdl6+m6eG9?= =?us-ascii?Q?5e7uoznHo+F/oMY8Sg8jgQezWMfzv4br3393N5RolmTgO8V0jGIrBCsWYWSk?= =?us-ascii?Q?ezc2T6PgJm2QCPIBNnP9KZDfRKrIX2p35/cgmG5DJSseukEPeLpSO0GnlUFz?= =?us-ascii?Q?/O/KNbyqDMeJ0/jzTvlCrglMsjvktw3oeUTUUR9oDxJOiqVZfC1xyTb9J0d+?= =?us-ascii?Q?jiZhnwg1SHqYT1ZsmZD4/Io+qtzeSsz59sIPUWCpH/ujoXXdl+TbqTAUx7gf?= =?us-ascii?Q?jPU+Za73RDxIopLCpZVpXnxxDwDPMh4hWr6TaoulHe+fBhlOjiU3KRVcBTWl?= =?us-ascii?Q?1G2oXVRjgIY/aW9mamEXa3nXuZq1FdqxUlB0ehlMwfw6suCNIKsTnDQ5neqj?= =?us-ascii?Q?udU4PpikuGN5946SnL4ihohNWCO0xLy7soN/zz+TmigtuKYBDK680pNbxk2p?= =?us-ascii?Q?xRWL86KomldY53RwTwQle+IJwD3F3EHQKGOGk9q1p95N0EsERZz9So/vKm10?= =?us-ascii?Q?hARNVBCz/LMDkkPomsrAN6wQRa0ypTsH5FUYzDwAanqKFniw2bcz2pHwELru?= =?us-ascii?Q?nDG1HXvgzuryVsrgqymMv6adf34IISQjH3wNjiMGOGNb9XoH7fCXrg+a1nGp?= =?us-ascii?Q?IiTNZnaigZGwtpq7q/kVd1g2RCFgQ80dB5mO9jZLfdjQ68Sx2+2hfs+qXgYZ?= =?us-ascii?Q?Y0+IzxjYUfvK4mx4tdiwi324D9M8s/rrlV2ETjZswqaYhZqe1+r+S9uM3tJh?= =?us-ascii?Q?N1N8eU1cloO3MEqe/SsC5LyPZh5OeNUyVuyrQ4Ga6H/xy1THkKfJFOQKijir?= =?us-ascii?Q?oUsF7zWfJ0RhoUvO/EAcIqiVOXptIeveAaTqHNUcDovvWhuU8pzx9irX1cJ4?= =?us-ascii?Q?coC19dkjOOVD0A5E1vwdZdRM8Ljv9k4R22J3c/TZiFxUGkoEYqRiovtWKvAT?= =?us-ascii?Q?erDmq4aKBMhM/uNMuXMIrd7scOBQa+yFt6YbRM3oXbQ2cbSw+fHTw4A0Bxv4?= =?us-ascii?Q?u4KPrcbAH0tPRGQ3vl+dkyn5uhWHJtvpLclp9KSNCb3uKpDb4rEp+fr55ZCB?= =?us-ascii?Q?oTUUqgb/wvOx9q5eZQd7Uk6anxyrgk9j9k661csGvR7xGXeQpf22GIGIltnM?= =?us-ascii?Q?fuZs9sfoPrDvOUiPYCP3+DnN74W6A+X2OsY90EbMRleEXVGCmYsWcqLyotW1?= =?us-ascii?Q?ePcfXBkMhYZStic4ecQYP9yRAuX7IQ5uMwdhjjEl/lg+ic75Tn6HCfvdfu/Z?= =?us-ascii?Q?a63kUhuYxb24g067d/9HJlwTfztwPa2fidSqmikoOuDYsv9OiTDCNzzBCzCo?= =?us-ascii?Q?Ag=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 109361d9-d446-41c8-113a-08dab57c6125 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:23.8300 (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: LEmoPOvarmEKcxG1AT9eCw2uHnWM15XcZmm2YD3gCzu+q2JYrGJNbLNdfLkd40MhzXWOH62NsEwLH7cnT7cH7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: gLl_et4pQfNYBlMgB7YU7VxZ_7MPkNVc X-Proofpoint-ORIG-GUID: gLl_et4pQfNYBlMgB7YU7VxZ_7MPkNVc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666588204325100001 Content-Type: text/plain; charset="utf-8" Introduce an opaque type to represent a file in the 9pfs. This is file descriptor on POSIX systems. In the upcoming patches, we can extend it to support Windows. With this new opaque type, it significantly reduces the number of deviated code paths when adding Windows support. Signed-off-by: Bin Meng --- hw/9pfs/9p-file-id.h | 21 +++++ hw/9pfs/9p-local.h | 8 +- hw/9pfs/9p-util.h | 28 ++++--- hw/9pfs/9p-local.c | 166 ++++++++++++++++++++------------------- hw/9pfs/9p-util-darwin.c | 14 ++-- hw/9pfs/9p-util-linux.c | 14 ++-- hw/9pfs/9p-xattr.c | 16 ++-- 7 files changed, 150 insertions(+), 117 deletions(-) create mode 100644 hw/9pfs/9p-file-id.h diff --git a/hw/9pfs/9p-file-id.h b/hw/9pfs/9p-file-id.h new file mode 100644 index 0000000000..60cbfbf4dd --- /dev/null +++ b/hw/9pfs/9p-file-id.h @@ -0,0 +1,21 @@ +/* + * 9p file representation for different hosts + * + * 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. + */ + +#ifndef QEMU_9P_FILE_ID_H +#define QEMU_9P_FILE_ID_H + +/* + * 9pfs file id + * + * This is file descriptor on POSIX platforms + */ +typedef int P9_FILE_ID; + +/* invalid value for P9_FILE_ID */ +#define P9_INVALID_FILE -1 + +#endif diff --git a/hw/9pfs/9p-local.h b/hw/9pfs/9p-local.h index 32c72749d9..c8404063e5 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -13,8 +13,10 @@ #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); +#include "9p-file-id.h" + +P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int fl= ags, + mode_t mode); +P9_FILE_ID 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..1e7dc76345 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -13,6 +13,8 @@ #ifndef QEMU_9P_UTIL_H #define QEMU_9P_UTIL_H =20 +#include "9p-file-id.h" + #ifdef O_PATH #define O_PATH_9P_UTIL O_PATH #else @@ -101,30 +103,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(P9_FILE_ID fd) { int serrno =3D errno; close(fd); errno =3D serrno; } =20 -static inline int openat_dir(int dirfd, const char *name) +static inline P9_FILE_ID openat_dir(P9_FILE_ID 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 P9_FILE_ID openat_file(P9_FILE_ID dirfd, const char *name, + int flags, mode_t mode) { - int fd, serrno, ret; + int serrno, ret; + P9_FILE_ID 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 (fd =3D=3D P9_INVALID_FILE) { #ifndef CONFIG_DARWIN if (errno =3D=3D EPERM && (flags & O_NOATIME)) { /* @@ -155,13 +158,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(P9_FILE_ID dirfd, const char *path, + const char *name, void *value, size_t size); +int fsetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, const char *n= ame, void *value, size_t size, int flags); -ssize_t flistxattrat_nofollow(int dirfd, const char *filename, +ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const char *filename, char *list, size_t size); -ssize_t fremovexattrat_nofollow(int dirfd, const char *filename, +ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name); =20 /* @@ -219,6 +222,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(P9_FILE_ID 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..7e8d8492ea 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -54,18 +54,18 @@ #endif =20 typedef struct { - int mountfd; + P9_FILE_ID mountfd; } LocalData; =20 -int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags, - mode_t mode) +P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int fl= ags, + mode_t mode) { LocalData *data =3D fs_ctx->private; - int fd =3D data->mountfd; + P9_FILE_ID fd =3D data->mountfd; =20 - while (*path && fd !=3D -1) { + while (*path && fd !=3D P9_INVALID_FILE) { const char *c; - int next_fd; + P9_FILE_ID 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) +P9_FILE_ID 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(P9_FILE_ID odirfd, const char *opath, + P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID dirfd, const char *name, const char = *mode) { - int fd, o_mode =3D 0; + P9_FILE_ID 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 (fd =3D=3D P9_INVALID_FILE) { 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(P9_FILE_ID dirfd, const char *name, struct stat *stbuf) { FILE *fp; char buf[ATTR_MAX]; - int map_dirfd; + P9_FILE_ID map_dirfd; =20 if (strcmp(name, ".")) { map_dirfd =3D openat_dir(dirfd, VIRTFS_META_DIR); - if (map_dirfd =3D=3D -1) { + if (map_dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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(P9_FILE_ID 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; + P9_FILE_ID map_dirfd =3D P9_INVALID_FILE, 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 (map_dirfd =3D=3D P9_INVALID_FILE) { 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 (map_dirfd !=3D P9_INVALID_FILE) { close_preserve_errno(map_dirfd); } } @@ -305,7 +307,7 @@ update_map_file: } =20 map_fd =3D fileno(fp); - assert(map_fd !=3D -1); + assert(map_fd !=3D P9_INVALID_FILE); 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(P9_FILE_ID dirfd, const char *name, mode_t mo= de) { struct stat stbuf; - int fd, ret; + P9_FILE_ID 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 (fd =3D=3D P9_INVALID_FILE) { /* 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 (fd =3D=3D P9_INVALID_FILE && errno =3D=3D EISDIR) { errno =3D EACCES; } } - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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 (fd =3D=3D P9_INVALID_FILE) { 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(P9_FILE_ID dirfd, const char *path, FsCred *c= redp) { 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, P9_FILE_ID dirfd, const char *name, FsCred *credp) { if (fchownat(dirfd, name, credp->fc_uid, credp->fc_gid, @@ -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; + P9_FILE_ID dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID fd; =20 fd =3D local_open_nofollow(ctx, fs_path->data, flags, 0); - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; DIR *stream; =20 dirfd =3D local_opendir_nofollow(ctx, fs_path->data); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID fd =3D P9_INVALID_FILE; int err =3D -1; - int dirfd; + P9_FILE_ID 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 (dirfd =3D=3D P9_INVALID_FILE) { 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 (fd =3D=3D P9_INVALID_FILE) { 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 (fd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; =20 if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE && local_is_mapped_file_metadata(fs_ctx, name)) { @@ -891,7 +894,7 @@ static int local_symlink(FsContext *fs_ctx, const char = *oldpath, } =20 dirfd =3D local_opendir_nofollow(fs_ctx, dir_path->data); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { return -1; } =20 @@ -903,7 +906,7 @@ static int local_symlink(FsContext *fs_ctx, const char = *oldpath, =20 fd =3D openat_file(dirfd, name, O_CREAT | O_EXCL | O_RDWR, fs_ctx->fmode); - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (odirfd =3D=3D P9_INVALID_FILE) { goto out; } =20 ndirfd =3D local_opendir_nofollow(ctx, dirpath->data); - if (ndirfd =3D=3D -1) { + if (ndirfd =3D=3D P9_INVALID_FILE) { 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 (omap_dirfd =3D=3D P9_INVALID_FILE) { goto err; } =20 nmap_dirfd =3D openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd =3D=3D -1) { + if (nmap_dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID fd; + int ret; =20 fd =3D local_open_nofollow(ctx, fs_path->data, O_WRONLY, 0); - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; =20 dirfd =3D local_opendir_nofollow(fs_ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; + int ret =3D -1; =20 dirfd =3D local_opendir_nofollow(s, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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, P9_FILE_ID dirfd, + const char *name, int flags) { int ret; =20 if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { - int map_dirfd; + P9_FILE_ID 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; + P9_FILE_ID fd; =20 fd =3D openat_dir(dirfd, name); - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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 (map_dirfd !=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; int err =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID fd; + int ret; =20 fd =3D local_open_nofollow(s, fs_path->data, O_RDONLY, 0); - if (fd =3D=3D -1) { + if (fd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (odirfd =3D=3D P9_INVALID_FILE) { return -1; } =20 ndirfd =3D local_opendir_nofollow(ctx, newdir->data); - if (ndirfd =3D=3D -1) { + if (ndirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (omap_dirfd =3D=3D P9_INVALID_FILE) { goto err; } =20 nmap_dirfd =3D openat_dir(ndirfd, VIRTFS_META_DIR); - if (nmap_dirfd =3D=3D -1) { + if (nmap_dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID 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 (dirfd =3D=3D P9_INVALID_FILE) { return -1; } =20 diff --git a/hw/9pfs/9p-util-darwin.c b/hw/9pfs/9p-util-darwin.c index 95146e7354..c509034fb2 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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..cb5e988354 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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..aaa364ea4a 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; + P9_FILE_ID 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 (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { 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; + P9_FILE_ID dirfd; ssize_t ret =3D -1; =20 dirfd =3D local_opendir_nofollow(ctx, dirpath); - if (dirfd =3D=3D -1) { + if (dirfd =3D=3D P9_INVALID_FILE) { goto out; } =20 --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666587705; cv=pass; d=zohomail.com; s=zohoarc; b=KjtFa42jMznEQPw2cnLVTENx2M73jXZNVp2PzEtqkrED7gQLU5QHrv9kVXW8jC2pU1y8pVaMa68TzMnIUBG0ILHo15OXnpLaYGco9+gZ3buLieG6kOyciJUZlad6VWs4363rII4m+4+Kd439r378vT7K3nizYKyQBWVS9Wam1bw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666587705; 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=R+duudYh1J0kX/mffKQJ3Z6PLhCTv7qtHEh0HvLqpvo=; b=hLG/VAk6LmzQxZqkRuP38xbd+VYNvIa+KWt3FdRbJVc04qy/lHbHgDXGtwNAboM2zWN9Wo+BuK4c9Ak3TCVfY1yVtTzh+/D/j0Pe8Oz5UXLRTfjmsWqUnqrDNasTMYbrJIc/VW0q1TkTFpAPZOt9/O2X8ZBGl00GOBW44Qn9f0o= 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 166658770525394.67780712006277; Sun, 23 Oct 2022 22:01:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYB-0004ES-57; Mon, 24 Oct 2022 00:58:59 -0400 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 1ompXu-0003t3-3D for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 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 1ompXq-00068S-Bj for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:41 -0400 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 29O4wR9p014323; Mon, 24 Oct 2022 04:58:27 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stj8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:27 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:25 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:25 +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=R+duudYh1J0kX/mffKQJ3Z6PLhCTv7qtHEh0HvLqpvo=; b=fPnBjh9nJrw3Aj2/kqBAsPyLndP092C4gLrCR9Nk90hnF/Yb5gdLNhT6Jqvu3hpZI8IL XRygCmC6M4DtD7NNim6z5GR32uaOGoQweA4sc0k2NuBwZHfZkOL6x+ldmJ2bcK1wTwcM Z/N+8vV/W+yOHlrWpVg+OLggaxE+qzJlcLPww1daMAY2PHeBDYHhpUt6deGJGuz8aG/l H+vODrdadT9/nDy0jJYQXd95GqqtRbVYTIB4rf/Ztr8IxkhJpndwAWzgi7RrkkWs7l9s 9LzF1PsRfK/0B/SHg6YEMt9poVEjOtcJ3TBnRVkCA4dMzQVvXQFQGJ2CHp4HsdgBD2Te hg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XL2ijE9AbRrI4WqsrInfv0fAqjpLNAbeXdR6GRm5lhbSfKnijIohiLTwBz1tR1npSw0GvtTGJWxeR91vXT2i1+We1RKn+YXnROtwkqdu4WgdFp30A9PpuqD4jdp3eznmKlZBByGFbkYSrxtC3oBLm/6tPJGNnEDmt7febSDqCNhC4cbDVZEA3GnoDf2f/pBL3o9dtUIPJZi1Z3VMBKeSk+YzxttZ67E/D/uYECOCERCSIs7xEeCuDqPJeBSpSdh1DLEjwiicc6eeR5hKod2EJzOEIEKrhfHCi3bNDeR88KKAetBDv7KRiN0c8SHGkV71E5/CGdDk1sHHEU3gat35Nw== 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=R+duudYh1J0kX/mffKQJ3Z6PLhCTv7qtHEh0HvLqpvo=; b=NI4XLtejuvOoaXaQ++4fJBu3OWwxlRMfaUIj4WDKcQ6bVfy6BUOXLQi64vh+wvi7TA37pVZw8eBWVabKtStMj+FLkA0A83SLgKcYlD/pUQmW/7ezj7ENnCHCZw3tiTwaO6ERr/iLdhRbVlKY5WyzyIORVNSSVbk1okGhLnnnNimtmd2kJyXN4SJz78ephtAvWlvEHmmrJI8dxpWnT+Vr3sPdAdzT0/dIR0vzUMciXbFMdjzLxE1GejEWPQMwXuat2emB1odgbpPqQU21yXoTeezpIGLZRJtlsg2J+tjQuJmEt/ovkn/+H7kJ2Apwhxw6aIUJSTI6MwiQcLO3qCitCQ== 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 05/16] hw/9pfs: Update P9_FILE_ID to support Windows Date: Mon, 24 Oct 2022 12:57:48 +0800 Message-Id: <20221024045759.448014-6-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: c17bee60-238e-42bf-e4f2-08dab57c624c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wgghzCmL7QuXl/OVZzPBacudKlptNLbmLMSt7iuiur2leIHj1WHKXaB0LLix/dORcEuxJSbmnbxPKq3qmTotkK7nIt6RcIPeYqxCKG53Yz2BaGtFobiYppvCumoqL4zE9sg3hQIv3PU+38Vc2C0cNAY2gChRvhVyIUQ0Ftc+4DfKUlJ3ImdhBg9RMU0++i3f0JBx3jwwBcrL5cndxjS3hGLY/Z2pDqmj9dxU0PlYOKSgaGGSyAyBMvUac57lg4zyTMB2ui+BHI6QnZQvUE//lG763RXpyZSsxOhK3OZWMtyDXJZo70m82zCD0aAAn2ds7rQePf8uDNatW4XCvN000kY998ISmmo+WZad5qhwCeIHBYtyiYITFA/Lvrp5MW4ZzdC8ReUkyR0jrs9sGAtby86YVJGAzn7qgfO1JEahroL6VfanhtNsK1AXdA9ieew3NflFjFmvbriJWMkCHwh/oLkck4P8j/o1OgoOvm4v8B7zyvz58+mcHR22KhiJ/UR68kmSBdnfUJ4hECRai+axg8egcqbkYnT7jEKVY11kbuxs9MQfdDt4q4MNh06/M3RpQUTKG7N6g8u2q7E0w1rW9J3TCfhN8lQ95DbQ8Px9bMqBMUC9HteTeX2aV5eGAfkR7hbV+dqICai3G765hK6/5ETk169Z64AHwqFJWMCFMeKj0Sqy5OZ6/613+o5AcUdBrlaqPORfxc9aSXXS+JKJRdjz1H9aNRBdNxWP7/X4/+oEmR/8N2mTFg42cc1padmq X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3meQ3teh1xTxL/vK6ffceVuDlVALCGREa1OjlVvMwfByggkKd1qBonnHrfZr?= =?us-ascii?Q?uilPLPQoF89MMydcfUVME3VQgh72CN8NyoV49K4++Dwq9uNpqsj+fa3geu2S?= =?us-ascii?Q?UW9r1pTe47AUJzbFZJu7RqD0Zit8DUkTy058IgMpqt07PvKok8OS4wlkT4uM?= =?us-ascii?Q?VjaORN1DoB6fyLfAR/sEKYTsNsQy2UbXuIxm3C/Hb8vHFqCjn7+izR+wSPn3?= =?us-ascii?Q?TBPTAAPo4RWHY+sVvuXjJuTPcBmqdCDwkrv3U6MbMEmjtHDuK51V5MSK0UFV?= =?us-ascii?Q?JydyNEqnr09tyPl7zHtKn687hXlQubgh6JTVapGq5SI+WVZSFJca0LuRH1Kg?= =?us-ascii?Q?MfDDSYVRDZWJumHGWN7mA069u73OLjcTkA5WNWApc1OOTiIwUFs0+u+aIc9g?= =?us-ascii?Q?VYDkddX4aHX7Rh2ZLNv1ibRrhK8BBLADitEN7z8LuVp1sO5oLhy6aN+gLhnS?= =?us-ascii?Q?Ob/7JKOYaWblb6xYFGuLk7dQfuYfd6VCzsKOm0LxiR85SnKreyA20BJFDNbp?= =?us-ascii?Q?3SOt1pjP19a/0X+O7tOlE+P9Y9EF+eDBZ8u+YIN3ljQDKByRscXOScVtqnxp?= =?us-ascii?Q?0KozCFbZe002hpq/9VcgKNeI5y0peqxKwGGY2bZM8Gy2pzn3reYOuc3qJqEf?= =?us-ascii?Q?AUQPhaTM2x8te3lExa+j801qlb5ohKh/EJnOvsidD/rGm4QW/Rzx2+yNCZtL?= =?us-ascii?Q?W0tCpS3M4NYvh4gY08OzkmaBJtn3F5FV6TmMFTYs70fFhB1w+sOH8r7eiwpA?= =?us-ascii?Q?C4ars3hv7+CPighnOsP75o5O7HRMfv+GkE9VlNDnRDghKMWp2vnb8xkqdJ3+?= =?us-ascii?Q?oqeHENKjPhX9ZCt4T83HivnxAAcfcR2FPE3vHkcERqTE+O4G2V7iQmjWO+Cz?= =?us-ascii?Q?JDXWFG1WXLq90VD4ge2dimunP2FFz1+CG/SQ++Gq7IEuZ7UNJt643qXYye4e?= =?us-ascii?Q?Jc9W01zqYJaDQlNxvr3AoY6idljABYmqjeERj+tAgxt5LlCRFbRQKOkxCS+4?= =?us-ascii?Q?eALC+RQ8EvLcHlolrziAfR4c8gu3CcUB/sEDqHcreh16xZK/GYsSc6pIvCac?= =?us-ascii?Q?2dr6ye4i5OQw4CD8bP3c5vqjgGxJvSN7TxaLKMMeHYV3aGghT6/S3nC/7uUb?= =?us-ascii?Q?RcyCa5AfmvgB0NpAKDcFjjg7WmjAECMPsenOVX/1FO/FymYaQlH9VNKarRHL?= =?us-ascii?Q?6CQxGqDQVvCG3cwBlODywowVwN6w5ww3td/HPc6pNZOLqSL89cr5wPYkPT33?= =?us-ascii?Q?7cCpVELUC1L2cnJqP14Eb9H7sBcJYobyAs7LcgQwvqVgRGhbFmx8PD9QHZTl?= =?us-ascii?Q?ZKT+2KExDzC0I4jCsIOiHW0uBHbt59yBoGLH++1iqbaQd7nqKATGZmxPNHj7?= =?us-ascii?Q?+87EqGEmcW52Qi9UgARlZyF//rvcR4qZgnZT5AYjTn9dyKREFmbj1rPox7xH?= =?us-ascii?Q?IbFHIv1Ju6v2SMoIpuWYty1jv3aIzW1hWrVQME1JIdNorQ/Kaehz8IQSq9Iu?= =?us-ascii?Q?CT6OEHXnhN4/8JwkbMthDqaVVpw3guwlJuMZlCpLTkpDIOvN4czvsOdPbT1A?= =?us-ascii?Q?sjWFdRH/wAZufX4QaXcqEp6h6xgm25FzeRaH2YqoS3/0ESaXjo7eRINmZeWu?= =?us-ascii?Q?Jg=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: c17bee60-238e-42bf-e4f2-08dab57c624c X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:25.7999 (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: /07WMoAiTCyyzHOyPsINbGuklX/UHSvEv3EgfCUlrpKwqufbH37p7KwlFb4JrFr6wlgGx4GjWcNX6rk5t9q/WQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: b4cKdonRYx6U4OXJ03rmOZKW6HrrmBHc X-Proofpoint-ORIG-GUID: b4cKdonRYx6U4OXJ03rmOZKW6HrrmBHc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=580 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666587707225100003 Content-Type: text/plain; charset="utf-8" On Windows P9_FILE_ID points to a file handle. Signed-off-by: Bin Meng --- hw/9pfs/9p-file-id.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/9pfs/9p-file-id.h b/hw/9pfs/9p-file-id.h index 60cbfbf4dd..00903048e6 100644 --- a/hw/9pfs/9p-file-id.h +++ b/hw/9pfs/9p-file-id.h @@ -11,11 +11,19 @@ /* * 9pfs file id * - * This is file descriptor on POSIX platforms + * This is file descriptor on POSIX platforms, handle on Windows */ +#ifndef CONFIG_WIN32 typedef int P9_FILE_ID; +#else +typedef HANDLE P9_FILE_ID; +#endif =20 /* invalid value for P9_FILE_ID */ +#ifndef CONFIG_WIN32 #define P9_INVALID_FILE -1 +#else +#define P9_INVALID_FILE INVALID_HANDLE_VALUE +#endif =20 #endif --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666593157; cv=pass; d=zohomail.com; s=zohoarc; b=J3CuOTZLT1iBFF3f7m8dK/70GYI082IxohSUu3ortDk9hOY6CZ+FlFDMb8EbW47UJPMmfFJM5qv0BrQj14ZsZx+1vEmfaK/nZWQ0FMLzp74pu/bNk0riIfULG2P0LDWsDKRow8rRaSqy9c5uIJWCT68KvMVgyUrkh9YzNeh10bw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666593157; 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=VUDe3U1eqSLzc8yDGCxSdlQo2llDVsZM9his1/vi9PM=; b=NCcD3NNevpNEcqvl8QiWzCJk6a2y9YMOBKYabddPuUo03O843jW33514TujcatE2G4AxMie28xGsnwkHdj9m76Yp2VxOCKCWa6KNqabA1pW3cY2UZSN7tbyxO3TN10SyP11qF8o2EyvyeatKpfocMcXTwQLrzhSCDAVTR4ba9hw= 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 1666593157831985.1560620791336; Sun, 23 Oct 2022 23:32:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYD-0004Hu-Ki; Mon, 24 Oct 2022 00:59:01 -0400 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 1ompXv-0003tC-PL for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:45 -0400 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 1ompXt-00068u-R9 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:43 -0400 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 29O4wTX9017633; Mon, 24 Oct 2022 04:58:29 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc5r2svrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:29 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:28 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:28 +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=VUDe3U1eqSLzc8yDGCxSdlQo2llDVsZM9his1/vi9PM=; b=jCil0BNNFw20t14s9vwcxD13kk6+DbF3qEv+U9TEZcL8iDsekALLMZDB+ThOj8E0xUjj pVREvXrhqyKFpBPDB45wAklCcVIL9E2jJf1yfQ6mCEbAS0KSYdvbmQT5s6p7x2qWRGyo Hy/Idg3SfzvV62gxuUHEBdQcy002ZfexYPTbBEQHrWVQTjp1Y9AtOQamholBG+RzMcxj 1fUmSS8dly1T3oIRnt7o/F6o7VduFCWvq8h/2s6ohn/wERNuBmb6WtoCzc/5EkQ0aBSV Ol9WsDNGwy3Asfd5N9bldNay9SlQR4UaESu6fUQvRZa1xCPzYOgQt7mdMZGaqZlzdCE9 bA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBUzder0SZgv0ZEt+vj/epDAseviVjH2HwZCsrDvteuOeAcVdtbZ4DhNfFybhvyhGhaLKHKFxoWo7GFE7SLnbE73YBrca6mbCkcNwk94g4DXBWT9NCV4rNVqvk957ZxixY5jA4HQXWPWQWyjIeimpm7bATXBE8sicRRHxuWDd3aD7xStU5f2Niigr2wplm2TTeVe3u2GutdmuErkKKGTXF5Qy2WqBBA/TcFmfIg8U3I34tJnGkwt93o8T1gIWVeXbN4zzvPkDusreP5a0v+nIklHrLauGJR4LsXWha772oJPiXEtv84WvIYuOSrGOWfIzFUuJGYu8bfAAjX2WwhJsA== 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=VUDe3U1eqSLzc8yDGCxSdlQo2llDVsZM9his1/vi9PM=; b=PXcYf8hd5xZnBXnP9haTKH9793MCTDugZw1fszFSP5uBDctMPooMCY/2AVKEDT7AQ+rMerhA+BDrzwIWBPaZV6P1O3i2e7/+VW4dhnjuTXQCo6eKirAxSVgjs5AwsB7xWFWdkMLYh070gDu0ohN2KlSGrOp7Egxf3VzBxD9IvPmyoTw1ai6slJi/G7JqFmwSCeRqQtot8llwtqbVRPSSqeOarENzz78xTP6wFRO1DNULjHYUH49WK7GobjnMqvxhdKTg0+1U81Yz6En5Rk0JBRbupFNJU3JEe/NB/5tf521lS7NMSf+GMSp9cuJeCVIed27z+grfw6ejvP6AQaT4yA== 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 06/16] hw/9pfs: Add missing definitions for Windows Date: Mon, 24 Oct 2022 12:57:49 +0800 Message-Id: <20221024045759.448014-7-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: e80b15f3-5241-4d0d-30a8-08dab57c63a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJF3eWOWW4ZknASoHW/J7xnawrAOWfz/A/oebnCau2QHMejf6UNSO5NEFtOK6viSCtC4yzc0W/SJeNivr/c1FsR3mawjX/cFEmxxQ7YUy6n0N3yCizDYgmambx9xaQ6uxdRXk6f6ZQVBk3XySlIcfBbN/1ssXX2kWiu+AWYBbUB1+SRq0IL0hbOGDp7Nu5gx2YFze098L39jbPDUCiR7/bbb9tvUflDE+4ycusHIUDJJEdEMyjwKthLthL8iX0dw0cIV2sMDO7QMLT+NedyjERC2c109rcTeSyv/D1PyuK6v0kS5yrMo+JoVOoclQUmpYaXefhivkmr5mXNFFxLEI2B7ijwSPPPkQsiUzlt+iFN+uBLs0a4KXKmVrw0gRR8qbCPEWv0ypwPtTxPpvIbuIo3eryO93SZ9sKI5pHrNWYzivfyKVgScPn5/cSHpcHRsOsfZ5nAIFtJQWR0hdr3LpPDtQtau79IUyWxrb1OoqEqcD5zTPMWOhW2gbL+fU7TPzhte/kn8+UCPXJPZ0IKLs6Pz9p8PxTj0d+r5zuZh7XEPj4Vqs/Vxn52C3IEmwyAjSEk4FwJbeMFfuApXiEmZOhTTmQW366uTguntFg6dOVmZvWD7JRmm3lTNI3nUHoQfeWkKELOl4aGpStnKedmcMxVKwo1J1K24qPDWSt9p+Ehy9wx0kouZFMtsN/izjfPzYgrB3t93Mv8UQ7XmqTj6Ka5xlozXMGc9g1o/IdQ9uAV9xx/1qfIPD3dDbdTp2PUzJ5s8R0AOcMxF+soW+xHH2/0V7CtYlc9MJCnkcbP6qaQ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(966005)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?dnVO5QrGsXJpfUz41Ylq47zqqcWSBGefb1ChJvknyQhqsJ/Hz7QlR0OcVVZg?= =?us-ascii?Q?AdI0xPgwA7hjquLSGS5/Ssk3UOsZzAsopJObvEhQsyTXFlUzbVufAtMjXQkj?= =?us-ascii?Q?6p2UkcFKNlKcs7HY73Yi8u+49eGf9W7ItWAKf8fD54r83GM6M37vWijppFqu?= =?us-ascii?Q?2thUJO4zjUaVktDQcMxkGMrQbfPGQQeVHclYVt0HfW2zcOHKZYyUHS/bZNVB?= =?us-ascii?Q?xX4dL2lNSXtU2p7SgHlbskCybW0mD16EuAakG5Qvrg89exHRmPIuzZXoo8kn?= =?us-ascii?Q?h2iLV8oCafvtlnMA9vxAEBTcGjuxqMMZDwGlh1rJxv/botukVDDnvODHW6Ul?= =?us-ascii?Q?CS4s2EM3gpeVt212PHOj/PZ3PsX2biuMPAfDk9N5jNvjP+AvrNid73J7sVHg?= =?us-ascii?Q?98YQw3DPnazOPGmdJHWFbFJK5xIkiuNo+ZYrDKJN+j3P+E9yoA1HQ156cPNn?= =?us-ascii?Q?R0dvWp/1bpyyvdD60PP8LyV+S3JO1Mt59H8tjfnRg1tGnnMN7tcncacXNVav?= =?us-ascii?Q?heU56nA1BHAcLipDyVe5yFnW7W87ilyywsRyFalDBwHcULeHWq0vQjvvEoX3?= =?us-ascii?Q?Z7dBGKaPAZcJnV89Bx8NggY6Gt1DVFdXM+BA9TBDl7cBBgMOvJYokJvm8Grj?= =?us-ascii?Q?SL8jDD86PH2kq9ok6/FNHVq+Whtpy4woG8FfI4wFLvwbNTgIyAEGB891ML8F?= =?us-ascii?Q?EFbiczvf89j0VLkNjqCM18lK6sY8xjY+jZye977Z0QsYDZoECyczS1AyQj6+?= =?us-ascii?Q?t9mNNJZgRdZ+aD8PIbJlm6QD6Y6g2uCYuv8/1x92H4vf84YaOQcJ3ygRpTqX?= =?us-ascii?Q?i3GQH+6bZaBogvdehGWbPEIfgY2fOib8kl4MXGLDeGg9ZZO7nTT0/HQY3e4u?= =?us-ascii?Q?HLOAsRGmNnPN0LTc54r4yi/wXEQyDHlbX2/F+yt7xe1898A00vSl+i8Tgity?= =?us-ascii?Q?/ozbDyYTFdBqxiG/bO6A/MM3EKqQf9fxFQ3gUqnPM0tF3VqZIo85Wc6FP0oF?= =?us-ascii?Q?TofpuUjCUmO46jT5m4sKwOGU1dtDAhCDnU9j9bDOJX90qNYFM1yhhHqJmiYW?= =?us-ascii?Q?DlFQMJx0Hw4km62hswbPMieeweFNzQKiEDAEWdKr7JkJI3EmR7e/5WKnVUCM?= =?us-ascii?Q?R/CtChHD7UfMzdrrzfQ86kkWGnkOy2li41H2LctbeOu8rP9M6Tvni26xe1jn?= =?us-ascii?Q?oF3ou6ogOvG12QOhEdtgtNjiYxKDruNCI2RXYiH/hF0jsYeovu+YmRnBcslu?= =?us-ascii?Q?w77zqqFWbNOm97uJtQ4645epqxSePpWqTmWUz0ixs7UAIWkw2KZVoduYzUCW?= =?us-ascii?Q?en1oEHunxAhM7jkUBL6dZKkk8jKlrLHZRokuHSpwHrnWb1tLln7WBnPAJvGt?= =?us-ascii?Q?J9eKow8LQPab9Me2AjKRDajCrXRkeT476VPN5MoSHCdW8h3HGh05QMCa7F5I?= =?us-ascii?Q?Kq+8elbwT028suzb+tsDdK6PxCHfwJglIbmOnRMjxplhesYf7jquk04M2pfG?= =?us-ascii?Q?mEs6hhgJsPMoKF9JbBMeZ8UTFKTotUOZI72eKPGxKiZJGeVH2Rz2BDWPKFiJ?= =?us-ascii?Q?VtVJgttIIRyGEhHzfOxyhpVCxviE7HVY0wiNzT0vF+4XAKn6AROLR2uyNnbg?= =?us-ascii?Q?XQ=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e80b15f3-5241-4d0d-30a8-08dab57c63a4 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:27.9717 (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: MqZgNQkgWzMrAZRVNRwYwSP1NpJhaUb0rhGMipaZ/3jQ1lwv1XSuryhh+QEsTP76lhiRR7wndemIo+JqZmweCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: sEA-AloqPglvPUw3K7M5LJhx7wE_93sZ X-Proofpoint-GUID: sEA-AloqPglvPUw3K7M5LJhx7wE_93sZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=608 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666593159016100001 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 --- fsdev/file-op-9p.h | 33 +++++++++++++++++++++++++++++++++ hw/9pfs/9p.h | 11 +++++++++++ 2 files changed, 44 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 994f952600..670f5dc4fb 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -3,13 +3,24 @@ =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 +#endif + enum { P9_TLERROR =3D 6, P9_RLERROR, --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666593037; cv=pass; d=zohomail.com; s=zohoarc; b=kvEZGXKuDPDFtbqw5p8gS9gwxFCXkvpu7QS0MbzBL9RzXon0KbNICrn7YKODPC3twI4Fj3qDU0Yy88nEvV2mLFlv3WEFIXS0sJ16k73HsN9vtA32mf7AxCUvMegSckbvV+j/IXG+AESVXWwyj5qlHnchy71FRr5MrFqyHEoUFvo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666593037; 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=6aclRzkAXh0uzcBoQTvPL1E++MVkrMwSiPU1IskNBXU=; b=MsbOBmT/K4rntcV5Y11Yf4QJ9zfFVw3d4+RcvNHQCClCecTqx32mBaRJUTLONnPBhvrkKFd6FheHKl9LQcUswfr+PHnhT3Bp7UF4SlhrtLx813asTIM2GyYY8gSDWyThncYE32jj91EI3EUpAsHPRAW10mrHnOVjShHLtwpRWiA= 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 1666593037332681.2064929207872; Sun, 23 Oct 2022 23:30:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYT-0004Qx-0v; Mon, 24 Oct 2022 00:59:17 -0400 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 1ompY2-0003zK-JV for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:51 -0400 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 1ompXy-0006AX-O2 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:50 -0400 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 29O4uZvQ011846; Mon, 24 Oct 2022 04:58:32 GMT 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 3kc7g9stja-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:32 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:30 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:30 +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=6aclRzkAXh0uzcBoQTvPL1E++MVkrMwSiPU1IskNBXU=; b=UlgFe+d5GugHlqC8cbVFzTPZlRwzd8q6F6ghN78UBduswv+O2mwFlyxW8eE+TMtQmE08 jucl/VCkDfAJbjlSfEB0ao3Fg+t3I6qZLGqR+XQAeIYeusN96JfvyhdknfLEKmDWboLp PWvxbNrR6kRQlCAeqDEQV4pzPUiYGE5IZTl6V7U0mCQifOpRhFS7SoAcJRvhOUGbSlMs h+oUGLJKVzwksnsdRLYWEAalYy7e9d8ZjljZHJfIxTDq6XFv1GXMyZHXE2aq8VSH3061 XfCN4eB9fxwjdidynP3xClTc63eUv4Cou1q3Sc3OUAbQQkcyKophUbEUWyNcYO+BHCOr ow== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mNfbY5QGs/3SJiukQYQ2uxJdvw0ZGCsFVz3haXSm/c21N57P3rPUA+Cpc+LsbDrbGDWphGTiOZihW4ZXVXamsTqtxUE2glKdL26IT91lZZ1AdwuHkODEkKvZt968FTTx2jHjW4DpQHJn9UpBogDUMdBZ85xASRt9n19kPzSuYKgpoXSuU9TBhF+Yi1AuiZNXzuld9yCSkBFJUajQ2EZJsnNUu9IJ5mkreBrF36IUcOe2lXdMy8vUSSHM8Su5UU46IBOXj8oahgCOGareq+iR8JSVfQvkXPxthF2SDNnO4J4HfLRoqVCwhslp2gaDkJYIxWPZPKfR/gvRLVX5N+xiBg== 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=6aclRzkAXh0uzcBoQTvPL1E++MVkrMwSiPU1IskNBXU=; b=Ztse8BQg4ERaVCdoHw59ifHddZc1mVbE5RlzzSsuf2ydCwKvkpjmtkxSgVZp+PMg5/i6142dR1FH5jKVXcFtXwweGLB7LxFgyw4z983qT4u4/G0mfnJdvwccUxalbpTLdsU36Aos/ZFBLTZttb11BRD4NhzCXW2KmWhvcVSH3btX8HaTCVqImFS0cOiw0f0RbU8NJeIYS6tlKUHCxA1DVJw5sJ5gfHg9aUoIIdlJ+L2GOJNB0bJiVueot+0xNoWWko78nnHA6aRqpKbyKE8JZgCA7Jqts8tSlGnRy4JarbnOEgy1ZQAh3KQl0XhqkAZeWipsZRJPDdCnA75ZvJs1/g== 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 07/16] hw/9pfs: Implement Windows specific utilities functions for 9pfs Date: Mon, 24 Oct 2022 12:57:50 +0800 Message-Id: <20221024045759.448014-8-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c95dae0-c5e8-4f48-e237-08dab57c64d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u9fAi5PiNRImI9/iSsb4iBqg9zwfwvF77Omelt6WA3g9DBqFHEFTJT3t7YzMNOR7Cptu6tS/cUgyuwL/4ERLPRhUAUnlBBzYM13DHlqnvrYJHVw7Npxhw1UdEI7gEND2WuOvoo83o9sbGHgiqOQSauZ1TdA+Txw7yZXzXnpKpg1RusUbPW9WnzScnZR7zzSshkfOMbI+zngTgcNqKsT/qQeEHQcU+uOmpkLEiG70nPO+4beXzHtQtSmvthHdfsDRQjHBojAo5f/gwvJeVCSdxCcn75ODwGRUNodwUSAkj57w856m50uvVAfpJjG11Hjc6g483pFWFZWKZqoCLmRv2IfrJPX2bTsP+BQf8V+y9ns1rL4gjCpcipYXjVtOqQR5NR9VGgWhLIIdZJyiQ9YGeBblV6vhgjqr+AasO+w6D2kcI1GMWZu96k7CGs9SBiq9jqT6N/uccfPlznX1Y3ORihoyPgKsGguKxmDlhNe16g5Zrutiq7+UR5fyYCFxdiC6GOIgicUbAkxJ70cG0rVT6QBDk7QmBsgXZpb9w54u47ZMB13gz+lw0HVBZ0tc9LO5rKwUhM/9EiBPx0A4/C22lDXImoBBOZP5rlYkPthkVEZi4D0gQUy8+HJ39fMI43y1DGjPJL6Xzls5xBzgaglpVsJQiTq/WMzyq2VjnfPhkfBHWEIkRRvsA/66t0X4dkW00BnxVO+49y/Af0AcwTUrvSGrvTqIeW5nKJDIwVo9RMZ326SvOcGWhgAFN4IQcOcBuyrU7KBIPLd+GMsJOTeqjQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?oudslNHSAAq4SHxcgTTBRUTXex2T877Njb7EjxlMVpwP6nJ+8S6PcgChxaIx?= =?us-ascii?Q?Yi8upSpyrcPWp/UtRjoyTXVa5b3mb7bNGwn9jE27Xx4KLXWBwxd9/om7MWcJ?= =?us-ascii?Q?rTn6IaqIz0gByTpUoy4CShK8jCnsfdzBPLs8ZUUUAfG6hUpYLLDJ+SXWSax0?= =?us-ascii?Q?K89/I5+JPP/GHskm+e/ZJkQXY5Dw7ahwqT5pdyfysEVaE4JXNbxf4w8evqNw?= =?us-ascii?Q?mK3lh90zi/S/My/icTyr1SsRXqqywi9oATNCef88rEcuLBrBTwO6fY2xyZh2?= =?us-ascii?Q?pQPfXvXUN4g3BAi03GYjs+hO2QdAcGeJ5PJRGitem5mIHM9ZLEcllGA7vDl1?= =?us-ascii?Q?WUvBdRaqr+MXmhf7RdICf0Z2VP/B2d8D85fFKAnZIv9ssOa8hH1saR9w1piR?= =?us-ascii?Q?fSTKw/xtSuNx0JoFmxmJKEa2xSTy+zrGb31GB733MfJk1Ptkqu7SPTH0nM5s?= =?us-ascii?Q?yKeqGPDKl7h+ZZBH60/HCQYtmNpleg8kW+ejtb2dYfFRwO7Dfr9KpmhN1X3k?= =?us-ascii?Q?FhbeIDc6dEIQsDn84eFE0DUcl3Upk2Wmrue7uIuJkUMpqqWNeuaJTnjSK+Vv?= =?us-ascii?Q?hw80kjMh10Vgnc4h0OV2CtADSlawycQ4oA5g7cTY2v/4GHeoto6XYAGke8dw?= =?us-ascii?Q?6dWdP5uz5a6sB0FYsF4R10CnAjxXboQDYupficS6ngvM7MGfhp0OI+Q4i5+X?= =?us-ascii?Q?ASTMi1u1mJjUaOvnlLnrFQwfOBMdW64V94OihYWoHztE1gjPvfci5W6d0i7c?= =?us-ascii?Q?5YaAAZwyyAlD1Inj7EuOlIj0jH13oiDHno84KxCeEVPrirNhNt+6CbSFhtfl?= =?us-ascii?Q?wvJDpaa53EcvuloUaxZ2RQ4wOMtPfd3/CtPTqSZDk109eNPSXlCbQIsaLs3r?= =?us-ascii?Q?jeF6Zh6YU936C9eRktS5ZdTUDCewbAbkMkwbuXtDlY5cb8modYbEuY1TYWyg?= =?us-ascii?Q?QrEbjBDnj873wMBsxkxx+GsWfj31Yb1cT4hEDJrO6eZg0j8K/K6vuVkkl0yo?= =?us-ascii?Q?KXqv1vzzRa+70fBNnX5pbUho33QXvU+lVpTJrlXohDL2zAVntJcRM39MtGdz?= =?us-ascii?Q?/hh6Qz0HnXRyNr4FdLW1eOl0dkwauuxO/QaQxkcXSYhWLo1fVDrzOTuayfPI?= =?us-ascii?Q?qARMgOvCfbVXiKglneSoWuppZsHqai/ktmeD4TtltyiZFpCe4Jj693feJp11?= =?us-ascii?Q?twBVCZXHk7iy4o2dQ3XamnGMKJDlKUZlSOOc25rBsbnHLFDP3lj+bAG7HRGX?= =?us-ascii?Q?i++2rA2QIoZWcBX7WlmZHz5tYkJfvO2ucLXCWdS/K1SvPTJoacjghmFp9Xge?= =?us-ascii?Q?WBnkuHBQBc4046IQgAOiRaSZ0Hnot9QdxEi56tdMyV3VCmLnpu2BCDDu0vGw?= =?us-ascii?Q?KyH4erC/9hxZKjcH0cikkHFmb595Tv/B6nl6wJxDduRs9fHg9VUMAWZpAr19?= =?us-ascii?Q?uh83LLVxwvziiUzNpisKVCqdtjCowANDIJ8x9jM4Nscsqhi8yDa/ulXzBHXY?= =?us-ascii?Q?h6g0dq35+WhFnsc002Wh3zTGlrVGLvT3O4BKMuy20TLGStFWzMURE+/dMk0z?= =?us-ascii?Q?2SdoJJqf0hkMNKftAnao7KaYcZhNer67mHpoW0Qc0/tHl89LPzAKk6mDnPyc?= =?us-ascii?Q?Zg=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c95dae0-c5e8-4f48-e237-08dab57c64d7 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:30.0350 (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: md+OxQ+qo/++o9/I6llTYrQSCr8hK92EMb53wFRC8AqL1p9q7o3oUFAngTLKVGpRI+y/7vsPEbpo9AdtvhGc9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: W2M-d8zIpLGoGnVBAt2SiT6cbkL47XJC X-Proofpoint-ORIG-GUID: W2M-d8zIpLGoGnVBAt2SiT6cbkL47XJC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=999 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666593039471100001 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.). Windows does not support extended attributes. 9pfs for Windows uses NTFS ADS (Alternate Data Streams) to emulate extended attributes. Windows does not provide POSIX compatible readlink(), and symbolic link feature in 9pfs will be disabled on Windows. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p-local.h | 7 + hw/9pfs/9p-util.h | 40 +- hw/9pfs/9p-local.c | 4 - hw/9pfs/9p-util-win32.c | 885 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 931 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 c8404063e5..02fd894ba3 100644 --- a/hw/9pfs/9p-local.h +++ b/hw/9pfs/9p-local.h @@ -15,6 +15,13 @@ =20 #include "9p-file-id.h" =20 +typedef struct { + P9_FILE_ID mountfd; +#ifdef CONFIG_WIN32 + char *root_path; +#endif +} LocalData; + P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int fl= ags, mode_t mode); P9_FILE_ID local_opendir_nofollow(FsContext *fs_ctx, const char *path); diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 1e7dc76345..82b2d0c3e4 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -90,26 +90,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(P9_FILE_ID fd, const char *name); +ssize_t fgetxattr_win32(int fd, const char *name, void *value, size_t size= ); +P9_FILE_ID openat_win32(P9_FILE_ID dirfd, const char *pathname, int flags, + mode_t mode); +int fstatat_win32(P9_FILE_ID dirfd, const char *pathname, + struct stat *statbuf, int flags); +int mkdirat_win32(P9_FILE_ID dirfd, const char *pathname, mode_t mode); +int renameat_win32(P9_FILE_ID olddirfd, const char *oldpath, + P9_FILE_ID newdirfd, const char *newpath); +int utimensat_win32(P9_FILE_ID dirfd, const char *pathname, + const struct timespec times[2], int flags); +int unlinkat_win32(P9_FILE_ID dirfd, const char *pathname, int flags); +int statfs_win32(const char *root_path, struct statfs *stbuf); +P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name); +P9_FILE_ID openat_file(P9_FILE_ID dirfd, const char *name, int flags, + mode_t mode); +#endif =20 static inline void close_preserve_errno(P9_FILE_ID fd) { int serrno =3D errno; +#ifndef CONFIG_WIN32 close(fd); +#else + CloseHandle(fd); +#endif errno =3D serrno; } =20 +#ifndef CONFIG_WIN32 static inline P9_FILE_ID openat_dir(P9_FILE_ID dirfd, const char *name) { return qemu_openat(dirfd, name, @@ -157,6 +192,7 @@ again: errno =3D serrno; return fd; } +#endif =20 ssize_t fgetxattrat_nofollow(P9_FILE_ID dirfd, const char *path, const char *name, void *value, size_t size); @@ -167,6 +203,7 @@ ssize_t flistxattrat_nofollow(P9_FILE_ID dirfd, const c= har *filename, ssize_t fremovexattrat_nofollow(P9_FILE_ID dirfd, const char *filename, const char *name); =20 +#ifndef CONFIG_WIN32 /* * Darwin has d_seekoff, which appears to function similarly to d_off. * However, it does not appear to be supported on all file systems, @@ -181,6 +218,7 @@ static inline off_t qemu_dirent_off(struct dirent *dent) return dent->d_off; #endif } +#endif /* !CONFIG_WIN32 */ =20 /** * qemu_dirent_dup() - Duplicate directory entry @dent. diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 7e8d8492ea..d0d6d93549 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 { - P9_FILE_ID mountfd; -} LocalData; - P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const char *path, int fl= ags, 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..953e7da6fa --- /dev/null +++ b/hw/9pfs/9p-util-win32.c @@ -0,0 +1,885 @@ +/* + * 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. + * + * 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(P9_FILE_ID 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. + */ +P9_FILE_ID openat_win32(P9_FILE_ID 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(P9_FILE_ID dirfd, const char *pathname, + struct stat *statbuf, int flags) +{ + g_autofree char *full_file_name =3D NULL; + HANDLE hFile =3D INVALID_HANDLE_VALUE; + 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 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); + +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(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID 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. + */ +P9_FILE_ID openat_dir(P9_FILE_ID 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; +} + +P9_FILE_ID openat_file(P9_FILE_ID 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(P9_FILE_ID 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(P9_FILE_ID dirfd, const char *path, const char *n= ame, + 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(P9_FILE_ID 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(P9_FILE_ID 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; +} --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666591259; cv=pass; d=zohomail.com; s=zohoarc; b=GjcUtVskELTZTccUXhkVGuGJ+jsHap68zF4gXBCem67D33xfbQK3dtSVe4foB11B1hVl+v4Fs1J3L1Eoxf8mq3UiAC1BdDq2vXakxE6SVUtLn9Kw8WiRM9C2Z2jqa1o23n5YGn5ikqWUO/67xiRC8hfY1fECIJ5rIz4iqKMB7LU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666591259; 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=3U3KU1/kIZJ+WxIAWSD9j1TgVnA4Rw8EBOumkxO+04Y=; b=EbrG57kM8WWWJaa6NXj//0P30W8CZDjYZluJt1tyKXjZ6jUHyXmCwXgAyz9bgigGFoVONZNuyYHMPatIEHyyXd6VMGMgAu3MOESQkE1TJK8gW5fA/rGR3CpGMGZANCB+l5Igi1yUWwqx+1VzzGIrhqCKdeB91lJqlwFcf4jI6rM= 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 1666591259092106.4788774885626; Sun, 23 Oct 2022 23:00:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYH-0004KF-Gi; Mon, 24 Oct 2022 00:59:05 -0400 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 1ompY2-0003yy-FE for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:50 -0400 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 1ompXz-0006AU-D9 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:48 -0400 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 29O4wYbA001509; Sun, 23 Oct 2022 21:58:34 -0700 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 3kcg1ksmac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:33 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:32 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:32 +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=3U3KU1/kIZJ+WxIAWSD9j1TgVnA4Rw8EBOumkxO+04Y=; b=R5+Sf2GawTkc56Qzt2JgKMlwVuc0AXI13B04excTE8rPXO9evfd0Q4vklJU1/7m7c5Qq rXuBnvpxG5PrPOUPd95MrHwAasn+ahP7glXRarOHz0hqLY4xQ6xad0Ag0/ZkZgjccY7V K9wNvI40tjCwjCeHpDoGsGUz2snrkZbQcwR1RygFOID3OJVjTeiL083sPfuGsNu9n2Gn Q7u0CHKNrbmVGYWfDvSkEdfYDwjnJb/SdYBpsMdUwXmfq97K239Gb0b024t9Ohmbh5kJ QE8zH1Me6PFZZ+bBlB0JRzixsI9eN2jmHwGRNX5pWw4lOmaN2p5l9KOTZmP/91/ZkwaB Zw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QAgrghJylMgIkBfY7EoJFHrHFhbK6/VPUrUtT/H4nHVrVUSS3zAQQ6HGlbOxXRdX97O4QXPVdbkkZlxNz8jwFABxpOkUbm0M1juQCeNUHLJHaR1ZkXq03VnJGueygAnnhXEwAunp00T8LOxUxPsf/a6ErCsVgRsyXLJALQWjNquqC/5yhcd0B3WFp3S+7Ctxi0paOIHlb3cUls0TZdRDXU3aYxVYOxyE5jhzCiBAKT2zXCJqhFptcM2QS2lB69nM8F2QvppOIFCZwASjcgGwx4DU5xrs7HCA7NxW7A/qHnjSx1EmVINYpLN9wecmLoRZsgn0w2bncV9+cx4GzvAQ0w== 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=3U3KU1/kIZJ+WxIAWSD9j1TgVnA4Rw8EBOumkxO+04Y=; b=cdDfIGn1tihej7XMyv3sq2l+fE0+rhvSJe+sGgjYPtu00j8VKMX+jiIRgyefpuuO4sGAvsV2DiSJBFSkLWlzrfcrgv7PFAjDElBug3fF6BvpssRPpiQEf1pgowG/hGBTAGxhKHjLcacYhM9iuJ1cGolqzJyiEZiPAt7UR106HdjKgLzGHsg+Or8hYgaPc2761cg3R2+2SqfaStMi3xYZLHsSqm6vRCjn4TmOLke0W0127kyviVWaChi6091ACuzsjHkgt4vA0tVEbL4oSXZkgxtOtn10GloJ9M3xEWZHuw7JCoKrXaTxTwO4zTWuv0tdl/2fPpx3E7Ws3sOtFJbs3Q== 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 08/16] hw/9pfs: Handle current directory offset for Windows Date: Mon, 24 Oct 2022 12:57:51 +0800 Message-Id: <20221024045759.448014-9-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: d0bb1661-74b2-457c-cb51-08dab57c6612 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ZflbNViBIM9Kch8uNmO/VA3n/RYz2TRBm7JUGZAyN7iDwkppyet3hQJbMlqglrmtcCco8EdrBgmLHYLXa8gSVAPuNG9qGpqZo5HBd8bK8s808WAZPbK5eJy+1vbNJr9SRvcc8SQPIFynazPXastPufF+tJqhNYgZtd2prU2Gzj59zqIZe0ayzk/PgZhC4BtyPPosPOWUzzmK4KaQFyHuHSaKkPMC1MEX/aqYO6m5++mXQtQfIoSE25yNDXkfypG7NWD3XmKojw4CMvE33Zco9fY5db8VIZUyp/2Zq98J4mCgrbqQFkjmULkny1aWTRbCfjRfR1EahxlfTMTXyR8OwIIClQQ3jKQmoPfdVBLLruOIlfE5u9Nk2r+YCKE+5pPP1arMyRhPzptbzM+iWCGkSFYSQ1cqELHWkyUqeyfR5NV77S4SnmVP23qRBdGY97TIZcAoLm48Aa4QgBFiZBD70amAIcQvASY9aP8OGBu3a3K1SBPj3k3GfHth5OHlzu0mG2l38PboqFs66BjSa92+aftb+TfZY/3EZzGlIBb3ZCN8L4X4FVQ9GitguwMBzq0aWrbYjpumO0zybDYG6Ekw8C3Juc+JJXTB4CFE8MnGO98Z2MQWl8uhx2XDgU7WlGOFOEqic7W5KpTzHOscTq+gthX/IvzURNEwNRa+cDBSLtofk5tp1ekWURLTm65+y6LyHXgwcG+dyIz8DRIeO85J0r4thtsiLrJHz0+VaAck8JrqMsxa0qqR+LaqiH1sXJtmidu174BukgR71n9C7komA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gzBddoOYQ2/e5N9d8Ktnk+ENIYmdd1LuxNnOJ+gjS6V/mvNjqGqSA3ij9fDL?= =?us-ascii?Q?vZrPty+DgiPaSjasR4KZCUIRXTR1QnxcTmEGVonELG83+2VpzY67guT1n5L2?= =?us-ascii?Q?E+iXVSc9NYUNYmWVmW7XaLiKqcKFmDGO7VStK80twj8DJJ0xh0P34gmY/P0S?= =?us-ascii?Q?7DPPpx+0+IF2XS1ewciTR93Rq71pgm0ipeUBDG52QA6yapPA1A4zNwn0UIg0?= =?us-ascii?Q?YmkvmMBeG9Qa9oR/Se9iHxBQIZE1dTi04EoxzcLoec1ESLCC3nItnt36nfd+?= =?us-ascii?Q?Z0qOZ8Mucs1R00QH7hds8LiaCJ4R8EJeFA+awlfLZ5OPZ9l4w8pA3ySDoKC9?= =?us-ascii?Q?ooFu+duthtp3EZz2e/mUqsFIT6BoTg8lodEdcwoomHzayPGQ9MbNCBKRbAzG?= =?us-ascii?Q?61fiybBwwdDs816uIhlqgVP0VHV0TLgGjFnsbvpbSajI2/CBNIL7PY/Sk8rK?= =?us-ascii?Q?IGKXx9QxgZdwETMGoOAdJnXjMFQGx3mG0xzyAvhDbEyG5lUe8ZLaL/4JkWDJ?= =?us-ascii?Q?Oc/gRR9pG/HJ0yzwP07Ds75tj1du9PZV3/W1f1JD8TjGdBpShUG+exIW62dq?= =?us-ascii?Q?5lLbOBgLIzepr5HSfrb3UjkxM8vEduYejjLWRhjY8Ojpy9DllzXB8YESrp9l?= =?us-ascii?Q?8qDCPmskR2Of77PdLIXAne2R+X9b5Pe2ihi4icTiVr9Z37iJvZ5OkyDHgEbr?= =?us-ascii?Q?Kn20GUGiuCvb1tBF5kxIFqmQ/Hiw8P04Zw1U9+DPLyrqDWxRn6H8jB19/IO4?= =?us-ascii?Q?bQOyolY5jqopdbZ7ryFlmAFTouReJvHnuRi3CnClSMjYjzMXhfjQR13jDfeh?= =?us-ascii?Q?2ZBvutzh6rO0NAjrCev0TO0+vvevowbYz/GMqzu1CrMEgJvJa5eN6FiRTORu?= =?us-ascii?Q?aik1T0cs+EoHuMm/xy1H+L/ydjIdEdu+pCEtcKyhpSqokse3fjoXSihrCeGJ?= =?us-ascii?Q?D6WUxqW5zHrirI2HPfLeUYZ7F3XxK+zlGvn8sR3fzU5Axjz3OveojHqHev/5?= =?us-ascii?Q?sdzhc+iBcHLaZ9GV+mkCmyh0Je48AtbJcEZy9HwalToSEiA3f95iB8JxXbUc?= =?us-ascii?Q?SGPy/FFRqkb/qSRpL3K+ioAj2Kv3P1y/pbjpdpt+cBE4n18VszkDDsWsUjxR?= =?us-ascii?Q?QdnaCA8ALNw36+WM19Mo+xtemkAJ1x8haVNxFwX9sedpDIrWEJqi/+fqvM9m?= =?us-ascii?Q?D7uiBqW52iUQpceCNK4qDXwYr1M6OyNT+L7ivZarM/+m3+OHm7atqmeQ9UA+?= =?us-ascii?Q?M4DpOEoM6611HlJY+W+FY8UVYHKDuUxHAVCc3npgJnBQBtxtWwV26s0/Oqm6?= =?us-ascii?Q?dM2V3XjRz9oNiPUk9irJZcNT701USKantMTHUbGov5+bhUjr0vdXWnwdU5II?= =?us-ascii?Q?P3Xh1Niec3I5gWnx2XUPgDpK8Io0Nd7+gNTqkUFozhfQXt0/Ky+CpNOqxvN0?= =?us-ascii?Q?t0GaJWgegSfMIVrWJyBCAnoR7uarGq8XBg7DnYaxRbp926cY3EwGrLCBE+3q?= =?us-ascii?Q?yBpy5Wt15Aq5+LkdWkpadHVwQDeVt2D8wHZZL+tPZPcg/YrNRuiATZ4cnCy4?= =?us-ascii?Q?FVuvSfk2NAEWSmd1m4Q+FA8AB+7IlJqtNO6juJlTBQZJrTOkM674OWkhRpm4?= =?us-ascii?Q?4g=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0bb1661-74b2-457c-cb51-08dab57c6612 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:32.0844 (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: 4m0cB+Sb+/k/hsEeZdyZdLpMcmitOzR9oTy/TAOk8nWYUxT1guyuzSoDHuizJNAkGcOnztBPo5uGvSDJqUpK8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: zbn_FH_RkY_fg9mIviFmH_jExSoMLiQa X-Proofpoint-GUID: zbn_FH_RkY_fg9mIviFmH_jExSoMLiQa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=734 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666591260912100003 Content-Type: text/plain; charset="utf-8" From: Guohuai Shi On Windows 'struct dirent' does not have current directory offset. We have to save current directory offset and update offset when reading directory. Signed-off-by: Guohuai Shi Signed-off-by: Bin Meng --- hw/9pfs/9p.c | 16 ++++++++++++++++ hw/9pfs/codir.c | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index aebadeaa03..6c4af86240 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -2319,7 +2319,15 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9= fsPDU *pdu, count +=3D len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); +#ifndef CONFIG_WIN32 saved_dir_pos =3D qemu_dirent_off(dent); +#else + /* + * Get offset by calling telldir() manually, + * as Windows does not have dent->d_off. + */ + saved_dir_pos =3D v9fs_co_telldir(pdu, fidp); +#endif } =20 v9fs_readdir_unlock(&fidp->fs.dir); @@ -2520,7 +2528,15 @@ static int coroutine_fn v9fs_do_readdir(V9fsPDU *pdu= , V9fsFidState *fidp, qid.version =3D 0; } =20 +#ifndef CONFIG_WIN32 off =3D qemu_dirent_off(dent); +#else + /* + * Get offset by calling telldir() manually, + * as Windows does not have dent->d_off. + */ + off =3D v9fs_co_telldir(pdu, fidp); +#endif 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..2fbe7b831b 100644 --- a/hw/9pfs/codir.c +++ b/hw/9pfs/codir.c @@ -78,6 +78,9 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState *fi= dp, int len, err =3D 0; int32_t size =3D 0; off_t saved_dir_pos; +#ifdef CONFIG_WIN32 + off_t next_dir_pos; +#endif struct dirent *dent; struct V9fsDirEnt *e =3D NULL; V9fsPath path; @@ -124,6 +127,14 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState = *fidp, break; } =20 +#ifdef CONFIG_WIN32 + next_dir_pos =3D s->ops->telldir(&s->ctx, &fidp->fs); + if (next_dir_pos < 0) { + err =3D next_dir_pos; + goto out; + } +#endif + /* * stop this loop as soon as it would exceed the allowed maximum * response message size for the directory entries collected so fa= r, @@ -168,7 +179,11 @@ static int do_readdir_many(V9fsPDU *pdu, V9fsFidState = *fidp, } =20 size +=3D len; +#ifndef CONFIG_WIN32 saved_dir_pos =3D qemu_dirent_off(dent); +#else + saved_dir_pos =3D next_dir_pos; +#endif } =20 /* restore (last) saved position */ --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666593053; cv=pass; d=zohomail.com; s=zohoarc; b=NNw/eUy6Dezl4q/CUpWOYHhhFPSd/nH4M9Jydl9g+WXHyYLeC3FTFxG2SJvVdgBSNSx6zdNq08TZVnAqHVukDbp/DM9FnVe35zDod2ddDtTnxugcPLNYrzKLGce3Zr0unURWwn7LPmfNOuKIEDNzQrf2XqTd9koZ1sw2m2EqMew= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666593053; 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=Dd827HPsvBbns/j7gw5UZ9B7zDyrUeNWaRHKjcmMvLg=; b=LQJYXP4ZLZYB/ng5LAfWs9aYyXhIh6QXI/pSzOX4r6QWXJuOcbYBZ3LGPXXTMJFNJmEVVDaZ2X7MbNzQtwGIPlfRrxzmsasW2wTcPFSoSaNeC80PIVgbxHRQX+YCJfstBQsXZhTP8HRwmx9qZMpFVb2CkHlWIaYJ7y0pD7deyXo= 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 1666593053057486.6381495391644; Sun, 23 Oct 2022 23:30:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYW-0004Yu-Vk; Mon, 24 Oct 2022 00:59:21 -0400 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 1ompY4-00040j-RZ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:53 -0400 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 1ompY2-0006Ay-FJ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:52 -0400 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 29O4gMkN001865; Sun, 23 Oct 2022 21:58:36 -0700 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 3kcg1ksmad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:36 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:34 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:34 +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=Dd827HPsvBbns/j7gw5UZ9B7zDyrUeNWaRHKjcmMvLg=; b=aM99FhlRmiPV4hzWKtFQ8N3xm+Tgh5lOX49nQEkwedmHGrQHqVU9SwBJFjuE87RwKzeN bjhqhlOYxaU6bAVSEIPZmWjuymLjHalESGb95/GiGfNHlm+uteKfkiFYlIgFZtMOY5xr 15aqHH8cgLJYPVoH6Djg+ur8oS3r8cmV2Fdj/xGIwl6cJZ6Qak/XN1IEK8Y8/cBqTulK t6A8+4ODjSCUetYFATnng90I0rf0aYYHm6wE9F0KfrSaagjTOrzQsnuD9hRWoKwCWh0N ORXGDBwacscFBpFzMhED/P1nVUNaQu4auK4Oak6GNP4l3wnH1R/ow2oGu5+l45Uq3rKD 2w== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LZk1EKGl2RDkLCqkqW7Yo3LN/EDVKJlDcTZbQV9v9cQ679Aywe6pNydl7LU8kwTEizkgNy6+nqPdwQqg/oCvkoveXpH66sSOhF15dvhh7xxHRRjK8KS9GDn13tVWthySB8nT70P8QhkYnbM7fCIyAee59GkEsPXjQ6V4Vtz1n7Xbc5rQjnTQ+6CWABpdOlrjWL4S/Sh7IoTgNXiHdIRFSZ//9pzbYwKbKBNxMMHaJw6TBWhbVDbqunKHD7/TncoT+tvyk2OH2ShyflKyRZ/7+lhdcUIPR7x4/RnkLwXY2b3DMxXx8W+1QA0pn0UPIjZLtjTnmgFHN6M995oYuo9Mrg== 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=Dd827HPsvBbns/j7gw5UZ9B7zDyrUeNWaRHKjcmMvLg=; b=ngev+AW0kz2C/G73LlQnaQ0QaAVpAdbbb4Jvka4cunyMWgX2bPXtYrM+RTpRGAAN9XG3sCs+LJwiqTKXLhxA8I4TobXK+YpAErKAr/REPGiVvAi6QRUgm8jY/NOeOyr5deqscByIoHnGQ1dsc54/ib66Wt3VzxHIQceLRyq8d58EzGQ2Sn0DIKNKajJmVJ0GUibOHJAeglCzWlr+MEIpQRw8pDM68m4GK4+MsVkpY6o7w/nPAEUy6GUJaxQWulacsu/yuWSaUSVGlL4mtwtpWq+fhakbhcRTCAj/aVeeoyYnr2fuOSd/WxoZuUxn/B2MuL6KIDuAiq84QT+5XfcK3w== 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 09/16] hw/9pfs: Disable unsupported flags and features for Windows Date: Mon, 24 Oct 2022 12:57:52 +0800 Message-Id: <20221024045759.448014-10-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e3a05d1-3957-4800-febd-08dab57c6754 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BB+T/6x5EiBbcuSb2nxRnHr4PPqgWRSi4J83jL0U5GwWAjDeL1yVn6l7Yd5fVhU4hH9pZGYayBmyjZvYNBGE7H1CkQyXmy+cSgBoNrSfw+k8JltkK82NHvfYzJ7xYBbdldibGOfeUxTVZ4qylChlDU+5U+KD49b7YzLZ+KsHjcCQTA8Q9wv+nX9Lg0L5fsVnjNfMru0HCVGr7ap/Uwf8xThZfKmtj1J1l5gV9ttz+FsKy1o0WY9ERkPOll9BBbaI9/5tzVBjWpXIeGYJ3dVdspWCHM16mONfTxkfkoy/3utSynmRXwUuSY5DOsn6KLjT7fEe+WgOgOkpd8uReRKVtcW2RTuEMGQLdhWR5AUP0guYlVsN5iDIEVLJKExFZb53A8abVfvChBpNyhZSDU9fhuGK4qmdIAtIFsU4NQpdTOAGM2P8tHcuEf/zghr4x3/hUbkWZoAJr3h7hwo9ng170nUe72u5K4/3uRuY+hTZ0FVR7SO4/G76LOHurh/1vtwXojvp4Qimccz0Ecpw8fSlbQnXPY8ut1DxPHAWrVrqfIIZCCihGD0ldJVhQv43ebOBK6cgp7d7zJ5hYFF7w/nas/1X5VWzGPI3iVhJYzP7HuFaCGzK0bPr1BqRz9Lbkgasm1ZfwXG74zvv5nkw55MQXdYnzcbfg6k4kpu8NjLKONdmD71hJNDfTxTs8hs7NkMOpsBLUaViTfydNCnRwKVQlqRaeK9F7kAYkgdHo+COsDfN9/8lKH45ZcR99QKYySKv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9bmjAgwlDObnM+OPxY7K+lodDqSfPcYpvHola0p9y5rlUFwuW3U9g20DcMfj?= =?us-ascii?Q?kgqMTdg167th6FZihUmtuZ/eJycQkFM5N1JXc/xIUKbvLJkB60HGnCzN8EPI?= =?us-ascii?Q?HBM0xNyX0kKDgi/ybcWpZIHAM98lRJD17zaI04GyOMxNeqXDPOQZ41WStzHo?= =?us-ascii?Q?6nYLwKd9lrqJ0UuCGEAMW8zh90fB3VMQMjV1wwQTUWj781U1GOhxhxSDBo4z?= =?us-ascii?Q?lFur+BAZGePVGbSDBkapDzRXhcBhSEyqDVSg8YT+45nZ8alRHTuzKqu3+SZ0?= =?us-ascii?Q?677iKBsdCvLopRyQyhldLkZ+VCbL3y56aBiuAdN2VNRLSpyyGdmGhpHuSYvh?= =?us-ascii?Q?F2IDgpC33jwF5pVqfMHnjEN4DobfVieOzxnL4uoYKHdzXqzjdU1s/g7c0b6e?= =?us-ascii?Q?Vfy/pe5RGlbor+rFvRK9UmgAf2JzQkgdhjZS5b/2LvjOABYHLNF3tVuNjz4C?= =?us-ascii?Q?uXiJ7muY5/yUBw/lH8MOdd5js9Jf8pa/85jCgoc4EPF16D+Oy3UXMgAdsWMW?= =?us-ascii?Q?yVFWgPzvZfBoPNKPk0PC0eUeOFaCNtDRwOVJibLoe4KmHTsb3TrRdVDXYpro?= =?us-ascii?Q?BKgQHXTtVkKGCB+4z785CTCUSpLzMSQMy8AxbyNdAbWY8TsmhfoivNCYuIFS?= =?us-ascii?Q?JN+AKfUs+vOAXCy8gbHeVq+Z8mWCLPaWjNtQyI1+kXQzM1OrI4mMCgs0bPdf?= =?us-ascii?Q?eCLtmRTmc7qXlJjfmaF3dfDeu8tJISxEp37TJmJt79y9ZeuX8rzJMBX7S+sP?= =?us-ascii?Q?+Uo79O/S/R+OM1qgD5eFFkFxjuOZnNZf5NBvhcrlPfg8Y4/jnzUr+qYxQIm2?= =?us-ascii?Q?R0nuo+gfKfniPeSyajUETxHDu9GXD4rR9ZJ3v7nXJAUkMycv7RRiVkjC8GnS?= =?us-ascii?Q?WgWvXYVznwwzSE7vRfb48qp4sh7pTN5DrBSsEzV+M1e16/aG0F8/r8wFn4Bb?= =?us-ascii?Q?ja+NWrv/BhM9ggFhx3NtCGl+3iuNLTA1yA24BvEHRVJS82TjtkINn8393SvV?= =?us-ascii?Q?IIVknK+79SRlhTwQgKlT2UiNeIIRlsAqaOVwEyYJ5ci0d+/ePS7kWKQdlaq3?= =?us-ascii?Q?23B/EfuM1+KOGiD3yrOVJO95C5BwjXAUhDD1zY4pZCin3Lbpwvi4WSBiio3d?= =?us-ascii?Q?Nxay0mGwLXTX6C27Rv3h2d62eZhewSiJzrcSejneov6+ZNIJ/7rANqvpEvNI?= =?us-ascii?Q?KimYDEP4m8M/49N+lQ06/jgqhJstGXISWl/NVxf4GB5lMATMp22f/rj/Fb8y?= =?us-ascii?Q?RCPKImXGi+E1+xptYaaqqXK6c34L9EJSpB63ESc7gYP5o11KYMGgHjcvHt0v?= =?us-ascii?Q?hBvl0kHhJZifQMlr4lLQz+/ccXQD5jy2v73bbXV+WNMNqAT9+Oyhx00IAMO+?= =?us-ascii?Q?QGnlwqt9y1TIFCmPtQoMNJZhmlc4H++DOeAqJAFN6pBz5KhPHRVdHbmhyY/+?= =?us-ascii?Q?Oou+KNzk4JJrnTH8JkOInly6Am1Anki/pGxjxu84NkWULDKN/1MXx8wHQGL/?= =?us-ascii?Q?Xi77eMxLmgs9mVYdMg8QSXXrvU9hq4hl2uTCcElBlALeQLs93dipAjQZdmQT?= =?us-ascii?Q?hGljhZU4xy8094ywiGju12XhhAwat+mdBYKpW9DLo2XkQtDsD3h+4XAlyczB?= =?us-ascii?Q?kw=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e3a05d1-3957-4800-febd-08dab57c6754 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:34.1949 (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: gi+QT2KrK2OLmH0JYZObM0Cg1nqk7KCepHBwLwL+iOOKUpWmDAiBnA3F3ZKYRGJ4MF8QOcpixeVgGTSY/ssWFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: 5pssW_kazj2W5zlXIpo5YrBQuIAY3VeJ X-Proofpoint-GUID: 5pssW_kazj2W5zlXIpo5YrBQuIAY3VeJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666593054532100003 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 --- hw/9pfs/9p-util.h | 6 +++- hw/9pfs/9p.c | 90 ++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 82b2d0c3e4..3d154e9103 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -53,8 +53,10 @@ 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) return dev; +#elif defined(CONFIG_WIN32) + return 0; #else return makedev_dotl(major(dev), minor(dev)); #endif @@ -260,7 +262,9 @@ 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 +#ifndef CONFIG_WIN32 int qemu_mknodat(P9_FILE_ID dirfd, const char *filename, mode_t mode, dev_t dev); +#endif =20 #endif diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 6c4af86240..771aab34ac 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 +#ifdef CONFIG_LINUX { 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 +#ifdef CONFIG_LINUX /* * Ignore direct disk access hint until the server supports it. */ @@ -986,9 +1000,11 @@ static int stat_to_qid(V9fsPDU *pdu, const struct sta= t *stbuf, V9fsQID *qidp) if (S_ISDIR(stbuf->st_mode)) { qidp->type |=3D P9_QID_TYPE_DIR; } +#ifndef CONFIG_WIN32 if (S_ISLNK(stbuf->st_mode)) { qidp->type |=3D P9_QID_TYPE_SYMLINK; } +#endif =20 return 0; } @@ -1097,6 +1113,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsStrin= g *extension) ret |=3D S_IFDIR; } =20 +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SYMLINK) { ret |=3D S_IFLNK; } @@ -1106,6 +1123,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsStrin= g *extension) 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; @@ -1118,6 +1136,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsStrin= g *extension) ret |=3D S_IFREG; } =20 +#ifndef CONFIG_WIN32 if (mode & P9_STAT_MODE_SETUID) { ret |=3D S_ISUID; } @@ -1127,6 +1146,7 @@ static mode_t v9mode_to_mode(uint32_t mode, V9fsStrin= g *extension) if (mode & P9_STAT_MODE_SETVTX) { ret |=3D S_ISVTX; } +#endif =20 return ret; } @@ -1182,6 +1202,7 @@ static uint32_t stat_to_v9mode(const struct stat *stb= uf) mode |=3D P9_STAT_MODE_DIR; } =20 +#ifndef CONFIG_WIN32 if (S_ISLNK(stbuf->st_mode)) { mode |=3D P9_STAT_MODE_SYMLINK; } @@ -1193,11 +1214,13 @@ static uint32_t stat_to_v9mode(const struct stat *s= tbuf) 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; } =20 +#ifndef CONFIG_WIN32 if (stbuf->st_mode & S_ISUID) { mode |=3D P9_STAT_MODE_SETUID; } @@ -1209,6 +1232,7 @@ static uint32_t stat_to_v9mode(const struct stat *stb= uf) if (stbuf->st_mode & S_ISVTX) { mode |=3D P9_STAT_MODE_SETVTX; } +#endif =20 return mode; } @@ -1247,9 +1271,17 @@ static int coroutine_fn stat_to_v9stat(V9fsPDU *pdu,= V9fsPath *path, return err; } } else if (v9stat->mode & P9_STAT_MODE_DEVICE) { + unsigned maj, min; + +#ifndef CONFIG_WIN32 + maj =3D major(stbuf->st_rdev); + min =3D minor(stbuf->st_rdev); +#else + maj =3D min =3D 0; +#endif v9fs_string_sprintf(&v9stat->extension, "%c %u %u", S_ISCHR(stbuf->st_mode) ? 'c' : 'b', - major(stbuf->st_rdev), minor(stbuf->st_rdev)); + maj, min); } 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); @@ -1317,7 +1349,14 @@ 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); + int32_t blksize; + +#ifndef CONFIG_WIN32 + blksize =3D stbuf->st_blksize); +#else + blksize =3D 0; +#endif + return blksize_to_iounit(pdu, blksize); } =20 static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf, @@ -1332,7 +1371,11 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const s= truct stat *stbuf, v9lstat->st_rdev =3D host_dev_to_dotl_dev(stbuf->st_rdev); v9lstat->st_size =3D stbuf->st_size; v9lstat->st_blksize =3D stat_to_iounit(pdu, stbuf); +#ifndef CONFIG_WIN32 v9lstat->st_blocks =3D stbuf->st_blocks; +#else + v9lstat->st_blocks =3D 0; +#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; @@ -1340,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; @@ -2471,6 +2515,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 @@ -2540,10 +2585,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 @@ -2873,8 +2921,12 @@ static void coroutine_fn v9fs_create(void *opaque) } =20 nmode |=3D perm & 0777; +#ifndef CONFIG_WIN32 err =3D v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); +#else + err =3D -ENOTSUP; +#endif if (err < 0) { goto out; } @@ -2899,8 +2951,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; } @@ -3634,7 +3690,7 @@ out_nofid: =20 static void coroutine_fn v9fs_mknod(void *opaque) { - +#ifndef CONFIG_WIN32 int mode; gid_t gid; int32_t fid; @@ -3691,6 +3747,10 @@ out: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + V9fsPDU *pdu =3D opaque; + pdu_complete(pdu, -1); +#endif } =20 /* @@ -3963,7 +4023,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. @@ -3980,6 +4040,7 @@ out_nofid: =20 static void coroutine_fn v9fs_xattrcreate(void *opaque) { +#ifndef CONFIG_WIN32 int flags, rflags =3D 0; int32_t fid; uint64_t size; @@ -4041,10 +4102,15 @@ out_put_fid: out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); +#else + V9fsPDU *pdu =3D opaque; + pdu_complete(pdu, -1); +#endif } =20 static void coroutine_fn v9fs_readlink(void *opaque) { +#ifndef CONFIG_WIN32 V9fsPDU *pdu =3D opaque; size_t offset =3D 7; V9fsString target; @@ -4080,6 +4146,10 @@ out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); +#else + V9fsPDU *pdu =3D opaque; + pdu_complete(pdu, -1); +#endif } =20 static CoroutineEntry *pdu_co_handlers[] =3D { @@ -4341,6 +4411,7 @@ void v9fs_reset(V9fsState *s) =20 static void __attribute__((__constructor__)) v9fs_set_fd_limit(void) { +#ifndef CONFIG_WIN32 struct rlimit rlim; if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) { error_report("Failed to get the resource limit"); @@ -4348,4 +4419,5 @@ static void __attribute__((__constructor__)) v9fs_set= _fd_limit(void) } open_fd_hw =3D rlim.rlim_cur - MIN(400, rlim.rlim_cur / 3); open_fd_rc =3D rlim.rlim_cur / 2; +#endif } --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666594948; cv=pass; d=zohomail.com; s=zohoarc; b=QEIYNXOHtGiBiqn+Mg1ORp441jnoeBqdT/YQ8YtgfHfIO1LrVlDGFWWrmBCVM3BbV4H74/3BltOSkjyDgmYFrm9so797CPsUIx90lMoCqhsKwDPpttDisC4Je28XVBkwXOuCvuLoJDYuoGpk32psJ+qj+GUKPq89ixJeuhiyfDY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666594948; 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=hDKyFjUO2d0ZQCKUFKsW1EMc1WJrDhhLACoty+3AVCQ=; b=eq7jLvP3syI4NnHjqV3nyfAcaaOvtflAILVFGc7w3YF8gJ8NVnma4zFIU8AUf9hjRPMdXlhRxJzOWjhXAaSfSvIAmpgMosBz9JWC7l+V8bx6t7mc8U8p08qFSBex/fD4hsNoMgc7jlb4bQzkdawEEYPzcXhDG2EPEVZDJw05kIs= 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 1666594948687305.08877584516983; Mon, 24 Oct 2022 00:02:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYX-0004cc-Ru; Mon, 24 Oct 2022 00:59:21 -0400 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 1ompY4-00040k-SO for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:53 -0400 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 1ompY2-0006Av-6x for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:52 -0400 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 29O4wcqL017682; Mon, 24 Oct 2022 04:58:38 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc5r2svrf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:38 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:36 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:36 +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=hDKyFjUO2d0ZQCKUFKsW1EMc1WJrDhhLACoty+3AVCQ=; b=K+ZZBh5WH2LO0EMv7X43XY2gbH8gqOrlX+nLmDIZ0u0biE8jduP63SFaY9UwtLlR9Rh3 y8gaKsxwcM7eYLJUupJxB7Z/FpQBZEPVhCIGgmzPCCx0RRGWIbGHd1zWo1hSlvcxaYJO DtRnu8OFij8U+joJ30hwcdEkvhw6bW/iCh6G+82nURzfRk9efZiodMfuLaPDIVsRzW/r WsS5zpa+YMauh0Pf5ud/QWwsQLnfkanHl0Hj3f2q6ZJQdfnj00qbI68OCLKIyIp7aN2J +tCdtZ+C/wyyQyEhT7aKk4x6RBFJZfqBoi1iUAnSl/fHw/k3DmdKXc27alcxD063hYtx gw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NzjqvY9rcZVojy5cgZfvsibiMaeD0hCfRN16t2Ojn6z5WvuK4/kV6Wvg8ZaKvgk3IRROtgmJloLw7VmlSLppQW4lSZw6+fRAjlYNDWJKtihGtzs5fPuahgOLJRxDXpyYxcxkqR51UY2e7K+ioVfUNwt6CoRsi8tUIZeofpep7HrGrNnOShhntO0u48xyMBN+bpzJYSjsP7Pfmah4u4xP396tJnpda9ULqAIY+pl8OIdPL9krpmRSIL4LOHDyUuN2o1Mz+IXzvCJ9RnPdIw0EhV2qME3c05P50d/uG2xkVT5qDFRxK41iNvcwPZ3jh+fiJQYIoJAPc2hILDuEZNoAFA== 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=hDKyFjUO2d0ZQCKUFKsW1EMc1WJrDhhLACoty+3AVCQ=; b=Iovz5uHiheIbO3ex4feYki7uDZ2HiqLXjqqEo+IQdljMtAF0yj3YuGzYSdFgxMgLo/TJPB+U8VB/+MtH3NR9FPGA5EZZiFL6IxsID6ogMPXo7vFSPNxaU/4cQXQxxd3cHmKaO2iH4ETgDaP/UuLJKwXadHpf8zjpxnEsf02CtvOfKFsc2MyGmVsmd4IWBAJDzxLk5ZMBVCtfVA85lQdAqm6jiLtJAQmclDx6iF8Ih0q7YDOGvbTTAMf/Rb78gZwRNOO441WyuRUf9xQ34R5Pojd4zJ3NHZYQezA+pF982K1UwyeC3QQL0jXhL59Lsxzw8fjdMKgtx2mNuOPPumBNuw== 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 10/16] hw/9pfs: Update the local fs driver to support Windows Date: Mon, 24 Oct 2022 12:57:53 +0800 Message-Id: <20221024045759.448014-11-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 5049416d-5c93-464e-a6b7-08dab57c6894 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XUZnBJE0HFbAJbnNGv9zT4QrsU3S7n7qqYNUOaV6i9Xc6ucwaGoh/s5ycoJq/tdQn3pWAu9M0QiL0vNTG/Y43O3GKo20lTupTJ7/CI52gBLBqmX0jQmpYDHemkt+UkFvmcT+u2PJw3xPXdeOA52PsviCPgrOiDSSkflpgr3ZROdUT7tyRwjvDtanekzMlZROwSaI7oLtY/+C+kZf2+/ctpeJ8P614otOMvie+poucBEknVVd/mJ/PTyEGp9Q44B7HdiPOKKVaBXP30B3pWU2rGT5gYjISmXOWhKTRJjImzSPT+1Ftiy1I4VCBoL6u6Pf/5RhjmLNfUhRM7MITAlyEwUwBU7OD7vasHr7sjm6E+0zLorBV3rsDEXNMKTN1+7xFQcO9PQG/Cq8WyMyP5Mp0B9RPDcEB6JgrDqRRfHkQcBqgYWMmV4JoCckYXRWhIX1OXnIYbpJSOmmHhZd6gt+zpM+scOmucQzU+T5eM7ZYWoCkPbOzsYOc06q6UT+O0jBWoDtlKuBSeXyeU8lMjAmZ/9wDOh+lcAjal5NQB00cukKiyHwGeXl5dVifvp2v4NqcNnr/tomB/OLQrqj/qEM+rCvqxg08AyU1TQgypGeNHLJDpz1bpjuJ8SqnNfW3bjtp0iFPI99mq76KeHOZCwdx6xp2xg2HMEvT7PZviKJ1+Y43Rz2m8jrodEW5shHmcGG5Rx653dT2eAvBcXUbo0jQ80McPQVbE96vpzbQ0Qcl9xCrdBUAbUGrRsGF4GFkqD+t+StmHpH3cxxPr8n5K6GEA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(15650500001)(2906002)(30864003)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9g6VSRLbJ8ri7dpb5h7muTM6HrTE5Hvz5hPbs6tff1Zy6/ROsd6cj/VJk0RD?= =?us-ascii?Q?U5A4Fum2Cn4OrBQefNAiPK0WqQz266BDsGh48AbXaOQZQ/tJk1aeG2ouNGCP?= =?us-ascii?Q?95p+oj0IhEzi2d/eTtueXyAPQhpk3reAtBtMli7n2doQUIlCL290uDFoeUt9?= =?us-ascii?Q?QleIvZZ8KHjQwJBWYY/mSUCCrOWOGgzJ1KXAEef9rDACukl3IkWtwDcJu4OF?= =?us-ascii?Q?majwRGHWKVhdzBIEHSv4NP7SRh9ww/o7xSuyUZu1Iw/JoA/ejujFX1SR87yD?= =?us-ascii?Q?7DCjVQOh/4487kPyEyGwy0lFtXYE1hs8eBwawIecuF8TAmNKO1bP2mInBaiy?= =?us-ascii?Q?i+stweqyHWESg5NsE+noJMMlCqjuCs+j8+gnGjGWv+NZuxwNawxIy7fXMQg+?= =?us-ascii?Q?rzC1IpMl3ZrCIXM+YBGWyccylwPDsWSZkJWyulWDPCrqucBJihnHnDUFE2ud?= =?us-ascii?Q?sxYqFQ255PbIZTIXK8DTv9leRBRZbb9BNw+AlmuPHd0qxc4F2FZni0iFcBdm?= =?us-ascii?Q?rVC/Xh7NSVi87piKzxfNmCj7U1ZiPT7GyVpHSgZrNmDtAMTTnRBFikLcwsJH?= =?us-ascii?Q?c9IKuGUJuGqL+k9yarHcCOccGHFhHpeoBr9cEbAhnVZ5mITM+KIibHQwNs/z?= =?us-ascii?Q?Of/7IlChyxJVB7OmUJ/+qTpZqzL0Q8OEBBqaMDOBm2aL1IP/J1H+GAiWR/wf?= =?us-ascii?Q?y7c46Ki9yynWij2OJfdezsf9okTdbVjJpMlK+bHE99S4/e/Zkk1Z8tmYr1jV?= =?us-ascii?Q?pdIx+DRrkIyHbr8U9GkDdCmljb7bhLLkXGrdfzCMrQKaFKuBs73wPAz/B3Br?= =?us-ascii?Q?inhWV117VTpe+Qq8MbhvwZk+E90ity3nPeSDWr8/1TzBmTwppNA/mD/ozXn4?= =?us-ascii?Q?rKf9XClsliAz7yJ/0Q0IGmH2YUSOEIct+opNEar+AdVFC6RYffqew+i9v5IB?= =?us-ascii?Q?ify3sDWGXKGHVVliztGLL8Zx6Lw/q1u8z88ZHOk1QbH4A79p7XVmLILtWb44?= =?us-ascii?Q?bxeLlcPAx+CW+SDd9ZJ4JP+Vkkdr0NWDuicZ+39V2jNfIXFz9hMHLzyLYA4Q?= =?us-ascii?Q?fpkDUpUGnBBWsiD0NEO+TxAMuZo8fesQhGIuebqodsFFf0TIxrIVWPSUAKYr?= =?us-ascii?Q?cxFVRxCegnLD4d8J+6McAMzEvWRw/H3+NNuCvva+fj+tyoM3g/tsrdZYMqDt?= =?us-ascii?Q?MEqvX6gjyyJb4XwE2zpSc6dhHOVZ9itw87xxlYgjgC0x2O8P84WaCcH9T5H/?= =?us-ascii?Q?CXRtyKXI0aLxzYg/DXnqIKKvVvCDi8amUiEHMEQDPUiKy2VTXg1Cdwn14KM7?= =?us-ascii?Q?t1wcloyNT01jIRMxVnQGtCSh2vv93VBq2hNgcMPDJD8XbedU3d6JCw6rWbZ7?= =?us-ascii?Q?ZgX3FCfJ72osK2D/Jc0Elv7o+uJlMVtmKqBHJAORbx20ZGR1JpvT3mOZuKOQ?= =?us-ascii?Q?zJjGPAdkb5OGMT7EgUYHZ6QNF5UdPnE1TQqvL4xTMS6yIvc0K41/ajQ0Xbg5?= =?us-ascii?Q?7dhtgOXPZ7DkCDAbC9n9zO3NFgOf7I9PE7G4JPoRNeyrxZ/wACpZ5HHthzwl?= =?us-ascii?Q?LxelJnvu9RgOiF6oETTE++YFX8A8NDr6WRgn81yMhJqgS3idMyv3+6w7JTVi?= =?us-ascii?Q?qQ=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5049416d-5c93-464e-a6b7-08dab57c6894 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:36.2740 (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: 5i+pJE9RFtR40vjyw2uoUDmHlU/93Npir8plmZ/l/YpncGpkjtadekZItuaYBWs/qbmLf3sUW83wVsM0gzIcYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Gc0zWYZd9J1j4w4cSrzFCclt6C84OV2i X-Proofpoint-GUID: Gc0zWYZd9J1j4w4cSrzFCclt6C84OV2i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=882 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_LOW=-0.7, 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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666594950874100003 Content-Type: text/plain; charset="utf-8" From: Guohuai Shi At present there is no Windows support for 9p file system. This commit adds initial Windows support for 9p file system. 'local' file system backend driver is supported on 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 because Windows NTFS does not fully support them with POSIX compatability. inode remap is always enabled because Windows file system does not have 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 --- hw/9pfs/9p-local.c | 336 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 327 insertions(+), 9 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index d0d6d93549..b5680d046a 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 @@ P9_FILE_ID local_open_nofollow(FsContext *fs_ctx, const= char *path, int flags, return fd; } =20 +#ifndef CONFIG_WIN32 P9_FILE_ID 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(P9_FILE_ID odirfd, const char *opath, P9_FILE_ID ndirfd, const char *npath) @@ -135,10 +141,20 @@ static FILE *local_fopenat(P9_FILE_ID dirfd, const ch= ar *name, const char *mode) if (fd =3D=3D P9_INVALID_FILE) { 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(P9_FILE_ID dirf= d, const char *name, int ret; char buf[ATTR_MAX]; int uid =3D -1, gid =3D -1, mode =3D -1, rdev =3D -1; - P9_FILE_ID map_dirfd =3D P9_INVALID_FILE, map_fd; + P9_FILE_ID map_dirfd =3D P9_INVALID_FILE; 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 + P9_FILE_ID map_fd =3D fileno(fp); assert(map_fd !=3D P9_INVALID_FILE); 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(P9_FILE_ID dirfd, const char *name, mode_t mo= de) { struct stat stbuf; @@ -399,6 +418,7 @@ static int fchmodat_nofollow(P9_FILE_ID dirfd, const ch= ar *name, mode_t mode) close_preserve_errno(fd); return ret; } +#endif =20 static int local_set_xattrat(P9_FILE_ID dirfd, const char *path, FsCred *c= redp) { @@ -439,6 +459,7 @@ static int local_set_xattrat(P9_FILE_ID dirfd, const ch= ar *path, FsCred *credp) return 0; } =20 +#ifndef CONFIG_WIN32 static int local_set_cred_passthrough(FsContext *fs_ctx, P9_FILE_ID dirfd, const char *name, FsCred *credp) { @@ -455,10 +476,15 @@ static int local_set_cred_passthrough(FsContext *fs_c= tx, P9_FILE_ID 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) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + return -1; +#else ssize_t tsize =3D -1; =20 if ((fs_ctx->export_flags & V9FS_SM_MAPPED) || @@ -491,6 +517,7 @@ static ssize_t local_readlink(FsContext *fs_ctx, V9fsPa= th *fs_path, g_free(dirpath); } return tsize; +#endif } =20 static int local_close(FsContext *ctx, V9fsFidOpenState *fs) @@ -512,7 +539,13 @@ static int local_open(FsContext *ctx, V9fsPath *fs_pat= h, if (fd =3D=3D P9_INVALID_FILE) { 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 +560,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 +620,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 +638,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 +791,12 @@ 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; + ret =3D -1; +#else ret =3D fchmodat_nofollow(dirfd, name, credp->fc_mode); +#endif } close_preserve_errno(dirfd); =20 @@ -665,6 +809,10 @@ out: static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, FsCred *credp) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + return -1; +#else int err =3D -1; P9_FILE_ID dirfd; =20 @@ -712,6 +860,7 @@ err_end: out: close_preserve_errno(dirfd); return err; +#endif } =20 static int local_mkdir(FsContext *fs_ctx, V9fsPath *dir_path, @@ -753,10 +902,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 +924,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 +981,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 (dirfd =3D=3D P9_INVALID_FILE) { @@ -858,13 +1014,22 @@ static int local_open2(FsContext *fs_ctx, V9fsPath *= dir_path, const char *name, if (fd =3D=3D P9_INVALID_FILE) { 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: @@ -880,6 +1045,18 @@ out: static int local_symlink(FsContext *fs_ctx, const char *oldpath, V9fsPath *dir_path, const char *name, FsCred *cre= dp) { +#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 feature is disabled on Windows ho= st. + */ + errno =3D ENOTSUP; + return -1; +#else int err =3D -1; P9_FILE_ID dirfd; =20 @@ -953,11 +1130,16 @@ err_end: out: close_preserve_errno(dirfd); return err; +#endif } =20 static int local_link(FsContext *ctx, V9fsPath *oldpath, V9fsPath *dirpath, const char *name) { +#ifdef CONFIG_WIN32 + errno =3D ENOTSUP; + 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 +1209,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 +1221,13 @@ static int local_truncate(FsContext *ctx, V9fsPath *= fs_path, off_t size) if (fd =3D=3D P9_INVALID_FILE) { 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 +1247,13 @@ 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; + 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 +1366,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 +1385,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) { - P9_FILE_ID fd; int ret; +#ifndef CONFIG_WIN32 + P9_FILE_ID fd; =20 fd =3D local_open_nofollow(s, fs_path->data, O_RDONLY, 0); if (fd =3D=3D P9_INVALID_FILE) { @@ -1198,39 +1400,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 +1621,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 +1671,72 @@ 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; + + 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'}; + + /* 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; + } =20 + /* + * 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; + } + + /* + * 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; + + 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 (data->mountfd =3D=3D -1) { error_setg_errno(errp, errno, "failed to open '%s'", ctx->fs_root); @@ -1457,7 +1747,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 +1777,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 +1797,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 Thu May 16 01:58:09 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=1666592336; cv=pass; d=zohomail.com; s=zohoarc; b=g/m4rA2AYwIFtzpCa8oEPxqn+BlUqiWftmtZtOcxvwBTR6nO2+IOWpNozeJw+UWotTzbP+pSM0D4bdXvkPnOswemIgpNwKktqbOLx8yb4TCtBOqYG9sie5A8tZbnVuZt0EY4HbWf9mBzfnq0H+bfk9eh7HpUPptxnStilTDGfkI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666592336; 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=+0mnYaFnS5jmeC+73F35KaOsy23psAhs23ArV2VeOh4=; b=LIiKdmzPMq5swONwzwe1qBDMJCz33Ott/qFBCzcwf5Yl0VGUk0nRFlMCBx0b/8F4RugH/vfnCctxrzSEkeUeUywwUt3/yJX63X2jtuO1uxQ4FAHzP2YKuL/iaYN3ryu0vi5eifHTZi9Z07fXaEIW+kOEMWux/ADVQJBCkBo7XvQ= 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 1666592335777625.8190403212136; Sun, 23 Oct 2022 23:18:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYZ-0004ev-GA; Mon, 24 Oct 2022 00:59:23 -0400 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 1ompY7-00046L-H8 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 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 1ompY5-0006Bf-9V for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 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 29O4weRa014413; Mon, 24 Oct 2022 04:58:40 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 3kc7g9stjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:40 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:38 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:38 +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=+0mnYaFnS5jmeC+73F35KaOsy23psAhs23ArV2VeOh4=; b=GYQNrjhr+MZ4cfPyASznEZtKgZTvEcapaXp7Rluy2L1WloG+71n76eWsOcSz1D5VMpOx FeN/vPGeC9uCiI6TeTaMnrU6bF3nyvgc/3nFjp+1Ccwwt2uw3rD/P2HYV8MgVXwr6Kr9 sPmvnihQjC24wBe3pyYg7VPSRjXmEaB7QAj2XXV6AXrz//wOYGsM/IxEitqCb4UPQ69K Ois+w3RU7CJrC6q+Aospc1vPuyqVDSwpDLeyCA2ddASJaqKi/OyOVAJCfXVitrmzVxxJ zKmnVM8oe2gWgXfGboa1lv4O78qDUncaljRDmzE89LZQc8tf/uDT1AHJ+/RiNbKNzcEt cA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ri3R3xyTz3GlALdPtACbPSdW02/8kq1nrLGV3eB1Dz8hpUKHkd5QLjjkHr3aKMKZp73rwtgdnyZyDxEr2EXohBAc4By1r5YTGGzUtE+WtPSk8ZvKjfYC7rVDGxrWzLFFjF7je0lHiRp8Pmz7C5/Whi+2haeyoqS/VrwlYmHviXdkUYuqovq1lFjwGs7nU5Lq2FSycdUH1ROeywMWW77o8wDxhUZ+x4LsfFepKSALDRa+QAVUGmfDLtIyzfqHD6Zu/nx5WcIkLU23QhW+QCTSznijPsJJZa32cIQUeea48wfG1IQDqs6symWw1Iye0rxDzXvYZ2QAG3Lv/TEf8Zl6+g== 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=+0mnYaFnS5jmeC+73F35KaOsy23psAhs23ArV2VeOh4=; b=CqhaRfETU3qjB0tHcCoWNd2LPLZcUTElCbHsDl2E94Q96JzmntsQswiJn7WP9mchpmFru1l5DUaNdLX91jFxlGWwgUP/LqQ0UdLeAFDv2XN1IlZO3uy+kr4SYLj2WEr4rHYeMVECqJVTyIHrzryH1kUmwKXaGaHI+hxNuacsVGFHsMtfklNdzOVzWbAegJsIPP9/rPkeAZu9PMdGtzL/QMq/lHLWFyhi+OP4ske1r+wbLVMUj/Qy9Y6vAp/w7cMSJ0FbtHAr15MMQrzrEQa1yWPBjCGT0mKWd3NjwmIKYlHMLFOx4uSe0sEhOts11OpzPn559v8SqzyaV4ySCRTu5g== 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 11/16] hw/9pfs: Add Linux error number definition Date: Mon, 24 Oct 2022 12:57:54 +0800 Message-Id: <20221024045759.448014-12-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 342b7cac-e3fa-4956-831f-08dab57c69d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lYFXcrDdqeHJWPcBrrZ8/S5q8oO8OA/VXgjCWmd8MYO8LAzrZvJcnhyYNfgpdoz2YaS805nN1tpMzyVstTAVEe5JaRRhW6Acd/CfpQ3cvGxH6V/OPOdQ5qUdghNoR+BRJLMNYReIJMycA8WFEoG6P1Yq2LCk6yTjbZVd1sXyueDW04A+6CQPXMP6JDAlLiywmnM+ngnIooMMtUL9KGYEIiirH5bx3tkA5/yHbF4PtgxugBoM5y3yqJbBffzn0/IxopOLFoM8O5YwASIOH5ARfwpyHlxk3ecf+0IG0VdZZgOzXzGqsQ9ilx9yme9O/zoD4Ze6/RLD0Nv35cXT/YFnKQNSwkaUMZQB7x33b+BpEYoHMqETYFS0hHaNm8UT+2BCeya0IURuVSXU+MWqCx6/mEC5dBzFBEKw01Yub06XCsR4jivGVRis4Kk3HU3viVTbM7+xpn3htsI8yHprnmGZtALVrC5dX+UPmNLxYo/BuIjSSaDY80YJizRC+G2ymoNxLxLVZ2lv5f/XdzdhsblU6V3shh9txNif3x6mbXEKlGNO17D4uOSN/2TnmPFonTMSiQ6REtKCtwzU7kbL7mus1cOH1ucmh0NBCu2VOw9kUzHROPVNtBCC23b+ZaLGhSDvkXAU4yOxX+EjWwWL6J18FIvUD/oou6IWIqmyYx9pNg4hyn68J5OejzJGtcrb+CtTNEUCqA5Tmf75uIQrDqsCBWfCjg1pk8DvZ6/pYqt1pJKfzbHp7C48NlzJRq9n8PZs X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1NawIDuYmI+S9O9V7A1K2i+kS/nY50ZeuidA/42zlIh8/mgmVIkS+QHiOMzD?= =?us-ascii?Q?gbs7g8d0ZaOUcuyKzll6wN2W7JFB0qRfLzwJM6nsu50aIUfZMifR5pHMReG2?= =?us-ascii?Q?24iauYog+oBOKwPzoO21jN/qPO26v3hYFConWBY/U2h6TS+Z8b+AAjU5hdHp?= =?us-ascii?Q?rzBly1XF32pkqUURFKvpEFd7DNwdAVFEGdpI8li+k0hOIvEXyj83PhOHjr1s?= =?us-ascii?Q?KRUz9WaRaXnCVM8hVqHx9OXxMKnjrHm+FIsr+LIKDArm2J99XCEFxYAxbXKZ?= =?us-ascii?Q?9/p+V55ASLNmy9xdF0Pes1MirLq+E6m2a/RknBDJ+06O2HAanNSE/goVorDJ?= =?us-ascii?Q?G2TOw9FdrdtvygreY8ySboLJ1iB36megvQdJSZg+sH+hW/g0qNImLYM7aFDR?= =?us-ascii?Q?mFUklsreMwfhH1lXdt6y2xAtG6ngPeo2twJpeWTtPqlXjIHGJJTKTJVusc4k?= =?us-ascii?Q?2mI+6/1aHcBWn1U6WG1vInfFFEKZjLa4GPFguE1yKjOF9wA9SIKHQpQtOFcT?= =?us-ascii?Q?uhFzZFk+4AyIfbVSO1EaJY7wDfbzchb6bxWVdgSeGdksUzEHeO8ZUWdXd7NH?= =?us-ascii?Q?BLzCDq3lE1a7KGnEFlrAX9F6P8N3WQKPRUVJq4U9VQldafn54EQTWzghUgwc?= =?us-ascii?Q?nlwY+4R+30/XP1AsC08PktCCCklT+xyd1dLiw5jZrztHtObGCEVV3w+gG86v?= =?us-ascii?Q?i4j27Zw2EMgH6GdJ3UxQ8Al4lLEKGjZM/W0zBtMKXaBUNa5YuLZnNoTJ4OIY?= =?us-ascii?Q?OoIFK7JWmwkHKdhJQ91rsC88N/McLSpESDi/oJcBe7SU7h+A502gtzxRvGus?= =?us-ascii?Q?BVIGKbwL7hkhZYp9hKMuSNC5vFZwVHMwA+DWUzoj9QK7rRV2EmGUyLRbpItc?= =?us-ascii?Q?NkQNko+iF6TF6Lck6ZWFB1VKR+fK1pWV+Pf0IhqnEWH0yfRfgq0sMa+Wo3lA?= =?us-ascii?Q?zZnfvHjvusi4PdmjuA7CDumxKacNqHsHHegq65ZJ+qtRa9cyD+JKJyywz3Bw?= =?us-ascii?Q?1pLcEwJjLgWkfHJpGUb/n9hQx2EK3aN5WQo3FtBBlzly0e4sbl+0NAJOFjxM?= =?us-ascii?Q?rx8fb4vOZBSY9miRH3fa5uBi3/R7oqLc8cEpTFixErXEnpHG7KhfEh/Z4EUA?= =?us-ascii?Q?05DvMOuhFqHKOmM6ZMFjPJ09BtMIQT62slR8f1z72Xz7SE5kAIfYpM0ugXwW?= =?us-ascii?Q?SrIHaa996vH+5523aERRJz0oiVgwSQOEIlV58t891sbmPFM1vnC2oPjnbOCL?= =?us-ascii?Q?VIALnCVgIPZw4zzUPNGymhX2Lej25PzRMz4AZDrQoH6GRV2ye53cPsdga/n9?= =?us-ascii?Q?4gDX5nLScTMlTDdYI4eLawHESu7Fk/41HWh/jxAzUIEyfR7lEFDP4Mcf8gnO?= =?us-ascii?Q?6ZltJQIAv5aSJ82GE7it7GWLaJDk6RoO4ThlA0FryIFXHZJU2ehrxU0o8egn?= =?us-ascii?Q?0A9dRY8yN/GmtAL/t2w7biYkQUndqTL7JW3W3Y99H2nVta81c71NZ+yJwOCI?= =?us-ascii?Q?J3aqh9MLRIM8kuXEEcsAe3Rf2g0g6fyqJKGekeXLnKwCFD2yr9pSeNtcFVUi?= =?us-ascii?Q?y/0Ysl3+czYeJmcAxWjw82eMzw8WXHMGWYNWWgRz9jOsg82CEa081Jg6M4nX?= =?us-ascii?Q?IA=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 342b7cac-e3fa-4956-831f-08dab57c69d6 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:38.3677 (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: oVT0GIgXgAIbnNQcK5/JrQrc96hBnIbqc1k1RrllFMl0BLicAdRnkA4F7uGOvEfWiqVIA9QmDcnaAtriBynBBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: PHRMBcgTc6VndYx-B8kEoPWs5_Kopaaz X-Proofpoint-ORIG-GUID: PHRMBcgTc6VndYx-B8kEoPWs5_Kopaaz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=804 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666592336864100001 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 --- hw/9pfs/9p-linux-errno.h | 151 +++++++++++++++++++++++++++++++++++++++ hw/9pfs/9p-util.h | 38 ++++++---- 2 files changed, 176 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 3d154e9103..281fdcbf8c 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -62,8 +62,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) @@ -73,18 +76,27 @@ 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: + err =3D L_ENAMETOOLONG; + break; + case ENOTEMPTY: + err =3D L_ENOTEMPTY; + break; + case ELOOP: + err =3D L_ELOOP; + break; + case ENOATTR: + err =3D L_ENODATA; + break; + case ENOTSUP + err =3D L_EOPNOTSUPP; + break; + case EOPNOTSUPP: + err =3D L_EOPNOTSUPP; + break; + default: + break; } #else #error Missing errno translation to Linux for this host system --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666591064; cv=pass; d=zohomail.com; s=zohoarc; b=jOTikihi/yA6tTNmFAEIMzXMlWZhVuRFNMgiP+cWw/YoGF54y8mJ7aingUEFUEDVIqjGsShKDbbVBkBjpOBC1yhV7W0CjnltvRnDX8hgOhy9tYhONyMXzd4n98Ht8QAx03L40DWVgFe+Qv1GjOLW/dRDw3ACpSfhR3bgyg+q528= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666591064; 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=6XgbaW1j3UaX/Qr65o3z7cIMt9V1DanK+ZYU3xctle8=; b=TQsLJR3BqstOqAkzGIAEMzdI994EljvD9hefLIogFxyBegfVRYTKfQ7vCacY6ho919K1Lp13kMs5HFLr/arHL6J5LWsmIe3jVBv7Ajuf9q9Wj5e6eBoWfEisiJH3X+x5yUzwRDwJhSj4HWD5neZkrYwNYVPTQb/uC0BhPNO1O2E= 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 1666591063458858.2034812445203; Sun, 23 Oct 2022 22:57:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYY-0004dz-Oi; Mon, 24 Oct 2022 00:59:22 -0400 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 1ompY6-000433-Ce for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 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 1ompY4-0006BT-PJ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:54 -0400 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 29O4uZvR011846; Mon, 24 Oct 2022 04:58:42 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:41 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:40 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:40 +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=6XgbaW1j3UaX/Qr65o3z7cIMt9V1DanK+ZYU3xctle8=; b=rMIykFBKbvQotD2qYXB0RFtqOXt4TUb2qBP3PRKQZj4QSv85qoXJPmlPYHEZVuGK/X9I Hh7sXAoQlIbG/Lzw41bzi9kKssYv2up//UmwUF56LyaqCwNMWW7vSQj+sXdKHtMJwdG2 CefmTWE1Ypbat914gyg+XwU907mKOczTHsv9dpATQyOaRGhSbqxJ7TxTLO7phfdu3qlz fBuZSafeCTkHZc6t1eZp4C6zStOlEUXReua+B+2CdY+zlgJM6BeuL0hGj5+nVXZHbtZQ RopbtUROQxCeFs2RlSsZZUs7VQdzTdlifLx7ckcT1bIb8aUVhogeEsaC+lM/wE6tlUqS iQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j2tj7Ngi7r8y1xB8+B1WTwR9oKQLtGswEY77OWtgBVL34mB2WMtO0gsZMsp+gBMizZjP6h26fruvC3ih+eHSg5Wzb8JtNPzZQrpDq2xXPdiuecWdqXy4GoJcLMhkU934FIyNqzuz7fsk953nxdjeKbMQDkSmsgcdTA22DwMszY1BO0hd17DThE3yNi0HqYP/nL7oQt2XJH6DobNV1JGEZgX4Q45Dr9INwBZe307eWjsZrtr3HgMvxvlQREx6sQPJ4T5i8+foT3ai9tmfMztxgNQ0sXXPOQmWoEdf+KCT6G2yGiJ94yXll0K46AMskXHvygzjwnYOY5U0JHk/gS5Kog== 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=6XgbaW1j3UaX/Qr65o3z7cIMt9V1DanK+ZYU3xctle8=; b=PkLUfnPc5+lpGMISZpG6NgTCbaWp67TE+eAOG0kLn75ZtSFuAb8jnaUkdnlE+IAgolJ6kxx/8oE3w9MGAv/Xjr6u2WD3Zg8NUkN/YMiEjnrXfqLna5v3otRP6Vwmy1nKcWs5WLWX9DT29I/voxbCIAnHSN71w8Gx+Y8o0c4/wOtN00cLu4ohzGnWqbUeOyg6nVaYorPx6R7EvR8jQbDsxrjoGhy/d2s5b3KAo6cLnzhFUcWeDQD31yFERmOPkeCwYBcSZH7vuL6OVGi4+BdZp9XZzub5sHQZNIssH5X5HjOF65JtmavuWkXbRcZFRP92NCz4Y6SVQt2xDydu/ZgD4w== 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 12/16] hw/9pfs: Translate Windows errno to Linux value Date: Mon, 24 Oct 2022 12:57:55 +0800 Message-Id: <20221024045759.448014-13-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: e0761660-2c7f-4cde-f273-08dab57c6b0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qtDruQI0nPSWsSJu1JT0pKlUUE1jTxmz5nzTYSOwtjRh2ElDv8GkFqJPJyAqe9UOg3jqXEQ+e4wSXf4QUuiObGRRcpCO1i/38Wqs3jKTAoo3acQCgs/o9QNoQmxzQiDYXHafpZZkcw87nb01Pv+mf5YjcktmmLPiCItCDuuJ7lADPeKY6eCF4aSSFjlW84Z9bO3OY9q1w/K0SCzB/oLmmZBpLr42+XVPuULQmauREN+PjXi7RSmV/9ZLWmgrDw/8NWhKZ4HJvS9jHzFuP2OnOSpRPC4PKeHcoTfzpkFRkChY/tvgSsXKMXBSnG1I3M2E/MsnvEtiP7GQRaLnOqNgkwimZev58AcJtaUYI0RT7rJV09DTp1nuBci1m1MdhESogGAEJExrYHmXEz62PNO62qQ1hZmkF+X991TfWMs16y+0+ImgQ1g0e6/HssQ2hr6lTTlQfUPrxhc+fHpKByw3mQm9HY6RuCw6pjFaBCYyBuTUDcl9cXgz3zMd//KzmFhQQQl6r23QDbAmZViKN54xThPZg06hyEDYBanp5ZwNi3fuLfMmBW/vlEfa+NCVysMyZNRY0wGEUdgcCu8h4y8UpW6qF/j6PcjnscTtqjQ84S7QaJ8s7+Ip9d21YvjYDPsW3FAHRErll419kSp54SBYeYo2dFmBh2tN5lqYIeSYT91NZronej6vfKTsyf0Sg22JGqs52d7v7APLAwF3om9EoYKCC/KZUEeFE80MWcdY50Zb35XhELCXL3MRcM2WCuI95uF32DXMDo8wFQlxeN/xxw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?6FW62tE4MuE9Z8Cid8Q1ErFPS4Y9JKm1WGfLa0iTHIzeB+4jiBz6iTfZR6UZ?= =?us-ascii?Q?+OCPHNC2KuFb0YmAcfy8XlSuy6bpvKT2kvtXrQ5PkpvAdun/l1eLhmLS/6mn?= =?us-ascii?Q?KgYEIJotSsoeDLpVvOELGUarzqnTAOs93zBDugdT5CtbpUdAbIQqtUM++CFy?= =?us-ascii?Q?xT6rYJ2O0s5LUGOkEAWGxVBV0DRH4gEn3RUqBSng2S7gKBkotsucLnjKmwhE?= =?us-ascii?Q?0VNp4io/k32vVhvYIiv4qnfxZRSus1kko9UPbNUkYWkeuFrJ2EpZD7Rd8D+N?= =?us-ascii?Q?9/r6y68bZEg3AZTUrVFKceVY6z6wp/RS5TzGCKtwbAcYSmC4tpDo3Uoi4nXq?= =?us-ascii?Q?oAtXM3Qt6djZJOogb0uUgS0tj0Cu5VTq/IAJZuWIG9NGw0WrR0X4ygu5/BJv?= =?us-ascii?Q?Apbqt92txkFr4oLlscVV+bB4H/kQVkK7UAh7vAY0svGywptHVH37feJhZxOI?= =?us-ascii?Q?ngG9A4SR1EZvrYfachSq50VpFZ3iL9VtyTGyoWUimBs8wRV8cYcdo68CdDXW?= =?us-ascii?Q?Hn5M0WN8aSjFPd6oMjQUYdWZBwkPnswp0gOxoefy9cqSTwwBPAeGIzjmIIOT?= =?us-ascii?Q?0cdLS3Immid23N8G3CSvVL2HKvY/4IlbVRspw/TFwtszWKCqkJJy8dVZPB/d?= =?us-ascii?Q?oVPct5PlBAO1ZoHeeIe712vnbtGgHCbevqV+eGLz4u34lIntBwYOtAGV0M6S?= =?us-ascii?Q?wd6yHQeF6paEJ4W+tGQnokctdS2zUmvHavV+qHEYaRvcarkhvW+UxWPi6idK?= =?us-ascii?Q?I8Ng7mcBmNzDXdV33OpZka3yF4pNmSuKiKtPsjZyTv9q+e2QBZ/KcfgI2GMK?= =?us-ascii?Q?ErbuA8WHDbJY9VpW+/S3SmJ0WACC5PkudJ0LEPT6vlSAbB/k1TFXKm8uCi5H?= =?us-ascii?Q?g2Zn9C1FgHPrG2hBxymP1IdNUbuFm/mqMxaQ53JGYRbCVQnb1m7/a9i70O2v?= =?us-ascii?Q?9/BXuGf+ui4a0YSq7dBTd6ZQII2iYc7lmNf3Eip8k7nxqPE4fsuv649dbjhm?= =?us-ascii?Q?x1/FtWR7aer4V889IkBB9wq++Q0coDGIyPFXz2BlCZyiishTI7B7DqH6dbm5?= =?us-ascii?Q?PO7QJxABol54rES5SATiJos/NsKcsOLHemPrWu7PX6SkoHtyve9dU3qQYQoq?= =?us-ascii?Q?nRSoJ+bU7c0Ti6kiA/UmkG3f08sc5xS7pNpN7P5Bi3q+wPu2g1/nrnewwdcd?= =?us-ascii?Q?5lZrBo1exI45g3VZfN2kLpLg7RUwOiBI7re/HJ1BhdFiIra2QDNCRu+29kWn?= =?us-ascii?Q?mSNUZH0RYlRfHSuHmVYY7wlADkIzKqJHwV5PngW81FQWmEfERRby1I3Cwx1B?= =?us-ascii?Q?kYthRL8fB+SJODyvzaBYn+NOf9MS/ZreK5cnPFhT4yvBwNV1U70ZwsVdfBho?= =?us-ascii?Q?ABzOMKJbRTlHdRiqk20dT/BoAQV6VuPIVvJijJOyIdNqOC3hplsu2CaNIVZq?= =?us-ascii?Q?DWJFzJzHTOMlgB/dadn4MMVdbg8AlBuGEcQkvxZyOOzpzKRPqdTyI83uawWL?= =?us-ascii?Q?sEQgqpgpAwtIzUAeeQS6ru6Ue0Jzpl2XATj2DGVYHb7QVFwsMg8WAyCZGpPL?= =?us-ascii?Q?o5Zrp6hZHYj6wF3gG80sn4w6MfAO2AJgD3pY9hnfCrUq+C9XcqHhH80mporA?= =?us-ascii?Q?ow=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: e0761660-2c7f-4cde-f273-08dab57c6b0e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:40.4466 (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: HtrUauHKvs6e/UCsmSt0lgKiFEbeb31XLmhkV0wGj3jwfKd6W4L3aIFQN2/qbwqMBPuCWulGvvAo33NSux83iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: Fpkp-sllKNhfRijf7MG0zlLnpxh0oLbZ X-Proofpoint-ORIG-GUID: Fpkp-sllKNhfRijf7MG0zlLnpxh0oLbZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=564 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666591065806100003 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 --- hw/9pfs/9p-util.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/9pfs/9p-util.h b/hw/9pfs/9p-util.h index 281fdcbf8c..145a3117dc 100644 --- a/hw/9pfs/9p-util.h +++ b/hw/9pfs/9p-util.h @@ -69,9 +69,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. @@ -86,6 +86,7 @@ static inline int errno_to_dotl(int err) case ELOOP: err =3D L_ELOOP; break; +#ifdef CONFIG_DARWIN case ENOATTR: err =3D L_ENODATA; break; @@ -95,6 +96,21 @@ static inline int errno_to_dotl(int err) case EOPNOTSUPP: err =3D L_EOPNOTSUPP; break; +#endif +#ifdef CONFIG_WIN32 + case EDEADLK: + err =3D L_EDEADLK; + break; + case ENOLCK: + err =3D L_ENOLCK; + break; + case ENOSYS: + err =3D L_ENOSYS; + break; + case EILSEQ: + err =3D L_EILSEQ; + break; +#endif default: break; } --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666589084; cv=pass; d=zohomail.com; s=zohoarc; b=Y6XaegKrjPQzno05Sd2cJx6si7E/Dr59/UONTzm5cBanbb554VePp/DFGDB+lSQB01fHle/cY1yWky81pQ/BZNawsPLI3bwt3TR5IKQrYjNZ0Z77tPI8zfVU4GuIUXoKri0mlMICPp0rrNrYoRjX0QX7V75rK0N2HFc6flrzb58= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666589084; 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=sdc1sBW+ClvCoAfMr2NakYHq4WgtRTi5ldHN/9cqbdI=; b=E1Ke12s96AqWh/TFBsUqyeJw5KWC9b2ndKhpyA1S9wMqqZ3/0s+3716kO2d8GpzLR6dhXKXJpHxfbiHkuPk2rTS+sYOopJTvqBiFNE52qfHCh9R1ygZBEmME/+iQ2+qweQNiayakyNWyoHbQ5EeMANgT/O4QvO75iPvwd2a9FVY= 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 1666589084177956.9899171509226; Sun, 23 Oct 2022 22:24:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYa-0004gI-Bl; Mon, 24 Oct 2022 00:59:24 -0400 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 1ompY8-00048I-6a for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:56 -0400 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 1ompY6-0006C4-LM for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:58:55 -0400 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 29O4wibr017751; Mon, 24 Oct 2022 04:58:44 GMT 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 3kc5r2svrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:43 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:42 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:42 +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=sdc1sBW+ClvCoAfMr2NakYHq4WgtRTi5ldHN/9cqbdI=; b=i1WV7XN4417ZmPl+DD9leukskdsnn/90hGG1EnhUD5hOnDPrjaIBWvc39r2NX+WDsuX2 u0uY+TIlstapDlEG38hDWe4V+0ZSxCDD1gXE+X6oPGblParurPl69i3ynkukro3I4aIv 1mRs6scZxshCZUobpJzIUki12WL9+eHUQhnw3zhlQoNFtccMRK0LLIpQNZLNLAc0HDMd MpuExgNcA0neQqgBfJIz228zxncnw38JfFJohxYYmSaEklEJNx5dCC+rtOcvjpuX/qO6 +ETB/F+Egsa6jyFeA7+LLui74TUeRZCfLbuBNi9YvMekRSM5SsZ8ByP+Z9Oq2nPxiu3c PA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bWHlbTTk9VJBbPoCpP4qP3q71p1WdBy3I4/yeJztZ0uzKulva1pPD3cbrv1+o+PczClj2jccUfdlms83yF+9QhVFJbRt409Cf0LVPp8pHFL6UjDHhQx2JdtgYmLMiLtSQvxngGiDyeU683D37LfTHqbqKjE+CQgMjBOvFCKf5yV6ZRpoamZHTTHKJWDQ0fT+jkdXVjtnV9Lghf2VN760QrTRNwj7gDQ4ByblPmmxkEMPqVUyI0gCoAO9vlorygfxPRk+vvaO/CIp0qaTwVswQUFa0JEhcgnB0GcsMi9pqkUpimpeacL7RnQQNlWdpCo8qNGoCOJfLWHw8P/a5xFBOg== 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=sdc1sBW+ClvCoAfMr2NakYHq4WgtRTi5ldHN/9cqbdI=; b=VNmPN7huick9GEcTdjozaAu29wpJbHd7BSSDPeBOLGcMUfiAp3q+9BrUVEf5KYuKSmdEMQvIkd0zIzI7slSGeXEDURnb1CopmRZmGOVyNQAfAUyOEM+OBXsz5bh7+1yXXfKXTXzdrqY2WVuGyudR+W98U8Gl5L96kqYgzXgBJpO4tKeDtf1aV3NfYyWDrNO8QHrYCrOFjh84tB/EM7gouc7913B0E5fSDodHOaXH5tX5FWtZau02iOUvAM8/CXrfvBRFNriR2T84blz2d2YKnDiizx7tI4dmm8E/aNgNhIWNGFQB/Lz4MnRLsAvqDw2YX9r//B7hZPoDaQELskimzg== 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 13/16] fsdev: Disable proxy fs driver on Windows Date: Mon, 24 Oct 2022 12:57:56 +0800 Message-Id: <20221024045759.448014-14-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 9611af09-8060-4f11-f8f7-08dab57c6c44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /OMe2PvdkMyZf4fBGiNjH/aoZmhQJkDqFbwpKmkZoSTrAYDfjaF6fA8bvHVJ+K7QmiH8Hp769Q8lu/XDNral1YvAEBs+TAlKkFK+8SyeTk/OKlToj/wPSSC7IS+hUxJpJnfOOU9x2NS8bmQbOYqXFHOriKk99jVcfRIuRX0/Fbs15rX3mkYBQUROQasIrV240aAGOeaS5CZPyKbiJ4IcasuMF9ZChSJczav5E53f3lmsp5KJG6cHy0uTJNOd5Tlr7K5v1TD5OtlEm8m3PSOWRNcB3Xz89lrJklSi1Doggltz8EqHdZ19IqlFpZ9mnVhMHB+7idhCjrfhxJvyOcl93nOrXeRgdP95ZyN4Ou+CefuRqmdPUKPiAj2QTCxA1znrSvkaztpBELOCcunvxaLsi3byZhTaDYIL3ggIrgVCkr7E5BHzmChb3dtKxtgbJcVup9L1tjukjrDV/c/uZm9YkQ0srJlPHOXLmOgqWGkui2/OO1vCw1sBJ3+KSjmH4MIpSw6J9g1Z0MdjCPtB9mxXaah43W3zVb17nUqLjgHH2Kl29vJKzTI64T7KqR/CnGq1d8BLLauyTXKnvozgqK74dWnp1Gwh3lT3R5m3ut00h5++mMwJI1JTsFvXc12yEoiAjWi7A5TDpfxe1nYKw0iN+FdV9bgq5DaZ/mkxbvB9e3gV7msCMxvdQc8KrlCkBVkzjBo9cUXsrqlCJOoUmMv07pTix7+kDdHWPddJHHqUEg2HzBCkOdraNm5Pha5SAmET3DIVo4iGIpp9IIEw27Fqvg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?T52xB8+q8sS0xt7ouPq3bcJpZHAVGZGVgOa+0Qubq2ojje04EmFEE4JJVdEG?= =?us-ascii?Q?rzmgWATT99cvu9J0GX+k2KgPviN0FFOHfcxK9fPmgnG/6oIniNP5Y3Fw0bDi?= =?us-ascii?Q?MmmX+x4KHgSA0BVcxBz+K8J1/z2ydoPU4KVYfvSTVt6fX1Ih52Pln6stmxk6?= =?us-ascii?Q?eYbMZSTLNjHnCwyk0fn9hCbTU8AQSiRBCaAPPywmkj3VRwtFoLJwY/iTXNYT?= =?us-ascii?Q?GFLriyzVu1gzA+bHixrIPYAF7bFuPfje+FBtCNfq6FBsr/YdGa9cRCPYm1V8?= =?us-ascii?Q?0j9BvFIIeiL7+TdcCUnKRMXHBWsiEk5B/7X+vDgE18Afy2QxunNPqBk3Ha2a?= =?us-ascii?Q?ItR9BxR9o24pQiFWuhB+UJjlOGMjq9OFbkeS5JmiXSUYhdKiqSXUVSH7pfRi?= =?us-ascii?Q?dKApUxW+SxaI92jJ6l8nNPZRnx/H9rV/wsr2B/nqa1Svak+BIunQlZZD2iiO?= =?us-ascii?Q?fKEZXCxyzBfIKMLfFHJVIciaPriywAobl19/Tw8dA7L24cu8ntHgS45kp1gU?= =?us-ascii?Q?/hUE4u1855Krh4bXUok2KuVl2rsk6xVXpJX2hxxsx1wL5UUI6uX4aIwop1NP?= =?us-ascii?Q?vvkiqqyRxj/a+o15uzcnGpJA/oMYPVJVKwY55fF1yK4lAyInwLRMg7dN+NeZ?= =?us-ascii?Q?33wY/6k6F6M6JoEPgqa0kNK0aTfS+PyfH29juD7te9xc51CU+OEJp+24hvTg?= =?us-ascii?Q?gYnWUxsb2tY0TD1H5hiG5IUQTg1hhFSNgmyRiESGlnz+vBYkroKuzCbgJMBt?= =?us-ascii?Q?q30r0jvCQFWffRt+Iz/YZI4QpwWyUDiAfV7wphE/p6J8/I8bfVQpwCL0kujs?= =?us-ascii?Q?ANan5FlpnHGKo4us3FYhRWnrmqc0+fRZk2kfHoVXvUgxdxH8/mnN6swIena4?= =?us-ascii?Q?eqwwczAtOG9B94Jmjv+zjNnhY1+A7glLcewvGUH9qsJuONkTjNCVh3dQE7Xs?= =?us-ascii?Q?EkO1ImTVESqxws7pAFX9vRO4GnA3jAX1fNPjzVy7JntnfXW0soHNvUmUHfh4?= =?us-ascii?Q?6jpIyKwxYej8BUBAxCo0kXL+63rjWq3cFGwJLVlNf+RIxtcgSSR/Egebz3lU?= =?us-ascii?Q?loqaiKdfl2VdcPG1t7yjallf8yk4Z5cM5izzzO13QmOW9m4BaPR+dAv0R8Hx?= =?us-ascii?Q?mJeMVVw4iOgBubtSuJgqQEQPahtnr6kwvQiZJEEWocz9W/Su+HE3niDhAgyY?= =?us-ascii?Q?A2idaG7uILkTVNgKypswijb6OLuaKPCqxGOgvTYYQlvme40Kkfkn6cVfxOZI?= =?us-ascii?Q?ssYcjgKVjDbKpbGF1K/AJx7T+fMFarHZ6QVbq5pTg2C/EqKOoTE7j9y7VusU?= =?us-ascii?Q?vWG/dZb8NGR2YgBk5Tzdagyz0Grd5AwQTe83QWn9ZJWtEq+N6YesrxjB4zUD?= =?us-ascii?Q?bZBxjegtLpflEjyjHO59Xz1k4owZjm9w9KrIzSri7PeCvxjx98hF/LjkoVk+?= =?us-ascii?Q?61uGXBpRzEZKRrgs/UNDOb73/idQWHXMuD5JaehewEL6iKLr26qcQmdokktF?= =?us-ascii?Q?9Rb61U3ArJIsQvDCE7aOVQ33aBqTKLRPGYgvY8e6uney2/yRuWVGHVOP5KBo?= =?us-ascii?Q?k2jcZMsYR3oZYR3n/KIcRMF/JxEG5IcB25b6tbFw8QLzSZD8EIqYAafK7Xtg?= =?us-ascii?Q?sA=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9611af09-8060-4f11-f8f7-08dab57c6c44 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:42.5565 (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: DzHZJ+yuhCeeCd7rtju5deF47H+fdWbW8e/tuaOsRfC1t6b85BkkEiAC/H+sD77XHINRgGW4tyBo6Z0E4ZtroA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: Z5roiwr25a1SrnU0dfToru1vmIaXyosr X-Proofpoint-GUID: Z5roiwr25a1SrnU0dfToru1vmIaXyosr X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=577 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666589085761100001 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 --- 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 Thu May 16 01:58:09 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=1666592264; cv=pass; d=zohomail.com; s=zohoarc; b=Pu+9EPHOohgpSWPFDrjNBIBcEUCXijaVGr3rOC6roQt7+2KwusEm4UnaVMt6XvJBK4ml1X4Yf1N6CadSSeYPn0AixKKDYTKDx0Wuj2DrEyRvuncupdZSDVNWjnXx7gLKct+JGv0mMVjLiP2Wcx2xwFvE38s0oSrdf2KIZB3AcQo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666592264; 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=A8rMuHBIpTw3noUrUHbCRcArxsTXdLFPt4FCt/dN2gY=; b=netRO5Cw2JRKVNGqgqXMb/sElHOfHu5v3i+nHnrYzpUIDNaww+NIhNNsHnITtvszeC+Pk8BybNTGaLLBbWO1kq3FK4EmsuxZjgUbtrAaFkzJqRJfMq9Q0Wg+VbiE3YLLelHiXU+GRhBKCPMlmngoONv02IDQnoHy8ZdMmS4gq5I= 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 1666592263602969.0227471036942; Sun, 23 Oct 2022 23:17:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYh-0004t3-63; Mon, 24 Oct 2022 00:59:31 -0400 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 1ompYF-0004JI-BN for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:03 -0400 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 1ompYC-0006D5-D0 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:02 -0400 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 29O4rWf1025182; Sun, 23 Oct 2022 21:58:47 -0700 Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2109.outbound.protection.outlook.com [104.47.70.109]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kcg1ksmag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:46 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:45 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:44 +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=A8rMuHBIpTw3noUrUHbCRcArxsTXdLFPt4FCt/dN2gY=; b=MAEI4HPlkRmp9zL0Nk3RHDNpSWhogxRh4ud7ZWEJiuPvqshwmVb9wSB3BkjpPey73Irg XZ3eFvgFrQPxLa/4mfICinuOFDF5ebFLiMjsNfk+u85ao0vffdNfwN98Wf6eY5v3doNu YxKrjp7+hei7FThZl9E8a5vt0pqNeUfzeSHpmvTC/5ZZklZmaJLzZ5F5s45596oF9z8+ fAVIoPwx65kufoqQjg9k9VKwrNZITOD/aKgujRyJLdc7r/v3Ot9MaI23pJEn75xzSM89 bW8N0KgoNbbZn4xdB18MmH2sAhusOOrHtfgvlpbelxC4l73ZbzA7qCs9o/h0qcO5kCi0 2Q== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y3y0e72Kunnll6vdj5/OL3iWfezH/UQxwJ7hKmDYUa5T9OOPao2y7r7UfRGxftiQKqrX4Hpw24Qy6qa5x2H8ZeQJWrn7RpX6CLJQavxPQbxmYC7+PsifPWqwmj7wGIr29F9weT79ty1JMg/A/kz5Vp478L2ArskCOignhW502s1luo4GD0uaQK5Tdit79LQmLsC14NEtkO6BYTzbm/iMf4alpathPa06vQna3X5naX6ghk2gn6gVRUteq23vo/eaHNBnIL4TCbganxjnzAJR45pGd+A0MuZTSYzhBMahjuFkHmW2SU/X72BDJk7P20d86nohxtI7Ff8cCwqXMbVb5Q== 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=A8rMuHBIpTw3noUrUHbCRcArxsTXdLFPt4FCt/dN2gY=; b=J/bwD1x0LNVkJIYNk6vudND2tD283e+UC6BHFe1c/T8gXAchnqzBbHX6jAjTngHo87fgLA7mdCZ/Qfg6n036bgPBWW+ah/t+M+Rq6/AoqL81sc4OAQAz4BFUDhjdr9QcNW5b/SXEGFV6vrhdOyWvGfQiv7ol3vj13zjvM2hH5wuJEXN6qlMZzP61MW3FKs0S3zuBrDXcxzDC7b+iJibWuokkkgAwaPLaD5TnMN3sChCf1MuT8fReLmxvmAM1+BoYb7/K33gxjqQPiWH5LdYU/GuBnJ/b5jBlwabYs7Goqt5omOuWMNYKNIZE57wH6rk98e63waNZ8r3/YjNKrHT+lg== 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 14/16] hw/9pfs: Update synth fs driver for Windows Date: Mon, 24 Oct 2022 12:57:57 +0800 Message-Id: <20221024045759.448014-15-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 778a3ab2-dd91-4cae-0d4f-08dab57c6d9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IjSgZTi80sQzL6KVwD9/7M9lVmB7jmnzTMSlfVTC3gglC8Iv2DUHaoHrDNNJkvUgKMpGsdCVkaEik7MYNspLVl/vuZway/ETeZmjd9Tm9Oc9xKIzaXEDoSKQjzDnPhTAJXpUAOxLFgkbqIhR24e5uTKPlQJP9WNK9FidLlrpYYRSreZ9r0y7Jo5sX7tLz4bBVFAUzZ8MXoKwzBphrhlRlKI0GHcM48FNl2iVqeEKWC/XU/sM3qvOcFfS258h0dcicuDsENo8D6TbbEmjEWoHHnpxx3GqIBTHF3IJE/q5V6EX8lxiYQk1Mmn5OObILd2OKmKGCB4j+/cy7orUQxbCNt3QgGnvrOYFibsFLXR6yA/hsqY8e6M5wh0Y3WnZF75GAVWvahCLr1I/boEtcyGVnuoonH36b6mfHgsBCsd5+97jnvjUeiRBMPec73k6Mf2P+hjdVFPz9kqOz6mVgpg/DbbyLWJD1unf1S9A1CZ8T0rcJps7b+xuzvcInuMEyHh8cH39iBA5eb5VNWlcH3k/jW+28Lx6fn27ULqlTIYlPyENok+gxF9MNAwFptzHdy+r0h5qZABMRAtg1Uhm1zRzwAp5zA190KUalVxVGCZT5FUsDb92ncahUAK8KWfB9R/z7AummcZz5gnFNKTXfWOkxnvZk5BngewMsGOGtQmK3KrEbHn1P5ZKICa2sFL2q2ibkQAnqpVhaqqeT7Umtbd4/sCRt3tRkP4IpPFg+wx1Pt7+AUUFzsk4FH981VZ0BEy7t/a6J9fGMPdmAWML+KBEJA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2i6ZwS58Uwv6+iXzx+iTx4uQuxIUQpEq6oWQipNv2ccELstQtpKNfVYdl9Sb?= =?us-ascii?Q?2Box+us5kqeKgsKYjfgOcAjXcwG3XjK4mF8P3zWce4YSq8163TPxxJOs0BhD?= =?us-ascii?Q?0DxTagYWbpsuwZ+PSnU0KYWa3ON13th6Duyt3wliI0OVJIgmLfeoxa4KKUMe?= =?us-ascii?Q?gbI9bU0XaTx7vp2yW8ehruZ2A7V96sTbLmiPWXVIwHPYCVqznRdcCT1d+yKc?= =?us-ascii?Q?GepRvgxXsPODVZf9anwDhU67tdWYLURuhIWsDSBdA/udEwaeiKbY+a+pRiSD?= =?us-ascii?Q?f/og4KylZvfC1EcMCWxCp+mu83o7QHEa3ysz/tBssBqMkz0Ibars/4szrLcb?= =?us-ascii?Q?+6uD79JAexPzLvGn9U4jDnlgpxbcS/0UD+fveOEd2Hd3PHHYkOCiYMnabvg3?= =?us-ascii?Q?/jSXDGVeujMNPHfwM+pNo1uLtUeXvw0tAb8pM3rRU5P2Hh05gsdb1snX9Xiw?= =?us-ascii?Q?Ut5DF82jJO5Z3x1QFQoPYAg0ZDJgQDrHS0A1KXYjaYi0x1Vuqe7fHJNnIS3c?= =?us-ascii?Q?Pi/7PkSLcI0djBf5LRmjqI6jInNXE3kEAK9zk5WlulrQVmt7vyLLrSs82kys?= =?us-ascii?Q?AODHvt56NNLqQ3MLFaXxbyWYO4QQDUwfsSfGIGmgBETS/ynTKUH7PbeoFDh9?= =?us-ascii?Q?0BvV0h9Rq4UxoCGtSRUvhw/DcnP1ya46DHBTiWBsjj6gwvdDt9xOEIrni558?= =?us-ascii?Q?IRhczG5Sg5yUyEQLl7/c66JT/4zO0NTF+M+q8j6/qoHZQ+6XQ8dsrVjospnv?= =?us-ascii?Q?SEeGVyqoHkYyPW5nAB+c0EOEnaFeP7ZYbxPHEg+kEatQjMjLMp+IIzETnKWp?= =?us-ascii?Q?U7vRZfiwsr3OI8Hzh+/HcPYDCvzosSk/iuiRSPTJoF4Q/o+GNf1wMqRbjnj6?= =?us-ascii?Q?gB00F3KdlMx1leQq1jOk8WBNDb/Gq4RI0aCmVEFFPixHtyxudL6pX8BHBrMd?= =?us-ascii?Q?vFfatci4C2Oy/E/uCSR1/fCU/26vuah7CJ7kFU3iaKXgsfuURlM/2tUnhEUA?= =?us-ascii?Q?BQJngdKgOstmOUFcgtmGMzgYMXt6wHoESHM1yZi6YNT0+ZTYoSuJE+mRkHGi?= =?us-ascii?Q?xR35GF1/c/J8FwQUwHT66o5HWFuIHtLT93gdRvu7PY6ckyKTsNadNibkCzSZ?= =?us-ascii?Q?f3oZS6LLpLLNzdFpGuSuSEX2k8xEt/iP3+0wXH8hmHrgKY9jDRhQgFRkMavw?= =?us-ascii?Q?R1cHzv/mlThlvmbdaZSYB+BYCROfuQDcneDZEiFsJiMN1RqPQGqb+/arOhhL?= =?us-ascii?Q?DmziCStsPyKK4zjsPe6DuP7WeWx+WJ0Veei+HLgrB+7hk/UclEWxSYubyg3y?= =?us-ascii?Q?Tn6/OcJY0XBXgy9C5bwVTL8CpUlBFLAtxZIzSuJvSCfflyymf3KahvOsvf4x?= =?us-ascii?Q?PcAEauJ+DeEiz6cVVPrOMkVsZ7hkJG+vhJ2PZGaV0GAkutPLHS9A+5+AqFer?= =?us-ascii?Q?D3AVs8pY/VAGFtNLFs+7rTSvsjf6xQndAX/XjhhUz5uHbT7YaDID+PoQ8DOp?= =?us-ascii?Q?rVsKM47BRkjkldseP4/BvBg2+6U2zhMHYSiT8xJhjnmLWHgnvmNu4rW4niCD?= =?us-ascii?Q?thXCpAZihrTZ3q7tsUkYLeWeTXFpwRA8rv0r0/zBSZm3caD8w09vlVii++Zi?= =?us-ascii?Q?7A=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 778a3ab2-dd91-4cae-0d4f-08dab57c6d9a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:44.7917 (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: va7RaoL97J6s/s4dsbf+qPgVZdJvp2YCMoYqB0JbzfNUtDLhip1hYUUHbJc2HJzDwl+LdAKWu+UoT2sDSbKcFw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: eBdzmNnwJBQKX--60CcaWf9oJUBoWObS X-Proofpoint-GUID: eBdzmNnwJBQKX--60CcaWf9oJUBoWObS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=942 mlxscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666592266634100003 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 --- 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 Thu May 16 01:58:09 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=1666594343; cv=pass; d=zohomail.com; s=zohoarc; b=d/D1OmxF4/f1aR/f67JrriSKkieOiu04PVx8CvzBvlaP9ALzBUhXmma/TiBqk0YbCDSWztbM2mWeoiSDj0EguBOg2rCAcCvilx9sAYUL6SR8jqjaUCj6qLiSEaYoy1VF4IxwxuY/tbAW+e84nTvOn+cA0QkKn8YEnmw2vZf5JPU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666594343; 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=olQOEYv7nNzRorXdnDXFKA4SrIIv6h/+VhWOvsF7C08=; b=BT3SOLthbsHBs73fXIujYTs7b6KTjVwq/ChOv0+dDOdhfeX1DUSbCXwO1AHzrDmZsM4eVMHfdoQfDoBHZzA7vo6dWvNWQwZeah8+rgDofCYS3VjVjIymubo7abwRgw8hhJrrz/fW6wCClZm8AcK33XNjOQE/WIg/cZV83CrMPB0= 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 1666594343448906.9308542272288; Sun, 23 Oct 2022 23:52:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompYi-0004uL-Kh; Mon, 24 Oct 2022 00:59:32 -0400 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 1ompYG-0004KV-Hu for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:05 -0400 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 1ompYE-0006DE-U2 for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:04 -0400 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 29O4wo6C023768; Sun, 23 Oct 2022 21:58:50 -0700 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 3kcbt51s1g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 23 Oct 2022 21:58:50 -0700 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:48 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:48 +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=olQOEYv7nNzRorXdnDXFKA4SrIIv6h/+VhWOvsF7C08=; b=PSuOuw2KqKcb9qO6jhKWbSYS/BbVe0R2HrWHYZR2UWldDxRdM5AFKoaP45rRIrWoqWSU Zy8G1ouAGmoXvuAWxHwPfM8Wgiaw/YdTOBpqEA/ah4lEmHF/XzYX8+8x1qFm0Sfaqy1v wxV/D/hzin6ZCMrH36myZDGwD8XNMw/TSLkdSTXRefSQ40POtUkwlR+Tpt8RPa0oH+Q4 LCcMA9nw8BydYTVOT+GFjRLcWP3ExoCotH9u8/0goDwAYB1THtwWKrBP42zteMFwKMDM djX8xyp2aKiEwCMy8F+54AYdRPolmfJHO1EwREBl8Ux/BMfNxaiKxRGqB0mmS29Af1Os yg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=boy4sqOH5g4fftPigCxTQ3TQgXSFr0oVMlR/j4fHFRH7I9bkXgxFUT8wjbiF2N5ofpzP5UgvS3WkzVtCJV6+9oIXlICicmpCUh30K54t8vY3LtA3eTUXCd+M74BXq+gI48k6LX/smnKoQ5o+mAHkUV9+up7XyBlrHh+Do+DKP2f2W9m/LChW0PZjo7E6pJ6UGz0V6nb6SuC7IQ/CHecyKNn+3HOX+/PYp5p+mZrDykJBsokc7p+aiv2YEYGi8Hid6sydeGlq5LJg0rkvUFRWset55R/9vaXpfX9DsnYwt/0WDfDQNy8VUEaQQcaWVq2cJzO2HUevKwfDljoKve/6eg== 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=olQOEYv7nNzRorXdnDXFKA4SrIIv6h/+VhWOvsF7C08=; b=kwdNF+hT9w45TfLIiSJNgKyRc/vTTfr5ujLb76H9fsAFltaS1gGJa4L1OLjXDuRJN7xdHrV2LzaVrq45MnEwuX5UD14UgZVSH5MOLh9mi+xgmpXqnn8vpbquK+oG2mHKa664secI2kFii74sOF5tfKj7vyaTwYc9a0UZBqHFOOFz7unI161VVrQ9QUISuOivzJ6v/4FSfNu9LI+2YfqfdknZaFKYSWKOTXyLyqkkccWBEq7e8ajcUT4ELvOOWHQZQfvwPu9ZifTRvvcuX4eJBZgKHs0w+wwt1iSIaaVybd7oaNIwPGqoMa3QJ5jCZpGBuMWtP7XVelqUBJuvi4m10Q== 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 , Christian Schoenebeck , Greg Kurz , Laurent Vivier , Paolo Bonzini , Thomas Huth Subject: [PATCH 15/16] tests/qtest: virtio-9p-test: Adapt the case for win32 Date: Mon, 24 Oct 2022 12:57:58 +0800 Message-Id: <20221024045759.448014-16-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: caf3e498-6f05-4ab5-7875-08dab57c6ffc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mce+lUuj1iGQpRAauiBt1Y7Ic5QzBW4bAz9H1f6uKja6qBQcsoh8e7AYyXDhEABLoopRHQN0sIQycnNOeySfPo7JfyXOrLrNZKqgbdhia52RIuYYDJFI6JmyVLgLDYUvcZa5h01ZicAHL+D+27w+0MPjs8qPFcJ/zq7cNy7t0rUoZSSxRxIizdVtoS2Tlyy7kI2FMxoua0BsqE+6Om0vaNCWHNbvSiBYs8HpF1xMWHrzAa+5dNCDSeppAEgdryBVOMdEwo/VeAXhAxqszDV8U6oTImcUa91uZvwr1I3OhgcBjn/n2w641GQaXCXxdV8yGR7B301MIQEeUICoPqNp+S2b+omvaMDgIoIj+mq/wu+eBLsz4poMJNkh7yx3iKTL1Ry0t+pdUh69B+kZeL5BAaslaU8n2yFpPOeRWQma4G0ndCj+iElRpkUtZDI99bQqNsg7N4W2KTS2HNg+mO1cEGIs3GTRnADxoD1/vxlnyyoDIQZZtPQ49nmVqbN9Lu+uDgGakzsz/ymv45bROf9lrT2rHGhqKl4AmpLrljfoH0aC+pjEsCojxkfAcgxDRYMZ+pFQhqMlvVkmZS9VPLFNNJ6cDdVzlmIvu9E73TxHqf6lw3AhBfHYLpdVrPyEhopQWaZ9Tpt863Cf4vhdGZFgBVYOigAO6F/+QJiISA1QbaXDjTBf7AaLtYpPdPR8kX7b5JbFBFeJnKt5kQoy/lmoLDF7izh99w7oUB5xtoszqiPgspwPY3ly8WXjnl+QhO53mMskYwC3RyaM/RwGpT3plA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6666004)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(44832011)(2906002)(4744005)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Cc+IZzSGQQDXSGdYWb/9W1YfYghZxrzDhC6WAKYXlmVu2Z7lbn864rfbxpSg?= =?us-ascii?Q?9M892Pz5RGAHB1+9qDPP3n66sMbWJIlIEeZOhkHTFX865rJ2/BQqNcAOpAdn?= =?us-ascii?Q?cHG0l5BhHmjA0ok5jEEL9F4FtpHznc3eL1KS/WbJ5XOmYOU2Ict+G61cAvBa?= =?us-ascii?Q?//lF91SCGH+8A6WGuG/bciyISU1yGKvn/i+3SqgdzOR69mQsn+u93cTSBPI5?= =?us-ascii?Q?yxSSh3lbmGOXAjKPueA0o7omL7L5KPvxM0fL3lA+9g/XU6d+efqe8q0nyyDh?= =?us-ascii?Q?nbvh9SeFYPX+sb8Y5HazfiTWzbARm/SVLQrcftjoNScLpG0jeebuUu67S7Gj?= =?us-ascii?Q?z5NBIfb1Eq+4P7nTkDgZRZEuEAuDUVC83IKxR0/EiqhcCVmexFipoKRdKJXx?= =?us-ascii?Q?EQ4TfX3aaRaaOkObSuVo6pkRQ2UhzFrR3+n0LtO1JDShhHPT2y5rkxpu5IHA?= =?us-ascii?Q?2JUNifgYoCQpUZf23PHBvzz4uXV5Pep+20DO2cCg2ZEp5SZCuI/83yHRks+p?= =?us-ascii?Q?eyLLqg7SMrBc794/gQ98I2oSf6dNKcKPRx5RA6kHzr5I9aLC1ojJ1KYURYmp?= =?us-ascii?Q?aT6f81hQfEBP4P+ILIoAm7sY+UxThH7cT3bscEz9ThmhpzWI2R9+IfovfjhS?= =?us-ascii?Q?vwsdBRh2Tk9gNGK+uA29NH/vUv0SjQ/OPXoQlfeUJlTB+ouI9vCBRzb8VCx0?= =?us-ascii?Q?yCf7B1AlS3uyaCNaaLYL3VWGTi95VV3W5bB8zcsMh5SKQqDabQi7us7n78Ny?= =?us-ascii?Q?VueiZRTV3+X39ERSISFhQgaueHEGVCnqnXpHesgRoIbhE6e/TEXAtRxhGiu7?= =?us-ascii?Q?OlyesRWiAWb19lfSlv9oMmujnbIE5TUhqmYqplehCCNEV26s/8etj/LNt29j?= =?us-ascii?Q?7nJEI1910/OHjYYXLJF7PJQrD1W1L0FNkRmhZsaVXOlIBzauc8Eb5evPnWle?= =?us-ascii?Q?oPABG9Ypg1Pv+1C6DGbud1vch3Ev1Hk0VZIL85wkBY4xg+mrnBK/dE1Uqnb2?= =?us-ascii?Q?80mLGGUNEmu3eOu7UkCbok4T20dVm2QMZ54QpEPdKrSo+LNVTwwBUttV4RFe?= =?us-ascii?Q?4Npj5PFfJFbMt75s7yyO06NsPQfXGydg9ExbxM639ptL1bh9og8cpsXwruaj?= =?us-ascii?Q?mB9osCAcl6u92Oxio6bdo3AaoJAHidTvTUEeZmLZO9UBNnLMPL7z/ajWpJpx?= =?us-ascii?Q?r7G7BxMB6Euswrw5XSoed5i5LjkPKioptD5ZVGJ2M4xV7sXSiY9I01er3/oj?= =?us-ascii?Q?8kWDA46BLrbEbVgRPte6K28IjGo83xeiPWA0nbbDKJqV/JCfluhLLB56aeAk?= =?us-ascii?Q?Ty/1Zm7Lnrq9m3AnI9W4t5ExIzOtUl3L3siv7H7pv4syRdaNdPevfStz8TOm?= =?us-ascii?Q?qWMzVRgFwK4ur6pBVjwvbGIbzFQ220TRG8tu55puwwRPCt8SHG/RcOMzdT/H?= =?us-ascii?Q?JkfeGauZLJhaEvim5/zJIQ73tddj63AEMjhsji+Vjt/k3a8OwGHB4OO874jg?= =?us-ascii?Q?TmFvOJLLgO0rNwGZkVfTo+RQti6V+KqO8LOca6QG0vbOY9u+/LeyB7Id02C+?= =?us-ascii?Q?szao11Y5ZJ7njQT+cTGzQE7fEu9Iy8G2ntQtUX9+FPlmHKuv/gdw4jt/zqIp?= =?us-ascii?Q?Eg=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: caf3e498-6f05-4ab5-7875-08dab57c6ffc X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:48.7766 (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: zG7yF9Nt+STGNqjoiwQIeXY8hirdybqvSv/4PO+e1CEAXguOzOOjpg67mcoo0llpZb+eqYbAA53VYjmsnu7k0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-ORIG-GUID: 7rDIQaoP_blqt-L1pXPlIiQvfAUoFh1g X-Proofpoint-GUID: 7rDIQaoP_blqt-L1pXPlIiQvfAUoFh1g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 phishscore=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666594344056100001 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. Signed-off-by: Guohuai Shi Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng Acked-by: Thomas Huth --- tests/qtest/virtio-9p-test.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 25305a4cf7..e81e3e3709 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -34,6 +34,13 @@ static uint32_t genfid(void) return fid_generator++; } =20 +#ifdef CONFIG_WIN32 +static uint32_t getuid(void) +{ + return 0; +} +#endif + /** * Splits the @a in string by @a delim into individual (non empty) strings * and outputs them to @a out. The output array @a out is NULL terminated. --=20 2.25.1 From nobody Thu May 16 01:58:09 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=1666588088; cv=pass; d=zohomail.com; s=zohoarc; b=DcrV0VBswwPcA0e3rrAJncvdutby6KEuNPvdaMZ5NACtaJq0pvfZhYQAQ4F45Flvrp7ghIa1YmXC3AU0WQTEPAmIepHydgGnftGVw0Qfh3ntGC5wg6Qu4d2PPe/wnVx5V4WM9Iyo9kiybkR+e2pDUbl2nett2jxrKTkj+FjAm+k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666588088; 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=HYLliU5SInIaZI2Sm1MxYUuuakbxSydGL3cJiGUQUcI=; b=Fm2X0Um3qtee0LzF/27ZWH3f0DQ0E0Gf9Y6WHdg4MzJ5rptGgXhE3R+wkknSrXPkmy7A2j7jMqDAuoE+E0FgClg1lDRqGecxVHloW2Kz0U0Yyoo+TzffMV4McKaL4NvJY7tMB2UeJCMMXrYnyW4Muj7HAgbWpDqLXkeGdinnGkc= 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 1666588088752339.7436215317414; Sun, 23 Oct 2022 22:08:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ompZ6-00058t-Kz; Mon, 24 Oct 2022 00:59:56 -0400 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 1ompYH-0004MH-UU for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:07 -0400 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 1ompYF-0006DP-JZ for qemu-devel@nongnu.org; Mon, 24 Oct 2022 00:59:05 -0400 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 29O4aBdG004966; Mon, 24 Oct 2022 04:58:52 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3kc7g9stjg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 24 Oct 2022 04:58:52 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by MW4PR11MB6911.namprd11.prod.outlook.com (2603:10b6:303:22d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.26; Mon, 24 Oct 2022 04:58:51 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::b051:27b7:c1c1:7cb9%4]) with mapi id 15.20.5746.025; Mon, 24 Oct 2022 04:58:51 +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=HYLliU5SInIaZI2Sm1MxYUuuakbxSydGL3cJiGUQUcI=; b=E553md43ATWQanUfd7UNkLqiKBiqLsAqNp8tBTb/LeVhd8GsBYm4Ls8emlrsa/vKngGi CylPQZ8maKx0RrVt5kRohlvZ290sEEGBaR0dqvoopYYrh2nRr3Kd3dH78N6Xz7NHVE5x pqNmCURA+rYlRtYdRA7tuqryQm4urs8LCSk280vnX2ecjn7S7N2hmiWUgc6fvYblE4Aw p1Dn7vvVatzx+dSAtv4mVS74z8M3RBRYaSH5P/v6BHzSfDvDe8FFpFXrZ7/RIqBLZuEj QpxVK0kvpRMJl9EoRQpwsBB9R+f6wYSUoItY9e4Rrlwj4mhsipY+ZM4P/urKtDK/TlJW Ig== ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dBzzHP4VkJzml/gujXMDOIuDWddt5/yJRUKaQ0G6l9AnSwHvcmN+0oRR66opPg0ViYX3MwtEfvw2R3LL+7bg23qahsDobX9VM0nXPZO+Viej8xs+xMfRA5MGWjClU2eYm3YdnJ6Ukk/E9juS6zg3ppEixp6dV+lS75lDNXCsV9zIBuMJ1vwAn8aRI+rHKVoKoETV7dcTCYThk+LNu+xCTGdtIT9O1rVxYzDvI4LWq6Ec/+/gHdf4j5kn01RP7hJRnCDCUXhNSwKpHuxPftOq7h2a2TUUT2IwZOKnm0hmDcMekkSkNS3VgWRm0GXS9ncilvw3IB+QF+PLJimtvw0/Fw== 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=HYLliU5SInIaZI2Sm1MxYUuuakbxSydGL3cJiGUQUcI=; b=ItHEqNqY5irxcuAglnZaGhJlQtPICFzar7PScHmUuDGKUiAJkDMFxePdJZFhCcsHfn+MOY1EBp6mEkFhXuYx/67pvNVh0P+s818UhzuokfwWXQiK0NPC/hvmhYjrGvVSPlDOv07/Wc3djNW9ya8uKYbeTGac8N3VC8ARnu6nV6ur9oZfMGYaI5vaEPYVLey5lYl/GZmg1jKlB9kYoF30tC1/Xzggt/Shr996afRqTLEwmriM2DCerUzf0h8a8t4Dm0zAKyJabf4yy27YMhrLtJDQzONcfLxAKz4K80/A7HBcgEnltNQdllu98sewWC8zAggXwksqaQITtaknF8uPhA== 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 16/16] meson.build: Turn on virtfs for Windows Date: Mon, 24 Oct 2022 12:57:59 +0800 Message-Id: <20221024045759.448014-17-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024045759.448014-1-bin.meng@windriver.com> References: <20221024045759.448014-1-bin.meng@windriver.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR03CA0021.namprd03.prod.outlook.com (2603:10b6:a03:39a::26) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|MW4PR11MB6911:EE_ X-MS-Office365-Filtering-Correlation-Id: 8169ae37-a7d7-408d-62b8-08dab57c714a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FXX9jdV/wddt96Dc6uyrO4tOhFhrHM1E0rESby2CNMvkAt/JQlFVzb+NSzMvLfwQE3A0A60iDkHX9+enox3faBfnOtG671B+3jYgRqFnOdBpP8Y5rD4KRhhnqVQpMLyLhkyu2rG41Eqe1wt4T4Eyqqt7XAjqpbVa/npQa8/n7YGzrA7Ca5Pp0v97pitgglliYty7kIglDALbWRB9e1zBsCs2Z8qUJ/pph3qmvZCzR5c4Kez2dJrb2kRw9Bd4Cg+B6yfxN5c/tX45Xv3QJvwKJiO1I2sx3s2F4g1+sN3cJGNcqMkDC/wOmpJN8mTFIMstMUvW7smemGrS3meUc0GM06Je/kOOXgWIR69yobYeRxQCIwY5Tmg4cK+JNVmPsdRKJwCS4Nc3uP6RJPF/QJDLlK1FAX8peqCkfyNsrKmscLn8j/yjqADsExtI1iWww0X2SiTunkIR3lQVRhMYUU45Yce2HNGzvBNuQ2/2NsKSaAhmTuiEacCqbrN1XxmwWsOh21rlelFs+0WDsJsxWwBhfenj4+V9hyAzkqrhtMrykpaGq154l/5gxImTDPRNkdpNQlseK4jYfUJK636qwmBqBHL0kxIFkGHKyHp1fOa5hsmGLV+MQK8WqpqSQj3xAy1Hcjs9kbMJNPA9VO7rZ75mTvmDb2uF95bP6i2zv2kUdb/OemH8etuwNakM7ROORaVbuFV4cljCAsIDQkg1Zt3jW0g4MNNlzBlCMb1TQmG9NP9/AOdP1lIYrslg14eQQZ/7ZcIpiVPTVyTbohVaB9/+4A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39850400004)(346002)(136003)(366004)(451199015)(6506007)(2616005)(52116002)(6512007)(26005)(1076003)(186003)(83380400001)(44832011)(2906002)(6916009)(54906003)(316002)(478600001)(6486002)(5660300002)(8936002)(41300700001)(66946007)(66556008)(4326008)(8676002)(66476007)(86362001)(36756003)(38100700002)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FYEfTqK6236nC1p8Ct32TxVLojcG9E8v8ofPDqOsMShdw4nTwT5ffjL+pgvf?= =?us-ascii?Q?+dwStPquegRy5Dm4fJDSPpcCzOzdxX69mWQDyeXVmllpebo0eVpKkLjUxcdC?= =?us-ascii?Q?moT09I7M4fHXVYz6CuMr8p3rhOu25Etj4syftOoi/QpyNMYzk5BctLIQDBOd?= =?us-ascii?Q?SJerVWbroQlG7ig9REdzEpLO2m/fsRfMO+4NEUcL5xnShZ+equTa9eRccl4n?= =?us-ascii?Q?WfydO18QnmKESWeSKRrweHUxxVYnkROH5ViJdZEUc1TlzQP4URXPhxP9Zunh?= =?us-ascii?Q?sY/B8luks4QVFbYTj/pJGPFAuYSQ/232TUYEqraLlAJmUERVt5e2Yn0Q002G?= =?us-ascii?Q?IKXpZY3COutEWjh+5UD2oAajNRdfu9Sw4q1/F5LgCfw1LyII5ZDYDyyKPKXU?= =?us-ascii?Q?64GZmf00D7hCdwPfA+VGeH34cMb4CFYjmF8S8KUyYwOhqav8Z1AxvR+NoZyS?= =?us-ascii?Q?zHvtKaqJw2raSSWQO2y2KBCoIm9obMhYcLDOGUEZgzT/HBZUAMBP83qw1Umu?= =?us-ascii?Q?4sR1BiQCWXE2lODpEE35qnI600hG4qBdo0mxsAmr804W+gAO/z0hR6j8+ZyD?= =?us-ascii?Q?KINVlket3q4iVrS2oIc5uuzx4ggp9HSRDVZLTUBdwim4InRzDNjxXLdnn4HV?= =?us-ascii?Q?IEn94kxsYUj/gcpwd9HdatoO1z4P440cjCYoQrFY5SZV8xjJkqzbs+BA1esj?= =?us-ascii?Q?292kz4aZy+fLgRsz6ZhpxdtFc2r1hk/fEF4pqD8aMxansgvF1iDXDuIdeZ9k?= =?us-ascii?Q?YeviYt4blbhpLMyJw3xDaR0ehSfZrL2C7hqXE2l9U3OyXLG25Tn5GdIlIDVQ?= =?us-ascii?Q?OvD1P7sZ8xwMw+gWfA0ib9a5osVG72qrNwUj/qMum1U7iIpaCkxjlI/dFnw/?= =?us-ascii?Q?COdKEgws95muNw5i6L2oEaNjUnaMYSM+NQui4+Ckx1MFSQZmdBN6u596ZN3c?= =?us-ascii?Q?uOuYhEzw9C5zumYnKp5AiVLhf6afZ7PRa7jjb2uzeleyEOBFCu7KSzGfE5XC?= =?us-ascii?Q?Aq5ft4gM9ejwp/4sWDsG2xeCqkIeodHRubbY5EUh3FbZXJ2LTXcthiO5GObZ?= =?us-ascii?Q?swJt5TrAOjlzRV8dlmRO36LO9rxbrksM5lLw/Dp3asFTP/2jL/o20vb4XGgi?= =?us-ascii?Q?To1qm0cysU39vSK3Px0lvq1ZyQUL/H/sI/XKssTtfzOC+h3HwgiC4RmdzpxM?= =?us-ascii?Q?fwTaS0ooR1D+m9jf7YAungcfDjzNlpMy1BBE0B5RFuSaH7bFJL8jmWbaxYNR?= =?us-ascii?Q?FswWBbZIvO4tssm4uaqyrhOkRCW8GlHu7LpocSHOFmaG7e720HjAHTEhmuVE?= =?us-ascii?Q?nUA1+YHz1XYyLv/X792zkB2JJwsOg5JbrNTsIjmm3Wcx3XdKz/sJ9TskxGvK?= =?us-ascii?Q?Q2Oju2Atx8a+RLH53KP4J/sYlKM9KcqCNiu5+jYBss7dfi18GRLMGA9/8Vzj?= =?us-ascii?Q?TFjBIzZ1ZyD9iakQBmylSs5iEZxj6WB2zPyyKxnbLqYm+8dBPu79h5YRnw8O?= =?us-ascii?Q?bt1VlTlzeiD6HHRs27sy6ZTpuKnmSjR1x4EvNGCUsE3d79CS0GDcfeYueY3W?= =?us-ascii?Q?7GOQeBte8UgZCkINpJMuLcwWjj8wazl9NJ6zi/GeQfxEoKI0gczi+wYlwssI?= =?us-ascii?Q?4g=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8169ae37-a7d7-408d-62b8-08dab57c714a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 04:58:50.9962 (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: QjKr265YSdaAVBKsKJJRdM4pysDVhiMFQspa57SmP/3RNrcNEDMvAsGs6+9MtfQL7we69vcUhoClL+N+D4bl/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR11MB6911 X-Proofpoint-GUID: no41bZC6vY0oKHU8GQX1HkU2MefHgbiI X-Proofpoint-ORIG-GUID: no41bZC6vY0oKHU8GQX1HkU2MefHgbiI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-23_02,2022-10-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 bulkscore=0 malwarescore=0 mlxlogscore=707 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210240031 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=72963f20b2=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @windriver.com) X-ZM-MESSAGEID: 1666588090010100003 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 --- 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 b686dfef75..4c23d18083 100644 --- a/meson.build +++ b/meson.build @@ -1728,16 +1728,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