diff options
author | Andrew Morton <akpm@osdl.org> | 2006-03-27 04:17:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:58 -0500 |
commit | 4ee218cd67b385759993a6c840ea45f0ee0a8b30 (patch) | |
tree | 788d33b31e9d008eeb2de2a7f874e45b09695719 | |
parent | 930d332a23682202c07df0276dd665a57755b37d (diff) |
[PATCH] dm: remove SECTOR_FORMAT
We don't know what type sector_t has. Sometimes it's unsigned long, sometimes
it's unsigned long long. For example on ppc64 it's unsigned long with
CONFIG_LBD=n and on x86_64 it's unsigned long long with CONFIG_LBD=n.
The way to handle all of this is to always use unsigned long long and to
always typecast the sector_t when printing it.
Acked-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/md/dm-crypt.c | 11 | ||||
-rw-r--r-- | drivers/md/dm-linear.c | 8 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 15 | ||||
-rw-r--r-- | drivers/md/dm-snap.c | 11 | ||||
-rw-r--r-- | drivers/md/dm-stripe.c | 11 | ||||
-rw-r--r-- | drivers/md/dm.h | 10 |
6 files changed, 32 insertions, 34 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 259e86f26549..61a590bb6241 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -518,6 +518,7 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
518 | char *ivopts; | 518 | char *ivopts; |
519 | unsigned int crypto_flags; | 519 | unsigned int crypto_flags; |
520 | unsigned int key_size; | 520 | unsigned int key_size; |
521 | unsigned long long tmpll; | ||
521 | 522 | ||
522 | if (argc != 5) { | 523 | if (argc != 5) { |
523 | ti->error = PFX "Not enough arguments"; | 524 | ti->error = PFX "Not enough arguments"; |
@@ -633,15 +634,17 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
633 | goto bad5; | 634 | goto bad5; |
634 | } | 635 | } |
635 | 636 | ||
636 | if (sscanf(argv[2], SECTOR_FORMAT, &cc->iv_offset) != 1) { | 637 | if (sscanf(argv[2], "%llu", &tmpll) != 1) { |
637 | ti->error = PFX "Invalid iv_offset sector"; | 638 | ti->error = PFX "Invalid iv_offset sector"; |
638 | goto bad5; | 639 | goto bad5; |
639 | } | 640 | } |
641 | cc->iv_offset = tmpll; | ||
640 | 642 | ||
641 | if (sscanf(argv[4], SECTOR_FORMAT, &cc->start) != 1) { | 643 | if (sscanf(argv[4], "%llu", &tmpll) != 1) { |
642 | ti->error = PFX "Invalid device sector"; | 644 | ti->error = PFX "Invalid device sector"; |
643 | goto bad5; | 645 | goto bad5; |
644 | } | 646 | } |
647 | cc->start = tmpll; | ||
645 | 648 | ||
646 | if (dm_get_device(ti, argv[3], cc->start, ti->len, | 649 | if (dm_get_device(ti, argv[3], cc->start, ti->len, |
647 | dm_table_get_mode(ti->table), &cc->dev)) { | 650 | dm_table_get_mode(ti->table), &cc->dev)) { |
@@ -885,8 +888,8 @@ static int crypt_status(struct dm_target *ti, status_type_t type, | |||
885 | result[sz++] = '-'; | 888 | result[sz++] = '-'; |
886 | } | 889 | } |
887 | 890 | ||
888 | DMEMIT(" " SECTOR_FORMAT " %s " SECTOR_FORMAT, | 891 | DMEMIT(" %llu %s %llu", (unsigned long long)cc->iv_offset, |
889 | cc->iv_offset, cc->dev->name, cc->start); | 892 | cc->dev->name, (unsigned long long)cc->start); |
890 | break; | 893 | break; |
891 | } | 894 | } |
892 | return 0; | 895 | return 0; |
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 6a2cd5dc8a63..daf586c0898d 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c | |||
@@ -26,6 +26,7 @@ struct linear_c { | |||
26 | static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) | 26 | static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) |
27 | { | 27 | { |
28 | struct linear_c *lc; | 28 | struct linear_c *lc; |
29 | unsigned long long tmp; | ||
29 | 30 | ||
30 | if (argc != 2) { | 31 | if (argc != 2) { |
31 | ti->error = "dm-linear: Invalid argument count"; | 32 | ti->error = "dm-linear: Invalid argument count"; |
@@ -38,10 +39,11 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
38 | return -ENOMEM; | 39 | return -ENOMEM; |
39 | } | 40 | } |
40 | 41 | ||
41 | if (sscanf(argv[1], SECTOR_FORMAT, &lc->start) != 1) { | 42 | if (sscanf(argv[1], "%llu", &tmp) != 1) { |
42 | ti->error = "dm-linear: Invalid device sector"; | 43 | ti->error = "dm-linear: Invalid device sector"; |
43 | goto bad; | 44 | goto bad; |
44 | } | 45 | } |
46 | lc->start = tmp; | ||
45 | 47 | ||
46 | if (dm_get_device(ti, argv[0], lc->start, ti->len, | 48 | if (dm_get_device(ti, argv[0], lc->start, ti->len, |
47 | dm_table_get_mode(ti->table), &lc->dev)) { | 49 | dm_table_get_mode(ti->table), &lc->dev)) { |
@@ -87,8 +89,8 @@ static int linear_status(struct dm_target *ti, status_type_t type, | |||
87 | break; | 89 | break; |
88 | 90 | ||
89 | case STATUSTYPE_TABLE: | 91 | case STATUSTYPE_TABLE: |
90 | snprintf(result, maxlen, "%s " SECTOR_FORMAT, lc->dev->name, | 92 | snprintf(result, maxlen, "%s %llu", lc->dev->name, |
91 | lc->start); | 93 | (unsigned long long)lc->start); |
92 | break; | 94 | break; |
93 | } | 95 | } |
94 | return 0; | 96 | return 0; |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 3d90f1b37e08..d12cf3e5e076 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -934,9 +934,9 @@ static inline int _check_region_size(struct dm_target *ti, uint32_t size) | |||
934 | static int get_mirror(struct mirror_set *ms, struct dm_target *ti, | 934 | static int get_mirror(struct mirror_set *ms, struct dm_target *ti, |
935 | unsigned int mirror, char **argv) | 935 | unsigned int mirror, char **argv) |
936 | { | 936 | { |
937 | sector_t offset; | 937 | unsigned long long offset; |
938 | 938 | ||
939 | if (sscanf(argv[1], SECTOR_FORMAT, &offset) != 1) { | 939 | if (sscanf(argv[1], "%llu", &offset) != 1) { |
940 | ti->error = "dm-mirror: Invalid offset"; | 940 | ti->error = "dm-mirror: Invalid offset"; |
941 | return -EINVAL; | 941 | return -EINVAL; |
942 | } | 942 | } |
@@ -1203,16 +1203,17 @@ static int mirror_status(struct dm_target *ti, status_type_t type, | |||
1203 | for (m = 0; m < ms->nr_mirrors; m++) | 1203 | for (m = 0; m < ms->nr_mirrors; m++) |
1204 | DMEMIT("%s ", ms->mirror[m].dev->name); | 1204 | DMEMIT("%s ", ms->mirror[m].dev->name); |
1205 | 1205 | ||
1206 | DMEMIT(SECTOR_FORMAT "/" SECTOR_FORMAT, | 1206 | DMEMIT("%llu/%llu", |
1207 | ms->rh.log->type->get_sync_count(ms->rh.log), | 1207 | (unsigned long long)ms->rh.log->type-> |
1208 | ms->nr_regions); | 1208 | get_sync_count(ms->rh.log), |
1209 | (unsigned long long)ms->nr_regions); | ||
1209 | break; | 1210 | break; |
1210 | 1211 | ||
1211 | case STATUSTYPE_TABLE: | 1212 | case STATUSTYPE_TABLE: |
1212 | DMEMIT("%d ", ms->nr_mirrors); | 1213 | DMEMIT("%d ", ms->nr_mirrors); |
1213 | for (m = 0; m < ms->nr_mirrors; m++) | 1214 | for (m = 0; m < ms->nr_mirrors; m++) |
1214 | DMEMIT("%s " SECTOR_FORMAT " ", | 1215 | DMEMIT("%s %llu ", ms->mirror[m].dev->name, |
1215 | ms->mirror[m].dev->name, ms->mirror[m].offset); | 1216 | (unsigned long long)ms->mirror[m].offset); |
1216 | } | 1217 | } |
1217 | 1218 | ||
1218 | return 0; | 1219 | return 0; |
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 14bd1a1815b1..a5765f9fbe02 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -959,9 +959,9 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
959 | snap->store.fraction_full(&snap->store, | 959 | snap->store.fraction_full(&snap->store, |
960 | &numerator, | 960 | &numerator, |
961 | &denominator); | 961 | &denominator); |
962 | snprintf(result, maxlen, | 962 | snprintf(result, maxlen, "%llu/%llu", |
963 | SECTOR_FORMAT "/" SECTOR_FORMAT, | 963 | (unsigned long long)numerator, |
964 | numerator, denominator); | 964 | (unsigned long long)denominator); |
965 | } | 965 | } |
966 | else | 966 | else |
967 | snprintf(result, maxlen, "Unknown"); | 967 | snprintf(result, maxlen, "Unknown"); |
@@ -974,9 +974,10 @@ static int snapshot_status(struct dm_target *ti, status_type_t type, | |||
974 | * to make private copies if the output is to | 974 | * to make private copies if the output is to |
975 | * make sense. | 975 | * make sense. |
976 | */ | 976 | */ |
977 | snprintf(result, maxlen, "%s %s %c " SECTOR_FORMAT, | 977 | snprintf(result, maxlen, "%s %s %c %llu", |
978 | snap->origin->name, snap->cow->name, | 978 | snap->origin->name, snap->cow->name, |
979 | snap->type, snap->chunk_size); | 979 | snap->type, |
980 | (unsigned long long)snap->chunk_size); | ||
980 | break; | 981 | break; |
981 | } | 982 | } |
982 | 983 | ||
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 697aacafb02a..204f796ee9e3 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -49,9 +49,9 @@ static inline struct stripe_c *alloc_context(unsigned int stripes) | |||
49 | static int get_stripe(struct dm_target *ti, struct stripe_c *sc, | 49 | static int get_stripe(struct dm_target *ti, struct stripe_c *sc, |
50 | unsigned int stripe, char **argv) | 50 | unsigned int stripe, char **argv) |
51 | { | 51 | { |
52 | sector_t start; | 52 | unsigned long long start; |
53 | 53 | ||
54 | if (sscanf(argv[1], SECTOR_FORMAT, &start) != 1) | 54 | if (sscanf(argv[1], "%llu", &start) != 1) |
55 | return -EINVAL; | 55 | return -EINVAL; |
56 | 56 | ||
57 | if (dm_get_device(ti, argv[0], start, sc->stripe_width, | 57 | if (dm_get_device(ti, argv[0], start, sc->stripe_width, |
@@ -201,10 +201,11 @@ static int stripe_status(struct dm_target *ti, | |||
201 | break; | 201 | break; |
202 | 202 | ||
203 | case STATUSTYPE_TABLE: | 203 | case STATUSTYPE_TABLE: |
204 | DMEMIT("%d " SECTOR_FORMAT, sc->stripes, sc->chunk_mask + 1); | 204 | DMEMIT("%d %llu", sc->stripes, |
205 | (unsigned long long)sc->chunk_mask + 1); | ||
205 | for (i = 0; i < sc->stripes; i++) | 206 | for (i = 0; i < sc->stripes; i++) |
206 | DMEMIT(" %s " SECTOR_FORMAT, sc->stripe[i].dev->name, | 207 | DMEMIT(" %s %llu", sc->stripe[i].dev->name, |
207 | sc->stripe[i].physical_start); | 208 | (unsigned long long)sc->stripe[i].physical_start); |
208 | break; | 209 | break; |
209 | } | 210 | } |
210 | return 0; | 211 | return 0; |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 4eaf075da217..0ff11d6f8158 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -23,16 +23,6 @@ | |||
23 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ | 23 | #define DMEMIT(x...) sz += ((sz >= maxlen) ? \ |
24 | 0 : scnprintf(result + sz, maxlen - sz, x)) | 24 | 0 : scnprintf(result + sz, maxlen - sz, x)) |
25 | 25 | ||
26 | /* | ||
27 | * FIXME: I think this should be with the definition of sector_t | ||
28 | * in types.h. | ||
29 | */ | ||
30 | #ifdef CONFIG_LBD | ||
31 | #define SECTOR_FORMAT "%llu" | ||
32 | #else | ||
33 | #define SECTOR_FORMAT "%lu" | ||
34 | #endif | ||
35 | |||
36 | #define SECTOR_SHIFT 9 | 26 | #define SECTOR_SHIFT 9 |
37 | 27 | ||
38 | /* | 28 | /* |