Commit 4b7ff05c authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] dev_t handling cleanups (4/12)

jffs used to put kdev_t values on disk - blind copy of in-core
representation.

Switched to explicit use of u16 (which is what kdev_t currently is),
with appropriate conversion
parent 24769621
...@@ -1080,9 +1080,11 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1080,9 +1080,11 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
struct jffs_control *c; struct jffs_control *c;
struct inode *inode; struct inode *inode;
int result = 0; int result = 0;
kdev_t dev = to_kdev_t(rdev); u16 data;
int err; int err;
data = (MAJOR(rdev) << 8) | MINOR(rdev);
D1(printk("***jffs_mknod()\n")); D1(printk("***jffs_mknod()\n"));
lock_kernel(); lock_kernel();
...@@ -1114,7 +1116,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1114,7 +1116,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
raw_inode.mtime = raw_inode.atime; raw_inode.mtime = raw_inode.atime;
raw_inode.ctime = raw_inode.atime; raw_inode.ctime = raw_inode.atime;
raw_inode.offset = 0; raw_inode.offset = 0;
raw_inode.dsize = sizeof(kdev_t); raw_inode.dsize = 2;
raw_inode.rsize = 0; raw_inode.rsize = 0;
raw_inode.nsize = dentry->d_name.len; raw_inode.nsize = dentry->d_name.len;
raw_inode.nlink = 1; raw_inode.nlink = 1;
...@@ -1124,7 +1126,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) ...@@ -1124,7 +1126,7 @@ jffs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
/* Write the new node to the flash. */ /* Write the new node to the flash. */
if ((err = jffs_write_node(c, node, &raw_inode, dentry->d_name.name, if ((err = jffs_write_node(c, node, &raw_inode, dentry->d_name.name,
(unsigned char *)&dev, 0, NULL)) < 0) { (unsigned char *)&data, 0, NULL)) < 0) {
D(printk("jffs_mknod(): jffs_write_node() failed.\n")); D(printk("jffs_mknod(): jffs_write_node() failed.\n"));
result = err; result = err;
goto jffs_mknod_err; goto jffs_mknod_err;
...@@ -1732,9 +1734,10 @@ jffs_read_inode(struct inode *inode) ...@@ -1732,9 +1734,10 @@ jffs_read_inode(struct inode *inode)
/* If the node is a device of some sort, then the number of /* If the node is a device of some sort, then the number of
the device should be read from the flash memory and then the device should be read from the flash memory and then
added to the inode's i_rdev member. */ added to the inode's i_rdev member. */
kdev_t rdev; u16 val;
jffs_read_data(f, (char *)&rdev, 0, sizeof(kdev_t)); jffs_read_data(f, (char *)val, 0, 2);
init_special_inode(inode, inode->i_mode, kdev_t_to_nr(rdev)); init_special_inode(inode, inode->i_mode,
MKDEV((val >> 8) & 255, val & 255));
} }
D3(printk (KERN_NOTICE "read_inode(): up biglock\n")); D3(printk (KERN_NOTICE "read_inode(): up biglock\n"));
......
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