nfs-ganesha 1.4
Defines | Functions

fsal_convert.c File Reference

#include "fsal_convert.h"
#include "fsal_internal.h"
#include <sys/types.h>
#include <errno.h>
#include <hpss_errno.h>

Go to the source code of this file.

Defines

#define MAX_2(x, y)   ( (x) > (y) ? (x) : (y) )
#define MAX_3(x, y, z)   ( (x) > (y) ? MAX_2((x),(z)) : MAX_2((y),(z)) )

Functions

int hpss2fsal_error (int hpss_errorcode)
int fsal2hpss_testperm (fsal_accessflags_t testperm)
int fsal2hpss_openflags (fsal_openflags_t fsal_flags, int *p_hpss_flags)
fsal_nodetype_t hpss2fsal_type (unsigned32 hpss_type_in)
fsal_time_t hpss2fsal_time (timestamp_sec_t tsec)
fsal_u64_t hpss2fsal_64 (u_signed64 hpss_size_in)
u_signed64 fsal2hpss_64 (fsal_u64_t fsal_size_in)
fsal_fsid_t hpss2fsal_fsid (u_signed64 hpss_fsid_in)
fsal_accessmode_t hpss2fsal_mode (unsigned32 uid_bit, unsigned32 gid_bit, unsigned32 sticky_bit, unsigned32 user_perms, unsigned32 group_perms, unsigned32 other_perms)
void fsal2hpss_mode (fsal_accessmode_t fsal_mode, unsigned32 *uid_bit, unsigned32 *gid_bit, unsigned32 *sticky_bit, unsigned32 *user_perms, unsigned32 *group_perms, unsigned32 *other_perms)
fsal_status_t hpss2fsal_attributes (ns_ObjHandle_t *p_hpss_handle_in, hpss_Attrs_t *p_hpss_attr_in, fsal_attrib_list_t *p_fsalattr_out)
fsal_status_t hpssHandle2fsalAttributes (ns_ObjHandle_t *p_hpsshandle_in, fsal_attrib_list_t *p_fsalattr_out)
fsal_status_t fsal2hpss_attribset (hpssfsal_handle_t *p_fsal_handle, fsal_attrib_list_t *p_attrib_set, hpss_fileattrbits_t *p_hpss_attrmask, hpss_Attrs_t *p_hpss_attrs)

Define Documentation

#define MAX_2 (   x,
 
)    ( (x) > (y) ? (x) : (y) )

Definition at line 24 of file FSAL_HPSS/fsal_convert.c.

#define MAX_3 (   x,
  y,
 
)    ( (x) > (y) ? MAX_2((x),(z)) : MAX_2((y),(z)) )

Definition at line 25 of file FSAL_HPSS/fsal_convert.c.


Function Documentation

u_signed64 fsal2hpss_64 ( fsal_u64_t  fsal_size_in)

fsal2hpss_64: Convert fsal_u64_t type to HPSS u_signed64 type.

Parameters:
fsal_size_in(input): The FSAL 64 bits number.
Returns:
- The HPSS 64 bits number.

Definition at line 389 of file FSAL_HPSS/fsal_convert.c.

fsal_status_t fsal2hpss_attribset ( hpssfsal_handle_t p_fsal_handle,
fsal_attrib_list_t p_attrib_set,
hpss_fileattrbits_t *  p_hpss_attrmask,
hpss_Attrs_t *  p_hpss_attrs 
)

fsal2hpss_attribset: Converts an fsal attrib list to a hpss attrib list and values to be used in Setattr.

Parameters:
p_fsal_handle(input): Pointer to the FSAL object handle.
p_attrib_set(input): Pointer to the FSAL attributes to be set.
p_hpss_attrmask(output): Pointer to the HPSS attribute list associated to the FSAL asked_attributes.
p_hpss_attrs(output): Pointer to the HPSS attribute values associated to input attributes.
Returns:
Major error codes:
  • ERR_FSAL_NO_ERROR: no error.
  • ERR_FSAL_FAULT: NULL pointer passed as parameter.
  • ERR_FSAL_ATTRNOTSUPP: Some of the asked attributes are not supported.
  • ERR_FSAL_INVAL: Some of the asked attributes are read-only.
  • ERR_FSAL_SERVERFAULT: Unexpected error.

Todo:
: Define some constants for settable and supported attributes.
Todo:
ACL management

Definition at line 883 of file FSAL_HPSS/fsal_convert.c.

void fsal2hpss_mode ( fsal_accessmode_t  fsal_mode,
unsigned32 *  uid_bit,
unsigned32 *  gid_bit,
unsigned32 *  sticky_bit,
unsigned32 *  user_perms,
unsigned32 *  group_perms,
unsigned32 *  other_perms 
)

fsal2hpss_mode: converts FSAL mode to HPSS mode.

Parameters:
fsal_mode(input): The fsal mode to be translated.
uid_bit(output): The uid_bit field to be set in HPSS object attributes.
gid_bit(output): The gid_bit field to be set in HPSS object attributes.
sticky_bit(output): The sticky_bit field to be set in HPSS object attributes.
user_perms(output): The user_perms field to be set in HPSS object attributes.
group_perms(output): The group_perms field to be set in HPSS object attributes.
other_perms(output): The other_perms field to be set in HPSS object attributes.
Returns:
Nothing.

Definition at line 505 of file FSAL_HPSS/fsal_convert.c.

int fsal2hpss_openflags ( fsal_openflags_t  fsal_flags,
int *  p_hpss_flags 
)

fsal2hpss_openflags: Convert FSAL open flags to (HPSS) Posix open flags.

Parameters:
fsal_flags(input): The FSAL open flags to be translated.
p_hpss_flags(output): Pointer to the HPSS open flags.
Returns:
- ERR_FSAL_NO_ERROR (no error).
  • ERR_FSAL_FAULT (p_hpss_flags is a NULL pointer).
  • ERR_FSAL_INVAL (invalid or incompatible input flags).

Definition at line 252 of file FSAL_HPSS/fsal_convert.c.

int fsal2hpss_testperm ( fsal_accessflags_t  testperm)

fsal2hpss_testperm: Convert FSAL permission flags to (HPSS) Posix permission flags.

Parameters:
testperm(input): The FSAL permission flags to be tested.
Returns:
The HPSS permission flags to be tested.

Definition at line 221 of file FSAL_HPSS/fsal_convert.c.

fsal_u64_t hpss2fsal_64 ( u_signed64  hpss_size_in)

hpss2fsal_64: Convert HPSS u_signed64 type to fsal_u64_t type.

Parameters:
hpss_size_in(input): The HPSS 64 bits number.
Returns:
- The FSAL 64 bits number.

Definition at line 371 of file FSAL_HPSS/fsal_convert.c.

fsal_status_t hpss2fsal_attributes ( ns_ObjHandle_t *  p_hpss_handle_in,
hpss_Attrs_t *  p_hpss_attr_in,
fsal_attrib_list_t p_fsalattr_out 
)

hpss2fsal_attributes: Fills an FSAL attributes structure with the info provided by the hpss handle and the hpss attributes of an object.

Parameters:
p_hpss_handle_in(input): Pointer to the HPSS NS object handle.
p_hpss_attr_in(input): Pointer to the HPSS attributes.
p_fsalattr_out(input/output): Pointer to the FSAL attributes. As input, it defines the attributes that the caller wants to retrieve (by positioning flags into this structure) and the output is built considering this input (it fills the structure according to the flags it contains).
p_cred(input) HPSS Credential.
Returns:
Major error codes:
  • ERR_FSAL_NO_ERROR: no error.
  • ERR_FSAL_FAULT: NULL pointer passed as input parameter.
  • ERR_FSAL_ATTRNOTSUPP: One of the asked attributes is not supported.
  • ERR_FSAL_SERVERFAULT: Unexpected error.

Todo:
: This doesn't convert ACLs for the moment.

Definition at line 602 of file FSAL_HPSS/fsal_convert.c.

int hpss2fsal_error ( int  hpss_errorcode)

hpss2fsal_error : Convert HPSS error codes to FSAL error codes.

Parameters:
hpss_errorcode(input): The error code returned from HPSS.
Returns:
The FSAL error code associated to hpss_errorcode.

Todo:
: The EBADF error also happens when file is opened for reading, and we try writting in it. In this case, we return ERR_FSAL_NOT_OPENED, but it doesn't seems to be a correct error translation.
Warning:
AIX returns EEXIST where BSD uses ENOTEMPTY; We want ENOTEMPTY to be interpreted anyway on AIX plateforms. Thus, we explicitely write its value (87).

Definition at line 38 of file FSAL_HPSS/fsal_convert.c.

fsal_fsid_t hpss2fsal_fsid ( u_signed64  hpss_fsid_in)

hpss2fsal_fsid: Convert HPSS fsid type to FSAL fsid type.

Parameters:
hpss_fsid_in(input): The HPSS fsid to be translated.
Returns:
- The FSAL fsid associated to hpss_fsid_in.

Definition at line 408 of file FSAL_HPSS/fsal_convert.c.

fsal_accessmode_t hpss2fsal_mode ( unsigned32  uid_bit,
unsigned32  gid_bit,
unsigned32  sticky_bit,
unsigned32  user_perms,
unsigned32  group_perms,
unsigned32  other_perms 
)

hpss2fsal_mode: Convert HPSS mode to FSAL mode.

Parameters:
uid_bit(input): The uid_bit field from HPSS object attributes.
gid_bit(input): The gid_bit field from HPSS object attributes.
sticky_bit(input): The sticky_bit field from HPSS object attributes.
user_perms(input): The user_perms field from HPSS object attributes.
group_perms(input): The group_perms field from HPSS object attributes.
other_perms(input): The other_perms field from HPSS object attributes.
Returns:
The FSAL mode associated to input parameters.

Definition at line 439 of file FSAL_HPSS/fsal_convert.c.

fsal_time_t hpss2fsal_time ( timestamp_sec_t  tsec)

hpss2fsal_time: Convert HPSS time structure (timestamp_sec_t) to FSAL time type (fsal_time_t).

Definition at line 350 of file FSAL_HPSS/fsal_convert.c.

fsal_nodetype_t hpss2fsal_type ( unsigned32  hpss_type_in)

hpss2fsal_type: Convert HPSS NS object type to FSAL node type.

Parameters:
hpss_type_in(input): The HPSS NS object type from NSObjHandle.Type.
Returns:
- The FSAL node type associated to hpss_type_in.
  • -1 if the input type is unknown.

Definition at line 319 of file FSAL_HPSS/fsal_convert.c.

fsal_status_t hpssHandle2fsalAttributes ( ns_ObjHandle_t *  p_hpsshandle_in,
fsal_attrib_list_t p_fsalattr_out 
)

hpssHandle2fsalAttributes: Fills an FSAL attributes structure with the info provided (only) by the hpss handle of an object.

Parameters:
p_hpsshandle_in(input): Pointer to the HPSS NS object handle.
p_fsalattr_out(input/output): Pointer to the FSAL attributes. As input, it defines the attributes that the caller wants to retrieve (by positioning flags into this structure) and the output is built considering this input (it fills the structure according to the flags it contains).
Returns:
Major error codes:
  • ERR_FSAL_NO_ERROR: no error.
  • ERR_FSAL_FAULT: NULL pointer passed as input parameter.
  • ERR_FSAL_ATTRNOTSUPP: One of the asked attributes is not supported.
  • ERR_FSAL_SERVERFAULT: Unexpected error.

Definition at line 817 of file FSAL_HPSS/fsal_convert.c.