On Fri, 5 Oct 2007, Darren J Moffat wrote:

> Alok Aggarwal wrote:
>> On Fri, 5 Oct 2007, Moinak Ghosh wrote:
>> 
>>> Alok Aggarwal wrote:
>>>> [...]     Examples:
>>>> 
>>>> -   1. Compress a file with gzip
>>>> +   1. Compress a file with gzip and add the compressed file as a block
>>>> +      device
>>>> 
>>>> -      # lofiadm -C gzip /export/home/solaris.iso
>>>> +      # lofiadm -a -C gzip /export/home/solaris.iso
>>>> 
>>>> -   2. Compress a file with gzip and compress it in 64k chunks
>>>> +   2. Compress a file with gzip in 64k chunks and add the compressed
>>>> +      file as a block device
>>>>
>>>>         # lofiadm -C gzip -s 64k /export/home/solaris.iso
>>>>
>>>  Shouldn't this be:
>>>
>>>  lofiadm -a -C gzip -s 64k /export/home/solaris.iso
>>>  ?
>> 
>> It should be, it's a typo.
>
> Now I'm really confused.  I thought that the -C was done while there was no 
> mapping in place, but -a adds a mapping.
>
>> The original proposal had what you're suggesting, i.e.
>> "compress this file with -C" and "map this compressed file
>> with -a" as a two step process. As part of some offline
>> discussions it was suggested that having these two actions
>> as disjoint steps doesn't buy us anything.
>
> So how long does the compress take ?  If it is anything more than a few 
> seconds I think it should be a separate step because -a has always been near 
> instant.

Yes, it takes a while to compress and depends on the 
size of the file being compressed.

>> If a user compresses a file with lofiadm, in all certainity
>> he's bound to map that compressed file as a logical next step
>> so why not just enable him to do that in a single command
>> invocation.
>
> I don't think that follows, in fact given that one of the main motivations 
> for this project is building compressed LiveCD images I'd have expected that 
> it wouldn't be getting mapped immediately afterwards.
>
> It also incorrectly leads the user into thinking that compression is on the 
> fly which it is not.

How does supporting both flavors of the command line
sound? That is -

# lofiadm -C gzip -s 64k /export/home/solaris.iso <-- compress the file

Or, optionally,

# lofiadm -a -C gzip -s 64k /export/home/solaris.iso <-- compress the
                                                         file and add it

>> Apropos making compression a separate step so the user doesn't
>> wonder if the command is hung, the  lofiadm output will change
>> to printing something like this to stderr (so scripts don't
>> break) -
>
>
>> # lofiadm -a -C gzip -s 64k /export/home/solaris.iso
>> Compressing solaris.iso
>> Mapping solaris.iso
>> /dev/lofi/1
>
> You really shouldn't do that the output of lofiadm -a is intended to be 
> scriptable and even says so in the man page:
>
>                          The ability to specify a device is pro-
>                          vided for use in scripts that  wish  to
>                          re-establish  a particular set of asso-
>                          ciations.

Will the scripts still break if the new messages "Compressing
file" and "Mapping file" are sent to *stderr* though? 
"/dev/lofi/1" still goes to stdout so there should be no 
difference from the scripts' perspective.

> The other problem with -C being part of the mapping is it is now different 
> from the -U option to uncompress since you wouldn't do lofiadm -d -U

Supporting both forms of the command line should take care
of this.

Alok

Reply via email to