public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Kefu Chai" <k.chai@proxmox.com>
To: "Kefu Chai" <k.chai@proxmox.com>, <pve-devel@lists.proxmox.com>,
	"Wolfgang Bumiller" <w.bumiller@proxmox.com>
Subject: Re: [pve-devel] [PATCH proxmox-fuse-rs 1/1] add rename operation
Date: Mon, 15 Dec 2025 14:59:12 +0800	[thread overview]
Message-ID: <DEYLGMHQVQVN.1YYXL41D8UC2Z@proxmox.com> (raw)
In-Reply-To: <20251111143800.504322-2-k.chai@proxmox.com>

+ Wolfgang

ping?

On Tue Nov 11, 2025 at 10:38 PM CST, Kefu Chai wrote:
> rename operation is required when implementing the rust rewrite of
> pmxcfs, which delegates the rename operations to the underlying
> plugin which exposes the renamed file.
>
> Signed-off-by: Kefu Chai <k.chai@proxmox.com>
> ---
>  src/requests.rs | 25 +++++++++++++++++++++++++
>  src/session.rs  | 32 ++++++++++++++++++++++++++++++++
>  2 files changed, 57 insertions(+)
>
> diff --git a/src/requests.rs b/src/requests.rs
> index 9bdab30..6799496 100644
> --- a/src/requests.rs
> +++ b/src/requests.rs
> @@ -118,6 +118,7 @@ pub enum Request {
>      Rmdir(Rmdir),
>      Write(Write),
>      Readlink(Readlink),
> +    Rename(Rename),
>      ListXAttrSize(ListXAttrSize),
>      ListXAttr(ListXAttr),
>      GetXAttrSize(GetXAttrSize),
> @@ -155,6 +156,7 @@ impl FuseRequest for Request {
>              Request::Rmdir(r) => r.fail(errno),
>              Request::Write(r) => r.fail(errno),
>              Request::Readlink(r) => r.fail(errno),
> +            Request::Rename(r) => r.fail(errno),
>              Request::ListXAttrSize(r) => r.fail(errno),
>              Request::ListXAttr(r) => r.fail(errno),
>              Request::GetXAttrSize(r) => r.fail(errno),
> @@ -681,6 +683,29 @@ impl Rmdir {
>      }
>  }
>  
> +/// Rename a file or directory.
> +#[derive(Debug)]
> +pub struct Rename {
> +    pub(crate) request: RequestGuard,
> +    pub parent: u64,
> +    pub name: OsString,
> +    pub new_parent: u64,
> +    pub new_name: OsString,
> +    pub flags: libc::c_int,
> +}
> +
> +impl FuseRequest for Rename {
> +    fn fail(self, errno: libc::c_int) -> io::Result<()> {
> +        reply_err(self.request, errno)
> +    }
> +}
> +
> +impl Rename {
> +    pub fn reply(self) -> io::Result<()> {
> +        reply_err(self.request, 0)
> +    }
> +}
> +
>  /// Write to a file.
>  #[derive(Debug)]
>  pub struct Write {
> diff --git a/src/session.rs b/src/session.rs
> index 427ce46..a38593e 100644
> --- a/src/session.rs
> +++ b/src/session.rs
> @@ -328,6 +328,32 @@ impl FuseData {
>              }));
>      }
>  
> +    extern "C" fn rename(
> +        request: sys::Request,
> +        parent: u64,
> +        name: sys::StrPtr,
> +        new_parent: u64,
> +        new_name: sys::StrPtr,
> +        flags: libc::c_int,
> +    ) {
> +        let fuse_data = unsafe { &*(sys::fuse_req_userdata(request) as *mut FuseData) };
> +        let name = unsafe { CStr::from_ptr(name) };
> +        let name = OsStr::from_bytes(name.to_bytes()).to_owned();
> +        let new_name = unsafe { CStr::from_ptr(new_name) };
> +        let new_name = OsStr::from_bytes(new_name.to_bytes()).to_owned();
> +        fuse_data
> +            .pending_requests
> +            .borrow_mut()
> +            .push_back(Request::Rename(requests::Rename {
> +                request: RequestGuard::from_raw(request),
> +                parent,
> +                name,
> +                new_parent,
> +                new_name,
> +                flags,
> +            }));
> +    }
> +
>      extern "C" fn write(
>          request: sys::Request,
>          inode: u64,
> @@ -533,6 +559,12 @@ impl FuseSessionBuilder {
>          self
>      }
>  
> +    /// Enable `Rename` requests.
> +    pub fn enable_rename(mut self) -> Self {
> +        self.operations.rename = Some(FuseData::rename);
> +        self
> +    }
> +
>      /// Enable `Read` requests.
>      pub fn enable_read(mut self) -> Self {
>          self.operations.read = Some(FuseData::read);



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-12-15  6:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 14:37 [pve-devel] [PATCH proxmox-fuse-rs 0/1] Add rename operation support Kefu Chai
2025-11-11 14:38 ` [pve-devel] [PATCH proxmox-fuse-rs 1/1] add rename operation Kefu Chai
2025-12-15  6:59   ` Kefu Chai [this message]
2025-12-22 11:35 ` [pve-devel] applied: [PATCH proxmox-fuse-rs 0/1] Add rename operation support Wolfgang Bumiller
2025-12-23 12:47   ` Kefu Chai
  -- strict thread matches above, loose matches on Subject: below --
2025-11-11 13:53 [pve-devel] " Kefu Chai
2025-11-11 13:53 ` [pve-devel] [PATCH proxmox-fuse-rs 1/1] add rename operation Kefu Chai

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=DEYLGMHQVQVN.1YYXL41D8UC2Z@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@proxmox.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal