/* -*- Mode: c; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
libparted - a library for manipulating disk partitions
Copyright (C) 2000-2001, 2007-2010 Free Software Foundation, Inc.
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contributor: Matt Wilson <msw@redhat.com>
*/
#include <config.h>
#include <stdbool.h>
#include <stdbool.h>
#if ENABLE_NLS
# include <libintl.h>
#else
#endif /* ENABLE_NLS */
#include "misc.h"
#include "pt-tools.h"
/* struct's & #define's stolen from libfdisk, which probably came from
* Linux...
*/
#ifdef __sun
#endif /* __sun */
#ifdef __sun
#pragma pack(1)
#endif
} __attribute__((packed));
#ifdef __sun
#pragma pack()
#endif
#ifdef __sun
#pragma pack(1)
#endif
struct _BSDRawLabel {
/* file system and partition information: */
} __attribute__((packed));
#ifdef __sun
#pragma pack()
#endif
typedef struct {
} BSDDiskData;
typedef struct {
int boot;
int raid;
int lvm;
/* XXX fixme: endian? */
static unsigned short
unsigned short sum = 0;
lp->d_checksum = 0;
return sum;
}
/* XXX fixme: endian? */
static void
int i;
sum = 0;
for (i = 0; i < 63; i++)
}
static int
{
return 0;
void *label;
return 0;
/* check magic */
return found;
}
static PedDisk*
{
if (!disk)
goto error;
if (!bsd_specific)
goto error_free_disk;
/* Initialize the first byte to zero, so that the code in bsd_write
knows to call _probe_and_add_boot_code. Initializing all of the
remaining buffer is a little wasteful, but the alternative is to
figure out why a block at offset 340 would otherwise be used
uninitialized. */
label->d_trackskew = 0;
label->d_headswitch = 0;
label->d_npartitions = 0;
return disk;
return NULL;
}
static PedDisk*
{
if (!new_disk)
return NULL;
return new_disk;
}
static void
{
}
static int
{
int i;
void *s0;
return 0;
for (i = 1; i <= BSD_MAXPARTITIONS; i++) {
continue;
if (!part)
goto error;
goto error;
}
return 1;
return 0;
}
static void
{
void *s0;
return;
if (old_boot_code [0]
sizeof (BSDDiskData));
}
}
#ifndef DISCOVER_ONLY
static int
{
int i;
int max_part = 0;
if (!bsd_specific->boot_code [0])
sizeof (BSDRawPartition) * BSD_MAXPARTITIONS);
for (i = 1; i <= BSD_MAXPARTITIONS; i++) {
if (!part)
continue;
max_part = i;
}
sizeof (BSDDiskData)))
goto error;
return 0;
}
#endif /* !DISCOVER_ONLY */
static PedPartition*
const PedFileSystemType* fs_type,
{
if (!part)
goto error;
if (ped_partition_is_active (part)) {
if (!bsd_data)
goto error_free_part;
} else {
}
return part;
return 0;
}
static PedPartition*
{
if (!new_part)
return NULL;
return new_part;
}
static void
{
if (ped_partition_is_active (part))
}
static int
{
if (!fs_type)
else
return 1;
}
static int
{
// PedPartition* walk; // since -Werror, this unused variable would break build
switch (flag) {
case PED_PARTITION_BOOT:
return 1;
case PED_PARTITION_RAID:
if (state) {
}
return 1;
case PED_PARTITION_LVM:
if (state) {
}
default:
;
}
return 0;
}
static int
{
switch (flag) {
case PED_PARTITION_BOOT:
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
default:
;
}
return 0;
}
static int
{
switch (flag) {
case PED_PARTITION_BOOT:
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
return 1;
default:
;
}
return 0;
}
static int
{
return BSD_MAXPARTITIONS;
}
static bool
{
return true;
}
static PedConstraint*
{
return ped_constraint_new_from_max (&max);
}
static int
{
return 1;
#ifndef DISCOVER_ONLY
_("Unable to satisfy all constraints on the partition."));
#endif
return 0;
}
static int
{
int i;
PedPartition* p;
/* never change the partition numbers */
return 1;
for (i = 1; i <= BSD_MAXPARTITIONS; i++) {
if (!p) {
return 1;
}
}
/* failed to allocate a number */
#ifndef DISCOVER_ONLY
_("Unable to allocate a bsd disklabel slot."));
#endif
return 0;
}
static int
{
/* allocate 1 sector for the disk label at the start */
if (!new_part)
goto error;
goto error;
}
return 1;
return 0;
}
#include "pt-common.h"
};
.name = "bsd",
.ops = &bsd_disk_ops,
.features = 0
};
void
{
}
void
{
}