Indication of extended attributes availability.

Václav Haisman V.Haisman at sh.cvut.cz
Fri Mar 21 22:20:57 UTC 2008


Hi,
I would like to have some sort of indication of extended attributes 
availability for given FS. It seems that things like this (MAC, ACLs etc.) 
are indicated using mount flags and those are available through statfs() 
call. The following is tentative patch that would expose extended attributes 
availability as mount flag. It is completely untested. I would just like to 
know if it is a viable approach to the problem or should I scratch it and try 
something else?


--- ./sys/mount.h~	2007-04-10 12:12:44.000000000 +0200
+++ ./sys/mount.h	2008-03-21 22:48:04.436630277 +0100
@@ -218,7 +218,6 @@ void          __mnt_vnode_markerfree(str
  #define	MNT_SYNCHRONOUS	0x00000002	/* filesystem written synchronously */
  #define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
  #define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
-#define	MNT_NODEV	0		/* Deprecated option */
  #define	MNT_UNION	0x00000020	/* union with underlying filesystem */
  #define	MNT_ASYNC	0x00000040	/* filesystem written asynchronously */
  #define	MNT_SUIDDIR	0x00100000	/* special handling of SUID on dirs */
@@ -246,6 +245,7 @@ void          __mnt_vnode_markerfree(str
   * but visible to the user.
   * XXX some of these are not quite right.. (I've never seen the root flag set)
   */
+#define MNT_EXTATTR	0x00000010	/* filesystem with extended attributes */
  #define	MNT_LOCAL	0x00001000	/* filesystem is stored locally */
  #define	MNT_QUOTA	0x00002000	/* quotas are enabled on filesystem */
  #define	MNT_ROOTFS	0x00004000	/* identifies the root filesystem */
@@ -265,7 +265,8 @@ void          __mnt_vnode_markerfree(str
  			MNT_ROOTFS	| MNT_NOATIME	| MNT_NOCLUSTERR| \
  			MNT_NOCLUSTERW	| MNT_SUIDDIR	| MNT_SOFTDEP	| \
  			MNT_IGNORE	| MNT_EXPUBLIC	| MNT_NOSYMFOLLOW | \
-			MNT_JAILDEVFS	| MNT_MULTILABEL | MNT_ACLS)
+			MNT_JAILDEVFS	| MNT_MULTILABEL | MNT_ACLS     | \
+			MNT_EXTATTR)

  /* Mask of flags that can be updated. */
  #define	MNT_UPDATEMASK (MNT_NOSUID	| MNT_NOEXEC	| \
--- ./ufs/ufs/ufs_extattr.c~	2006-03-13 04:08:08.000000000 +0100
+++ ./ufs/ufs/ufs_extattr.c	2008-03-21 22:59:50.766939565 +0100
@@ -220,6 +220,10 @@ ufs_extattr_start(struct mount *mp, stru

  	ump->um_extattr.uepm_ucred = crhold(td->td_ucred);

+	MNT_ILOCK(mp);
+	mp->f_flags |= MNT_EXTATTR;
+	MNT_IUNLOCK(mp);
+
  unlock:
  	ufs_extattr_uepm_unlock(ump, td);

@@ -549,6 +553,10 @@ ufs_extattr_stop(struct mount *mp, struc
  		    uele->uele_attrname, td);
  	}

+	MNT_ILOCK(mp);
+	mp->f_flags &= ~MNT_EXTATTR;
+	MNT_IUNLOCK(mp);
+
  	ump->um_extattr.uepm_flags &= ~UFS_EXTATTR_UEPM_STARTED;

  	crfree(ump->um_extattr.uepm_ucred);

--
VH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20080321/7b64c056/signature.pgp


More information about the freebsd-fs mailing list