FreeBSD/sbin/restore/dirs.c
/*
 * Allocate and initialize a directory inode entry.
 * If requested, save its pertinent mode, owner, and time info.
 */
Allocate and initialize a directory inode entry.
If requested, save its pertinent mode, owner, and time info.
Allocate and initialize a directory inode entry . If requested save its pertinent mode owner and time info .
static struct inotab *
allocinotab(struct context *ctxp, long seekpt)
{
	struct inotab	*itp;
	struct modeinfo node;
	itp = calloc(1, sizeof(struct inotab));
	if (itp == NULL)
		panic("no memory for directory table\n");
	itp->t_next = inotab[INOHASH(ctxp->ino)];
	inotab[INOHASH(ctxp->ino)] = itp;
	itp->t_ino = ctxp->ino;
	itp->t_seekpt = seekpt;
	if (mf == NULL)
		return (itp);
	node.ino = ctxp->ino;
	node.mtimep[0].tv_sec = ctxp->atime_sec;
	node.mtimep[0].tv_nsec = ctxp->atime_nsec;
	node.mtimep[1].tv_sec = ctxp->mtime_sec;
	node.mtimep[1].tv_nsec = ctxp->mtime_nsec;
	node.ctimep[0].tv_sec = ctxp->atime_sec;
	node.ctimep[0].tv_nsec = ctxp->atime_nsec;
	node.ctimep[1].tv_sec = ctxp->birthtime_sec;
	node.ctimep[1].tv_nsec = ctxp->birthtime_nsec;
	node.extsize = ctxp->extsize;
	node.mode = ctxp->mode;
	node.flags = ctxp->file_flags;
	node.uid = ctxp->uid;
	node.gid = ctxp->gid;
	if (fwrite((char *)&node, sizeof(struct modeinfo), 1, mf) != 1)
		fail_dirtmp(modefile);
	return (itp);
}
static struct inotab * allocinotab ( struct context * ctxp , long seekpt ) { struct inotab * itp ; struct modeinfo node ; itp = calloc ( 1 , sizeof ( struct inotab ) ) ; if ( itp == NULL ) panic ( " \n " ) ; itp -> t_next = inotab [ INOHASH ( ctxp -> ino ) ] ; inotab [ INOHASH ( ctxp -> ino ) ] = itp ; itp -> t_ino = ctxp -> ino ; itp -> t_seekpt = seekpt ; if ( mf == NULL ) return ( itp ) ; node . ino = ctxp -> ino ; node . mtimep [ 0 ] . tv_sec = ctxp -> atime_sec ; node . mtimep [ 0 ] . tv_nsec = ctxp -> atime_nsec ; node . mtimep [ 1 ] . tv_sec = ctxp -> mtime_sec ; node . mtimep [ 1 ] . tv_nsec = ctxp -> mtime_nsec ; node . ctimep [ 0 ] . tv_sec = ctxp -> atime_sec ; node . ctimep [ 0 ] . tv_nsec = ctxp -> atime_nsec ; node . ctimep [ 1 ] . tv_sec = ctxp -> birthtime_sec ; node . ctimep [ 1 ] . tv_nsec = ctxp -> birthtime_nsec ; node . extsize = ctxp -> extsize ; node . mode = ctxp -> mode ; node . flags = ctxp -> file_flags ; node . uid = ctxp -> uid ; node . gid = ctxp -> gid ; if ( fwrite ( ( char * ) & node , sizeof ( struct modeinfo ) , 1 , mf ) != 1 ) fail_dirtmp ( modefile ) ; return ( itp ) ; }
Allocate and initialize a directory inode entry.
Allocate and initialize a directory inode entry .