Lines Matching +full:next +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0
3 * devtmpfs - kernel-maintained tmpfs-based /dev
8 * devtmpfs, a tmpfs-based filesystem is created. Every driver-core
12 * owned by root and have a default mode of 0600. Subsystems can
47 struct req *next; member
51 umode_t mode; /* 0 => delete */ member
69 struct super_block *s = mnt->mnt_sb; in public_dev_mount()
72 atomic_inc(&s->s_active); in public_dev_mount()
73 down_write(&s->s_umount); in public_dev_mount()
79 return dget(s->s_root); in public_dev_mount()
99 init_completion(&req->done); in devtmpfs_submit_req()
102 req->next = requests; in devtmpfs_submit_req()
107 wait_for_completion(&req->done); in devtmpfs_submit_req()
111 return req->err; in devtmpfs_submit_req()
122 req.mode = 0; in devtmpfs_create_node()
125 req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp); in devtmpfs_create_node()
127 return -ENOMEM; in devtmpfs_create_node()
129 if (req.mode == 0) in devtmpfs_create_node()
130 req.mode = 0600; in devtmpfs_create_node()
132 req.mode |= S_IFBLK; in devtmpfs_create_node()
134 req.mode |= S_IFCHR; in devtmpfs_create_node()
151 return -ENOMEM; in devtmpfs_delete_node()
153 req.mode = 0; in devtmpfs_delete_node()
159 static int dev_mkdir(const char *name, umode_t mode) in dev_mkdir() argument
169 err = vfs_mkdir(&nop_mnt_idmap, d_inode(path.dentry), dentry, mode); in dev_mkdir()
171 /* mark as kernel-created inode */ in dev_mkdir()
172 d_inode(dentry)->i_private = &thread; in dev_mkdir()
186 return -ENOMEM; in create_path()
195 if (err && err != -EEXIST) in create_path()
204 static int handle_create(const char *nodename, umode_t mode, kuid_t uid, in handle_create() argument
212 if (dentry == ERR_PTR(-ENOENT)) { in handle_create()
219 err = vfs_mknod(&nop_mnt_idmap, d_inode(path.dentry), dentry, mode, in handle_create()
220 dev->devt); in handle_create()
224 newattrs.ia_mode = mode; in handle_create()
232 /* mark as kernel-created inode */ in handle_create()
233 d_inode(dentry)->i_private = &thread; in handle_create()
249 if (d_inode(dentry)->i_private == &thread) in dev_rmdir()
253 err = -EPERM; in dev_rmdir()
255 err = -ENOENT; in dev_rmdir()
270 return -ENOMEM; in delete_path()
291 if (inode->i_private != &thread) in dev_mynode()
296 if (!S_ISBLK(stat->mode)) in dev_mynode()
299 if (!S_ISCHR(stat->mode)) in dev_mynode()
302 if (stat->rdev != dev->devt) in dev_mynode()
333 newattrs.ia_mode = stat.mode & ~0777; in handle_remove()
341 if (!err || err == -ENOENT) in handle_remove()
345 err = -ENOENT; in handle_remove()
358 * auto-mounted after the kernel mounted the root filesystem.
380 static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid, in handle() argument
383 if (mode) in handle()
384 return handle_create(name, mode, uid, gid, dev); in handle()
398 struct req *next = req->next; in devtmpfs_work_loop() local
399 req->err = handle(req->name, req->mode, in devtmpfs_work_loop()
400 req->uid, req->gid, req->dev); in devtmpfs_work_loop()
401 complete(&req->done); in devtmpfs_work_loop()
402 req = next; in devtmpfs_work_loop()
446 * Create devtmpfs instance, driver-core devices will add their device
451 char opts[] = "mode=0755"; in devtmpfs_init()