nfs-ganesha 1.4
Classes | Defines | Typedefs | Functions

nodelist.h File Reference

Go to the source code of this file.

Classes

struct  nodelist_range
 structure that represent a range of long int value More...
struct  nodelist_rangelist
 structure that represent a range of long int value More...
struct  nodelist_idlist
 structure that represent a range of long int value More...
struct  nodelist_nodepattern
 structure that represent a nodename pattern More...
struct  nodelist_nodelist
 structure that represent a range of long int value More...

Defines

#define xfree(a)
#define VERSUS_OPERATION_INCLUDE   1
 Check a nodes list versus another one according to required operation operation can be inclusion or intersection.
#define VERSUS_OPERATION_INTERSECT   2

Typedefs

typedef struct nodelist_range nodelist_range_t
 structure that represent a range of long int value
typedef struct nodelist_rangelist nodelist_rangelist_t
 structure that represent a range of long int value
typedef struct nodelist_idlist nodelist_idlist_t
 structure that represent a range of long int value
typedef struct nodelist_nodepattern nodelist_nodepattern_t
 structure that represent a nodename pattern
typedef struct nodelist_nodelist nodelist_nodelist_t
 structure that represent a range of long int value

Functions

int nodelist_range_set (nodelist_range_t *r1, long int v1, long int v2)
 set bridge range values
int nodelist_range_check (nodelist_range_t *r1)
 Indicate if the range is a valid one. That is to say if from value is lower that to value.
int nodelist_range_compare (nodelist_range_t *r1, nodelist_range_t *r2)
 Indicate if the first range equals, is placed before or is placed after the second one.
int nodelist_range_intersects (nodelist_range_t *r1, nodelist_range_t *r2)
 Indicate if it exists an non empty intersection between the two input ranges.
int nodelist_range_intersection (nodelist_range_t *r1, nodelist_range_t *r2, nodelist_range_t *r3)
 Gives the range that is common to the two input ranges.
int nodelist_range_contiguous (nodelist_range_t *r1, nodelist_range_t *r2)
 Indicate if the two input ranges are contiguous.
int nodelist_range_includes (nodelist_range_t *r1, nodelist_range_t *r2)
 Indicate if one of the two input range is included in the other one.
int nodelist_range_union (nodelist_range_t *r1, nodelist_range_t *r2, nodelist_range_t *rout)
 Gives a nodelist_range that represent the union of the two nodelist_ranges given in input. The two ranges must intersect or be continuous otherwise operation will failed.
int nodelist_rangelist_init (nodelist_rangelist_t *array)
 Initialize a bridge ranges array structure.
int nodelist_rangelist_init_by_copy (nodelist_rangelist_t *array, nodelist_rangelist_t *a2c)
 Initialize a bridge ranges array structure by duplicating an other one.
int nodelist_rangelist_free_contents (nodelist_rangelist_t *array)
 Free a bridge ranges array structure contents.
int nodelist_rangelist_incremente_size (nodelist_rangelist_t *array)
 Increment a bridge ranges array storage zone.
int nodelist_rangelist_add_range (nodelist_rangelist_t *array, nodelist_range_t *r)
 Add a range to a bridge ranges array The range will be merge with already existing ranges if required and resulting ranges will be sorted.
int nodelist_rangelist_add_list (nodelist_rangelist_t *array, char *list)
 Add a list of values to a bridge ranges array The range will be merge with already existing ranges if required and resulting ranges will be sorted.
int nodelist_rangelist_sort (nodelist_rangelist_t *array)
 Sort a bridge ranges array.
int nodelist_idlist_init (nodelist_idlist_t *idlist, char **lists, int lists_nb)
 Initialize a bridge ids list structure.
int nodelist_idlist_free_contents (nodelist_idlist_t *idlist)
 Free a bridge ids list structure.
int nodelist_idlist_add_ids (nodelist_idlist_t *idlist, char *list)
 Add a ids list to a bridge ids list structure.
long int nodelist_idlist_ids_quantity (nodelist_idlist_t *idlist)
 Get ids quantity.
int nodelist_idlist_get_extended_string (nodelist_idlist_t *idlist, char **p_string)
 Get extended ids string.
int nodelist_idlist_get_compacted_string (nodelist_idlist_t *idlist, char **p_string)
 Get compacted ids string.
int nodelist_nodepattern_init (nodelist_nodepattern_t *np)
 Initialize a bridge node pattern structure.
int nodelist_nodepattern_init_by_copy (nodelist_nodepattern_t *np, nodelist_nodepattern_t *npin)
 Initialize a bridge node pattern structure by dumping an other one.
int nodelist_nodepattern_free_contents (nodelist_nodepattern_t *np)
 Clean a bridge node pattern structure.
int nodelist_nodepattern_set_padding (nodelist_nodepattern_t *np, int padding)
 Set bridge node pattern padding.
int nodelist_nodepattern_set_prefix (nodelist_nodepattern_t *np, char *prefix)
 Set bridge node pattern prefix.
int nodelist_nodepattern_set_suffix (nodelist_nodepattern_t *np, char *suffix)
 Set bridge node pattern prefix.
int nodelist_nodepattern_set_basic (nodelist_nodepattern_t *np)
 Set bridge node pattern basic flag.
int nodelist_nodepattern_unset_basic (nodelist_nodepattern_t *np)
 Unset bridge node pattern basic flag.
int nodelist_nodepattern_equals (nodelist_nodepattern_t *np1, nodelist_nodepattern_t *np2)
 Test if two bridge node patterns are identical.
int nodelist_nodelist_init (nodelist_nodelist_t *nodelist, char **lists, int lists_nb)
 Initialize a bridge nodes list structure.
int nodelist_nodelist_free_contents (nodelist_nodelist_t *nodelist)
 Free a bridge nodes list structure.
int nodelist_nodelist_add_nodes (nodelist_nodelist_t *nodelist, char *list)
 Add a nodes list to a bridge nodes list structure.
int nodelist_nodelist_versus_second_list (nodelist_nodelist_t *nodelist, nodelist_nodelist_t *second_list, int operation)
long int nodelist_nodelist_nodes_quantity (nodelist_nodelist_t *nodelist)
 Get nodes quantity.
int nodelist_nodelist_get_extended_string (nodelist_nodelist_t *nodelist, char **p_string)
 Get extended nodes string.
int nodelist_nodelist_get_compacted_string (nodelist_nodelist_t *nodelist, char **p_string)
 Get compacted nodes string.
int nodelist_common_condensed2extended_nodelist (char *src_list, char **p_dst_list)
 Get an extended nodes list based on a compacted one.
int nodelist_common_extended2condensed_nodelist (char *src_list, char **p_dst_list)
 Get an compacted nodes list based on a extended one.
int nodelist_common_string_get_tokens_quantity (char *string, char *separators_list, int *p_token_nb)
 Get number of tokens included in a string.
int nodelist_common_string_get_token (char *string, char *separators_list, int token_id, char **p_token)
 Get a specific token included in a string.
int nodelist_common_string_appends_and_extends (char **p_io_string, size_t *p_current_length, size_t inc_length, char *string2append, char *separator)
 Appends a char* giving a char* to append and an optionnal separator.

Define Documentation

#define xfree (   a)
Value:
if(a!=NULL){ \
  free(a); \
  a=NULL; \
}

Definition at line 5 of file nodelist.h.


Function Documentation

int nodelist_common_string_appends_and_extends ( char **  p_io_string,
size_t *  p_current_length,
size_t  inc_length,
char *  string2append,
char *  separator 
)

Appends a char* giving a char* to append and an optionnal separator.

Parameters:
p_io_stringpointer on the input char* that have to be appended
p_current_lengthpointer on the size_t that contains the current char* associated buffer (should be larger that string length)
inc_lengthincrementation step length
string2appendchar* that must be added
separatorchar* containing the separator
Return values:
0operation successfully done
-1operation failed

Definition at line 82 of file nodelist_common.c.

int nodelist_common_string_get_token ( char *  string,
char *  separators_list,
int  token_id,
char **  p_token 
)

Get a specific token included in a string.

Parameters:
stringinput string
separators_liststring containing allowed token 's separators
tokenid the id of the token in the list
p_tokenpointer on a string that will be set according to the token value (must be free later)
Return values:
0operation successfully done
-1operation failed

Definition at line 23 of file nodelist_common.c.

int nodelist_common_string_get_tokens_quantity ( char *  string,
char *  separators_list,
int *  p_token_nb 
)

Get number of tokens included in a string.

Parameters:
stringinput string
separators_liststring containing allowed token 's separators
p_token_nbpointer on an integer that will be set to tokens quantity found in the string
Return values:
0operation successfully done
-1operation failed

Definition at line 49 of file nodelist_common.c.