chiark / gitweb /
volume_id: use PRIu64i, PRIx64 macros
[elogind.git] / extras / volume_id / lib / util.c
index e71d6208c5aadc325398318752943d882979fd21..671f97ee271407a5a194935360e4aad4ab75027f 100644 (file)
@@ -3,19 +3,24 @@
  *
  * Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
  *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE 1
 #endif
 
-#ifdef HAVE_CONFIG_H
-#  include <config.h>
-#endif
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -27,7 +32,6 @@
 
 #include "libvolume_id.h"
 #include "libvolume_id-private.h"
-#include "util.h"
 
 /* count of characters used to encode one unicode char */
 static int utf8_encoded_expected_len(const char *str)
@@ -348,7 +352,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
 {
        ssize_t buf_len;
 
-       info("get buffer off 0x%llx(%llu), len 0x%zx\n", (unsigned long long) off, (unsigned long long) off, len);
+       info("get buffer off 0x%" PRIx64 "(%" PRIu64 "), len 0x%zx\n", off, off, len);
        /* check if requested area fits in superblock buffer */
        if (off + len <= SB_BUFFER_SIZE) {
                if (id->sbbuf == NULL) {
@@ -361,7 +365,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
 
                /* check if we need to read */
                if ((off + len) > id->sbbuf_len) {
-                       info("read sbbuf len:0x%llx\n", (unsigned long long) (off + len));
+                       info("read sbbuf len:0x%" PRIx64 "\n", (off + len));
                        if (lseek(id->fd, 0, SEEK_SET) < 0) {
                                dbg("lseek failed (%s)\n", strerror(errno));
                                return NULL;
@@ -397,7 +401,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len)
 
                /* check if we need to read */
                if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) {
-                       info("read seekbuf off:0x%llx len:0x%zx\n", (unsigned long long) off, len);
+                       info("read seekbuf off:0x%" PRIx64 " len:0x%zx\n", off, len);
                        if (lseek(id->fd, off, SEEK_SET) < 0) {
                                dbg("lseek failed (%s)\n", strerror(errno));
                                return NULL;