blob: bafdf86b0497d81ec6278501b13eae2e58e0b078 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Kay Sievers2b2af542009-04-30 15:23:42 +02002/*
3 * devtmpfs - kernel-maintained tmpfs-based /dev
4 *
5 * Copyright (C) 2009, Kay Sievers <kay.sievers@vrfy.org>
6 *
7 * During bootup, before any driver core device is registered,
8 * devtmpfs, a tmpfs-based filesystem is created. Every driver-core
9 * device which requests a device node, will add a node in this
Kay Sieverse454cea2009-09-18 23:01:12 +020010 * filesystem.
Peter Korsgaard02fbe5e2012-04-17 12:13:18 +020011 * By default, all devices are named after the name of the device,
12 * owned by root and have a default mode of 0600. Subsystems can
13 * overwrite the default setting if needed.
Kay Sievers2b2af542009-04-30 15:23:42 +020014 */
15
16#include <linux/kernel.h>
17#include <linux/syscalls.h>
18#include <linux/mount.h>
19#include <linux/device.h>
20#include <linux/genhd.h>
21#include <linux/namei.h>
22#include <linux/fs.h>
23#include <linux/shmem_fs.h>
Peter Korsgaardda5e4ef2010-03-16 21:55:21 +010024#include <linux/ramfs.h>
Kay Sieverse454cea2009-09-18 23:01:12 +020025#include <linux/sched.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Al Viro2780f1f2011-06-27 16:25:29 -040027#include <linux/kthread.h>
David Howellse262e32d2018-11-01 23:07:23 +000028#include <uapi/linux/mount.h>
Greg Kroah-Hartmanc3a30422013-04-10 09:00:15 -070029#include "base.h"
Kay Sievers2b2af542009-04-30 15:23:42 +020030
Al Viro2780f1f2011-06-27 16:25:29 -040031static struct task_struct *thread;
Kay Sievers2b2af542009-04-30 15:23:42 +020032
33#if defined CONFIG_DEVTMPFS_MOUNT
Al Virofc14f2f2010-07-25 01:48:30 +040034static int mount_dev = 1;
Kay Sievers2b2af542009-04-30 15:23:42 +020035#else
Al Virofc14f2f2010-07-25 01:48:30 +040036static int mount_dev;
Kay Sievers2b2af542009-04-30 15:23:42 +020037#endif
38
Al Viro2780f1f2011-06-27 16:25:29 -040039static DEFINE_SPINLOCK(req_lock);
40
41static struct req {
42 struct req *next;
43 struct completion done;
44 int err;
45 const char *name;
Al Viro2c9ede52011-07-23 20:24:48 -040046 umode_t mode; /* 0 => delete */
Greg Kroah-Hartman4e4098a2013-04-11 11:43:29 -070047 kuid_t uid;
48 kgid_t gid;
Al Viro2780f1f2011-06-27 16:25:29 -040049 struct device *dev;
50} *requests;
Kay Sieversed413ae2009-10-28 19:51:06 +010051
Kay Sievers2b2af542009-04-30 15:23:42 +020052static int __init mount_param(char *str)
53{
Al Virofc14f2f2010-07-25 01:48:30 +040054 mount_dev = simple_strtoul(str, NULL, 0);
Kay Sievers2b2af542009-04-30 15:23:42 +020055 return 1;
56}
57__setup("devtmpfs.mount=", mount_param);
58
Al Virod4017272019-06-01 18:43:09 -040059static struct vfsmount *mnt;
60
61static struct dentry *public_dev_mount(struct file_system_type *fs_type, int flags,
62 const char *dev_name, void *data)
63{
64 struct super_block *s = mnt->mnt_sb;
65 atomic_inc(&s->s_active);
66 down_write(&s->s_umount);
67 return dget(s->s_root);
68}
69
Al Virofc14f2f2010-07-25 01:48:30 +040070static struct dentry *dev_mount(struct file_system_type *fs_type, int flags,
71 const char *dev_name, void *data)
Kay Sievers2b2af542009-04-30 15:23:42 +020072{
Peter Korsgaardda5e4ef2010-03-16 21:55:21 +010073#ifdef CONFIG_TMPFS
Al Virod4017272019-06-01 18:43:09 -040074 return mount_nodev(fs_type, flags, data, shmem_fill_super);
Peter Korsgaardda5e4ef2010-03-16 21:55:21 +010075#else
Al Virod4017272019-06-01 18:43:09 -040076 return ramfs_mount(fs_type, flags, dev_name, data);
Peter Korsgaardda5e4ef2010-03-16 21:55:21 +010077#endif
Kay Sievers2b2af542009-04-30 15:23:42 +020078}
79
Al Virod4017272019-06-01 18:43:09 -040080static struct file_system_type internal_fs_type = {
Kay Sievers2b2af542009-04-30 15:23:42 +020081 .name = "devtmpfs",
Al Virofc14f2f2010-07-25 01:48:30 +040082 .mount = dev_mount,
Kay Sievers2b2af542009-04-30 15:23:42 +020083 .kill_sb = kill_litter_super,
84};
85
Al Virod4017272019-06-01 18:43:09 -040086static struct file_system_type dev_fs_type = {
87 .name = "devtmpfs",
88 .mount = public_dev_mount,
89};
90
Kay Sievers2b2af542009-04-30 15:23:42 +020091#ifdef CONFIG_BLOCK
92static inline int is_blockdev(struct device *dev)
93{
94 return dev->class == &block_class;
95}
96#else
97static inline int is_blockdev(struct device *dev) { return 0; }
98#endif
99
Al Viro2780f1f2011-06-27 16:25:29 -0400100int devtmpfs_create_node(struct device *dev)
101{
102 const char *tmp = NULL;
103 struct req req;
104
105 if (!thread)
106 return 0;
107
108 req.mode = 0;
Greg Kroah-Hartman4e4098a2013-04-11 11:43:29 -0700109 req.uid = GLOBAL_ROOT_UID;
110 req.gid = GLOBAL_ROOT_GID;
Kay Sievers3c2670e2013-04-06 09:56:00 -0700111 req.name = device_get_devnode(dev, &req.mode, &req.uid, &req.gid, &tmp);
Al Viro2780f1f2011-06-27 16:25:29 -0400112 if (!req.name)
113 return -ENOMEM;
114
115 if (req.mode == 0)
116 req.mode = 0600;
117 if (is_blockdev(dev))
118 req.mode |= S_IFBLK;
119 else
120 req.mode |= S_IFCHR;
121
122 req.dev = dev;
123
124 init_completion(&req.done);
125
126 spin_lock(&req_lock);
127 req.next = requests;
128 requests = &req;
129 spin_unlock(&req_lock);
130
131 wake_up_process(thread);
132 wait_for_completion(&req.done);
133
134 kfree(tmp);
135
136 return req.err;
137}
138
139int devtmpfs_delete_node(struct device *dev)
140{
141 const char *tmp = NULL;
142 struct req req;
143
144 if (!thread)
145 return 0;
146
Kay Sievers3c2670e2013-04-06 09:56:00 -0700147 req.name = device_get_devnode(dev, NULL, NULL, NULL, &tmp);
Al Viro2780f1f2011-06-27 16:25:29 -0400148 if (!req.name)
149 return -ENOMEM;
150
151 req.mode = 0;
152 req.dev = dev;
153
154 init_completion(&req.done);
155
156 spin_lock(&req_lock);
157 req.next = requests;
158 requests = &req;
159 spin_unlock(&req_lock);
160
161 wake_up_process(thread);
162 wait_for_completion(&req.done);
163
164 kfree(tmp);
165 return req.err;
166}
167
Al Virofbd48a62011-07-24 10:47:56 -0400168static int dev_mkdir(const char *name, umode_t mode)
Kay Sievers2b2af542009-04-30 15:23:42 +0200169{
Kay Sievers2b2af542009-04-30 15:23:42 +0200170 struct dentry *dentry;
Al Viro69753a02011-06-27 16:35:45 -0400171 struct path path;
Kay Sievers2b2af542009-04-30 15:23:42 +0200172 int err;
173
Jeff Layton1ac12b42012-12-11 12:10:06 -0500174 dentry = kern_path_create(AT_FDCWD, name, &path, LOOKUP_DIRECTORY);
Al Viro69753a02011-06-27 16:35:45 -0400175 if (IS_ERR(dentry))
176 return PTR_ERR(dentry);
Kay Sievers2b2af542009-04-30 15:23:42 +0200177
David Howells75c3cfa2015-03-17 22:26:12 +0000178 err = vfs_mkdir(d_inode(path.dentry), dentry, mode);
Al Viro69753a02011-06-27 16:35:45 -0400179 if (!err)
180 /* mark as kernel-created inode */
David Howells75c3cfa2015-03-17 22:26:12 +0000181 d_inode(dentry)->i_private = &thread;
Al Viro921a1652012-07-20 01:15:31 +0400182 done_path_create(&path, dentry);
Kay Sievers2b2af542009-04-30 15:23:42 +0200183 return err;
184}
185
186static int create_path(const char *nodepath)
187{
Al Viro5da4e682011-06-27 16:37:12 -0400188 char *path;
189 char *s;
Al Viro9d108d22011-07-27 22:27:33 -0400190 int err = 0;
Kay Sievers2b2af542009-04-30 15:23:42 +0200191
Al Viro5da4e682011-06-27 16:37:12 -0400192 /* parent directories do not exist, create them */
193 path = kstrdup(nodepath, GFP_KERNEL);
194 if (!path)
195 return -ENOMEM;
Kay Sievers2b2af542009-04-30 15:23:42 +0200196
Al Viro5da4e682011-06-27 16:37:12 -0400197 s = path;
198 for (;;) {
199 s = strchr(s, '/');
200 if (!s)
201 break;
202 s[0] = '\0';
203 err = dev_mkdir(path, 0755);
204 if (err && err != -EEXIST)
205 break;
206 s[0] = '/';
207 s++;
Kay Sievers2b2af542009-04-30 15:23:42 +0200208 }
Al Viro5da4e682011-06-27 16:37:12 -0400209 kfree(path);
Kay Sievers2b2af542009-04-30 15:23:42 +0200210 return err;
211}
212
Greg Kroah-Hartman4e4098a2013-04-11 11:43:29 -0700213static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
214 kgid_t gid, struct device *dev)
Kay Sievers2b2af542009-04-30 15:23:42 +0200215{
Kay Sievers2b2af542009-04-30 15:23:42 +0200216 struct dentry *dentry;
Al Viro69753a02011-06-27 16:35:45 -0400217 struct path path;
Kay Sievers2b2af542009-04-30 15:23:42 +0200218 int err;
219
Al Viro69753a02011-06-27 16:35:45 -0400220 dentry = kern_path_create(AT_FDCWD, nodename, &path, 0);
221 if (dentry == ERR_PTR(-ENOENT)) {
Kay Sievers2b2af542009-04-30 15:23:42 +0200222 create_path(nodename);
Al Viro69753a02011-06-27 16:35:45 -0400223 dentry = kern_path_create(AT_FDCWD, nodename, &path, 0);
Kay Sievers2b2af542009-04-30 15:23:42 +0200224 }
Al Viro69753a02011-06-27 16:35:45 -0400225 if (IS_ERR(dentry))
226 return PTR_ERR(dentry);
Kay Sievers2b2af542009-04-30 15:23:42 +0200227
David Howells75c3cfa2015-03-17 22:26:12 +0000228 err = vfs_mknod(d_inode(path.dentry), dentry, mode, dev->devt);
Al Viro69753a02011-06-27 16:35:45 -0400229 if (!err) {
230 struct iattr newattrs;
Kay Sievers00926992009-10-28 19:50:57 +0100231
Al Viro69753a02011-06-27 16:35:45 -0400232 newattrs.ia_mode = mode;
Greg Kroah-Hartman4e4098a2013-04-11 11:43:29 -0700233 newattrs.ia_uid = uid;
234 newattrs.ia_gid = gid;
Kay Sievers3c2670e2013-04-06 09:56:00 -0700235 newattrs.ia_valid = ATTR_MODE|ATTR_UID|ATTR_GID;
Al Viro59551022016-01-22 15:40:57 -0500236 inode_lock(d_inode(dentry));
J. Bruce Fields27ac0ff2011-09-20 17:19:26 -0400237 notify_change(dentry, &newattrs, NULL);
Al Viro59551022016-01-22 15:40:57 -0500238 inode_unlock(d_inode(dentry));
Kay Sievers00926992009-10-28 19:50:57 +0100239
Al Viro69753a02011-06-27 16:35:45 -0400240 /* mark as kernel-created inode */
David Howells75c3cfa2015-03-17 22:26:12 +0000241 d_inode(dentry)->i_private = &thread;
Kay Sievers2b2af542009-04-30 15:23:42 +0200242 }
Al Viro921a1652012-07-20 01:15:31 +0400243 done_path_create(&path, dentry);
Kay Sievers2b2af542009-04-30 15:23:42 +0200244 return err;
245}
246
247static int dev_rmdir(const char *name)
248{
Al Viro79714f72012-06-15 03:01:42 +0400249 struct path parent;
Kay Sievers2b2af542009-04-30 15:23:42 +0200250 struct dentry *dentry;
251 int err;
252
Al Viro79714f72012-06-15 03:01:42 +0400253 dentry = kern_path_locked(name, &parent);
254 if (IS_ERR(dentry))
255 return PTR_ERR(dentry);
David Howells75c3cfa2015-03-17 22:26:12 +0000256 if (d_really_is_positive(dentry)) {
257 if (d_inode(dentry)->i_private == &thread)
258 err = vfs_rmdir(d_inode(parent.dentry), dentry);
Al Viro79714f72012-06-15 03:01:42 +0400259 else
260 err = -EPERM;
Kay Sievers2b2af542009-04-30 15:23:42 +0200261 } else {
Al Viro79714f72012-06-15 03:01:42 +0400262 err = -ENOENT;
Kay Sievers2b2af542009-04-30 15:23:42 +0200263 }
Al Viro79714f72012-06-15 03:01:42 +0400264 dput(dentry);
Al Viro59551022016-01-22 15:40:57 -0500265 inode_unlock(d_inode(parent.dentry));
Al Viro79714f72012-06-15 03:01:42 +0400266 path_put(&parent);
Kay Sievers2b2af542009-04-30 15:23:42 +0200267 return err;
268}
269
270static int delete_path(const char *nodepath)
271{
Rasmus Villemoesbe6b1df2018-08-22 13:00:07 +0200272 char *path;
Kay Sievers2b2af542009-04-30 15:23:42 +0200273 int err = 0;
274
275 path = kstrdup(nodepath, GFP_KERNEL);
276 if (!path)
277 return -ENOMEM;
278
Kay Sieversed413ae2009-10-28 19:51:06 +0100279 for (;;) {
Kay Sievers2b2af542009-04-30 15:23:42 +0200280 char *base;
281
282 base = strrchr(path, '/');
283 if (!base)
284 break;
285 base[0] = '\0';
286 err = dev_rmdir(path);
287 if (err)
288 break;
289 }
290
291 kfree(path);
292 return err;
293}
294
295static int dev_mynode(struct device *dev, struct inode *inode, struct kstat *stat)
296{
297 /* did we create it */
Al Viro2780f1f2011-06-27 16:25:29 -0400298 if (inode->i_private != &thread)
Kay Sievers2b2af542009-04-30 15:23:42 +0200299 return 0;
300
301 /* does the dev_t match */
302 if (is_blockdev(dev)) {
303 if (!S_ISBLK(stat->mode))
304 return 0;
305 } else {
306 if (!S_ISCHR(stat->mode))
307 return 0;
308 }
309 if (stat->rdev != dev->devt)
310 return 0;
311
312 /* ours */
313 return 1;
314}
315
Al Viro2780f1f2011-06-27 16:25:29 -0400316static int handle_remove(const char *nodename, struct device *dev)
Kay Sievers2b2af542009-04-30 15:23:42 +0200317{
Al Viro79714f72012-06-15 03:01:42 +0400318 struct path parent;
Kay Sievers2b2af542009-04-30 15:23:42 +0200319 struct dentry *dentry;
Axel Linfbde7c62013-11-16 16:15:23 +0800320 int deleted = 0;
Kay Sievers2b2af542009-04-30 15:23:42 +0200321 int err;
322
Al Viro79714f72012-06-15 03:01:42 +0400323 dentry = kern_path_locked(nodename, &parent);
324 if (IS_ERR(dentry))
325 return PTR_ERR(dentry);
Kay Sievers2b2af542009-04-30 15:23:42 +0200326
David Howells75c3cfa2015-03-17 22:26:12 +0000327 if (d_really_is_positive(dentry)) {
Al Viro79714f72012-06-15 03:01:42 +0400328 struct kstat stat;
Al Viro3dadecc2013-01-24 02:18:08 -0500329 struct path p = {.mnt = parent.mnt, .dentry = dentry};
David Howellsa528d352017-01-31 16:46:22 +0000330 err = vfs_getattr(&p, &stat, STATX_TYPE | STATX_MODE,
331 AT_STATX_SYNC_AS_STAT);
David Howells75c3cfa2015-03-17 22:26:12 +0000332 if (!err && dev_mynode(dev, d_inode(dentry), &stat)) {
Al Viro79714f72012-06-15 03:01:42 +0400333 struct iattr newattrs;
334 /*
335 * before unlinking this node, reset permissions
336 * of possible references like hardlinks
337 */
Eric W. Biederman91fa2cc2012-04-25 04:25:35 -0700338 newattrs.ia_uid = GLOBAL_ROOT_UID;
339 newattrs.ia_gid = GLOBAL_ROOT_GID;
Al Viro79714f72012-06-15 03:01:42 +0400340 newattrs.ia_mode = stat.mode & ~0777;
341 newattrs.ia_valid =
342 ATTR_UID|ATTR_GID|ATTR_MODE;
Al Viro59551022016-01-22 15:40:57 -0500343 inode_lock(d_inode(dentry));
J. Bruce Fields27ac0ff2011-09-20 17:19:26 -0400344 notify_change(dentry, &newattrs, NULL);
Al Viro59551022016-01-22 15:40:57 -0500345 inode_unlock(d_inode(dentry));
David Howells75c3cfa2015-03-17 22:26:12 +0000346 err = vfs_unlink(d_inode(parent.dentry), dentry, NULL);
Al Viro79714f72012-06-15 03:01:42 +0400347 if (!err || err == -ENOENT)
348 deleted = 1;
Kay Sievers2b2af542009-04-30 15:23:42 +0200349 }
Kay Sievers2b2af542009-04-30 15:23:42 +0200350 } else {
Al Viro79714f72012-06-15 03:01:42 +0400351 err = -ENOENT;
Kay Sievers2b2af542009-04-30 15:23:42 +0200352 }
Al Viro79714f72012-06-15 03:01:42 +0400353 dput(dentry);
Al Viro59551022016-01-22 15:40:57 -0500354 inode_unlock(d_inode(parent.dentry));
Kay Sievers2b2af542009-04-30 15:23:42 +0200355
Al Viro79714f72012-06-15 03:01:42 +0400356 path_put(&parent);
Kay Sievers2b2af542009-04-30 15:23:42 +0200357 if (deleted && strchr(nodename, '/'))
358 delete_path(nodename);
Kay Sievers2b2af542009-04-30 15:23:42 +0200359 return err;
360}
361
362/*
363 * If configured, or requested by the commandline, devtmpfs will be
364 * auto-mounted after the kernel mounted the root filesystem.
365 */
Kay Sievers073120c2009-10-28 19:51:17 +0100366int devtmpfs_mount(const char *mntdir)
Kay Sievers2b2af542009-04-30 15:23:42 +0200367{
Kay Sievers2b2af542009-04-30 15:23:42 +0200368 int err;
369
Al Virofc14f2f2010-07-25 01:48:30 +0400370 if (!mount_dev)
Kay Sievers2b2af542009-04-30 15:23:42 +0200371 return 0;
372
Al Viro2780f1f2011-06-27 16:25:29 -0400373 if (!thread)
Kay Sievers2b2af542009-04-30 15:23:42 +0200374 return 0;
375
Al Viro33488842019-05-31 20:09:15 -0400376 err = ksys_mount("devtmpfs", mntdir, "devtmpfs", MS_SILENT, NULL);
Kay Sievers2b2af542009-04-30 15:23:42 +0200377 if (err)
378 printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
379 else
380 printk(KERN_INFO "devtmpfs: mounted\n");
Kay Sievers2b2af542009-04-30 15:23:42 +0200381 return err;
382}
383
Arnaud Lacombef9e0b152011-07-21 13:16:19 -0400384static DECLARE_COMPLETION(setup_done);
Al Viro2780f1f2011-06-27 16:25:29 -0400385
Greg Kroah-Hartman4e4098a2013-04-11 11:43:29 -0700386static int handle(const char *name, umode_t mode, kuid_t uid, kgid_t gid,
Kay Sievers3c2670e2013-04-06 09:56:00 -0700387 struct device *dev)
Al Viro2780f1f2011-06-27 16:25:29 -0400388{
389 if (mode)
Kay Sievers3c2670e2013-04-06 09:56:00 -0700390 return handle_create(name, mode, uid, gid, dev);
Al Viro2780f1f2011-06-27 16:25:29 -0400391 else
392 return handle_remove(name, dev);
393}
394
395static int devtmpfsd(void *p)
396{
Al Viro2780f1f2011-06-27 16:25:29 -0400397 int *err = p;
Dominik Brodowski9b321052018-03-11 11:34:42 +0100398 *err = ksys_unshare(CLONE_NEWNS);
Al Viro2780f1f2011-06-27 16:25:29 -0400399 if (*err)
400 goto out;
Al Virod4017272019-06-01 18:43:09 -0400401 *err = ksys_mount("devtmpfs", "/", "devtmpfs", MS_SILENT, NULL);
Al Viro2780f1f2011-06-27 16:25:29 -0400402 if (*err)
403 goto out;
Dominik Brodowski447016e2018-03-11 11:34:46 +0100404 ksys_chdir("/.."); /* will traverse into overmounted root */
Dominik Brodowskia16fe332018-03-11 11:34:41 +0100405 ksys_chroot(".");
Al Viro2780f1f2011-06-27 16:25:29 -0400406 complete(&setup_done);
407 while (1) {
408 spin_lock(&req_lock);
409 while (requests) {
410 struct req *req = requests;
411 requests = NULL;
412 spin_unlock(&req_lock);
413 while (req) {
Al Viroe13889b2011-07-25 14:15:50 -0400414 struct req *next = req->next;
Kay Sievers3c2670e2013-04-06 09:56:00 -0700415 req->err = handle(req->name, req->mode,
416 req->uid, req->gid, req->dev);
Al Viro2780f1f2011-06-27 16:25:29 -0400417 complete(&req->done);
Al Viroe13889b2011-07-25 14:15:50 -0400418 req = next;
Al Viro2780f1f2011-06-27 16:25:29 -0400419 }
420 spin_lock(&req_lock);
421 }
Kautuk Consul65e67572011-11-15 14:52:34 -0800422 __set_current_state(TASK_INTERRUPTIBLE);
Al Viro2780f1f2011-06-27 16:25:29 -0400423 spin_unlock(&req_lock);
424 schedule();
Al Viro2780f1f2011-06-27 16:25:29 -0400425 }
426 return 0;
427out:
428 complete(&setup_done);
429 return *err;
430}
431
Kay Sievers2b2af542009-04-30 15:23:42 +0200432/*
433 * Create devtmpfs instance, driver-core devices will add their device
434 * nodes here.
435 */
436int __init devtmpfs_init(void)
437{
Al Virod4017272019-06-01 18:43:09 -0400438 char opts[] = "mode=0755";
439 int err;
440
441 mnt = vfs_kern_mount(&internal_fs_type, 0, "devtmpfs", opts);
442 if (IS_ERR(mnt)) {
443 printk(KERN_ERR "devtmpfs: unable to create devtmpfs %ld\n",
444 PTR_ERR(mnt));
445 return PTR_ERR(mnt);
446 }
447 err = register_filesystem(&dev_fs_type);
Kay Sievers2b2af542009-04-30 15:23:42 +0200448 if (err) {
449 printk(KERN_ERR "devtmpfs: unable to register devtmpfs "
450 "type %i\n", err);
451 return err;
452 }
453
Al Viro2780f1f2011-06-27 16:25:29 -0400454 thread = kthread_run(devtmpfsd, &err, "kdevtmpfs");
455 if (!IS_ERR(thread)) {
456 wait_for_completion(&setup_done);
457 } else {
458 err = PTR_ERR(thread);
459 thread = NULL;
460 }
461
462 if (err) {
Kay Sievers2b2af542009-04-30 15:23:42 +0200463 printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err);
464 unregister_filesystem(&dev_fs_type);
465 return err;
466 }
Kay Sievers2b2af542009-04-30 15:23:42 +0200467
468 printk(KERN_INFO "devtmpfs: initialized\n");
469 return 0;
470}