tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gpt's -s parameter



On Nov 22,  8:46am, dieter roelants wrote:
} On Fri, Nov 22, 2013 at 5:46 AM, John Nemeth <jnemeth%cue.bc.ca@localhost> 
wrote:
} 
} >      As some people may have noticed, I've been working on fixing
} > up gpt(8) lately.  One of the things I've done is to change various
} > parameters to accept "human numbers".  These are numbers like "1M",
} > "200K", "5.2G", etc.  I've been pondering what to do with the -s
} > parameter.  This parameter is for specifying a partition size in
} > terms of the number of sectors.  Most people would expect that if
} > they were to specify "-s 1M" they would get a partition that would
} > hold 1 MiB of data.  But, what they would get is 1 Mi sectors,
} > which with a conventional disk with 512 byte sectors, they would
} > actually get a partition that would hold 512 MiB of data.
} >
} >      The meaning of the -s parameter can't be changed at this point
} > since gpt(8) has been part of NetBSD since late 2006 and first
} > appeared in NetBSD 4.0.  One solution I've been considering is to
} > introduce a new -S parameter that would take a size in terms of
} > bytes, and would calculate the appropriate number of sectors based
} > on the device's sector size.  However, I'm wondering if having both
} > -s and -S would cause confusion (the program wouldn't accept both).
} > What are people's thoughts on this?
} 
} What about changing -s to use sectors if no unit is given or unit is "s",
} and use {kilo,mega,...}bytes otherwise? It's what disklabel does too, no?

     That is a possibility, but it would be more work to code.
Right now, I just pass the whole string to dehumanize_number() and
I'm done.  To do this, I would have to parse the string first.

}-- End of excerpt from dieter roelants


Home | Main Index | Thread Index | Old Index