From nobody Wed Apr 24 07:55:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1641913964; cv=none; d=zohomail.com; s=zohoarc; b=WjQgnB8PsNnjUZzrOoYUghKmnTzHDyJWD5sXXl8uV4Gp0Bvh/19rz61WpZwITLBNOPUXgxo7hsFn3uXDlPy67rj0cTqOJ09sUrWsq/UQQKzVGWzfBsmQ0UzW+/kU39px1bWR/vacTTYOug6CGwTdo35BhUW4vDI1A6qUy3B2EDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641913964; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LT7y4F0rIJkzgfg3Wqk+kFvoECYDkYG0U0o/MY4F4aI=; b=RAW520mInSs9XjlwnHbCYkcOXvMVxTH4DI8/wwSqm3DYtoL6ARZXzUR/EVTRtt6BvylsLpwTC4F8GcMFo7lJnWDMRzRimQDpx7eGHzzFlR+a4w8H+bM/QJ9Bm17wKo1BcOePKYIPjsO2R3NgR/E2hk/5j2kcTmWNuCNG4j6o0nQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1641913964955491.0555046057008; Tue, 11 Jan 2022 07:12:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.255879.438812 (Exim 4.92) (envelope-from ) id 1n7Ip5-0004e9-Uu; Tue, 11 Jan 2022 15:12:31 +0000 Received: by outflank-mailman (output) from mailman id 255879.438812; Tue, 11 Jan 2022 15:12:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n7Ip5-0004Zj-1W; Tue, 11 Jan 2022 15:12:31 +0000 Received: by outflank-mailman (input) for mailman id 255879; Tue, 11 Jan 2022 15:12:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1n7Ip0-0002Fv-W8 for xen-devel@lists.xenproject.org; Tue, 11 Jan 2022 15:12:26 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id de7324e1-72f0-11ec-9ce5-af14b9085ebd; Tue, 11 Jan 2022 16:12:19 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 1802F1F3B9; Tue, 11 Jan 2022 15:12:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E27A913DDD; Tue, 11 Jan 2022 15:12:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MH/eNVKe3WG8AwAAMHmgww (envelope-from ); Tue, 11 Jan 2022 15:12:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: de7324e1-72f0-11ec-9ce5-af14b9085ebd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1641913939; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LT7y4F0rIJkzgfg3Wqk+kFvoECYDkYG0U0o/MY4F4aI=; b=J3Y9NA+QaK3CF8Btdh7yERlbdXYM4SHcMGD4DBHtgKs4C1sRKVE81UI0g2nNwB9bek+8ly Gx+PHio0I06zucoyCKZq/DjGp0OJMqhiLm1Ei/YJVqbBkKTwIFK8d7ACGJ6G5qp147LkSC 2znecvy9nwsbg1LkPq6Hmb1Ni3fLgtw= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH v2 11/12] mini-os: add struct file_ops for FTYPE_FILE Date: Tue, 11 Jan 2022 16:12:14 +0100 Message-Id: <20220111151215.22955-12-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220111151215.22955-1-jgross@suse.com> References: <20220111151215.22955-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1641913966888100001 Content-Type: text/plain; charset="utf-8" FTYPE_FILE is the last relevant file type without a struct file_ops. Add it. Signed-off-by: Juergen Gross Reviewed-by: Samuel Thibault --- lib/sys.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/sys.c b/lib/sys.c index 12deaed..0f42e97 100644 --- a/lib/sys.c +++ b/lib/sys.c @@ -99,6 +99,11 @@ static struct file_ops file_ops_none =3D { .name =3D "none", }; =20 +static struct file_ops file_file_ops =3D { + .name =3D "file", + .lseek =3D lseek_default, +}; + #ifdef HAVE_LWIP static int socket_read(int fd, void *buf, size_t nbytes) { @@ -160,6 +165,7 @@ static struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE]= =3D { #ifdef CONFIG_CONSFRONT [FTYPE_CONSOLE] =3D &console_ops, #endif + [FTYPE_FILE] =3D &file_file_ops, #ifdef HAVE_LWIP [FTYPE_SOCKET] =3D &socket_ops, #endif @@ -397,16 +403,9 @@ off_t lseek(int fd, off_t offset, int whence) if ( ops->lseek ) return ops->lseek(fd, offset, whence); =20 - switch(files[fd].type) { - case FTYPE_FILE: - break; - default: - /* Not implemented for this filetype */ - errno =3D ESPIPE; - return (off_t) -1; - } - - return lseek_default(fd, offset, whence); + /* Not implemented for this filetype */ + errno =3D ESPIPE; + return (off_t) -1; } =20 int fsync(int fd) { --=20 2.26.2