--- crash-4.0-3.3/filesys.c 2006-09-07 21:00:08.000000000 +0200 +++ crash-4.0-3.3-patch/filesys.c 2006-09-07 22:45:24.000000000 +0200 @@ -18,7 +18,7 @@ #include "defs.h" #include -static void show_mounts(ulong, int); +static void show_mounts(ulong, int, ulong); static int find_booted_kernel(void); static int find_booted_system_map(void); static int verify_utsname(char *); @@ -33,7 +33,7 @@ static int open_file_reference(struct reference *); static void memory_source_init(void); static int get_pathname_component(ulong, ulong, int, char *, char *); -static ulong *get_mount_list(int *); +static ulong *get_mount_list(int *, ulong); char *inode_type(char *, char *); static void match_proc_version(void); static void get_live_memory_source(void); @@ -1137,6 +1137,7 @@ { int i; int c, found; + ulong namespace_pid = (ulong)1; char *spec_string; char buf1[BUFSIZE]; char buf2[BUFSIZE]; @@ -1146,7 +1147,7 @@ int mh_flag = 1; int save_next; - while ((c = getopt(argcnt, args, "if")) != EOF) { + while ((c = getopt(argcnt, args, "ifn:")) != EOF) { switch(c) { case 'i': @@ -1156,7 +1157,22 @@ case 'f': flags |= MOUNT_PRINT_FILES; break; - + case 'n': + { + ulong context; + struct task_context *tc; + switch (str_to_context(optarg, &context, &tc)) { + case STR_PID: + case STR_TASK: + namespace_pid = tc->pid; + break; + case STR_INVALID: + error(FATAL, "invalid task or pid value: %s\n", + optarg); + break; + } + break; + } default: argerrs++; break; @@ -1175,7 +1191,7 @@ shift_string_left(spec_string, 2); open_tmpfile(); - show_mounts(0, MOUNT_PRINT_ALL); + show_mounts(0, MOUNT_PRINT_ALL, namespace_pid); found = FALSE; rewind(pc->tmpfile); @@ -1201,7 +1217,7 @@ fp = pc->saved_fp; if (flags) { sscanf(buf2,"%lx",&vfsmount); - show_mounts(vfsmount, flags); + show_mounts(vfsmount, flags, namespace_pid); } else { if (mh_flag) { fprintf(fp, mount_hdr); @@ -1216,7 +1232,7 @@ close_tmpfile(); } while (args[++optind]); } else - show_mounts(0, flags); + show_mounts(0, flags, namespace_pid); } /* @@ -1224,7 +1240,7 @@ */ static void -show_mounts(ulong one_vfsmount, int flags) +show_mounts(ulong one_vfsmount, int flags, ulong namespace_pid) { ulong one_vfsmount_list; long sb_s_files; @@ -1262,7 +1278,7 @@ mount_cnt = 1; mntlist = &one_vfsmount_list; } else - mntlist = get_mount_list(&mount_cnt); + mntlist = get_mount_list(&mount_cnt, namespace_pid); if (!strlen(mount_hdr)) { devlen = strlen("DEVNAME"); @@ -1424,7 +1440,7 @@ * Allocate and fill a list of the currently-mounted vfsmount pointers. */ static ulong * -get_mount_list(int *cntptr) +get_mount_list(int *cntptr, ulong namespace_pid) { struct list_data list_data, *ld; int mount_cnt; @@ -1438,7 +1454,7 @@ get_symbol_data("vfsmntlist", sizeof(void *), &ld->start); ld->end = symbol_value("vfsmntlist"); } else if (VALID_MEMBER(namespace_root)) { - if (!(tc = pid_to_context(1))) + if (!(tc = pid_to_context(namespace_pid))) tc = CURRENT_CONTEXT(); readmem(tc->task + OFFSET(task_struct_namespace), KVADDR, @@ -1513,7 +1529,7 @@ goto nopath; if (VALID_MEMBER(file_f_vfsmnt)) { - mntlist = get_mount_list(&mount_cnt); + mntlist = get_mount_list(&mount_cnt, 1); vfsmount_buf = GETBUF(SIZE(vfsmount)); for (m = found = 0, vfsmnt = mntlist;