Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cda37124 authored by Eric Biggers's avatar Eric Biggers Committed by Al Viro
Browse files

fs: constify tree_descr arrays passed to simple_fill_super()



simple_fill_super() is passed an array of tree_descr structures which
describe the files to create in the filesystem's root directory.  Since
these arrays are never modified intentionally, they should be 'const' so
that they are placed in .rodata and benefit from memory protection.
This patch updates the function signature and all users, and also
constifies tree_descr.name.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent a0c111b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -512,7 +512,7 @@ static int qibfs_fill_super(struct super_block *sb, void *data, int silent)
	unsigned long flags;
	int ret;

	static struct tree_descr files[] = {
	static const struct tree_descr files[] = {
		[2] = {"driver_stats", &driver_ops[0], S_IRUGO},
		[3] = {"driver_stats_names", &driver_ops[1], S_IRUGO},
		{""},
+2 −2
Original line number Diff line number Diff line
@@ -44,14 +44,14 @@ static const struct file_operations capabilities_file_ops = {

static int xenfs_fill_super(struct super_block *sb, void *data, int silent)
{
	static struct tree_descr xenfs_files[] = {
	static const struct tree_descr xenfs_files[] = {
		[2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
		{ "capabilities", &capabilities_file_ops, S_IRUGO },
		{ "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
		{""},
	};

	static struct tree_descr xenfs_init_files[] = {
	static const struct tree_descr xenfs_init_files[] = {
		[2] = { "xenbus", &xen_xenbus_fops, S_IRUSR|S_IWUSR },
		{ "capabilities", &capabilities_file_ops, S_IRUGO },
		{ "privcmd", &xen_privcmd_fops, S_IRUSR|S_IWUSR },
+1 −1
Original line number Diff line number Diff line
@@ -818,7 +818,7 @@ static const struct super_operations s_ops = {
static int bm_fill_super(struct super_block *sb, void *data, int silent)
{
	int err;
	static struct tree_descr bm_files[] = {
	static const struct tree_descr bm_files[] = {
		[2] = {"status", &bm_status_operations, S_IWUSR|S_IRUGO},
		[3] = {"register", &bm_register_operations, S_IWUSR},
		/* last one */ {""}
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ static const struct dentry_operations debugfs_dops = {

static int debug_fill_super(struct super_block *sb, void *data, int silent)
{
	static struct tree_descr debug_files[] = {{""}};
	static const struct tree_descr debug_files[] = {{""}};
	struct debugfs_fs_info *fsi;
	int err;

+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc)

static int fuse_ctl_fill_super(struct super_block *sb, void *data, int silent)
{
	struct tree_descr empty_descr = {""};
	static const struct tree_descr empty_descr = {""};
	struct fuse_conn *fc;
	int err;

Loading