2012-05-04 13:38:00 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
#include "util.h"
|
2012-05-04 13:38:00 +04:00
|
|
|
#include "log.h"
|
2012-05-04 13:38:00 +04:00
|
|
|
#include "mount.h"
|
|
|
|
#include "proc_parse.h"
|
|
|
|
|
2012-06-27 20:57:30 +04:00
|
|
|
static struct mount_info *mntinfo;
|
2012-05-04 13:38:00 +04:00
|
|
|
|
|
|
|
int open_mount(unsigned int s_dev)
|
2012-05-04 13:38:00 +04:00
|
|
|
{
|
2012-06-27 20:57:30 +04:00
|
|
|
struct mount_info *i;
|
2012-05-04 13:38:00 +04:00
|
|
|
|
2012-05-13 00:07:11 +04:00
|
|
|
for (i = mntinfo; i != NULL; i = i->next)
|
|
|
|
if (s_dev == i->s_dev)
|
|
|
|
return open(i->mountpoint, O_RDONLY);
|
2012-05-04 13:38:00 +04:00
|
|
|
|
|
|
|
return -ENOENT;
|
|
|
|
}
|
2012-05-04 13:38:00 +04:00
|
|
|
|
|
|
|
int collect_mount_info(void)
|
|
|
|
{
|
2012-05-13 00:07:11 +04:00
|
|
|
mntinfo = parse_mountinfo(getpid());
|
|
|
|
if (!mntinfo) {
|
2012-05-04 13:38:00 +04:00
|
|
|
pr_err("Parsing mountinfo %d failed\n", getpid());
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2012-05-12 03:30:10 +04:00
|
|
|
|
|
|
|
int dump_mnt_ns(int ns_pid, struct cr_fdset *fdset)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void show_mountpoints(int fd, struct cr_options *o)
|
|
|
|
{
|
|
|
|
pr_img_head(CR_FD_MOUNTPOINTS);
|
|
|
|
pr_img_tail(CR_FD_MOUNTPOINTS);
|
|
|
|
}
|