[PATCH 0/5] PMFS: Rebase to Linux 3.9

Ross Zwisler ross.zwisler at linux.intel.com
Mon Apr 29 15:56:35 EDT 2013

> I think these build errors were caused because kuid_t and kgid_t are now structs:
> typedef struct {
> 	uid_t val;
> } kuid_t;
> typedef struct {
> 	gid_t val;
> } kgid_t;

Sorry for the running dialog.  :)  I've been looking at this a bit more, and
it turns out that kuid_t and kgid_t are sometimes structs and sometimes raw
values, depending on whether CONFIG_UIDGID_STRICT_TYPE_CHECKS is defined.

It looks like some filesystems handle this by making their internal structures
also use kuid_t and kgid_t instead of a raw value:

struct affs_sb_info {
	int s_partition_size;		/* Partition size in blocks. */
	int s_reserved;			/* Number of reserved blocks. */
	//u32 s_blksize;			/* Initial device blksize */
	u32 s_data_blksize;		/* size of the data block w/o header */
	u32 s_root_block;		/* FFS root block number. */
	int s_hashsize;			/* Size of hash table. */
	unsigned long s_flags;		/* See below. */
	kuid_t s_uid;			/* uid to override */
	kgid_t s_gid;			/* gid to override */

So when you do this:
	inode->i_uid = sbi->s_uid;

(inode is of type struct inode*, and sbi is of type struct affs_sb_info*), you
sometimes are copying a struct, and sometimes copying a single value.

Another way to deal with this seems to just use i_uid_read(inode) type wrapper
functions.  Reiserfs seems to go this route.

For us, since we probably want to keep our struct pmfs_inode in on disk/in
memory format as __le32, we should probably just use i_uid_read() type


- Ross

More information about the Linux-pmfs mailing list