Files
OpenCellular/cgpt
Louis Yung-Chieh Lo 66b47ba37d cgpt: verify the modifications of 'cgpt add' before effected.
Current code only does basic check on parameters, but doesn't validate
if it can pass the CheckEntries(). So a user can accidentally break
the cgpt table by:

  cgpt add /dev/sda -i 6 -s 0  # 0 sector is not allowed for a partition.

  cgpt show /dev/sda
  ... INVALID_ENTRIES ...

This CL checks the new entry before we write it to disk. If new entry is
not good, we return fail.

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
BUG=None
TEST=tested on link.
% cgpt add /dev/sda -i 6 -s 0
ERROR: cgpt add: A given parameter is not allowed.
% cgpt show /dev/sda
(no error, and partition 6 is still good)

Change-Id: Iee0ad24f73ca12028c0b8a0a5490b67c815488cf
Reviewed-on: https://gerrit.chromium.org/gerrit/25914
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-06-27 00:55:05 -07:00
..
2012-06-27 00:55:04 -07:00
2012-06-27 00:55:04 -07:00
2010-08-05 16:42:43 -07:00
2012-06-18 18:15:38 -07:00