View | Details | Raw Unified | Return to bug 980834
Collapse All | Expand All

(-)parted-3.2/doc/C/parted.8 (+4 lines)
Lines 30-35 never prompts for user intervention Link Here
30
.B -v, --version
30
.B -v, --version
31
displays the version
31
displays the version
32
.TP
32
.TP
33
.B --wipesignatures
34
mkpart wipes the superblock signatures from the disk region where it is
35
about to create the partition
36
.TP
33
.B -a \fIalignment-type\fP, --align \fIalignment-type\fP
37
.B -a \fIalignment-type\fP, --align \fIalignment-type\fP
34
Set alignment for newly created partitions, valid alignment types are:
38
Set alignment for newly created partitions, valid alignment types are:
35
.RS
39
.RS
(-)parted-3.2/include/parted/device.in.h (+2 lines)
Lines 119-124 struct _PedDeviceArchOps { Link Here
119
        /* These functions are optional */
119
        /* These functions are optional */
120
        PedAlignment *(*get_minimum_alignment)(const PedDevice *dev);
120
        PedAlignment *(*get_minimum_alignment)(const PedDevice *dev);
121
        PedAlignment *(*get_optimum_alignment)(const PedDevice *dev);
121
        PedAlignment *(*get_optimum_alignment)(const PedDevice *dev);
122
        int (*wipe_signatures)(const PedDevice *dev, PedSector start, PedSector length);
122
};
123
};
123
124
124
#include <parted/constraint.h>
125
#include <parted/constraint.h>
Lines 155-160 extern PedConstraint *ped_device_get_opt Link Here
155
156
156
extern PedAlignment *ped_device_get_minimum_alignment(const PedDevice *dev);
157
extern PedAlignment *ped_device_get_minimum_alignment(const PedDevice *dev);
157
extern PedAlignment *ped_device_get_optimum_alignment(const PedDevice *dev);
158
extern PedAlignment *ped_device_get_optimum_alignment(const PedDevice *dev);
159
extern int ped_device_wipe_signatures(const PedDevice *dev, PedSector start, PedSector length);
158
160
159
/* private stuff ;-) */
161
/* private stuff ;-) */
160
162
(-)parted-3.2/libparted/arch/linux.c (+39 lines)
Lines 3297-3302 linux_get_optimum_alignment(const PedDev Link Here
3297
                blkid_topology_get_alignment_offset(tp) / dev->sector_size,
3297
                blkid_topology_get_alignment_offset(tp) / dev->sector_size,
3298
                blkid_topology_get_optimal_io_size(tp) / dev->sector_size);
3298
                blkid_topology_get_optimal_io_size(tp) / dev->sector_size);
3299
}
3299
}
3300
3301
static int
3302
linux_wipe_signatures(const PedDevice *dev, PedSector start, PedSector length)
3303
{
3304
        PED_ASSERT (dev != NULL);
3305
        LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
3306
3307
        blkid_loff_t wipe_offset = start * dev->sector_size;
3308
        blkid_loff_t wipe_size = length * dev->sector_size;
3309
3310
        _ensure_read_write (dev);
3311
3312
        blkid_probe pr;
3313
        pr = blkid_new_probe();
3314
        if (!pr)
3315
                goto error;
3316
3317
        if (blkid_probe_set_device(pr, arch_specific->fd, wipe_offset, wipe_size) == -1)
3318
                goto error_free_probe;
3319
        if (blkid_probe_enable_superblocks(pr, 1) == -1)
3320
                goto error_free_probe;
3321
        if (blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_MAGIC) == -1)
3322
                goto error_free_probe;
3323
3324
        while (blkid_do_probe(pr) == 0) {
3325
                if (blkid_do_wipe(pr, 0) == -1)
3326
                        goto error_free_probe;
3327
        }
3328
3329
        blkid_free_probe(pr);
3330
        return 1;
3331
3332
error_free_probe:
3333
        blkid_free_probe(pr);
3334
3335
error:
3336
        return 0;
3337
}
3300
#endif
3338
#endif
3301
3339
3302
static PedDeviceArchOps linux_dev_ops = {
3340
static PedDeviceArchOps linux_dev_ops = {
Lines 3316-3321 static PedDeviceArchOps linux_dev_ops = Link Here
3316
#if USE_BLKID
3354
#if USE_BLKID
3317
        get_minimum_alignment:	linux_get_minimum_alignment,
3355
        get_minimum_alignment:	linux_get_minimum_alignment,
3318
        get_optimum_alignment:	linux_get_optimum_alignment,
3356
        get_optimum_alignment:	linux_get_optimum_alignment,
3357
	wipe_signatures: linux_wipe_signatures,
3319
#endif
3358
#endif
3320
};
3359
};
3321
3360
(-)parted-3.2/libparted/device.c (+17 lines)
Lines 565-568 ped_device_get_optimum_alignment(const P Link Here
565
        return align;
565
        return align;
566
}
566
}
567
567
568
569
/**
570
 * Wipe superblock signatures from the specified region on the device.
571
 *
572
 * \return zero on failure
573
 */
574
int
575
ped_device_wipe_signatures(const PedDevice *dev, PedSector start, PedSector length)
576
{
577
	int ret = 0;
578
579
        if (ped_architecture->dev_ops->wipe_signatures)
580
                ret = ped_architecture->dev_ops->wipe_signatures(dev, start, length);
581
582
	return ret;
583
}
584
568
/** @} */
585
/** @} */
(-)parted-3.2/parted/parted.c (+16 lines)
Lines 76-81 static int MEGABYTE_SECTORS (PedDevice* Link Here
76
enum
76
enum
77
{
77
{
78
  PRETEND_INPUT_TTY = CHAR_MAX + 1,
78
  PRETEND_INPUT_TTY = CHAR_MAX + 1,
79
  WIPESIGNATURES = CHAR_MAX + 2,
79
};
80
};
80
81
81
enum
82
enum
Lines 117-122 static struct option const options[] = { Link Here
117
        {"script",      0, NULL, 's'},
118
        {"script",      0, NULL, 's'},
118
        {"version",     0, NULL, 'v'},
119
        {"version",     0, NULL, 'v'},
119
        {"align",       required_argument, NULL, 'a'},
120
        {"align",       required_argument, NULL, 'a'},
121
        {"wipesignatures", 0, NULL, WIPESIGNATURES},
120
        {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY},
122
        {"-pretend-input-tty", 0, NULL, PRETEND_INPUT_TTY},
121
        {NULL,          0, NULL, 0}
123
        {NULL,          0, NULL, 0}
122
};
124
};
Lines 128-138 static const char *const options_help [] Link Here
128
        {"script",      N_("never prompts for user intervention")},
130
        {"script",      N_("never prompts for user intervention")},
129
        {"version",     N_("displays the version")},
131
        {"version",     N_("displays the version")},
130
        {"align=[none|cyl|min|opt]", N_("alignment for new partitions")},
132
        {"align=[none|cyl|min|opt]", N_("alignment for new partitions")},
133
        {"wipesignatures", N_("wipe superblock signatures when creating partition")},
131
        {NULL,          NULL}
134
        {NULL,          NULL}
132
};
135
};
133
136
134
int     opt_script_mode = 0;
137
int     opt_script_mode = 0;
135
int     pretend_input_tty = 0;
138
int     pretend_input_tty = 0;
139
int     wipesignatures = 0;
136
int     opt_machine_mode = 0;
140
int     opt_machine_mode = 0;
137
int     disk_is_modified = 0;
141
int     disk_is_modified = 0;
138
int     is_toggle_mode = 0;
142
int     is_toggle_mode = 0;
Lines 650-655 _adjust_end_if_iec (PedSector* start, Pe Link Here
650
        }
654
        }
651
}
655
}
652
656
657
653
static int
658
static int
654
do_mkpart (PedDevice** dev, PedDisk** diskp)
659
do_mkpart (PedDevice** dev, PedDisk** diskp)
655
{
660
{
Lines 840-845 do_mkpart (PedDevice** dev, PedDisk** di Link Here
840
        if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
845
        if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
841
                ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
846
                ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
842
847
848
        if (wipesignatures) {
849
                if (!ped_device_wipe_signatures(*dev, part->geom.start, part->geom.length))
850
                        ped_exception_throw (
851
                                        PED_EXCEPTION_WARNING,
852
                                        PED_EXCEPTION_OK,
853
                                        _("Wiping the superblock signatures has failed."));
854
        }
855
843
        if (!ped_disk_commit (disk))
856
        if (!ped_disk_commit (disk))
844
                goto error;
857
                goto error;
845
858
Lines 2196-2201 while (1) Link Here
2196
                case PRETEND_INPUT_TTY:
2209
                case PRETEND_INPUT_TTY:
2197
                  pretend_input_tty = 1;
2210
                  pretend_input_tty = 1;
2198
                  break;
2211
                  break;
2212
                case WIPESIGNATURES:
2213
                  wipesignatures = 1;
2214
                  break;
2199
                default:
2215
                default:
2200
                  wrong = 1;
2216
                  wrong = 1;
2201
                  break;
2217
                  break;

Return to bug 980834