Safely access union smb_* members

Amin Azez azez at ufomechanic.net
Tue Oct 2 08:42:49 GMT 2007


My SMB caching code needs to "notice" reads that occur and cache the
data for satisfying future reads (with cache validation on subsequent
opens).

In the cofs backend I'm looking at cvfs_read, and of course I need to
store the offset of the read request.

Should I be writing my own accessor in interfaces.h after the manner of
SMB_OPEN_OUT_FILE, only for called SMB_READ_IN_OFFSET, or does this:

	if (io->generic.level != RAW_READ_GENERIC &&
	    private->map_generic) {
		return ntvfs_map_read(ntvfs, req, io);
	}

in cvfs_read negate the need from that. I'm still having difficulty
understanding the existance of that code block. As a potential code-path
it scares me because it misses out all the caching code. Further, as it
misses out SETUP_FILE_HERE; to fixup the file handle, I can't see how it
does anything useful?

I think I should
1. write an accessor
2. pray that that code block is never entered.

Sam


More information about the samba-technical mailing list