cmd_result_t if_cfm_failover(int unit, args_t *a) { char *c; if (!sh_check_attached(ARG_CMD(a), unit)) { return CMD_FAIL; } if ((c = ARG_GET(a)) != NULL) { if (!sal_strcmp(c, "cx4")) { cx4_flag = 1; c = ARG_GET(a); } } if (c != NULL) { if (!sal_strcmp(c, "enable")) { if (cfm_hattached) bcm_cfm_failover_detach(unit); bcm_cfm_failover_attach(unit); } else if (!sal_strcmp(c, "disable")) { bcm_cfm_failover_detach(unit); } else { printk("cfmfailover [enable/disable] \n"); } } else { printk("cfmfailover [enable/disable] \n"); } return CMD_OK; }
/* * Function: * _board_insert * Purpose: * Locate board registration insertion point in registration list * Parameters: * driver - (IN) driver structure * insp - (OUT) pointer to registration record insertion point * none * Returns: * BCM_E_NONE - success * BCM_E_EXISTS - already registered * Notes: * Insertion point is NULL if the insertion point is the head * of the list, otherwise it is the record whose next pointer * should point to the record being inserted. */ int _board_insert(board_driver_t *driver, board_reg_t **insp) { board_reg_t *entry; for (entry = driver_reg; entry != NULL; entry = entry->next) { if (!sal_strcmp(entry->driver->name, driver->name)) { return BCM_E_EXISTS; } if (driver->priority > entry->driver->priority) { /* priority is greater than what we are finding, so it must be inserted at the beginning */ entry = NULL; break; } else if (entry->next == NULL || entry->next->driver->priority < driver->priority) { /* This is either the last entry, or before entries that have a lower priority, so insertion point is after this entry */ break; } } *insp = entry; return BCM_E_NONE; }
/* * Function: soc_i2c_devopen * * Purpose: Open device, return valid file descriptor or -1 on error. * * Parameters: * unit - StrataSwitch device number or I2C bus number * devname - I2C device name string * flags - arguments to pass to attach, default value should be zero * speed - I2C bus speed, if non-zero, this speed is configured, normally * this argument should be zero unless a speed is desired. * Returns: * device identifier for all I2C operations * * Notes: * This routine should be called before attempting to communicate * with an I2C device which has a registered driver. */ int soc_i2c_devopen(int unit, char* devname, uint32 flags, int speed) { int devid, rv; soc_i2c_bus_t *i2cbus; #ifdef BCM_CALADAN3_SVK rv = cpu_i2c_dev_open(cpu_i2c_defaultbus(), devname, flags, speed); if ((rv != SOC_E_NOT_FOUND) || (unit > soc_ndev)) { /* device found on cpu bus, or no bcm units to probe */ return rv; } #endif /* Make sure that we're already attached, or go get attached */ if ( !soc_i2c_is_attached(unit) && ((rv = soc_i2c_attach(unit, flags, speed)) < 0) ) { return rv; } i2cbus = I2CBUS(unit); for (devid = 0; devid < NUM_I2C_DEVICES; devid++) { if (i2cbus->devs[devid]) { if (sal_strcmp(i2cbus->devs[devid]->devname, devname) == 0) { return devid; } } } return SOC_E_NOT_FOUND; }
int syscmd_copy_file(char *src_file, char *dst_file) { FILE *src_fp = NULL, *dst_fp = NULL; char buf[BUFFER_COUNT]; int ret = 0, count; int w_count = 0; int amount = 0; if (!sal_strcmp(src_file, dst_file)) { return 0; } src_fp = sal_fopen(src_file, "r"); if (NULL == src_fp) { ret = -1; goto error; } dst_fp = sal_fopen(dst_file, "w+"); if (NULL == dst_fp) { ret = -2; goto error; } while ((count = sal_fread(buf, sizeof(char), BUFFER_COUNT, src_fp)) > 0) { w_count = sal_fwrite(buf, sizeof(char), count, dst_fp); if (w_count < count) { ret = -2; goto error; } /* check the memory on 1M boundary */ amount += count; if(amount & 0x100000) { ret = -3; goto error; } } error: if (NULL != src_fp) { sal_fclose(src_fp); } if (NULL != dst_fp) { sal_fclose(dst_fp); } memmgr_free_cached_mem(); return ret; }
/* * Function: * _board_find_by_name * Purpose: * Return board driver registration by name, or NULL if there is no * registered board driver by that name. * Parameters: * name - (IN) board driver name * Returns: * Pointer to board driver registration or NULL. */ board_reg_t * _board_find_by_name(char *name) { board_reg_t *entry; for (entry = driver_reg; entry != NULL; entry = entry->next) { if (!sal_strcmp(entry->driver->name, name)) { return entry; } } return NULL; }
/******************************************************************************* * Name: gen_validate_relative_path * Purpose: validate relative path * Input: * pszFullName: path name * Output: * Return: * success: 0 * failed : -1 * Note: Created by Percy Wang 2007-12-21 ******************************************************************************/ int gen_validate_relative_path(char *pszFullName) { int nCnt = 0; int nRet = 0; int nIdx = 0; rootdir_t *rdir = NULL; char *pszTmpName; int nValLen = 0; if (NULL == pszFullName) { return -1; } if (sal_strlen(pszFullName) > M_FULLPATH_MAX_LEN) { return -1; } pszTmpName = pszFullName; if (sal_strchr (pszFullName, ':') != NULL) { nCnt = sizeof(actual_root_dir) / sizeof(actual_root_dir[0]); for (nIdx = 0; nIdx < nCnt; nIdx++) { rdir = &actual_root_dir[nIdx]; nValLen = sal_strlen(rdir->show_name); if (!sal_strncmp(pszFullName, rdir->show_name, sal_strlen(rdir->show_name))) { if (!sal_strcmp(pszFullName, rdir->show_name)) { return 0; } else { pszTmpName = pszFullName + nValLen; break; } } } } nRet = gen_validate_path(pszTmpName); return nRet; }
static sc_t * sal_config_find(const char *name) { sc_t *sc; sc_hash_t hash; SC_HASH(name, hash); sc = sal_config_list[hash]; while (sc != NULL) { if (sal_strcmp(sc->sc_name, name) == 0) { break; } sc = sc->sc_next; } return sc; }
cmd_result_t cmd_cint(int unit, args_t* a) { char* s; int cmp; int argc = 0; char* argv[16]; cmd_cint_initialize(); s = ARG_CUR(a); if(s) { cmp = sal_strcmp(s, "allow_file_info"); if(!cmp) { argv[argc] = ARG_GET(a); argc++; } } if(ARG_CUR(a)) { /* Load file */ FILE* fp; s = ARG_GET(a); if((fp = sal_fopen(s, "r")) != NULL) { sal_memset(argv, 0, sizeof(argv)); while( (argv[argc] = ARG_GET(a)) ) { argc++; } cint_interpreter_parse(fp, NULL, argc, argv); sal_fclose(fp); } else { cli_out("error: could not open file '%s'\n", s); } } else { cli_out("Entering C Interpreter. Type 'exit;' to quit.\n\n"); cint_interpreter_parse(NULL, "cint> ", argc, argv); } return 0; }
soc_pbsmh_field_t soc_pbsmh_name_to_field(int unit, char *name) { soc_pbsmh_field_t f; assert(COUNTOF(soc_pbsmh_field_names) - 1 == PBSMH_COUNT); COMPILER_REFERENCE(unit); for (f = 0; soc_pbsmh_field_names[f] != NULL; f++) { if (sal_strcmp(name, soc_pbsmh_field_names[f]) == 0) { return f; } } return PBSMH_invalid; }
bslsink_sink_t * bslsink_sink_find(const char *name) { bslsink_sink_t *sink = bslsink_sinks; if (name == NULL) { return NULL; } while (sink != NULL) { if (sal_strcmp(name, sink->name) == 0) { return sink; } sink = sink->next; } return NULL; }
int sal_config_get_next(char **name, char **value) { sc_t *sc; sc_hash_t hash; char * nm = *name; if (nm) { SC_HASH(nm, hash); sc = sal_config_list[hash]; while (sc != NULL) { if (sal_strcmp(sc->sc_name, nm) == 0) { break; } sc = sc->sc_next; } if (sc != NULL) { sc = sc->sc_next; if (sc == NULL) { hash++; for (;hash < MAX_CONFIG_HASH_COUNT; hash++) { sc = sal_config_list[hash]; if (sc != NULL) { break; } } } } } else { for (hash = 0; hash < MAX_CONFIG_HASH_COUNT; hash++) { sc = sal_config_list[hash]; if (sc != NULL) { break; } } } if (sc) { *name = sc->sc_name; *value = sc->sc_value; return 0; } else { return -1; } }
/******************************************************************************* * Name: gen_check_and_gen_showname * Purpose: check original path and build showing string * Input: * szOrig: absolute path * szShow: showing path * Output: * Return: * success: 0 * failed : -1 * Note: ******************************************************************************/ int gen_check_and_gen_showname(char *szOrig, char *szShow) { int nCnt = 0; int nIdx = 0; rootdir_t *rdir = NULL; if (NULL == szOrig || NULL == szShow) { return -1; } nCnt = sizeof(actual_root_dir) / sizeof(actual_root_dir[0]); for (nIdx = 0; nIdx < nCnt; nIdx++) { rdir = &actual_root_dir[nIdx]; if (!sal_strncmp(szOrig, rdir->real_name, sal_strlen(rdir->real_name))) { if (!sal_strcmp(szOrig, rdir->real_name)) { sal_snprintf(szShow, M_FULLPATH_MAX_LEN, "%s/", rdir->show_name); } else if ('/' == szOrig[sal_strlen(rdir->real_name)]) { sal_snprintf(szShow, M_FULLPATH_MAX_LEN, "%s%s", rdir->show_name, szOrig + sal_strlen(rdir->real_name)); } else { sal_snprintf(szShow, M_FULLPATH_MAX_LEN, "%s/%s", rdir->show_name, szOrig + sal_strlen(rdir->real_name)); } return 0; } } return -1; }
static int __strcmp(char* p, char* c) { return sal_strcmp(p, c); }
cmd_result_t pscan_cmd(int unit, args_t *a) /* * Function: pscan_cmd * Purpose: Control uKernel pscan interface * Parameters: unit - unit * a - args * Returns: CMD_OK/CMD_FAIL/CMD_USAGE */ { cmd_result_t rv = CMD_OK; char *c; int count, delay, port, flags; #ifndef NO_CTRL_C jmp_buf ctrl_c; #endif if (!sh_check_attached("pscan", unit)) { return(CMD_FAIL); } if (!soc_feature(unit, soc_feature_uc)) { return (CMD_FAIL); } if (ARG_CNT(a) < 1) { return(CMD_USAGE); } /* check for simulation*/ if (SAL_BOOT_BCMSIM) { return(rv); } #ifndef NO_CTRL_C if (!setjmp(ctrl_c)) { sh_push_ctrl_c(&ctrl_c); #endif c = ARG_GET(a); count = ARG_CNT(a); if ((count == 0) && !sal_strcmp(c, "init")) { rv = soc_pscan_init(unit); } else if ((count == 2) && !sal_strcmp(c, "config")) { c = ARG_GET(a); port = parse_integer(c); c = ARG_GET(a); flags = parse_integer(c); rv = soc_pscan_port_config(unit, port, flags); } else if ((count == 1) && !sal_strcmp(c, "delay")) { c = ARG_GET(a); delay = parse_integer(c); rv = soc_pscan_delay(unit, delay); } else if ((count == 1) && !sal_strcmp(c, "disable")) { c = ARG_GET(a); port = parse_integer(c); rv = soc_pscan_port_enable(unit, port, 0); } else if ((count == 1) && !sal_strcmp(c, "enable")) { c = ARG_GET(a); port = parse_integer(c); rv = soc_pscan_port_enable(unit, port, 1); } else if ((count == 0) && !sal_strcmp(c, "update")) { rv = soc_pscan_update(unit); } else { rv = CMD_USAGE; } #ifndef NO_CTRL_C } else { rv = CMD_INTR; } sh_pop_ctrl_c(); #endif return(rv); }
int sal_config_set(char *name, char *value) { sc_t *sc, *psc; char *newval; char *wildcard = NULL; char *sc_wildcard; int length; sc_hash_t hash; if (name == NULL || *name == '\0') { return -1; } SC_HASH(name, hash); sc = sal_config_list[hash]; psc = NULL; while (sc != NULL) { if (sal_strcmp(sc->sc_name, name) == 0) { break; } psc = sc; sc = sc->sc_next; } if (sc != NULL) { /* found */ if (value == NULL) { /* delete */ if (sal_config_list[hash] == sc) { sal_config_list[hash] = sc->sc_next; } else { if (psc !=NULL) { psc->sc_next = sc->sc_next; } } FREE_SC(sc); return 0; } else { /* replace */ newval = sal_alloc(strlen(value) + 1, "config value"); if (newval == NULL) { return -1; } sal_strncpy(newval, value, strlen(value)); newval[strlen(value)] = '\0'; sal_free(sc->sc_value); sc->sc_value = newval; return 0; } } /* not found, delete */ if (value == NULL) { int i; wildcard = wildcard_search(name, wildcard, &length); if (wildcard != NULL) { sc_wildcard = sal_alloc((length + 1), "sc_wildcard"); *(sc_wildcard+length) = 0; for (i = 0; i < MAX_CONFIG_HASH_COUNT; i++) { sc = sal_config_list[i]; psc = NULL; while (sc != NULL){ sc_wildcard = sal_strncpy(sc_wildcard, sc->sc_name, length); sc_wildcard[length] = '\0'; if (sal_strcmp(sc_wildcard, wildcard) == 0) { if (sal_config_list[i] == sc) { sal_config_list[i] = sc->sc_next; FREE_SC(sc); sc = sal_config_list[i]; psc = NULL; } else { if (psc !=NULL) { psc->sc_next = sc->sc_next; } FREE_SC(sc); if (psc !=NULL) { sc = psc->sc_next; } } } else { psc = sc; sc = sc->sc_next; } } } sal_free(wildcard); sal_free(sc_wildcard); return 0; } else { return -1; } } /* not found, add */ if ((sc = sal_alloc(sizeof(sc_t), "config set")) == NULL) { return -1; } sc->sc_name = sal_alloc(strlen(name) + 1, "config name"); sc->sc_value = sal_alloc(strlen(value) + 1, "config value"); if (sc->sc_name == NULL || sc->sc_value == NULL) { FREE_SC(sc); return -1; } sal_strncpy(sc->sc_name, name, strlen(name)); sc->sc_name[strlen(name)] = '\0'; sal_strncpy(sc->sc_value, value, strlen(value)); sc->sc_value[strlen(value)] = '\0'; sc->sc_hash = hash; sc->sc_next = sal_config_list[hash]; sal_config_list[hash] = sc; return 0; }
/* * Function: * sal_config_refresh * Purpose: * Refresh default (compiled-in) configuration. * Refresh the memory image from the configuration file, * clobbering default values (if the config file exists). * Parameters: * None * Returns: * 0 - success * -1 - failed. */ int sal_config_refresh(void) { sc_t *sc, *sc_tmp; int i; #ifndef SAL_CONFIG_FILE_DISABLE FILE *fp; sc_t *found_sc; char str[SAL_CONFIG_STR_MAX], *c; int line = 0; char *fname; int suppress_unknown_warnings = 0; #endif /* Clear all previous state */ for (i = 0; i < MAX_CONFIG_HASH_COUNT; i++) { sc = sal_config_list[i]; sal_config_list[i] = NULL; while (sc != NULL) { sc_tmp = sc->sc_next; FREE_SC(sc); sc = sc_tmp; } } /* load precompiled values from platform_defines.c */ sal_config_init_defaults(); #ifndef SAL_CONFIG_FILE_DISABLE fname = (sal_config_file_name != NULL ? sal_config_file_name : SAL_CONFIG_FILE); if (fname[0] == 0) { return 0; /* No config file */ } /* Try to load config file ... */ if ((fp = sal_fopen(fname, "r")) == NULL) { #if defined(BROADCOM_DEBUG) sal_printf("sal_config_refresh: cannot read file: %s, " "variables not loaded\n", fname); #endif /* BROADCOM_DEBUG */ return -1; } /* * Add new file-based variables, superseding any matching compiled * variables. Find end-of-list, and initialize the default-or-file * flag. */ for (i = 0; i < MAX_CONFIG_HASH_COUNT; i++) { for (sc = sal_config_list[i]; sc != NULL; sc = sc->sc_next) { sc->sc_flag = SC_COMPILE_VALUE; } } /* Read the entire file - parsing as we go */ while (sal_fgets(str, sizeof(str), fp)) { line++; /* Skip comment lines */ if (str[0] == '#') { continue; } /* Strip trailing newline/blanks */ c = str + strlen(str); while (c > str && isspace((unsigned) c[-1])) { c--; } *c = '\0'; /* Skip blank lines */ if (str[0] == 0) { continue; } if ((sc = sal_config_parse(str)) == NULL) { sal_printf("sal_config_refresh: format error " "in %s on line %d (ignored)\n", fname, line); continue; } /* Check for pre-existing default or duplicates in the file */ found_sc = sal_config_list[sc->sc_hash]; while (found_sc != NULL) { if (sal_strcmp(found_sc->sc_name, sc->sc_name) == 0) { break; } found_sc = found_sc->sc_next; } if (found_sc != NULL) { if (found_sc->sc_flag != SC_COMPILE_VALUE) { sal_printf("sal_config_refresh: ignoring duplicate entry " "\"%s\"\n" " %s line %d " "(first defined on line %d)\n", sc->sc_name, fname, line, found_sc->sc_flag); } else { /* Clobber the compiled-in default value */ char *temp = sc->sc_value; /* New value */ sc->sc_value = found_sc->sc_value; /* Old, to be freed */ found_sc->sc_value = temp; found_sc->sc_flag = line; /* Line # of 1st definition */ } FREE_SC(sc); continue; } /* * Scan for "suppress_unknown_prop_warnings" directly as we go * instead of sal_config_find() because it's much faster */ if (sal_strcasecmp("suppress_unknown_prop_warnings", sc->sc_name) == 0) { suppress_unknown_warnings = _shr_ctoi(sc->sc_value); } if (!suppress_unknown_warnings) { if (sal_config_prop_is_known(sc) == FALSE) { sal_printf("sal_config_refresh: unknown entry \"%s\"" " on %s line %d\n", sc->sc_name, fname, line); } } sc->sc_flag = line; /* Line # of 1st definition */ sc->sc_next = sal_config_list[sc->sc_hash]; sal_config_list[sc->sc_hash] = sc; } /* parse config file */ sal_fclose(fp); #endif /* SAL_CONFIG_FILE_DISABLE */ return 0; }
/* _bcm_esw_match * Purpose: * match BCM control subtype strings for ESW types * Parameters: * unit - unit being detached * Returns: * 0 match * !0 no match */ int _bcm_esw_match(int unit, char *subtype_a, char *subtype_b) { COMPILER_REFERENCE(unit); return sal_strcmp(subtype_a, subtype_b); }
/******************************************************************************* * Name: copy_file_with_progress * Purpose: copy file and show progress * Input: * src_file: source file * dst_file: dest file * Output: * Return: * success: 0 * failed : -1 * Note: ******************************************************************************/ #define HASHBYTES (50 * 1024) #define MEMCHECK (4 * 1024 *1024) /*4M*/ int copy_file_with_progress(char *src_file, char *dst_file) { FILE *src_fp = NULL, *dst_fp = NULL; char buf[BUFFER_COUNT]; int ret = 0, count; int amount = 0; int hashbytes = 0; int memcheck = 0; struct timeval tstart; struct timeval tstop; if (!sal_strcmp(src_file, dst_file)) { return 0; } src_fp = sal_fopen(src_file, "r"); if (NULL == src_fp) { ret = -1; goto error; } dst_fp = sal_fopen(dst_file, "w+"); if (NULL == dst_fp) { ret = -2; goto error; } (void)gettimeofday(&tstart, NULL); while ((count = sal_fread(buf, sizeof(char), BUFFER_COUNT, src_fp)) > 0) { ret = sal_fwrite(buf, sizeof(char), count, dst_fp); if (ret <= 0) { (void)gettimeofday(&tstop, NULL); goto error; } amount += count; if(amount >= memcheck) { if((syslimit_mem_threshold_check() < 0)) { ret = -3; goto error; } memcheck += MEMCHECK; } while (amount >= hashbytes) { ctc_cli_out("."); (void) fflush(stdout); hashbytes += HASHBYTES; } } (void)gettimeofday(&tstop, NULL); error: if (NULL != src_fp) { sal_fclose(src_fp); } if (NULL != dst_fp) { sal_fclose(dst_fp); } if (amount && ( ret >= 0)) { double delta; /* compute delta in 1/10's second units */ delta = ((tstop.tv_sec * 10.) + (tstop.tv_usec / 100000)) - ((tstart.tv_sec * 10.) + (tstart.tv_usec / 100000)); delta = delta / 10.; /* back to seconds */ ctc_cli_out("\n%lu bytes in %.1f seconds, %.0f kbytes/second\n", amount, delta, (amount * 1.) / (1024 * delta)); } return ret; }
/******************************************************************************* * Name: gen_check_and_get_filename * Purpose: check and return absolute filename * Input: * filename: file name start with drive * outsize: out buffer size * Output: * outfile: output file name * Return: * success: 0 * failed : -1 * Note: ******************************************************************************/ int gen_check_and_get_filename(char *filename, char *outfile, size_t outsize) { char szFullName[M_FULLPATH_MAX_LEN]; rootdir_t *rdir = NULL; int nValLen = 0; int nLen = 0; int nCnt = 0; int nIdx = 0; if (NULL == filename || NULL == outfile || 0 > outsize) { return -1; } if (sal_strlen(filename) >= M_FULLPATH_MAX_LEN) { ctc_cli_out("%% File or directory name length overflow.\n"); return -1; } sal_snprintf(szFullName, M_FULLPATH_MAX_LEN, filename); if (gen_validate_relative_path(szFullName) != 0) { return -1; } gen_path_getparents(szFullName); nLen = sal_strlen(szFullName); nCnt = sizeof(actual_root_dir) / sizeof(actual_root_dir[0]); for (nIdx = 0; nIdx < nCnt; nIdx++) { rdir = &actual_root_dir[nIdx]; nValLen = sal_strlen(rdir->show_name); if (!sal_strncmp(szFullName, rdir->show_name, sal_strlen(rdir->show_name))) { if (!sal_strcmp(szFullName, rdir->show_name)) { sal_snprintf(outfile, outsize, "%s", rdir->real_name); } else if ('/' == szFullName[nValLen]) { sal_snprintf(outfile, outsize, "%s%s", rdir->real_name, szFullName + nValLen); if ((sal_strlen(rdir->real_name) + sal_strlen(szFullName + nValLen)) >= M_FULLPATH_MAX_LEN) { ctc_cli_out("%% File or directory name length overflow.\n"); return -1; } } else { sal_snprintf(outfile, outsize, "%s/%s", rdir->real_name, szFullName + nValLen); if ((sal_strlen(rdir->real_name) + sal_strlen(szFullName + nValLen) + 1) >= M_FULLPATH_MAX_LEN) { ctc_cli_out("%% File or directory name length overflow.\n"); return -1; } } if (gen_validate_path(outfile) != 0) { return -1; } return 0; } } /* is it .. or . or raw path * let connect it with current working directory and check it */ szFullName[0] = '\0'; szFullName[M_FULLPATH_MAX_LEN - 1] = '\0'; if (getcwd(szFullName, M_FULLPATH_MAX_LEN) == NULL) { ctc_cli_out("%% Get current working directory failed: %s\n", sal_strerror(errno)); return -1; } nLen = sal_strlen(szFullName); if ('/' != filename[0]) { sal_snprintf(szFullName + nLen, M_FULLPATH_MAX_LEN - nLen, "/%s", filename); if ((nLen + sal_strlen(filename) + 1) >= M_FULLPATH_MAX_LEN) { ctc_cli_out("%% File or directory name length overflow.\n"); return -1; } } else { sal_snprintf(szFullName + nLen, M_FULLPATH_MAX_LEN - nLen, "%s", filename); if ((nLen + sal_strlen(filename)) >= M_FULLPATH_MAX_LEN) { ctc_cli_out("%% File or directory name length overflow.\n"); return -1; } } gen_path_getparents(szFullName); nLen = sal_strlen(szFullName); nCnt = sizeof(actual_root_dir) / sizeof(actual_root_dir[0]); for (nIdx = 0; nIdx < nCnt; nIdx++) { rdir = &actual_root_dir[nIdx]; nValLen = sal_strlen(rdir->real_name); if (!sal_strncmp(szFullName, rdir->real_name, sal_strlen(rdir->real_name))) { sal_snprintf(outfile, outsize, szFullName); if (gen_validate_path(outfile) != 0) { return -1; } return 0; } if (!sal_strncmp(szFullName, rdir->real_name, nLen)) { /* this directory not showing for user * setting it to root directory of this part */ return -1; } } return -1; }