Deleted Added
full compact
vfs_export.c (108250) vfs_export.c (109623)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
39 * $FreeBSD: head/sys/kern/vfs_export.c 108250 2002-12-24 03:03:39Z hsu $
39 * $FreeBSD: head/sys/kern/vfs_export.c 109623 2003-01-21 08:56:16Z alfred $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/socket.h>
46#include <sys/malloc.h>
47#include <sys/mbuf.h>

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

117 mp->mnt_flag |= MNT_DEFEXPORTED;
118 return (0);
119 }
120
121 if (argp->ex_addrlen > MLEN)
122 return (EINVAL);
123
124 i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/kernel.h>
45#include <sys/socket.h>
46#include <sys/malloc.h>
47#include <sys/mbuf.h>

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

117 mp->mnt_flag |= MNT_DEFEXPORTED;
118 return (0);
119 }
120
121 if (argp->ex_addrlen > MLEN)
122 return (EINVAL);
123
124 i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
125 np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK | M_ZERO);
125 np = (struct netcred *) malloc(i, M_NETADDR, M_ZERO);
126 saddr = (struct sockaddr *) (np + 1);
127 if ((error = copyin(argp->ex_addr, saddr, argp->ex_addrlen)))
128 goto out;
129 if (saddr->sa_len > argp->ex_addrlen)
130 saddr->sa_len = argp->ex_addrlen;
131 if (argp->ex_masklen) {
132 smask = (struct sockaddr *)((caddr_t)saddr + argp->ex_addrlen);
133 error = copyin(argp->ex_mask, smask, argp->ex_masklen);

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

231 }
232 vfs_free_addrlist(nep);
233 mp->mnt_export = NULL;
234 free(nep, M_MOUNT);
235 mp->mnt_flag &= ~(MNT_EXPORTED | MNT_DEFEXPORTED);
236 }
237 if (argp->ex_flags & MNT_EXPORTED) {
238 if (nep == NULL) {
126 saddr = (struct sockaddr *) (np + 1);
127 if ((error = copyin(argp->ex_addr, saddr, argp->ex_addrlen)))
128 goto out;
129 if (saddr->sa_len > argp->ex_addrlen)
130 saddr->sa_len = argp->ex_addrlen;
131 if (argp->ex_masklen) {
132 smask = (struct sockaddr *)((caddr_t)saddr + argp->ex_addrlen);
133 error = copyin(argp->ex_mask, smask, argp->ex_masklen);

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

231 }
232 vfs_free_addrlist(nep);
233 mp->mnt_export = NULL;
234 free(nep, M_MOUNT);
235 mp->mnt_flag &= ~(MNT_EXPORTED | MNT_DEFEXPORTED);
236 }
237 if (argp->ex_flags & MNT_EXPORTED) {
238 if (nep == NULL) {
239 nep = malloc(sizeof(struct netexport), M_MOUNT, M_WAITOK | M_ZERO);
239 nep = malloc(sizeof(struct netexport), M_MOUNT, M_ZERO);
240 mp->mnt_export = nep;
241 }
242 if (argp->ex_flags & MNT_EXPUBLIC) {
243 if ((error = vfs_setpublicfs(mp, nep, argp)) != 0)
244 return (error);
245 mp->mnt_flag |= MNT_EXPUBLIC;
246 }
247 if ((error = vfs_hang_addrlist(mp, nep, argp)))

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

301
302 vput(rvp);
303
304 /*
305 * If an indexfile was specified, pull it in.
306 */
307 if (argp->ex_indexfile != NULL) {
308 MALLOC(nfs_pub.np_index, char *, MAXNAMLEN + 1, M_TEMP,
240 mp->mnt_export = nep;
241 }
242 if (argp->ex_flags & MNT_EXPUBLIC) {
243 if ((error = vfs_setpublicfs(mp, nep, argp)) != 0)
244 return (error);
245 mp->mnt_flag |= MNT_EXPUBLIC;
246 }
247 if ((error = vfs_hang_addrlist(mp, nep, argp)))

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

301
302 vput(rvp);
303
304 /*
305 * If an indexfile was specified, pull it in.
306 */
307 if (argp->ex_indexfile != NULL) {
308 MALLOC(nfs_pub.np_index, char *, MAXNAMLEN + 1, M_TEMP,
309 M_WAITOK);
309 0);
310 error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
311 MAXNAMLEN, (size_t *)0);
312 if (!error) {
313 /*
314 * Check for illegal filenames.
315 */
316 for (cp = nfs_pub.np_index; *cp; cp++) {
317 if (*cp == '/') {

--- 87 unchanged lines hidden ---
310 error = copyinstr(argp->ex_indexfile, nfs_pub.np_index,
311 MAXNAMLEN, (size_t *)0);
312 if (!error) {
313 /*
314 * Check for illegal filenames.
315 */
316 for (cp = nfs_pub.np_index; *cp; cp++) {
317 if (*cp == '/') {

--- 87 unchanged lines hidden ---