Message ID | 20181001030413.5053-1-rosysong@rosinson.com |
---|---|
State | Rejected |
Delegated to: | John Crispin |
Headers | show |
Series | [OpenWrt-Devel,V2] fstools: mount ntfs with ntfs-3g utility if it exist | expand |
Hi, I updated my commit, please check it agagin, thanks a lot!
This patch can mount ntfs with fuseblk fs type and make the deivces to be
mounted writable.
Signed-off-by: Rosy Song <rosysong@rosinson.com>
---
block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 2651c86..b2cd32b 100644
--- a/block.c
+++ b/block.c
@@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target,
size_t mount_opts_len;
char *mount_opts = NULL, *ptr;
- err = mount(source, target, fstype, m ? m->flags : 0,
+ /* Mount ntfs filesystem with ntfs-3g utility */
+ if (!strcmp(fstype, "ntfs") &&
+ !access("/sbin/mount.ntfs-3g", X_OK)) {
+ err = -1;
+ errno = ENODEV;
+ } else
+ err = mount(source, target, fstype, m ? m->flags : 0,
(m && m->options) ? m->options : "");
/* Requested file system type is not available in kernel,
I’m not seeing where “mount.ntfs-3g” is being set as the program to use... and should the test for the presence and modes of the program be generic? i.e. regardless of what type of FS or which program you use to mount it, you’ll want to test for its presence. So these are really two independent things. > On Sep 30, 2018, at 9:04 PM, Rosy Song <rosysong@rosinson.com> wrote: > > Signed-off-by: Rosy Song <rosysong@rosinson.com> > --- > block.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/block.c b/block.c > index 2651c86..b2cd32b 100644 > --- a/block.c > +++ b/block.c > @@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target, > size_t mount_opts_len; > char *mount_opts = NULL, *ptr; > > - err = mount(source, target, fstype, m ? m->flags : 0, > + /* Mount ntfs filesystem with ntfs-3g utility */ > + if (!strcmp(fstype, "ntfs") && > + !access("/sbin/mount.ntfs-3g", X_OK)) { > + err = -1; > + errno = ENODEV; > + } else > + err = mount(source, target, fstype, m ? m->flags : 0, > (m && m->options) ? m->options : ""); > > /* Requested file system type is not available in kernel, > -- > 2.17.0 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
1. Users can decided whether to use ntfs-3g themselves, if so, just slect it at "make menuconfig->utility->filesystem->ntfs-3g-utils"; 2. This sentence "access("/sbin/mount.ntfs-3g", X_OK)" does the test for its presence or not; 3. There are 2 way to mount devices of ntfs filesystem, default is readonly while writable with fuseblk(ntfs-3g), so we need to do a special test here that avoid user remount it again and again when system boot. ------------------------------------------------------------------ From:Philip Prindeville <philipp_subx@redfish-solutions.com> Send Time:2018 Oct 1 (Mon) 12:21 To:Rosy Song <rosysong@rosinson.com> Cc:openwrt-devel <openwrt-devel@lists.openwrt.org> Subject:Re: [OpenWrt-Devel] [PATCH, V2] fstools: mount ntfs with ntfs-3g utility if it exist I’m not seeing where “mount.ntfs-3g” is being set as the program to use... and should the test for the presence and modes of the program be generic? i.e. regardless of what type of FS or which program you use to mount it, you’ll want to test for its presence. So these are really two independent things. > On Sep 30, 2018, at 9:04 PM, Rosy Song <rosysong@rosinson.com> wrote: > > Signed-off-by: Rosy Song <rosysong@rosinson.com> > --- > block.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/block.c b/block.c > index 2651c86..b2cd32b 100644 > --- a/block.c > +++ b/block.c > @@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target, > size_t mount_opts_len; > char *mount_opts = NULL, *ptr; > > - err = mount(source, target, fstype, m ? m->flags : 0, > + /* Mount ntfs filesystem with ntfs-3g utility */ > + if (!strcmp(fstype, "ntfs") && > + !access("/sbin/mount.ntfs-3g", X_OK)) { > + err = -1; > + errno = ENODEV; > + } else > + err = mount(source, target, fstype, m ? m->flags : 0, > (m && m->options) ? m->options : ""); > > /* Requested file system type is not available in kernel, > -- > 2.17.0 > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel <div class="__aliyun_email_body_block"><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"> 1. Users can decided whether to use ntfs-3g themselves, if so, just slect it at "make menuconfig->utility->filesystem->ntfs-3g-utils";</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"> 2. This sentence "<span style="color:#000000;font-family:Tahoma,Arial;font-size:14.0px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;text-align:start;text-indent:.0px;text-transform:none;widows:2;background-color:#ffffff;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline;">access("/sbin/mount.ntfs-3g", X_OK)</span>" does the test for its presence or not;</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"> 3. There are 2 way to mount devices of ntfs filesystem, default is readonly while writable with fuseblk(ntfs-3g), </span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"> so we need to do a special test here that avoid user remount it again and again when system boot.</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><blockquote style="margin-right:.0px;margin-top:.0px;margin-bottom:.0px;"><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:Philip Prindeville <philipp_subx@redfish-solutions.com></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2018 Oct 1 (Mon) 12:21</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:Rosy Song <rosysong@rosinson.com></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:openwrt-devel <openwrt-devel@lists.openwrt.org></span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [OpenWrt-Devel] [PATCH, V2] fstools: mount ntfs with ntfs-3g utility if it exist</span></div><div style="clear:both;"><span style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div>I’m not seeing where “mount.ntfs-3g” is being set as the program to use... and should the test for the presence and modes of the program be generic? i.e. regardless of what type of FS or which program you use to mount it, you’ll want to test for its presence.<br ><br >So these are really two independent things.<br ><br ><br >> On Sep 30, 2018, at 9:04 PM, Rosy Song <rosysong@rosinson.com> wrote:<br >> <br >> Signed-off-by: Rosy Song <rosysong@rosinson.com><br >> ---<br >> block.c | 8 +++++++-<br >> 1 file changed, 7 insertions(+), 1 deletion(-)<br >> <br >> diff --git a/block.c b/block.c<br >> index 2651c86..b2cd32b 100644<br >> --- a/block.c<br >> +++ b/block.c<br >> @@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target,<br >> size_t mount_opts_len;<br >> char *mount_opts = NULL, *ptr;<br >> <br >> - err = mount(source, target, fstype, m ? m->flags : 0,<br >> + /* Mount ntfs filesystem with ntfs-3g utility */<br >> + if (!strcmp(fstype, "ntfs") &&<br >> + !access("/sbin/mount.ntfs-3g", X_OK)) {<br >> + err = -1;<br >> + errno = ENODEV;<br >> + } else<br >> + err = mount(source, target, fstype, m ? m->flags : 0,<br >> (m && m->options) ? m->options : "");<br >> <br >> /* Requested file system type is not available in kernel,<br >> -- <br >> 2.17.0<br >> <br >> <br >> _______________________________________________<br >> openwrt-devel mailing list<br >> openwrt-devel@lists.openwrt.org<br >> https://lists.openwrt.org/mailman/listinfo/openwrt-devel</blockquote><div ><br ></div></div>
Le 01/10/2018 à 06:21, Philip Prindeville a écrit :
> I’m not seeing where “mount.ntfs-3g” is being set as the program to use...
I think this patch is just plain wrong.
A correct one has been done here :
http://lists.infradead.org/pipermail/openwrt-devel/2018-September/014108.html
++
> On Oct 1, 2018, at 10:22 AM, Jérôme Benoit <jbenoit100@gmail.com> wrote: > > Signed PGP part > Le 01/10/2018 à 06:21, Philip Prindeville a écrit : >> I’m not seeing where “mount.ntfs-3g” is being set as the program to use... > > I think this patch is just plain wrong. > A correct one has been done here : > http://lists.infradead.org/pipermail/openwrt-devel/2018-September/014108.html That one is buggy, too. @@ -725,6 +726,8 @@ static void check_filesystem(struct probe_info *pr) ckfs = e2fsck; } else if (!strncmp(pr->type, "btrfs", 5)) { ckfs = btrfsck; + } else if (!strncmp(pr->type, "ntfs", 5)) { + ckfs = ntfsck; } else { ULOG_ERR("check_filesystem: %s is not supported\n", pr->type); return; @@ -743,6 +746,9 @@ static void check_filesystem(struct probe_info *pr) } else if(!strncmp(pr->type, "btrfs", 5)) { execl(ckfs, ckfs, "--repair", pr->dev, NULL); exit(-1); + } else if(!strncmp(pr->type, "ntfs", 5)) { + execl(ckfs, ckfs, "-b", pr->dev, NULL); + exit(-1); } else { execl(ckfs, ckfs, "-p", pr->dev, NULL); exit(-1); @@ -1437,8 +1443,9 @@ static int mount_extroot(char *cfg) if (strncmp(pr->type, "ext", 3) && strncmp(pr->type, "f2fs", 4) && strncmp(pr->type, "btrfs", 5) && + strncmp(pr->type, "ntfs", 5) && strncmp(pr->type, "ubifs", 5)) { - ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs or ubifs\n", pr->type); + ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs, ntfs or ubifs\n", pr->type); return -1; } Uhhh… by my count, “ntfs” is 4 letters, not 5. > > ++ >
> On Oct 1, 2018, at 10:22 AM, Jérôme Benoit <jbenoit100@gmail.com> wrote: > > Signed PGP part > Le 01/10/2018 à 06:21, Philip Prindeville a écrit : >> I’m not seeing where “mount.ntfs-3g” is being set as the program to use... > > I think this patch is just plain wrong. > A correct one has been done here : > http://lists.infradead.org/pipermail/openwrt-devel/2018-September/014108.html That one is buggy, too. @@ -725,6 +726,8 @@ static void check_filesystem(struct probe_info *pr) ckfs = e2fsck; } else if (!strncmp(pr->type, "btrfs", 5)) { ckfs = btrfsck; + } else if (!strncmp(pr->type, "ntfs", 5)) { + ckfs = ntfsck; } else { ULOG_ERR("check_filesystem: %s is not supported\n", pr->type); return; @@ -743,6 +746,9 @@ static void check_filesystem(struct probe_info *pr) } else if(!strncmp(pr->type, "btrfs", 5)) { execl(ckfs, ckfs, "--repair", pr->dev, NULL); exit(-1); + } else if(!strncmp(pr->type, "ntfs", 5)) { + execl(ckfs, ckfs, "-b", pr->dev, NULL); + exit(-1); } else { execl(ckfs, ckfs, "-p", pr->dev, NULL); exit(-1); @@ -1437,8 +1443,9 @@ static int mount_extroot(char *cfg) if (strncmp(pr->type, "ext", 3) && strncmp(pr->type, "f2fs", 4) && strncmp(pr->type, "btrfs", 5) && + strncmp(pr->type, "ntfs", 5) && strncmp(pr->type, "ubifs", 5)) { - ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs or ubifs\n", pr->type); + ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs, ntfs or ubifs\n", pr->type); return -1; } Uhhh… by my count, “ntfs” is 4 letters, not 5. > > ++ >
Sorry, NO, I just care about how to mount the ntfs with writable accessibility not for its checking or fixing.
------------------------------------------------------------------
From:Jérôme Benoit <jbenoit100@gmail.com>
Send Time:2018 Oct 2 (Tue) 00:23
To:openwrt-devel <openwrt-devel@lists.openwrt.org>
Subject:Re: [OpenWrt-Devel] [PATCH, V2] fstools: mount ntfs with ntfs-3g utility if it exist
Le 01/10/2018 à 06:21, Philip Prindeville a écrit :
> I’m not seeing where “mount.ntfs-3g” is being set as the program to use...
I think this patch is just plain wrong.
A correct one has been done here :
http://lists.infradead.org/pipermail/openwrt-devel/2018-September/014108.html
++
... > @@ -1437,8 +1443,9 @@ static int mount_extroot(char *cfg) > if (strncmp(pr->type, "ext", 3) && > strncmp(pr->type, "f2fs", 4) && > strncmp(pr->type, "btrfs", 5) && > + strncmp(pr->type, "ntfs", 5) && > strncmp(pr->type, "ubifs", 5)) { > - ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs or ubifs\n", pr->type); > + ULOG_ERR("extroot: unsupported filesystem %s, try ext4, f2fs, btrfs, ntfs or ubifs\n", pr->type); > return -1; > } > > > Uhhh… by my count, “ntfs” is 4 letters, not 5. > It's easily fixable. And as long as the ntfs-3g package provide the right mount.X binary will just permit to fsck ntfs.
ntf-3g provide both mount.ntfs and mount.ntfs-3g Il giorno mar 2 ott 2018 alle ore 14:29 Jerome BENOIT <jbenoit100@gmail.com> ha scritto: > > > On 02/10/2018 14:24, Ansuel Smith wrote: > > ntfs-3g provide both mount.ntfs and mount.ntfs-3g > > Good, but you should reply also on the list :) > > -- > Jérôme Benoit aka fraggle > Piment Noir - https://piment-noir.org > OpenPGP Key ID : 27B535D3 > Key fingerprint : B799 BBF6 8EC8 911B B8D7 CDBC C3B1 92C6 27B5 35D3 >
diff --git a/block.c b/block.c index 2651c86..b2cd32b 100644 --- a/block.c +++ b/block.c @@ -881,7 +881,13 @@ static int handle_mount(const char *source, const char *target, size_t mount_opts_len; char *mount_opts = NULL, *ptr; - err = mount(source, target, fstype, m ? m->flags : 0, + /* Mount ntfs filesystem with ntfs-3g utility */ + if (!strcmp(fstype, "ntfs") && + !access("/sbin/mount.ntfs-3g", X_OK)) { + err = -1; + errno = ENODEV; + } else + err = mount(source, target, fstype, m ? m->flags : 0, (m && m->options) ? m->options : ""); /* Requested file system type is not available in kernel,
Signed-off-by: Rosy Song <rosysong@rosinson.com> --- block.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)