Re: Anyway to mknod from kernel?

Alexander Viro (viro@math.psu.edu)
Tue, 26 Oct 1999 17:14:09 -0400 (EDT)


On Tue, 26 Oct 1999, Adam D. Bradley wrote:

> That's how I've done it in the past. It's pretty easy, requires a
> dirt-simple setup script to be run one time (instead of after every
> install of the module, which I gather is what you want to avoid), and the
> code is dirt simple: (snipped from something I was working back in late
> 2.1 days)

... and will break apart RSN. _Please_ don't use the knowledge of
proc_dir_entry guts - there are cleaner ways to achieve the same result.

> struct proc_dir_entry *node = malloc(sizeof(struct proc_dir_entry));
> *node = (struct proc_dir_entry) {
> 0, strlen("device"), "device",
> S_IFBLK | S_IWUSR | S_IRUGO |
> MKDEV(device_major, device_minor),
> 1, 0, 0, 0,
> &blkdev_inode_operations,
> NULL, NULL, NULL, NULL, NULL,
> NULL, NULL, NULL, NULL, 0, 0 };
> proc_register(parent_proc_directory, node);

_That_ simply will not work. lower bits of i_mode are not a place for
i_rdev.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/