/*********************************************************
- * Copyright (C) 2004-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2004-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
} WiperInitData;
Bool Wiper_Init(WiperInitData *clientData);
-Bool WiperPartition_Open(WiperPartition_List *pl);
+Bool WiperPartition_Open(WiperPartition_List *pl, Bool shrinkableOnly);
void WiperPartition_Close(WiperPartition_List *pl);
WiperPartition *WiperSinglePartition_Allocate(void);
-WiperPartition *WiperSinglePartition_Open(const char *mntpt);
+WiperPartition *WiperSinglePartition_Open(const char *mntpt, Bool shrinkableOnly);
void WiperSinglePartition_Close(WiperPartition *);
Bool Wiper_IsWipeSupported(const WiperPartition *);
/* Local functions */
static Bool WiperIsDiskDevice(MNTINFO *mnt, struct stat *s);
-static void WiperPartitionFilter(WiperPartition *item, MNTINFO *mnt);
+static void WiperPartitionFilter(WiperPartition *item, MNTINFO *mnt, Bool shrinkableOnly);
static unsigned char *WiperGetSpace(WiperState *state, uint64 *free, uint64 *total);
static void WiperClean(WiperState *state);
*
* Determine whether or not we know how to wipe a partition.
*
+ * When the parameter 'shrinkableOnly' is TRUE, disk will be checked
+ * if it is really shrinkable. Otherwise only the filesystem
+ * will be checked for support.
+ *
* Results:
* None
*
static void
WiperPartitionFilter(WiperPartition *item, // IN/OUT
- MNTINFO *mnt) // IN
+ MNTINFO *mnt, // IN
+ Bool shrinkableOnly) // IN
{
struct stat s;
const char *comment = NULL;
if (i == ARRAYSIZE(gKnownPartitions)) {
comment = "Unknown filesystem. Contact VMware.";
- } else if (item->type != PARTITION_UNSUPPORTED) {
+ } else if (item->type != PARTITION_UNSUPPORTED &&
+ shrinkableOnly) {
/*
* If the partition is supported by the wiper library, do some other
* checks before declaring it shrinkable.
*/
WiperPartition *
-WiperSinglePartition_Open(const char *mountPoint) // IN
+WiperSinglePartition_Open(const char *mountPoint, // IN
+ Bool shrinkableOnly) // IN
{
char *mntpt = NULL;
MNTHANDLE fp;
p = NULL;
} else {
WiperCollectDiskMajors();
- WiperPartitionFilter(p, mnt);
+ WiperPartitionFilter(p, mnt, shrinkableOnly);
}
goto out;
*/
Bool
-WiperPartition_Open(WiperPartition_List *pl)
+WiperPartition_Open(WiperPartition_List *pl,
+ Bool shrinkableOnly)
{
MNTHANDLE fp;
DECLARE_MNTINFO(mnt);
break;
}
- WiperPartitionFilter(part, mnt);
+ WiperPartitionFilter(part, mnt, shrinkableOnly);
DblLnkLst_LinkLast(&pl->link, &part->link);
}
/*********************************************************
- * Copyright (C) 2014-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2014-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
GuestDiskInfo *di;
/* Get partition list. */
- if (!WiperPartition_Open(&pl)) {
+ if (!WiperPartition_Open(&pl, FALSE)) {
g_warning("GetDiskInfo: ERROR: could not get partition list\n");
return FALSE;
}
/*********************************************************
- * Copyright (C) 2008-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2018 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
break;
case WIPER_ENABLED:
- if (WiperPartition_Open(pl)) {
+ if (WiperPartition_Open(pl, TRUE)) {
return TRUE;
}