Deleted Added
full compact
mount_unionfs.c (165788) mount_unionfs.c (166684)
1/*-
2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California.
4 * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc.
5 * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org>
6 * All rights reserved.
7 *
8 * This code is derived from software donated to Berkeley by

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

39 The Regents of the University of California. All rights reserved.\n";
40#endif /* not lint */
41
42#ifndef lint
43#if 0
44static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
45#else
46static const char rcsid[] =
1/*-
2 * Copyright (c) 1992, 1993, 1994
3 * The Regents of the University of California.
4 * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc.
5 * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org>
6 * All rights reserved.
7 *
8 * This code is derived from software donated to Berkeley by

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

39 The Regents of the University of California. All rights reserved.\n";
40#endif /* not lint */
41
42#ifndef lint
43#if 0
44static char sccsid[] = "@(#)mount_union.c 8.5 (Berkeley) 3/27/94";
45#else
46static const char rcsid[] =
47 "$FreeBSD: head/sbin/mount_unionfs/mount_unionfs.c 165788 2007-01-05 02:54:27Z rodrigc $";
47 "$FreeBSD: head/sbin/mount_unionfs/mount_unionfs.c 166684 2007-02-13 05:39:38Z rodrigc $";
48#endif
49#endif /* not lint */
50
51#include <sys/param.h>
52#include <sys/mount.h>
53#include <sys/uio.h>
54#include <sys/errno.h>
55

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

127
128int
129main(int argc, char *argv[])
130{
131 struct iovec *iov;
132 int ch, mntflags, iovlen;
133 char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
134 char uid_str[20], gid_str[20];
48#endif
49#endif /* not lint */
50
51#include <sys/param.h>
52#include <sys/mount.h>
53#include <sys/uio.h>
54#include <sys/errno.h>
55

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

127
128int
129main(int argc, char *argv[])
130{
131 struct iovec *iov;
132 int ch, mntflags, iovlen;
133 char source [MAXPATHLEN], target[MAXPATHLEN], errmsg[255];
134 char uid_str[20], gid_str[20];
135 char fstype[] = "unionfs";
135 char *p, *val;
136
137 iov = NULL;
138 iovlen = 0;
139 mntflags = 0;
140 memset(errmsg, 0, sizeof(errmsg));
141
142 while ((ch = getopt(argc, argv, "bo:")) != -1) {

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

177 /* resolve both target and source with realpath(3) */
178 (void)checkpath(argv[0], target);
179 (void)checkpath(argv[1], source);
180
181 if (subdir(target, source) || subdir(source, target))
182 errx(EX_USAGE, "%s (%s) and %s (%s) are not distinct paths",
183 argv[0], target, argv[1], source);
184
136 char *p, *val;
137
138 iov = NULL;
139 iovlen = 0;
140 mntflags = 0;
141 memset(errmsg, 0, sizeof(errmsg));
142
143 while ((ch = getopt(argc, argv, "bo:")) != -1) {

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

178 /* resolve both target and source with realpath(3) */
179 (void)checkpath(argv[0], target);
180 (void)checkpath(argv[1], source);
181
182 if (subdir(target, source) || subdir(source, target))
183 errx(EX_USAGE, "%s (%s) and %s (%s) are not distinct paths",
184 argv[0], target, argv[1], source);
185
185 build_iovec(&iov, &iovlen, "fstype", "unionfs", (size_t)-1);
186 build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
186 build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
187 build_iovec(&iov, &iovlen, "from", target, (size_t)-1);
188 build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
189
190 if (nmount(iov, iovlen, mntflags))
191 err(EX_OSERR, "%s: %s", source, errmsg);
192 exit(0);
193}
187 build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
188 build_iovec(&iov, &iovlen, "from", target, (size_t)-1);
189 build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
190
191 if (nmount(iov, iovlen, mntflags))
192 err(EX_OSERR, "%s: %s", source, errmsg);
193 exit(0);
194}