diff options
author | Jim Meyering <meyering@redhat.com> | 2009-03-05 19:22:39 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-03-05 20:45:57 +0100 |
commit | 099eaa4acd0d8ca10ec48f67c13382ffb556b703 (patch) | |
tree | 258d566cf610167d1433f3e7431bc1ed7b520c9d /libparted/labels | |
parent | bcc72af3370b9511351b451e3c96c8375346ff7c (diff) | |
download | parted-099eaa4acd0d8ca10ec48f67c13382ffb556b703.tar.gz |
remove all trailing blanks
...by running these commands:
t=$'\t'
git grep -l "[ $t]\$"|xargs perl -pi -e 's/[ \t]+$//'
Diffstat (limited to 'libparted/labels')
-rw-r--r-- | libparted/labels/aix.c | 2 | ||||
-rw-r--r-- | libparted/labels/bsd.c | 24 | ||||
-rw-r--r-- | libparted/labels/dos.c | 20 | ||||
-rw-r--r-- | libparted/labels/dvh.c | 4 | ||||
-rw-r--r-- | libparted/labels/dvh.h | 2 | ||||
-rw-r--r-- | libparted/labels/efi_crc32.c | 2 | ||||
-rw-r--r-- | libparted/labels/fdasd.c | 108 | ||||
-rw-r--r-- | libparted/labels/gpt.c | 96 | ||||
-rw-r--r-- | libparted/labels/loop.c | 4 | ||||
-rw-r--r-- | libparted/labels/mac.c | 10 | ||||
-rw-r--r-- | libparted/labels/pc98.c | 10 | ||||
-rw-r--r-- | libparted/labels/rdb.c | 34 | ||||
-rw-r--r-- | libparted/labels/sun.c | 14 | ||||
-rw-r--r-- | libparted/labels/vtoc.c | 220 |
14 files changed, 275 insertions, 275 deletions
diff --git a/libparted/labels/aix.c b/libparted/labels/aix.c index 465cb6c..de81270 100644 --- a/libparted/labels/aix.c +++ b/libparted/labels/aix.c @@ -115,7 +115,7 @@ static PedDisk* aix_duplicate (const PedDisk* disk) { PedDisk* new_disk; - + new_disk = ped_disk_new_fresh (disk->dev, &aix_disk_type); if (!new_disk) return NULL; diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c index 83e1709..3d6b5ab 100644 --- a/libparted/labels/bsd.c +++ b/libparted/labels/bsd.c @@ -74,7 +74,7 @@ struct _BSDRawLabel { int16_t d_type; /* drive type */ int16_t d_subtype; /* controller/d_type specific */ int8_t d_typename[16]; /* type name, e.g. "eagle" */ - int8_t d_packname[16]; /* pack identifier */ + int8_t d_packname[16]; /* pack identifier */ uint32_t d_secsize; /* # of bytes per sector */ uint32_t d_nsectors; /* # of data sectors per track */ uint32_t d_ntracks; /* # of tracks per cylinder */ @@ -97,7 +97,7 @@ struct _BSDRawLabel { uint32_t d_spare[NSPARE]; /* reserved for future use */ uint32_t d_magic2; /* the magic number (again) */ uint16_t d_checksum; /* xor of data incl. partitions */ - + /* file system and partition information: */ uint16_t d_npartitions; /* number of partitions in following */ uint32_t d_bbsize; /* size of boot area at sn0, bytes */ @@ -123,7 +123,7 @@ static unsigned short xbsd_dkcksum (BSDRawLabel *lp) { unsigned short *start, *end; unsigned short sum = 0; - + lp->d_checksum = 0; start = (u_short*) lp; end = (u_short*) &lp->d_partitions [ @@ -138,7 +138,7 @@ static void alpha_bootblock_checksum (char *boot) { uint64_t *dp, sum; int i; - + dp = (uint64_t *)boot; sum = 0; for (i = 0; i < 63; i++) @@ -164,7 +164,7 @@ bsd_probe (const PedDevice *dev) label = (BSDRawLabel *) (boot + BSD_LABEL_OFFSET); alpha_bootblock_checksum(boot); - + /* check magic */ if (PED_LE32_TO_CPU (label->d_magic) != BSD_DISKMAGIC) return 0; @@ -209,18 +209,18 @@ bsd_alloc (const PedDevice* dev) = PED_CPU_TO_LE32 (dev->bios_geom.sectors * dev->bios_geom.heads * dev->bios_geom.cylinders); - + label->d_rpm = PED_CPU_TO_LE16 (3600); label->d_interleave = PED_CPU_TO_LE16 (1);; label->d_trackskew = 0; label->d_cylskew = 0; label->d_headswitch = 0; label->d_trkseek = 0; - + label->d_magic2 = PED_CPU_TO_LE32 (BSD_DISKMAGIC); label->d_bbsize = PED_CPU_TO_LE32 (BSD_BBSIZE); label->d_sbsize = PED_CPU_TO_LE32 (BSD_SBSIZE); - + label->d_npartitions = 0; label->d_checksum = xbsd_dkcksum (label); return disk; @@ -237,7 +237,7 @@ bsd_duplicate (const PedDisk* disk) PedDisk* new_disk; BSDDiskData* new_bsd_data; BSDDiskData* old_bsd_data = (BSDDiskData*) disk->disk_specific; - + new_disk = ped_disk_new_fresh (disk->dev, &bsd_disk_type); if (!new_disk) return NULL; @@ -274,7 +274,7 @@ bsd_read (PedDisk* disk) BSDDiskData* bsd_specific = (BSDDiskData*) disk->disk_specific; BSDRawLabel* label; int i; - + ped_disk_delete_all (disk); if (!ped_device_read (disk->dev, bsd_specific->boot_code, 0, 1)) @@ -302,7 +302,7 @@ bsd_read (PedDisk* disk) bsd_part_data->type = label->d_partitions[i - 1].p_fstype; part->num = i; part->fs_type = ped_file_system_probe (&part->geom); - + constraint_exact = ped_constraint_exact (&part->geom); if (!ped_disk_add_partition (disk, part, constraint_exact)) goto error; @@ -585,7 +585,7 @@ bsd_partition_enumerate (PedPartition* part) { int i; PedPartition* p; - + /* never change the partition numbers */ if (part->num != -1) return 1; diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index a0044b7..d07dcbd 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -251,7 +251,7 @@ static PedDisk* msdos_duplicate (const PedDisk* disk) { PedDisk* new_disk; - + new_disk = ped_disk_new_fresh (disk->dev, &msdos_disk_type); if (!new_disk) return NULL; @@ -333,7 +333,7 @@ sector_to_chs (const PedDevice* dev, const PedCHSGeometry* bios_geom, PED_ASSERT (dev != NULL, return); PED_ASSERT (chs != NULL, return); - + if (!bios_geom) bios_geom = &dev->bios_geom; @@ -461,7 +461,7 @@ probe_filesystem_for_geom (const PedPartition* part, PedCHSGeometry* bios_geom) return 0); buf = ped_malloc (part->disk->dev->sector_size); - + if (!buf) return 0; @@ -515,14 +515,14 @@ end: * * [ c h ] [ cyl_sectors ] = [ s - a ] = [ a_ ] * [ C H ] [ head_sectors ] [ S - A ] [ A_ ]. - * + * * (s - a is abbreviated to a_to simplify the notation.) * * This can be abbreviated into augmented matrix form: * * [ c h | a_ ] * [ C H | A_ ]. - * + * * Solving these equations requires following the row reduction algorithm. We * need to be careful about a few things though: * - the equations might be linearly dependent, in which case there @@ -632,7 +632,7 @@ probe_partition_for_geom (const PedPartition* part, PedCHSGeometry* bios_geom) head_size = ( a_ - c * cyl_size ) / h; else if (H > 0) head_size = ( A_ - C * cyl_size ) / H; - else { + else { /* should not happen because denum != 0 */ head_size = 0; PED_ASSERT (0, return 0); @@ -878,7 +878,7 @@ read_table (PedDisk* disk, PedSector sector, int is_extended_table) * partitions, to make sure we get the order right. */ if (is_extended_table && raw_part_is_extended (raw_part)) - continue; + continue; lba_offset = is_extended_table ? sector : 0; @@ -1780,7 +1780,7 @@ _logical_min_start_head (const PedPartition* part, * 2)*The partition table of part5 is always at the beginning of the ext_part * so there is no need to leave a one sector gap before part5. * *There always is a partition table at the beginning of each partition != 5. - * We don't need to worry to much about consistency with + * We don't need to worry to much about consistency with * _partition_get_overlap_constraint because missing it means we are in edge * cases anyway, and we don't lose anything by just refusing to do the job in * those cases. @@ -2002,7 +2002,7 @@ msdos_partition_align (PedPartition* part, const PedConstraint* constraint) return 1; if (_align_no_geom (part, constraint)) return 1; - + #ifndef DISCOVER_ONLY ped_exception_throw ( PED_EXCEPTION_ERROR, @@ -2143,7 +2143,7 @@ msdos_alloc_metadata (PedDisk* disk) int i; PedSector start, end; PedCHSGeometry bios_geom; - + for (i=5; 1; i++) { PedPartition* log_part; log_part = ped_disk_get_partition (disk, i); diff --git a/libparted/labels/dvh.c b/libparted/labels/dvh.c index 38b7569..93de8f9 100644 --- a/libparted/labels/dvh.c +++ b/libparted/labels/dvh.c @@ -474,8 +474,8 @@ dvh_write (const PedDisk* disk) } /* whole disk partition - * This is only ever written here, and never modified - * (or even shown) as it must contain the entire disk, + * This is only ever written here, and never modified + * (or even shown) as it must contain the entire disk, * and parted does not like overlapping partitions */ vh.vh_pt[PNUM_VOLUME].pt_nblks = PED_CPU_TO_BE32 (disk->dev->length); diff --git a/libparted/labels/dvh.h b/libparted/labels/dvh.h index 992f3ee..4c25c99 100644 --- a/libparted/labels/dvh.h +++ b/libparted/labels/dvh.h @@ -26,7 +26,7 @@ * media (sector 0). It contains information pertaining to physical * device parameters and logical partition information. * - * The volume header is manipulated by disk formatters/verifiers, + * The volume header is manipulated by disk formatters/verifiers, * partition builders (e.g. fx, dvhtool, and mkfs), and disk drivers. * * Previous versions of IRIX wrote a copy of the volume header is diff --git a/libparted/labels/efi_crc32.c b/libparted/labels/efi_crc32.c index 327fb2d..bf1249f 100644 --- a/libparted/labels/efi_crc32.c +++ b/libparted/labels/efi_crc32.c @@ -1,4 +1,4 @@ -/* +/* * Dec 5, 2000 Matt Domsch <Matt_Domsch@dell.com> * - Copied crc32.c from the linux/drivers/net/cipe directory. * - Now pass seed as an arg diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c index 2b876e5..40ba8c9 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -13,7 +13,7 @@ * 2001-06-26 '-a' option added, it is now possible to add a single * partition in non-interactive mode * 2001-06-26 long parameter support added - * + * */ #include <config.h> @@ -58,7 +58,7 @@ setpos (fdasd_anchor_t *anc, int dsn, int pos) } void -fdasd_cleanup (fdasd_anchor_t *anchor) +fdasd_cleanup (fdasd_anchor_t *anchor) { PDEBUG int i; @@ -85,8 +85,8 @@ fdasd_cleanup (fdasd_anchor_t *anchor) } } -static void -fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str) +static void +fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str) { PDEBUG char error[2*LINE_LENGTH], *message = error; @@ -110,23 +110,23 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str) case api_version_mismatch: sprintf(error, "fdasd: %s -- %s\n", _("API version mismatch"), str); - break; + break; case wrong_disk_type: sprintf(error, "fdasd: %s -- %s\n", _("Unsupported disk type"), str); - break; + break; case wrong_disk_format: sprintf(error, "fdasd: %s -- %s\n", _("Unsupported disk format"), str); - break; + break; case disk_in_use: sprintf(error, "fdasd: %s -- %s\n", _("Disk is in use"), str); - break; + break; case config_syntax_error: sprintf(error, "fdasd: %s -- %s\n", _("Syntax error in config file"), str); - break; + break; case vlabel_corrupted: sprintf(error, "fdasd: %s -- %s\n", _("Volume label is corrupted"), str); @@ -144,7 +144,7 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str) _("Device verification failed"), _("The specified device is not a valid DASD device")); break; - default: + default: sprintf(error, "fdasd: %s: %s\n", _("Fatal error"), str); } @@ -154,8 +154,8 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char * str) /* * converts cyl-cyl-head-head-blk to blk */ -static unsigned long -cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) +static unsigned long +cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) { PDEBUG return (unsigned long) (p->cc * geo->heads * geo->sectors @@ -167,7 +167,7 @@ cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) * memory for the labels */ void -fdasd_initialize_anchor (fdasd_anchor_t * anc) +fdasd_initialize_anchor (fdasd_anchor_t * anc) { PDEBUG int i; @@ -203,15 +203,15 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) bzero(anc->confdata, sizeof(config_data_t)); anc->f4 = malloc(sizeof(format4_label_t)); - if (anc->f4 == NULL) + if (anc->f4 == NULL) fdasd_error(anc, malloc_failed, "FMT4 DSCB."); anc->f5 = malloc(sizeof(format5_label_t)); - if (anc->f5 == NULL) + if (anc->f5 == NULL) fdasd_error(anc, malloc_failed, "FMT5 DSCB."); anc->f7 = malloc(sizeof(format7_label_t)); - if (anc->f7 == NULL) + if (anc->f7 == NULL) fdasd_error(anc, malloc_failed, "FMT7 DSCB."); bzero(anc->f4, sizeof(format4_label_t)); @@ -219,7 +219,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) bzero(anc->f7, sizeof(format7_label_t)); v = malloc(sizeof(volume_label_t)); - if (v == NULL) + if (v == NULL) fdasd_error(anc, malloc_failed, _("No room for volume label.")); bzero(v, sizeof(volume_label_t)); @@ -227,7 +227,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) for (i=1; i<=USABLE_PARTITIONS; i++) { p = malloc(sizeof(partition_info_t)); - if (p == NULL) + if (p == NULL) fdasd_error(anc, malloc_failed, _("No room for partition info.")); p->used = 0x00; @@ -251,10 +251,10 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) } p->f1 = malloc(sizeof(format1_label_t)); - if (p->f1 == NULL) + if (p->f1 == NULL) fdasd_error(anc, malloc_failed, "FMT1 DSCB."); bzero(p->f1, sizeof(format1_label_t)); - + q = p; } } @@ -264,13 +264,13 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) */ static void fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) -{ +{ PDEBUG partition_info_t *p; unsigned long b; char dsno[6], s1[7], s2[45], *c1, *c2, *ch; int i = 0, k = 0; - + b = (cchhb2blk (&anc->vlabel->vtoc, &anc->geo) - 1) * anc->blksize; if (b <= 0) fdasd_error (anc, vlabel_corrupted, ""); @@ -297,13 +297,13 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); continue; } - + strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); ch = p->f1->DS1DSNAM; vtoc_ebcdic_dec (ch, ch, 44); c1 = ch + 7; - + if (getdsn (anc, i) > -1) { /* re-use the existing data set name */ c2 = strchr (c1, '.'); @@ -389,7 +389,7 @@ fdasd_write_labels (fdasd_anchor_t * anc, int fd) * writes all changes to dasd */ int -fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) +fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) { PDEBUG partition_info_t *p = anc->first; @@ -404,7 +404,7 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) ch = p->f1->DS1DSNAM; vtoc_ebcdic_dec (ch, ch, 44); c1 = ch + 7; - + if (getdsn (anc, i) > -1) { /* re-use the existing data set name */ c2 = strchr (c1, '.'); @@ -487,7 +487,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) vtoc_init_format5_label(anc->f5); vtoc_init_format7_label(anc->f7); - vtoc_set_freespace(anc->f4, anc->f5, anc->f7, + vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, FIRST_USABLE_TRK, anc->geo.cylinders * anc->geo.heads - 1, @@ -520,7 +520,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) * information provided in the labels */ static void -fdasd_update_partition_info (fdasd_anchor_t *anc) +fdasd_update_partition_info (fdasd_anchor_t *anc) { PDEBUG partition_info_t *q = NULL, *p = anc->first; @@ -580,11 +580,11 @@ fdasd_update_partition_info (fdasd_anchor_t *anc) } /* - * reorganizes all FMT1s, after that all used FMT1s should be right in + * reorganizes all FMT1s, after that all used FMT1s should be right in * front of all unused FMT1s */ static void -fdasd_reorganize_FMT1s (fdasd_anchor_t *anc) +fdasd_reorganize_FMT1s (fdasd_anchor_t *anc) { PDEBUG int i, j; @@ -693,7 +693,7 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) PDEBUG char str[LINE_LENGTH]; - /* VOL1 label contains valid VTOC pointer */ + /* VOL1 label contains valid VTOC pointer */ vtoc_read_label (fd, b, NULL, anc->f4, NULL, NULL); if (anc->f4->DS4IDFMT != 0xf4) { @@ -710,8 +710,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) /* * check the dasd for a volume label */ -int -fdasd_check_volume (fdasd_anchor_t *anc, int fd) +int +fdasd_check_volume (fdasd_anchor_t *anc, int fd) { PDEBUG volume_label_t *v = anc->vlabel; @@ -751,31 +751,31 @@ fdasd_check_api_version (fdasd_anchor_t *anc, int f) PDEBUG int api; char s[LINE_LENGTH]; - + if (ioctl(f, DASDAPIVER, &api) != 0) fdasd_error(anc, unable_to_ioctl, _("Could not retrieve API version.")); - + if (api != DASD_MIN_API_VERSION) { sprintf(s, _("The current API version '%d' doesn't " \ "match dasd driver API version " \ "'%d'!"), api, DASD_MIN_API_VERSION); fdasd_error(anc, api_version_mismatch, s); } -} +} /* * reads dasd geometry data */ -void -fdasd_get_geometry (fdasd_anchor_t *anc, int f) +void +fdasd_get_geometry (fdasd_anchor_t *anc, int f) { PDEBUG int blksize = 0; dasd_information_t dasd_info; char s[LINE_LENGTH]; - if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) + if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) fdasd_error(anc, unable_to_ioctl, _("Could not retrieve disk geometry information.")); @@ -784,8 +784,8 @@ fdasd_get_geometry (fdasd_anchor_t *anc, int f) _("Could not retrieve blocksize information.")); /* get disk type */ - if (ioctl(f, BIODASDINFO, &dasd_info) != 0) - fdasd_error(anc, unable_to_ioctl, + if (ioctl(f, BIODASDINFO, &dasd_info) != 0) + fdasd_error(anc, unable_to_ioctl, _("Could not retrieve disk information.")); if (strncmp(dasd_info.type, "ECKD", 4) != 0) @@ -804,12 +804,12 @@ fdasd_get_geometry (fdasd_anchor_t *anc, int f) * returns unused partition info pointer if there * is a free partition, otherwise NULL */ -static partition_info_t * -fdasd_get_empty_f1_label (fdasd_anchor_t * anc) +static partition_info_t * +fdasd_get_empty_f1_label (fdasd_anchor_t * anc) { PDEBUG - if (anc->used_partitions < USABLE_PARTITIONS) - return anc->last; + if (anc->used_partitions < USABLE_PARTITIONS) + return anc->last; else return NULL; } @@ -817,10 +817,10 @@ fdasd_get_empty_f1_label (fdasd_anchor_t * anc) /* * asks for and sets some important partition data */ -static int +static int fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent, partition_info_t *p, unsigned int *start_ptr, - unsigned int *stop_ptr) + unsigned int *stop_ptr) { PDEBUG unsigned int limit, cc, hh; @@ -877,7 +877,7 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent, vtoc_set_cchh(&llimit, cc, hh); /* check for cylinder boundary */ - if (hh == 0) + if (hh == 0) b1 = 0x81; else b1 = 0x01; @@ -914,7 +914,7 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent, } static void -fdasd_enqueue_new_partition (fdasd_anchor_t *anc) +fdasd_enqueue_new_partition (fdasd_anchor_t *anc) { PDEBUG partition_info_t *q = anc->first, *p = anc->last; @@ -923,7 +923,7 @@ fdasd_enqueue_new_partition (fdasd_anchor_t *anc) for (i=1; i<USABLE_PARTITIONS; i++) { if ((q->end_trk == 0) || (p->start_trk < q->start_trk)) { break; - } else { + } else { q = q->next; k++; } @@ -931,7 +931,7 @@ fdasd_enqueue_new_partition (fdasd_anchor_t *anc) if (anc->first == q) anc->first = p; - + if (p != q) { anc->last->prev->next = NULL; anc->last = anc->last->prev; @@ -939,7 +939,7 @@ fdasd_enqueue_new_partition (fdasd_anchor_t *anc) p->next = q; p->prev = q->prev; q->prev = p; - + if (p->prev != NULL) p->prev->next = p; } @@ -986,7 +986,7 @@ fdasd_enqueue_new_partition (fdasd_anchor_t *anc) */ partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, - unsigned int stop) + unsigned int stop) { PDEBUG cchhb_t hf1; @@ -1010,7 +1010,7 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, PDEBUG; fdasd_enqueue_new_partition(anc); - + PDEBUG; anc->used_partitions += 1; diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index cc03b0b..765c8a5 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -172,9 +172,9 @@ struct __attribute__ ((packed)) _GuidPartitionEntry_t { #define GPT_PMBR_SECTORS 1 #define GPT_PRIMARY_HEADER_LBA 1 #define GPT_HEADER_SECTORS 1 -#define GPT_PRIMARY_PART_TABLE_LBA 2 +#define GPT_PRIMARY_PART_TABLE_LBA 2 -/* +/* These values are only defaults. The actual on-disk structures may define different sizes, so use those unless creating a new GPT disk! */ @@ -285,7 +285,7 @@ pth_new (const PedDevice* dev) GuidPartitionTableHeader_t* pth = ped_malloc ( sizeof (GuidPartitionTableHeader_t) + sizeof (uint8_t)); - + pth->Reserved2 = ped_malloc ( pth_get_size_rsv2 (dev) ); return pth; @@ -296,25 +296,25 @@ static GuidPartitionTableHeader_t* pth_new_zeroed (const PedDevice* dev) { GuidPartitionTableHeader_t* pth = pth_new (dev); - + memset (pth, 0, pth_get_size_static (dev)); - memset (pth->Reserved2, 0, pth_get_size_rsv2 (dev)); - + memset (pth->Reserved2, 0, pth_get_size_rsv2 (dev)); + return (pth); } - + static GuidPartitionTableHeader_t* pth_new_from_raw (const PedDevice* dev, const uint8_t* pth_raw) { - GuidPartitionTableHeader_t* pth = pth_new (dev); + GuidPartitionTableHeader_t* pth = pth_new (dev); PED_ASSERT (pth_raw != NULL, return 0); - + memcpy (pth, pth_raw, pth_get_size_static (dev)); memcpy (pth->Reserved2, pth_raw + pth_get_size_static (dev), pth_get_size_rsv2 (dev)); - + return pth; } @@ -333,13 +333,13 @@ pth_get_raw (const PedDevice* dev, const GuidPartitionTableHeader_t* pth) { uint8_t* pth_raw = ped_malloc (pth_get_size (dev)); int size_static = pth_get_size_static (dev); - + PED_ASSERT (pth != NULL, return 0); PED_ASSERT (pth->Reserved2 != NULL, return 0); - + memcpy (pth_raw, pth, size_static); memcpy (pth_raw + size_static, pth->Reserved2, pth_get_size_rsv2 (dev)); - + return pth_raw; } @@ -350,7 +350,7 @@ pth_get_raw (const PedDevice* dev, const GuidPartitionTableHeader_t* pth) * * There are two different representations for Globally Unique Identifiers * (GUIDs or UUIDs). - * + * * The RFC specifies a UUID as a string of 16 bytes, essentially * a big-endian array of char. * Intel, in their EFI Specification, references the same RFC, but @@ -390,14 +390,14 @@ pth_crc32(const PedDevice* dev, const GuidPartitionTableHeader_t* pth) { uint8_t* pth_raw = pth_get_raw (dev, pth); uint32_t crc32 = 0; - + PED_ASSERT (dev != NULL, return 0); PED_ASSERT (pth != NULL, return 0); - + crc32 = efi_crc32 (pth_raw, PED_LE32_TO_CPU (pth->HeaderSize)); free (pth_raw); - + return crc32; } @@ -440,13 +440,13 @@ gpt_probe (const PedDevice * dev) if (gpt->Signature == PED_CPU_TO_LE64(GPT_HEADER_SIGNATURE)) gpt_sig_found = 1; } - + free (pth_raw); if (gpt) pth_free (gpt); - + if (!gpt_sig_found) return 0; @@ -486,7 +486,7 @@ gpt_clobber(PedDevice * dev) memset(&pmbr, 0, sizeof(pmbr)); memset(zeroed_pth_raw, 0, pth_get_size (dev)); - + /* * TO DISCUSS: check whether checksum is correct? * If not, we might get a wrong AlternateLBA field and destroy @@ -497,7 +497,7 @@ gpt_clobber(PedDevice * dev) goto error_free; gpt = pth_new_from_raw (dev, pth_raw); - + if (!ped_device_write(dev, &pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS)) goto error_free_with_gpt; if (!ped_device_write(dev, &zeroed_pth_raw, @@ -513,11 +513,11 @@ gpt_clobber(PedDevice * dev) GPT_HEADER_SECTORS)) return 0; } - + pth_free (gpt); return 1; - + error_free_with_gpt: pth_free (gpt); error_free: @@ -623,9 +623,9 @@ _read_header (const PedDevice* dev, GuidPartitionTableHeader_t** gpt, free (pth_raw); return 0; } - + *gpt = pth_new_from_raw (dev, pth_raw); - + free (pth_raw); if (_header_is_valid (dev, *gpt)) @@ -636,9 +636,9 @@ _read_header (const PedDevice* dev, GuidPartitionTableHeader_t** gpt, } static int -_parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt, +_parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt, int *update_needed) -{ +{ GPTDiskData* gpt_disk_data = disk->disk_specific; PedSector first_usable; PedSector last_usable; @@ -668,20 +668,20 @@ _parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt, /* Need to check whether the volume has grown, the LastUsableLBA is normally set to disk->dev->length - 2 - ptes_size (at least for parted - created volumes), where ptes_size is the number of entries * + created volumes), where ptes_size is the number of entries * size of each entry / sector size or 16k / sector size, whatever the greater. If the volume has grown, offer the user the chance to use the new - space or continue with the current usable area. Only ask once per + space or continue with the current usable area. Only ask once per parted invocation. */ - - last_usable_if_grown + + last_usable_if_grown = (disk->dev->length - 2 - - ((PedSector)(PED_LE32_TO_CPU(gpt->NumberOfPartitionEntries)) * - (PedSector)(PED_LE32_TO_CPU(gpt->SizeOfPartitionEntry)) / + ((PedSector)(PED_LE32_TO_CPU(gpt->NumberOfPartitionEntries)) * + (PedSector)(PED_LE32_TO_CPU(gpt->SizeOfPartitionEntry)) / disk->dev->sector_size)); - last_usable_min_default = disk->dev->length - 2 - + last_usable_min_default = disk->dev->length - 2 - GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / disk->dev->sector_size; if ( last_usable_if_grown > last_usable_min_default ) { @@ -705,7 +705,7 @@ _parse_header (PedDisk* disk, GuidPartitionTableHeader_t* gpt, _("Not all of the space available to %s appears " "to be used, you can fix the GPT to use all of the " "space (an extra %llu blocks) or continue with the " - "current setting? "), disk->dev->path, + "current setting? "), disk->dev->path, (uint64_t)(last_usable_if_grown - last_usable)); @@ -755,15 +755,15 @@ _parse_part_entry (PedDisk* disk, GuidPartitionEntry_t* pte) gpt_part_data->name[i] = (efi_char16_t) PED_LE16_TO_CPU( (uint16_t) pte->PartitionName[i]); gpt_part_data->name[i] = 0; - - gpt_part_data->lvm = gpt_part_data->raid + + gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service = gpt_part_data->hidden = gpt_part_data->msftres = gpt_part_data->bios_grub = 0; if (pte->Attributes.RequiredToFunction & 0x1) gpt_part_data->hidden = 1; - + if (!guid_cmp (gpt_part_data->type, PARTITION_SYSTEM_GUID)) gpt_part_data->boot = 1; else if (!guid_cmp (gpt_part_data->type, PARTITION_BIOS_GRUB_GUID)) @@ -776,7 +776,7 @@ _parse_part_entry (PedDisk* disk, GuidPartitionEntry_t* pte) gpt_part_data->hp_service = 1; else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID)) gpt_part_data->msftres = 1; - + return part; } @@ -816,7 +816,7 @@ gpt_read (PedDisk * disk) ped_disk_delete_all (disk); - /* + /* * motivation: let the user decide about the pmbr... during * ped_disk_probe(), they probably didn't get a choice... */ @@ -966,7 +966,7 @@ _write_pmbr (PedDevice * dev) pmbr.PartitionRecord[0].EndSector = 0xFF; pmbr.PartitionRecord[0].EndTrack = 0xFF; pmbr.PartitionRecord[0].StartingLBA = PED_CPU_TO_LE32(1); - if ((dev->length - 1ULL) > 0xFFFFFFFFULL) + if ((dev->length - 1ULL) > 0xFFFFFFFFULL) pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(0xFFFFFFFF); else pmbr.PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32(dev->length - 1UL); @@ -982,9 +982,9 @@ _generate_header (const PedDisk* disk, int alternate, uint32_t ptes_crc, GuidPartitionTableHeader_t* gpt; *gpt_p = pth_new_zeroed (disk->dev); - + gpt = *gpt_p; - + gpt->Signature = PED_CPU_TO_LE64 (GPT_HEADER_SIGNATURE); gpt->Revision = PED_CPU_TO_LE32 (GPT_HEADER_REVISION_V1_00); @@ -1034,7 +1034,7 @@ _partition_generate_part_entry (PedPartition* part, GuidPartitionEntry_t* pte) if (gpt_part_data->hidden) pte->Attributes.RequiredToFunction = 1; - + for (i = 0; i < 72 / sizeof(efi_char16_t); i++) pte->PartitionName[i] = (efi_char16_t) PED_CPU_TO_LE16( @@ -1252,7 +1252,7 @@ gpt_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type) gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; return 1; } - + if (fs_type) { if (strncmp (fs_type->name, "fat", 3) == 0 || strcmp (fs_type->name, "ntfs") == 0) { @@ -1340,7 +1340,7 @@ gpt_partition_set_flag(PedPartition *part, case PED_PARTITION_BOOT: gpt_part_data->boot = state; if (state) - gpt_part_data->raid + gpt_part_data->raid = gpt_part_data->lvm = gpt_part_data->bios_grub = gpt_part_data->hp_service @@ -1349,7 +1349,7 @@ gpt_partition_set_flag(PedPartition *part, case PED_PARTITION_BIOS_GRUB: gpt_part_data->bios_grub = state; if (state) - gpt_part_data->raid + gpt_part_data->raid = gpt_part_data->lvm = gpt_part_data->boot = gpt_part_data->hp_service @@ -1445,7 +1445,7 @@ gpt_partition_is_flag_available(const PedPartition * part, case PED_PARTITION_BIOS_GRUB: case PED_PARTITION_HPSERVICE: case PED_PARTITION_MSFT_RESERVED: - case PED_PARTITION_HIDDEN: + case PED_PARTITION_HIDDEN: return 1; case PED_PARTITION_SWAP: case PED_PARTITION_ROOT: diff --git a/libparted/labels/loop.c b/libparted/labels/loop.c index c89a9ce..10ba29e 100644 --- a/libparted/labels/loop.c +++ b/libparted/labels/loop.c @@ -192,7 +192,7 @@ loop_partition_new (const PedDisk* disk, PedPartitionType part_type, PedSector start, PedSector end) { PedPartition* part; - + part = _ped_partition_alloc (disk, part_type, fs_type, start, end); if (!part) return NULL; @@ -204,7 +204,7 @@ static PedPartition* loop_partition_duplicate (const PedPartition* part) { PedPartition* result; - + result = ped_partition_new (part->disk, part->type, part->fs_type, part->geom.start, part->geom.end); result->num = part->num; diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c index e89dc20..c1f3dc7 100644 --- a/libparted/labels/mac.c +++ b/libparted/labels/mac.c @@ -46,11 +46,11 @@ * Apple_partition_map partition map (table) * Apple_Driver device driver * Apple_Driver43 SCSI Manager 4.3 device driver - * Apple_MFS original Macintosh File System + * Apple_MFS original Macintosh File System * Apple_HFS Hierarchical File System (and +) * Apple_HFSX HFS+ with case sensitivity and more * Apple_UNIX_SVR2 UNIX file system (UFS?) - * Apple_PRODOS ProDOS file system + * Apple_PRODOS ProDOS file system * Apple_Free unused space * Apple_Scratch empty * Apple_Void padding for iso9660 @@ -312,7 +312,7 @@ mac_duplicate (const PedDisk* disk) MacDiskData* new_mac_data; MacDiskData* old_mac_data = (MacDiskData*) disk->disk_specific; PedPartition* partition_map; - + new_disk = ped_disk_new_fresh (disk->dev, &mac_disk_type); if (!new_disk) goto error; @@ -957,7 +957,7 @@ _generate_raw_part (PedDisk* disk, PedPartition* part, return 1; error: - return 0; + return 0; } static int @@ -992,7 +992,7 @@ _generate_raw_freespace_part (PedDisk* disk, PedGeometry* geom, int num, return 1; error: - return 0; + return 0; } static int diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c index 3ab7b03..f392bea 100644 --- a/libparted/labels/pc98.c +++ b/libparted/labels/pc98.c @@ -36,7 +36,7 @@ * http://www.kmc.kyoto-u.ac.jp/proj/linux98/index-english.html * * Partition types: - * + * * id0(mid): * bit 7: 1=bootable, 0=not bootable * # Linux uses this flag to make a distinction between ext2 and swap. @@ -49,7 +49,7 @@ * 20H : DOS(data), Windows95/98/NT, Linux * 21H..2FH : DOS(system#1 .. system#15) * 40H : Minix - * + * * id1(sid): * bit 7: 1=active, 0=sleep(hidden) * # PC-UX uses this flag to make a distinction between its file system @@ -139,7 +139,7 @@ static int pc98_check_ipl_signature (const PC98RawTable *part_table) { return !memcmp (part_table->boot_code + 4, "IPL1", 4); -} +} static int check_partition_consistency (const PedDevice* dev, @@ -603,7 +603,7 @@ static int pc98_partition_set_system (PedPartition* part, const PedFileSystemType* fs_type) { PC98PartitionData* pc98_data = part->disk_specific; - + part->fs_type = fs_type; pc98_data->system = 0x2062; @@ -855,7 +855,7 @@ static PedDiskOps pc98_disk_ops = { #else write: NULL, #endif - + partition_new: pc98_partition_new, partition_duplicate: pc98_partition_duplicate, partition_destroy: pc98_partition_destroy, diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c index 90acc2b..c39230d 100644 --- a/libparted/labels/rdb.c +++ b/libparted/labels/rdb.c @@ -51,7 +51,7 @@ static void _amiga_set_bstr (const char *cstr, char *bstr, int maxsize) { static const char * _amiga_get_bstr (char * bstr) { char * cstr = bstr + 1; int size = bstr[0]; - + cstr[size] = '\0'; return cstr; } @@ -62,7 +62,7 @@ static const char * _amiga_get_bstr (char * bstr) { #define IDNAME_FILESYSHEADER (uint32_t)0x46534844 /* 'FSHD' */ #define IDNAME_LOADSEG (uint32_t)0x4C534547 /* 'LSEG' */ #define IDNAME_BOOT (uint32_t)0x424f4f54 /* 'BOOT' */ -#define IDNAME_FREE (uint32_t)0xffffffff +#define IDNAME_FREE (uint32_t)0xffffffff static const char * _amiga_block_id (uint32_t id) { @@ -127,7 +127,7 @@ struct AmigaBlock { uint32_t amiga_SummedLongss; /* Size of the structure for checksums */ int32_t amiga_ChkSum; /* Checksum of the structure */ }; -#define AMIGA(pos) ((struct AmigaBlock *)(pos)) +#define AMIGA(pos) ((struct AmigaBlock *)(pos)) static int _amiga_checksum (struct AmigaBlock *blk) { @@ -150,7 +150,7 @@ _amiga_calculate_checksum (struct AmigaBlock *blk) { blk->amiga_ChkSum = PED_CPU_TO_BE32( PED_BE32_TO_CPU(blk->amiga_ChkSum) - _amiga_checksum((struct AmigaBlock *) blk)); - return; + return; } static struct AmigaBlock * @@ -175,7 +175,7 @@ _amiga_read_block (const PedDevice *dev, struct AmigaBlock *blk, return NULL; case PED_EXCEPTION_IGNORE : case PED_EXCEPTION_UNHANDLED : - default : + default : return blk; } } @@ -227,7 +227,7 @@ struct RigidDiskBlock { uint32_t rdb_Reserved5[10]; }; -#define RDSK(pos) ((struct RigidDiskBlock *)(pos)) +#define RDSK(pos) ((struct RigidDiskBlock *)(pos)) #define AMIGA_RDB_NOT_FOUND ((uint32_t)0xffffffff) #define RDB_LOCATION_LIMIT 16 @@ -339,7 +339,7 @@ amiga_probe (const PedDevice *dev) return (found == AMIGA_RDB_NOT_FOUND ? 0 : 1); } - + static PedDisk* amiga_alloc (const PedDevice* dev) { @@ -374,7 +374,7 @@ amiga_alloc (const PedDevice* dev) rdb->rdb_FileSysHeaderList = PED_CPU_TO_BE32 (LINK_END); rdb->rdb_DriveInit = PED_CPU_TO_BE32 (LINK_END); rdb->rdb_BootBlockList = PED_CPU_TO_BE32 (LINK_END); - + /* Physical drive characteristics */ rdb->rdb_Cylinders = PED_CPU_TO_BE32 (dev->hw_geom.cylinders); rdb->rdb_Sectors = PED_CPU_TO_BE32 (dev->hw_geom.sectors); @@ -408,7 +408,7 @@ amiga_alloc (const PedDevice* dev) /* And calculate the checksum */ _amiga_calculate_checksum ((struct AmigaBlock *) rdb); - + return disk; } @@ -423,7 +423,7 @@ amiga_duplicate (const PedDisk* disk) PED_ASSERT(disk->disk_specific != NULL, return NULL); old_rdb = (struct RigidDiskBlock *) disk->disk_specific; - + if (!(new_disk = ped_disk_new_fresh (disk->dev, &amiga_disk_type))) return NULL; @@ -559,7 +559,7 @@ amiga_read (PedDisk* disk) part->type = 0; /* Let's probe what file system is present on the disk */ part->fs_type = ped_file_system_probe (&part->geom); - + constraint_exact = ped_constraint_exact (&part->geom); if (!ped_disk_add_partition (disk, part, constraint_exact)) { ped_partition_destroy(part); @@ -593,7 +593,7 @@ _amiga_find_free_blocks(const PedDisk *disk, uint32_t *table, /* TODO : Need to add fixing code */ case PED_EXCEPTION_IGNORE : case PED_EXCEPTION_UNHANDLED : - default : + default : return 1; } } @@ -610,7 +610,7 @@ _amiga_find_free_blocks(const PedDisk *disk, uint32_t *table, /* TODO : to more subtile things here */ case PED_EXCEPTION_CANCEL : case PED_EXCEPTION_UNHANDLED : - default : + default : return 0; } } @@ -1000,9 +1000,9 @@ amiga_partition_is_flag_available (const PedPartition* part, } } -static void +static void amiga_partition_set_name (PedPartition* part, const char* name) -{ +{ struct PartitionBlock *partition; PED_ASSERT (part != NULL, return); @@ -1049,7 +1049,7 @@ amiga_partition_align (PedPartition* part, const PedConstraint* constraint) { PED_ASSERT (part != NULL, return 0); PED_ASSERT (part->disk != NULL, return 0); - + if (_ped_partition_attempt_align (part, constraint, _amiga_get_constraint (part->disk))) return 1; @@ -1066,7 +1066,7 @@ amiga_partition_enumerate (PedPartition* part) { int i; PedPartition* p; - + PED_ASSERT (part != NULL, return 0); PED_ASSERT (part->disk != NULL, return 0); diff --git a/libparted/labels/sun.c b/libparted/labels/sun.c index 389db47..41580a4 100644 --- a/libparted/labels/sun.c +++ b/libparted/labels/sun.c @@ -164,7 +164,7 @@ sun_clobber (PedDevice* dev) if (!ped_device_read (dev, &label, 0, 1)) return 0; - + label.magic = 0; return ped_device_write (dev, &label, 0, 1); } @@ -234,7 +234,7 @@ sun_duplicate (const PedDisk* disk) PedDisk* new_disk; SunDiskData* new_sun_data; SunDiskData* old_sun_data = (SunDiskData*) disk->disk_specific; - + new_disk = ped_disk_new_fresh (disk->dev, &sun_disk_type); if (!new_disk) return NULL; @@ -308,11 +308,11 @@ sun_read (PedDisk* disk) PedPartition* part; PedSector end, start, block; PedConstraint* constraint_exact; - + PED_ASSERT (disk != NULL, return 0); PED_ASSERT (disk->dev != NULL, return 0); PED_ASSERT (disk->disk_specific != NULL, return 0); - + disk_data = (SunDiskData*) disk->disk_specific; label = &disk_data->raw_label; @@ -353,7 +353,7 @@ sun_read (PedDisk* disk) part->num = i + 1; part->fs_type = ped_file_system_probe (&part->geom); - + constraint_exact = ped_constraint_exact (&part->geom); if (!ped_disk_add_partition (disk, part, constraint_exact)) goto error; @@ -414,7 +414,7 @@ sun_write (const PedDisk* disk) label->infos[i].id = WHOLE_DISK_ID; label->partitions[i].start_cylinder = 0; - label->partitions[i].num_sectors = + label->partitions[i].num_sectors = PED_CPU_TO_BE32(disk_data->length); continue; } @@ -750,7 +750,7 @@ sun_partition_enumerate (PedPartition* part) { int i; PedPartition* p; - + /* never change the partition numbers */ if (part->num != -1) return 1; diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c index e81bf08..bdcb9f4 100644 --- a/libparted/labels/vtoc.c +++ b/libparted/labels/vtoc.c @@ -35,7 +35,7 @@ static const unsigned char EBCtoASC[256] = -INP */ 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, /* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ + -SW */ 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, /* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, @@ -51,7 +51,7 @@ static const unsigned char EBCtoASC[256] = 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, /* 0x60 - / ---- Ä ---- ---- ---- */ 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, -/* 0x68 ---- , % _ > ? */ +/* 0x68 ---- , % _ > ? */ 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, /* 0x70 --- ---- ---- ---- ---- ---- ---- */ 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, @@ -152,8 +152,8 @@ enum failure { static char buffer[85]; -static void -vtoc_error (enum failure why, char *s1, char *s2) +static void +vtoc_error (enum failure why, char *s1, char *s2) { PDEBUG char error[8192]; @@ -182,21 +182,21 @@ vtoc_error (enum failure why, char *s1, char *s2) ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, error); } -char * +char * vtoc_ebcdic_enc (char source[LINE_LENGTH], char target[LINE_LENGTH], - int l) + int l) { PDEBUG int i; - for (i = 0; i < l; i++) + for (i = 0; i < l; i++) target[i]=ASCtoEBC[(unsigned char)(source[i])]; return target; } -char * +char * vtoc_ebcdic_dec (char source[LINE_LENGTH], char target[LINE_LENGTH], int l) @@ -204,16 +204,16 @@ vtoc_ebcdic_dec (char source[LINE_LENGTH], PDEBUG int i; - for (i = 0; i < l; i++) + for (i = 0; i < l; i++) target[i]=EBCtoASC[(unsigned char)(source[i])]; return target; } -void +void vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, - cchh_t *lower, cchh_t *upper) -{ + cchh_t *lower, cchh_t *upper) +{ PDEBUG ext->typeind = typeind; ext->seqno = seqno; @@ -221,24 +221,24 @@ vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, memcpy(&ext->ulimit,upper,sizeof(cchh_t)); } -void -vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh) +void +vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh) { PDEBUG addr->cc = cc; addr->hh = hh; } -static void -vtoc_set_ttr (ttr_t *addr, u_int16_t tt, u_int8_t r) +static void +vtoc_set_ttr (ttr_t *addr, u_int16_t tt, u_int8_t r) { PDEBUG addr->tt = tt; addr->r = r; } -void -vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) +void +vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) { PDEBUG addr->cc = cc; @@ -246,8 +246,8 @@ vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) addr->b = b; } -void -vtoc_set_date (labeldate_t * d, u_int8_t year, u_int16_t day) +void +vtoc_set_date (labeldate_t * d, u_int8_t year, u_int16_t day) { PDEBUG d->year = year; @@ -262,16 +262,16 @@ vtoc_volume_label_init (volume_label_t *vlabel) { PDEBUG sprintf(buffer, "%84s", " "); - vtoc_ebcdic_enc(buffer, buffer, 84); + vtoc_ebcdic_enc(buffer, buffer, 84); strncpy(vlabel->volkey, buffer, 84); } /* * reads the volume label from dasd */ -int +int vtoc_read_volume_label (int f, unsigned long vlabel_start, - volume_label_t *vlabel) + volume_label_t *vlabel) { PDEBUG int rc; @@ -295,9 +295,9 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start, /* * writes the volume label to dasd */ -int +int vtoc_write_volume_label (int f, unsigned long vlabel_start, - volume_label_t *vlabel) + volume_label_t *vlabel) { PDEBUG int rc; @@ -306,8 +306,8 @@ vtoc_write_volume_label (int f, unsigned long vlabel_start, vtoc_error(unable_to_seek, "vtoc_write_volume_label", _("Could not write volume label.")); - rc = write(f, vlabel, sizeof(volume_label_t)); - if (rc != sizeof(volume_label_t)) + rc = write(f, vlabel, sizeof(volume_label_t)); + if (rc != sizeof(volume_label_t)) vtoc_error(unable_to_write, "vtoc_write_volume_label", _("Could not write volume label.")); @@ -345,7 +345,7 @@ vtoc_volume_label_set_volser (volume_label_t *vlabel, char *volser) } /* - * returns the volume serial number right after it is translated + * returns the volume serial number right after it is translated * to ASCII */ char * @@ -366,12 +366,12 @@ vtoc_volume_label_set_key (volume_label_t *vlabel, char *key) { PDEBUG char s[4]; - + vtoc_ebcdic_enc(key, s, 4); strncpy(vlabel->volkey, s, 4); - + return; -} +} /* * sets the volume label identifier right @@ -406,27 +406,27 @@ vtoc_volume_label_get_label (volume_label_t *vlabel, char *lbl) * reads either a format4 label or a format1 label * from the specified position */ -void +void vtoc_read_label (int f, unsigned long position, format1_label_t *f1, - format4_label_t *f4, format5_label_t *f5, format7_label_t *f7) -{ + format4_label_t *f4, format5_label_t *f5, format7_label_t *f7) +{ PDEBUG int t; - if (lseek(f, position, SEEK_SET) == -1) + if (lseek(f, position, SEEK_SET) == -1) vtoc_error(unable_to_seek, "vtoc_read_label", _("Could not read VTOC labels.")); if (f1 != NULL) { t = sizeof(format1_label_t); - if (read(f, f1, t) != t) + if (read(f, f1, t) != t) vtoc_error(unable_to_read, "vtoc_read_label", _("Could not read VTOC FMT1 DSCB.")); } if (f4 != NULL) { t = sizeof(format4_label_t); - if (read(f, f4, t) != t) + if (read(f, f4, t) != t) vtoc_error(unable_to_read, "vtoc_read_label", _("Could not read VTOC FMT4 DSCB.")); } @@ -440,7 +440,7 @@ vtoc_read_label (int f, unsigned long position, format1_label_t *f1, if (f7 != NULL) { t = sizeof(format7_label_t); - if (read(f, f7, t) != t) + if (read(f, f7, t) != t) vtoc_error(unable_to_read, "vtoc_read_label", _("Could not read VTOC FMT7 DSCB.")); } @@ -451,40 +451,40 @@ vtoc_read_label (int f, unsigned long position, format1_label_t *f1, * to the specified position */ void -vtoc_write_label (int f, unsigned long position, format1_label_t *f1, +vtoc_write_label (int f, unsigned long position, format1_label_t *f1, format4_label_t *f4, format5_label_t *f5, format7_label_t *f7) { PDEBUG int t; - if (lseek(f, position, SEEK_SET) == -1) + if (lseek(f, position, SEEK_SET) == -1) vtoc_error(unable_to_seek, "vtoc_write_label", _("Could not write VTOC labels.")); if (f1 != NULL) { t = sizeof(format1_label_t); - if (write(f, f1, t) != t) + if (write(f, f1, t) != t) vtoc_error(unable_to_write, "vtoc_write_label", _("Could not write VTOC FMT1 DSCB.")); } if (f4 != NULL) { t = sizeof(format4_label_t); - if (write(f, f4, t) != t) + if (write(f, f4, t) != t) vtoc_error(unable_to_write, "vtoc_write_label", _("Could not write VTOC FMT4 DSCB.")); } if (f5 != NULL) { t = sizeof(format5_label_t); - if (write(f, f5, t) != t) + if (write(f, f5, t) != t) vtoc_error(unable_to_write, "vtoc_write_label", _("Could not write VTOC FMT5 DSCB.")); } if (f7 != NULL) { t = sizeof(format7_label_t); - if (write(f, f7, t) != t) + if (write(f, f7, t) != t) vtoc_error(unable_to_write, "vtoc_write_label", _("Could not write VTOC FMT7 DSCB.")); } @@ -493,11 +493,11 @@ vtoc_write_label (int f, unsigned long position, format1_label_t *f1, /* * initializes a format4 label */ -void +void vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, unsigned int cylinders, unsigned int tracks, unsigned int blocks, unsigned int blksize, - u_int16_t dev_type) + u_int16_t dev_type) { PDEBUG int i; @@ -566,7 +566,7 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, * initializes a format5 label */ void -vtoc_init_format5_label (format5_label_t *f5) +vtoc_init_format5_label (format5_label_t *f5) { PDEBUG int i; @@ -581,7 +581,7 @@ vtoc_init_format5_label (format5_label_t *f5) * initializes a format7 label */ void -vtoc_init_format7_label (format7_label_t *f7) +vtoc_init_format7_label (format7_label_t *f7) { PDEBUG int i; @@ -595,9 +595,9 @@ vtoc_init_format7_label (format7_label_t *f7) /* * initializes a format1 label */ -void +void vtoc_init_format1_label (char *volid, unsigned int blksize, - extent_t *part_extent, format1_label_t *f1) + extent_t *part_extent, format1_label_t *f1) { PDEBUG struct tm * creatime; @@ -653,7 +653,7 @@ vtoc_init_format1_label (char *volid, unsigned int blksize, /* * do some updates to the VTOC format4 label */ -void +void vtoc_update_format4_label (format4_label_t *f4, cchhb_t *highest_f1, u_int16_t unused_update) { @@ -669,29 +669,29 @@ vtoc_update_format4_label (format4_label_t *f4, cchhb_t *highest_f1, * reorganizes all extents within a FMT5 label */ static void -vtoc_reorganize_FMT5_extents (format5_label_t *f5) +vtoc_reorganize_FMT5_extents (format5_label_t *f5) { PDEBUG ds5ext_t *ext, *last, tmp; int i, j; for (i=0; i<26; i++) { - if (i==0) - last = &f5->DS5AVEXT; + if (i==0) + last = &f5->DS5AVEXT; else if ((i > 0) && (i < 8)) last = &f5->DS5EXTAV[i-1]; else last = &f5->DS5MAVET[i-8]; for (j=i; j<26; j++) { - if (j==0) - ext = &f5->DS5AVEXT; + if (j==0) + ext = &f5->DS5AVEXT; else if ((j > 0) && (j < 8)) ext = &f5->DS5EXTAV[j-1]; else ext = &f5->DS5MAVET[j-8]; - if (((ext->t > 0) && (last->t == 0)) || + if (((ext->t > 0) && (last->t == 0)) || ((ext->t > 0) && (ext->t < last->t))) { tmp.t = last->t; @@ -711,23 +711,23 @@ vtoc_reorganize_FMT5_extents (format5_label_t *f5) /* * add a free space extent description to the VTOC FMT5 DSCB */ -void +void vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl, - int trk, u_int16_t a, u_int16_t b, u_int8_t c) + int trk, u_int16_t a, u_int16_t b, u_int8_t c) { PDEBUG ds5ext_t *ext = NULL, *tmp = NULL; - int i; + int i; for (i=0; i<26; i++) { - if (i==0) - ext = &f5->DS5AVEXT; + if (i==0) + ext = &f5->DS5AVEXT; else if ((i > 0) && (i < 8)) ext = &f5->DS5EXTAV[i-1]; else ext = &f5->DS5MAVET[i-8]; - if (((a < ext->t) && (a + b*trk + c > ext->t)) || + if (((a < ext->t) && (a + b*trk + c > ext->t)) || ((a > ext->t) && (ext->t + ext->fc*trk + ext->ft > a))) { puts ("BUG: overlapping free space extents " @@ -740,7 +740,7 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl, ext->fc = b; ext->ft = c; tmp = ext; - if (verbose) + if (verbose) puts ("FMT5 add extent: add new extent"); break; } @@ -770,13 +770,13 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl, bzero(tmp, sizeof(ds5ext_t)); tmp = ext; - if (verbose) + if (verbose) puts ("FMT5 add extent: " "merge with predecessor"); i = -1; continue; - } + } if ((tmp->t + tmp->fc*trk + tmp->ft) == ext->t) { /* this extent succeeds the new one */ @@ -786,30 +786,30 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl, bzero(tmp, sizeof(ds5ext_t)); tmp = ext; - if (verbose) + if (verbose) puts ("FMT5 add extent: " "merge with successor"); i = -1; continue; - } + } } } /* * remove a free space extent description from the VTOC FMT5 DSCB */ -void +void vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, - int trk, u_int16_t a, u_int16_t b, u_int8_t c) + int trk, u_int16_t a, u_int16_t b, u_int8_t c) { PDEBUG ds5ext_t *ext; int i, counter=0; - + for (i=0; i<26; i++) { - if (i==0) - ext = &f5->DS5AVEXT; + if (i==0) + ext = &f5->DS5AVEXT; else if ((i > 0) && (i < 8)) ext = &f5->DS5EXTAV[i-1]; else @@ -819,7 +819,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, /* fills up whole free space gap */ bzero(ext, sizeof(ds5ext_t)); - if (verbose) + if (verbose) puts ("FMT5 del extent: fills whole gap"); counter++; @@ -838,7 +838,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, ext->ft -= c; } - if (verbose) + if (verbose) puts ("FMT5 del extent: left bounded"); counter++; @@ -857,7 +857,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, ext->ft -= c; } - if (verbose) + if (verbose) puts ("FMT5 del extent: right bounded"); counter++; @@ -879,10 +879,10 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, ext->fc = (a - ext->t) / trk; ext->ft = (a - ext->t) % trk; - vtoc_update_format5_label_add(f5, verbose, + vtoc_update_format5_label_add(f5, verbose, cyl, trk, x, y, z); - if (verbose) + if (verbose) puts ("FMT5 del extent: 2 pieces"); counter++; @@ -897,7 +897,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, "in FMT5 DSCB!\nexiting..."); exit(1); } - + if ((a > ext->t) && (a < ext->t + ext->fc*trk + ext->ft) && (a + b*trk + c > ext->t + ext->fc*trk + ext->ft)) { @@ -922,22 +922,22 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, * reorganizes all extents within a FMT7 label */ static void -vtoc_reorganize_FMT7_extents (format7_label_t *f7) +vtoc_reorganize_FMT7_extents (format7_label_t *f7) { PDEBUG ds7ext_t *ext, *last, tmp; int i, j; for (i=0; i<16; i++) { - if (i<5) - last = &f7->DS7EXTNT[i]; - else + if (i<5) + last = &f7->DS7EXTNT[i]; + else last = &f7->DS7ADEXT[i-5]; for (j=i; j<16; j++) { - if (j<5) - ext = &f7->DS7EXTNT[j]; - else + if (j<5) + ext = &f7->DS7EXTNT[j]; + else ext = &f7->DS7ADEXT[j-5]; if (((ext->a > 0) && (last->a == 0)) @@ -957,18 +957,18 @@ vtoc_reorganize_FMT7_extents (format7_label_t *f7) /* * add a free space extent description to the VTOC FMT7 DSCB */ -void +void vtoc_update_format7_label_add (format7_label_t *f7, int verbose, - u_int32_t a, u_int32_t b) + u_int32_t a, u_int32_t b) { PDEBUG ds7ext_t *ext = NULL, *tmp = NULL; - int i; + int i; for (i=0; i<16; i++) { - if (i<5) - ext = &f7->DS7EXTNT[i]; - else + if (i<5) + ext = &f7->DS7EXTNT[i]; + else ext = &f7->DS7ADEXT[i-5]; if (((a < ext->a) && (b > ext->a) && (b < ext->b)) @@ -984,7 +984,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, ext->b = b; tmp = ext; - if (verbose) + if (verbose) puts ("FMT7 add extent: add new extent"); break; @@ -998,9 +998,9 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, } for (i=0; i<16; i++) { - if (i<5) - ext = &f7->DS7EXTNT[i]; - else + if (i<5) + ext = &f7->DS7EXTNT[i]; + else ext = &f7->DS7ADEXT[i-5]; if ((ext->a + ext->b) == 0x00000000) @@ -1012,13 +1012,13 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, bzero(tmp, sizeof(ds7ext_t)); tmp = ext; - if (verbose) + if (verbose) puts ("FMT7 add extent: " "merge with predecessor"); i = -1; continue; - } + } if (ext->a == (tmp->b + 1)) { /* this extent succeeds the new one */ @@ -1026,37 +1026,37 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, bzero(tmp, sizeof(ds7ext_t)); tmp = ext; - if (verbose) + if (verbose) puts ("FMT7 add extent: merge with successor"); i = -1; continue; - } + } } } /* * remove a free space extent description from the VTOC FMT7 DSCB */ -void +void vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - u_int32_t a, u_int32_t b) + u_int32_t a, u_int32_t b) { PDEBUG ds7ext_t *ext; int i, counter=0; - + for (i=0; i<16; i++) { - if (i<5) - ext = &f7->DS7EXTNT[i]; - else + if (i<5) + ext = &f7->DS7EXTNT[i]; + else ext = &f7->DS7ADEXT[i-5]; if ((a == ext->a) && (b == ext->b)) { /* fills up whole free space gap */ bzero(ext, sizeof(ds7ext_t)); - if (verbose) + if (verbose) puts ("FMT7 del extent: fills whole gap"); counter++; @@ -1067,7 +1067,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, /* left-bounded in free space gap */ ext->a = b + 1; - if (verbose) + if (verbose) puts ("FMT7 add extent: left-bounded"); counter++; @@ -1078,7 +1078,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, /* right-bounded in free space gap */ ext->b = a - 1; - if (verbose) + if (verbose) puts ("FMT7 add extent: right-bounded"); counter++; @@ -1090,7 +1090,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, vtoc_update_format7_label_add(f7, verbose, b+1, ext->b); ext->b = a - 1; - if (verbose) + if (verbose) puts ("FMT7 add extent: 2 pieces"); counter++; |