Commit a56d3133 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull configfs updates from Andreas Hindborg:

 - Allow creation of rw files with custom permissions. This allows
   drivers to better protect secrets written through configfs

 - Fix a bug where an error condition did not cause an early return
   while populating attributes

 - Report ENOMEM rather than EFAULT when kvasprintf() fails in
   config_item_set_name()

 - Add a Rust API for configfs. This allows Rust drivers to use configfs
   through a memory safe interface

* tag 'configfs-for-v6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux:
  MAINTAINERS: add configfs Rust abstractions
  rust: configfs: add a sample demonstrating configfs usage
  rust: configfs: introduce rust support for configfs
  configfs: Correct error value returned by API config_item_set_name()
  configfs: Do not override creating attribute file failure in populate_attrs()
  configfs: Delete semicolon from macro type_print() definition
  configfs: Add CONFIGFS_ATTR_PERM helper
parents 5e82ed5c c6b19082
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5983,7 +5983,9 @@ S: Supported
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/a.hindborg/linux.git configfs-next
F:	fs/configfs/
F:	include/linux/configfs.h
F:	rust/kernel/configfs.rs
F:	samples/configfs/
F:	samples/rust/rust_configfs.rs
CONGATEC BOARD CONTROLLER MFD DRIVER
M:	Thomas Richard <thomas.richard@bootlin.com>
+2 −2
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ static int populate_attrs(struct config_item *item)
				break;
		}
	}
	if (t->ct_bin_attrs) {
	if (!error && t->ct_bin_attrs) {
		for (i = 0; (bin_attr = t->ct_bin_attrs[i]) != NULL; i++) {
			if (ops && ops->is_bin_visible && !ops->is_bin_visible(item, bin_attr, i))
				continue;
@@ -970,7 +970,7 @@ static void configfs_dump_one(struct configfs_dirent *sd, int level)
{
	pr_info("%*s\"%s\":\n", level, " ", configfs_get_name(sd));

#define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type);
#define type_print(_type) if (sd->s_type & _type) pr_info("%*s %s\n", level, " ", #_type)
	type_print(CONFIGFS_ROOT);
	type_print(CONFIGFS_DIR);
	type_print(CONFIGFS_ITEM_ATTR);
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ int config_item_set_name(struct config_item *item, const char *fmt, ...)
		name = kvasprintf(GFP_KERNEL, fmt, args);
		va_end(args);
		if (!name)
			return -EFAULT;
			return -ENOMEM;
	}

	/* Free the old name, if necessary. */
+6 −2
Original line number Diff line number Diff line
@@ -120,15 +120,19 @@ struct configfs_attribute {
	ssize_t (*store)(struct config_item *, const char *, size_t);
};

#define CONFIGFS_ATTR(_pfx, _name)			\
#define CONFIGFS_ATTR_PERM(_pfx, _name, _perm)		\
static struct configfs_attribute _pfx##attr_##_name = {	\
	.ca_name	= __stringify(_name),		\
	.ca_mode	= S_IRUGO | S_IWUSR,		\
	.ca_mode	= _perm,			\
	.ca_owner	= THIS_MODULE,			\
	.show		= _pfx##_name##_show,		\
	.store		= _pfx##_name##_store,		\
}

#define CONFIGFS_ATTR(_pfx, _name) CONFIGFS_ATTR_PERM(	\
		_pfx, _name, S_IRUGO | S_IWUSR		\
)

#define CONFIGFS_ATTR_RO(_pfx, _name)			\
static struct configfs_attribute _pfx##attr_##_name = {	\
	.ca_name	= __stringify(_name),		\
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include <linux/blk-mq.h>
#include <linux/blk_types.h>
#include <linux/blkdev.h>
#include <linux/configfs.h>
#include <linux/cpumask.h>
#include <linux/cred.h>
#include <linux/device/faux.h>
Loading