[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/group/tool main.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2006-07-31 18:38:33

Modified files:
	group/tool     : main.c 

Log message:
	'group_tool dump plocks <fsname>' can now be used to display all
	plocks held in the fs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&r1=1.18&r2=1.19

--- cluster/group/tool/main.c	2006/07/25 20:09:58	1.18
+++ cluster/group/tool/main.c	2006/07/31 18:38:33	1.19
@@ -359,6 +359,39 @@
 	return 0;
 }
 
+int do_plock_dump(int argc, char **argv, int fd)
+{
+	char inbuf[MAXLINE];
+	char outbuf[MAXLINE];
+	int rv;
+
+	memset(outbuf, 0, sizeof(outbuf));
+
+	if (opt_ind + 1 >= argc) {
+		printf("plocks option requires a group name\n");
+		return -1;
+	}
+
+	sprintf(outbuf, "plocks %s", argv[opt_ind + 1]);
+
+	rv = write(fd, outbuf, sizeof(outbuf));
+	if (rv != sizeof(outbuf)) {
+		printf("dump write error %d errno %d\n", rv, errno);;
+		return -1;
+	}
+
+	while (1) {
+		memset(&inbuf, 0, sizeof(inbuf));
+		rv = read(fd, inbuf, sizeof(inbuf));
+		if (rv <= 0)
+			break;
+		write(STDOUT_FILENO, inbuf, rv);
+	}
+
+	close(fd);
+	return 0;
+}
+
 int main(int argc, char **argv)
 {
 	int fd;
@@ -385,6 +418,13 @@
 					return -1;
 				return do_maxline_dump(argc, argv, fd);
 			}
+
+			if (!strncmp(argv[opt_ind], "plocks", 5)) {
+				fd = connect_daemon(LOCK_DLM_SOCK_PATH);
+				if (fd < 0)
+					return -1;
+				return do_plock_dump(argc, argv, fd);
+			}
 		}
 
 		fd = connect_daemon(GROUPD_SOCK_PATH);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]