Update to upstream util-linux 2.20.1
[framework/base/util-linux-ng.git] / libblkid / src / superblocks / udf.c
similarity index 91%
rename from shlibs/blkid/src/probers/udf.c
rename to libblkid/src/superblocks/udf.c
index 42f7aa1..a5afc5c 100644 (file)
@@ -16,7 +16,7 @@
 #include <ctype.h>
 #include <stdint.h>
 
-#include "blkidP.h"
+#include "superblocks.h"
 
 struct volume_descriptor {
        struct descriptor_tag {
@@ -55,9 +55,10 @@ struct volume_structure_descriptor {
        uint8_t         version;
 } __attribute__((packed));
 
-#define UDF_VSD_OFFSET                 0x8000
+#define UDF_VSD_OFFSET                 0x8000LL
 
-static int probe_udf(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_udf(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct volume_descriptor *vd;
        struct volume_structure_descriptor *vsd;
@@ -86,7 +87,7 @@ nsr:
        for (b = 0; b < 64; b++) {
                vsd = (struct volume_structure_descriptor *)
                        blkid_probe_get_buffer(pr,
-                                       UDF_VSD_OFFSET + (b * bs),
+                                       UDF_VSD_OFFSET + ((blkid_loff_t) b * bs),
                                        sizeof(*vsd));
                if (!vsd)
                        return -1;
@@ -117,7 +118,9 @@ anchor:
        /* pick the primary descriptor from the list */
        for (b = 0; b < count; b++) {
                vd = (struct volume_descriptor *)
-                       blkid_probe_get_buffer(pr, (loc + b) * bs, sizeof(*vd));
+                       blkid_probe_get_buffer(pr,
+                                       (blkid_loff_t) (loc + b) * bs,
+                                       sizeof(*vd));
                if (!vd)
                        return -1;
 
@@ -136,6 +139,9 @@ anchor:
                                blkid_probe_set_utf8label(pr,
                                                vd->type.primary.ident.c,
                                                31, BLKID_ENC_UTF16BE);
+
+                       if (clen == 8 || clen == 16)
+                               break;
                }
        }