@@ -252,13 +252,16 @@ tap_cli_create_usage(FILE *stream)
252252 "[-r turn on read caching into leaf node] [-2 <path> "
253253 "use secondary image (in mirror mode if no -s)] [-s "
254254 "fail over to the secondary image on ENOSPC] "
255- "[-t request timeout in seconds] [-D no O_DIRECT]\n" );
255+ "[-t request timeout in seconds] [-D no O_DIRECT] "
256+ "[-T enable thin provisioning] "
257+ "[-q allocation quantum in MBytes]\n" );
258+
256259}
257260
258261static int
259262tap_cli_create (int argc , char * * argv )
260263{
261- int c , err , flags , prt_minor , timeout ;
264+ int c , err , flags , prt_minor , timeout , alloc_quantum ;
262265 char * args , * devname , * secondary ;
263266
264267 args = NULL ;
@@ -267,9 +270,10 @@ tap_cli_create(int argc, char **argv)
267270 prt_minor = -1 ;
268271 flags = 0 ;
269272 timeout = 0 ;
273+ alloc_quantum = 0 ;
270274
271275 optind = 0 ;
272- while ((c = getopt (argc , argv , "a:RDd:e:r2:st:h" )) != -1 ) {
276+ while ((c = getopt (argc , argv , "a:RDd:e:r2:st:Tq: h" )) != -1 ) {
273277 switch (c ) {
274278 case 'a' :
275279 args = optarg ;
@@ -300,6 +304,12 @@ tap_cli_create(int argc, char **argv)
300304 case 't' :
301305 timeout = atoi (optarg );
302306 break ;
307+ case 'T' :
308+ flags |= TAPDISK_MESSAGE_FLAG_THIN ;
309+ break ;
310+ case 'q' :
311+ alloc_quantum = atoi (optarg );
312+ break ;
303313 case '?' :
304314 goto usage ;
305315 case 'h' :
@@ -312,7 +322,7 @@ tap_cli_create(int argc, char **argv)
312322 goto usage ;
313323
314324 err = tap_ctl_create (args , & devname , flags , prt_minor , secondary ,
315- timeout );
325+ timeout , alloc_quantum );
316326 if (!err )
317327 printf ("%s\n" , devname );
318328
@@ -717,14 +727,16 @@ tap_cli_open_usage(FILE *stream)
717727 "[-r turn on read caching into leaf node] [-2 <path> "
718728 "use secondary image (in mirror mode if no -s)] [-s "
719729 "fail over to the secondary image on ENOSPC] "
720- "[-t request timeout in seconds] [-D no O_DIRECT]\n" );
730+ "[-t request timeout in seconds] [-D no O_DIRECT] "
731+ "[-T enable thin provisioning] "
732+ "[-q allocation quantum in MBytes]\n" );
721733}
722734
723735static int
724736tap_cli_open (int argc , char * * argv )
725737{
726738 const char * args , * secondary ;
727- int c , pid , minor , flags , prt_minor , timeout ;
739+ int c , pid , minor , flags , prt_minor , timeout , alloc_quantum ;
728740
729741 flags = 0 ;
730742 pid = -1 ;
@@ -733,9 +745,11 @@ tap_cli_open(int argc, char **argv)
733745 timeout = 0 ;
734746 args = NULL ;
735747 secondary = NULL ;
748+ alloc_quantum = 0 ;
749+
736750
737751 optind = 0 ;
738- while ((c = getopt (argc , argv , "a:RDm:p:e:r2:st:h" )) != -1 ) {
752+ while ((c = getopt (argc , argv , "a:RDm:p:e:r2:st:Tq: h" )) != -1 ) {
739753 switch (c ) {
740754 case 'p' :
741755 pid = atoi (optarg );
@@ -769,6 +783,12 @@ tap_cli_open(int argc, char **argv)
769783 case 't' :
770784 timeout = atoi (optarg );
771785 break ;
786+ case 'T' :
787+ flags |= TAPDISK_MESSAGE_FLAG_THIN ;
788+ break ;
789+ case 'q' :
790+ alloc_quantum = atoi (optarg );
791+ break ;
772792 case '?' :
773793 goto usage ;
774794 case 'h' :
@@ -781,7 +801,7 @@ tap_cli_open(int argc, char **argv)
781801 goto usage ;
782802
783803 return tap_ctl_open (pid , minor , args , flags , prt_minor , secondary ,
784- timeout );
804+ timeout , alloc_quantum );
785805
786806usage :
787807 tap_cli_open_usage (stderr );
0 commit comments