diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | ReadMe.c | 2 | ||||
-rw-r--r-- | bitmap.c | 4 | ||||
-rw-r--r-- | inventory | 1 | ||||
-rwxr-xr-x | makedist | 15 | ||||
-rw-r--r-- | mdadm.8 | 8 | ||||
-rw-r--r-- | mdadm.c | 11 | ||||
-rw-r--r-- | mdadm.h | 14 | ||||
-rw-r--r-- | mdadm.spec | 2 | ||||
-rw-r--r-- | mdassemble.8 | 2 | ||||
-rw-r--r-- | mdopen.c | 15 | ||||
-rw-r--r-- | super0.c | 7 | ||||
-rw-r--r-- | super1.c | 22 |
14 files changed, 86 insertions, 30 deletions
@@ -1,4 +1,12 @@ -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: @@ -137,5 +137,8 @@ clean : dist : clean ./makedist +testdist : everything clean + ./makedist test + TAGS : etags *.h *.c @@ -30,7 +30,7 @@ #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 @@ -21,7 +21,6 @@ #include <sys/types.h> #include <sys/stat.h> #include "mdadm.h" -#include <asm/byteorder.h> #define min(a,b) (((a) < (b)) ? (a) : (b)) @@ -357,7 +356,8 @@ int CreateBitmap(char *filename, int force, char uuid[16], 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) @@ -3,6 +3,7 @@ ANNOUNCE-2.0 ANNOUNCE-2.1 ANNOUNCE-2.2 ANNOUNCE-2.3 +ANNOUNCE-2.3.1 Assemble.c Build.c COPYING @@ -1,6 +1,12 @@ #!/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 @@ -48,13 +54,16 @@ then 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 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH MDADM 8 "" v2.3 +.TH MDADM 8 "" v2.3.1 .SH NAME mdadm \- manage MD devices .I aka @@ -249,6 +249,12 @@ The file .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 @@ -772,8 +772,15 @@ int main(int argc, char *argv[]) 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): @@ -71,6 +71,20 @@ char *strncpy(char *dest, const char *src, size_t n) __THROW; #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; @@ -1,6 +1,6 @@ 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/ diff --git a/mdassemble.8 b/mdassemble.8 index da888c5..f2aea68 100644 --- a/mdassemble.8 +++ b/mdassemble.8 @@ -1,5 +1,5 @@ .\" -*- nroff -*- -.TH MDASSEMBLE 8 "" v2.3 +.TH MDASSEMBLE 8 "" v2.3.1 .SH NAME mdassemble \- assemble MD devices .I aka @@ -64,9 +64,12 @@ void make_parts(char *dev, int cnt) } 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); } @@ -205,8 +208,10 @@ int open_mddev(char *dev, int autof) 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); @@ -28,7 +28,6 @@ */ #include "mdadm.h" -#include <asm/byteorder.h> /* * All handling for the 0.90.0 version superblock is in @@ -124,7 +123,7 @@ static void examine_super0(void *sbv) 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) @@ -807,7 +806,9 @@ int write_bitmap0(struct supertype *st, int fd, void *sbv) 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) { @@ -28,8 +28,6 @@ */ #include "mdadm.h" -#include <endian.h> -#include "asm/byteorder.h" /* * The version-1 superblock : * All numeric fields are little-endian. @@ -198,7 +196,7 @@ static void examine_super1(void *sbv) (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)); @@ -1019,17 +1017,19 @@ add_internal_bitmap1(struct supertype *st, void *sbv, 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); } @@ -1045,7 +1045,9 @@ int write_bitmap1(struct supertype *st, int fd, void *sbv) 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)); |