libvolume_id-private.h revision ef5c2d048c875b6307fdc0e10f6b703fcb57772e
/*
* volume_id - reads volume label and uuid
*
* Copyright (C) 2005-2007 Kay Sievers <kay.sievers@vrfy.org>
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*/
#ifndef _LIBVOLUME_ID_PRIVATE_H_
#define _LIBVOLUME_ID_PRIVATE_H_
#include <stdint.h>
#include <stddef.h>
#include <endian.h>
#include <byteswap.h>
#include <syslog.h>
#include "libvolume_id.h"
#define ALLOWED_CHARS "#+-.:=@_"
#ifndef PACKED
#endif
#ifdef DEBUG
#else
#endif
#if (__BYTE_ORDER == __LITTLE_ENDIAN)
#define le16_to_cpu(x) (x)
#define le32_to_cpu(x) (x)
#define le64_to_cpu(x) (x)
#define be16_to_cpu(x) bswap_16(x)
#define be32_to_cpu(x) bswap_32(x)
#define cpu_to_le16(x) (x)
#define cpu_to_le32(x) (x)
#define cpu_to_be32(x) bswap_32(x)
#define le16_to_cpu(x) bswap_16(x)
#define le32_to_cpu(x) bswap_32(x)
#define le64_to_cpu(x) bswap_64(x)
#define be16_to_cpu(x) (x)
#define be32_to_cpu(x) (x)
#define cpu_to_le16(x) bswap_16(x)
#define cpu_to_le32(x) bswap_32(x)
#define cpu_to_be32(x) (x)
#endif /* __BYTE_ORDER */
enum uuid_format {
};
enum endian {
LE = 0,
BE = 1
};
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
#define VOLUME_ID_FORMAT_SIZE 32
#define VOLUME_ID_PATH_MAX 256
#define VOLUME_ID_PARTITIONS_MAX 256
/* size of superblock buffer, reiserfs block is at 64k */
#define SB_BUFFER_SIZE 0x11000
/* size of seek buffer, FAT cluster is 32k max */
#define SEEK_BUFFER_SIZE 0x10000
enum volume_id_usage {
};
struct volume_id {
enum volume_id_usage usage_id;
char *usage;
char *type;
int fd;
};
/* utils */
extern int volume_id_utf8_encoded_valid_unichar(const char *str);
extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count);
extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count);
extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format);
/* filesystems */
/* special formats */
/* raid */
/* bios raid */
extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size);
#endif