OBS User unknown 2008-09-26 12:47:52 +00:00 committed by Git OBS Bridge
parent b1a33d4752
commit b26f226e0c
13 changed files with 74 additions and 506 deletions

View File

@ -1,20 +1,11 @@
Index: 1.0.0.rc13/lib/activate/devmapper.c
Index: 1.0.0.rc15/lib/activate/devmapper.c
===================================================================
--- 1.0.0.rc13.orig/lib/activate/devmapper.c
+++ 1.0.0.rc13/lib/activate/devmapper.c
@@ -164,6 +164,7 @@ static int run_task(struct lib_context *
_init_dm();
ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name) &&
dm_task_set_uuid(dmt, uuid);
+
if (ret && table)
ret = parse_table(lc, dmt, table);
@@ -174,6 +175,83 @@ static int run_task(struct lib_context *
free(uuid);
--- 1.0.0.rc15.orig/lib/activate/devmapper.c 2008-06-20 18:03:04.000000000 +0200
+++ 1.0.0.rc15/lib/activate/devmapper.c 2008-09-24 16:20:58.000000000 +0200
@@ -207,6 +207,82 @@ run_task(struct lib_context *lc, struct
return ret;
}
+
+int get_edd_value(unsigned long *value, const char *path)
+{
+ FILE *file;
@ -92,9 +83,9 @@ Index: 1.0.0.rc13/lib/activate/devmapper.c
+}
+
/* Create a mapped device. */
int dm_create(struct lib_context *lc, struct raid_set *rs, char *table)
{
@@ -182,6 +260,10 @@ int dm_create(struct lib_context *lc, st
int
dm_create(struct lib_context *lc, struct raid_set *rs, char *table)
@@ -216,6 +292,10 @@ dm_create(struct lib_context *lc, struct
/* Create <dev_name> */
ret = run_task(lc, rs, table, DM_DEVICE_CREATE);

View File

@ -1,23 +0,0 @@
Index: 1.0.0.rc13/lib/format/ataraid/jm.c
===================================================================
--- 1.0.0.rc13.orig/lib/format/ataraid/jm.c
+++ 1.0.0.rc13/lib/format/ataraid/jm.c
@@ -28,10 +28,15 @@ static char *name(struct lib_context *lc
size_t len;
struct jm *jm = META(rd, jm);
char buf[2], *ret, *name = (char *) jm->name;
+ char buf0[JM_NAME_LEN+1] = { '\0' };
+ size_t i = JM_NAME_LEN-1;
- /* Name always 0 terminated ? */
- if ((len = strlen(name)) > JM_NAME_LEN)
- len = JM_NAME_LEN;
+ strncpy(buf0, jm->name, JM_NAME_LEN);
+ while (i!=0 && buf0[i]==' ') {
+ buf0[i]='\0';
+ --i;
+ }
+ len = strlen(buf0);
len += sizeof(HANDLER) + 2;
if (jm->mode == JM_T_RAID01)

View File

@ -1,15 +0,0 @@
Index: 1.0.0.rc14/lib/metadata/metadata.c
===================================================================
--- 1.0.0.rc14.orig/lib/metadata/metadata.c
+++ 1.0.0.rc14/lib/metadata/metadata.c
@@ -797,6 +797,10 @@ static void want_set(struct lib_context
if (name) {
size_t len1 = strlen(rs->name), len2 = strlen(name);
+ /* FIXME: skip the DDF1 superset to get rid of segfault */
+ if (strncmp(rs->name, ".ddf1_", 6) == 0)
+ return;
+
if (len2 > len1 ||
strncmp(rs->name, name, min(len1, len2))) {
log_notice(lc, "dropping unwanted RAID set \"%s\"",

View File

@ -1,18 +1,18 @@
Index: 1.0.0.rc14/lib/format/ddf/ddf1.c
Index: 1.0.0.rc15/lib/format/ddf/ddf1.c
===================================================================
--- 1.0.0.rc14.orig/lib/format/ddf/ddf1.c
+++ 1.0.0.rc14/lib/format/ddf/ddf1.c
@@ -28,6 +28,9 @@ static const char *handler = HANDLER;
// #define PCI_VENDOR_ID_ADAPTEC 0x9004
--- 1.0.0.rc15.orig/lib/format/ddf/ddf1.c 2008-06-20 18:04:10.000000000 +0200
+++ 1.0.0.rc15/lib/format/ddf/ddf1.c 2008-09-24 16:10:34.000000000 +0200
@@ -40,6 +40,9 @@ static const char *handler = HANDLER;
// #define PCI_VENDOR_ID_ADAPTEC 0x9004
#define PCI_VENDOR_ID_ADAPTEC2 0x9005
+/* PCI IDs for LSI */
+#define PCI_VENDOR_ID_LSI 0x1000
+
/* Map DDF1 disk status to dmraid status */
static enum status disk_status(struct ddf1_phys_drive *disk) {
struct states states[] = {
@@ -358,6 +361,13 @@ static int read_extended(struct lib_cont
static enum status
disk_status(struct ddf1_phys_drive *disk)
@@ -378,6 +381,13 @@ read_extended(struct lib_context *lc, st
ddf1->adaptec_mode = 1;
}
@ -26,29 +26,29 @@ Index: 1.0.0.rc14/lib/format/ddf/ddf1.c
/* Read physical drive characteristic data */
where = to_bytes(pri->primary_table_lba + pri->disk_data_offset);
if (!(ddata = ddf1->disk_data =
@@ -667,10 +677,14 @@ static char *name(struct lib_context *lc
@@ -692,10 +702,14 @@ name(struct lib_context *lc, struct ddf1
} else {
char *b;
- for (b = buf + prefix, i = 0; i < 24; b += 8, i += 4)
- sprintf(b, "%02x%02x%02x%02x",
- vd->guid[i], vd->guid[i+1],
- vd->guid[i+2], vd->guid[i+3]);
+ for (b = buf + prefix, i = 0; i < 24; b += 8, i += 4) {
+ if (i == 16 && ddf1->lsi_mode)
+ sprintf(b, "00000000");
+ else
+ sprintf(b, "%02x%02x%02x%02x",
+ vd->guid[i], vd->guid[i+1],
+ vd->guid[i+2], vd->guid[i+3]);
+ }
- vd->guid[i], vd->guid[i + 1],
- vd->guid[i + 2], vd->guid[i + 3]);
+ for (b = buf + prefix, i = 0; i < 24; b += 8, i += 4) {
+ if (i == 16 && ddf1->lsi_mode)
+ sprintf(b, "00000000");
+ else
+ sprintf(b, "%02x%02x%02x%02x",
+ vd->guid[i], vd->guid[i+1],
+ vd->guid[i+2], vd->guid[i+3]);
+ }
}
out:
Index: 1.0.0.rc14/lib/format/ddf/ddf1.h
out:
Index: 1.0.0.rc15/lib/format/ddf/ddf1.h
===================================================================
--- 1.0.0.rc14.orig/lib/format/ddf/ddf1.h
+++ 1.0.0.rc14/lib/format/ddf/ddf1.h
--- 1.0.0.rc15.orig/lib/format/ddf/ddf1.h 2008-06-12 12:54:32.000000000 +0200
+++ 1.0.0.rc15/lib/format/ddf/ddf1.h 2008-09-24 16:03:52.000000000 +0200
@@ -264,6 +264,7 @@ struct ddf1 {
int disk_format;
int in_cpu_format;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a777354d6d69a9b58d84966cc7b37bc3f5c89539f885ad25fd874ed1c388fbec
size 164234

View File

@ -1,13 +1,13 @@
Index: 1.0.0.rc13/lib/internal.h
Index: 1.0.0.rc15/lib/internal.h
===================================================================
--- 1.0.0.rc13.orig/lib/internal.h
+++ 1.0.0.rc13/lib/internal.h
--- 1.0.0.rc15.orig/lib/internal.h 2008-06-12 12:54:32.000000000 +0200
+++ 1.0.0.rc15/lib/internal.h 2008-09-25 15:41:37.000000000 +0200
@@ -49,8 +49,8 @@
#define u_int64_t uint64_t
#endif
-#define min(a, b) a < b ? a : b
-#define max(a, b) a > b ? a : b
-#define min(a, b) (a) < (b) ? (a) : (b)
-#define max(a, b) (a) > (b) ? (a) : (b)
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define max(a, b) ((a) > (b) ? (a) : (b))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:30847258b7f946ed908e79af4058bbf2c9a3791728b8231f7c490ca601566c05
size 190475

View File

@ -1,45 +0,0 @@
Index: 1.0.0.rc13/lib/activate/devmapper.c
===================================================================
--- 1.0.0.rc13.orig/lib/activate/devmapper.c
+++ 1.0.0.rc13/lib/activate/devmapper.c
@@ -153,9 +153,17 @@ static int run_task(struct lib_context *
{
int ret;
struct dm_task *dmt;
+ char *uuid;
+
+ /* Generate UUID */
+ uuid = malloc(strlen(rs->name) + UUID_PREFIX_LEN + 1);
+ if (!uuid) return 0;
+
+ sprintf(uuid, UUID_PREFIX "%s", rs->name);
_init_dm();
- ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name);
+ ret = (dmt = dm_task_create(type)) && dm_task_set_name(dmt, rs->name) &&
+ dm_task_set_uuid(dmt, uuid);
if (ret && table)
ret = parse_table(lc, dmt, table);
@@ -163,6 +171,7 @@ static int run_task(struct lib_context *
ret = dm_task_run(dmt);
_exit_dm(dmt);
+ free(uuid);
return ret;
}
/* Create a mapped device. */
Index: 1.0.0.rc13/lib/activate/devmapper.h
===================================================================
--- 1.0.0.rc13.orig/lib/activate/devmapper.h
+++ 1.0.0.rc13/lib/activate/devmapper.h
@@ -8,6 +8,9 @@
#ifndef _DEVMAPPER_H_
#define _DEVMAPPER_H
+#define UUID_PREFIX "dmraid-"
+#define UUID_PREFIX_LEN 7
+
char *mkdm_path(struct lib_context *lc, const char *name);
int dm_create(struct lib_context *lc, struct raid_set *rs, char *table);
int dm_remove(struct lib_context *lc, struct raid_set *rs);

View File

@ -1,233 +0,0 @@
Index: 1.0.0.rc14/include/dmraid/lib_context.h
===================================================================
--- 1.0.0.rc14.orig/include/dmraid/lib_context.h 2005-09-21 13:46:53.000000000 +0200
+++ 1.0.0.rc14/include/dmraid/lib_context.h 2008-09-10 15:09:17.000000000 +0200
@@ -38,7 +38,12 @@
LC_VERBOSE,
LC_IGNORELOCKING,
LC_SEPARATOR,
- LC_DEVICES, /* Add new options below this one ! */
+ LC_DEVICES,
+ LC_PARTCHAR,
+ LC_CREATE,
+ LC_REBUILD_SET,
+ LC_REBUILD_DISK,
+ LC_HOT_SPARE_SET, /* Add new options below this one ! */
LC_OPTIONS_SIZE, /* Must be the last enumerator. */
};
@@ -62,6 +67,82 @@
#define OPT_STR_FORMAT(lc) OPT_STR(lc, LC_FORMAT)
#define OPT_STR_SEPARATOR(lc) OPT_STR(lc, LC_SEPARATOR)
+/* Options actions dmraid performs. */
+enum action {
+ UNDEF = 0x0,
+ ACTIVATE = 0x1,
+ DEACTIVATE = 0x2,
+ FORMAT = 0x4,
+#ifndef DMRAID_MINI
+ BLOCK_DEVICES = 0x8,
+ COLUMN = 0x10,
+ DBG = 0x20,
+ DUMP = 0x40,
+ DMERASE = 0x80,
+ GROUP = 0x100,
+#endif
+ HELP = 0x200,
+#ifndef DMRAID_MINI
+ LIST_FORMATS = 0x400,
+# ifdef DMRAID_NATIVE_LOG
+ NATIVE_LOG = 0x800,
+# endif
+#endif
+ NOPARTITIONS = 0x1000,
+#ifndef DMRAID_MINI
+ RAID_DEVICES = 0x2000,
+ RAID_SETS = 0x4000,
+ TEST = 0x8000,
+ VERBOSE = 0x10000,
+ ACTIVE = 0x20000,
+ INACTIVE = 0x40000,
+ SEPARATOR = 0x80000,
+#endif
+ VERSION = 0x100000,
+ IGNORELOCKING = 0x200000,
+#ifndef DMRAID_MINI
+ DEL_SETS = 0x400000,
+ CREATE = 0x800000,
+ REBUILD = 0x1000000,
+ SPARE = 0x2000000,
+ MEDIA = 0x4000000,
+ END_REBUILD = 0x8000000,
+ GET_MEMBERS = 0x10000000,
+ PARTCHAR = 0x20000000,
+
+#endif
+};
+
+enum metadata_need {
+ M_NONE = 0x00,
+ M_DEVICE = 0x01,
+ M_RAID = 0x02,
+ M_SET = 0x04,
+};
+
+enum id {
+ ROOT,
+ ANY_ID,
+};
+
+enum lock {
+ LOCK,
+ NO_LOCK,
+};
+
+/*
+ * Pre and Post functions to perform for an option.
+ */
+struct prepost {
+ enum action action;
+ enum metadata_need metadata;
+ enum id id;
+ enum lock lock;
+ int (*pre) (int arg);
+ int arg;
+ int (*post) (struct lib_context * lc, int arg);
+};
+
struct lib_version {
const char *text;
const char *date;
Index: 1.0.0.rc14/tools/commands.h
===================================================================
--- 1.0.0.rc14.orig/tools/commands.h 2005-09-27 15:39:44.000000000 +0200
+++ 1.0.0.rc14/tools/commands.h 2008-09-10 15:09:17.000000000 +0200
@@ -13,40 +13,6 @@
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a))
#define ARRAY_END(a) (a + ARRAY_SIZE(a))
-/* Options actions dmraid performs. */
-enum action {
- UNDEF = 0x0,
- ACTIVATE = 0x1,
- DEACTIVATE = 0x2,
- FORMAT = 0x4,
-#ifndef DMRAID_MINI
- BLOCK_DEVICES = 0x8,
- COLUMN = 0x10,
- DBG = 0x20,
- DUMP = 0x40,
- ERASE = 0x80,
- GROUP = 0x100,
-#endif
- HELP = 0x200,
-#ifndef DMRAID_MINI
- LIST_FORMATS = 0x400,
-# ifdef DMRAID_NATIVE_LOG
- NATIVE_LOG = 0x800,
-# endif
-#endif
- NOPARTITIONS = 0x1000,
-#ifndef DMRAID_MINI
- RAID_DEVICES = 0x2000,
- RAID_SETS = 0x4000,
- TEST = 0x8000,
- VERBOSE = 0x10000,
- ACTIVE = 0x20000,
- INACTIVE = 0x40000,
- SEPARATOR = 0x80000,
-#endif
- VERSION = 0x100000,
- IGNORELOCKING = 0x200000,
-};
#define ALL_FLAGS ((enum action) -1)
@@ -75,37 +41,6 @@
int arg; /* Argument for above function call */
};
-/* Define which metadata is needed before we can call post functions. */
-enum metadata_need {
- M_NONE = 0x00,
- M_DEVICE = 0x01,
- M_RAID = 0x02,
- M_SET = 0x04,
-};
-
-enum id {
- ROOT,
- ANY_ID,
-};
-
-enum lock {
- LOCK,
- NO_LOCK,
-};
-
-/*
- * Pre and Post functions to perform for an option.
- */
-struct prepost {
- enum action action;
- enum metadata_need metadata;
- enum id id;
- enum lock lock;
- int (*pre)(int arg);
- int arg;
- int (*post)(struct lib_context *lc, int arg);
-};
-
int handle_args(struct lib_context *lc, int argc, char ***argv);
int perform(struct lib_context *lc, char **argv);
Index: 1.0.0.rc14/tools/commands.c
===================================================================
--- 1.0.0.rc14.orig/tools/commands.c 2008-09-10 15:09:17.000000000 +0200
+++ 1.0.0.rc14/tools/commands.c 2008-09-10 15:09:39.000000000 +0200
@@ -243,7 +243,7 @@
|NATIVE_LOG
# endif
|RAID_DEVICES|RAID_SETS,
- ACTIVE|INACTIVE|COLUMN|DBG|DUMP|ERASE|GROUP|HELP|
+ ACTIVE|INACTIVE|COLUMN|DBG|DUMP|DMERASE|GROUP|HELP|
IGNORELOCKING|NOPARTITIONS|SEPARATOR|TEST|VERBOSE
#else
, UNDEF
@@ -314,7 +314,7 @@
/* Erase metadata option. */
{ 'E',
- ERASE,
+ DMERASE,
RAID_DEVICES,
COLUMN|DBG|FORMAT|HELP|IGNORELOCKING|SEPARATOR|VERBOSE,
ARGS,
@@ -381,7 +381,7 @@
{ 'r',
RAID_DEVICES,
UNDEF,
- COLUMN|DBG|DUMP|ERASE|FORMAT|HELP|IGNORELOCKING|SEPARATOR|VERBOSE,
+ COLUMN|DBG|DUMP|DMERASE|FORMAT|HELP|IGNORELOCKING|SEPARATOR|VERBOSE,
ARGS,
NULL,
0,
@@ -500,7 +500,7 @@
if ((action & (DBG|VERBOSE)) == action)
LOG_ERR(lc, 0, "More options needed with -d/-v");
- if (action & ERASE) {
+ if (action & DMERASE) {
action |= DUMP;
lc_inc_opt(lc, LC_DUMP);
}
@@ -697,7 +697,7 @@
},
/* Erase metadata. */
- { ERASE,
+ { DMERASE,
M_DEVICE|M_RAID,
ROOT,
LOCK,

View File

@ -1,40 +0,0 @@
Index: 1.0.0.rc14/lib/format/ataraid/pdc.c
===================================================================
--- 1.0.0.rc14.orig/lib/format/ataraid/pdc.c
+++ 1.0.0.rc14/lib/format/ataraid/pdc.c
@@ -155,6 +155,21 @@ static void *pdc_read_metadata(struct li
}
}
+ /* Some pdc card detect only PDC_MAX_SECTOR sectors, even
+ * if the disk is bigger, this prevents dmraid from discovering
+ * the metadata. This quirk searches for metadata at the
+ * sector PDC_MAX_SECTOR
+ */
+ if (di->sectors >= PDC_MAX_SECTOR) {
+ if (read_file(lc, handler, di->path, ret, sizeof(*ret),
+ PDC_MAX_SECTOR << 9) &&
+ !strncmp((const char*) ret->promise_id, PDC_MAGIC,
+ PDC_ID_LENGTH)) {
+ info->u32 = PDC_MAX_SECTOR;
+ return (void*) ret;
+ }
+ }
+
dbg_free(ret);
}
Index: 1.0.0.rc14/lib/format/ataraid/pdc.h
===================================================================
--- 1.0.0.rc14.orig/lib/format/ataraid/pdc.h
+++ 1.0.0.rc14/lib/format/ataraid/pdc.h
@@ -16,6 +16,9 @@
#define PDC_CONFIGOFFSETS 63,255,256,16,399,735
#define PDC_DATAOFFSET 0
+/* maximum device size (sectors) which can be detected by some pdc card */
+#define PDC_MAX_SECTOR 268435377UL
+
/* Ondisk metadata for Promise Fastrack */
struct pdc {
#define PDC_ID_LENGTH 24

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Thu Sep 25 14:49:41 CEST 2008 - mkoenig@suse.de
- update to 1.0.0rc15
* jm.c: fixed name handling
* nv.c: fixed endian bug
* added support for RAID set create/remove/rebuild and
event handling
- needed for [fate#304215,fate#303950,fate#304216]
- removed patches
dmraid-1.0.0.rc13-jm_termination.patch
dmraid-1.0.0.rc14-ddf1_segfault.patch
dmraid-add_uuid.patch
dmraid_fixup_nvidia.diff
dmraid-move-type-definition.diff
dmraid-pdc_max_sectors.patch
-------------------------------------------------------------------
Wed Sep 24 18:25:01 CEST 2008 - ro@suse.de

View File

@ -1,5 +1,5 @@
#
# spec file for package dmraid (Version 1.0.0.rc14)
# spec file for package dmraid (Version 1.0.0.rc15)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -26,8 +26,8 @@ License: GPL v2 or later
Group: System/Base
AutoReqProv: on
Summary: A Device-Mapper Software RAID Support Tool
Version: 1.0.0.rc14
Release: 96
Version: 1.0.0.rc15
Release: 1
Source: ftp://people.redhat.com/heinzm/sw/dmraid/src/dmraid-%{version}.tar.bz2
Source1: sysconfig.dmraid
Source2: boot.dmraid
@ -37,15 +37,9 @@ Source5: mkinitrd-boot.sh
Source6: libdmraid-events_DSO-1.0.0.rc4.tgz
Source7: dm_dso_reg_tool-1.0.0.rc2.tgz
Patch0: dmraid_fixup_paths3.diff
Patch1: dmraid-add_uuid.patch
Patch2: dmraid_fixup_nvidia.diff
Patch3: dmraid_duplicate_args.patch
Patch4: dmraid-1.0.0.rc13-geometry.patch
Patch5: dmraid-1.0.0.rc13-jm_termination.patch
Patch6: dmraid-1.0.0.rc13-fix_macro.patch
Patch7: dmraid-pdc_max_sectors.patch
Patch8: dmraid-1.0.0.rc14-ddf1_segfault.patch
Patch9: dmraid-move-type-definition.diff
Patch6: dmraid-1.0.0.rc15-fix_macro.patch
Patch10: dmraid-1.0.0.rc14-fixup_lsi1068e.patch
# libdmraid-events
Patch50: libdmraid-events.dif
@ -112,15 +106,9 @@ Authors:
%prep
%setup -a 6 -a 7 -n dmraid/%{version}
%patch0 -p2
%patch1 -p1
%patch2 -p2
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
pushd libdmraid*
%patch50
@ -205,6 +193,20 @@ install -D -m644 reg_tool/dm_dso_reg_tool.8 $RPM_BUILD_ROOT/usr/share/man/man8/d
/%{_lib}/libdmraid-events.so.0
%changelog
* Thu Sep 25 2008 mkoenig@suse.de
- update to 1.0.0rc15
* jm.c: fixed name handling
* nv.c: fixed endian bug
* added support for RAID set create/remove/rebuild and
event handling
- needed for [fate#304215,fate#303950,fate#304216]
- removed patches
dmraid-1.0.0.rc13-jm_termination.patch
dmraid-1.0.0.rc14-ddf1_segfault.patch
dmraid-add_uuid.patch
dmraid_fixup_nvidia.diff
dmraid-move-type-definition.diff
dmraid-pdc_max_sectors.patch
* Wed Sep 24 2008 ro@suse.de
- change "udevsettle" to "udevadm settle"
* Tue Sep 16 2008 mkoenig@suse.de

View File

@ -1,86 +0,0 @@
diff -pur dmraid/1.0.0.rc11.orig/lib/datastruct/byteorder.h dmraid/1.0.0.rc11/lib/datastruct/byteorder.h
--- dmraid/1.0.0.rc11.orig/lib/datastruct/byteorder.h 2006-05-12 14:57:41.000000000 +0200
+++ dmraid/1.0.0.rc11/lib/datastruct/byteorder.h 2006-08-10 16:12:05.000000000 +0200
@@ -18,28 +18,28 @@
static inline uint64_t le64_to_cpu(uint64_t x)
{
- return((((uint64_t)x & 0x00000000000000ffULL) << 56) |
- (((uint64_t)x & 0x000000000000ff00ULL) << 40) |
- (((uint64_t)x & 0x0000000000ff0000ULL) << 24) |
- (((uint64_t)x & 0x00000000ff000000ULL) << 8) |
- (((uint64_t)x & 0x000000ff00000000ULL) >> 8) |
- (((uint64_t)x & 0x0000ff0000000000ULL) >> 24) |
- (((uint64_t)x & 0x00ff000000000000ULL) >> 40) |
- (((uint64_t)x & 0xff00000000000000ULL) >> 56));
+ return((((uint64_t)(x) & 0x00000000000000ffULL) << 56) |
+ (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) |
+ (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) |
+ (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) |
+ (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) |
+ (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) |
+ (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) |
+ (((uint64_t)(x) & 0xff00000000000000ULL) >> 56));
}
static inline int32_t le32_to_cpu(int32_t x)
{
- return((((u_int32_t)x & 0x000000ffU) << 24) |
- (((u_int32_t)x & 0x0000ff00U) << 8) |
- (((u_int32_t)x & 0x00ff0000U) >> 8) |
- (((u_int32_t)x & 0xff000000U) >> 24));
+ return((((u_int32_t)(x) & 0x000000ffU) << 24) |
+ (((u_int32_t)(x) & 0x0000ff00U) << 8) |
+ (((u_int32_t)(x) & 0x00ff0000U) >> 8) |
+ (((u_int32_t)(x) & 0xff000000U) >> 24));
}
static inline int16_t le16_to_cpu(int16_t x)
{
- return((((u_int16_t)x & 0x00ff) << 8) |
- (((u_int16_t)x & 0xff00) >> 8));
+ return((((u_int16_t)(x) & 0x00ff) << 8) |
+ (((u_int16_t)(x) & 0xff00) >> 8));
}
#define CVT64(x) do { x = le64_to_cpu(x); } while(0)
Nur in dmraid/1.0.0.rc11/lib/datastruct: byteorder.h~.
diff -pur dmraid/1.0.0.rc11.orig/lib/format/ataraid/nv.c dmraid/1.0.0.rc11/lib/format/ataraid/nv.c
--- dmraid/1.0.0.rc11.orig/lib/format/ataraid/nv.c 2006-03-23 13:33:00.000000000 +0100
+++ dmraid/1.0.0.rc11/lib/format/ataraid/nv.c 2006-08-10 16:20:07.000000000 +0200
@@ -151,7 +151,7 @@ static int set_sort(struct list_head *po
static void to_cpu(void *meta)
{
struct nv *nv = meta;
- unsigned int i = NV_SIGNATURES;
+ unsigned int i;
struct nv_array_base *array = &nv->array;
CVT32(nv->size);
@@ -162,7 +162,7 @@ static void to_cpu(void *meta)
CVT32(nv->unitFlags);
CVT32(array->version);
- while (i--);
+ for (i = 0; i < NV_SIGNATURES; i++);
CVT32(array->signature[i]);
CVT32(array->raidLevel);
@@ -221,15 +221,9 @@ static struct raid_dev *nv_read(struct l
static int nv_write(struct lib_context *lc, struct raid_dev *rd, int erase)
{
int ret;
-#if BYTE_ORDER != LITTLE_ENDIAN
- struct nv *nv = META(rd, nv);
- to_disk(nv);
-#endif
ret = write_metadata(lc, handler, rd, -1, erase);
-#if BYTE_ORDER != LITTLE_ENDIAN
- to_cpu(nv);
-#endif
+
return ret;
}
Nur in dmraid/1.0.0.rc11/lib/format/ataraid: nv.c~.