Ejemplo n.º 1
0
/**
 * Parse FS specific option string
 * to build the export entry option.
 */
fsal_status_t PROXYFSAL_BuildExportContext(fsal_export_context_t * p_export_context,       /* OUT */
                                           fsal_path_t * p_export_path, /* IN */
                                           char *fs_specific_options    /* IN */
    )
{
  char subopts[256];
  char *p_subop;
  char *value;

  /* sanity check */
  if(!p_export_context)
    Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_BuildExportContext);

  /* Save pointer to fsal_staticfsinfo_t in export context */
  p_export_context->fe_static_fs_info = &global_fs_info;

  if((fs_specific_options != NULL) && (fs_specific_options[0] != '\0'))
    {

      /* copy the option string (because it is modified by getsubopt call) */
      strncpy(subopts, fs_specific_options, 256);
      subopts[255] = '\0';
      p_subop = subopts;        /* set initial pointer */

      /* parse the FS specific option string */

      switch (Getsubopt(&p_subop, fs_specific_opts, &value))
        {
        case YOUR_OPTION_1:
          /* analyze your option 1 and fill the export_context structure */
          break;

        case YOUR_OPTION_2:
          /* analyze your option 2 and fill the export_context structure */
          break;

        case YOUR_OPTION_3:
          /* analyze your option 3 and fill the export_context structure */
          break;

        case YOUR_OPTION_4:
          /* analyze your option 4 and fill the export_context structure */
          break;

        default:
          {
            LogCrit(COMPONENT_FSAL,
                    "FSAL LOAD PARAMETER: ERROR: Invalid suboption found in EXPORT::FS_Specific : %s : xxxxxx expected.",
                    value);
            Return(ERR_FSAL_INVAL, 0, INDEX_FSAL_BuildExportContext);
          }
        }

    }

  Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_BuildExportContext);
}
Ejemplo n.º 2
0
/*
 * Parse FS specific option string to build the export entry option.
 */
fsal_status_t dpmfsal_BuildExportContext(
                                      dpmfsal_export_context_t * p_export_context, // OUT
                                      fsal_path_t * p_export_path, // IN
                                      char *fs_specific_options // IN
)
{
    char subopts[256];
    char *p_subop;
    char *value;
    int rc;

    // Sanity checks.
    if (!p_export_context)
        Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_BuildExportContext);

    if ((fs_specific_options != NULL) && (fs_specific_options[0] != '\0')) {

        // copy the option string (because it is modified by getsubopt call)
        strncpy(subopts, fs_specific_options, 256);
        p_subop = subopts; // set initial pointer

        // parse the FS specific option string
        switch (Getsubopt(&p_subop, fs_specific_opts, &value)) {
        // Add options here, if any
        default: {
            LogCrit(COMPONENT_CONFIG,
                    "FSAL LOAD PARAMETER: ERROR: Invalid suboption found in EXPORT::FS_Specific : %s : xxxxxx expected.",
                    value);
            Return(ERR_FSAL_INVAL, 0, INDEX_FSAL_BuildExportContext);
        }
        }
    }

    // Put DPM specific export initialization handling here (if necessary)

    Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_BuildExportContext);
}
Ejemplo n.º 3
0
/**
 * Parse FS specific option string
 * to build the export entry option.
 */
fsal_status_t HPSSFSAL_BuildExportContext(hpssfsal_export_context_t * p_export_context, /* OUT */
                                          fsal_path_t * p_export_path,  /* IN */
                                          char *fs_specific_options     /* IN */
    )
{
  char subopts[256];
  char *p_subop;
  char *value;

  char *filesetname = NULL;
  int read_cos = 0;             /* 0 => not set */

  int rc;

  /* sanity check */
  if(!p_export_context)
    Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_BuildExportContext);

  if((fs_specific_options != NULL) && (fs_specific_options[0] != '\0'))
    {

      /* cleans the export context */
      memset(p_export_context, 0, sizeof(hpssfsal_export_context_t));

      /* copy the option string (because it is modified by getsubopt call) */
      strncpy(subopts, fs_specific_options, 256);
      p_subop = subopts;        /* set initial pointer */

      /* parse the FS specific option string */

      switch (Getsubopt(&p_subop, fs_specific_opts, &value))
        {
        case FILESET_OPTION:
          filesetname = value;
          break;

        case COS_OPTION:
          read_cos = atoi(value);
          if(read_cos <= 0)
            {
              LogCrit(COMPONENT_FSAL,
                  "FSAL LOAD PARAMETER: ERROR: Unexpected value for EXPORT::FS_Specific::%s : ( %s ) positive integer expected.",
                   fs_specific_opts[COS_OPTION], value);
              Return(ERR_FSAL_INVAL, 0, INDEX_FSAL_BuildExportContext);
            }
          break;

        default:
          {
            LogCrit(COMPONENT_FSAL,
                "FSAL LOAD PARAMETER: ERROR: Invalid suboption found in EXPORT::FS_Specific : %s : %s or %s expected.",
                 value, fs_specific_opts[FILESET_OPTION], fs_specific_opts[COS_OPTION]);
            Return(ERR_FSAL_INVAL, 0, INDEX_FSAL_BuildExportContext);
          }
        }

    }

  /* fills the export context structure */

  /* Save pointer to fsal_staticfsinfo_t in export context */
  p_export_context->fe_static_fs_info = &global_fs_info;

  p_export_context->default_cos = read_cos;

  rc = HPSSFSAL_GetFilesetRoot(filesetname, &p_export_context->fileset_root_handle);

  if(rc != 0)
    {
      LogCrit(COMPONENT_FSAL,
          "FSAL LOAD PARAMETER: ERROR: Could not get root handle for fileset \"%s\"",
           (filesetname == NULL ? filesetname : "<root>"));
      Return(ERR_FSAL_INVAL, -rc, INDEX_FSAL_BuildExportContext);
    }

  Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_BuildExportContext);

}