nfs-ganesha 1.4
|
Header file for functions used by several layers. More...
#include <strings.h>
#include <string.h>
#include <errno.h>
#include <err_ghost_fs.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <pthread.h>
#include "cmd_tools.h"
#include <grp.h>
Go to the source code of this file.
Defines | |
#define | TIME_STRLEN 30 |
#define | print_mask(_out, _mode, _mask, _lettre) |
Functions | |
struct tm * | Localtime_r (const time_t *p_time, struct tm *p_tm) |
int | my_atoi (char *str) |
int | atomode (char *str) |
int | ato64 (char *str, unsigned long long *out64) |
time_t | atotime (char *str) |
void | split_path (char *in_path, char **p_path, char **p_file) |
char * | time2str (time_t time_in, char *str_out) |
void | clean_path (char *str, int len) |
void | print_fsal_status (FILE *output, fsal_status_t status) |
void | fsal_status_to_string (char *output, fsal_status_t status) |
void | print_fsal_attrib_mask (fsal_attrib_mask_t mask, FILE *output) |
char * | strtype (fsal_nodetype_t type) |
void | print_fsal_attributes (fsal_attrib_list_t attrs, FILE *output) |
void | print_item_line (FILE *out, fsal_attrib_list_t *attrib, char *name, char *target) |
int | MkFSALSetAttrStruct (char *attribute_list, fsal_attrib_list_t *fsal_set_attr_struct) |
struct timeval | time_diff (struct timeval time_from, struct timeval time_to) |
char * | concat (char *str1, char *str2, size_t max_len) |
int | getugroups (int maxcount, gid_t *grouplist, char *username, gid_t gid) |
Header file for functions used by several layers.
Revision 1.24 2006/01/20 14:44:13 leibovic altgroups support.
Revision 1.23 2006/01/17 14:56:22 leibovic Adaptation de HPSS 6.2.
Revision 1.21 2005/09/28 09:08:00 leibovic thread-safe version of localtime.
Revision 1.20 2005/09/09 15:23:11 leibovic Adding "cross" command for crossing junctions.
Revision 1.19 2005/08/12 11:21:27 leibovic Now, set cat concatenate strings.
Revision 1.18 2005/07/27 14:19:08 leibovic Changing fsal_time_t printing.
Revision 1.17 2005/05/11 15:53:36 leibovic Adding time function.
Revision 1.16 2005/05/03 09:38:25 leibovic Adding handle adressing support.
Revision 1.15 2005/04/25 15:25:54 leibovic Handling daylight saving.
Revision 1.14 2005/04/25 12:57:48 leibovic Implementing setattr.
Revision 1.13 2005/04/14 11:21:56 leibovic Changing command syntax.
Revision 1.12 2005/04/13 09:28:05 leibovic Adding unlink and mkdir calls.
Revision 1.11 2005/03/15 15:30:07 leibovic localtime_r -> localtime.
Revision 1.10 2005/03/14 10:49:18 leibovic Changing time printing.
Revision 1.9 2005/03/09 15:43:25 leibovic Multi-OS compiling.
Revision 1.8 2005/03/04 08:01:32 leibovic removing snprintmem (moved to FSAL layer)à.
Revision 1.7 2005/01/31 14:09:03 leibovic Portage to Linux.
Revision 1.6 2005/01/21 13:31:26 leibovic Code clenaning.
Revision 1.5 2005/01/11 08:27:38 leibovic Implementing Cache_inode layer tests.
Revision 1.4 2005/01/07 09:12:13 leibovic Improved Cache_inode shell version.
Revision 1.3 2004/12/17 16:05:27 leibovic Replacing X with snprintmem for handles printing.
Revision 1.2 2004/12/09 15:53:50 leibovic A debug printf had been left.
Revision 1.1 2004/12/09 15:46:22 leibovic Tools externalisation.
Definition in file cmd_tools.c.
#define print_mask | ( | _out, | |
_mode, | |||
_mask, | |||
_lettre | |||
) |
do { \ if (_mode & _mask) fprintf(_out,_lettre);\ else fprintf(_out,"-"); \ } while(0)
print_item_line: Prints a filesystem element on one line, like the Unix ls command.
out | (in FILE*) The file where the item is to be printed. |
attrib | (in fsal_attrib_list_t *) the attributes for the item. |
name | (in char *) The name of the item to be printed. |
target | (in char *) It the item is a symbolic link, this contains the link target. |
Definition at line 848 of file cmd_tools.c.
#define TIME_STRLEN 30 |
int ato64 | ( | char * | str, |
unsigned long long * | out64 | ||
) |
Definition at line 215 of file cmd_tools.c.
int atomode | ( | char * | str | ) |
atomode: This function converts a string to a unix access mode.
str | (in char *) The string to be converted. |
Definition at line 190 of file cmd_tools.c.
time_t atotime | ( | char * | str | ) |
convert time from "YYYYMMDDHHMMSS" to time_t.
Definition at line 247 of file cmd_tools.c.
void clean_path | ( | char * | str, |
int | len | ||
) |
clean_path: Transform a path to a cannonical path. Remove //, /./, /../, final / from a POSIX-like path.
str | (in/out char*) The path to be transformed. |
len | (in int) The max path length. |
Definition at line 513 of file cmd_tools.c.
char* concat | ( | char * | str1, |
char * | str2, | ||
size_t | max_len | ||
) |
concat: concatenates 2 strings with a limitation of the size of the destination string.
str1 | (in/out char*) The destination string. |
str2 | (in char*) The string to be added at the end of str1. |
max_len | (in int) The max str1 length. |
Definition at line 1152 of file cmd_tools.c.
void fsal_status_to_string | ( | char * | output, |
fsal_status_t | status | ||
) |
fsal_status_to_string: this function converts an fsal_status_t to a a string buffer
output | (in char *) The output where the status is to be printed. |
status | (in status) The status to be printed. |
Definition at line 695 of file cmd_tools.c.
int getugroups | ( | int | maxcount, |
gid_t * | grouplist, | ||
char * | username, | ||
gid_t | gid | ||
) |
Definition at line 1167 of file cmd_tools.c.
struct tm* Localtime_r | ( | const time_t * | p_time, |
struct tm * | p_tm | ||
) | [read] |
Definition at line 125 of file cmd_tools.c.
int MkFSALSetAttrStruct | ( | char * | attribute_list, |
fsal_attrib_list_t * | fsal_set_attr_struct | ||
) |
this function converts peers (attr_name=attr_value,attr_name=attr_value,...) to a fsal_attrib_list_t to be used in the FSAL_setattr call).
Definition at line 983 of file cmd_tools.c.
int my_atoi | ( | char * | str | ) |
my_atoi: This function converts a string to an integer.
str | (in char *) The string to be converted. |
Definition at line 156 of file cmd_tools.c.
void print_fsal_attrib_mask | ( | fsal_attrib_mask_t | mask, |
FILE * | output | ||
) |
print_fsal_attrib_mask: Print an fsal_attrib_mask_t to a given output file.
mask | (in fsal_attrib_mask_t) The mask to be printed. |
output | (in FILE *) The output where the mask is to be printed. |
Definition at line 720 of file cmd_tools.c.
void print_fsal_attributes | ( | fsal_attrib_list_t | attrs, |
FILE * | output | ||
) |
print_fsal_attributes: print an fsal_attrib_list_t to a given output file.
attrs | (in fsal_attrib_list_t) The attributes to be printed. |
output | (in FILE *) The file where the attributes are to be printed. |
Definition at line 798 of file cmd_tools.c.
void print_fsal_status | ( | FILE * | output, |
fsal_status_t | status | ||
) |
print_fsal_status: this function prints an fsal_status_t to a given output file.
output | (in FILE *) The output where the status is to be printed. |
status | (in status) The status to be printed. |
Definition at line 666 of file cmd_tools.c.
void print_item_line | ( | FILE * | out, |
fsal_attrib_list_t * | attrib, | ||
char * | name, | ||
char * | target | ||
) |
print_item_line: Prints a filesystem element on one line, like the Unix ls command.
out | (in FILE*) The file where the item is to be printed. |
attrib | (in fsal_attrib_list_t *) the attributes for the item. |
name | (in char *) The name of the item to be printed. |
target | (in char *) It the item is a symbolic link, this contains the link target. |
Definition at line 853 of file cmd_tools.c.
void split_path | ( | char * | in_path, |
char ** | p_path, | ||
char ** | p_file | ||
) |
split_path: splits a path 'dir/dir/dir/obj' in two strings : 'dir/dir/dir' and 'obj'.
in_path | (in/out char *) |
p_path | (out char **) |
p_file | (out char **) |
Definition at line 408 of file cmd_tools.c.
char* strtype | ( | fsal_nodetype_t | type | ) |
strtype: convert an FSAL object type to a string.
type | (in fsal_nodetype_t) The type to be printed. |
Definition at line 767 of file cmd_tools.c.
char* time2str | ( | time_t | time_in, |
char * | str_out | ||
) |
Definition at line 472 of file cmd_tools.c.
struct timeval time_diff | ( | struct timeval | time_from, |
struct timeval | time_to | ||
) | [read] |
Definition at line 1130 of file cmd_tools.c.