mount.cifs - "Const" warnings patch

Matthias Dieter Wallnöfer mdw at
Sat Nov 7 08:45:45 MST 2009

Hi Jeff!

Yeah, please apply! My mission of this patch(set) was to prevent "CONST" warnings. Your solution does it in a very elegant manner (I would have only introduced another discard-const macro - which is far from perfect). Therefore it should be perfectly okay!

Thanks for working with me on the CONST issue.


--- Jeff Layton <jlayton at> schrieb am Sa, 7.11.2009:

Von: Jeff Layton <jlayton at>
Betreff: Re: mount.cifs - "Const" warnings patch
An: "Matthias Dieter Wallnöfer" <mdw at>
CC: "Samba Technical Mailinglist" <samba-technical at>
Datum: Samstag, 7. November 2009, 14:19

On Mon, 02 Nov 2009 21:36:19 +0100
Matthias Dieter Wallnöfer <mdw at> wrote:

> Hi Jeff,
> sorry, sorry - sometimes I forget the attachments.
> Now it should be okay.

No problem, I do the same thing sometimes.

The patch looks safe enough, but I wonder whether the problem is really
in addmntent. Looking at a recent glibc, it doesn't look like addmntent
ever changes any of the strings it gets passed. If any of them need to
be reencoded, it uses alloca to get a new buffer and reencodes the
string into that. Maybe the prototype for it should declare the struct
as const.

Fixing it there though may be problematic. Assuming that not stripping
off the const generates a warning, maybe it would be a little more
clear to just declare a non-const variable to hold a "cifs" string and
pass that in instead. Something like this maybe?

Jeff Layton <jlayton at>


More information about the samba-technical mailing list