summaryrefslogtreecommitdiff
path: root/libparted/labels/sun.c
Commit message (Collapse)AuthorAgeFilesLines
* maint: Update copyright statements to 2022Brian C. Lane2022-03-231-1/+1
| | | | By running make update-copyright
* maint: Update copyright statements to 2021Brian C. Lane2021-01-181-1/+1
| | | | By running make update-copyright
* maint: Update copyright statements to 2020Brian C. Lane2020-12-111-2/+2
| | | | By running make update-copyright
* maint: Update copyright statements to 2019Brian C. Lane2019-08-121-1/+2
| | | | By running make update-copyright
* sun.c: Aligned _SunRawLabel to 16bit boundaryBrian C. Lane2019-08-091-1/+1
|
* maint: run "make update-copyright"Jim Meyering2014-05-251-1/+1
|
* maint: update all copyright year number rangesJim Meyering2013-01-061-1/+1
| | | | Run "make update-copyright".
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* build: mark functions with "const" or "pure" attribute, per gcc warningsJim Meyering2011-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* sun: avoid NULL-deref-on-OOM and an error-path leakJim Meyering2011-05-271-3/+6
| | | | | * libparted/labels/sun.c (sun_read): Don't dereference NULL on OOM. Don't leak a constraint when failing to add a partition.
* maint: remove unreachable codeJim Meyering2011-05-271-1/+0
| | | | | * libparted/labels/sun.c (sun_partition_new): Remove unreachable stmt. * libparted/labels/pc98.c (pc98_partition_new): Likewise.
* Remove PED_ASSERT action argumentBrian C. Lane2011-03-051-20/+19
| | | | | | 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-221-2/+1
| | | | Run "make update-copyright".
* sun: revert "implement disk flag operations"Colin Watson2010-06-261-46/+1
| | | | | | | | This reverts the libparted/labels/sun.c part of 723ea23c5df68cbe67d1f518ef484f4c77f516fa. Sun disk labels do not appear to be able to handle non-cylinder alignment (http://bugs.debian.org/579948). * libparted/labels/sun.c: Revert.
* sun: initialize basic partition table fieldsKarel Zak2010-02-251-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | libparted completely ignores basic fields (version, nparts and sanity) in the sun VTOC, then for example fdisk prints warnings for such partition table: # fdisk -lu /dev/sdb Detected sun disklabel with wrong version [0x00000000]. Detected sun disklabel with wrong sanity [0x00000000]. Detected sun disklabel with wrong num_partitions [0]. It seems that the current libparted sun support follows old Linux kernel code, but the code was changed 3 years ago (see kernel commit 3961bae0ac030a70ae2e0578270203889021f1a1). Note that the number of partitions (nparts) is optional for Linux kernel, but fdisk(8) strictly requires SUN_DISK_MAXPARTITIONS (=8) there. This patch sets nparts to SUN_DISK_MAXPARTITIONS rather then use a real number of partitions. * NEWS (Bug fixes): Mention it. * libparted/labels/sun.c: Update from kernel. * tests/t4001-sun-vtoc.sh: New file. Test for this.
* maint: remove now-unused <partition_table_type>_clobber functionsJim Meyering2010-02-201-20/+1
| | | | | | | | | | | | | | | | | | All of these functions were rendered unused by commit 376b143045, "ped_disk_clobber: change semantics" on 2009-11-13. Also, Update each <...>_disk_ops "clobber:" member to be NULL. * libparted/labels/aix.c (aix_clobber): Remove function. * libparted/labels/bsd.c (bsd_clobber): Likewise. * libparted/labels/dasd.c (dasd_clobber): Likewise. * libparted/labels/dos.c (msdos_clobber): Likewise. * libparted/labels/dvh.c (dvh_clobber): Likewise. * libparted/labels/gpt.c (gpt_clobber): Likewise. * libparted/labels/loop.c (loop_clobber): Likewise. * libparted/labels/mac.c (_clobber_part_map, mac_clobber): Likewise. * libparted/labels/pc98.c (pc98_clobber): Likewise. * libparted/labels/rdb.c (amiga_clobber): Likewise. * libparted/labels/sun.c (sun_clobber): Likewise. Suggested by Hans De Goede.
* maint: update all FSF copyright year lists to include 2010Jim Meyering2010-01-081-1/+2
| | | | Run this command: make update-copyright
* maint: use "int", not "bool" for value returned by ped_device_writeJim Meyering2009-12-161-1/+1
| | | | | | * libparted/labels/gpt.c (gpt_write): Correct type of local. * libparted/labels/mac.c (mac_clobber): Likewise. * libparted/labels/sun.c (sun_write): Likewise.
* msdos, sun: implement disk flag operationsHans de Goede2009-12-101-6/+51
| | | | | | | | | | * libparted/labels/dos.c (DosDiskData): New struct. * libparted/labels/dos.c (msdos_alloc, msdos_duplicate, msdos_free): Handle per disk DosDiskData. * libparted/labels/dos.c (msdos_disk_set_flag, msdos_disk_get_flag, msdos_disk_is_flag_available): New functions. * libparted/labels/sun.c (sun_disk_set_flag, sun_disk_get_flag, sun_disk_is_flag_available): New functions.
* libparted: factor out duplication, hook up new APIsJim Meyering2009-12-081-35/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/parted/disk.h [struct _PedDiskOps]: (max_length, max_start_sector): New members. * libparted/labels/pt-common.h: New file. * libparted/labels/Makefile.am (liblabels_la_SOURCES): Add it. * libparted/labels/dos.c: Include "pt-common.h". (msdos_partition_check): Remove function. (msdos_disk_ops): Remove factored out initializers. * libparted/labels/gpt.c: Likewise. * libparted/labels/dvh.c: Likewise. * libparted/labels/aix.c: (aix_disk_ops, aix_partition_check): Likewise. * libparted/labels/bsd.c: (bsd_disk_ops, bsd_partition_check): Likewise. * libparted/labels/dasd.c: (dasd_disk_ops, dasd_partition_check): Likewise. * libparted/labels/loop.c: (loop_disk_ops, loop_partition_check): Likewise. * libparted/labels/mac.c: (mac_disk_ops, mac_partition_check): Likewise. * libparted/labels/pc98.c: (pc98_disk_ops, pc98_partition_check): Likewise. * libparted/labels/rdb.c: (amiga_disk_ops, amiga_partition_check): Likewise. * libparted/labels/sun.c: (sun_disk_ops, sun_partition_check): Likewise. * libparted/labels/gpt.c (NULL_IF_DISCOVER_ONLY): Remove definition, now that it's in pt-common.h.
* Implement get_partition_alignment DiskOp for all labels which need itHans de Goede2009-11-011-0/+10
| | | | | Implement get_partition_alignment DiskOp for all labels which require an alignment with a grain_size != 1.
* maint: update most copyright year lists to include 2009Jim Meyering2009-09-291-1/+1
| | | | | | I used this command: make update-copyright \ UPDATE_COPYRIGHT_FORCE=1 UPDATE_COPYRIGHT_USE_INTERVALS=1
* sun: don't read freed memoryJim Meyering2009-07-241-14/+21
| | | | | | | | * libparted/labels/sun.c (_use_old_info): Rename from _probe_and_use_old_info. Don't read sector 0 here. (sun_write): Read it here instead. Write not a constant-sized 512-byte buffer, but the sector-sized buffer just read above.
* sun: remove obsolete FIXME commentsJim Meyering2009-07-241-2/+2
| | | | * libparted/labels/sun.c:
* sun: don't segfault for sector sizes larger than 512Jim Meyering2009-07-241-40/+63
| | | | | | | | | | | | | | * libparted/labels/sun.c Include "pt-tools.h" and "verify.h". (sun_verify_checksum): Make parameter "const". (sun_probe): Don't always return 0, now that this code works. (sun_probe): Rewrite to work with sector sizes larger than 512. (_probe_and_use_old_info): Likewise. (sun_clobber): Likewise. (sun_read): Likewise. (_check_geometry_sanity) Don't accept all-zeros c,h,s. Add assertions and uses of verify. (sun_alloc): Remove bogus cast. Don't modify through const pointer.
* put partition-table-specific logic in the corresponding filesJoel Granados Moreno2009-07-241-0/+7
| | | | | | | | | | | | | | | | | | | * include/parted/disk.h (struct _PedDiskOps) [partition_check]: New member function. * libparted/disk.c (_check_partition): Replace open-coded tests with use of the new ->partition_check(). (_partition_max_start, _partition_max_len): Remove functions. * libparted/labels/dvh.c (dvh_partition_check): New function. * libparted/labels/dos.c (dos_partition_check): Likewise. * libparted/labels/aix.c (aix_partition_check): New stub. * libparted/labels/bsd.c (bsd_partition_check): Likewise. * libparted/labels/gpt.c (gpt_partition_check): Likewise. * libparted/labels/loop.c (loop_partition_check): Likewise. * libparted/labels/mac.c (mac_partition_check): Likewise. * libparted/labels/pc98.c (pc98_partition_check): Likewise. * libparted/labels/rdb.c (rdb_partition_check): Likewise. * libparted/labels/sun.c (sun_partition_check): Likewise.
* remove all trailing blanksJim Meyering2009-03-051-7/+7
| | | | | | ...by running these commands: t=$'\t' git grep -l "[ $t]\$"|xargs perl -pi -e 's/[ \t]+$//'
* rename all "support" parameters; avoid new compiler warningsJim Meyering2009-03-051-3/+4
| | | | | | | | | | | | | | | | | | | Change each occurrence like this (which evokes a warning from gcc): - return *supported = MAX_TOTAL_PART; to this: + *max_n = MAX_TOTAL_PART; + return true; I did it mostly mechanically: cd libparted/labels && grep -l 'return .supported = ' *.c|xargs perl -ni \ -e '$m=/^\treturn \*supported( = .*;)/;' \ -e 'print $m ? "\t*max_n$1\n\treturn true;\n" : $_' git grep -l 'int\* supported'|xargs perl -pi -e 's/int\* supported/int *max_n/' That got all but aix.c, which used different spacing: "int *supported", which I changed manually. Then I updated all copyright dates.
* Properly sync partitions with operating systemJoel Granados Moreno2009-03-051-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | * include/parted/disk.h: Add prototypes for new function. * libparted/disk.c (ped_disk_get_max_supported_partition_count): New function that calls the partition-table-specific function. * libparted/arch/linux.c (_disk_sync_part_table): To sync the table in disk with the kernel, we remove all partitions from the kernel table and then add the ones that are in disk. For this to happen we need to calculate the partition-table-type-specific maximum number of supported partitions. * libparted/labels/gpt.c (gpt_get_max_supported_partition_count): Read the gpt header from disk and calculate the maximum number of partitions it can accommodate. * libparted/labels/aix.c (get_max_supported_partition_count): New function. * libparted/labels/bsd.c: Likewise. * libparted/labels/dasd.c: Likewise. * libparted/labels/dos.c: Likewise. * libparted/labels/dvh.c: Likewise. * libparted/labels/gpt.c: Likewise. * libparted/labels/loop.c: Likewise. * libparted/labels/mac.c: Likewise. * libparted/labels/pc98.c: Likewise. * libparted/labels/rdb.c: Likewise. * libparted/labels/sun.c: Likewise.
* sun partition tables: add support for RAID partition typesTom "spot" Callaway2008-12-231-6/+35
| | | | | | | | | | | | | | | | | | | | | This patch enables RAID as a supported partition type on Sun disk layouts, commonly found/used on SPARC hardware. It has been tested on Aurora SPARC Linux (and Fedora SPARC). I have no idea if Solaris supports Software RAID or not... Along with the code change, I wrote a test case that checks if the RAID partition type is supported on sun disk labels. * libparted/labels/sun.c [_SunPartitionData] (is_raid): New member. (sun_read): Initialize the ->is_raid member. (sun_partition_new): Clear is_raid, like all the other members. (sun_partition_duplicate): Propagate the is_raid member. (sun_partition_set_system): Make sun_data->type reflect is_raid. (sun_partition_set_flag): Also initialize ->is_raid. (sun_partition_get_flag): Handle PED_PARTITION_RAID. (sun_partition_is_flag_available): Likewise. * tests/t4000-sun-raid-type.sh: New file. * tests/Makefile.am (TESTS): Add t4000-sun-raid-type.sh.
* don't call ped_partition_new with "0" as 2nd argJim Meyering2008-07-271-2/+3
| | | | | | | | | | | | | Instead, use an explicit and equivalent PED_PARTITION_NORMAL. * libparted/labels/bsd.c (bsd_read): * libparted/labels/dasd.c (dasd_read): * libparted/labels/gpt.c (_parse_part_entry): * libparted/labels/loop.c (loop_read): * libparted/labels/mac.c (_disk_add_part_map_entry) (_rawpart_analyse): * libparted/labels/pc98.c (read_table): * libparted/labels/rdb.c (amiga_read): * libparted/labels/sun.c (sun_read):
* Use free, not ped_free.Jim Meyering2008-05-291-5/+5
| | | | | | | * libparted/libparted.c (ped_free): Remove function. [DEBUG] (_check_dodgy_pointer): Remove function. Global substitution: perl -pi -e 's/\bped_free\b/free/g' $(lid -knone ped_free)
* Fix mkpart linux-swap bug: would use 0x83 rather than 0x82Jim Meyering2007-08-141-1/+3
| | | | | | | | | | | | | | | | * libparted/labels/bsd.c (bsd_partition_set_system): Include "misc.h". Use is_linux_swap to test whether the type string matches. * libparted/labels/dasd.c (dasd_read, dasd_partition_set_system): Likewise. * libparted/labels/dos.c (msdos_partition_set_system): Likewise. * libparted/labels/mac.c (mac_partition_set_system): Likewise. * libparted/labels/rdb.c (amiga_partition_set_system): Likewise. * libparted/labels/sun.c (sun_partition_set_system): Likewise. Based on a patch by Kenneth MacDonald, from <http://lists.gnu.org/archive/html/bug-parted/2007-07/msg00012.html>. * libparted/labels/misc.h (is_linux_swap): New function/file. * libparted/labels/Makefile.am (liblabels_la_SOURCES): Add misc.h. * tests/t2100-mkswap.sh: New file, test for the above fix. * tests/Makefile.am (TESTS): Add t2100-mkswap.sh.
* Updated GPL license boilerplate.David Cantrell2007-07-231-3/+2
|
* Use <config.h> consistently, not "config.h".Jim Meyering2007-03-071-1/+1
| | | | | * Makefile.cfg (local-checks-to-skip): Remove sc_require_config_h, to enable the "make distcheck" test for this.
* Begin making libparted/labels/*.c const-correct.Jim Meyering2007-03-051-3/+2
| | | | | | | For an introduction, see http://mail-archive.com/parted-devel@lists.alioth.debian.org/msg00930.html In particular, I've used a const-adding case in mac.c to work around the current, inconsistent semantics of mac_write.
* Avoid compiler warnings with gcc -Wall -Wshadow.Jim Meyering2007-02-161-3/+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>
* Fix the style of typedef, enum, struct and __attribute__ ((packed)).Debarshi Ray2007-02-161-10/+16
|
* Deprecating ped_[register|unregister]_disk_type in favour of ↵Debarshi Ray2007-02-151-2/+2
| | | | ped_disk_type_[register|unregister].
* Compile warning-free with "gcc -Wall -Wshadow".Jim Meyering2007-02-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, I find that keeping code warning-free (wrt gcc -Wall -Wshadow) makes it easier to avoid certain classes of bugs. Compiling with gcc -Wall -Wshadow evoked a few warnings on a Debian/unstable system. Here are patches to fix those: * libparted/exception.c (default_handler): Rename parameter "ex" to "e", to avoid shadowing file-scoped global. * libparted/fs/linux_swap/linux_swap.c (_generic_swap_probe): Add a "can't happen" (with current callers) "default: goto error" clause in a switch to avoid a may-be-used-uninitialized warning. (_generic_swap_clobber): Likewise. * libparted/fs/hfs/reloc_plus.c (hfsplus_pack_free_space_from_block): Rename local variable "div" to "divisor", to avoid shadowing the function in <stdlib.h>. * libparted/fs/hfs/reloc.c (hfs_pack_free_space_from_block): Likewise. * libparted/fs/hfs/cache.c (hfsc_cache_add_extent): Rename parameter "index" to "ref_index" to avoid shadowing the <string.h> function. * libparted/labels/sun.c (sun_partition_enumerate): Rename local variable "i" to "j", to avoid shadowing another local. Signed-off-by: Jim Meyering <jim@meyering.net>
* cb6ca73be06f360308e6a2fccb7142ed8175af29 continued.Debarshi Ray2007-01-161-2/+0
|
* Fix ChangeLogAnant Narayanan2006-09-141-0/+853
git-svn-id: svn://svn.debian.org/svn/parted/upstream/trunk@820 2d424fd7-7fe2-0310-af74-8bc65edeb173