summaryrefslogtreecommitdiffstats
path: root/libblkid/src/blkidP.h
diff options
context:
space:
mode:
authorOndrej Oprala2015-02-03 16:30:15 +0100
committerKarel Zak2015-02-24 10:22:37 +0100
commit6c4a7811f85fc64cb0b0fb9f3e266592ed9c40dc (patch)
treefa3dd1b62a64c4240171fa80e9c3946e08e91b03 /libblkid/src/blkidP.h
parentdocs: add terminal-colors requests to TODO (diff)
downloadkernel-qcow2-util-linux-6c4a7811f85fc64cb0b0fb9f3e266592ed9c40dc.tar.gz
kernel-qcow2-util-linux-6c4a7811f85fc64cb0b0fb9f3e266592ed9c40dc.tar.xz
kernel-qcow2-util-linux-6c4a7811f85fc64cb0b0fb9f3e266592ed9c40dc.zip
libblkid: make probing data structures more dynamic
* replace static probing result array with list * use allocated buffers for probing result variables [kzak@redhat.com: - rename some functions - clean up \0 terminator usage in variables - remove never used code to convert UUID to lower-case - remove possible memory leaks on errors] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/blkidP.h')
-rw-r--r--libblkid/src/blkidP.h40
1 files changed, 18 insertions, 22 deletions
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h
index fbf4e719b..4d440800e 100644
--- a/libblkid/src/blkidP.h
+++ b/libblkid/src/blkidP.h
@@ -118,24 +118,14 @@ struct blkid_chaindrv {
/*
* Low-level probe result
*/
-#define BLKID_PROBVAL_BUFSIZ 128
-
-#define BLKID_NVALS_SUBLKS 18
-#define BLKID_NVALS_TOPLGY 5
-#define BLKID_NVALS_PARTS 13
-
-/* Max number of all values in probing result */
-#define BLKID_NVALS (BLKID_NVALS_SUBLKS + \
- BLKID_NVALS_TOPLGY + \
- BLKID_NVALS_PARTS)
-
struct blkid_prval
{
- const char *name; /* value name */
- unsigned char data[BLKID_PROBVAL_BUFSIZ]; /* value data */
- size_t len; /* length of value data */
+ const char *name; /* value name */
+ unsigned char *data; /* value data */
+ size_t len; /* length of value data */
struct blkid_chain *chain; /* owner */
+ struct list_head prvals; /* list of results */
};
/*
@@ -208,8 +198,7 @@ struct blkid_struct_probe
struct blkid_chain chains[BLKID_NCHAINS]; /* array of chains */
struct blkid_chain *cur_chain; /* current chain */
- struct blkid_prval vals[BLKID_NVALS]; /* results */
- int nvals; /* number of assigned vals */
+ struct list_head vals; /* results */
struct blkid_struct_probe *parent; /* for clones */
struct blkid_struct_probe *disk_probe; /* whole-disk probing */
@@ -432,8 +421,7 @@ extern void blkid_probe_chain_reset_vals(blkid_probe pr, struct blkid_chain *chn
__attribute__((nonnull));
extern int blkid_probe_chain_copy_vals(blkid_probe pr,
struct blkid_chain *chn,
- struct blkid_prval *vals,
- int nvals)
+ struct list_head *vals)
__attribute__((nonnull));
extern struct blkid_prval *blkid_probe_assign_value(blkid_probe pr,
@@ -441,17 +429,19 @@ extern struct blkid_prval *blkid_probe_assign_value(blkid_probe pr,
__attribute__((nonnull))
__attribute__((warn_unused_result));
-extern int blkid_probe_reset_last_value(blkid_probe pr)
- __attribute__((nonnull));
+extern void blkid_probe_free_val(struct blkid_prval *v);
+
+
extern void blkid_probe_append_vals(blkid_probe pr,
- struct blkid_prval *vals,
- int nvals)
+ struct list_head *vals)
__attribute__((nonnull));
extern struct blkid_chain *blkid_probe_get_chain(blkid_probe pr)
__attribute__((nonnull))
__attribute__((warn_unused_result));
+extern struct blkid_prval *blkid_probe_last_value(blkid_probe pr);
+
extern struct blkid_prval *__blkid_probe_get_value(blkid_probe pr, int num)
__attribute__((nonnull))
__attribute__((warn_unused_result));
@@ -475,9 +465,14 @@ extern void *blkid_probe_get_binary_data(blkid_probe pr, struct blkid_chain *chn
__attribute__((nonnull))
__attribute__((warn_unused_result));
+extern struct blkid_prval *blkid_probe_new_val(void)
+ __attribute__((warn_unused_result));
extern int blkid_probe_set_value(blkid_probe pr, const char *name,
unsigned char *data, size_t len)
__attribute__((nonnull));
+extern int blkid_probe_value_set_data(struct blkid_prval *v,
+ unsigned char *data, size_t len)
+ __attribute__((nonnull));
extern int blkid_probe_vsprintf_value(blkid_probe pr, const char *name,
const char *fmt, va_list ap)
@@ -535,6 +530,7 @@ extern void blkid_probe_use_wiper(blkid_probe pr, blkid_loff_t off, blkid_loff_t
(blkid_bmp_nwords(max_items) * sizeof(unsigned long))
/* encode.c */
+extern unsigned char *blkid_encode_alloc(size_t count, size_t *reslen);
extern size_t blkid_encode_to_utf8(int enc, unsigned char *dest, size_t len,
const unsigned char *src, size_t count)
__attribute__((nonnull));