Petr Uzel wrote:
> On Sat, Mar 05, 2011 at 07:50:04PM +0100, Jim Meyering wrote:
>> Jiro SEKIBA wrote:
>>
>> > Hi,
>> >
>> > This is a new fs module to provide following:
>> > - probe nilfs2 filesystem partition
>> > - clobber nilfs2 filesystem partition
>> >
>
> .... snip ....
>
>> +
>> +#ifndef DISCOVER_ONLY
>> +static int
>> +nilfs2_clobber (PedGeometry* geom)
>> +{
>> + char buf[512];
>> + int ret[2];
>> +
>> + printf("nilfs2_clobber\n");
>
> This looks like a leftover after debugging...
Thank you for catching that.
I obviously did not review this code.
An even more serious problem: hard-coded 512-byte buffer.
That would fail for sector-size != 512.
>> + memset (buf, 0, 512);
>> +
>> + ret[0] = ped_geometry_write (geom, buf, NILFS_SB_OFFSET, 1);
>> + ret[1] = ped_geometry_write (geom, buf,
>> + NILFS_SB2_OFFSET(geom->length), 1);
>> +
>> + return ret[0]|ret[1];
>> +}
>> +#endif /* !DISCOVER_ONLY */
>> +
>> +static PedFileSystemOps nilfs2_ops = {
>> + probe: nilfs2_probe,
>> +#ifndef DISCOVER_ONLY
>> + #if 0
>> + clobber: nilfs2_clobber,
>> + #else
>> + clobber: NULL,
>> + #endif
>
> Dtto. And this causes parted not to compile with -Wall (as -Werror
> added by default):
>
> libtool: compile: gcc -std=gnu99 -I. -I../../../lib -I../../../include
> -ggdb -O0 -Wall -Werror -MT nilfs2.lo -MD -MP -MF .deps/nilfs2.Tpo -c
> nilfs2.c -o nilfs2.o
> cc1: warnings being treated as errors
> nilfs2.c:142:1: error: 'nilfs2_clobber' defined but not used
> make[4]: *** [nilfs2.lo] Error 1
That highlights the fact that the usual CFLAGS_WARN options
were not in effect for that subdirectory.
I've begun fixing things:
>From 74b4210ce1d4aee826e9373fb09d98816fcf31fe Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 7 Mar 2011 15:42:57 +0100
Subject: [PATCH 1/4] build: don't let parted_CFLAGS override our AM_CFLAGS
setting
* parted/Makefile.am (parted_CFLAGS): Remove unused (and interfering)
definition.
---
parted/Makefile.am | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/parted/Makefile.am b/parted/Makefile.am
index 5838590..7b093c6 100644
--- a/parted/Makefile.am
+++ b/parted/Makefile.am
@@ -36,9 +36,6 @@ version.h: Makefile
DISTCLEANFILES = version.c version.h
MAINTAINERCLEANFILES = $(BUILT_SOURCES)
-#parted_CFLAGS = -DBUILDINFO='"\"'$(BUILDINFO)'\""'
-parted_CFLAGS = -DBUILDINFO=
-
parted_LDADD = \
libver.a \
$(top_builddir)/libparted/libparted.la \
--
1.7.4.1.299.ga459d
>From 9eb3886a5de5de162a16bcfd06d88c9135e1dab9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 7 Mar 2011 15:44:50 +0100
Subject: [PATCH 2/4] maint: avoid shadowing warning
* parted/parted.c (do_mkpart): Rename inner added_ok to add_ok.
---
parted/parted.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/parted/parted.c b/parted/parted.c
index 9b4c1f2..18c7a30 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1041,11 +1041,11 @@ do_mkpartfs (PedDevice** dev)
ped_exception_leave_all();
PedConstraint *constraint_any = ped_constraint_any (*dev);
- bool added_ok = ped_disk_add_partition (disk, part,
+ bool add_ok = ped_disk_add_partition (disk, part,
constraint_any);
ped_constraint_destroy (constraint_any);
- if (!added_ok)
+ if (!add_ok)
goto error_remove_part;
if (!ped_geometry_test_sector_inside(range_start,
part->geom.start) ||
--
1.7.4.1.299.ga459d
>From 1004161e2475ef8adaf90bcb1f31fffcffde11c9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 7 Mar 2011 15:46:42 +0100
Subject: [PATCH 3/4] build: enable compilation warnings also for new nilfs2
subdir
* libparted/fs/nilfs2/Makefile.am (AM_CFLAGS): Define.
---
libparted/fs/nilfs2/Makefile.am | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/libparted/fs/nilfs2/Makefile.am b/libparted/fs/nilfs2/Makefile.am
index 9bb87b6..c7cfd68 100644
--- a/libparted/fs/nilfs2/Makefile.am
+++ b/libparted/fs/nilfs2/Makefile.am
@@ -1,5 +1,7 @@
partedincludedir = -I$(top_srcdir)/include
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
+
noinst_LTLIBRARIES = libnilfs2.la
libnilfs2_la_SOURCES = nilfs2.c
--
1.7.4.1.299.ga459d
>From 01b46b268ed6e7056839e87714e9622102b4b166 Mon Sep 17 00:00:00 2001
From: Petr Uzel <[email protected]>
Date: Mon, 7 Mar 2011 16:08:57 +0100
Subject: [PATCH 4/4] nilfs2: remove debug printf; remove erroneous #if 0
* libparted/fs/nilfs2/nilfs2.c (nilfs2_clobber): Remove debugging
printf.
(nilfs2_ops): Remove erroneous "#if 0" and #else block.
---
libparted/fs/nilfs2/nilfs2.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 49634c0..5802df5 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -144,7 +144,6 @@ nilfs2_clobber (PedGeometry* geom)
char buf[512];
int ret[2];
- printf("nilfs2_clobber\n");
memset (buf, 0, 512);
ret[0] = ped_geometry_write (geom, buf, NILFS_SB_OFFSET, 1);
@@ -158,11 +157,7 @@ nilfs2_clobber (PedGeometry* geom)
static PedFileSystemOps nilfs2_ops = {
probe: nilfs2_probe,
#ifndef DISCOVER_ONLY
- #if 0
clobber: nilfs2_clobber,
- #else
- clobber: NULL,
- #endif
#else
clobber: NULL,
#endif
--
1.7.4.1.299.ga459d
_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel