From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 7B6151FF178 for ; Mon, 15 Dec 2025 07:58:37 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9F91D16E2; Mon, 15 Dec 2025 07:59:21 +0100 (CET) Mime-Version: 1.0 Date: Mon, 15 Dec 2025 14:59:12 +0800 Message-Id: From: "Kefu Chai" To: "Kefu Chai" , , "Wolfgang Bumiller" X-Mailer: aerc 0.20.0 References: <20251111143800.504322-1-k.chai@proxmox.com> <20251111143800.504322-2-k.chai@proxmox.com> In-Reply-To: <20251111143800.504322-2-k.chai@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1765781952458 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.009 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH proxmox-fuse-rs 1/1] add rename operation X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" + 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 > --- > 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