From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: virtio-fs@redhat.com, Miklos Szeredi <mszeredi@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [PATCH 4/8] virtiofsd: Add fuse_reply_attr_with_flags()
Date: Wed, 9 Sep 2020 20:40:24 +0200 [thread overview]
Message-ID: <20200909184028.262297-5-mreitz@redhat.com> (raw)
In-Reply-To: <20200909184028.262297-1-mreitz@redhat.com>
The plain fuse_reply_attr() function does not allow setting
fuse_attr.flags, so add this new function that does.
Make fuse_reply_attr() a wrapper around it.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tools/virtiofsd/fuse_lowlevel.h | 15 +++++++++++++++
tools/virtiofsd/fuse_lowlevel.c | 14 ++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/tools/virtiofsd/fuse_lowlevel.h b/tools/virtiofsd/fuse_lowlevel.h
index 9c06240f9e..1ff6ba1e4f 100644
--- a/tools/virtiofsd/fuse_lowlevel.h
+++ b/tools/virtiofsd/fuse_lowlevel.h
@@ -1313,6 +1313,21 @@ int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e,
int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
double attr_timeout);
+/**
+ * Reply with attributes and set fuse_attr.flags
+ *
+ * Possible requests:
+ * getattr, setattr
+ *
+ * @param req request handle
+ * @param attr the attributes
+ * @param attr_timeout validity timeout (in seconds) for the attributes
+ * @param attr_flags flags to put into fuse_attr.flags
+ * @return zero for success, -errno for failure to send reply
+ */
+int fuse_reply_attr_with_flags(fuse_req_t req, const struct stat *attr,
+ double attr_timeout, uint32_t attr_flags);
+
/**
* Reply with the contents of a symbolic link
*
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
index 3ca49456c3..70efd3feaf 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -426,8 +426,8 @@ int fuse_reply_create(fuse_req_t req, const struct fuse_entry_param *e,
return send_reply_ok(req, buf, entrysize + sizeof(struct fuse_open_out));
}
-int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
- double attr_timeout)
+int fuse_reply_attr_with_flags(fuse_req_t req, const struct stat *attr,
+ double attr_timeout, uint32_t attr_flags)
{
struct fuse_attr_out arg;
size_t size = sizeof(arg);
@@ -437,9 +437,19 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
arg.attr_valid_nsec = calc_timeout_nsec(attr_timeout);
convert_stat(attr, &arg.attr);
+ if (req->se->conn.capable & FUSE_CAP_ATTR_FLAGS) {
+ arg.attr.flags = attr_flags;
+ }
+
return send_reply_ok(req, &arg, size);
}
+int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
+ double attr_timeout)
+{
+ return fuse_reply_attr_with_flags(req, attr, attr_timeout, 0);
+}
+
int fuse_reply_readlink(fuse_req_t req, const char *linkname)
{
return send_reply_ok(req, linkname, strlen(linkname));
--
2.26.2
next prev parent reply other threads:[~2020-09-09 18:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 18:40 [PATCH 0/8] virtiofsd: Announce submounts to the guest Max Reitz
2020-09-09 18:40 ` [PATCH 1/8] linux/fuse.h: Pull in from Linux Max Reitz
2020-09-09 18:40 ` [PATCH 2/8] virtiofsd: Announce FUSE_ATTR_FLAGS Max Reitz
2020-09-09 18:40 ` [PATCH 3/8] virtiofsd: Add attr_flags to fuse_entry_param Max Reitz
2020-09-09 18:40 ` Max Reitz [this message]
2020-09-09 18:40 ` [PATCH 5/8] virtiofsd: Store every lo_inode's parent_dev Max Reitz
2020-09-09 18:40 ` [PATCH 6/8] virtiofsd: Announce sub-mount points Max Reitz
2020-09-09 18:40 ` [PATCH 7/8] tests/acceptance/boot_linux: Accept SSH pubkey Max Reitz
2020-09-10 5:23 ` Philippe Mathieu-Daudé
2020-09-11 21:28 ` Willian Rampazzo
2020-09-09 18:40 ` [PATCH 8/8] tests/acceptance: Add virtiofs_submounts.py Max Reitz
2020-09-11 10:22 ` [PATCH 0/8] virtiofsd: Announce submounts to the guest Stefan Hajnoczi
2020-10-26 17:54 ` Dr. David Alan Gilbert
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=20200909184028.262297-5-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=dgilbert@redhat.com \
--cc=mszeredi@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=virtio-fs@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).