diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-05-07 08:17:28 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-07 08:17:28 -0700 |
| commit | bd1f184d1f44fd6aadc8f5d84da348a885f872d1 (patch) | |
| tree | 72637b9094215c959bf5f4fd109c03d6b21d8803 /include/linux/devfs_fs_kernel.h | |
| parent | 2e493e2a0af3f3aa353644c641ad8b2663598153 (diff) | |
[PATCH] devfs: API changes
From: Christoph Hellwig <hch@lst.de>
Some people may already have noticed that I've been revamping the devfs API
recently. The worst offender still left is devfs_register, it's prototype
is:
devfs_handle_t devfs_register(devfs_handle_t dir,
const char *name, unsigned int flags,
unsigned int major, unsigned int minor,
umode_t mode, void *ops, void *info)
Of these:
- dir and flags are always zero
- the return value is never used
- info is only used in one driver which doesn't even need it for
operation
- umode_t always describes a character device
- name very often comes from a stack buffer we sprintf'ed into
so obviously we really want a much simpler API instead. My first draft for
this was:
int devfs_mk_cdev(dev_t dev, umode_t mode,
struct file_operations *fops, void *info,
const char *fmt, ...)
this removes the unused argumens, switches to a proper dev_t for the device
number and allows to directly use a printf-like expression as name, getting
rid of the temporary buffers.
Now Al has reappeared and put the first steps of his CIDR for charater device
on public ftp and we'll soon have a similar lookup object + fops mechanism in
generic code as we already habe for blockdevices, i.e. the devfs code to
assign fops from an entry will become superflous as generic code already does
it. That means the fops and info arguments are obsolete before they were
introduced, so I'd like to propose the following API instead:
int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...)
which is much nicer anyway. The educated reader will notice that this is
exactly the same prototype devfs_mk_bdev has so I'll probably get suggestions
to merge those two into some kind of devfs_mk_node soon. Personally I don't
like that as character and blockdevices are two really separate entinities
and I'll like to keep them as separate as possible.
Example patch that introduces the API and converts drivers/input attached.
Every driver which calls devfs_mk_cdev (about 50) needs conversion. Note
that the transition can happen in pieces - devfs_register continues to work
after this patch, it's just the plan to get rid of it in the end.
Diffstat (limited to 'include/linux/devfs_fs_kernel.h')
| -rw-r--r-- | include/linux/devfs_fs_kernel.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/devfs_fs_kernel.h b/include/linux/devfs_fs_kernel.h index 8ee76799308c..34ebe93c6194 100644 --- a/include/linux/devfs_fs_kernel.h +++ b/include/linux/devfs_fs_kernel.h @@ -27,6 +27,8 @@ extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, umode_t mode, void *ops, void *info); extern int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) __attribute__((format (printf, 3, 4))); +extern int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...) + __attribute__((format (printf, 3, 4))); extern int devfs_mk_symlink(const char *name, const char *link); extern int devfs_mk_dir(const char *fmt, ...) __attribute__((format (printf, 1, 2))); @@ -51,6 +53,10 @@ static inline int devfs_mk_bdev(dev_t dev, umode_t mode, const char *fmt, ...) { return 0; } +static inline int devfs_mk_cdev(dev_t dev, umode_t mode, const char *fmt, ...) +{ + return 0; +} static inline int devfs_mk_symlink (const char *name, const char *link) { return 0; |
