fstrim: patch

Tito farmatito at tiscali.it
Sun Nov 10 20:31:13 UTC 2013


On Sunday 10 November 2013 16:52:04 you wrote:
> Le 10/11/2013 14:56, Tito a écrit :
> > On Sunday 10 November 2013 12:57:41 souf wrote:
> >> Hi,
> >> Please apply this patch to fstrim applet
> >>
> >> Thanks.
> >>
> >>
> >
> > Hi,
> > this patch looks wrong to me:
> >
> > --- busybox/util-linux/fstrim.c.orig    2013-11-10 11:33:33.966789413 +0100

snip 

> >
> > Ciao,
> > Tito

> from man fstrim:
> 
> "The mountpoint argument is the pathname of the directory where the
> filesystem is mounted."
> 
> from fstrim (util-linux-2.24):
> 
> path = argv[optind++];
> 
> if (optind != argc) {
> 	warnx(_("unexpected number of arguments"));
> 	usage(stderr);
> }
> 
> if (stat(path, &sb) == -1)
> 	err(EXIT_FAILURE, _("stat failed %s"), path);
> if (!S_ISDIR(sb.st_mode))
> 	errx(EXIT_FAILURE, _("%s: not a directory"), path);
> 
> fd = open(path, O_RDONLY);
> if (fd < 0)
> 	err(EXIT_FAILURE, _("cannot open %s"), path);
> 
> if (ioctl(fd, FITRIM, &range))
> 	err(EXIT_FAILURE, _("%s: FITRIM ioctl failed"), path);
> 
> 

Hi,
yes you are right, should have done my research before hitting send.
Sorry for the noise.

Ciao,
Tito



More information about the busybox mailing list