]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/import/aufs-util.c
2 This file is part of systemd.
4 Copyright 2014 Lennart Poettering
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 #include "aufs-util.h"
24 #include "string-util.h"
29 const struct stat
*sb
,
33 const char *fn
, *original
;
37 fn
= fpath
+ ftwbuf
->base
;
39 /* We remove all whiteout files, and all whiteouts */
41 original
= startswith(fn
, ".wh.");
45 log_debug("Removing whiteout indicator %s.", fpath
);
46 r
= rm_rf(fpath
, REMOVE_ROOT
|REMOVE_PHYSICAL
);
50 if (!startswith(fn
, ".wh..wh.")) {
52 p
= alloca(ftwbuf
->base
+ strlen(original
));
53 strcpy(mempcpy(p
, fpath
, ftwbuf
->base
), original
);
55 log_debug("Removing deleted file %s.", p
);
56 r
= rm_rf(p
, REMOVE_ROOT
|REMOVE_PHYSICAL
);
64 int aufs_resolve(const char *path
) {
68 r
= nftw(path
, nftw_cb
, 64, FTW_MOUNT
|FTW_PHYS
|FTW_ACTIONRETVAL
);
70 return errno
> 0 ? -errno
: -EIO
;