Re: 2.6.1-mm2: compilation error

From: Trond Myklebust
Date: Sat Jan 10 2004 - 11:15:50 EST


På lau , 10/01/2004 klokka 10:46, skreiv Milan Jurik:
> Hi,
>
> CC fs/nfs/nfs4proc.o
> fs/nfs/nfs4proc.c: In function `nfs4_lck_type':
> fs/nfs/nfs4proc.c:2042: warning: control reaches end of non-void function
> fs/nfs/nfs4proc.c: In function `nfs4_proc_setlk':
> fs/nfs/nfs4proc.c:2189: unknown field `clientid' specified in initializer
> fs/nfs/nfs4proc.c:2189: warning: missing braces around initializer
> fs/nfs/nfs4proc.c:2189: warning: (near initialization for
> `otl.lock_owner')
> make[3]: *** [fs/nfs/nfs4proc.o] Error 1
> make[2]: *** [fs/nfs] Error 2
> make[1]: *** [fs] Error 2
> make[1]: Leaving directory `/usr/src/linux-2.6.1'
> make: *** [stamp-build] Error 2

No need. I'm surprised I don't see that first warning in my own
compiles.

The second one, however appears to be a compiler bug: AFAICS
concatenating C99 designated intializers in that manner is supported by
the spec (and indeed my version of gcc is quite happy with it). No
matter, though, as we can work around it.

Does the following patch work for you?

Cheers,
Trond

--- linux-2.6.1-mm2/fs/nfs/nfs4proc.c.orig 2004-01-10 10:56:17.000000000 -0500
+++ linux-2.6.1-mm2/fs/nfs/nfs4proc.c 2004-01-10 11:10:11.000000000 -0500
@@ -2039,6 +2039,7 @@ nfs4_lck_type(int cmd, struct file_lock
return NFS4_WRITE_LT;
}
BUG();
+ return 0;
}

static inline uint64_t
@@ -2186,7 +2187,9 @@ nfs4_proc_setlk(struct nfs4_state *state
if (lsp == NULL) {
struct nfs4_state_owner *owner = state->owner;
struct nfs_open_to_lock otl = {
- .lock_owner.clientid = server->nfs4_state->cl_clientid,
+ .lock_owner = {
+ .clientid = server->nfs4_state->cl_clientid,
+ },
};
status = -ENOMEM;
lsp = nfs4_alloc_lock_state(state, request->fl_owner);