Commit Graph

131 Commits

Author SHA1 Message Date
Karel Zak 5b72b3dd8e fdisk: main() refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak 6bcd192c7b libfdisk: add fdisk_has_user_device_properties()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak fcd9a2a42d fdisk: cleanup header file
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak a57639e1f8 libfdisk: move sync() and reread PT code from fdisk to libfdisk
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak df4bfa97b8 fdisk: cleanup write table code
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak 27ddd4f158 fdisk: move remaining actions to menu callbacks
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak 8930996828 fdisk: move expect actions to menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak 5e86087018 fdisk: consolidate code in fdisk.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:08 +02:00
Karel Zak aae727f2f5 fdisk: cleanup sgi menu callbackswq
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:07 +02:00
Karel Zak b3ac22eff3 fdisk: move "create label" actions to menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:07 +02:00
Karel Zak 6d9362988e fdisk: remove common.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:07 +02:00
Karel Zak d5b2b8dbbb libfdisk: add bsd driver
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:07 +02:00
Karel Zak e563f05525 fdisk: (bsd) rewrite list disklabel function
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:07 +02:00
Karel Zak 22ddf54705 fdisk: (bsd) *OSF --> *BSD
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:06 +02:00
Karel Zak b529ea2abc fdisk: (bsd) implement regular bsd menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:06 +02:00
Karel Zak d5b243144e fdisk: (bsd) remove generic actions from bsd_command_prompt()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:06 +02:00
Karel Zak a47fec81b2 fdisk: allow to exchange context pointer in menu callbacks
... to make it possible to switch to nested contexts (nested partition
tables).

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:06 +02:00
Karel Zak 5099226711 libfdisk: move mbr code to the library
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:04 +02:00
Karel Zak 4f79f8872b fdisk: cleanup warning messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:04 +02:00
Karel Zak c10937dcaf fdisk: remove nowarn global variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:04 +02:00
Karel Zak f02fecd19a fdisk: (dos) add dos menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:04 +02:00
Karel Zak 35b1f0a4c4 libfdisk: add generic function to set disklabel ID
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:03 +02:00
Karel Zak 21fe3dde84 libfdisk: add generic function to get disklabel ID
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:03 +02:00
Karel Zak 1cf67f1c33 fdisk: (dos) clean up list PT functions
- use tt.c to list partitions
 - list extended partitions in expert mode

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:03 +02:00
Karel Zak 6dc30bc6df fdisk: (dos) don't check for CHS in move-begin command
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:03 +02:00
Karel Zak af0df606a2 fdisk: (dos) remove global ptes[]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:03 +02:00
Karel Zak 0b52b94c3e fdisk: cleanup warnings
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak 04d83a9251 fdisk: move remaining ptes[] code to fdiskdoslabel.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak 3f0ac58755 fdisk: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak 5497ba0442 fdisk: move get_nr_sects() fdisk.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak afb7c83520 fdisk: remove old code to ask user
Old code has been broken by design:

 * use global variables
 * fixed buffer size
 * useless within libfdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak 950edd1a71 fdisk: use libfdisk to ask for partition type
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:01 +02:00
Karel Zak 918afd3f1a fdisk: remove ugly fatal() function
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:59 +02:00
Karel Zak 3c08cb2df0 fdisk: remove Mac code
The code has been used only to detect magic strings, nothing else.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:59 +02:00
Karel Zak 067686d895 libfdisk: (sgi) add driver
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:58 +02:00
Karel Zak c880065096 fdisk: (sgi) remove dead code
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:58 +02:00
Karel Zak a97422aa15 fdisk: (sgi) rewrite sgi_list_table()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:58 +02:00
Karel Zak 1a9889ad7f fdisk: (sgi) cleanu sgi_info stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:57 +02:00
Karel Zak 1653f0b0c2 libfdisk: make it possible to reset device properties
- remember user C/H/S and sector size
 - reset all device properties before create a new label (maybe the
   old setting has been affected by previous on-disk label)
 - always apply user setting after the reset
 - improve topology/geometry debug messages

Note that for fdisk "user C/H/S and sector size" means on command line
specified values. If you override the setting by c/h/s commands in
expert menu then the setting is applied to the current disk label
only. If you create a new disk label (e.g change MBR to GPT) then
fdisk will use the original setting.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:57 +02:00
Karel Zak 9f2809033e fdisk: move sun commands to sun menu callback
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 8e40a677bd fdisk: add functions to geometry menu
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 4170ae9cbd libfdisk: clean up sun geometry stuff
- move fdisk_sun_set_* functions to public API file
 - remove extra function to set ncyl -- this has to follow regular
   geo.cylinders
 - set alternative cylinders to zero (to be compatible with parted)
 - it seems that the previous code completely ignored relation between
   geo.cylinders, sunlabel->acyl and sunlabel->ncyl.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak b9e94cd7f8 fdisk: add GPT specific callback to menu
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak a410f8df0f fdisk: use new menu infrastructure to verify keys
- use generic function to ask for key
 - verify the key against the current menu
 - call menu callback if defined

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 74fcee985d fdisk: use remove read_int() usage from fdisk.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 287ce9ed6c fdisk: make internal command line case sensitive
Hey, this is Linux, year 2013...

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak 39f01b7b2b fdisk: use new menus
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak 67dac5c5a3 fdisk: (gpt) add t, v and x to menu
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak ad3b5e74ba fdisk: revert add 'G' to create SGI label to the main menu
'G' does not make sense, fdisk menus are case insensitive. Yes...

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak 414b6b0f90 fdisk: always allow 'p'rint command in expert menu
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00