From patchwork Mon Dec 19 10:20:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13076437 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55D9FC4332F for ; Mon, 19 Dec 2022 10:22:33 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7DGy-0003Br-Q5; Mon, 19 Dec 2022 05:21:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGg-0003Aj-Pf for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:13 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7DGb-0007PI-8o for qemu-devel@nongnu.org; Mon, 19 Dec 2022 05:21:10 -0500 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BJA0m7O003812; Mon, 19 Dec 2022 10:20:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=PPS06212021; bh=PfnK1WqiGbskdJNSZ6wJnL4YH9zuwz79hhHyJkZEASc=; b=VKD4Z+2B9IDPEdjmeccJ25DEVxFt2VaQL+iJ1hVrz6SYlrEyc0W4IQtjf/SPFzBPzzcs wV5cG+eXJUoHSQGSe3MvwcCqNkrPAMYonocBbBC2MzgoIX5viZaIu4eK9bZqSBSBsjBc xcd385/OKCfYcoTTrVoIi9/UaZfXZc/PGfmJ/inC9itoN9rMGZnFT6mU8Uh9jBprUA9d 2A4YzcJ3GodgWuDLhfII1+D1qw6vgeMocA1o27hM5DOC2MK7VW1Zs0ehXgV6iC4I71e6 04x9xgQJKMNncdHSgdQ3q9VpHfc7JqOZ9abTSuqpe6yvSyR/l5CUFK/MkBYr71ZYmYbn OQ== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3mh301hdgm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2022 10:20:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eLN4pLeHE9Ur/6S8j1SAtajUfH7pTFkQBPBKbdM1i60y6HwFIj3qgPMoqziwL0fP8dRd57AmnRkDsGJcDPB26iprqq8DQadhqmx3HBqv9O/6WUFegoP5PC19SnVlEafWVk8iXCE5HqSA0KYo1qToNNdMsaAh0lllWoia8R8vavi0Okno2+bUuLfWyDzpPP+gQGiNh8+/HkZop22eT7fzJDhTZCdGxMbHJ/36CGaRdEl/mjVB1Q/ChJQl9R0WmoJ7zsdqM42JgT/r5h15CSbEYV9jZ9DH93vNhXicGMtsRuWVLhkpg5j54jicYkCU70aaHQ/2E9lW72zBPGHl/F8icA== 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=PfnK1WqiGbskdJNSZ6wJnL4YH9zuwz79hhHyJkZEASc=; b=cqp9/c6brjbj71xZ9fVWcU93ByamrcFYcbBTzX0ILM3MhDP0hv4sI4l1LVSH6cqos7cbx+9rTjww4HVJjmBxIicynuuQYfBG0DUO27tKS88zw3hVxYUh651tIJOeoJFxEPw8s+ZIHLV4mWfs461WFUiNFQ9Ra4HgmbXfb4p2qEGc5paoc7+Pq2cpWZHWeobA08/6YEAI9to3mDSnS/mwOxDyg5p0+Zy7p8Fc2EEGoSobWXrB2VHQACfPkClM79XVVFX6r6Lf3pt/yBJCnhNfrQwEfyipIyZdFBSQ7H3trj0LnHpd0ZYQ1KpEme+w8rZirUednZMZdjMFTUGYTO5DiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by DM6PR11MB4691.namprd11.prod.outlook.com (2603:10b6:5:2a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Mon, 19 Dec 2022 10:20:44 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::8e5e:71da:1e29:bc15%5]) with mapi id 15.20.5880.019; Mon, 19 Dec 2022 10:20:44 +0000 From: Bin Meng To: Greg Kurz , Christian Schoenebeck , qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Laurent Vivier , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Thomas Huth , Will Cohen Subject: [PATCH v3 00/17] hw/9pfs: Add 9pfs support for Windows Date: Mon, 19 Dec 2022 18:20:04 +0800 Message-Id: <20221219102022.2167736-1-bin.meng@windriver.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SL2P216CA0158.KORP216.PROD.OUTLOOK.COM (2603:1096:101:35::14) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|DM6PR11MB4691:EE_ X-MS-Office365-Filtering-Correlation-Id: ae89be57-e01b-402a-4c48-08dae1aaaf09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 63XmDPqBs+Kr3C7Y+vUOWMO3jkP2kY+udg6PJFNqS+NTfsLNQTNB8IP+7b0CznEDHiRFf6CxMigh2OpOcfk9kazITbGbCm6+S+rj6+DdqhZSKx6sb9HIO5odvQUX4c3Y3dTTWOItCeLzFjpK6KnH5Aig5HcxRXDBfSbCD4mVZEBKh/uCi7ARNx4quP2lowc3RHC/5Ydgjcb8SkfbjR6uw6LXsxJoZwt8MMD1LjIMKYlUUaus3awoGD6S4c2dDS7mi//i74ggcl7p7gHRG3Mf0eYBl7i0X+C97gsVpy0/K8HibCV/wWoyIbcYQuS3ILtrMU27KY2RfeFo4k13OEevBy7dNXQWZsB5IsENhVTZsQek18bUjbfaGZq64WCxVgvc0HW43yJLkMQ6upXGqJZnRzKN4jaGGsAv+NMGKPU5R16odu5tqvjZdIMu2xlcHN3U2D5bcRFA9udbOr9GeVRbgOBJBuWuBK39kUhTL3N1MCOBERiVzdGJNC6UNSaoyA64SQ+We11OIyAEok53SpgKLhRlf9lMBkMxCWWuqa3zGoVo7rUaIGVLBKdwX387DsH54qYXHNMd3OJ1vuek2kecrZgnRy56aH4tvcskDsqiU10nPbRht4bs8egeZ7M1cpZ7ebhKG8r+pL3LokxZdMj80wk0XgjgDbuXhxCGvk4o47d8MkKRL6oTfxtzKc/e5vwVsxBQ6gKJMg/0UfrPJrQ83w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39840400004)(136003)(376002)(346002)(366004)(396003)(451199015)(5660300002)(6666004)(8936002)(83380400001)(186003)(26005)(6512007)(44832011)(2906002)(41300700001)(36756003)(6486002)(110136005)(1076003)(38350700002)(7416002)(52116002)(316002)(478600001)(54906003)(4326008)(38100700002)(8676002)(66476007)(2616005)(6506007)(66946007)(66556008)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8Z4lM9bkDR356V0vx5Xhb3b4PQ6/?= =?utf-8?q?abl9Nb7mWEChH4vIop+4jBrEQD910bi58NYOK7dvaPLThWjoo4JoYFSPiqFs4Gx5P?= =?utf-8?q?6ZzsHsQn0HWvcUwti7pLVWoOECaP4nKPcA6LXfn07ddRYYxwHpT4sDyVcD7JE6ODX?= =?utf-8?q?p6r2SnDh+cJa/euqfrZwKvsd4BpMv8xxuun4DYAyFMHkbZKed+MqlRQrqHvly1cGi?= =?utf-8?q?tmMUvHAhL4LJ8LrUOX2p6BDO88yshhtHUhdZQhfs0306Kv11KmKVbhpO4gItEc2DI?= =?utf-8?q?6tlZb8ja8jGRgtyqXNRuGNN8wTLoTis/SIlnTBuBQAgW1rqrlYjqP7r3BDNHjf0hc?= =?utf-8?q?QoC42gLfaJcfOKH3bOj6XzCAZijw1ZhFif14YNCrcMDar4w4qa4l1zsnbMpGuJWy7?= =?utf-8?q?+Rmv45fygf/uiqHDGy8iRSbt0BOalftEJcIWVzYqtJPiVdsgxkrTxPnGlaZxSncZX?= =?utf-8?q?FWhKdEo87mwgz8i5aul7W/FbHoRMJmIwiTJLlZMVjLBTWXEIV190IdJcEtQecb57l?= =?utf-8?q?YZkmrWjt6FE6ocfphFiV40wtA0mJbufjj+J9V8Ydn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fYqhSjFKUIErHiS4+HLZ/UjlYFERR?= =?utf-8?q?/Sl7/ICBFQ5bOnKSM0oK4WtIbt1yzCOaF8vVl6u6/7sIOlIte7SzeBmIWzNNpmGlY?= =?utf-8?q?LoFDfwYt/kSUJkvHq0Vx5pPPNMDkNjnNjw=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae89be57-e01b-402a-4c48-08dae1aaaf09 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2022 10:20:44.3980 (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: SBemd7Q702bhMiskrfhEOy+gZAJtPzxUZl2uuxuR1bCDVvIRkWMWsZhWPyjO1BFsVTYRRIQT+h0piql6YrtatQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4691 X-Proofpoint-ORIG-GUID: uieuM0NZFbcgQW5kDcXDS85qka3nGeh7 X-Proofpoint-GUID: uieuM0NZFbcgQW5kDcXDS85qka3nGeh7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-18_13,2022-12-15_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 priorityscore=1501 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxlogscore=489 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212190091 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=9352c01a6b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org At present there is no Windows support for 9p file system. This series 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. 'synth' driver is adapted for Windows too so that we can now run qtests on Windows for 9p related regression testing. Example command line to test: "-fsdev local,path=c:\msys64,security_model=mapped,id=p9 -device virtio-9p-pci,fsdev=p9,mount_tag=p9fs" Base-commit: 562d4af32ec2213061f844b3838223fd7711b56a Bin Meng (5): qemu/xattr.h: Exclude for Windows hw/9pfs: Drop unnecessary *xattr wrapper API declarations hw/9pfs: Replace the direct call to xxxat() APIs with a wrapper hw/9pfs: update helper qemu_stat_rdev() hw/9pfs: Add a helper qemu_stat_blksize() Guohuai Shi (12): hw/9pfs: Add missing definitions for Windows hw/9pfs: Implement Windows specific utilities functions for 9pfs hw/9pfs: Update the local fs driver to support Windows hw/9pfs: Support getting current directory offset for Windows hw/9pfs: Disable unsupported flags and features for Windows hw/9pfs: Update v9fs_set_fd_limit() for Windows hw/9pfs: Add Linux error number definition hw/9pfs: Translate Windows errno to Linux value fsdev: Disable proxy fs driver on Windows hw/9pfs: Update synth fs driver for Windows tests/qtest: virtio-9p-test: Adapt the case for win32 meson.build: Turn on virtfs for Windows meson.build | 10 +- fsdev/file-op-9p.h | 33 + hw/9pfs/9p-linux-errno.h | 151 ++++ hw/9pfs/9p-local.h | 8 + hw/9pfs/9p-util.h | 137 +++- hw/9pfs/9p.h | 43 ++ include/qemu/xattr.h | 4 +- tests/qtest/libqos/virtio-9p-client.h | 7 + fsdev/qemu-fsdev.c | 2 + hw/9pfs/9p-local.c | 386 ++++++++++- hw/9pfs/9p-synth.c | 5 +- hw/9pfs/9p-util-win32.c | 963 ++++++++++++++++++++++++++ hw/9pfs/9p.c | 90 ++- hw/9pfs/codir.c | 2 +- fsdev/meson.build | 1 + hw/9pfs/meson.build | 8 +- 16 files changed, 1759 insertions(+), 91 deletions(-) create mode 100644 hw/9pfs/9p-linux-errno.h create mode 100644 hw/9pfs/9p-util-win32.c