diff options
| -rw-r--r-- | libglusterfs/src/gf-dirent.c | 19 | ||||
| -rw-r--r-- | libglusterfs/src/gf-dirent.h | 1 | 
2 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/gf-dirent.c b/libglusterfs/src/gf-dirent.c index cd31464ffea..0a343694944 100644 --- a/libglusterfs/src/gf-dirent.c +++ b/libglusterfs/src/gf-dirent.c @@ -49,6 +49,25 @@ gf_dirent_nb_size (gf_dirent_t *entries)  	return (sizeof (struct gf_dirent_nb) + strlen (entries->d_name) + 1);  } +gf_dirent_t * +gf_dirent_for_namelen (int len) +{ +	gf_dirent_t *gf_dirent = NULL; + +	/* TODO: use mem-pool */ +	gf_dirent = CALLOC (len, sizeof(char)); +	if (!gf_dirent) +		return NULL; + +	INIT_LIST_HEAD (&gf_dirent->list); + +	gf_dirent->d_off = 0; +	gf_dirent->d_ino = -1; +	gf_dirent->d_type = 0; + +	return gf_dirent; +} +  gf_dirent_t *  gf_dirent_for_name (const char *name) diff --git a/libglusterfs/src/gf-dirent.h b/libglusterfs/src/gf-dirent.h index 2c10f8fbc19..0e13c0325f0 100644 --- a/libglusterfs/src/gf-dirent.h +++ b/libglusterfs/src/gf-dirent.h @@ -57,5 +57,6 @@ gf_dirent_t *gf_dirent_for_name (const char *name);  void gf_dirent_free (gf_dirent_t *entries);  int gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t size);  int gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t size); +gf_dirent_t * gf_dirent_for_namelen (int len);  #endif /* _GF_DIRENT_H */  | 
