lkml.org 
[lkml]   [2001]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRE: uid_t and gid_t vs. __kernel_uid_t and __kernel_gid_t
Vassilii:

> I am trying to understand what's the cleanest coding that would allow
> 1) user code to just use uid/gid for interfacing the driver control
> structures
> 2) driver code to read/write the corresponding structure fields with minimum
> awareness of the actual difference between kernel and user uid_t/gid_t
> layout.

Just define a structure like:

struct user-to-kernel {
unsigned int uid;
unsigned int gid;
...
}

and copy the header into your user space program. The alignments may
differ between different Linux architectures, but that won't matter.
You aren't going to be running a program compiled on a sparc on an i386
anyway...

If you are writing a filesystem or sending data over the network directly
via the kernel (without going through the user space program), then you
will need to decide upon a fixed byte order and alignment. (but this
doesn't seem to be the case for you, right?)

-Chris
wingc@engin.umich.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:53    [W:0.040 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site