nfs-ganesha 1.4

fsal_context.c

Go to the documentation of this file.
00001 
00010 #ifdef HAVE_CONFIG_H
00011 #include "config.h"
00012 #endif
00013 
00014 #include "fsal.h"
00015 #include "fsal_internal.h"
00016 #include <pwd.h>
00017 #include <errno.h>
00018 #include <stdlib.h>
00019 #include <string.h>
00020 
00021 const char *fs_specific_opts[] = {
00022   NULL
00023 };
00024 
00037 fsal_status_t POSIXFSAL_BuildExportContext(fsal_export_context_t * p_export_context,       /* OUT */
00038                                            fsal_path_t * p_export_path, /* IN */
00039                                            char *fs_specific_options    /* IN */
00040     )
00041 {
00042   /* Save pointer to fsal_staticfsinfo_t in export context */
00043   p_export_context->fe_static_fs_info = &global_fs_info;
00044 
00045   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_BuildExportContext);
00046 }
00047 
00048 fsal_status_t POSIXFSAL_InitClientContext(fsal_op_context_t * thr_context)
00049 {
00050   posixfsal_op_context_t * p_thr_context = (posixfsal_op_context_t *) thr_context;
00051   fsal_posixdb_status_t st;
00052 
00053   /* sanity check */
00054   if(!p_thr_context)
00055     Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_InitClientContext);
00056 
00057   /* initialy set the export entry to none */
00058   p_thr_context->export_context = NULL;
00059 
00060   st = fsal_posixdb_connect(&global_posixdb_params, &(p_thr_context->p_conn));
00061   if(FSAL_POSIXDB_IS_ERROR(st))
00062     {
00063       LogCrit(COMPONENT_FSAL,
00064               "CRITICAL ERROR: Worker could not connect to database !!!");
00065       Return(ERR_FSAL_SERVERFAULT, 0, INDEX_FSAL_InitClientContext);
00066     }
00067   else
00068     {
00069       LogEvent(COMPONENT_FSAL, "Worker successfuly connected to database");
00070     }
00071 
00072   /* sets the credential time */
00073 /*  p_thr_context->credential.last_update = time( NULL );*/
00074 
00075   /* traces: prints p_credential structure */
00076 
00077   /*
00078      LogDebug(COMPONENT_FSAL, "credential created:");
00079      LogDebug(COMPONENT_FSAL, "\tuid = %d, gid = %d",
00080      p_thr_context->credential.hpss_usercred.SecPWent.Uid, p_thr_context->credential.hpss_usercred.SecPWent.Gid);
00081      LogDebug(COMPONENT_FSAL, "\tName = %s",
00082      p_thr_context->credential.hpss_usercred.SecPWent.Name);
00083 
00084      for ( i=0; i< p_thr_context->credential.hpss_usercred.NumGroups; i++ )
00085      LogDebug(COMPONENT_FSAL, "\tAlt grp: %d",
00086      p_thr_context->credential.hpss_usercred.AltGroups[i] );
00087    */
00088   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_InitClientContext);
00089 
00090 }
00091 
00092 /* @} */