~vibhavp/ubuntu/saucy/aufs-tools/merge-from-debian

« back to all changes in this revision

Viewing changes to umount.aufs.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2011-08-28 00:22:02 UTC
  • mfrom: (1.2.1 upstream) (3.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20110828002202-csjxokj480jh4qei
Tags: 20110410-1
* Merging upstream version 20110410.
* Updating maintainer and uploaders fields.
* Removing vcs fields.
* Removing references to my old email address.
* Makging packaging distribution neutral.
* Updating years in copyright file.
* Updating to standards version 3.9.2.
* Compacting copyright file.
* Updating build and install targets in rules for new upstream
  version.
* Rediffing static.patch.
* Correcting spelling mistake in package description.
* Adding manpage symlinks for aubusy and auibusy.
* Updating lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Junjiro R. Okajima
 
3
 *
 
4
 * This program, aufs is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
/*
 
20
 * The main purpose of this script is calling auplink.
 
21
 */
 
22
 
 
23
#include <linux/aufs_type.h>
 
24
#include <mntent.h>
 
25
#include <stdio.h>
 
26
#include <unistd.h>
 
27
#include "au_util.h"
 
28
 
 
29
int main(int argc, char *argv[])
 
30
{
 
31
        int err, i, j;
 
32
        struct mntent ent;
 
33
        char *mntpnt, *av[argc + 1];
 
34
 
 
35
        if (argc < 2) {
 
36
                puts(AuVersion);
 
37
                errno = EINVAL;
 
38
                goto out;
 
39
        }
 
40
 
 
41
        mntpnt = argv[1];
 
42
        err = au_proc_getmntent(mntpnt, &ent);
 
43
        if (err)
 
44
                AuFin("no such mount point");
 
45
        if (!hasmntopt(&ent, "noplink")) {
 
46
                err = au_plink(mntpnt, AuPlink_FLUSH,
 
47
                               AuPlinkFlag_OPEN | AuPlinkFlag_CLOEXEC,
 
48
                               /*fd*/NULL);
 
49
                if (err)
 
50
                        AuFin(NULL);
 
51
        }
 
52
 
 
53
        i = 0;
 
54
        av[i++] = "umount";
 
55
        av[i++] = "-i";
 
56
        for (j = 2; j < argc; j++)
 
57
                av[i++] = argv[j];
 
58
        av[i++] = mntpnt;
 
59
        av[i++] = NULL;
 
60
        execvp(MOUNT_CMD_PATH "umount", av);
 
61
 
 
62
out:
 
63
        AuFin("umount");
 
64
        return errno;
 
65
}