support for disk without partition table
[oweals/mountd.git] / fs.c
diff --git a/fs.c b/fs.c
index 49ad1d542d3cd8e966934f30a35935f4f146b323..ca77a76875cf5b723a1601408c84137c4f8c8b9c 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -123,6 +123,20 @@ out:
        return ret;
 }
 
+static int detect_exfat(int fd)
+{
+       int ret = NONE;
+       unsigned char *buffer = (unsigned char*)malloc(FAT_BUF_SIZE);
+       if(get_buffer(fd, buffer, 0, FAT_BUF_SIZE) != 0)
+               goto out;
+
+       if (!memcmp(buffer + 3, "EXFAT  ", 7))
+               ret = EXFAT;
+out:
+       free(buffer);
+       return ret;
+}
+
 #define HFSPLUS_VOL_JOURNALED  (1 << 13)
 #define HFSPLUS_BUF_SIZE                       512
 static int detect_hfsplus(int fd)
@@ -139,8 +153,8 @@ static int detect_hfsplus(int fd)
        {
                if(!journal)
                        ret = HFSPLUS;
-       //      else
-       //              ret = HFSPLUSJOURNAL;
+               else
+                       ret = HFSPLUSJOURNAL;
        }
 out:
        free(buffer);
@@ -179,6 +193,7 @@ out:
 
 dfunc funcs[] = {
        detect_ext23,
+       detect_exfat,
        detect_fat,
        detect_ntfs,
        detect_hfsplus,