summaryrefslogtreecommitdiffstats
path: root/label.c
Commit message (Collapse)AuthorAgeFilesLines
* label: check parttypes identity typeJose M. Guisado2023-01-111-2/+18
| | | | | | | | | | | | | | | parttypes can be either: - A code for MBR/DOS - An UUID for GPT User needs a label instance before using a parttype getter. If checking for a parttype using a code, check if the current label support that kind of parttype identification before retrieving it. Same applies for UUID based parttypes. If wrong identity type is used, raise an exception. Errors regarding parttype are more informative this way.
* fdisk: declare kwlist array staticJose M. Guisado2022-12-151-4/+1
|
* coding style: line breaksJose M. Guisado2022-12-151-3/+4
| | | | | | | | | Only two line breaks separate copyright notice from source. For the rest of the source file any function declaration or similar block is separated with a line break from any other block. Except when a python function definition is previously followed by a docstring #define block.
* parttype: add parttype class and functionsJose M. Guisado2022-12-151-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parttype is a container for partition types in libfdisk. In python-libfdisk, the only way to create parttype instances is using the corresponding label-specific function: get_parttype_from_{code,string} This function wraps libfdisk's label_get_parttype_from_code (lookup DOS label parttype by hex code) and label_get_parttype_from_string (lookup GPT parttype by type uuid) For example, to get the parttype instance of 'EFI System' partition type of a GPT label, with type uuid 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b': >>> import fdisk >>> cxt = fdisk.Context('./disk.bin', readonly=False) >>> cxt.create_disklabel('gpt') >>> efitype = cxt.label.get_parttype_from_string("c12a7328-f81f-11d2-ba4b-00a0c93ec93b") >>> efitype <libfdisk.PartType object at 0x7f503e4a5270, name=EFI System> See: https://cdn.kernel.org/pub/linux/utils/util-linux/v2.34/libfdisk-docs/libfdisk-Partition-types.html https://cdn.kernel.org/pub/linux/utils/util-linux/v2.34/libfdisk-docs/libfdisk-Label.html#fdisk-label-get-parttype-from-code https://cdn.kernel.org/pub/linux/utils/util-linux/v2.34/libfdisk-docs/libfdisk-Label.html#fdisk-label-get-parttype-from-string
* Use c99 struct initializationJose M. Guisado Gomez2022-04-281-37/+11
| | | | Declutters PyTypeObject struct initialization when declaring new types.
* Add COPYING and license headersJose M. Guisado Gomez2022-04-071-0/+12
| | | | LGPL2.1 or later.
* Initial commitJose M. Guisado Gomez2022-04-061-0/+147
Add sources, setup.py and .gitignore Build/Install: python setup.py build python setup.py install