cluster/gfs2/tool gfs2_tool.h misc.c util.c
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: rpeterso at sourceware.org 2007-11-07 14:58:00
Modified files:
gfs2/tool : gfs2_tool.h misc.c util.c
Log message:
Resolves: bz 352581: GFS2: implement gfs2_tool lockdump
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/gfs2_tool.h.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/misc.c.diff?cvsroot=cluster&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs2/tool/util.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
gfs2/tool/gfs2_tool.h +1 -1
@@ -95,7 +95,7 @@char *get_list (void );char **str2lines (char *str); -const char *find_debugfs_mount (void ); +char *find_debugfs_mount (void );char *mp2fsname (char *mp);char *name2value (char *str,char *name);uint32_t name2u32 (char *str,char *name);
gfs2/tool/misc.c +62 -1
75 lines not on this page · raw message
gfs2/tool/util.c +30 -0
@@ -283,6 +283,36 @@return name; } +char * +find_debugfs_mount (void ) +{ +FILE *file; +char line[PATH_MAX ]; +char device[PATH_MAX ], type[PATH_MAX ]; +char *path; + + file =fopen ("/proc/mounts" ,"rt" ); +if (!file) +die ("can't open /proc/mounts: %s\n" ,strerror (errno)); + + path =malloc (PATH_MAX ); +if (!path) +die ("Can't allocate memory for debugfs.\n" ); +while (fgets (line,PATH_MAX , file)) { + +if (sscanf (line,"%s %s %s" , device, path, type) !=3 ) +continue ; +if (!strcmp (type,"debugfs" )) { +fclose (file); +return path; + } + } + +free (path); +fclose (file); +return NULL ; +} +/* The fsname can be substituted for the mountpoint on the command line. This is necessary when we can't resolve a devname from /proc/mounts to a fsname. */