/** \file aac_afh.c para_server's aac audio format handler */
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
#include <signal.h>
#include <fnmatch.h>
+#include <osl.h>
#include "server.cmdline.h"
#include "para.h"
#include "error.h"
struct pattern_match_data *pmd = data;
struct osl_object name_obj;
const char *p, *name;
- int ret = osl_get_object(pmd->table, row, pmd->match_col_num, &name_obj);
+ int ret = osl(osl_get_object(pmd->table, row, pmd->match_col_num, &name_obj));
const char *pattern_txt = (const char *)pmd->patterns.data;
if (ret < 0)
*
* \param pmd Describes what to match and how.
*
- * \return The return value of the underlying call to osl_rbtree_loop()
- * or osl_rbtree_loop_reverse().
+ * \return Standard.
*/
int for_each_matching_row(struct pattern_match_data *pmd)
{
if (pmd->pm_flags & PM_REVERSE_LOOP)
- return osl_rbtree_loop_reverse(pmd->table, pmd->loop_col_num, pmd,
- action_if_pattern_matches);
- return osl_rbtree_loop(pmd->table, pmd->loop_col_num, pmd,
- action_if_pattern_matches);
+ return osl(osl_rbtree_loop_reverse(pmd->table, pmd->loop_col_num, pmd,
+ action_if_pattern_matches));
+ return osl(osl_rbtree_loop(pmd->table, pmd->loop_col_num, pmd,
+ action_if_pattern_matches));
}
/**
/** \file afs.h Exported symbols of the audio file selector. */
#include <regex.h>
-#include <osl.h>
#include "hash.h"
/** Audio file selector data stored in the audio file table. */
/** \file aft.c Audio file table functions. */
#include <dirent.h> /* readdir() */
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
* \param path The full path of the audio file.
* \param row Result pointer.
*
- * \return The return value of the underlying call to osl_get_row().
+ * \return Standard.
*/
int aft_get_row_of_path(const char *path, struct osl_row **row)
{
struct osl_object obj = {.data = (char *)path, .size = strlen(path) + 1};
- return osl_get_row(audio_file_table, AFTCOL_PATH, &obj, row);
+ return osl(osl_get_row(audio_file_table, AFTCOL_PATH, &obj, row));
}
/**
* \param hash The hash value of the desired audio file.
* \param row resul pointer.
*
- * \return The return value of the underlying call to osl_get_row().
+ * \return Standard.
*/
int aft_get_row_of_hash(HASH_TYPE *hash, struct osl_row **row)
{
const struct osl_object obj = {.data = hash, .size = HASH_SIZE};
- return osl_get_row(audio_file_table, AFTCOL_HASH, &obj, row);
+ return osl(osl_get_row(audio_file_table, AFTCOL_HASH, &obj, row));
}
/**
* \param row Pointer to a row in the audio file table.
* \param obj Result pointer.
*
- * \return The return value of the underlying call to osl_get_object().
+ * \return Standard.
*/
int get_afsi_object_of_row(const struct osl_row *row, struct osl_object *obj)
{
- return osl_get_object(audio_file_table, row, AFTCOL_AFSI, obj);
+ return osl(osl_get_object(audio_file_table, row, AFTCOL_AFSI, obj));
}
/**
int get_audio_file_path_of_row(const struct osl_row *row, char **path)
{
struct osl_object path_obj;
- int ret = osl_get_object(audio_file_table, row, AFTCOL_PATH,
- &path_obj);
+ int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_PATH,
+ &path_obj));
if (ret < 0)
return ret;
*path = path_obj.data;
*
* \sa get_hash_of_row().
*/
-static int get_hash_object_of_aft_row(const struct osl_row *row, struct osl_object *obj)
+static int get_hash_object_of_aft_row(const struct osl_row *row,
+ struct osl_object *obj)
{
- return osl_get_object(audio_file_table, row, AFTCOL_HASH, obj);
+ return osl(osl_get_object(audio_file_table, row, AFTCOL_HASH, obj));
}
/**
int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi)
{
struct osl_object obj;
- int ret = osl_get_object(audio_file_table, row, AFTCOL_AFHI,
- &obj);
+ int ret = osl(osl_get_object(audio_file_table, row, AFTCOL_AFHI,
+ &obj));
if (ret < 0)
return ret;
load_afhi(obj.data, afhi);
if (opts->flags & LS_FLAG_ADMISSIBLE_ONLY)
ret = admissible_file_loop(opts, prepare_ls_row);
else
- ret = osl_rbtree_loop(audio_file_table, AFTCOL_PATH, opts,
- prepare_ls_row);
+ ret = osl(osl_rbtree_loop(audio_file_table, AFTCOL_PATH, opts,
+ prepare_ls_row));
if (ret < 0)
goto out;
if (!opts->num_matching_paths)
* \param private_data An arbitrary data pointer, passed to \a func.
* \param func The custom function to be called.
*
- * \return The return value of the underlying call to osl_rbtree_loop().
+ * \return Standard.
*/
int audio_file_loop(void *private_data, osl_rbtree_loop_func *func)
{
- return osl_rbtree_loop(audio_file_table, AFTCOL_HASH, private_data,
- func);
+ return osl(osl_rbtree_loop(audio_file_table, AFTCOL_HASH, private_data,
+ func));
}
static struct osl_row *find_hash_sister(HASH_TYPE *hash)
PARA_INFO_LOG("request to add %s\n", path);
hs = find_hash_sister(hash);
ret = aft_get_row_of_path(path, &pb);
- if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
+ if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
goto out;
if (hs && pb && hs == pb && !(flags & ADD_FLAG_FORCE)) {
if (flags & ADD_FLAG_VERBOSE)
if (ret < 0)
goto out;
}
- ret = osl_del_row(audio_file_table, pb);
+ ret = osl(osl_del_row(audio_file_table, pb));
if (ret < 0)
goto out;
pb = NULL;
}
/* file rename, update hs' path */
if (flags & ADD_FLAG_VERBOSE) {
- ret = osl_get_object(audio_file_table, hs,
- AFTCOL_PATH, &obj);
+ ret = osl(osl_get_object(audio_file_table, hs,
+ AFTCOL_PATH, &obj));
if (ret < 0)
goto out;
ret = para_printf(&msg, "renamed from %s\n", (char *)obj.data);
if (ret < 0)
goto out;
}
- ret = osl_update_object(audio_file_table, hs, AFTCOL_PATH,
- &objs[AFTCOL_PATH]);
+ ret = osl(osl_update_object(audio_file_table, hs, AFTCOL_PATH,
+ &objs[AFTCOL_PATH]));
if (ret < 0)
goto out;
afs_event(AUDIO_FILE_RENAME, &msg, hs);
if (ret < 0)
goto out;
}
- ret = osl_update_object(audio_file_table, row, AFTCOL_AFHI,
- &objs[AFTCOL_AFHI]);
+ ret = osl(osl_update_object(audio_file_table, row, AFTCOL_AFHI,
+ &objs[AFTCOL_AFHI]));
if (ret < 0)
goto out;
- ret = osl_update_object(audio_file_table, row, AFTCOL_CHUNKS,
- &objs[AFTCOL_CHUNKS]);
+ ret = osl(osl_update_object(audio_file_table, row, AFTCOL_CHUNKS,
+ &objs[AFTCOL_CHUNKS]));
if (ret < 0)
goto out;
afs_event(AFHI_CHANGE, &msg, row);
objs[AFTCOL_AFSI].data = &afsi_buf;
objs[AFTCOL_AFSI].size = AFSI_SIZE;
save_afsi(&default_afsi, &objs[AFTCOL_AFSI]);
- ret = osl_add_and_get_row(audio_file_table, objs, &aft_row);
+ ret = osl(osl_add_and_get_row(audio_file_table, objs, &aft_row));
afs_event(AUDIO_FILE_ADD, &msg, aft_row);
out:
if (ret < 0)
query.size = strlen(path) + 1;
ret = send_callback_request(path_brother_callback, &query,
get_row_pointer_from_result, &pb);
- if (ret < 0 && ret != -E_OSL_RB_KEY_NOT_FOUND)
+ if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
goto out_free;
ret = 1;
if (pb && (pad->flags & ADD_FLAG_LAZY)) { /* lazy is really cheap */
return ret;
}
afs_event(AUDIO_FILE_REMOVE, &crd->pb, row);
- ret = osl_del_row(audio_file_table, row);
+ ret = osl(osl_del_row(audio_file_table, row));
if (ret < 0)
para_printf(&crd->pb, "%s: %s\n", name, para_strerror(-ret));
else
int ret;
audio_file_table_desc.dir = dir;
- ret = osl_open_table(&audio_file_table_desc, &audio_file_table);
+ ret = osl(osl_open_table(&audio_file_table_desc, &audio_file_table));
if (ret >= 0) {
unsigned num;
osl_get_num_rows(audio_file_table, &num);
static int aft_create(const char *dir)
{
audio_file_table_desc.dir = dir;
- return osl_create_table(&audio_file_table_desc);
+ return osl(osl_create_table(&audio_file_table_desc));
}
static int clear_attribute(struct osl_row *row, void *data)
*/
/** \file attribute.c Attribute handling functions. */
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
struct osl_object obj = {.data = (char *)att_name,
.size = strlen(att_name) + 1};
struct osl_row *row;
- int ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+ int ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
if (ret < 0)
return ret;
- ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM, &obj);
+ ret = osl(osl_get_object(attribute_table, row, ATTCOL_BITNUM, &obj));
if (ret < 0)
return ret;
*bitnum = *(unsigned char *)obj.data;
if (!(laad->flags & LSATT_FLAG_LONG))
return para_printf(&laad->pb, "%s\n", name);
- ret = osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj);
+ ret = osl(osl_get_object(table, row, ATTCOL_BITNUM, &bitnum_obj));
if (ret < 0) {
para_printf(&laad->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
p[len - 1] = '\0';
obj.data = p;
obj.size = len + 1;
- ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
if (ret < 0)
goto out;
- ret = osl_get_object(attribute_table, row, ATTCOL_BITNUM,
- &obj);
+ ret = osl(osl_get_object(attribute_table, row, ATTCOL_BITNUM,
+ &obj));
if (ret < 0)
goto out;
if (c == '+')
goto out;
continue;
}
- if (ret != -E_OSL_RB_KEY_NOT_FOUND) /* error */
+ if (ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* error */
goto out;
objs[ATTCOL_BITNUM].size = 1;
/* find smallest unused attribute */
for (bitnum = 0; bitnum < 64; bitnum++) {
objs[ATTCOL_BITNUM].data = &bitnum;
- ret = osl_get_row(attribute_table, ATTCOL_BITNUM,
- &objs[ATTCOL_BITNUM], &row);
- if (ret == -E_OSL_RB_KEY_NOT_FOUND)
+ ret = osl(osl_get_row(attribute_table, ATTCOL_BITNUM,
+ &objs[ATTCOL_BITNUM], &row));
+ if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
break; /* this bitnum is unused, use it */
if (ret < 0) /* error */
goto out;
}
objs[ATTCOL_NAME].data = p;
objs[ATTCOL_NAME].size = len + 1;
- ret = osl_add_row(attribute_table, objs);
+ ret = osl(osl_add_row(attribute_table, objs));
if (ret < 0)
goto out;
aed.name = p;
};
int ret;
- ret = osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(attribute_table, ATTCOL_NAME, &obj, &row));
if (ret < 0)
goto out;
obj.data = new;
obj.size = strlen(new) + 1;
- ret = osl_update_object(attribute_table, row, ATTCOL_NAME, &obj);
+ ret = osl(osl_update_object(attribute_table, row, ATTCOL_NAME, &obj));
out:
if (ret < 0)
para_printf(&pb, "%s\n", para_strerror(-ret));
ret = get_attribute_bitnum_by_name(name, &red.bitnum);
if (ret < 0)
return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
- ret = osl_del_row(table, row);
+ ret = osl(osl_del_row(table, row));
if (ret < 0)
return para_printf(&raad->pb, "%s: %s\n", name, para_strerror(-ret));
ret = para_printf(&raad->pb, "removed attribute %s\n", name);
if (!(*atts & (one << i)))
continue;
- ret = osl_get_row(attribute_table, ATTCOL_BITNUM, &obj, &row);
+ ret = osl(osl_get_row(attribute_table, ATTCOL_BITNUM, &obj, &row));
if (ret < 0)
goto err;
- ret = osl_get_object(attribute_table, row, ATTCOL_NAME, &obj);
+ ret = osl(osl_get_object(attribute_table, row, ATTCOL_NAME, &obj));
if (ret < 0)
goto err;
if (*text) {
int ret;
attribute_table_desc.dir = dir;
- ret = osl_open_table(&attribute_table_desc, &attribute_table);
+ ret = osl(osl_open_table(&attribute_table_desc, &attribute_table));
greatest_att_bitnum = -1; /* no atts available */
if (ret >= 0) {
find_greatest_att_bitnum();
static int attribute_create(const char *dir)
{
attribute_table_desc.dir = dir;
- return osl_create_table(&attribute_table_desc);
+ return osl(osl_create_table(&attribute_table_desc));
}
/**
/** \file blob.c Macros and functions for blob handling. */
#include <fnmatch.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
if (!(lbad->flags & BLOB_LS_FLAG_LONG))
return para_printf(&lbad->pb, "%s\n", name);
- ret = osl_get_object(table, row, BLOBCOL_ID, &obj);
+ ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
if (ret < 0) {
para_printf(&lbad->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
int ret = 0, ret2;
struct osl_object obj;
- ret = osl_open_disk_object(table, row, BLOBCOL_DEF, &obj);
+ ret = osl(osl_open_disk_object(table, row, BLOBCOL_DEF, &obj));
if (ret < 0)
return ret;
if (obj.size)
ret = pass_buffer_as_shm(obj.data, obj.size, data);
- ret2 = osl_close_disk_object(&obj);
+ ret2 = osl(osl_close_disk_object(&obj));
return (ret < 0)? ret : ret2;
}
const char *name, void *data)
{
struct rmblob_data *rmbd = data;
- int ret = osl_del_row(table, row);
+ int ret = osl(osl_del_row(table, row));
if (ret < 0) {
para_printf(&rmbd->pb, "%s: %s\n", name, para_strerror(-ret));
return ret;
unsigned num_rows;
int ret;
- ret = osl_get_num_rows(table, &num_rows);
+ ret = osl(osl_get_num_rows(table, &num_rows));
if (ret < 0)
goto out;
if (!num_rows) { /* this is the first entry ever added */
objs[BLOBCOL_NAME].size = 1;
objs[BLOBCOL_DEF].data = "";
objs[BLOBCOL_DEF].size = 1;
- ret = osl_add_row(table, objs);
+ ret = osl(osl_add_row(table, objs));
if (ret < 0)
goto out;
} else {
/* check if name already exists */
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_OSL_RB_KEY_NOT_FOUND)
+ ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
+ if (ret < 0 && ret != -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
goto out;
if (ret >= 0) { /* we already have a blob with this name */
obj.data = name + name_len;
obj.size = query->size - name_len;
- ret = osl_update_object(table, row, BLOBCOL_DEF, &obj);
+ ret = osl(osl_update_object(table, row, BLOBCOL_DEF, &obj));
goto out;
}
/* new blob, get id of the dummy row and increment it */
obj.data = "";
obj.size = 1;
- ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
if (ret < 0)
goto out;
- ret = osl_get_object(table, row, BLOBCOL_ID, &obj);
+ ret = osl(osl_get_object(table, row, BLOBCOL_ID, &obj));
if (ret < 0)
goto out;
id = *(uint32_t *)obj.data + 1;
obj.data = &id;
- ret = osl_update_object(table, row, BLOBCOL_ID, &obj);
+ ret = osl(osl_update_object(table, row, BLOBCOL_ID, &obj));
if (ret < 0)
goto out;
}
objs[BLOBCOL_NAME].size = name_len;
objs[BLOBCOL_DEF].data = name + name_len;
objs[BLOBCOL_DEF].size = query->size - name_len;
- ret = osl_add_row(table, objs);
+ ret = osl(osl_add_row(table, objs));
if (ret < 0)
goto out;
afs_event(BLOB_ADD, NULL, table);
struct osl_object obj = {.data = src, .size = strlen(src) + 1};
char *dest = src + obj.size;
struct osl_row *row;
- int ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+ int ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
if (ret < 0)
goto out;
obj.data = dest;
obj.size = strlen(dest) + 1;
- ret = osl_update_object(table, row, BLOBCOL_NAME, &obj);
+ ret = osl(osl_update_object(table, row, BLOBCOL_NAME, &obj));
if (ret < 0)
goto out;
afs_event(BLOB_RENAME, NULL, table);
*name = NULL;
if (!id)
return 1;
- ret = osl_get_row(table, BLOBCOL_ID, &obj, &row);
+ ret = osl(osl_get_row(table, BLOBCOL_ID, &obj, &row));
if (ret < 0)
return ret;
- ret = osl_get_object(table, row, BLOBCOL_NAME, &obj);
+ ret = osl(osl_get_object(table, row, BLOBCOL_NAME, &obj));
if (ret < 0)
return ret;
*name = (char *)obj.data;
def->data = NULL;
if (!*name)
return 1;
- ret = osl_get_row(table, BLOBCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(table, BLOBCOL_NAME, &obj, &row));
if (ret < 0)
return ret;
- return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+ return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
}
/** Define the \p get_def_by_id function for this blob type. */
def->data = NULL;
if (!id)
return 1;
- ret = osl_get_row(table, BLOBCOL_ID, &obj, &row);
+ ret = osl(osl_get_row(table, BLOBCOL_ID, &obj, &row));
if (ret < 0)
return ret;
- return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+ return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
}
/** Define the \p get_def_by_id function for this blob type. */
const struct osl_row *row, char **name, struct osl_object *def)
{
struct osl_object obj;
- int ret = osl_get_object(table, row, BLOBCOL_NAME, &obj);
+ int ret = osl(osl_get_object(table, row, BLOBCOL_NAME, &obj));
if (ret < 0)
return ret;
*name = obj.data;
- return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+ return osl(osl_open_disk_object(table, row, BLOBCOL_DEF, def));
}
/** Define the \p get_name_and_def_by_row function for this blob type. */
#define DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix) \
{
int ret;
desc->dir = dir;
- ret = osl_open_table(desc, table);
+ ret = osl(osl_open_table(desc, table));
if (ret >= 0)
return ret;
*table = NULL;
#include <sys/types.h>
#include <dirent.h>
#include <openssl/rc4.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
#include <sys/types.h>
#include <dirent.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
/** \file error.h List of error messages for all subsystems. */
-#include <osl.h>
-
/** \cond */
/* List of all subsystems that use paraslash's error facility. */
_static_inline_ const char *para_strerror(int num)
{
assert(num > 0);
+#ifdef _OSL_H
if (IS_OSL_ERROR(num))
return osl_strerror(num & ((1 << OSL_ERROR_BIT) - 1));
+#endif
if (IS_SYSTEM_ERROR(num))
return strerror(num & ((1 << SYSTEM_ERROR_BIT) - 1));
return para_errlist[ERRNUM_TO_SS(num)][ERRNUM_TO_INDEX(num)];
* \param ret The return value of an osl library function.
*
* This should be used for all calls to osl functions that return an osl error
- * code. It changes the return value to \p -E_OSL appropriately so that it can
- * be used for printing the correct error message.
+ * code. It changes the return value appropriately so that it can be used for
+ * printing the correct error message vi para_strerror().
*
- * \return \a ret if \a ret >= 0, \p -E_OSL otherwise.
+ * \return \a ret if \a ret >= 0, a paraslash error code otherwise.
*/
_static_inline_ int osl(int ret)
{
return OSL_ERRNO_TO_PARA_ERROR(-ret);
}
-
/**
* Define the error list for one subsystem.
#
#include <sys/types.h>
#include <dirent.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
/** \file mood.c Paraslash's mood handling functions. */
#include <fnmatch.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
.data = mood_name,
.size = strlen(mood_name) + 1
};
- ret = osl_get_row(moods_table, BLOBCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(moods_table, BLOBCOL_NAME, &obj, &row));
if (ret < 0) {
PARA_NOTICE_LOG("no such mood: %s\n", mood_name);
return ret;
* Johannes Overmann <overmann@iname.com>
*/
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "afh.h"
#include <ogg/ogg.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
+#include <osl.h>
#include "para.h"
#include "afh.h"
* Licensed under the GPL v2. For licencing details see COPYING.
*/
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
obj.data = name;
obj.size = strlen(obj.data);
- ret = osl_get_row(playlists_table, BLOBCOL_NAME, &obj, &row);
+ ret = osl(osl_get_row(playlists_table, BLOBCOL_NAME, &obj, &row));
if (ret < 0) {
PARA_NOTICE_LOG("failed to load playlist %s\n", name);
return ret;
*/
/** \file score.c Scoring functions to determine the audio file streaming order. */
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
*/
int get_num_admissible_files(unsigned *num)
{
- return osl_get_num_rows(score_table, num);
+ return osl(osl_get_num_rows(score_table, num));
}
/**
static int get_score_of_row(void *score_row, long *score)
{
struct osl_object obj;
- int ret = osl_get_object(score_table, score_row, SCORECOL_SCORE, &obj);
+ int ret = osl(osl_get_object(score_table, score_row, SCORECOL_SCORE, &obj));
if (ret >= 0)
*score = *(long *)obj.data;
*(int *)(score_objs[SCORECOL_SCORE].data) = score;
// PARA_DEBUG_LOG("adding %p\n", *(void **) (score_objs[SCORECOL_AFT_ROW].data));
- ret = osl_add_row(score_table, score_objs);
+ ret = osl(osl_add_row(score_table, score_objs));
if (ret < 0) {
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
free(score_objs[SCORECOL_SCORE].data);
static int get_nth_score(unsigned n, long *score)
{
struct osl_row *row;
- int ret = osl_get_nth_row(score_table, SCORECOL_SCORE, n, &row);
+ int ret = osl(osl_get_nth_row(score_table, SCORECOL_SCORE, n, &row));
if (ret < 0)
return ret;
unsigned n, new_pos;
struct osl_object obj = {.data = (struct osl_row *)aft_row,
.size = sizeof(aft_row)};
- int ret = osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, &row);
+ int ret = osl(osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, &row));
- if (ret == -E_OSL_RB_KEY_NOT_FOUND) /* not an error */
+ if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND)) /* not an error */
return 1;
if (ret < 0)
return ret;
obj.data = para_malloc(obj.size);
*(long *)obj.data = new_score;
PARA_DEBUG_LOG("new score: %ld, rank %u/%u\n", new_score, new_pos, n);
- return osl_update_object(score_table, row, SCORECOL_SCORE, &obj);
+ return osl(osl_update_object(score_table, row, SCORECOL_SCORE, &obj));
}
/**
if (ret < 0)
return ret;
- ret = osl_get_object(score_table, score_row, SCORECOL_AFT_ROW, &obj);
+ ret = osl(osl_get_object(score_table, score_row, SCORECOL_AFT_ROW, &obj));
if (ret < 0)
return ret;
*aft_row = obj.data;
{
struct osl_object obj = {.data = (struct osl_row *)aft_row,
.size = sizeof(aft_row)};
- return osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, score_row);
-
+ return osl(osl_get_row(score_table, SCORECOL_AFT_ROW, &obj, score_row));
}
/**
*/
int admissible_file_loop(void *data, osl_rbtree_loop_func *func)
{
- return osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func);
+ return osl(osl_rbtree_loop(score_table, SCORECOL_SCORE, data, func));
}
/**
*/
int admissible_file_loop_reverse(void *data, osl_rbtree_loop_func *func)
{
- return osl_rbtree_loop_reverse(score_table, SCORECOL_SCORE, data, func);
+ return osl(osl_rbtree_loop_reverse(score_table, SCORECOL_SCORE, data, func));
}
/**
{
struct osl_row *row;
struct osl_object obj;
- int ret = osl_rbtree_last_row(score_table, SCORECOL_SCORE, &row);
+ int ret = osl(osl_rbtree_last_row(score_table, SCORECOL_SCORE, &row));
if (ret < 0)
return ret;
- ret = osl_get_object(score_table, row, SCORECOL_AFT_ROW, &obj);
+ ret = osl(osl_get_object(score_table, row, SCORECOL_AFT_ROW, &obj));
if (ret < 0)
return ret;
*aft_row = obj.data;
if (ret < 0)
return ret;
- return osl_del_row(score_table, score_row);
+ return osl(osl_del_row(score_table, score_row));
}
/**
struct osl_row *score_row;
int ret = get_score_row_from_aft_row(aft_row, &score_row);
- if (ret == -E_OSL_RB_KEY_NOT_FOUND)
+ if (ret == -OSL_ERRNO_TO_PARA_ERROR(E_OSL_RB_KEY_NOT_FOUND))
return 0;
if (ret < 0)
return ret;
if (!rank)
return 1;
- ret = osl_get_rank(score_table, score_row, SCORECOL_SCORE, rank);
+ ret = osl(osl_get_rank(score_table, score_row, SCORECOL_SCORE, rank));
if (ret < 0)
return ret;
return 1;
static int score_open(__a_unused const char *dir)
{
score_table_desc.dir = NULL; /* this table has only volatile columns */
- return osl_open_table(&score_table_desc, &score_table);
+ return osl(osl_open_table(&score_table_desc, &score_table));
}
/**
/** \file send_common.c Functions used by more than one paraslash sender. */
#include <dirent.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
#include "string.h"
#include <signal.h>
#include <dirent.h>
#include <sys/time.h>
+#include <osl.h>
#include "para.h"
#include "error.h"
#include <dirent.h>
#include <sys/socket.h>
#include <net/if.h>
+#include <osl.h>
#include "server.cmdline.h"
#include "para.h"
*/
#include <dirent.h>
+#include <osl.h>
#include "para.h"
#include "error.h"