Commit 188858aa authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] fix devfs_mk_dir prototype

Return an error code instead of a devfs_handle_t.  The handle isn't
useful for anything and the !CONFIG_DEVFS_FS stub in fact returned
NULL which made it entirely useless.  Thus only one driver is actually
checking the retval in the current tree..
parent 4d009152
...@@ -2055,13 +2055,9 @@ dasd_init(void) ...@@ -2055,13 +2055,9 @@ dasd_init(void)
DBF_EVENT(DBF_EMERG, "%s", "debug area created"); DBF_EVENT(DBF_EMERG, "%s", "debug area created");
#ifdef CONFIG_DEVFS_FS rc = devfs_mk_dir("dasd");
if (!devfs_mk_dir("dasd")) { if (rc)
DBF_EVENT(DBF_ALERT, "%s", "no devfs");
rc = -ENOSYS;
goto failed; goto failed;
}
#endif
rc = dasd_devmap_init(); rc = dasd_devmap_init();
if (rc) if (rc)
goto failed; goto failed;
......
...@@ -1708,41 +1708,39 @@ int devfs_mk_symlink(const char *from, const char *to) ...@@ -1708,41 +1708,39 @@ int devfs_mk_symlink(const char *from, const char *to)
* On failure %NULL is returned. * On failure %NULL is returned.
*/ */
devfs_handle_t devfs_mk_dir(const char *fmt, ...) int devfs_mk_dir(const char *fmt, ...)
{ {
struct devfs_entry *dir = NULL, *de = NULL, *old; struct devfs_entry *dir = NULL, *de = NULL, *old;
char buf[64]; char buf[64];
va_list args; va_list args;
int n; int error, n;
va_start(args, fmt); va_start(args, fmt);
n = vsnprintf(buf, 64, fmt, args); n = vsnprintf(buf, 64, fmt, args);
if (n >= 64 || !buf[0]) { if (n >= 64 || !buf[0]) {
printk(KERN_WARNING "%s: invalid argument.", __FUNCTION__); printk(KERN_WARNING "%s: invalid argument.", __FUNCTION__);
return NULL; return -EINVAL;
} }
de = _devfs_prepare_leaf(&dir, buf, MODE_DIR); de = _devfs_prepare_leaf(&dir, buf, MODE_DIR);
if (!de) { if (!de) {
PRINTK("(%s): could not prepare leaf\n", buf); PRINTK("(%s): could not prepare leaf\n", buf);
return NULL; return -EINVAL;
} }
de->info = NULL; error = _devfs_append_entry(dir, de, &old);
if (_devfs_append_entry(dir, de, &old)) { if (error) {
PRINTK("(%s): could not append to dir: %p \"%s\"\n", PRINTK("(%s): could not append to dir: %p \"%s\"\n",
buf, dir, dir->name); buf, dir, dir->name);
devfs_put(old); devfs_put(old);
goto out_put; goto out_put;
} }
DPRINTK(DEBUG_REGISTER, "(%s): de: %p dir: %p \"%s\"\n",
buf, de, dir, dir->name);
devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED); devfsd_notify(de, DEVFSD_NOTIFY_REGISTERED);
out_put: out_put:
devfs_put(dir); devfs_put(dir);
return de; return error;
} }
......
...@@ -27,8 +27,8 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, ...@@ -27,8 +27,8 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name,
umode_t mode, void *ops, void *info); umode_t mode, void *ops, void *info);
extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...)
__attribute__((format (printf, 3, 4))); __attribute__((format (printf, 3, 4)));
extern int devfs_mk_symlink (const char *name, const char *link); extern int devfs_mk_symlink(const char *name, const char *link);
extern devfs_handle_t devfs_mk_dir(const char *fmt, ...) extern int devfs_mk_dir(const char *fmt, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));
extern void devfs_remove(const char *fmt, ...) extern void devfs_remove(const char *fmt, ...)
__attribute__((format (printf, 1, 2))); __attribute__((format (printf, 1, 2)));
...@@ -55,9 +55,9 @@ static inline int devfs_mk_symlink (const char *name, const char *link) ...@@ -55,9 +55,9 @@ static inline int devfs_mk_symlink (const char *name, const char *link)
{ {
return 0; return 0;
} }
static inline devfs_handle_t devfs_mk_dir(const char *fmt, ...) static inline int devfs_mk_dir(const char *fmt, ...)
{ {
return NULL; return 0;
} }
static inline void devfs_remove(const char *fmt, ...) static inline void devfs_remove(const char *fmt, ...)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment