GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.sbin/amd/amd/umount_fs.c Lines: 0 8 0.0 %
Date: 2017-11-07 Branches: 0 7 0.0 %

Line Branch Exec Source
1
/*
2
 * Copyright (c) 1990 Jan-Simon Pendry
3
 * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
4
 * Copyright (c) 1990, 1993
5
 *	The Regents of the University of California.  All rights reserved.
6
 *
7
 * This code is derived from software contributed to Berkeley by
8
 * Jan-Simon Pendry at Imperial College, London.
9
 *
10
 * Redistribution and use in source and binary forms, with or without
11
 * modification, are permitted provided that the following conditions
12
 * are met:
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in the
17
 *    documentation and/or other materials provided with the distribution.
18
 * 3. Neither the name of the University nor the names of its contributors
19
 *    may be used to endorse or promote products derived from this software
20
 *    without specific prior written permission.
21
 *
22
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32
 * SUCH DAMAGE.
33
 *
34
 *	from: @(#)umount_fs.c	8.1 (Berkeley) 6/6/93
35
 *	$Id: umount_fs.c,v 1.6 2014/10/20 00:20:04 guenther Exp $
36
 */
37
38
#include "am.h"
39
40
int
41
umount_fs(char *fs_name)
42
{
43
	int error;
44
45
eintr:
46
	error = unmount(fs_name, 0);
47
	if (error < 0)
48
		error = errno;
49
50
	switch (error) {
51
	case EINVAL:
52
	case ENOTBLK:
53
	case ENOENT:
54
		plog(XLOG_WARNING, "unmount: %s is not mounted", fs_name);
55
		error = 0;	/* Not really an error */
56
		break;
57
58
	case EINTR:
59
#ifdef DEBUG
60
		/* not sure why this happens, but it does.  ask kirk one day... */
61
		dlog("%s: unmount: %m", fs_name);
62
#endif /* DEBUG */
63
		goto eintr;
64
65
#ifdef DEBUG
66
	default:
67
		dlog("%s: unmount: %m", fs_name);
68
		break;
69
#endif /* DEBUG */
70
	}
71
72
	return error;
73
}