From: Juergen Gross <jgross@suse.com>
To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org
Cc: samuel.thibault@ens-lyon.org, wl@xen.org,
Juergen Gross <jgross@suse.com>
Subject: [MINIOS PATCH v3 11/12] add struct file_ops for FTYPE_FILE
Date: Sun, 16 Jan 2022 09:33:27 +0100 [thread overview]
Message-ID: <20220116083328.26524-12-jgross@suse.com> (raw)
In-Reply-To: <20220116083328.26524-1-jgross@suse.com>
FTYPE_FILE is the last relevant file type without a struct file_ops.
Add it.
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
lib/sys.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/sys.c b/lib/sys.c
index 538d6e7b..7f3dc4e4 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -99,6 +99,11 @@ static const struct file_ops file_ops_none = {
.name = "none",
};
+static const struct file_ops file_file_ops = {
+ .name = "file",
+ .lseek = lseek_default,
+};
+
#ifdef HAVE_LWIP
static int socket_read(struct file *file, void *buf, size_t nbytes)
{
@@ -157,6 +162,7 @@ static const struct file_ops *file_ops[FTYPE_N + FTYPE_SPARE] = {
#ifdef CONFIG_CONSFRONT
[FTYPE_CONSOLE] = &console_ops,
#endif
+ [FTYPE_FILE] = &file_file_ops,
#ifdef HAVE_LWIP
[FTYPE_SOCKET] = &socket_ops,
#endif
@@ -415,16 +421,9 @@ off_t lseek(int fd, off_t offset, int whence)
if ( ops->lseek )
return ops->lseek(file, offset, whence);
- switch(file->type) {
- case FTYPE_FILE:
- break;
- default:
- /* Not implemented for this filetype */
- errno = ESPIPE;
- return (off_t) -1;
- }
-
- return lseek_default(file, offset, whence);
+ /* Not implemented for this filetype */
+ errno = ESPIPE;
+ return (off_t) -1;
}
int fsync(int fd) {
--
2.26.2
next prev parent reply other threads:[~2022-01-16 8:33 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-16 8:33 [MINIOS PATCH v3 00/12] remove device specific struct file members Juergen Gross
2022-01-16 8:33 ` [MINIOS PATCH v3 01/12] remove event channel specific struct file definitions Juergen Gross
2022-01-16 20:53 ` Samuel Thibault
2022-01-16 8:33 ` [MINIOS PATCH v3 02/12] remove gnttab specific member from struct file Juergen Gross
2022-01-16 8:33 ` [MINIOS PATCH v3 03/12] use alloc_file_type() and get_file_from_fd() in xs Juergen Gross
2022-01-16 20:54 ` Samuel Thibault
2022-01-18 14:29 ` Andrew Cooper
2022-01-18 14:53 ` Juergen Gross
2022-01-16 8:33 ` [MINIOS PATCH v3 04/12] use alloc_file_type() and get_file_from_fd() in tpm_tis Juergen Gross
2022-01-16 20:56 ` Samuel Thibault
2022-01-18 14:32 ` Andrew Cooper
2022-01-18 14:54 ` Juergen Gross
2022-01-16 8:33 ` [MINIOS PATCH v3 05/12] use alloc_file_type() and get_file_from_fd() in tpmfront Juergen Gross
2022-01-16 20:57 ` Samuel Thibault
2022-01-16 8:33 ` [MINIOS PATCH v3 06/12] use alloc_file_type() and get_file_from_fd() in blkfront Juergen Gross
2022-01-16 20:58 ` Samuel Thibault
2022-01-18 14:41 ` Andrew Cooper
2022-01-18 14:55 ` Juergen Gross
2022-01-16 8:33 ` [MINIOS PATCH v3 07/12] use alloc_file_type() and get_file_from_fd() in netfront Juergen Gross
2022-01-16 20:59 ` Samuel Thibault
2022-01-16 8:33 ` [MINIOS PATCH v3 08/12] use alloc_file_type() and get_file_from_fd() in fbfront Juergen Gross
2022-01-16 21:00 ` Samuel Thibault
2022-01-16 8:33 ` [MINIOS PATCH v3 09/12] use file_ops and get_file_from_fd() for console Juergen Gross
2022-01-16 21:01 ` Samuel Thibault
2022-01-16 8:33 ` [MINIOS PATCH v3 10/12] add struct file_ops for file type socket Juergen Gross
2022-01-16 21:02 ` Samuel Thibault
2022-01-16 8:33 ` Juergen Gross [this message]
2022-01-16 8:33 ` [MINIOS PATCH v3 12/12] make files array private to sys.c Juergen Gross
2022-01-16 21:03 ` [MINIOS PATCH v3 00/12] remove device specific struct file members Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220116083328.26524-12-jgross@suse.com \
--to=jgross@suse.com \
--cc=minios-devel@lists.xenproject.org \
--cc=samuel.thibault@ens-lyon.org \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.