/*
- * Copyright (C) 2007-2008 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2009 Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
#include "afs.h"
#include "net.h"
#include "ipc.h"
+#include "portable_io.h"
+
+/**
+ * Compare two osl objects pointing to unsigned integers of 32 bit size.
+ *
+ * \param obj1 Pointer to the first integer.
+ * \param obj2 Pointer to the second integer.
+ *
+ * \return The values required for an osl compare function.
+ *
+ * \sa osl_compare_func, osl_hash_compare().
+ */
+static int uint32_compare(const struct osl_object *obj1, const struct osl_object *obj2)
+{
+ uint32_t d1 = read_u32((const char *)obj1->data);
+ uint32_t d2 = read_u32((const char *)obj2->data);
+
+ if (d1 < d2)
+ return 1;
+ if (d1 > d2)
+ return -1;
+ return 0;
+}
static struct osl_column_description blob_cols[] = {
[BLOBCOL_ID] = {
struct lsblob_action_data *lbad = data;
struct osl_object obj;
uint32_t id;
- int ret, ret2;
+ int ret;
if (!(lbad->flags & BLOB_LS_FLAG_LONG))
return para_printf(&lbad->pb, "%s\n", name);
ret = osl_get_object(table, row, BLOBCOL_ID, &obj);
if (ret < 0) {
- ret2 = para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
+ para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
}
id = *(uint32_t *)obj.data;
pmd.loop_col_num = BLOBCOL_ID;
ret = for_each_matching_row(&pmd);
if (ret < 0)
- ret = para_printf(&lbad.pb, "%s\n", para_strerror(-ret));
+ para_printf(&lbad.pb, "%s\n", para_strerror(-ret));
if (lbad.pb.offset)
pass_buffer_as_shm(lbad.pb.buf, lbad.pb.offset, &fd);
free(lbad.pb.buf);
const char *name, void *data)
{
struct rmblob_data *rmbd = data;
- int ret = osl_del_row(table, row), ret2;
+ int ret = osl_del_row(table, row);
if (ret < 0) {
- ret2 = para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
+ para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
}
rmbd->num_removed++;
struct osl_row *row;
struct osl_object obj = {.data = name, .size = name_len};
ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
- if (ret < 0 && ret != -E_RB_KEY_NOT_FOUND)
+ if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
goto out;
if (ret >= 0) { /* we already have a blob with this name */
obj.data = name + name_len;