Re: svn commit: r289203 - head/usr.sbin/makefs

2015-10-21 Thread NGie Cooper

> On Oct 12, 2015, at 19:32, Adrian Chadd  wrote:
> 
> Author: adrian
> Date: Tue Oct 13 02:32:15 2015
> New Revision: 289203
> URL: https://svnweb.freebsd.org/changeset/base/289203
> 
> Log:
>  makefs: introduce a new option to specify what to round the resulting
>  image up to.
> 
>  From ticket:
> 
>  While trying to run FreeBSD/mips on some device having very small flash 
> media,
>  one is forced to compress file system with mkulzma(8) utility. It is 
> desirable
>  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
>  and big compression block size like 65535 bytes to mkulzma at the same time.
>  Then one obtains very good comression ratios (like 75% and more) but faces
>  the following problem.
> 
>  geom_uncompress kernel module reports GEOM provider size rounded up to its
>  compression block size. Generally, this changes original media size and now
>  it fails to match the size of embedded UFS file system that leads to other
>  problems, f.e. geom_label kernel module does not like this and skips the
>  file system while tasting the GEOM and looking for UFS label.
> 
>  This makes it impossible to refer to the file system using known UFS label
>  instead of something like /dev/map/rootfs.uncompress.
> 
>  The following patch introduces new command line option "-r roundup" for 
> makefs
>  that makes it round up the image to specified block size. Hence, 
> geom_uncompress
>  does not change GEOM media size for images rounded that way and geom_label
>  accepts such GEOMs just fine.
> 
>  With the patch applied, one can use following commands:
> 
>  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash 
> optimization=space fs.img fs
>  $ mkulzma -s 65536 -o fs.img.ulzma fs.img
> 
>  PR:  bin/203707
>  Submitted by:

1. roundup doesn’t seem like a user-friendly name.
2. “roundup” isn’t documented under the FFS-specific options.

I’m going to send out a CR soon updating the documentation and changing -r to 
-R.

Thanks,
-NGie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r289203 - head/usr.sbin/makefs

2015-10-20 Thread Ed Maste
On 12 October 2015 at 22:32, Adrian Chadd  wrote:
> Author: adrian
> Date: Tue Oct 13 02:32:15 2015
> New Revision: 289203
> URL: https://svnweb.freebsd.org/changeset/base/289203
>
> Log:
>   makefs: introduce a new option to specify what to round the resulting
>   image up to.
>...
> +.Op Fl r Ar roundup

Note that NetBSD's makefs already has -r assigned
-r When merging multiple directories replace duplicate files with the
last found.

We should pick a different option, and push this patch there too.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r289203 - head/usr.sbin/makefs

2015-10-20 Thread Adrian Chadd
please absolutely do reassign the option to something that doesn't clash ASAP.



-adrian


On 20 October 2015 at 12:12, Ed Maste  wrote:
> On 12 October 2015 at 22:32, Adrian Chadd  wrote:
>> Author: adrian
>> Date: Tue Oct 13 02:32:15 2015
>> New Revision: 289203
>> URL: https://svnweb.freebsd.org/changeset/base/289203
>>
>> Log:
>>   makefs: introduce a new option to specify what to round the resulting
>>   image up to.
>>...
>> +.Op Fl r Ar roundup
>
> Note that NetBSD's makefs already has -r assigned
> -r When merging multiple directories replace duplicate files with the
> last found.
>
> We should pick a different option, and push this patch there too.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r289203 - head/usr.sbin/makefs

2015-10-20 Thread Ed Maste
On 20 October 2015 at 21:53, Adrian Chadd  wrote:
> please absolutely do reassign the option to something that doesn't clash ASAP.

It's important that we do it soon, but a few more days won't make a
difference. I've discussed syncing NetBSD's & FreeBSD's makefs on the
NetBSD tech-userlevel list with the hope that we can avoid any new
incompatibilities in option letters, and want to figure out how we can
sync ours and theirs.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r289203 - head/usr.sbin/makefs

2015-10-12 Thread Adrian Chadd
Author: adrian
Date: Tue Oct 13 02:32:15 2015
New Revision: 289203
URL: https://svnweb.freebsd.org/changeset/base/289203

Log:
  makefs: introduce a new option to specify what to round the resulting
  image up to.
  
  From ticket:
  
  While trying to run FreeBSD/mips on some device having very small flash media,
  one is forced to compress file system with mkulzma(8) utility. It is desirable
  to specify small UFS block/fragment sizes like 4096/512 bytes for makefs(8)
  and big compression block size like 65535 bytes to mkulzma at the same time.
  Then one obtains very good comression ratios (like 75% and more) but faces
  the following problem.
  
  geom_uncompress kernel module reports GEOM provider size rounded up to its
  compression block size. Generally, this changes original media size and now
  it fails to match the size of embedded UFS file system that leads to other
  problems, f.e. geom_label kernel module does not like this and skips the
  file system while tasting the GEOM and looking for UFS label.
  
  This makes it impossible to refer to the file system using known UFS label
  instead of something like /dev/map/rootfs.uncompress.
  
  The following patch introduces new command line option "-r roundup" for makefs
  that makes it round up the image to specified block size. Hence, 
geom_uncompress
  does not change GEOM media size for images rounded that way and geom_label
  accepts such GEOMs just fine.
  
  With the patch applied, one can use following commands:
  
  $ makefs -t ffs -r 65536 -o bsize=4096,fsize=512,label=flash 
optimization=space fs.img fs
  $ mkulzma -s 65536 -o fs.img.ulzma fs.img
  
  PR:   bin/203707
  Submitted by: 

Modified:
  head/usr.sbin/makefs/ffs.c
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
  head/usr.sbin/makefs/makefs.h

Modified: head/usr.sbin/makefs/ffs.c
==
--- head/usr.sbin/makefs/ffs.c  Tue Oct 13 02:17:56 2015(r289202)
+++ head/usr.sbin/makefs/ffs.c  Tue Oct 13 02:32:15 2015(r289203)
@@ -418,6 +418,10 @@ ffs_validate(const char *dir, fsnode *ro
/* round up to the next block */
fsopts->size = roundup(fsopts->size, ffs_opts->bsize);
 
+   /* round up to requested block size, if any */
+   if (fsopts->roundup > 0)
+   fsopts->size = roundup(fsopts->size, fsopts->roundup);
+
/* calculate density if necessary */
if (ffs_opts->density == -1)
ffs_opts->density = fsopts->size / fsopts->inodes + 1;

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Tue Oct 13 02:17:56 2015
(r289202)
+++ head/usr.sbin/makefs/makefs.8   Tue Oct 13 02:32:15 2015
(r289203)
@@ -53,6 +53,7 @@
 .Op Fl m Ar maximum-size
 .Op Fl N Ar userdb-dir
 .Op Fl o Ar fs-options
+.Op Fl r Ar roundup
 .Op Fl S Ar sector-size
 .Op Fl s Ar image-size
 .Op Fl t Ar fs-type
@@ -195,6 +196,9 @@ Deprecated.
 See the
 .Fl Z
 flag.
+.It Fl r Ar roundup
+Round the image up to specified block size that should be multiple
+of block size.
 .It Fl S Ar sector-size
 Set the file system sector size to
 .Ar sector-size .

Modified: head/usr.sbin/makefs/makefs.c
==
--- head/usr.sbin/makefs/makefs.c   Tue Oct 13 02:17:56 2015
(r289202)
+++ head/usr.sbin/makefs/makefs.c   Tue Oct 13 02:32:15 2015
(r289203)
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
 
-   while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ")) != -1) 
{
+   while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:pr:s:S:t:xZ")) != 
-1) {
switch (ch) {
 
case 'B':
@@ -209,6 +209,12 @@ main(int argc, char *argv[])
fsoptions.sparse = 1;
break;
 
+   case 'r':
+   /* Round image size up to specified block size */
+   fsoptions.roundup =
+   strsuftoll("roundup", optarg, 0, LLONG_MAX);
+   break;
+
case 's':
fsoptions.minsize = fsoptions.maxsize =
strsuftoll("size", optarg, 1LL, LLONG_MAX);
@@ -359,9 +365,9 @@ usage(void)
prog = getprogname();
fprintf(stderr,
 "usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n"
-"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n"
-"\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-xZ]\n"
-"\t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n",
+"\t[-S sector-size] [-M minimum-size] [-m maximum-size] [-r roundup ]\n"
+"\t[-s image-size]