summaryrefslogtreecommitdiff
path: root/parted
Commit message (Collapse)AuthorAgeFilesLines
...
* parted: Add stub resize command for backward compatibilityPhillip Susi2014-06-151-0/+16
| | | | | | To make sure that older scripts trying to use the resize command do not accidentally run the new resizepart command by mistake, this undocumented stub command will throw an error if called.
* parted: Allow undocumented commandsPhillip Susi2014-06-151-0/+2
| | | | | | Have command_print_summary print nothing if the command summary is NULL. This allows for a command to be registered, but not documented in the output of help.
* parted: make _partition_warn_busy actually a warning instead of an errorPhillip Susi2014-06-151-7/+10
| | | | | | This function was throwing a PED_EXCEPTION_ERROR with only the PED_EXCEPTION_CANCEL option. Converted to a PED_EXCEPTION_WARNING with the option to continue anyhow.
* parted: add resizepart commandPetr Uzel2014-06-151-0/+86
| | | | | Add resizepart command to resize ( change the end position ) an existing partition. Note that it does nothing to a filesystem in the partition.
* maint: run "make update-copyright"Jim Meyering2014-05-259-9/+9
|
* parted: don't reload partition table on every commandPhillip Susi2014-05-225-159/+160
| | | | | | | | | | | | gpt was using a static local variable to suppress repeatedly reporting an error if you chose to ignore it. This is incorrect as the variable is global to all disks, and ignoring the error on one should not suppress its reporting on another. Moving the flag to the PedDisk object made it effectively useless because parted was destroying the PedDisk and reloading the partition table on every command. Parted has been reworked to cache the PedDisk once loaded, and only discard it when changing disks, or creating a new disklabel.
* ui: switch to new-style readline typedefGustavo Zacarias2014-03-051-1/+1
| | | | | | | | | | The CPPFunction typedef (among others) have been deprecated in favour of specific prototyped typedefs since readline 4.2 (circa 2001). It's been working since because compatibility typedefs have been in place until they where removed in the recent readline 6.3 release. Switch to the new style to avoid build breakage. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
* Fix help text for disk_{set,toggle}Phillip Susi2014-02-241-2/+21
| | | | Fix the help text to show *disk* flags instead of partition flags.
* parted: fix EOF and ctrl-c handlingPhillip Susi2013-11-231-10/+6
| | | | | | | feof() seems to not detect EOF after readline() hits it, so parted went into an infinite loop prompting for input on EOF. Change test to use the got_ctrl_c variable instead, which is set when readline hits EOF and returns NULL. This also makes parted properly exit on ctrl-c.
* maint: update all copyright year number rangesJim Meyering2013-01-069-9/+9
| | | | Run "make update-copyright".
* maint: remove unnecessary wcslen useJim Meyering2012-09-121-2/+2
| | | | | * parted/strlist.c (gettext_to_wchar): Tighten up test for mbsrtowcs failure and remove unnecessary wcslen use.
* build: prefer $(AM_CPPFLAGS) over $(INCLUDES)Stefano Lattarini2012-08-301-1/+1
| | | | | | | | | | | | | | | The latter is obsolete, and might be removed in future Automake versions. Moreover, it's already been removed in Automake-NG, so its use would make a port to Automake-NG more difficult. * parted/Makefile.am (INCLUDES): Rename ... (AM_CPPFLAGS): ... like this. * partprobe/Makefile.am: Likewise. * libparted/fs/Makefile.am: Likewise. * libparted/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. Copyright-paperwork-exempt: yes
* ui: rewrite disk_print_flags and partition_print_flagsJim Meyering2012-02-031-59/+41
| | | | | | * parted/parted.c (disk_print_flags): Avoid NULL-dereference on failed malloc. Use xrealloc, not ped_realloc. (partition_print_flags): Likewise; nearly identical code.
* parted: when printing, also print the new disk flagsBrian C. Lane2012-02-021-2/+42
| | | | | | | | | This adds a 'Disk Flags:' line the displays the active disk flags. In machine mode this is appended to the disk info line, after the device model. * parted/parted.c (disk_print_flags): New function (_print_disk_info): Add Disk Flags information.
* gpt: add commands to manipulate pMBR boot flagMatthew Garrett2012-02-023-0/+98
| | | | | | | | | | | | | | | | | | | | | | Some BIOS systems will only boot from GPT partitions if the boot flag is set on the protective MBR partition. This adds the ability to set this flag using the disk_set and disk_toggle commands. * include/parted/disk.in.h (_PedDiskFlag): Add PED_DISK_GPT_PMBR_BOOT * libparted/disk.c (ped_disk_flag_get_name): Add PED_DISK_GPT_PMBR_BOOT * libparted/labels/gpt.c (_GPTDiskData): Add pmbr_boot flag. (gpt_alloc): Init pmbr_boot to 0. (gpt_read_headers): Set pmbr_boot state from PMBR boot flag. (_write_pmbr): Add pmbr_boot flag and set PMBR boot flag from it. (gpt_write): Pass pmbr_boot flag through to _write_pmbr (gpt_disk_set_flag): New function (gpt_disk_is_flag_available): New function (gpt_disk_get_flag): New function (gpt_disk_ops): Add disk_set_flag, disk_get_flag, disk_is_flag_available * parted/parted.c (do_disk_set): New function (do_disk_toggle): New function (_init_commands): Add do_disk_set and do_disk_toggle * parted/ui.c (command_line_get_disk_flag): New function * parted/ui.h: Add command_line_get_disk_flag prototype.
* libparted: gpt: avoid invalid free with many (~100) partitionsJim Meyering2012-01-231-1/+0
| | | | | | * parted/parted.c (do_print): Remove invalid free. Bug introduced via v1.8.8.1-19-gb56d69c. * NEWS (Bug fixes): Mention this.
* build: insert -I$(top_builddir)/include before -I$(top_srcdir)/includeKeshav P R2012-01-101-1/+2
| | | | | | | | | | | | | everywhere, for those who perform non-srcdir builds from a pristine cloned directory. There is no problem when building from a tarball, since that includes include/parted/*.h files under $(top_srcdir). * libparted/Makefile.am: Insert it. * libparted/fs/Makefile.am: Likewise. * libparted/labels/Makefile.am: Likewise. * libparted/tests/Makefile.am: Likewise. * parted/Makefile.am: Likewise. * partprobe/Makefile.am: Likewise. * tests/Makefile.am: Likewise.
* build: appease gcc's -Werror=suggest-attribute=pureJim Meyering2012-01-091-3/+3
| | | | | | * parted/strlist.c (wchar_strcasecmp): Add pure attribute; make static. (wchar_strncasecmp): Likewise. (wchar_strdup): Likewise.
* maint: update all copyright year number rangesJim Meyering2012-01-019-9/+9
| | | | Run "make update-copyright".
* build: address a new "noreturn" suggestionJim Meyering2011-12-031-1/+1
| | | | * parted/ui.h (help_msg): Declare as __noreturn__.
* build: mark functions with "const" or "pure" attribute, per gcc warningsJim Meyering2011-12-034-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use _GL_ATTRIBUTE_PURE or _GL_ATTRIBUTE_CONST. Mark static functions at point of definition; extern ones at point of declaration. * include/parted/crc32.h: * include/parted/device.h: Likewise. * include/parted/disk.h: Likewise. * include/parted/exception.h: Likewise. * include/parted/filesys.h: Likewise. * include/parted/geom.h: Likewise. * include/parted/natmath.h: Likewise. * include/parted/parted.h: Likewise. * include/parted/unit.h: Likewise. * libparted/arch/linux.c: Likewise. * libparted/disk.c: Likewise. * libparted/exception.c: Likewise. * libparted/fs/amiga/amiga.h: Likewise. * libparted/labels/aix.c: Likewise. * libparted/labels/bsd.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/dvh.c: Likewise. * libparted/labels/efi_crc32.c: Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/rdb.c: Likewise. * libparted/labels/sun.c: Likewise. * libparted/unit.c: Likewise. * parted/ui.c: Likewise. * parted/strlist.c: Likewise. * parted/strlist.h: Likewise. * libparted/tests/common.h (_implemented_disk_label): Mark as pure. * libparted/cs/natmath.c (extended_euclid): Mark as pure.
* build: avoid new float-to-double warningsJim Meyering2011-12-031-1/+1
| | | | | | * libparted/timer.c (ped_timer_new_nested): Mark literal floating point constants with "f" suffix, since they are compared against "float"s. * parted/parted.c (_timer_handler): Likewise.
* parted: exit nonzero for certain failures already diagnosed as "Error"Jim Meyering2011-11-031-3/+14
| | | | | | | | | * parted/parted.c (do_print): Do not exit successfully when issuing an error about an "unrecognised disk label" or when both GPT primary and backup tables are corrupted. * tests/t0101-print-empty.sh: Adjust expected exit code to match new behavior. * NEWS (Bug fixes): Mention this.
* parted: mkpart: DWIM for IEC ending sector numbers like 2MiB and 9GiBPetr Uzel2011-11-023-7/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, if the user specified start and end in mkpart command using IEC units, parted created a partition that starts and ends exactly on these positions. With such behavior, it is impossible to create partitions as follows: 1MiB-2MiB, 2MiB-3MiB - parted would complain that it cannot create the second partition, because the first one occupied sectors 2048-4096 and the second one sectors 4096-3072, so they would overlap at sector 4096. With this patch, if the user uses IEC units to specify end of the partition, parted creates the partition which ends one sector before the specified position. See also https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html * parted/ui.c (command_line_get_sector): Add parameter to retrieve raw input from user. * parted/ui.h (command_line_get_sector): Adjust prototype of function. * parted/parted.c (_adjust_end_if_iec): New function. (_strip_trailing_spaces): New function. (_string_ends_with_iec_unit): New function. (do_mkpart): Call _adjust_end_if_iec(). Use new parameter of command_line_get_sector function. (do_rescue): Adjust call to command_line_get_sector. * bootstrap.conf (gnulib_modules): Add these: c-ctype, c-strcase. * tests/t0207-IEC-binary-notation.sh: Adjust to new semantics. * NEWS: Mention the changed behavior. Notable adjustments: - s/isspace/c_isblank/ so that parsing is locale-independent - avoid an array-bounds error: * parted/parted.c (_strip_trailing_spaces): Don't deref str[-1] for an empty string.
* parted: write a few errors and warnings to stderr instead of stdoutRichard W.M. Jones2011-10-143-8/+8
|
* parted: strlist print functions can now send output to any FILE *Richard W.M. Jones2011-10-144-15/+15
| | | | | | This changes the two strlist print functions so that instead of just sending output to stdout, they can send it to any FILE *. Now the caller can send errors to stderr instead of stdout.
* parted: make a warning message more informativePetr Uzel2011-10-121-3/+7
| | | | | | | | | | | | | | | | | | | The following parted message is not very useful: Error: You requested a partition from 2.00MiB to 3.00MiB. The closest location we can manage is 2.00MiB to 3.00MiB. Improve the message by including exact geometry (in sectors): ...requested a partition from 2.00MiB to 3.00MiB (sectors 2048..3072). ... location we can manage is 2.00MiB to 3.00MiB (sectors 2049..3072). * parted/parted.c (do_mkpart): Include exact partition geometry in the warning message. * tests/t-lib-helpers.sh (normalize_part_diag_): Adapt to handle the new form of the diagnostic. * tests/t7000-scripting.sh: Adapt and change the name of a temporary file.
* parted: remove obsolete commentsPetr Uzel2011-10-011-7/+0
| | | | | | is_start_exact and is_end_exact were removed from the source. * parted/parted.c (constraint_from_start_end): Remove obsolete documentation of the function.
* libparted: differentiate between plain files and loop devicesPetr Uzel2011-09-291-1/+1
| | | | | | | | Stop using PED_DEVICE_FILE for loopback devices; loopback are significantly different from plain files. * include/parted/device.h (PedDeviceType): Add PED_DEVICE_LOOP. * libparted/arch/linux.c (_device_probe_type): Detect loopback device. * parted/parted.c (do_print): Add "loopback" to list of transports.
* remove all top-level FS-op code and the clearfat programJim Meyering2011-05-271-88/+0
|
* UI: remove all file-system-aware sub-commandsJim Meyering2011-05-271-680/+1
| | | | | | | | | | | | Note that we are removing the resize command, even though parted appears to be the only free tool that provides the ability to resize FAT16 and FAT32 file systems. * parted/parted.c (do_mkfs, do_cp, do_mkpartfs): Remove functions. (do_move, do_check, do_resize): Likewise. (_init_commands): Remove each command-definition clause. * parted/parted.c (_partition_warn_loss): Remove now-unused function. * include/parted/filesys.h: Remove declarations of now-removed FS-munging functions
* UI: avoid leak when interactive sector selection matches defaultJim Meyering2011-05-271-0/+1
| | | | * parted/ui.c (command_line_get_fs_type): Don't leak an input "word".
* UI: plug a leakJim Meyering2011-05-271-0/+1
| | | | | * parted/ui.c (command_line_get_fs_type): Don't leak an FS type name string.
* maint: correct coverity-reported "suspicious sizeof"Jim Meyering2011-05-271-1/+1
| | | | | * parted/table.c (table_add_row): Use sizeof(*VAR), rather than erroneous sizeof(explicit_type) that just happened to be ok.
* maint: avoid shadowing warningJim Meyering2011-03-161-2/+2
| | | | * parted/parted.c (do_mkpart): Rename inner added_ok to add_ok.
* build: don't let parted_CFLAGS override our AM_CFLAGS settingJim Meyering2011-03-161-3/+0
| | | | | * parted/Makefile.am (parted_CFLAGS): Remove unused (and interfering) definition.
* maint: avoid new compiler warningsJim Meyering2011-03-161-2/+1
| | | | | | * parted/parted.c (do_print): Remove now-unused "error" label. (_print_disk_info): Use one more "const" attribute, to avoid compiler warnings.
* parted: rework 'parted print' so that it works with empty diskPetr Uzel2011-03-161-57/+68
| | | | | | | | | | | | | | | | | | | | | | 'parted $dev print' on a device without a partition table used to fail with an 'unrecognised disk label' error, without printing the following: disk model, transport, size, sector size, BIOS geometry all of which are available, and do not dependent on the partition table. With this patch, parted prints all of this information (BIOS geometry only if 'unit cyl' is specified) and reports success even if the disk does not have a valid partition table. As a side efect, 'parted $dev print devices/all/list' now prints information about all the devices, even if $dev does not have a partition table. * parted/parted.c (_print_disk_info): New function. (do_print): Do not immediately fail if the partition table is not recognized, but print disk information and report success instead. * NEWS (Changes in behavior): Mention it. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* parted: factor out disk geometry printing into separate functionPetr Uzel2011-03-161-17/+23
| | | | | | | * parted/parted.c (_print_disk_geometry): New function. (do_print): Use _print_disk_geometry. Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* Remove PED_ASSERT action argumentBrian C. Lane2011-03-053-25/+23
| | | | | | The action argument was a leftover from when the PED_ASSERT macro was last changed. This removes that argument from the macro and from all occurrences of it.
* maint: update copyright year ranges to include 2011Jim Meyering2011-02-229-13/+9
| | | | Run "make update-copyright".
* parted: do_align_check returns always 1 in interactive modePetr Uzel2010-05-281-2/+6
| | | | * parted/parted.c (do_align_check): Always return 1 in interactive mode.
* parted: make align-check work in interactive modePetr Uzel2010-05-261-5/+16
| | | | | | * parted/parted.c (do_align_check): rework the function so that it reports partition alignment in interactive mode as described in documentation.
* parted: initialize align_type to default valuePetr Uzel2010-05-261-1/+1
| | | | | | * parted/parted.c (do_align_check): Initialize align_type to default alignment; this prevents reading of uninitialized memory later in command_line_get_align_type()
* parted: plug memory leakPetr Uzel2010-05-261-0/+1
| | | | * parted/parted.c (_done_messages): Free unit_msg.
* maint: remove useless definitionsJim Meyering2010-05-262-12/+0
| | | | | | | | | | * libparted/fs/xfs/platform_defs.h [__sparc__] (O_DIRECT): Remove now-unneeded definition. * parted/table.c (wchar_t): Remove definition. * parted/strlist.c (wchar_t): Likewise. * .x-sc_prohibit_always-defined_macros: New file. Exempt two files from this syntax-check rule. * Makefile.am (EXTRA_DIST): Add it here.
* ui: make --help tell where to report bugsJim Meyering2010-04-281-0/+1
| | | | * parted/ui.c (help_msg): Tell where to report bugs.
* maint: remove empty lines at end of fileJim Meyering2010-04-284-4/+0
| | | | | | This lets one more "syntax-check" test pass. Run this command: git ls-files|grep -v gnulib|xargs perl -pi -0777 -e 's/\n\n+$/\n/'
* doc: use a valid http:.../AUTHORS URLJim Meyering2010-04-271-1/+1
| | | | | | | | | * debug/clearfat/clearfat.c (AUTHORS): Point to the git repo. * parted/parted.c (AUTHORS): Likewise. * partprobe/partprobe.c (AUTHORS): Likewise. * parted/parted.c: Include "version.h". (_version): Use Version, not VERSION.
* ui: get version number from a separately-compiled fileJim Meyering2010-04-272-2/+27
| | | | | | | | | | * parted/Makefile.am (version.c, version.h): Generate. (parted_LDADD): Add libver.a. (noinst_LIBRARIES, nodist_libver_a_SOURCES): Define. (BUILT_SOURCES): Initialize and append. (MAINTAINERCLEANFILES): Update. * parted/parted.c: Include "version.h". (_version): Use the new global variable, Version, not VERSION.