[Ocfs2-tools-commits] smushran commits r400 - in trunk: dlmtools
libocfs2/include
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Nov 15 17:33:06 CST 2004
Author: smushran
Date: 2004-11-15 17:33:04 -0600 (Mon, 15 Nov 2004)
New Revision: 400
Added:
trunk/dlmtools/Cscope.make
Modified:
trunk/dlmtools/
trunk/dlmtools/listuuid.c
trunk/libocfs2/include/ocfs2.h
Log:
added maj_num and min_num to ocfs2_devices
used the two in listuuid
Property changes on: trunk/dlmtools
___________________________________________________________________
Name: svn:ignore
+ cscope*
listuuid
stamp-md5
Added: trunk/dlmtools/Cscope.make
===================================================================
--- trunk/dlmtools/Cscope.make 2004-11-15 21:25:04 UTC (rev 399)
+++ trunk/dlmtools/Cscope.make 2004-11-15 23:33:04 UTC (rev 400)
@@ -0,0 +1,11 @@
+.PHONY: cscope
+cscope:
+ rm -f cscope.*
+ echo "-k" >> cscope.files
+ echo "-I inc" >> cscope.files
+ find . -maxdepth 2 -name '*.c' -print >>cscope.files
+ find . -maxdepth 2 -name '*.h' -print >>cscope.files
+ find ../libocfs2/ -maxdepth 2 -name '*.c' -print >>cscope.files
+ find ../libocfs2/ -maxdepth 2 -name '*.h' -print >>cscope.files
+ find ../libocfs2/ -maxdepth 2 -name '*.et' -print >>cscope.files
+ cscope -b
Modified: trunk/dlmtools/listuuid.c
===================================================================
--- trunk/dlmtools/listuuid.c 2004-11-15 21:25:04 UTC (rev 399)
+++ trunk/dlmtools/listuuid.c 2004-11-15 23:33:04 UTC (rev 400)
@@ -59,6 +59,8 @@
FILE *proc;
char line[256];
char name[256];
+ char major[256];
+ char minor[256];
ocfs2_devices *dev;
proc = fopen ("/proc/partitions", "r");
@@ -68,7 +70,9 @@
}
while (fgets (line, sizeof(line), proc) != NULL) {
- if (sscanf(line, "%*d %*d %*d %99[^ \t\n]", name) != 1)
+ *major = *minor = *name = '\0';
+ if (sscanf(line, "%*[ ]%[0-9]%*[ ]%[0-9] %*d %99[^ \t\n]",
+ major, minor, name) != 3)
continue;
ret = ocfs2_malloc0(sizeof(ocfs2_devices), &dev);
@@ -76,6 +80,8 @@
goto bail;
snprintf(dev->dev_name, sizeof(dev->dev_name), "/dev/%s", name);
+ dev->maj_num = strtoul(major, NULL, 0);
+ dev->min_num = strtoul(minor, NULL, 0);
list_add_tail(&(dev->list), dev_list);
}
@@ -95,10 +101,11 @@
ocfs2_devices *dev;
struct list_head *pos;
char uuid[40];
+ char devstr[10];
char *p;
int i;
- printf("%-20s %-32s\n", "Device", "UUID");
+ printf("%-20s %7s %-32s\n", "Device", "maj,min", "UUID");
list_for_each(pos, dev_list) {
dev = list_entry(pos, ocfs2_devices, list);
if (dev->fs_type == 0)
@@ -108,7 +115,8 @@
for (i = 0, p = uuid; i < 16; i++, p += 2)
sprintf(p, "%02X", dev->uuid[i]);
- printf("%-20s %-32s\n", dev->dev_name, uuid);
+ sprintf(devstr, "%3d,%-d", dev->maj_num, dev->min_num);
+ printf("%-20s %-7s %-32s\n", dev->dev_name, devstr, uuid);
}
return ;
Modified: trunk/libocfs2/include/ocfs2.h
===================================================================
--- trunk/libocfs2/include/ocfs2.h 2004-11-15 21:25:04 UTC (rev 399)
+++ trunk/libocfs2/include/ocfs2.h 2004-11-15 23:33:04 UTC (rev 400)
@@ -210,6 +210,8 @@
uint8_t uuid[16];
int mount_flags;
int fs_type; /* 0=unknown, 1=ocfs, 2=ocfs2 */
+ uint32_t maj_num; /* major number of the device */
+ uint32_t min_num; /* minor number of the device */
void *private;
struct list_head node_list;
};
More information about the Ocfs2-tools-commits
mailing list