/*
libparted - a library for manipulating disk partitions
- Copyright (C) 1998 - 2001, 2005, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1998 - 2001, 2005, 2007-2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
PedDeviceType type; /**< SCSI, IDE, etc.
\deprecated \sa PedDeviceType */
-#ifdef ENABLE_DEVICE_MAPPER
char* dmtype; /**< device map target type */
-#endif
long long sector_size; /**< logical sector size */
long long phys_sector_size; /**< physical sector size */
PedSector length; /**< device length (LBA) */
-/*
- libparted - a library for manipulating disk partitions
+/* libparted - a library for manipulating disk partitions
Copyright (C) 1999 - 2005, 2007, 2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
#include <stdio.h>
#include <syscall.h>
#include <unistd.h>
+#include <stdbool.h>
#include <dirent.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
linux_new (const char* path)
{
PedDevice* dev;
- char* type;
PED_ASSERT (path != NULL, return NULL);
goto error_free_arch_specific;
break;
-#ifdef ENABLE_DEVICE_MAPPER
case PED_DEVICE_DM:
- if (asprintf(&type, _("Linux device-mapper (%s)"), dev->dmtype) == -1)
- goto error_free_arch_specific;
- if (!init_generic (dev, type))
+ {
+ char* type;
+ if (dev->dmtype == NULL
+ || asprintf(&type, _("Linux device-mapper (%s)"),
+ dev->dmtype) == -1)
goto error_free_arch_specific;
- break;
-#endif
+ bool ok = init_generic (dev, type);
+ free (type);
+ if (!ok)
+ goto error_free_arch_specific;
+ break;
+ }
case PED_DEVICE_XVD:
if (!init_generic (dev, _("Xen Virtual Block Device")))
free (dev->arch_specific);
free (dev->path);
free (dev->model);
-#ifdef ENABLE_DEVICE_MAPPER
free (dev->dmtype);
-#endif
free (dev);
}
} else if (dev->type == PED_DEVICE_DAC960
|| dev->type == PED_DEVICE_CPQARRAY
|| dev->type == PED_DEVICE_ATARAID
-#ifdef ENABLE_DEVICE_MAPPER
|| dev->type == PED_DEVICE_DM
-#endif
|| isdigit (dev->path[path_len - 1]))
snprintf (result, result_len, "%sp%d", dev->path, num);
else