* Given mode bits, return directory entry type code.
*/
#define INCORE_D_TYPEOF(m) (((m) & S_IFMT) >> 12)
+#define INCORE_D_TEMPLATE_LEN (INCORE_D_RECLEN(1) + INCORE_D_RECLEN(2))
-static char incore_dir_template[INCORE_D_RECLEN(1) + INCORE_D_RECLEN(2)];
+char *incore_dir_template;
#if 0
static struct intnl_dirent incore_dir_template[] = {
{
/*
* Fill in the directory template.
*/
+ incore_dir_template = calloc(1, INCORE_D_TEMPLATE_LEN);
+ if (incore_dir_template == NULL)
+ return -ENOMEM;
de = (struct intnl_dirent *)incore_dir_template;
#ifdef _DIRENT_HAVE_D_OFF
de->d_off =
/*
* Allocate and init directory data.
*/
- err = incore_trunc(icino, sizeof(incore_dir_template), 1);
+ err = incore_trunc(icino, INCORE_D_TEMPLATE_LEN, 1);
if (err) {
incore_i_destroy(icino);
return NULL;
}
(void )memcpy(icino->ici_data,
&incore_dir_template,
- sizeof(incore_dir_template));
+ INCORE_D_TEMPLATE_LEN);
de = icino->ici_data;
de->d_ino = st->st_ino;
de =
if (!de)
return -ENOENT;
assert((size_t )((char *)de - (char *)icino->ici_data) >=
- sizeof(incore_dir_template));
+ INCORE_D_TEMPLATE_LEN);
#ifndef _DIRENT_HAVE_D_OFF
reclen = de->d_reclen;
#else
extern struct fsswent *_sysio_fssw_lookup(const char *name);
extern int _sysio_fssw_register(const char *name, struct fssw_ops *ops);
+extern char *incore_dir_template;
extern struct filesys * _sysio_fs_new(struct filesys_ops *ops,
unsigned mask,
void *private);