nfs-ganesha 1.4
Classes | Defines | Typedefs | Enumerations | Functions

cmd_tools.h File Reference

Header file for functions used by several layers. More...

#include "fsal.h"
#include <time.h>

Go to the source code of this file.

Classes

struct  shell_attribute__

Defines

#define print_timeval(out, _tv_)   fprintf(out,"%ld.%.6ld s\n",_tv_.tv_sec,_tv_.tv_usec)

Typedefs

typedef enum shell_attr_type__ shell_attr_type_t
typedef struct shell_attribute__ shell_attribute_t

Enumerations

enum  shell_attr_type__ {
  ATTR_NONE = 0, ATTR_32, ATTR_64, ATTR_OCTAL,
  ATTR_TIME
}

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)
char * time2str (time_t time_in, char *str_out)
void split_path (char *in_path, char **p_path, char **p_file)
void clean_path (char *str, int len)
char * concat (char *str1, char *str2, size_t max_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)
int getugroups (int maxcount, gid_t *grouplist, char *username, gid_t gid)

Detailed Description

Header file for functions used by several layers.

Author:
Author:
leibovic
Date:
$Date $
Version:
$Revision $
Log:
cmd_tools.h,v

Revision 1.14 2006/01/24 13:49:33 leibovic Adding missing includes.

Revision 1.13 2006/01/20 14:44:14 leibovic altgroups support.

Revision 1.12 2006/01/17 14:56:22 leibovic Adaptation de HPSS 6.2.

Revision 1.11 2005/09/28 09:08:00 leibovic thread-safe version of localtime.

Revision 1.10 2005/08/12 11:56:58 leibovic coquille.

Revision 1.9 2005/08/12 11:21:27 leibovic Now, set cat concatenate strings.

Revision 1.8 2005/05/11 15:53:37 leibovic Adding time function.

Revision 1.7 2005/05/09 12:23:54 leibovic Version 2 of ganeshell.

Revision 1.6 2005/04/25 12:57:48 leibovic Implementing setattr.

Revision 1.5 2005/04/14 11:21:56 leibovic Changing command syntax.

Revision 1.4 2005/04/13 09:28:05 leibovic Adding unlink and mkdir calls.

Revision 1.3 2005/03/04 08:01:32 leibovic removing snprintmem (moved to FSAL layer)à.

Revision 1.2 2004/12/17 16:05:27 leibovic Replacing X with snprintmem for handles printing.

Revision 1.1 2004/12/09 15:46:22 leibovic Tools externalisation.

Definition in file cmd_tools.h.


Define Documentation

#define print_timeval (   out,
  _tv_ 
)    fprintf(out,"%ld.%.6ld s\n",_tv_.tv_sec,_tv_.tv_usec)

Definition at line 275 of file cmd_tools.h.


Typedef Documentation

Type of attributes

Attribute definition structure.


Enumeration Type Documentation

Type of attributes

Enumerator:
ATTR_NONE 
ATTR_32 
ATTR_64 
ATTR_OCTAL 
ATTR_TIME 

Definition at line 215 of file cmd_tools.h.


Function Documentation

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.

Parameters:
str(in char *) The string to be converted.
Returns:
A negative value on error. Else, the access mode integer.

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.

Parameters:
str(in/out char*) The path to be transformed.
len(in int) The max path length.
Returns:
Nothing.

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.

Parameters:
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.
Returns:
NULL on error, the destination string, else.

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

Parameters:
output(in char *) The output where the status is to be printed.
status(in status) The status to be printed.
Returns:
Nothing.

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).

Returns:
0 if no error occured, a non null value else.

Definition at line 983 of file cmd_tools.c.

int my_atoi ( char *  str)

my_atoi: This function converts a string to an integer.

Parameters:
str(in char *) The string to be converted.
Returns:
A negative value on error. Else, the converted integer.

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.

Parameters:
mask(in fsal_attrib_mask_t) The mask to be printed.
output(in FILE *) The output where the mask is to be printed.
Returns:
Nothing.

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.

Parameters:
attrs(in fsal_attrib_list_t) The attributes to be printed.
output(in FILE *) The file where the attributes are to be printed.
Returns:
Nothing.

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.

Parameters:
output(in FILE *) The output where the status is to be printed.
status(in status) The status to be printed.
Returns:
Nothing.

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.

Parameters:
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.
Returns:
Nothing.

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'.

Parameters:
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.

Parameters:
type(in fsal_nodetype_t) The type to be printed.
Returns:
The name (char *) for this FSAL object type.

Definition at line 69 of file FSAL_CEPH/test_fsal.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 476 of file nfs_worker_thread.c.