From daea52a0072a9438aa647c960e0e85d8f119d86d Mon Sep 17 00:00:00 2001 From: relan Date: Sun, 18 Mar 2012 13:05:04 +0000 Subject: [PATCH] Add constant for the last possible valid cluster number. --- libexfat/exfat.h | 2 +- libexfat/exfatfs.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libexfat/exfat.h b/libexfat/exfat.h index bca0d24..a5a9ba1 100644 --- a/libexfat/exfat.h +++ b/libexfat/exfat.h @@ -38,7 +38,7 @@ #define IS_CONTIGUOUS(node) (((node).flags & EXFAT_ATTRIB_CONTIGUOUS) != 0) #define SECTOR_SIZE(sb) (1 << (sb).sector_bits) #define CLUSTER_SIZE(sb) (SECTOR_SIZE(sb) << (sb).spc_bits) -#define CLUSTER_INVALID(c) ((c) == EXFAT_CLUSTER_BAD || (c) == EXFAT_CLUSTER_END) +#define CLUSTER_INVALID(c) ((c) > EXFAT_LAST_DATA_CLUSTER) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define DIV_ROUND_UP(x, d) (((x) + (d) - 1) / (d)) diff --git a/libexfat/exfatfs.h b/libexfat/exfatfs.h index 61e39a1..78a62e6 100644 --- a/libexfat/exfatfs.h +++ b/libexfat/exfatfs.h @@ -26,6 +26,7 @@ typedef uint32_t cluster_t; /* cluster number */ #define EXFAT_FIRST_DATA_CLUSTER 2 +#define EXFAT_LAST_DATA_CLUSTER 0xfffffff6 #define EXFAT_CLUSTER_FREE 0 /* free cluster */ #define EXFAT_CLUSTER_BAD 0xfffffff7 /* cluster contains bad sector */ -- 2.11.0