Changes by: flatcap
Update of /cvsroot/linux-ntfs/dynamic-disk/linux/fs/partitions
In directory usw-pr-cvs1:/tmp/cvs-serv29692/linux/fs/partitions
Modified Files:
ldm.c ldm.h
Log Message:
reverted DEBUG_ON->BUG_ON
simplified logging
minor cleanups
Index: ldm.c
===================================================================
RCS file: /cvsroot/linux-ntfs/dynamic-disk/linux/fs/partitions/ldm.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -U2 -r1.78 -r1.79
--- ldm.c 20 Jun 2002 18:04:51 -0000 1.78
+++ ldm.c 21 Jun 2002 14:31:44 -0000 1.79
@@ -27,4 +27,5 @@
#include <linux/slab.h>
#include <linux/pagemap.h>
+#include <linux/buffer_head.h>
#include <linux/stringify.h>
#include "ldm.h"
@@ -51,5 +52,5 @@
/**
- * ldm_debug - Output an error message if debugging was enabled at compile time
+ * ldm_debug/info/error/crit - Output an error message
* @f: A printf format string containing the message
* @...: The variables to substitute into @f
@@ -59,34 +60,19 @@
*/
#ifndef CONFIG_LDM_DEBUG
-# define ldm_debug(...) do {} while (0)
-# define DEBUG_ON(x) do {} while (0)
+#define ldm_debug(...) do {} while (0)
#else
-# define DEBUG_ON BUG_ON
-# define ldm_debug(f, a...) \
- _ldm_printf (LDM_DEBUG, __LINE__, __func__, f, ##a)
+#define ldm_debug(f, a...) _ldm_printk (KERN_DEBUG, __FUNCTION__, f, ##a)
#endif
-#define ldm_crit(f, a...) _ldm_printf (LDM_CRIT, __LINE__, __func__, f, ##a)
-#define ldm_error(f, a...) _ldm_printf (LDM_ERR, __LINE__, __func__, f, ##a)
-#define ldm_info(f, a...) _ldm_printf (LDM_INFO, __LINE__, __func__, f, ##a)
-
-__attribute__ ((format (printf, 4, 5)))
-static void _ldm_printf (unsigned level, int line,
- const char *function, const char *fmt, ...)
+#define ldm_crit(f, a...) _ldm_printk (KERN_CRIT, __FUNCTION__, f, ##a)
+#define ldm_error(f, a...) _ldm_printk (KERN_ERR, __FUNCTION__, f, ##a)
+#define ldm_info(f, a...) _ldm_printk (KERN_INFO, __FUNCTION__, f, ##a)
+
+__attribute__ ((format (printf, 3, 4)))
+static void _ldm_printk (const char *level, const char *function,
+ const char *fmt, ...)
{
static char buf[128];
va_list args;
- static const char *const prefix[] = {
- KERN_CRIT "(CRITICAL)",
- KERN_ERR "(ERROR)",
- KERN_INFO "(INFO)",
- KERN_DEBUG "(DEBUG)"};
-
- const char* file =
-#ifdef KBUILD_BASENAME
- __stringify (KBUILD_BASENAME);
-#else
- "ldm.c"; // FIXME: __FILE__ is too verbose.
-#endif
va_start (args, fmt);
@@ -94,8 +80,8 @@
va_end (args);
- printk ("%s (%s, %d) %s(): %s\n", prefix[level], file, line, function,
- buf);
+ printk ("%s%s(): %s\n", level, function, buf);
}
+
/**
* ldm_parse_hexbyte - Convert a ASCII hex number to a byte
@@ -167,5 +153,5 @@
static BOOL ldm_parse_privhead (const u8 *data, struct privhead *ph)
{
- DEBUG_ON (!data || !ph);
+ BUG_ON (!data || !ph);
if (MAGIC_PRIVHEAD != BE64 (data)) {
@@ -224,5 +210,5 @@
static BOOL ldm_parse_tocblock (const u8 *data, struct tocblock *toc)
{
- DEBUG_ON (!data || !toc);
+ BUG_ON (!data || !toc);
if (MAGIC_TOCBLOCK != BE64 (data)) {
@@ -270,5 +256,5 @@
static BOOL ldm_parse_vmdb (const u8 *data, struct vmdb *vm)
{
- DEBUG_ON (!data || !vm);
+ BUG_ON (!data || !vm);
if (MAGIC_VMDB != BE32 (data)) {
@@ -306,5 +292,5 @@
const struct privhead *ph2)
{
- DEBUG_ON (!ph1 || !ph2);
+ BUG_ON (!ph1 || !ph2);
return ((ph1->ver_major == ph2->ver_major) &&
@@ -330,5 +316,5 @@
const struct tocblock *toc2)
{
- DEBUG_ON (!toc1 || !toc2);
+ BUG_ON (!toc1 || !toc2);
return ((toc1->bitmap1_start == toc2->bitmap1_start) &&
@@ -371,5 +357,5 @@
int i;
- DEBUG_ON (!bdev || !ph1);
+ BUG_ON (!bdev || !ph1);
ph[1] = kmalloc (sizeof (*ph[1]), GFP_KERNEL);
@@ -398,5 +384,5 @@
goto out; /* Already logged */
else
- break; // FIXME ignore for now, 3rd PH can fail on odd-sized disks
+ break; /* FIXME ignore for now, 3rd PH can fail on odd-sized disks */
}
}
@@ -412,5 +398,6 @@
if ((ph[0]->logical_disk_start > ph[0]->config_start) ||
- ((ph[0]->logical_disk_start + ph[0]->logical_disk_size) > ph[0]->config_start)) {
+ ((ph[0]->logical_disk_start + ph[0]->logical_disk_size)
+ > ph[0]->config_start)) {
ldm_crit ("Disk and database overlap.");
goto out;
@@ -421,9 +408,10 @@
goto out;
}
+ /* FIXME ignore this for now
if (!ldm_compare_privheads (ph[0], ph[2])) {
- //ldm_crit ("Primary and backup PRIVHEADs don't match.");
- //goto out; // FIXME ignore this for now
+ ldm_crit ("Primary and backup PRIVHEADs don't match.");
+ goto out;
}
-
+ */
ldm_debug ("Validated PRIVHEADs successfully.");
result = TRUE;
@@ -459,5 +447,5 @@
int i;
- DEBUG_ON (!bdev || !ldb);
+ BUG_ON (!bdev || !ldb);
ph = &ldb->ph;
@@ -528,5 +516,5 @@
struct tocblock *toc;
- DEBUG_ON (!bdev || !ldb);
+ BUG_ON (!bdev || !ldb);
vm = &ldb->vm;
@@ -586,5 +574,5 @@
BOOL result = FALSE;
- DEBUG_ON (!bdev);
+ BUG_ON (!bdev);
data = read_dev_sector (bdev, 0, §);
@@ -628,5 +616,5 @@
struct list_head *item;
- DEBUG_ON (!lh_vl);
+ BUG_ON (!lh_vl);
list_for_each (item, lh_vl) {
@@ -656,5 +644,5 @@
struct list_head *item;
- DEBUG_ON (!ldb);
+ BUG_ON (!ldb);
list_for_each (item, &ldb->v_disk) {
@@ -681,9 +669,9 @@
*/
static BOOL ldm_create_partition (struct gendisk *hd, int minor, int start,
- int size)
+ int size)
{
int disk_minor;
- DEBUG_ON (!hd || !hd->part);
+ BUG_ON (!hd || !hd->part);
/* Get the minor number of the parent device
@@ -728,5 +716,5 @@
int minor;
- DEBUG_ON (!hd || !ldb);
+ BUG_ON (!hd || !ldb);
disk = ldm_get_disk_objid (ldb);
@@ -840,5 +828,5 @@
u8 length;
- DEBUG_ON (!block);
+ BUG_ON (!block);
length = *block++;
@@ -874,5 +862,5 @@
int length;
- DEBUG_ON (!block || !buffer);
+ BUG_ON (!block || !buffer);
length = block[0];
@@ -904,5 +892,5 @@
struct vblk_comp *comp;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -955,5 +943,5 @@
struct vblk_dgrp *dgrp;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1000,5 +988,5 @@
struct vblk_dgrp *dgrp;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1043,5 +1031,5 @@
struct vblk_disk *disk;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1082,5 +1070,5 @@
struct vblk_disk *disk;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1115,5 +1103,5 @@
struct vblk_part *part;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1168,5 +1156,5 @@
struct vblk_volu *volu;
- DEBUG_ON (!buffer || !vb);
+ BUG_ON (!buffer || !vb);
r_objid = ldm_relative (buffer, buflen, 0x18, 0);
@@ -1238,5 +1226,5 @@
int r_objid;
- DEBUG_ON (!buf || !vb);
+ BUG_ON (!buf || !vb);
r_objid = ldm_relative (buf, len, 0x18, 0);
@@ -1266,5 +1254,5 @@
else
ldm_error ("Failed to parse VBLK 0x%llx (type: 0x%02x).",
- vb->obj_id, vb->type);
+ (unsigned long long) vb->obj_id, vb->type);
return result;
@@ -1290,5 +1278,5 @@
struct list_head *item;
- DEBUG_ON (!data || !ldb);
+ BUG_ON (!data || !ldb);
vb = kmalloc (sizeof (*vb), GFP_KERNEL);
@@ -1352,5 +1340,5 @@
int rec, num, group;
- DEBUG_ON (!data || !frags);
+ BUG_ON (!data || !frags);
group = BE32 (data + 0x08);
@@ -1410,5 +1398,5 @@
struct list_head *item, *tmp;
- DEBUG_ON (!list);
+ BUG_ON (!list);
list_for_each_safe (item, tmp, list)
@@ -1433,5 +1421,5 @@
BOOL result = FALSE;
- DEBUG_ON (!frags || !ldb);
+ BUG_ON (!frags || !ldb);
list_for_each (item, frags) {
@@ -1464,5 +1452,6 @@
* FALSE An error occurred
*/
-static BOOL ldm_get_vblks (struct block_device *bdev, unsigned long base, struct ldmdb *ldb)
+static BOOL ldm_get_vblks (struct block_device *bdev, unsigned long base,
+ struct ldmdb *ldb)
{
int size, perbuf, skip, finish, s, v, recs;
@@ -1472,5 +1461,5 @@
LIST_HEAD (frags);
- DEBUG_ON (!bdev || !ldb);
+ BUG_ON (!bdev || !ldb);
size = ldb->vm.vblk_size;
@@ -1527,5 +1516,5 @@
struct list_head *item, *tmp;
- DEBUG_ON (!lh);
+ BUG_ON (!lh);
list_for_each_safe (item, tmp, lh)
@@ -1561,5 +1550,5 @@
int err = -1;
- DEBUG_ON (!hd || !bdev);
+ BUG_ON (!hd || !bdev);
/* Look for signs of a Dynamic Disk */
Index: ldm.h
===================================================================
RCS file: /cvsroot/linux-ntfs/dynamic-disk/linux/fs/partitions/ldm.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -U2 -r1.48 -r1.49
--- ldm.h 20 Jun 2002 18:04:52 -0000 1.48
+++ ldm.h 21 Jun 2002 14:31:44 -0000 1.49
@@ -34,11 +34,4 @@
#include <asm/byteorder.h>
-enum {
- LDM_CRIT, /* critical conditions */
- LDM_ERR, /* error conditions */
- LDM_INFO, /* informative messages */
- LDM_DEBUG /* debug-level messages */
-};
-
/* Magic numbers in CPU format. */
#define MAGIC_VMDB 0x564D4442 /* VMDB */
|