This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
STABLE2 - dlmtop: fix some typos.
- From: Christine Caulfield <chrissie at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Wed, 22 Oct 2008 13:21:56 +0000 (UTC)
- Subject: STABLE2 - dlmtop: fix some typos.
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7a8ef1e8fbd60fc1f582111b53b1f7fb2a562794
Commit: 7a8ef1e8fbd60fc1f582111b53b1f7fb2a562794
Parent: 83f0ae0c5055e5781de3cd8f59cbebdfe7d71be6
Author: Christine Caulfield <ccaulfie@redhat.com>
AuthorDate: Wed Oct 22 14:21:41 2008 +0100
Committer: Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed Oct 22 14:21:41 2008 +0100
dlmtop: fix some typos.
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
dlm/tests/tcpdump/dlmtop.c | 56 ++++++++++++++++++++++---------------------
1 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/dlm/tests/tcpdump/dlmtop.c b/dlm/tests/tcpdump/dlmtop.c
index 8ae3f19..528a2b6 100644
--- a/dlm/tests/tcpdump/dlmtop.c
+++ b/dlm/tests/tcpdump/dlmtop.c
@@ -159,7 +159,7 @@ static struct locking_process remote_procs[MAX_PROCESSES];
static int num_local_procs;
static int num_remote_procs;
-/* This always suceeds */
+/* This always succeeds */
static struct locking_process *find_proc(struct locking_process *array, pid_t pid)
{
int i;
@@ -188,6 +188,17 @@ static struct locking_process *find_proc(struct locking_process *array, pid_t pi
return proc;
}
+static void update_deltas(struct locking_process *array, int size)
+{
+ int i;
+
+ for (i=0; i<size; i++) {
+ array[i].last_locks = array[i].locks;
+ array[i].last_unlocks = array[i].unlocks;
+ array[i].last_convs = array[i].convs;
+ }
+}
+
static int proc_compare(const void *a, const void *b)
{
const struct locking_process *pa = a;
@@ -207,17 +218,6 @@ static int proc_compare(const void *a, const void *b)
}
}
-static void update_deltas(struct locking_process *array, int size)
-{
- int i;
-
- for (i=0; i<size; i++) {
- array[i].last_locks = array[i].locks;
- array[i].last_unlocks = array[i].unlocks;
- array[i].last_convs = array[i].convs;
- }
-}
-
static void sort_proc(struct locking_process *array)
{
int array_size;
@@ -230,6 +230,7 @@ static void sort_proc(struct locking_process *array)
qsort(array, array_size, sizeof(struct locking_process), proc_compare);
}
+/* Get the command name for a PID */
static char *get_command(pid_t pid)
{
char name[1024];
@@ -258,7 +259,7 @@ static char *get_command(pid_t pid)
return cmd;
}
-/* We assume that the lcoal host only has 1 Ipv4 address */
+/* We assume that the local host only has 1 IPv4 address */
static int is_local_ip(unsigned int test_ip)
{
struct ifaddrs *ifa, *ifa_list;
@@ -342,7 +343,7 @@ static void display_remote_procs(void)
}
}
-
+/* Show what we have seen */
static void display(int ignored)
{
char timebuf[1024];
@@ -357,7 +358,7 @@ static void display(int ignored)
now = localtime(&t);
strftime(timebuf, sizeof(timebuf), "%d-%b-%Y %H:%M:%S", now);
-
+ /* Clear screen and display the header */
printf("\033[H\033[2Jdlmtop %s %s ", VERSION, timebuf);
printf("\n");
printf("\nSeen %d packets, %d locals, %d remote, %d non-dlm, %d errors\n", packets, l_locks, r_locks, nondlm, errors);
@@ -379,6 +380,7 @@ static void display(int ignored)
alarm(interval);
}
+/* Called when a user resizes the screen */
static void new_term_size(int sig)
{
struct winsize w;
@@ -400,7 +402,7 @@ static void new_term_size(int sig)
}
-static u_char save_buffer[4096]; /* more than enough for two packets */
+static u_char save_buffer[4096]; /* More than enough for two packets */
static int save_len = 0;
/* Process a packet */
@@ -439,6 +441,14 @@ static void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,
if (len - offset < offsetof(struct dlm_message, m_length))
return;
+ /* Non-dlm packet */
+ if (req->m_version != DLM_VERSION) {
+ if (debug)
+ fprintf(stderr, "CC: error non-dlm version = %x\n", req->m_version);
+ nondlm++;
+ return;
+ }
+
/* Ignore error packets */
if (req->m_length <= 0 || req->m_length > 200) {
if (debug)
@@ -448,14 +458,6 @@ static void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,
return;
}
- /* Non-dlm packet */
- if (req->m_version != DLM_VERSION) {
- if (debug)
- fprintf(stderr, "CC: error non-dlm version = %x\n", req->m_version);
- nondlm++;
- return;
- }
-
/* Carry forward incomplete packets */
if (offset+req->m_length > len) {
save_len = len - offset;
@@ -526,7 +528,7 @@ static void my_callback(u_char *useless,const struct pcap_pkthdr* pkthdr,
static void usage(char *cmd, FILE *f)
{
fprintf(f, "Usage:\n");
- fprintf(f, "%s [hVrladi]\n", cmd);
+ fprintf(f, "%s [hVrladip]\n", cmd);
fprintf(f, "\n");
fprintf(f, "Options\n");
fprintf(f, " -r Sort output by resources (default lock ops)\n");
@@ -561,7 +563,7 @@ int main(int argc,char **argv)
usage(argv[0], stdout);
exit(0);
case 'V':
- fprintf(stderr, "dlmtop version 0.1\n");
+ fprintf(stderr, "dlmtop version " VERSION "\n");
exit(0);
case 'r':
sort_type = SORT_RESOURCES;
@@ -608,7 +610,7 @@ int main(int argc,char **argv)
memset(local_procs, 0, sizeof(local_procs));
memset(remote_procs, 0, sizeof(remote_procs));
- /* grab a device to peak into... */
+ /* grab a device to peek into... */
dev = pcap_lookupdev(errbuf);
if(dev == NULL)
{ fprintf(stderr,"%s\n",errbuf); exit(1); }