summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common.h93
-rw-r--r--src/partgpt.c9
2 files changed, 77 insertions, 25 deletions
diff --git a/src/common.h b/src/common.h
index 69c5e12..aeecaf5 100644
--- a/src/common.h
+++ b/src/common.h
@@ -24,6 +24,12 @@
#ifdef __cplusplus
extern "C" {
#endif
+#if defined(__FRAMAC__) || defined(MAIN_photorec)
+#undef HAVE_NCURSES
+#endif
+#if defined(__FRAMAC__) && defined(HAVE_STRING_H)
+#include <string.h>
+#endif
typedef struct efi_guid_s efi_guid_t;
struct efi_guid_s
@@ -146,64 +152,66 @@ struct efi_guid_s
((const efi_guid_t){le32(0x516e7cb8),le16(0x6ecf),le16(0x11d6),0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}})
-#define GPT_ENT_TYPE_MS_RESERVED \
- ((const efi_guid_t){le32(0xe3c9e316),le16(0x0b5c),le16(0x4db8),0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}})
#define GPT_ENT_TYPE_MS_BASIC_DATA \
((const efi_guid_t){le32(0xebd0a0a2),le16(0xb9e5),le16(0x4433),0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}})
-#define GPT_ENT_TYPE_MS_LDM_METADATA \
- ((const efi_guid_t){le32(0x5808c8aa),le16(0x7e8f),le16(0x42e0),0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}})
#define GPT_ENT_TYPE_MS_LDM_DATA \
((const efi_guid_t){le32(0xaf9b60a0),le16(0x1431),le16(0x4f62),0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}})
+#define GPT_ENT_TYPE_MS_LDM_METADATA \
+ ((const efi_guid_t){le32(0x5808c8aa),le16(0x7e8f),le16(0x42e0),0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}})
#define GPT_ENT_TYPE_MS_RECOVERY \
((const efi_guid_t){le32(0xde94bba4),le16(0x06d1),le16(0x4d40),0xa1,0x6a,{0xbf,0xd5,0x01,0x79,0xd6,0xac}})
+#define GPT_ENT_TYPE_MS_RESERVED \
+ ((const efi_guid_t){le32(0xe3c9e316),le16(0x0b5c),le16(0x4db8),0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}})
+#define GPT_ENT_TYPE_MS_SPACES \
+ ((const efi_guid_t){le32(0xe75caf8f),le16(0xf680),le16(0x4cee),0xaf,0xa3,{0xb0,0x01,0xe5,0x6e,0xfc,0x2d}})
-#define GPT_ENT_TYPE_LINUX_RAID \
- ((const efi_guid_t){le32(0xa19d880f),le16(0x05fc),le16(0x4d3b),0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}})
-#define GPT_ENT_TYPE_LINUX_SWAP \
- ((const efi_guid_t){le32(0x0657fd6d),le16(0xa4ab),le16(0x43c4),0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}})
-#define GPT_ENT_TYPE_LINUX_LVM \
- ((const efi_guid_t){le32(0xe6d6d379),le16(0xf507),le16(0x44c2),0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}})
-#define GPT_ENT_TYPE_LINUX_RESERVED \
- ((const efi_guid_t){le32(0x8da63339),le16(0x0007),le16(0x60c0),0xc4,0x36,{0x08,0x3a,0xc8,0x23,0x09,0x08}})
#define GPT_ENT_TYPE_LINUX_DATA \
((const efi_guid_t){le32(0x0fc63daf),le16(0x8483),le16(0x4772),0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}})
#define GPT_ENT_TYPE_LINUX_HOME \
((const efi_guid_t){le32(0x933ac7e1),le16(0x2eb4),le16(0x4f13),0xb8,0x44,{0x0e,0x14,0xe2,0xae,0xf9,0x15}})
+#define GPT_ENT_TYPE_LINUX_LVM \
+ ((const efi_guid_t){le32(0xe6d6d379),le16(0xf507),le16(0x44c2),0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}})
+#define GPT_ENT_TYPE_LINUX_RAID \
+ ((const efi_guid_t){le32(0xa19d880f),le16(0x05fc),le16(0x4d3b),0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}})
+#define GPT_ENT_TYPE_LINUX_RESERVED \
+ ((const efi_guid_t){le32(0x8da63339),le16(0x0007),le16(0x60c0),0xc4,0x36,{0x08,0x3a,0xc8,0x23,0x09,0x08}})
#define GPT_ENT_TYPE_LINUX_SRV \
((const efi_guid_t){le32(0x3b8f8425),le16(0x20e0),le16(0x4f3b),0x90,0x7f,{0x1a,0x25,0xa7,0x6f,0x98,0xe8}})
+#define GPT_ENT_TYPE_LINUX_SWAP \
+ ((const efi_guid_t){le32(0x0657fd6d),le16(0xa4ab),le16(0x43c4),0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}})
#define GPT_ENT_TYPE_HPUX_DATA \
((const efi_guid_t){le32(0x75894c1e),le16(0x3aeb),le16(0x11d3),0xb7,0xc1,{0x7b,0x03,0xa0,0x00,0x00,0x00}})
#define GPT_ENT_TYPE_HPUX_SERVICE \
((const efi_guid_t){le32(0xe2a1e728),le16(0x32e3),le16(0x11d6),0xa6,0x82,{0x7b,0x03,0xa0,0x00,0x00,0x00}})
-#define GPT_ENT_TYPE_MAC_AFS \
+#define GPT_ENT_TYPE_APPLE_CORE_STORAGE \
+ ((const efi_guid_t){le32(0x53746F72),le16(0x6167),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
+#define GPT_ENT_TYPE_MAC_APFS \
((const efi_guid_t){le32(0x7c3457ef),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
+#define GPT_ENT_TYPE_MAC_BOOT \
+ ((const efi_guid_t){le32(0x426f6f74),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
#define GPT_ENT_TYPE_MAC_HFS \
((const efi_guid_t){le32(0x48465300),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
-#define GPT_ENT_TYPE_MAC_UFS \
- ((const efi_guid_t){le32(0x55465300),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
+#define GPT_ENT_TYPE_MAC_LABEL \
+ ((const efi_guid_t){le32(0x4c616265),le16(0x6c00),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
#define GPT_ENT_TYPE_MAC_RAID \
((const efi_guid_t){le32(0x52414944),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
#define GPT_ENT_TYPE_MAC_RAID_OFFLINE \
((const efi_guid_t){le32(0x52414944),le16(0x5f4f),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
-#define GPT_ENT_TYPE_MAC_BOOT \
- ((const efi_guid_t){le32(0x426f6f74),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
-#define GPT_ENT_TYPE_MAC_LABEL \
- ((const efi_guid_t){le32(0x4c616265),le16(0x6c00),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
#define GPT_ENT_TYPE_MAC_TV_RECOVERY \
((const efi_guid_t){le32(0x5265636f),le16(0x7665),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
-#define GPT_ENT_TYPE_APPLE_CORE_STORAGE \
- ((const efi_guid_t){le32(0x53746F72),le16(0x6167),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
+#define GPT_ENT_TYPE_MAC_UFS \
+ ((const efi_guid_t){le32(0x55465300),le16(0x0000),le16(0x11aa),0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}})
+#define GPT_ENT_TYPE_SOLARIS_BACKUP \
+ ((const efi_guid_t){le32(0x6a8b642b),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
#define GPT_ENT_TYPE_SOLARIS_BOOT \
((const efi_guid_t){le32(0x6a82cb45),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
#define GPT_ENT_TYPE_SOLARIS_ROOT \
((const efi_guid_t){le32(0x6a85cf4d),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
#define GPT_ENT_TYPE_SOLARIS_SWAP \
((const efi_guid_t){le32(0x6a87c46f),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
-#define GPT_ENT_TYPE_SOLARIS_BACKUP \
- ((const efi_guid_t){le32(0x6a8b642b),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
#define GPT_ENT_TYPE_SOLARIS_USR \
((const efi_guid_t){le32(0x6a898cc3),le16(0x1dd2),le16(0x11b2),0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}})
#define GPT_ENT_TYPE_MAC_ZFS GPT_ENT_TYPE_SOLARIS_USR
@@ -447,14 +455,31 @@ struct my_data_struct
@*/
void *MALLOC(size_t size);
+/*@
+ @ assigns \nothing;
+ @*/
unsigned int up2power(const unsigned int number);
+
+/*@
+ @ requires \valid(partition);
+ @ requires \valid_read(src + (0 .. max_size-1));
+ @*/
void set_part_name(partition_t *partition, const char *src, const unsigned int max_size);
+
+/*@
+ @ requires \valid(partition);
+ @ requires \valid_read(src + (0 .. max_size-1));
+ @*/
void set_part_name_chomp(partition_t *partition, const unsigned char *src, const unsigned int max_size);
+
char* strip_dup(char* str);
/*@ assigns \nothing; */
time_t date_dos2unix(const unsigned short f_time,const unsigned short f_date);
+
void set_secwest(void);
+
+/*@ assigns \nothing; */
time_t td_ntfs2utc (int64_t ntfstime);
#ifndef BSD_MAXPARTITIONS
#define BSD_MAXPARTITIONS 8
@@ -518,7 +543,11 @@ int strncasecmp(const char * s1, const char * s2, size_t len);
#ifndef HAVE_STRCASESTR
char * strcasestr (const char *haystack, const char *needle);
#endif
-#if ! defined(HAVE_LOCALTIME_R) && ! defined(__MINGW32__)
+#if ! defined(HAVE_LOCALTIME_R) && ! defined(__MINGW32__) && !defined(__FRAMAC__)
+/*@
+ @ requires valid_timer: \valid_read(timep);
+ @ requires \valid(result);
+ @*/
struct tm *localtime_r(const time_t *timep, struct tm *result);
#endif
/*
@@ -539,8 +568,24 @@ struct tm *localtime_r(const time_t *timep, struct tm *result);
(void) (&_x == &_y); \
_x > _y ? _x : _y; })
+/*@
+ @ requires \valid(current_cmd);
+ @ requires valid_string(*current_cmd);
+ @ requires valid_read_string((char *)*cmd);
+ @*/
+ // requires strlen(cmd) == n;
int check_command(char **current_cmd, const char *cmd, size_t n);
+
+/*@
+ @ requires \valid(current_cmd);
+ @ requires valid_string(*current_cmd);
+ @*/
void skip_comma_in_command(char **current_cmd);
+
+/*@
+ @ requires \valid(current_cmd);
+ @ requires valid_string(*current_cmd);
+ @*/
uint64_t get_int_from_command(char **current_cmd);
#ifdef __cplusplus
} /* closing brace for extern "C" */
diff --git a/src/partgpt.c b/src/partgpt.c
index 4ede59c..19cc8b0 100644
--- a/src/partgpt.c
+++ b/src/partgpt.c
@@ -25,6 +25,12 @@
#include <config.h>
#endif
+#if defined(__FRAMAC__)
+#undef HAVE_SYS_UUID_H
+#undef HAVE_UUID_H
+#undef HAVE_UUID_UUID_H
+#endif
+
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -90,6 +96,7 @@ const struct systypes_gtp gpt_sys_types[] = {
{ GPT_ENT_TYPE_MS_LDM_METADATA, "MS LDM MetaData" },
{ GPT_ENT_TYPE_MS_LDM_DATA, "MS LDM Data" },
{ GPT_ENT_TYPE_MS_RECOVERY, "Windows Recovery Env" },
+ { GPT_ENT_TYPE_MS_SPACES, "MS Storage Spaces" },
// { GPT_ENT_TYPE_LINUX_DATA
{ GPT_ENT_TYPE_LINUX_RAID, "Linux Raid" },
{ GPT_ENT_TYPE_LINUX_SWAP, "Linux Swap" },
@@ -100,7 +107,7 @@ const struct systypes_gtp gpt_sys_types[] = {
{ GPT_ENT_TYPE_LINUX_DATA, "Linux filesys. data" },
{ GPT_ENT_TYPE_HPUX_DATA, "HPUX Data" },
{ GPT_ENT_TYPE_HPUX_SERVICE, "HPUX Service" },
- { GPT_ENT_TYPE_MAC_AFS, "Apple APFS" },
+ { GPT_ENT_TYPE_MAC_APFS, "Apple APFS" },
{ GPT_ENT_TYPE_MAC_HFS, "Mac HFS" },
{ GPT_ENT_TYPE_MAC_UFS, "Mac UFS" },
{ GPT_ENT_TYPE_MAC_RAID, "Mac Raid" },