summaryrefslogtreecommitdiff
path: root/libparted
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for the F2FS filesystemRomain Perier2020-05-044-0/+123
| | | | | | | | | This adds a basic support for the Flash-Friendly File System. So we can manipulate the file system by using the PedFileSystem API and we can do basic device probing for autodetecting the current fs. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Removed reference to ped_file_system_createMax Campbell2020-03-091-2/+0
| | | | | | | Removed a reference to the removed function ped_file_system_create in the docs for ped_file_system_clobber. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: Add support for bls_boot to GPT disksBrian C. Lane2019-12-202-1/+48
| | | | | | This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to indicate that the partition is a Boot Loader Specification compatible /boot partition.
* libparted: Add support for MSDOS partition type bls_boot (0xea)Brian C. Lane2019-12-201-13/+20
| | | | | This type is used by the Boot Loader Specification to identify a compatible /boot boot partition.
* libparted: Add ChromeOS Kernel partition flagAlper Nebi Yasak2019-12-202-0/+47
| | | | | | | | | | | | | | | | | | | | This adds a GPT-only partition type flag, chromeos_kernel, for use on Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309. The firmware/bootloader in these machines relies on special images being written to partitions of this type. Among multiple such partitions, it decides which one it will boot from based on the GUID-specific partition attributes. This patch is not intended to and does not manipulate these bits. Google refers to these partitions as "ChromeOS kernel" partitions. They also define partitions for rootfs, firmware, and a reserved one; but these are not necessary for the boot flow and are not included here. Relevant ChromiumOS documentation: https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
* libparted/s390: Re-enabled virtio-attached DASD heuristicsViktor Mihajlovski2019-09-301-3/+10
| | | | | | | | | | | DASDs attached to KVM guest as virtio-blk devices are only handled properly, if the unique DASD geometry is detected. Commit id 61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry detection. Fixed by making sure that HDIO_GETGEO takes precedence on s390[x]. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* maint: Update copyright statements to 2019Brian C. Lane2019-08-12110-115/+165
| | | | By running make update-copyright
* maint: Bump library REVISION number for releaseBrian C. Lane2019-08-122-2/+2
|
* libparted: Fix bug in bsd.c alpha_bootblock_checksumBrian C. Lane2019-08-091-2/+2
| | | | | | | I flubbed this in e35af6cbc43f5b279e6f0d65ccc904b1ac6c63d2 by trying to switch to using a pointer and ended up writing off the end. Switch the loop in alpha_bootblock_checksum back to use [i] index. It's easier to read anyway.
* bsd.c: Rewrite disklabel code to prevent gcc warningsBrian C. Lane2019-08-091-46/+42
| | | | | | Constructing a pointer into a char array results in warnings about casting changing alignment. This changes how the boot sector is handled by adding the label to BSDDiskData with the correct offset (64 bytes).
* libparted: Replace abs() with llabs()Shin'ichiro Kawasaki2019-08-094-5/+5
| | | | | | | | | | | | | | | | | | | | GCC 9 fails to compile a few C source files which call abs() function. An example of the error messages was as follows: CC dos.lo dos.c: In function '_best_solution': dos.c:1773:13: error: absolute value function 'abs' given an argument of type 'long long int' but has parameter of type 'int' which may cause truncation of value [-Werror=absolute-value] 1773 | a_delta = abs (part->geom.start - a->start); | ^~~ dos.c:1774:13: error: absolute value function 'abs' given an argument of type 'long long int' but has parameter of type 'int' which may cause truncation of value [-Werror=absolute-value] 1774 | b_delta = abs (part->geom.start - b->start); | ^~~ cc1: all warnings being treated as errors To avoid the errors, replace abs() function calls with llabs(). Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* sun.c: Aligned _SunRawLabel to 16bit boundaryBrian C. Lane2019-08-091-1/+1
|
* gpt.c: Drop cast of efi_guid_t to unsigned char *Brian C. Lane2019-08-091-6/+4
| | | | | This confuses gcc, making it think the uuid_t is unaligned when it really comes from a efi_guid_t entry in _GPTDiskData.
* gpt.c: Align _GPTDiskData to 8 byte boundaryBrian C. Lane2019-08-091-1/+1
|
* dvh.c: Use memcpy instead of strncpyBrian C. Lane2019-08-091-4/+4
| | | | | The strings are short, so using memcpy isn't much slower (if at all). This fixes gcc complaining about strncpy possibly copying a non-terminated string.
* libparted/labels/pt-tools.c: Fix gperf generated function attributeShin'ichiro Kawasaki2019-08-091-3/+4
| | | | | | | | | | | | | | | | | | | | | | GCC 8 fails to compile libparted/labels/pt-tools.c with an error: CC pt-tools.lo In file included from pt-tools.c:114: pt-tools.c: In function 'pt_limit_lookup': pt-limit.gperf:78:1: error: function might be candidate for attribute 'pure' [-Werror=suggest-attribute=pure] cc1: all warnings being treated as errors "Pure" attribute is required for the function pt_limit_lookup() because it does not change program status other than its return value. To avoid the build failure, add _GL_ATTRIBUTE_PURE to the function. The attribute cannot be added in libparted/gperf/pt-limit.c because it is generated by gperf during the build process. Instead, add the attribute in libparted/gperf/pt-tools.c which includes the generated function. Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* dos.c: Fix cast alignment error in maybe_FATBrian C. Lane2019-08-091-1/+1
|
* atari.c: Align the AtariRawTable on a 16bit boundaryBrian C. Lane2019-08-091-1/+2
| | | | | | The casts to uint16_t need to know that this will be aligned. The struct is actually 512 bytes, so it normally does end up aligned. This just makes sure the compiler knows it and stops warning about the casts.
* Change 'time stamp' to 'timestamp'Brian C. Lane2019-08-091-3/+3
| | | | Caught by make syntax-check
* Fix double semi-colonsBrian C. Lane2019-08-092-2/+2
| | | | Caught by make syntax-check
* Remove unnecessary if before free checksBrian C. Lane2019-08-091-8/+4
| | | | Caught by make syntax-check
* libparted: Fix endian bug in bsd.cA. Wilcox2019-08-051-1/+1
| | | | | | You have to add 1 *before* doing the endian conversion, not after. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted/fs/amiga/affs.c: Remove printf() to avoid confusionMax Staudt2019-07-151-2/+0
| | | | | | | | | | | | | | | | | | Currently, the affs code in libparted prints a debug line to stdout when an Amiga FFS partition is probed. This confuses tools that parse stdout. A prominent example is the partitioner (partman) in Debian's installer, which parses stdout from a tool (parted_devices) that uses libparted to scan the system's block devices. As of now, Debian cannot be installed on a typical Amiga: https://lists.debian.org/debian-68k/2019/07/msg00015.html This patch removes this unexpected printf(). Cc: glaubitz@debian.org Signed-off-by: Max Staudt <max@enpas.org> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Avoid sigsegv in case 2nd nilfs2 superblock magic accidently found.Michael Small2019-04-091-3/+5
| | | | | | | | | | | | | | | | 1. is_valid_nilfs_sb: make sure the subtraction bytes - sumoff - 4 won't give a negative number. That as the len argument to __efi_crc32() would give a very large number for the latter's for loop limit, since len is unsigned long. 2. nilfs2_probe: Read and allocate enough sectors to hold a struct nilfs2_super_block. is_valid_nilfs_sb() will be passing up to 1024 bytes to __efi_crc32(). If only one 512 byte sector had been allocated with alloca and read from disk that would cause reads off the the end of the stack even if bytes were more than sumoff - 4. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Added support for Windows recovery partition (WINRE) on MBRHans-Joachim Baader2019-01-311-2/+38
| | | | | | | | | Windows 10 uses a recovery partition which is sometimes marked with partition type 0x27 on MBR systems. It wasn't possible to handle such a partition with parted. Therefore the partition type PARTITION_MSFT_RECOVERY is now used properly also on MBR when the flag msftres is set. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Read NVMe model names from sysfsdann frazier2018-10-161-1/+17
| | | | | | | | | | | | | | parted currently shows the same generic model name for all NVMe devices: # parted /dev/nvme0n1 -s print | grep Model Model: NVMe Device (nvme) If the model information is available in sysfs, display that instead: # parted /dev/nvme0n1 -s print | grep Model Model: THNSN5512GPU7 NVMe TOSHIBA 512GB (nvme) Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Fix warnings from GCC 7's -Wimplicit-fallthroughdann frazier2018-10-162-0/+9
| | | | | | | All of these locations appear to have intentional fallthroughs. Add comments that GCC will detect to mute warnings w/ -Wimplicit-fallthrough. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: Add support for MBR id, GPT GUID and detection of UDF filesystemPali Rohár2018-10-165-0/+184
| | | | | | | | | | | | | | | This is needed for libparted based applications (like Gparted) to correctly choose MBR id and GPT GUID for UDF filesystem. MBR id for UDF is 0x07 and GPT GUID is Microsoft Basic Data, see why: https://serverfault.com/a/829172 Without registering a new libparted fs code it is not possible to assign MBR id or GPT GUID. Detection of UDF filesystem is done by checking presence of UDF VSD (NSR02 or NSR03 identifier) and UDF AVDP at expected locations (blocks 256, -257, -1, 512). Signed-off-by: Brian C. Lane <bcl@redhat.com>
* Fix the length of several strncpy callsBrian C. Lane2018-08-222-7/+14
| | | | | | | | | These need to be 1 less than the allocated size of the buffer, strncpy will fill shorter strings with zeros, but there needs to be room for at least one 0x00 at the end if the string is the same length as the buffer and has no terminating 0x00. Related: rhbz#1602652
* libparted: Fix ending CHS address in PMBR.Ulrich Müller2018-08-221-1/+1
| | | | | | | According to the UEFI specification version 2.7, Section 5.2.3, Table 16, the ending CHS address in the protective MBR should be set to 0xFFFFFF. This also agrees with the behaviour of fdisk from util-linux-2.32.
* Fix atari label false positivesPhillip Susi2018-06-121-2/+2
| | | | | The atari label gets false positives easily, so probe it after all other labels have said no.
* Lift 512 byte restriction on fat resizePhillip Susi2018-06-051-12/+0
| | | | | | As Colin Watson pointed out way back in 2014, when I removed the 512 byte sector size restriction from the fs recognition code, I missed the same from the fat resize code.
* build: Remove unused traces of dynamic loadingColin Watson2018-06-054-20/+1
| | | | | | | | | Now that file system operations have been removed from libparted, libreiserfs is no longer used. Remove references to it, along with the dynamic loading build infrastructure which was only used for libreiserfs. Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
* Fix make checkPhillip Susi2018-05-071-1/+4
| | | | | | | | | | Make check failed due to some warnings treated as errors. One was caused by a warning that a function could have the noreturn attribute. It seems that this had previously been disabled but gcc has changed the flag from -Wmissing-noreturn to -Wsuggest-attribute=noreturn. The recently added volser.c test also caused a few warnings when not compiled on s390x because most of the functions were no used, so #if those out as well.
* linux: Include <sys/sysmacros.h> for major() macro.Richard W.M. Jones2018-04-041-0/+1
| | | | Since glibc 2.27 this header is required.
* Add support for NVDIMM devicesSebastian Parschauer2017-12-191-0/+7
| | | | | | | | | | | | | | | | | | | Recognize NVDIMM devices, so that "parted -s /dev/pmem7 p" now prints "Model: NVDIMM Device (pmem)" instead of "Model: Unknown (unknown)". In order for a device to be recognized as NVDIMM, it has to have a 'blkext' major number. But since this major can be used also by other device types, we also check that the device path contains 'pmem' as a substring. * NEWS: Mention the change * include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_PMEM * libparted/arch/linux.c(_device_probe_type): Recognize NVDIMM devices. * libparted/arch/linux.c(linux_new): Handle NVDIMM devices. * parted/parted.c(do_print): Add "pmem" to list of transports. Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
* libparted/labels: link with libiconv if neededArnout Vandecappelle (Essensium/Mind)2017-12-191-1/+1
| | | | | | | | | | | | | gpt.c uses iconv so it should link with it. Otherwise, on platforms where libiconv is a separate library, we get a link failure of parted: CCLD parted ../libparted/.libs/libparted.so: undefined reference to `libiconv' ../libparted/.libs/libparted.so: undefined reference to `libiconv_open' ../libparted/.libs/libparted.so: undefined reference to `libiconv_close' Since iconv functionality is needed unconditionally (not only when gettext is enabled), AM_ICONV needs to be added to configure.ac.
* atari.c: Drop xlocale.h (#1476934)Brian C. Lane2017-07-311-1/+0
| | | | glibc no longer includes this header. locale.h should work just fine.
* libparted: Fix udev cookie leak in _dm_resize_partitionBrian C. Lane2017-05-251-7/+7
| | | | | | | | | | | | | | The function is setting udev cookies, but not using them when waiting for the task. This results in leaked cookies, which can eventually exhaust the available number of semaphores. 'dmsetup udevcookies' will show a cookie remaining afterwards, and 'ipcs -s' will show the semaphores in use. Also simplified the exit so that the task is always destroyed and memory is all freed in the same path. Resolves: rhbz#1455564
* libparted/dasd: add test cases for the new fdasd functionsWang Dong2017-05-012-0/+208
| | | | | | | | The test case uses a temporary file in libparted/tests under Check framwork.It can be issued by "make check" in the test dir. Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
* libparted/dasd: add an exception for changing DASD-LDL partition tableWang Dong2017-05-011-1/+5
| | | | | | | | | | The partition table of DASD-LDL device with the dasd disk label should not be changed according to its character in Linux. When the user tries to modify the partition table, an exception will be raised to inform user of this character. Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
* libpartd/dasd: improve flag processing for DASD-LDLWang Dong2017-05-011-0/+14
| | | | | | | | | DASD-LDL does not support flag now, so all the flags are unavailable to it. Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com> Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
* Add support for RAM drivesSebastian Parschauer2017-05-011-2/+10
| | | | | | | | | | | | | | | | | | | Recognize RAM drives, so "parted -s /dev/ram0 p" now prints "RAM Drive (brd)" instead of "Model: Unknown (unknown)". In order for a device to be recognized as RAM drive, it has to have major number 1. Also the BLKFLSBUF ioctl shouldn't be used on RAM drives as it is used to zero the device. * NEWS: Mention the change * include/parted/device.h.in(PedDeviceType): Add PED_DEVICE_RAM. * libparted/arch/linux.c(RAM_MAJOR): New define. * libparted/arch/linux.c(_device_probe_type): Recognize RAM drives. * libparted/arch/linux.c(linux_new): Handle RAM drives. * libparted/arch/linux.c(_flush_cache): Skip RAM drives. * parted/parted.c(do_print): Add "brd" to list of transports. Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
* libparted: Fix typo in hfs error messageSebastian Rasmussen2017-01-191-2/+2
|
* libparted: Fix MacOS boot supportLaurent Vivier2016-12-221-21/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | boot_region_length (or BootSize in the MacOS dialect) is the length of the driver code in the driver partition. This length is used to compute the checksum of the driver. libparted updates this value by setting the whole size of the partition without computing the checksum of the driver using this size. As the checksum is wrong, the driver is broken and cannot be loaded by the MacOS ROM, and thus the disk is not bootable anymore. Moreover, parted try to update the driver list and makes it disappear. As parted is not able to insert a driver in a partition, the driver is generally inserted by the Apple HD Tool, this patch removes the line updating the driver size. We also simplify the driver list scan and fix endianess use. This has been tested... and it works, now. I have updated a bootable disk with parted on x86_64 and then been able to boot it (again) on a Mac LC III. Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: Add support for atari partition tablesJohn Paul Adrian Glaubitz2016-12-225-0/+1978
| | | | | Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted:tests: Move get_sector_size() to common.cJohn Paul Adrian Glaubitz2016-12-223-15/+19
| | | | | | | | | | | Moving get_sector_size() from disk.c to common.c allows us to use it in _implemented_disk_label() to test for 512-byte sectors. This change is required to be able to enable this test for atari partition tables for which support is added in a follow-up patch. Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: set swap flag on GPT partitionsArvin Schnell2016-12-221-3/+39
| | | | | | | The filesystem type is still detected as befor, but now setting the 'swap' flag will set the partition GUID to PARTITION_SWAP_GUID. Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted/dasd: add test cases for the new fdasd functionsWang Dong2016-12-221-2/+3
| | | | | | | | | The test case uses a temporary file in libparted/tests under Check framwork. It can be issued by "make check" in the test dir. Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted/dasd: add new fdasd functionsWang Dong2016-12-221-0/+123
| | | | | | | | | | | | | | | Introduce a set of new functions from the fdasd utility of the s390-tools to keep the code base in parted and s390-tools in sync. These new functions are: fdasd_check_volser(): validate the volser input fdasd_get_volser(): get volume serial (volser) fdasd_change_volser(): change volser with string fdasd_reuse_vtoc(): re-create vtoc labels based on the existing vtoc Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>