Hi, On 12/9/25 1:51 PM, Sascha Hauer wrote: > Implement the mknod hook in ramfs for creating device special files. > > Signed-off-by: Sascha Hauer <[email protected]>
Reviewed-by: Ahmad Fatoum <[email protected]> > --- > fs/ramfs.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/fs/ramfs.c b/fs/ramfs.c > index > 1caace0183a58e8a07001eb6ce9df8ea1895ac0b..d86bf6144e8485269c589ba0024377f9852a8eaa > 100644 > --- a/fs/ramfs.c > +++ b/fs/ramfs.c > @@ -89,6 +89,9 @@ static struct inode *ramfs_get_inode(struct super_block > *sb, const struct inode > case S_IFLNK: > inode->i_op = &ramfs_symlink_inode_operations; > break; > + case S_IFBLK: > + case S_IFCHR: > + break; > } > > return inode; > @@ -149,6 +152,20 @@ static int ramfs_create(struct inode *dir, struct dentry > *dentry, umode_t mode) > return ramfs_mknod(dir, dentry, mode | S_IFREG); > } > > +static int __ramfs_mknod(struct inode *dir,struct dentry *dentry, umode_t > mode, > + const char *cdevname) > +{ > + int ret; > + > + ret = ramfs_mknod(dir, dentry, mode); > + if (ret) > + return ret; > + > + init_special_inode(dentry->d_inode, mode, cdevname); > + > + return 0; > +} > + > static int ramfs_symlink(struct inode *dir, struct dentry *dentry, > const char *symname) > { > @@ -196,6 +213,7 @@ static const struct inode_operations > ramfs_dir_inode_operations = > .unlink = simple_unlink, > .create = ramfs_create, > .tmpfile = ramfs_tmpfile, > + .mknod = __ramfs_mknod, > }; > > static struct ramfs_chunk *ramfs_find_chunk(struct ramfs_inode *node, > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
