]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - osl_core.h
user_list.c: Simplify populate_user_list().
[paraslash.git] / osl_core.h
index 16a6775be607ae36a344bea9162c075e9fe90054..d6661617725e3436a78ba7ee12e19c42800462c6 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (C) 2007 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2007-2008 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -67,8 +67,12 @@ struct osl_table {
 
 /** Internal representation of a row of an osl table */
 struct osl_row {
 
 /** Internal representation of a row of an osl table */
 struct osl_row {
-       /** The row number only present if there is at least one mapped column. */
-       off_t id;
+       /**
+        * The row number.
+        *
+        * It is only used if there is at least one mapped column.
+        */
+       off_t num;
        /** Array of size \a num_volatile_columns. */
        struct osl_object *volatile_objects;
 };
        /** Array of size \a num_volatile_columns. */
        struct osl_object *volatile_objects;
 };
@@ -76,9 +80,9 @@ struct osl_row {
 int read_table_desc(struct osl_object *map, struct osl_table_description *desc);
 int init_table_structure(const struct osl_table_description *desc,
                struct osl_table **table_ptr);
 int read_table_desc(struct osl_object *map, struct osl_table_description *desc);
 int init_table_structure(const struct osl_table_description *desc,
                struct osl_table **table_ptr);
-int row_is_invalid(struct osl_table *t, uint32_t id);
+int row_is_invalid(struct osl_table *t, uint32_t row_num);
 int get_mapped_object(const struct osl_table *t, unsigned col_num,
 int get_mapped_object(const struct osl_table *t, unsigned col_num,
-       uint32_t id, struct osl_object *obj);
+       uint32_t row_num, struct osl_object *obj);
 int para_truncate(const char *filename, off_t size);
 int unmap_table(struct osl_table *t, enum osl_close_flags flags);
 int init_rbtrees(struct osl_table *t);
 int para_truncate(const char *filename, off_t size);
 int unmap_table(struct osl_table *t, enum osl_close_flags flags);
 int init_rbtrees(struct osl_table *t);
@@ -435,9 +439,9 @@ _static_inline_ struct osl_row *get_row_pointer(const struct rb_node *node,
  * \param obj the Object to compute the hash value from.
  * \param hash Result is returned here.
  */
  * \param obj the Object to compute the hash value from.
  * \param hash Result is returned here.
  */
-static inline void hash_object(const struct osl_object *obj, HASH_TYPE *hash)
+_static_inline_ void hash_object(const struct osl_object *obj, HASH_TYPE *hash)
 {
 {
-       return hash_function(obj->data, obj->size, hash);
+       hash_function(obj->data, obj->size, hash);
 }
 
 /**
 }
 
 /**
@@ -456,7 +460,7 @@ static inline void hash_object(const struct osl_object *obj, HASH_TYPE *hash)
  *
  * \sa struct osl_table:disk_storage_name_column.
  */
  *
  * \sa struct osl_table:disk_storage_name_column.
  */
-static inline char *disk_storage_name_of_hash(const struct osl_table *t, HASH_TYPE *hash)
+_static_inline_ char *disk_storage_name_of_hash(const struct osl_table *t, HASH_TYPE *hash)
 {
        char asc[2 * HASH_SIZE + 2];
 
 {
        char asc[2 * HASH_SIZE + 2];
 
@@ -472,14 +476,14 @@ static inline char *disk_storage_name_of_hash(const struct osl_table *t, HASH_TY
  * \param old_path The source path.
  * \param new_path The destination path.
  *
  * \param old_path The source path.
  * \param new_path The destination path.
  *
- * \return positive in success, \p -E_RENAME on errors.
+ * \return Standard.
  *
  * \sa rename(2).
  */
  *
  * \sa rename(2).
  */
-static inline int para_rename(const char *old_path, const char *new_path)
+_static_inline_ int para_rename(const char *old_path, const char *new_path)
 {
        if (rename(old_path, new_path) < 0)
 {
        if (rename(old_path, new_path) < 0)
-               return -E_RENAME;
+               return -ERRNO_TO_PARA_ERROR(errno);
        return 1;
 }
 
        return 1;
 }