Deleted Added
full compact
ffs.c (217769) ffs.c (223306)
1/* $NetBSD: ffs.c,v 1.44 2009/04/28 22:49:26 joerg Exp $ */
2
3/*
4 * Copyright (c) 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Luke Mewburn for Wasabi Systems, Inc.
8 *

--- 52 unchanged lines hidden (view full) ---

61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 * @(#)ffs_alloc.c 8.19 (Berkeley) 7/13/95
66 */
67
68#include <sys/cdefs.h>
1/* $NetBSD: ffs.c,v 1.44 2009/04/28 22:49:26 joerg Exp $ */
2
3/*
4 * Copyright (c) 2001 Wasabi Systems, Inc.
5 * All rights reserved.
6 *
7 * Written by Luke Mewburn for Wasabi Systems, Inc.
8 *

--- 52 unchanged lines hidden (view full) ---

61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
63 * SUCH DAMAGE.
64 *
65 * @(#)ffs_alloc.c 8.19 (Berkeley) 7/13/95
66 */
67
68#include <sys/cdefs.h>
69__FBSDID("$FreeBSD: head/usr.sbin/makefs/ffs.c 217769 2011-01-24 06:17:05Z mckusick $");
69__FBSDID("$FreeBSD: head/usr.sbin/makefs/ffs.c 223306 2011-06-19 18:34:49Z marcel $");
70
71#include <sys/param.h>
72
73#include <sys/mount.h>
74
75#include <assert.h>
76#include <errno.h>
77#include <fcntl.h>

--- 693 unchanged lines hidden (view full) ---

771 */
772 if (debug & DEBUG_FS_POPULATE)
773 printf("ffs_populate_dir: PASS 2 dir %s\n", dir);
774 for (cur = root; cur != NULL; cur = cur->next) {
775 if (cur->inode->flags & FI_WRITTEN)
776 continue; /* skip hard-linked entries */
777 cur->inode->flags |= FI_WRITTEN;
778
70
71#include <sys/param.h>
72
73#include <sys/mount.h>
74
75#include <assert.h>
76#include <errno.h>
77#include <fcntl.h>

--- 693 unchanged lines hidden (view full) ---

771 */
772 if (debug & DEBUG_FS_POPULATE)
773 printf("ffs_populate_dir: PASS 2 dir %s\n", dir);
774 for (cur = root; cur != NULL; cur = cur->next) {
775 if (cur->inode->flags & FI_WRITTEN)
776 continue; /* skip hard-linked entries */
777 cur->inode->flags |= FI_WRITTEN;
778
779 if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name)
780 >= sizeof(path))
781 errx(1, "Pathname too long.");
779 if (cur->contents == NULL) {
780 if (snprintf(path, sizeof(path), "%s/%s", dir,
781 cur->name) >= sizeof(path))
782 errx(1, "Pathname too long.");
783 }
782
783 if (cur->child != NULL)
784 continue; /* child creates own inode */
785
786 /* build on-disk inode */
787 if (ffs_opts->version == 1)
788 membuf = ffs_build_dinode1(&din.ffs1_din, &dirbuf, cur,
789 root, fsopts);

--- 7 unchanged lines hidden (view full) ---

797 if (cur->inode->nlink > 1)
798 printf(", nlink %d", cur->inode->nlink);
799 putchar('\n');
800 }
801
802 if (membuf != NULL) {
803 ffs_write_file(&din, cur->inode->ino, membuf, fsopts);
804 } else if (S_ISREG(cur->type)) {
784
785 if (cur->child != NULL)
786 continue; /* child creates own inode */
787
788 /* build on-disk inode */
789 if (ffs_opts->version == 1)
790 membuf = ffs_build_dinode1(&din.ffs1_din, &dirbuf, cur,
791 root, fsopts);

--- 7 unchanged lines hidden (view full) ---

799 if (cur->inode->nlink > 1)
800 printf(", nlink %d", cur->inode->nlink);
801 putchar('\n');
802 }
803
804 if (membuf != NULL) {
805 ffs_write_file(&din, cur->inode->ino, membuf, fsopts);
806 } else if (S_ISREG(cur->type)) {
805 ffs_write_file(&din, cur->inode->ino, path, fsopts);
807 ffs_write_file(&din, cur->inode->ino,
808 (cur->contents) ? cur->contents : path, fsopts);
806 } else {
807 assert (! S_ISDIR(cur->type));
808 ffs_write_inode(&din, cur->inode->ino, fsopts);
809 }
810 }
811
812 /*
813 * pass 3: write out sub-directories

--- 329 unchanged lines hidden ---
809 } else {
810 assert (! S_ISDIR(cur->type));
811 ffs_write_inode(&din, cur->inode->ino, fsopts);
812 }
813 }
814
815 /*
816 * pass 3: write out sub-directories

--- 329 unchanged lines hidden ---