summaryrefslogtreecommitdiff
path: root/libparted/labels/fdasd.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary if before free checksBrian C. Lane2019-08-091-8/+4
| | | | Caught by make syntax-check
* 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>
* libparted/dasd: update and improve fdasd functionsWang Dong2016-12-221-27/+29
| | | | | | | | | | | Update the fdasd_anchor_t data structure and the fdasd_cleanup() function. Also correct vtoc_changed and vlabel_changed accounting because they are important to rewrite vtoc to save the changes. Wang Dong <dongdwdw@linux.vnet.ibm.com> Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* fdasd.c: Safeguard against geometry misprobingViktor Mihajlovski2016-02-091-2/+9
| | | | | | | | | | | | Fixes an issue with parted print being run against a logical volume realised by extents on a physical volume residing on a DASD. We must make sure that geometry, device blocksize and DASD attributes are present before we start format verifications If any of it is missing this is not a DASD. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* fdasd: geometry handling updated from upstream s390-toolsViktor Mihajlovski2015-10-271-50/+116
| | | | | | | | | | | | | | | | | | | | | | | | Remove the necessity for DASD-specific ioctls for partition handling. This allows to correctly handle DASD-backed virtio block devices. Note that this is necessary because virtio is just the transport. A DASD, even if provided via virtio, still has it's unique characteristics, which means that only traditional DASD partition table formats can be used (no MBR, GPT, or similar). Use bzero for initialization to make sure all struct members are properly cleared. Also changed partition list handling code to be more similar to upstream s390-tools fdasd. Further, enhanced error handling capabilities by providing a return code by fdasd_get_geometry. Code is largely backported from s390-tools project. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Acked-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <bcl@redhat.com>
* libparted: mklabel to support EDEV DASDNageswara R Sastry2014-04-291-13/+15
| | | | | | | | Fixed Block Access (FBA) DASDs are mainframe-specific disk devices which are layed out as a sequence of 512-byte sectors. This patch adds support for mklabel to properly handle FBA devices. Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
* libparted: Avoid dasd as default disk type while probeNageswara R Sastry2014-04-291-1/+5
| | | | | | | This patch avoids setting 'dasd' as a default disk type for 'disk image file' at the time of probe. Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
* libparted: mklabel to support EAV DASDNageswara R Sastry2014-04-291-2/+90
| | | | | | | | Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for mklabel to properly handle unformatted EAV DASDs. Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
* libparted: add support for EAV DASD partitionsNageswara R Sastry2014-04-291-70/+156
| | | | | | | | | | | | | Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for recognizing and modifying partitions on EAV DASDs to Parted. The changes are based on the EAV support added to version 1.8.1 [1] of the s390-tools package. [1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
* libparted: add support for implicit FBA DASD partitionsNageswara R Sastry2014-04-291-0/+5
| | | | | | | | | | | | | | | | | | | | Fixed Block Access (FBA) DASDs are mainframe-specific disk devices which are layed out as a sequence of 512-byte sectors. In contrast to ECKD DASDs, these disks do not require formatting and resemble the LBA layout of non-mainframe disks. Despite this resemblance, the Linux kernel applies special handling during partition detection for FBA DASDs, resulting in a single, immutable partition being reported. While actual FBA DASD hardware is no longer available, the z/VM hypervisor can simulate FBA DASD disks, backed by either ECKD or SCSI devices. This patch adds support for recognizing FBA DASD partitions to parted. Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
* s390/dasd: avoid buffer overrun upon API mismatch diagnosticBrian C. Lane2011-04-211-1/+1
| | | | | | * libparted/labels/fdasd.c (fdasd_check_api_version): The static buffer for the error string was too small. Double its length. This resolves http://bugzilla.redhat.com/693852
* s390: avoid warningsJim Meyering2011-02-231-0/+1
| | | | | | | | | * libparted/labels/vtoc.c (vtoc_read_volume_label): Remove decl of unused var. * libparted/labels/fdasd.c (fdasd_valid_vtoc_pointer): Return a value also when successful. * libparted/labels/dasd.c (dasd_alloc_metadata): Initialize "part" to NULL solely to avoid a spurious used-uninitialized warning.
* s390: make DIAG driver work for FBA DASD with block size > 512Stephen Powell2011-02-231-5/+0
| | | | | | | | | | | | | | | | | | | | | In order to make the DIAG driver work for FBA DASD with a block size greater than 512, I had to make a rather awkward patch to C function vtoc_read_volume_label in libparted/labels/vtoc.c. The "right" logic would be "If this is an FBA DASD device using the DIAG driver, and the effective block size used by the DIAG driver is greater than 512, then do it this way. Else, do it the normal way." (Note that when using the FBA driver, the effective block size is always 512, regardless of the CMS logical block size stored in the volume label. The DIAG driver, on the other hand, honors the CMS logical block size.) The problem is that the information needed to make that decision has not been provided to the routine (via the parameter list). So what I ended up doing is assuming the normal way, then if I don't find a recognized volume label header (VOL1, LNX1, or CMS1, in EBCDIC), then I assumed that it must be the special case. So in the special case I end up doing an unnecessary read. It's a kludge, but it works.
* s390: improve/correct DASD supportStephen Powell2011-02-231-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The long title would be "corrections to partition size and location calculations for type 1 partitions for s390 dasd". This could be treated as two separate fixes, one to make corrections for LDL formatted disks and one to add support for CMS formatted disks. I see CMS formatted disks as a variant of LDL formatted disks, with the additional twist that CMS formatted disks can be reserved or recomped, which LDL formatted disks cannot be. This affects the size and location of the partition. With these patches, parted matches the behavior of the Linux kernel in recognizing partitions on CMS- and LDL-formatted disks, as documented in the Linux kernel source code in routine fs/partitions/ibm.c. Calculation of the metadata has also been changed so that parted will show no free space on such a disk. In some cases there are now two non-contiguous metadata extents: one at the beginning of the disk and one at the end. As before, parted only supports CKD DASD using the ECKD driver. FBA DASD and CKD DASD using the DIAG driver are still not supported. In my regression testing I have discovered some problems in the area of recognizing file system options. However, since I can duplicate these errors on a version of parted which does not contain my changes, I have concluded that my changes did not cause this and therefore this is an unrelated bug.
* dasd: allow the use of a *regular* backing fileJim Meyering2009-11-271-18/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change, dasd partition tables had to be associated with very specialized block devices available only on IBM s390 systems. This made testing especially hard. Not only did you need access to one of those relatively uncommon systems, but you also needed access to a spare block device. In addition, many of Parted's tests may be run as a non-privileged user, using regular files, and those tests would fail when run on an s390. This change makes it so you may now write a DASD partition table to a regular backing file, just as you may with any other supported partition table type. However, note that even now, DASD support is conditionally compiled and hence enabled only when compiling for an s390 target. * libparted/arch/linux.c (_device_set_sector_size) [__s390__]: Allow operation on a device of type PED_DEVICE_FILE, as well as those of type PED_DEVICE_DASD. * libparted/labels/fdasd.c: Include <parted/device.h>. (fdasd_get_geometry): Add a new "dev" parameter, required for dev-phys-sector_size, which is needed in order to initialize the "anc" structure without using the device-specific ioctls. When file descriptor "f" refers to a regular file, initialize "anc", "dasd_info", etc. from other sources (fstat and dev->). Update all callers to reflect added parameter. (fdasd_check_api_version): Skip ioctl-calling tests when "f" is a regular file. * include/parted/fdasd.h: Update fdasd_get_geometry prototype. * libparted/labels/dasd.c (dasd_probe): Also allow PED_DEVICE_FILE. (dasd_alloc_metadata): Initialize arch_specific->real_sector_size, which is used in calculating vtoc_end. Reviewed-by: Karel Zak <kzak@redhat.com>
* maint: fix s390-specific const correctness problemsJim Meyering2009-11-101-1/+1
| | | | | | | | * libparted/labels/vtoc.c (vtoc_error, vtoc_ebcdic_enc): (vtoc_ebcdic_dec): Declare parameters to be const, as required. * libparted/labels/fdasd.c (fdasd_error): Likewise. * include/parted/vtoc.h (vtoc_ebcdic_enc, vtoc_ebcdic_enc): Update prototypes.
* Fix 2 typos.Gilles Espinasse2009-08-211-1/+1
| | | | | | * libparted/labels/fdasd.c (fdasd_enqueue_new_partition): Fix typo in comment. * parted/parted.c (_init_commands): Fix typo in message.
* Avoid compilation failure on s390Otavio Salvador2009-07-191-1/+1
| | | | | | | | | | | | | | | To export LinuxSpecific stuff for labels, in this case fdasd, we now provide arch/linux.h. This aids in avoiding code duplication. * configure.ac: add BUILD_LINUX conditional. * libparted/Makefile.am: conditionally use linux.h. * libparted/arch/linux.c: move LinuxSpecific stuff to linux.h. * libparted/arch/linux.h: New file. * libparted/labels/Makefile.am: include from libparted as well. * libparted/labels/dasd.c: use arch/linux.h and use dev->path for error message. * libparted/labels/fdasd.c: include linux.h and drop an unused variable.
* remove all trailing blanksJim Meyering2009-03-051-54/+54
| | | | | | ...by running these commands: t=$'\t' git grep -l "[ $t]\$"|xargs perl -pi -e 's/[ \t]+$//'
* Remove useless "if" tests before free.Jim Meyering2008-04-301-11/+4
| | | | | | | * libparted/arch/linux.c (_dm_add_partition): Remove useless test. * libparted/labels/fdasd.c (fdasd_cleanup): Likewise. * m4/o-direct.m4 (parted_FIND_USABLE_TEST_DIR): Likewise. * parted/table.c (table_destroy): Likewise.
* Fix syntax error.Bastian Blank2008-04-071-1/+1
|
* fdasd label: Move formatting out of translatable strings.Benno Schulenberg2007-05-291-46/+43
| | | | | | Also gettextize several missed messages, and simplify some of them. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
* Preventing compilation of DASD code on GNU Hurd systems through the use of ↵Debarshi Ray2007-05-081-5/+0
| | | | AC_COMPILE_IFELSE and AM_CONDITIONAL, instead of #ifdef.
* Conditionalize the System Z stuff correctly. We get headers installed on ↵David Cantrell2007-03-191-0/+5
| | | | non-System Z platforms, but the code only compiles on that platform.
* Include <config.h> from every .c file:Jim Meyering2007-02-251-0/+1
| | | | | | | | | | | | | | | * libparted/unit.c, libparted/timer.c: * libparted/cs/natmath.c, libparted/cs/constraint.c: * libparted/tests/label.c, libparted/tests/common.c: * libparted/fs/fat/count.c, libparted/fs/fat/bootsector.c: * libparted/fs/fat/context.c, libparted/fs/fat/fatio.c: * libparted/fs/fat/fat.c, libparted/fs/fat/clstdup.c: * libparted/fs/fat/resize.c, libparted/fs/fat/traverse.c: * libparted/fs/fat/table.c, libparted/fs/fat/calc.c: * libparted/fs/amiga/amiga.c, libparted/labels/fdasd.c: * libparted/labels/dvh.c, libparted/labels/efi_crc32.c: * libparted/labels/vtoc.c, parted/command.c: * libparted/tests/label.c, libparted/tests/common.c:
* Avoid compiler warnings with gcc -Wall -Wshadow.Jim Meyering2007-02-161-101/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libparted/arch/linux.c (init_ide): Add missing "break" at end of final case: stmt. Add "default:" in the same switch to avoid a compiler warning. * libparted/fs/fat/bootsector.c (fat_boot_sector_analyse): Likewise. * libparted/fs/fat/resize.c (ask_type): Likewise. * libparted/fs/fat/traverse.c (fat_dir_entry_set_first_cluster): Likewise. * debug/clearfat/clearfat.c (_calc_fat_entry_offset): Likewise. * parted/parted.c (_timer_handler): Cast time_t values to "int" to agree with %d printf format. (g_timer): Rename file-scoped global from shadowed "timer". Update all uses of the global. (version_msg): Remove decl of unused global. * parted/ui.c (current_exception_opt): Remove decl of unused global. * libparted/filesys.c (ped_file_system_close): Remove unused label. * libparted/unit.c (parse_chs): Likewise. * libparted/debug.c (ped_assert): Use "int" as type of backtrace return value, not size_t. * libparted/fs/reiserfs/reiserfs.c (reiserfs_check): Guard declaration of local with #ifdef HAVE_REISERFS_FS_CHECK, since it's used only in a similarly-guarded block. (reiserfs_fs_check): Likewise for this file-scoped global. Avoid warnings about unused file-scoped global variables. * libparted/fs/hfs/hfs.h (hfs_type, hfsplus_type): Remove these declarations of file-scoped static variables. * libparted/fs/hfs/hfs.c: Put them here, instead. * libparted/fs/fat/table.c (_test_code_active): Remove unused function. * libparted/arch/linux.c: Add casts to avoid performing pointer arithmetic on "void *" pointers. * libparted/fs/hfs/file_plus.c (hfsplus_file_read): Don't do pointer arithmetic on a "void *" pointer. (hfsplus_file_write): Likewise. * libparted/fs/fat/count.c (flag_traverse_dir): Move decl of unused local into #if-0'd block where it is referenced. (print_chain): Guard definition with #ifdef PED_VERBOSE, since the sole use of this function is guarded the same way. * libparted/fs/amiga/amiga.c: (_amiga_valid_block_id): Remove unused function. (_amiga_get_bstr): Likewise. (_amiga_set_bstr): Likewise. Remove unused labels and/or declarations of unused variables. * parted/ui.c (_readline): Likewise. * libparted/cs/constraint.c (_constraint_get_canonical_start_range): Likewise. * libparted/cs/geom.c (ped_geometry_read): Likewise. * libparted/fs/amiga/apfs.c (_generic_apfs_probe): Likewise. * libparted/fs/ext2/ext2_mkfs.c (ext2_mkfs_write_meta): Likewise. * libparted/disk.c: Likewise. * libparted/fs/hfs/hfs.c: Likewise. * libparted/fs/fat/fat.c: Likewise. * libparted/fs/fat/clstdup.c: Likewise. * libparted/fs/fat/calc.c: Likewise. * libparted/fs/ext2/ext2.c: Likewise. * libparted/fs/amiga/affs.c: Likewise. * libparted/fs/amiga/asfs.c: Likewise. * libparted/labels/aix.c: Likewise. * libparted/labels/sun.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/loop.c (loop_alloc): Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/dvh.c (dvh_alloc): Likewise. (dvh_read) [!DISCOVER_ONLY]: Add "default:" in a switch. * libparted/labels/fdasd.c (fdasd_reread_partition_table): Remove decl of unused local(s). (fdasd_get_partition_data): Likewise. (fdasd_partition_type): Remove unused function. (fdasd_write_vtoc_labels): Likewise. (fdasd_change_volser): Likewise. (fdasd_check_volser): Likewise. (fdasd_reread_partition_table): Likewise. Signed-off-by: Jim Meyering <jim@meyering.net>
* * libparted/labels/fdasd.c (GETARG): Remove unused definition.Jim Meyering2007-02-131-2/+0
| | | | | | A tiny change... Signed-off-by: Jim Meyering <jim@meyering.net>
* Fix ChangeLogAnant Narayanan2006-09-141-0/+1153
git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@820 2d424fd7-7fe2-0310-af74-8bc65edeb173