Date: Wed, 20 Feb 2013 19:32:31 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r247052 - head/usr.sbin/makefs Message-ID: <201302201932.r1KJWVTB000268@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Wed Feb 20 19:32:31 2013 New Revision: 247052 URL: http://svnweb.freebsd.org/changeset/base/247052 Log: Support hardlinks in manifest files by the same logic as the treewalk code. Reviewed by: marcel Sponsored by: DARPA, AFRL Modified: head/usr.sbin/makefs/makefs.h head/usr.sbin/makefs/mtree.c head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/makefs.h ============================================================================== --- head/usr.sbin/makefs/makefs.h Wed Feb 20 19:05:13 2013 (r247051) +++ head/usr.sbin/makefs/makefs.h Wed Feb 20 19:32:31 2013 (r247052) @@ -280,6 +280,8 @@ extern struct timespec start_time; struct fs; void ffs_fragacct_swap(struct fs *, int, int32_t [], int, int); +fsinode *link_check(fsinode *); + /* * Declarations for compat routines. */ Modified: head/usr.sbin/makefs/mtree.c ============================================================================== --- head/usr.sbin/makefs/mtree.c Wed Feb 20 19:05:13 2013 (r247051) +++ head/usr.sbin/makefs/mtree.c Wed Feb 20 19:32:31 2013 (r247052) @@ -779,6 +779,24 @@ read_mtree_keywords(FILE *fp, fsnode *no return (0); } + /* + * Check for hardlinks. If the contents key is used, then the check + * will only trigger if the contents file is a link even if it is used + * by more than one file + */ + if (sb.st_nlink > 1) { + fsinode *curino; + + st->st_ino = sb.st_ino; + st->st_dev = sb.st_dev; + curino = link_check(node->inode); + if (curino != NULL) { + free(node->inode); + node->inode = curino; + node->inode->nlink++; + } + } + free(node->contents); node->contents = name; st->st_size = sb.st_size; Modified: head/usr.sbin/makefs/walk.c ============================================================================== --- head/usr.sbin/makefs/walk.c Wed Feb 20 19:05:13 2013 (r247051) +++ head/usr.sbin/makefs/walk.c Wed Feb 20 19:32:31 2013 (r247052) @@ -59,7 +59,6 @@ static void apply_specdir(const char *, static void apply_specentry(const char *, NODE *, fsnode *); static fsnode *create_fsnode(const char *, const char *, const char *, struct stat *); -static fsinode *link_check(fsinode *); /* @@ -644,7 +643,7 @@ inode_type(mode_t mode) /* This was borrowed from du.c and tweaked to keep an fsnode * pointer instead. -- dbj@netbsd.org */ -static fsinode * +fsinode * link_check(fsinode *entry) { static struct entry {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302201932.r1KJWVTB000268>