home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / include / pvfs2-util.h < prev    next >
C/C++ Source or Header  |  2007-11-07  |  3KB  |  117 lines

  1. /*
  2.  * (C) 2001 Clemson University and The University of Chicago
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */
  6.  
  7. /* This header includes prototypes for utility functions that may be
  8.  * useful to implementors working at the pvfs2 system interface level.
  9.  */
  10.  
  11. #ifndef __PVFS2_UTIL_H
  12. #define __PVFS2_UTIL_H
  13.  
  14.  
  15. #include "pvfs2.h"
  16. #include "pvfs2-types.h"
  17.  
  18. /* Define min macro with pvfs2 prefix */
  19. #ifndef PVFS_util_min
  20. #define PVFS_util_min(x1,x2) ((x1) > (x2))? (x2):(x1)
  21. #endif
  22.  
  23. #ifndef PVFS_util_max
  24. #define PVFS_util_max(x1,x2) ((x1) > (x2)) ? (x1) : (x2)
  25. #endif
  26.  
  27. /* results of parsing a pvfs2 tabfile, may contain more than one entry */
  28. struct PVFS_util_tab_s
  29. {
  30.     int mntent_count;                      /* number of mnt entries */
  31.     struct PVFS_sys_mntent *mntent_array;  /* mnt entries */
  32.     char tabfile_name[PVFS_NAME_MAX];      /* name of tabfile */
  33. };
  34. typedef struct PVFS_util_tab_s PVFS_util_tab;
  35.  
  36. /* client side default credential generation */
  37. void PVFS_util_gen_credentials(
  38.     PVFS_credentials *credentials);
  39.  
  40. /* returns the currently set umask */
  41. int PVFS_util_get_umask(void);
  42.  
  43. /*
  44.   shallow copies the credentials into a newly allocated returned
  45.   credential object.  returns NULL on failure.
  46. */
  47. PVFS_credentials *PVFS_util_dup_credentials(
  48.     const PVFS_credentials *credentials);
  49.  
  50. struct PVFS_sys_mntent* PVFS_util_gen_mntent(
  51.     char* config_server,
  52.     char* fs_name);
  53.  
  54. void PVFS_util_gen_mntent_release(struct PVFS_sys_mntent* mntent);
  55.  
  56. void PVFS_util_release_credentials(
  57.     PVFS_credentials *credentials);
  58.  
  59. int PVFS_util_copy_sys_attr(
  60.     PVFS_sys_attr *dest_attr,
  61.     PVFS_sys_attr *src_attr);
  62. void PVFS_util_release_sys_attr(
  63.     PVFS_sys_attr *attr);
  64.  
  65. int PVFS_util_init_defaults(void);
  66.  
  67. /* client side config file / option management */
  68. const PVFS_util_tab* PVFS_util_parse_pvfstab(
  69.     const char* tabfile);
  70. void PINT_release_pvfstab(void);
  71. int PVFS_util_resolve(
  72.     const char* local_path,
  73.     PVFS_fs_id* out_fs_id,
  74.     char* out_fs_path,
  75.     int out_fs_path_max);
  76. int PVFS_util_get_default_fsid(
  77.     PVFS_fs_id* out_fs_id);
  78.  
  79. int PVFS_util_add_dynamic_mntent(
  80.     struct PVFS_sys_mntent *mntent);
  81. int PVFS_util_remove_internal_mntent(
  82.     struct PVFS_sys_mntent *mntent);
  83.  
  84. int PVFS_util_get_mntent_copy(
  85.     PVFS_fs_id fs_id,
  86.     struct PVFS_sys_mntent *out_mntent);
  87. int PVFS_util_copy_mntent(
  88.     struct PVFS_sys_mntent *dest_mntent,
  89.     struct PVFS_sys_mntent *src_mntent);
  90. void PVFS_util_free_mntent(
  91.     struct PVFS_sys_mntent *mntent);
  92.  
  93. void PVFS_util_make_size_human_readable(
  94.     PVFS_size size,
  95.     char *out_str,
  96.     int max_out_len,
  97.     int use_si_units);
  98.  
  99. uint32_t PVFS_util_sys_to_object_attr_mask(
  100.     uint32_t sys_attrmask);
  101.  
  102. uint32_t PVFS_util_object_to_sys_attr_mask( 
  103.     uint32_t obj_mask);
  104.  
  105. int32_t PVFS_util_translate_mode(int mode, int suid);
  106.  
  107. #endif /* __PVFS2_UTIL_H */
  108.  
  109. /*
  110.  * Local variables:
  111.  *  c-indent-level: 4
  112.  *  c-basic-offset: 4
  113.  * End:
  114.  *
  115.  * vim: ts=8 sts=4 sw=4 expandtab
  116.  */
  117.