~ubuntu-branches/ubuntu/trusty/util-linux/trusty-proposed

« back to all changes in this revision

Viewing changes to fdisk/fdiskbsdlabel.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones
  • Date: 2011-11-03 15:38:23 UTC
  • mto: (4.5.5 sid) (1.6.4)
  • mto: This revision was merged to the branch mainline in revision 85.
  • Revision ID: package-import@ubuntu.com-20111103153823-10sx16jprzxlhkqf
ImportĀ upstreamĀ versionĀ 2.20.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
static int xbsd_get_part_index (int max);
72
72
static int xbsd_check_new_partition (int *i);
73
73
static void xbsd_list_types (void);
74
 
static u_short xbsd_dkcksum (struct xbsd_disklabel *lp);
 
74
static unsigned short xbsd_dkcksum (struct xbsd_disklabel *lp);
75
75
static int xbsd_initlabel  (struct partition *p, struct xbsd_disklabel *d,
76
76
                            int pindex);
77
77
static int xbsd_readlabel  (struct partition *p, struct xbsd_disklabel *d);
463
463
  d = &xbsd_dlabel;
464
464
 
465
465
#if defined (__alpha__) || defined (__ia64__)
466
 
  d -> d_secsize    = (u_long) edit_int ((u_long) d -> d_secsize     ,_("bytes/sector"));
467
 
  d -> d_nsectors   = (u_long) edit_int ((u_long) d -> d_nsectors    ,_("sectors/track"));
468
 
  d -> d_ntracks    = (u_long) edit_int ((u_long) d -> d_ntracks     ,_("tracks/cylinder"));
469
 
  d -> d_ncylinders = (u_long) edit_int ((u_long) d -> d_ncylinders  ,_("cylinders"));
 
466
  d -> d_secsize    = (unsigned long) edit_int ((unsigned long) d -> d_secsize     ,_("bytes/sector"));
 
467
  d -> d_nsectors   = (unsigned long) edit_int ((unsigned long) d -> d_nsectors    ,_("sectors/track"));
 
468
  d -> d_ntracks    = (unsigned long) edit_int ((unsigned long) d -> d_ntracks     ,_("tracks/cylinder"));
 
469
  d -> d_ncylinders = (unsigned long) edit_int ((unsigned long) d -> d_ncylinders  ,_("cylinders"));
470
470
#endif
471
471
 
472
472
  /* d -> d_secpercyl can be != d -> d_nsectors * d -> d_ntracks */
473
473
  while (1)
474
474
  {
475
 
    d -> d_secpercyl = (u_long) edit_int ((u_long) d -> d_nsectors * d -> d_ntracks,
 
475
    d -> d_secpercyl = (unsigned long) edit_int ((unsigned long) d -> d_nsectors * d -> d_ntracks,
476
476
                                          _("sectors/cylinder"));
477
477
    if (d -> d_secpercyl <= d -> d_nsectors * d -> d_ntracks)
478
478
      break;
479
479
 
480
480
    printf (_("Must be <= sectors/track * tracks/cylinder (default).\n"));
481
481
  }
482
 
  d -> d_rpm        = (u_short) edit_int ((u_short) d -> d_rpm       ,_("rpm"));
483
 
  d -> d_interleave = (u_short) edit_int ((u_short) d -> d_interleave,_("interleave"));
484
 
  d -> d_trackskew  = (u_short) edit_int ((u_short) d -> d_trackskew ,_("trackskew"));
485
 
  d -> d_cylskew    = (u_short) edit_int ((u_short) d -> d_cylskew   ,_("cylinderskew"));
486
 
  d -> d_headswitch = (u_long) edit_int ((u_long) d -> d_headswitch  ,_("headswitch"));
487
 
  d -> d_trkseek    = (u_long) edit_int ((u_long) d -> d_trkseek     ,_("track-to-track seek"));
 
482
  d -> d_rpm        = (unsigned short) edit_int ((unsigned short) d -> d_rpm       ,_("rpm"));
 
483
  d -> d_interleave = (unsigned short) edit_int ((unsigned short) d -> d_interleave,_("interleave"));
 
484
  d -> d_trackskew  = (unsigned short) edit_int ((unsigned short) d -> d_trackskew ,_("trackskew"));
 
485
  d -> d_cylskew    = (unsigned short) edit_int ((unsigned short) d -> d_cylskew   ,_("cylinderskew"));
 
486
  d -> d_headswitch = (unsigned long) edit_int ((unsigned long) d -> d_headswitch  ,_("headswitch"));
 
487
  d -> d_trkseek    = (unsigned long) edit_int ((unsigned long) d -> d_trkseek     ,_("track-to-track seek"));
488
488
 
489
489
  d -> d_secperunit = d -> d_secpercyl * d -> d_ncylinders;
490
490
}
638
638
        list_types (xbsd_fstypes);
639
639
}
640
640
 
641
 
static u_short
 
641
static unsigned short
642
642
xbsd_dkcksum (struct xbsd_disklabel *lp) {
643
 
        u_short *start, *end;
644
 
        u_short sum = 0;
 
643
        unsigned short *start, *end;
 
644
        unsigned short sum = 0;
645
645
  
646
 
        start = (u_short *) lp;
647
 
        end = (u_short *) &lp->d_partitions[lp->d_npartitions];
 
646
        start = (unsigned short *) lp;
 
647
        end = (unsigned short *) &lp->d_partitions[lp->d_npartitions];
648
648
        while (start < end)
649
649
                sum ^= *start++;
650
650
        return sum;
651
651
}
652
652
 
653
653
static int
654
 
xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d, int pindex) {
 
654
xbsd_initlabel (struct partition *p, struct xbsd_disklabel *d,
 
655
                int pindex __attribute__((__unused__))) {
655
656
        struct xbsd_partition *pp;
656
657
        struct geom g;
657
658