From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B3E439871B for ; Wed, 7 Jan 2026 15:34:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800099; cv=none; b=DqyY2PEagLiNyOpWZg86Fd9onsGSJnTPtkpZNUrybI6t8Kc/DHieF1OaBjDp/LKMnItj5fs0VoX53EbnXBrm+3Ij7dDBU7++VljKCAqwfsHYbvtylCh7osp0oibN21MzzFZ1wL8t5+4ysGXuMelFkV8E0fedbOPNr+hxIm1ko3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767800099; c=relaxed/simple; bh=3CO44iNrPAkdfYLxe1mcSvtJfmua9dBTiPyw/Zw6zgo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vEmmLkVqJWgw0E4bWKJAl2yPaIv6RvlcajhuLg1jtyz1iCWMJkvetJElGVU/sfDcWTMcoEFtLaFFwx4EizLZyk2dvjel7thSmMG6PeZcvhViUUTrD2jBpbtXBoqFr9UqDHR1Oc6PTpIuiwlsktOMRodQIzxiOpy7E5eBpe2Bz6s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UlyzrF/X; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=Groves.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UlyzrF/X" Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-44fe903c1d6so620033b6e.0 for ; Wed, 07 Jan 2026 07:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767800097; x=1768404897; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=3n8Kb47Rl130Byxu0ad+8SvRWtkqSvh8ZeidUsu8Q2I=; b=UlyzrF/XmN05HA8PEjpbuqMKIxx6O8wSt2fCFJoABez6wlizZ79QjgpsYRx/PagwSv aFSZzo0XW7wjrLvKNUbPNWYGGdtU0/YPxOJbWREdy1/XecdFZNmiL85RnhW+HvdjT4uI WGo8FT0h1ziCxDr0ibrUqSNq9TnHnncITTFvgYI3O3d9nZhM9BB/0KvupT6d5TlNYykt 5auxcqE3iDkoH2Btc7JA9ecrgsh/VNTLoNfp3hFq1IQb70zhvXL2ixaTfkQr+/DMuhVj yl981S+hkIE3mf2MImnTIMl8GzQ0akcPzC+l5xu8jUWWIXH9OYGdiSLi8l8JOVvbY+cE P3Dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767800097; x=1768404897; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3n8Kb47Rl130Byxu0ad+8SvRWtkqSvh8ZeidUsu8Q2I=; b=xNvZ3HCaucmUOQctMRQZnB0KGutFNzF7i9z0TeT5VrtEUBhKfZ0CKadg/KcfNGAnjW CWyEgrcdGA8sbGl3dLlBCeZyW4ILvttwJFzyPSc41S7BNx0Qm0RJ2C4fOAtkvmPeH7zg l8BSGLlqLVGlog4024WcIYiHscXfw+J+ZPaxTTvUcpEgiufQTVaOg34IbkhRE21P1oh2 n1JzxsYFd0phYVmuN07ywVfgGB7Tn1ZWWX9E7wnr6A5znNP58PjOAFfZ5CfQ8cLXi3nD xJI4fCvqvNZsiuaDq8yGoNFmq2C5PbqE4O9WwQDtvutURpvSv4CHjHd/HyGsK6pTzgZk cThQ== X-Forwarded-Encrypted: i=1; AJvYcCUkNb1YokFdM6lKwA4HpZNuFZTLrTPpvIf8zddb68lZYWm538q4ivdMylzGy1FugbliIFhrElXjfEo=@vger.kernel.org X-Gm-Message-State: AOJu0YzdiRxJsolH+NaBtasW/sIMOh3B5WZ29yxYulxTsZa4nb685zo7 Hi4iBihYKs4GbXvBJ/UEJmXwaMmo+Y/f3WBm82XI1tR2WRoaMCvx381Z X-Gm-Gg: AY/fxX6oc5+RiAecgEgzAwHl5bhcI6mOXnuNJTMii3RONPh2vCKqXI51hnPSk0qOso8 ja3WDjfGxMSM9T3pT7N3GW25UOe2aExMuGFZZJ6kSfLAbnRMd9N4iDvcJ0hFQp7mkuKMjN1x7Zb V5VwOtxLSIpOkKcI3PQ9+g1ZMvEpC9FD14i1m3lkbX9+ZHvFMMG3uSWrz9AwbBuhpYmR8hk3ZTu Mo1YPQP8ptrci1nBHOFp/ASmAn6M3HOCnpNLyvc2BJAA0dm1d97sGElFOe1dZ4rcUttUZ4Mdx5F GjA8LACcflt/dS20+7HOs2wVC4MSPrS4+1ptVnC5P2hWcXdGlNXkBO0tiYqdhNwt/rtr+xCxJnB s6gBivqpWFxZZyeJ+QkasPgQyaG2TIaEsCWw2Ckw3iXa6aNUzLqiqBm/898HvF8WpFJ3kilTVDW TkE2o+0e1dOeDJavDVxCbxhWrFliCV8oLW8+G1vcyFnjJm X-Google-Smtp-Source: AGHT+IEkv++nP1XZgFGglQlyqUlGW3kCUi7rPnay9ZMhKErbt4qPcz86yrkR1ubRTqfHLlOPMJj8bg== X-Received: by 2002:a05:6808:16a8:b0:45a:55e6:f5d6 with SMTP id 5614622812f47-45a6bd87897mr1217540b6e.12.1767800096765; Wed, 07 Jan 2026 07:34:56 -0800 (PST) Received: from localhost.localdomain ([2603:8080:1500:3d89:a917:5124:7300:7cef]) by smtp.gmail.com with ESMTPSA id 5614622812f47-45a5e183ac3sm2398424b6e.4.2026.01.07.07.34.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 07 Jan 2026 07:34:56 -0800 (PST) Sender: John Groves From: John Groves X-Google-Original-From: John Groves To: John Groves , Miklos Szeredi , Dan Williams , Bernd Schubert , Alison Schofield Cc: John Groves , Jonathan Corbet , Vishal Verma , Dave Jiang , Matthew Wilcox , Jan Kara , Alexander Viro , David Hildenbrand , Christian Brauner , "Darrick J . Wong" , Randy Dunlap , Jeff Layton , Amir Goldstein , Jonathan Cameron , Stefan Hajnoczi , Joanne Koong , Josef Bacik , Bagas Sanjaya , Chen Linxuan , James Morse , Fuad Tabba , Sean Christopherson , Shivank Garg , Ackerley Tng , Gregory Price , Aravind Ramesh , Ajay Joshi , venkataravis@micron.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, John Groves Subject: [PATCH V3 3/4] fuse: add API to set kernel mount options Date: Wed, 7 Jan 2026 09:34:42 -0600 Message-ID: <20260107153443.64794-4-john@groves.net> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260107153443.64794-1-john@groves.net> References: <20260107153244.64703-1-john@groves.net> <20260107153443.64794-1-john@groves.net> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add fuse_add_kernel_mount_opt() to allow libfuse callers to pass additional mount options directly to the kernel. This enables filesystem-specific kernel mount options that aren't exposed through the standard libfuse mount option parsing. For example, famfs uses this to set the "shadow=" mount option for shadow file system mounts. API addition: int fuse_add_kernel_mount_opt(struct fuse_session *se, const char *mount_opt) Signed-off-by: John Groves --- include/fuse_lowlevel.h | 10 ++++++++++ lib/fuse_i.h | 1 + lib/fuse_lowlevel.c | 5 +++++ lib/fuse_versionscript | 1 + lib/mount.c | 8 ++++++++ 5 files changed, 25 insertions(+) diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 016f831..d2bbcca 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -2195,6 +2195,16 @@ static inline int fuse_session_custom_io(struct fuse_session *se, } #endif +/** + * Allow a libfuse caller to directly add kernel mount opts + * + * @param se session object + * @param mount_opt the option to add + * + * @return 0 on success, -1 on failure + */ +int fuse_add_kernel_mount_opt(struct fuse_session *se, const char *mount_opt); + /** * Mount a FUSE file system. * diff --git a/lib/fuse_i.h b/lib/fuse_i.h index 65d2f68..41285d2 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -220,6 +220,7 @@ void destroy_mount_opts(struct mount_opts *mo); void fuse_mount_version(void); unsigned get_max_read(struct mount_opts *o); void fuse_kern_unmount(const char *mountpoint, int fd); +int __fuse_add_kernel_mount_opt(struct fuse_session *se, const char *mount_opt); int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo); int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov, diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 0cde3d4..413e7c3 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -4349,6 +4349,11 @@ int fuse_session_custom_io_30(struct fuse_session *se, offsetof(struct fuse_custom_io, clone_fd), fd); } +int fuse_add_kernel_mount_opt(struct fuse_session *se, const char *mount_opt) +{ + return __fuse_add_kernel_mount_opt(se, mount_opt); +} + int fuse_session_mount(struct fuse_session *se, const char *_mountpoint) { int fd; diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript index f9562b6..536569a 100644 --- a/lib/fuse_versionscript +++ b/lib/fuse_versionscript @@ -220,6 +220,7 @@ FUSE_3.18 { fuse_reply_statx; fuse_fs_statx; + fuse_add_kernel_mount_opt; } FUSE_3.17; FUSE_3.19 { diff --git a/lib/mount.c b/lib/mount.c index 7a856c1..e6c2305 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -674,6 +674,14 @@ void destroy_mount_opts(struct mount_opts *mo) free(mo); } +int __fuse_add_kernel_mount_opt(struct fuse_session *se, const char *mount_opt) +{ + if (!se->mo) + return -1; + if (!mount_opt) + return -1; + return fuse_opt_add_opt(&se->mo->kernel_opts, mount_opt); +} int fuse_kern_mount(const char *mountpoint, struct mount_opts *mo) { -- 2.49.0