.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* inode.c: /proc/openprom handling routines |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 1996-1999 Jakub Jelinek (jakub@redhat.com) |
---|
.. | .. |
---|
8 | 9 | #include <linux/types.h> |
---|
9 | 10 | #include <linux/string.h> |
---|
10 | 11 | #include <linux/fs.h> |
---|
| 12 | +#include <linux/fs_context.h> |
---|
11 | 13 | #include <linux/init.h> |
---|
12 | 14 | #include <linux/slab.h> |
---|
13 | 15 | #include <linux/seq_file.h> |
---|
.. | .. |
---|
199 | 201 | |
---|
200 | 202 | child = dp->child; |
---|
201 | 203 | while (child) { |
---|
202 | | - int n = strlen(child->path_component_name); |
---|
| 204 | + const char *node_name = kbasename(child->full_name); |
---|
| 205 | + int n = strlen(node_name); |
---|
203 | 206 | |
---|
204 | 207 | if (len == n && |
---|
205 | | - !strncmp(child->path_component_name, name, len)) { |
---|
| 208 | + !strncmp(node_name, name, len)) { |
---|
206 | 209 | ent_type = op_inode_node; |
---|
207 | 210 | ent_data.node = child; |
---|
208 | 211 | ino = child->unique_id; |
---|
.. | .. |
---|
245 | 248 | set_nlink(inode, 2); |
---|
246 | 249 | break; |
---|
247 | 250 | case op_inode_prop: |
---|
248 | | - if (!strcmp(dp->name, "options") && (len == 17) && |
---|
| 251 | + if (of_node_name_eq(dp, "options") && (len == 17) && |
---|
249 | 252 | !strncmp (name, "security-password", 17)) |
---|
250 | 253 | inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; |
---|
251 | 254 | else |
---|
.. | .. |
---|
293 | 296 | } |
---|
294 | 297 | while (child) { |
---|
295 | 298 | if (!dir_emit(ctx, |
---|
296 | | - child->path_component_name, |
---|
297 | | - strlen(child->path_component_name), |
---|
| 299 | + kbasename(child->full_name), |
---|
| 300 | + strlen(kbasename(child->full_name)), |
---|
298 | 301 | child->unique_id, DT_DIR)) |
---|
299 | 302 | goto out; |
---|
300 | 303 | |
---|
.. | .. |
---|
335 | 338 | return &oi->vfs_inode; |
---|
336 | 339 | } |
---|
337 | 340 | |
---|
338 | | -static void openprom_i_callback(struct rcu_head *head) |
---|
| 341 | +static void openprom_free_inode(struct inode *inode) |
---|
339 | 342 | { |
---|
340 | | - struct inode *inode = container_of(head, struct inode, i_rcu); |
---|
341 | 343 | kmem_cache_free(op_inode_cachep, OP_I(inode)); |
---|
342 | | -} |
---|
343 | | - |
---|
344 | | -static void openprom_destroy_inode(struct inode *inode) |
---|
345 | | -{ |
---|
346 | | - call_rcu(&inode->i_rcu, openprom_i_callback); |
---|
347 | 344 | } |
---|
348 | 345 | |
---|
349 | 346 | static struct inode *openprom_iget(struct super_block *sb, ino_t ino) |
---|
.. | .. |
---|
374 | 371 | |
---|
375 | 372 | static const struct super_operations openprom_sops = { |
---|
376 | 373 | .alloc_inode = openprom_alloc_inode, |
---|
377 | | - .destroy_inode = openprom_destroy_inode, |
---|
| 374 | + .free_inode = openprom_free_inode, |
---|
378 | 375 | .statfs = simple_statfs, |
---|
379 | 376 | .remount_fs = openprom_remount, |
---|
380 | 377 | }; |
---|
381 | 378 | |
---|
382 | | -static int openprom_fill_super(struct super_block *s, void *data, int silent) |
---|
| 379 | +static int openprom_fill_super(struct super_block *s, struct fs_context *fc) |
---|
383 | 380 | { |
---|
384 | 381 | struct inode *root_inode; |
---|
385 | 382 | struct op_inode_info *oi; |
---|
.. | .. |
---|
413 | 410 | return ret; |
---|
414 | 411 | } |
---|
415 | 412 | |
---|
416 | | -static struct dentry *openprom_mount(struct file_system_type *fs_type, |
---|
417 | | - int flags, const char *dev_name, void *data) |
---|
| 413 | +static int openpromfs_get_tree(struct fs_context *fc) |
---|
418 | 414 | { |
---|
419 | | - return mount_single(fs_type, flags, data, openprom_fill_super); |
---|
| 415 | + return get_tree_single(fc, openprom_fill_super); |
---|
| 416 | +} |
---|
| 417 | + |
---|
| 418 | +static const struct fs_context_operations openpromfs_context_ops = { |
---|
| 419 | + .get_tree = openpromfs_get_tree, |
---|
| 420 | +}; |
---|
| 421 | + |
---|
| 422 | +static int openpromfs_init_fs_context(struct fs_context *fc) |
---|
| 423 | +{ |
---|
| 424 | + fc->ops = &openpromfs_context_ops; |
---|
| 425 | + return 0; |
---|
420 | 426 | } |
---|
421 | 427 | |
---|
422 | 428 | static struct file_system_type openprom_fs_type = { |
---|
423 | 429 | .owner = THIS_MODULE, |
---|
424 | 430 | .name = "openpromfs", |
---|
425 | | - .mount = openprom_mount, |
---|
| 431 | + .init_fs_context = openpromfs_init_fs_context, |
---|
426 | 432 | .kill_sb = kill_anon_super, |
---|
427 | 433 | }; |
---|
428 | 434 | MODULE_ALIAS_FS("openpromfs"); |
---|