Commit Graph

90 Commits

Author SHA1 Message Date
Karel Zak 181aab4013 libfdisk: allow to address partition by chars
For example BSD uses letters rather tahn numbers to address partition,
the fist partition is 'a', last partition is 'p'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:05 +02:00
Karel Zak 7e937b7774 fdisk: improve menus to make it more usable for BSD label
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:05 +02:00
Karel Zak 8a9256f9fc libfdisk: improve nested context initialization
- all label prober() function in fdisk_new_nested_context()
 - don't reset device properties for nested contexts

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:05 +02:00
Karel Zak 60c1b03620 libfdisk: (dos) cosmetic changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:05 +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 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 9af7ed4eab fdisk: (gpt) enlarge columns in list output
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 caad858324 libfdisk: add FDISK_LABEL_FL_REQUIRE_GEOMETRY
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 b720e0d7b4 libfdisk: copy ask callback from parental context
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:47:00 +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 a8dd3d1532 libfdisk: (sun) remove duplicate code
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 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 1054699ccd libfdisk: support GPT partition name (label) change
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 36050e7001 libfdisk: add FDISK_DEBUG_FRONTEND
Currently we use private libfdisk in fdisk code, because the library
API is not stable yet. Let's add debug flag to make it obvious in the
debug output what is from libfdisk and what is from fdisk frontend.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:56 +02:00
Karel Zak 7ab242ecbe libfdisk: make the library usable with tests
We don't have completely initialized all label drivers in the tests, so
make the code more robust.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak bfcd337995 libfdisk: remove unnecessary code from test_fdisk_ask
.. 'sun' stuff is already in the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:55 +02:00
Karel Zak b1920e0b5f libfdisk: (gpt) print UUID and NAME in expert mode only
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak d45fa25d7b libfdisk: (gpt) cleanup structs members names
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak 34b06299ce libfdisk: add asktype "string" and support UUID partition change
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak b4bfbaddfa libfdisk: (sun) move driver from fdisk to library
... and also add fdisk_info_new_partition()

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak 0d75581e44 libfdisk: add fdisk_scround()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak aec8d88349 fdisk: (gpt, sun) use fdisk_partname()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak bb8a40366a libfdisk: add fdisk_partname()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:54 +02:00
Karel Zak a5c1b0fa20 libfdisk: add fdisk_context_enable_details()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:53 +02:00
Karel Zak 3c5fb4757f libfdisk: add list() label operation
... and use it for GPT

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:53 +02:00
Karel Zak d9948c3716 libfdisk: (gpt) use lib/tt.c to list partitions
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:53 +02:00
Karel Zak 0c870c1c73 libfdisk: add new 'ask' type TABLE
The new type could be used to print table-like output (for example
list of the partitions).

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-09-16 16:46:53 +02:00
Karel Zak 5673f30de6 libfdisk: don't re-allocate range string in Ask API
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-09 13:20:35 +02:00
Karel Zak 4fb18cde32 libfdisk: do not use va_list in the Ask API
# fdisk /dev/sda
  Welcome to fdisk (util-linux 2.23).

  [...]

  Command (m for help): a
  Segmentation fault (core dumped)

It's too fragile, the va_list implementation is architecture specific
and it seems we need such thing in libfdisk at all.

Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-09 13:06:02 +02:00
Yuri Chornoivan ef75bc880e Fix various typos 2013-04-26 12:50:03 +02:00
Davidlohr Bueso f481ad7172 libfdisk: gpt: remove leftover comments
I must have left those in some commit.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2013-04-25 09:23:41 +02:00
Karel Zak c0d14b0985 libfdisk: (gpt) fix EFI UUID usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 15:45:25 +02:00
Karel Zak f67c524e59 libfdisk: (gpt) fix valid_pmbr()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 12:44:00 +02:00
Karel Zak c15aec8606 libfdisk: (gpt) use le64_to_cpu() for alternative LBA checks
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-18 12:27:43 +02:00
Sami Kerola 3acc206d39 various: fix variable and function declarations [smatch scan]
disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 12:17:20 +02:00
Ville Skyttä 58c41e15b3 Spelling fixes.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2013-04-08 17:06:55 +02:00
Karel Zak 065070f216 libfdisk: use O_CLOEXEC
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-04-03 16:13:45 +02:00
Karel Zak c1253a3b10 libfdisk: (gpt) fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:15:57 +01:00
Karel Zak bbe8e6a98e libfdisk: check returns [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 14:12:47 +01:00
Karel Zak eb6a03f3bf build-sys: set dependence fdisk -> libfdisk -> libuuid
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-21 15:34:24 +01:00
Karel Zak d06f321df1 libfdisk: (gpt) rmeove xalloc calls
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20 14:46:03 +01:00
Karel Zak d23c661c47 fdisk: no more AIX "support"
The whole AIX support in fdisk has been limited to pretty poor AIX
magic string detection and warning that the AIX is unsupported. It's
too expensive to maintain such fdisk driver.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-12 11:37:33 +01:00