Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Mar 2008 23:20:06 +0100
From:      =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= <V.Haisman@sh.cvut.cz>
To:        freebsd-fs@freebsd.org
Subject:   Indication of extended attributes availability.
Message-ID:  <47E43496.5080201@sh.cvut.cz>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigF74110CD873584BE0BE507C2
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

Hi,
I would like to have some sort of indication of extended attributes=20
availability for given FS. It seems that things like this (MAC, ACLs etc.=
)=20
are indicated using mount flags and those are available through statfs() =

call. The following is tentative patch that would expose extended attribu=
tes=20
availability as mount flag. It is completely untested. I would just like =
to=20
know if it is a viable approach to the problem or should I scratch it and=
 try=20
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 fl=
ag 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 =3D crhold(td->td_ucred);

+	MNT_ILOCK(mp);
+	mp->f_flags |=3D 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 &=3D ~MNT_EXTATTR;
+	MNT_IUNLOCK(mp);
+
  	ump->um_extattr.uepm_flags &=3D ~UFS_EXTATTR_UEPM_STARTED;

  	crfree(ump->um_extattr.uepm_ucred);

--
VH


--------------enigF74110CD873584BE0BE507C2
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH5DSfoUFWwtEPkHIRCAEFAJ4uLX92ZBGnGvEw0laJw3Pc09PxlgCeM1RF
T+Vv3VW0ngwqaYTxq3T2NVc=
=uVTE
-----END PGP SIGNATURE-----

--------------enigF74110CD873584BE0BE507C2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?47E43496.5080201>