-Changes Prior to this release
+Changes Prior to 2.3.1 release
+ - Fixed -O2 compile so I could make and RPM.
+ - Type cast number to be printed %llu so it compiles on 64bit
+ machines. (Thanks Luca).
+ - Stop using asm/byteorder.h - to make Redhat happy :-(
+ - Require bitmap files to have a '/' in their name.
+ - Error-check a few syscalls - code from SuSE package.
+
+Changes Prior to 2.3 release
- Try /etc/mdadm/mdadm.conf if /etc/mdadm.conf doesn't exist.
This provided compatability for Debian.
- Fixed for version-1 superblock:
dist : clean
./makedist
+testdist : everything clean
+ ./makedist test
+
TAGS :
etags *.h *.c
#include "mdadm.h"
-char Version[] = Name " - v2.3 - 2 February 2006\n";
+char Version[] = Name " - v2.3.1 - 6 February 2006\n";
/*
* File: ReadMe.c
#include <sys/types.h>
#include <sys/stat.h>
#include "mdadm.h"
-#include <asm/byteorder.h>
#define min(a,b) (((a) < (b)) ? (a) : (b))
rv = 0;
/* make the file be the right size (well, to the nearest byte) */
- ftruncate(fileno(fp), filesize);
+ if (ftruncate(fileno(fp), filesize))
+ perror("ftrunace");
out:
fclose(fp);
if (rv)
ANNOUNCE-2.1
ANNOUNCE-2.2
ANNOUNCE-2.3
+ANNOUNCE-2.3.1
Assemble.c
Build.c
COPYING
#!/bin/sh
arg=$1
target=~/public_html/source/mdadm
+if [ " $arg" = " test" ]
+then
+ target=/tmp/mdadm-test
+ rm -rf $target
+ mkdir -p $target
+fi
if [ -d $target ]
then :
else echo $target is not a directory
rm $target/$base
exit 1
fi
- rpmbuild -ta $target/$base
+ rpmbuild -ta $target/$base || exit 1
find /home/neilb/src/RPM -name "*mdadm-$version-*" \
-exec cp {} $target/RPM \;
cp ANNOUNCE-$version $target/ANNOUNCE
cp ChangeLog $target/ChangeLog
- scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
- scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
+ if [ " $arg" != " test" ]
+ then
+ scp $target/$base master.kernel.org:/pub/linux/utils/raid/mdadm/mdadm-$version.tar.gz
+ scp $target/ANNOUNCE $target/ChangeLog master.kernel.org:/pub/linux/utils/raid/mdadm/
+ fi
else
if [ ! -f $target/$base ]
then
.\" -*- nroff -*-
-.TH MDADM 8 "" v2.3
+.TH MDADM 8 "" v2.3.1
.SH NAME
mdadm \- manage MD devices
.I aka
.B none
can be given when used with --grow to remove a bitmap.
+To help catch typing errors, the filename must contain at least one
+slash ('/') if it is a real file (not 'internal' or 'none').
+
+Note: bitmaps are only known to work on ext2 and ext3. Using other
+filesystems may result in serious problems.
+
.TP
.BR --bitmap-chunk=
Set the Chunksize of the bitmap. Each bit corresponds to that many
case O(GROW,'b'):
case O(BUILD,'b'):
case O(CREATE,'b'): /* here we create the bitmap */
- bitmap_file = optarg;
- continue;
+ if (strcmp(optarg, "internal")== 0 ||
+ strcmp(optarg, "none")== 0 ||
+ strchr(optarg, '/') != NULL) {
+ bitmap_file = optarg;
+ continue;
+ }
+ /* probable typo */
+ fprintf(stderr, Name ": bitmap file must contain a '/', or be 'internal', or 'none'\n");
+ exit(2);
case O(GROW,4):
case O(BUILD,4):
#include "md_p.h"
#include "bitmap.h"
+#include <endian.h>
+/* #include "asm/byteorder.h" Redhat don't like this so... */
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# include <linux/byteorder/little_endian.h>
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# include <linux/byteorder/big_endian.h>
+#elif __BYTE_ORDER == __PDP_ENDIAN
+# include <linux/byteorder/pdp_endian.h>
+#else
+# error "unknown endianness."
+#endif
+
+
+
/* general information that might be extracted from a superblock */
struct mdinfo {
mdu_array_info_t array;
Summary: mdadm is used for controlling Linux md devices (aka RAID arrays)
Name: mdadm
-Version: 2.3
+Version: 2.3.1
Release: 1
Source: http://www.cse.unsw.edu.au/~neilb/source/mdadm/mdadm-%{version}.tgz
URL: http://www.cse.unsw.edu.au/~neilb/source/mdadm/
.\" -*- nroff -*-
-.TH MDASSEMBLE 8 "" v2.3
+.TH MDASSEMBLE 8 "" v2.3.1
.SH NAME
mdassemble \- assemble MD devices
.I aka
} else {
stb2 = stb;
}
- mknod(name, S_IFBLK | 0600, makedev(major, minor+i));
- chown(name, stb2.st_uid, stb2.st_gid);
- chmod(name, stb2.st_mode & 07777);
+ if (mknod(name, S_IFBLK | 0600, makedev(major, minor+i)))
+ perror("mknod");
+ if (chown(name, stb2.st_uid, stb2.st_gid))
+ perror("chown");
+ if (chmod(name, stb2.st_mode & 07777))
+ perror("chmod");
stat(name, &stb2);
add_dev(name, &stb2, 0, NULL);
}
return -1;
}
if (must_remove) {
- chown(dev, stb.st_uid, stb.st_gid);
- chmod(dev, stb.st_mode & 07777);
+ if (chown(dev, stb.st_uid, stb.st_gid))
+ perror("chown");
+ if (chmod(dev, stb.st_mode & 07777))
+ perror("chmod");
}
stat(dev, &stb);
add_dev(dev, &stb, 0, NULL);
*/
#include "mdadm.h"
-#include <asm/byteorder.h>
/*
* All handling for the 0.90.0 version superblock is in
printf("Preferred Minor : %d\n", sb->md_minor);
printf("\n");
if (sb->minor_version > 90 && (sb->reshape_position+1) != 0) {
- printf(" Reshape pos'n : %llu%s\n", sb->reshape_position/2, human_size((long long)sb->reshape_position<<9));
+ printf(" Reshape pos'n : %llu%s\n", (unsigned long long)sb->reshape_position/2, human_size((long long)sb->reshape_position<<9));
if (sb->delta_disks) {
printf(" Delta Devices : %d", sb->delta_disks);
if (sb->delta_disks)
return 3;
- write(fd, ((char*)sb)+MD_SB_BYTES, sizeof(bitmap_super_t));
+ if (write(fd, ((char*)sb)+MD_SB_BYTES, sizeof(bitmap_super_t)) !=
+ sizeof(bitmap_super_t))
+ return -2;
towrite = 64*1024 - MD_SB_BYTES - sizeof(bitmap_super_t);
memset(buf, 0xff, sizeof(buf));
while (towrite > 0) {
*/
#include "mdadm.h"
-#include <endian.h>
-#include "asm/byteorder.h"
/*
* The version-1 superblock :
* All numeric fields are little-endian.
(long)__le32_to_cpu(sb->bitmap_offset));
}
if (sb->feature_map & __le32_to_cpu(MD_FEATURE_RESHAPE_ACTIVE)) {
- printf(" Reshape pos'n : %llu%s\n", __le64_to_cpu(sb->reshape_position)/2,
+ printf(" Reshape pos'n : %llu%s\n", (unsigned long long)__le64_to_cpu(sb->reshape_position)/2,
human_size(__le64_to_cpu(sb->reshape_position)<<9));
if (__le32_to_cpu(sb->delta_disks)) {
printf(" Delta Devices : %d", __le32_to_cpu(sb->delta_disks));
void locate_bitmap1(struct supertype *st, int fd, void *sbv)
{
unsigned long long offset;
- struct mdp_superblock_1 *sb = NULL;
+ struct mdp_superblock_1 *sb;
+ int mustfree = 0;
- if (sbv)
- sb = sbv;
- else
- if (st->ss->load_super(st, fd, (void **)&sb, NULL))
+ if (!sbv) {
+ if (st->ss->load_super(st, fd, &sbv, NULL))
return; /* no error I hope... */
+ mustfree = 1;
+ }
+ sb = sbv;
offset = __le64_to_cpu(sb->super_offset);
offset += (long) __le32_to_cpu(sb->bitmap_offset);
- if (!sbv)
+ if (mustfree)
free(sb);
lseek64(fd, offset<<9, 0);
}
locate_bitmap1(st, fd, sbv);
- write(fd, ((char*)sb)+1024, sizeof(bitmap_super_t));
+ if (write(fd, ((char*)sb)+1024, sizeof(bitmap_super_t)) !=
+ sizeof(bitmap_super_t))
+ return -2;
towrite = __le64_to_cpu(bms->sync_size) / (__le32_to_cpu(bms->chunksize)>>9);
towrite = (towrite+7) >> 3; /* bits to bytes */
memset(buf, 0xff, sizeof(buf));