Saturday Nov 18, 2006

two types specified in one empty declaration

So I'm in the midst of a project to put the /etc/dfs/sharetab into memory to help some minor performance concerns and to avoid the need for a setuid program for zfs when filesystem creation is delegated. I've been cutting and pasting the nfssys system call to a sharefs_sys system call. I've had my back against the wall for the past week as I build in the background of doing bug triage for the group.

I've been hitting one of two error messages:

"../../common/sharefs/sharesvc.h", line 59: invalid type combination
cc: acomp failed for ../../common/fs/sharefs/sharetab.c

or

../../common/sharefs/sharesvc.h:60: error: two types specified in one empty declaration

A web search has not helped at all. So, here is the orginal code, the bug is there by the way:

/\*
 \* Flavors of the system call.
 \*/
enum sharefs_sys_op { SHAREFS_ADD, SHAREFS_REMOVE, SHAREFS_REPLACE };

struct sharefs_args {
        struct share    \*sha_sharetab;
};

#ifdef _SYSCALL32
struct sharefs_args32 {
        caddr32_t       sha_sharetab;
}
#endif

#ifdef _KERNEL
union sharefs_sys_args {
        struct sharefs_args     \*sharefs_args_u;        /\* sharefs args \*/
};

struct sharefs_sys_a {
        enum sharefs_sys_op     opcode; /\* operation discriminator \*/
        union sharefs_sys_args  arg;    /\* syscall-specific arg pointer \*/
};

And I should mention that I am building on an i386 machine. The non-kernel part builds without complaining (which causes me problems when triaging the issue) and the kernel part always barfs on the union. To troubleshoot, since I had no frigging clue what the compiler was telling me, I added in dummy fields, I used -E to get intermediate code, etc. Nothing helped.

And then, and then, I saw that I was missing a ';' in here:

#ifdef _SYSCALL32
struct sharefs_args32 {
        caddr32_t       sha_sharetab;
}
#endif

I'm feeling old, when I taught undergrad courses, I could spot those types of bugs without the compiler. Oh well, I'm documenting this effort to help people searching on the error messages.


Technorati Tags:
Orginally posted on Kool Aid Served Daily
Copyright (C) 2006, Kool Aid Served Daily
About

tdh

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today