Commit graph

33 commits

Author SHA1 Message Date
Karel Zak
9ff2ce0a54 fdisk: (sun) use Ask API for new-partiton dialog
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:56 +01:00
Karel Zak
9eac213c5b fdisk: (sun) use fdisk_{info,warnx}
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:56 +01:00
Karel Zak
c69bbca9c1 fdisk: (sun): use ask API, remove global variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:56 +01:00
Karel Zak
cfebc4654e fdisk: (sun) share disk label struct with libblkid
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:55 +01:00
Karel Zak
a1ac3a0ce1 fdisk: (sun) use cpu_to_be* macros, remove other_endian global variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:55 +01:00
Karel Zak
aace6e9d1c fdisk: correctly initialize pointer to sun label
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:54 +01:00
Karel Zak
9ffeb235d6 fdisk: remove fdisk_label from API functions, add asserts, use size_t
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 13:00:54 +01:00
Karel Zak
47b8e7c002 libfdisk: add part_get_status operation
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:31 +01:00
Karel Zak
bddd84e7c5 fdisk: use libfdisk label->changed
The patch is huge because it's necessary to add a pointer context to
all read_<foo> functions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:30 +01:00
Karel Zak
d6ab93f18a fdisk: (sun) remove nasty sunlabel macro
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:30 +01:00
Karel Zak
137b57e56b fdisk: (sun) remove global variable 'partitions'
* use label counters
 * add assert()
 * use struct fdisk_label if possible

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:30 +01:00
Karel Zak
53b422ab16 libfdisk: move label identifier to label struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:29 +01:00
Karel Zak
8a95621d30 libfdisk: add fdisk_label to driver API
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:29 +01:00
Karel Zak
0c5d095e46 libfdisk: split label and label operations
Changes:

 - fdisk_label is a private label driver struct
 - generic header of the fdisk_label points to fdisk_label_operations
 - the private fdisk_label stuff is always allocated for all drivers
   during fdisk_context initialization

 - context->labels[] contains pointers to all supported labels (drivers)
 - context->label is a pointer to the currently used label

 This change allows to:

 - store label specific global settings (e.g. dos compatible mode,
   display units, ...) independently on the current label

 - add label specific function to the API

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-11 12:47:29 +01:00
Karel Zak
3c88fb56b6 fdisk: move DOS units stuff to fdiskdoslabel.c
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-03 16:22:17 +01:00
Davidlohr Bueso
8254c3a594 fdisk: api: propagate add partitions to users
Similarly to commit 1f5eb51b79 we
do not propagate problems when adding partitions to user visible
api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-11-30 13:48:27 +01:00
Davidlohr Bueso
ff5775bd4f fdisk: api: move disklabel type to cxt
Get rid of it as a global variable as it belongs in the context.
To compare a disklabel on the device, the fdisk_dev_is_disklabel()
function is introduced. Also, to avoid naming issues, the fdisk_labeltype
members where renamed to FDISK_DISKLABEL_<type>.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-11-30 13:48:19 +01:00
Davidlohr Bueso
1f5eb51b79 fdisk: api: propagate partition deletion to users
The generic fdisk_delete_partition() function returns 0 when a partition
is correctly deleted, otherwise it's corresponding error (negative values).
This, however, does not include problems that can occur in actual label
specific contexts, so we need to propagate the corresponding return code,
back to the user visible api.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-10-18 12:15:33 +02:00
Karel Zak
ed470672bb fdisk: use fdisk_parttype in add_partition
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-27 13:38:13 +02:00
Karel Zak
02460b8aae fdisk: add fdisk_set_partition_type()
- remove all label specific partition type stuff from fdisk.c to
   label files
 - add new fdisk_set_partition_type() to API

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-27 13:38:13 +02:00
Karel Zak
010186f2a2 fdisk: add fdisk_get_partition_type()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-27 13:38:13 +02:00
Karel Zak
559d921eda fdisk: add new functions for work with fdisk_parttype
- add flags to fdisk_parttype to store more information about the types
 - function for conversion from code to fdisk_parttype
 - function for conversion from string to fdisk_parttype
 - function for conversion from user input to fdisk_parttype
 - support for unknown complex types (e.g. unknown UUIDs)

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-27 13:38:13 +02:00
Karel Zak
749af4b609 fdisk: move partition types to label specific part
- move MBR partition types to dos_part_types.h
 - make dos_part_types.h independent on datetypes to keep it useful in
   all fdisks
 - add struct fdisk_parrtype
 - move label specific partition types to context->label

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-27 13:38:13 +02:00
Davidlohr Bueso
639f1d56b9 fdisk: API: add fdisk_label_change
[kzak@redhat.com: - rename function
                  - remove fdisk_create_default_disklabel()]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-07-24 10:31:32 +02:00
Davidlohr Bueso
2ca61a61e1 fdisk: API: add verify to label operations
[kzak@redhat.com: - rename some functions]

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-24 09:54:52 +02:00
Davidlohr Bueso
0f639e54df fdisk: API: add new partition to label operations
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-07-24 09:34:22 +02:00
Davidlohr Bueso
fae7b1bcb5 fdisk: API: add write to label operations
[kzak@redhat.com: - rename functions
                  - use errno]

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-07-24 09:13:59 +02:00
Davidlohr Bueso
61c4cb8530 fdisk: API: add delete partition to label operations
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-23 18:15:57 +02:00
Karel Zak
67987b4734 fdisk: rename cxt->mbr buffer to cxt->firstsector
MBR is regular name for DOS partition table, let use less confusing
name for the buffer.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-23 14:24:25 +02:00
Karel Zak
a71601af27 fdisk: get_boot() has to die (step I.)
- move generic stuff around "create disklabel" operation to API

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-23 10:56:06 +02:00
Petr Uzel
da4ea9f54b fdisk: rename label probing functions
Rename check_$foo_label() to $foo_probe_label():

1/ 'probe' is more appropriate verb than 'check' for these functions
2/ making label name first part of the funciton name is IMO more
   friendly for tags completion (e.g. vim + cscope/ctags).

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-07-16 18:09:22 +02:00
Davidlohr Bueso
b8855c868f fdisk: API: add label probing functionality
This patch sets the initial layout for label specific operations. A
new fdisk_label structure is created that will hold all these ops,
like new, delete, write and probe, among others. For now only probing
is implemented. Once this design is established, a copy of the probed
label will be copied to the main context structure, where calling the
specific functions will save 'disklabel' checks. Debugging support is
added as well.

This patch passes regression tests and manually passes bsd, sun, dos
and sgi labels probes.

Reviewed-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2012-07-16 17:59:52 +02:00
Karel Zak
50ea679509 build-sys: rename fdisk -> fdisks/, convert to module
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-26 20:50:53 +02:00
Renamed from fdisk/fdisksunlabel.c (Browse further)