From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fzzH7-000431-S7 for barebox@lists.infradead.org; Wed, 12 Sep 2018 07:09:23 +0000 From: Sascha Hauer Date: Wed, 12 Sep 2018 09:09:07 +0200 Message-Id: <20180912070908.24485-1-s.hauer@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 1/2] fs: devfs: Create device files as character devices To: Barebox List Without this files in /dev/ appear as regular files. copy_file() stumbles upon this as it tries a truncate() on that files which then fails. Create the files as character devices so that copy_file() works as expected. Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation") Signed-off-by: Sascha Hauer --- fs/devfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/devfs.c b/fs/devfs.c index 5d0bb2c674..84c619f1ed 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -226,7 +226,7 @@ static struct inode *devfs_get_inode(struct super_block *sb, const struct inode switch (mode & S_IFMT) { default: return NULL; - case S_IFREG: + case S_IFCHR: inode->i_op = &devfs_file_inode_operations; inode->i_fop = &devfs_file_operations; break; @@ -251,7 +251,7 @@ static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry, if (!cdev) return ERR_PTR(-ENOENT); - inode = devfs_get_inode(dir->i_sb, dir, S_IFREG | S_IRWXUGO); + inode = devfs_get_inode(dir->i_sb, dir, S_IFCHR | S_IRWXUGO); if (!inode) return ERR_PTR(-ENOMEM); -- 2.18.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox