Message ID | 20140501231242.31890.24539.stgit@birch.djwong.org |
---|---|
State | Accepted, archived |
Headers | show |
On Thu, 1 May 2014, Darrick J. Wong wrote: > Date: Thu, 01 May 2014 16:12:42 -0700 > From: Darrick J. Wong <darrick.wong@oracle.com> > To: tytso@mit.edu, darrick.wong@oracle.com > Cc: linux-ext4@vger.kernel.org > Subject: [PATCH 03/37] libext2fs: create sockets when populating filesystem > > Since the code to copy-in a socket when creating a filesystem is > fairly simple, just do it here. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > misc/create_inode.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > > diff --git a/misc/create_inode.c b/misc/create_inode.c > index 4bb5e5b..e7faab1 100644 > --- a/misc/create_inode.c > +++ b/misc/create_inode.c > @@ -114,6 +114,9 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name, > mode = LINUX_S_IFIFO; > filetype = EXT2_FT_FIFO; > break; > + case S_IFSOCK: > + mode = LINUX_S_IFSOCK; > + filetype = EXT2_FT_SOCK; You probably want to change the comment for the function as well. -Lukas > default: > abort(); > /* NOTREACHED */ > @@ -516,6 +519,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, > case S_IFCHR: > case S_IFBLK: > case S_IFIFO: > + case S_IFSOCK: > retval = do_mknod_internal(fs, parent_ino, name, &st); > if (retval) { > com_err(__func__, retval, > @@ -524,11 +528,6 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, > goto out; > } > break; > - case S_IFSOCK: > - /* FIXME: there is no make socket function atm. */ > - com_err(__func__, 0, > - _("ignoring socket file \"%s\""), name); > - continue; > case S_IFLNK: > read_cnt = readlink(name, ln_target, > sizeof(ln_target) - 1); > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Fri, May 02, 2014 at 01:22:16PM +0200, Lukáš Czerner wrote: > On Thu, 1 May 2014, Darrick J. Wong wrote: > > > Date: Thu, 01 May 2014 16:12:42 -0700 > > From: Darrick J. Wong <darrick.wong@oracle.com> > > To: tytso@mit.edu, darrick.wong@oracle.com > > Cc: linux-ext4@vger.kernel.org > > Subject: [PATCH 03/37] libext2fs: create sockets when populating filesystem > > > > Since the code to copy-in a socket when creating a filesystem is > > fairly simple, just do it here. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > > --- > > misc/create_inode.c | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > > > diff --git a/misc/create_inode.c b/misc/create_inode.c > > index 4bb5e5b..e7faab1 100644 > > --- a/misc/create_inode.c > > +++ b/misc/create_inode.c > > @@ -114,6 +114,9 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name, > > mode = LINUX_S_IFIFO; > > filetype = EXT2_FT_FIFO; > > break; > > + case S_IFSOCK: > > + mode = LINUX_S_IFSOCK; > > + filetype = EXT2_FT_SOCK; > > You probably want to change the comment for the function as well. I'll do that, thanks. I'll also teach the function to return retval instead of -1, since we're returning errcode_t anyway... though those changes are probably more for the cleanup patch. --D > > -Lukas > > > default: > > abort(); > > /* NOTREACHED */ > > @@ -516,6 +519,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, > > case S_IFCHR: > > case S_IFBLK: > > case S_IFIFO: > > + case S_IFSOCK: > > retval = do_mknod_internal(fs, parent_ino, name, &st); > > if (retval) { > > com_err(__func__, retval, > > @@ -524,11 +528,6 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, > > goto out; > > } > > break; > > - case S_IFSOCK: > > - /* FIXME: there is no make socket function atm. */ > > - com_err(__func__, 0, > > - _("ignoring socket file \"%s\""), name); > > - continue; > > case S_IFLNK: > > read_cnt = readlink(name, ln_target, > > sizeof(ln_target) - 1); > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks, applied. I've fixed up the issues which Lukáš pointed out, including replacing the -1 return with EROFS. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/misc/create_inode.c b/misc/create_inode.c index 4bb5e5b..e7faab1 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -114,6 +114,9 @@ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name, mode = LINUX_S_IFIFO; filetype = EXT2_FT_FIFO; break; + case S_IFSOCK: + mode = LINUX_S_IFSOCK; + filetype = EXT2_FT_SOCK; default: abort(); /* NOTREACHED */ @@ -516,6 +519,7 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, case S_IFCHR: case S_IFBLK: case S_IFIFO: + case S_IFSOCK: retval = do_mknod_internal(fs, parent_ino, name, &st); if (retval) { com_err(__func__, retval, @@ -524,11 +528,6 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino, goto out; } break; - case S_IFSOCK: - /* FIXME: there is no make socket function atm. */ - com_err(__func__, 0, - _("ignoring socket file \"%s\""), name); - continue; case S_IFLNK: read_cnt = readlink(name, ln_target, sizeof(ln_target) - 1);
Since the code to copy-in a socket when creating a filesystem is fairly simple, just do it here. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- misc/create_inode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html