From: bmarzins@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: multipath-tools/kpartx dasd.c
Date: 4 Jan 2007 19:03:28 -0000 [thread overview]
Message-ID: <20070104190328.14354.qmail@sourceware.org> (raw)
CVSROOT: /cvs/dm
Module name: multipath-tools
Branch: RHEL5_FC6
Changes by: bmarzins@sourceware.org 2007-01-04 19:03:28
Modified files:
kpartx : dasd.c
Log message:
Add Stefan Bader's dasd partition fix.
Note: with the dasd partition fix, it may be necessary to remake the file
system on the device, because the superblock may no longer be at the same
location in the partition.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/kpartx/dasd.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.1&r2=1.1.4.1
--- multipath-tools/kpartx/dasd.c 2006/06/06 18:46:38 1.1
+++ multipath-tools/kpartx/dasd.c 2007/01/04 19:03:28 1.1.4.1
@@ -40,14 +40,20 @@
#include "byteorder.h"
#include "dasd.h"
+unsigned long sectors512(unsigned long sectors, int blocksize)
+{
+ return sectors * (blocksize >> 9);
+}
+
/*
*/
int
read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
{
int retval = -1;
- int blocksize, offset, size;
+ int blocksize;
long disksize;
+ unsigned long offset, size;
dasd_information_t info;
struct hd_geometry geo;
char type[5] = {0,};
@@ -172,13 +178,13 @@
/* disk is reserved minidisk */
blocksize = label[3];
offset = label[13];
- size = (label[7] - 1)*(blocksize >> 9);
+ size = sectors512(label[7] - 1, blocksize);
} else {
- offset = (info.label_block + 1) * (blocksize >> 9);
- size = disksize - offset;
+ offset = info.label_block + 1;
+ size = disksize;
}
- sp[0].start = offset * (blocksize >> 9);
- sp[0].size = size - offset * (blocksize >> 9);
+ sp[0].start = sectors512(offset, blocksize);
+ sp[0].size = size - sp[0].start;
retval = 1;
} else if ((strncmp(type, "VOL1", 4) == 0) &&
(!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) {
@@ -214,8 +220,8 @@
offset = cchh2blk(&f1.DS1EXT1.llimit, &geo);
size = cchh2blk(&f1.DS1EXT1.ulimit, &geo) -
offset + geo.sectors;
- sp[counter].start = offset * (blocksize >> 9);
- sp[counter].size = size * (blocksize >> 9);
+ sp[counter].start = sectors512(offset, blocksize);
+ sp[counter].size = sectors512(size, blocksize);
counter++;
blk++;
}
@@ -224,10 +230,8 @@
/*
* Old style LNX1 or unlabeled disk
*/
- offset = (info.label_block + 1) * (blocksize >> 9);
- size = disksize - offset;
- sp[0].start = offset * (blocksize >> 9);
- sp[0].size = size - offset * (blocksize >> 9);
+ sp[0].start = sectors512(info.label_block + 1, blocksize);
+ sp[0].size = disksize - sp[0].start;
retval = 1;
}
reply other threads:[~2007-01-04 19:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070104190328.14354.qmail@sourceware.org \
--to=bmarzins@sourceware.org \
--cc=dm-cvs@sourceware.org \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.