Date: Sat, 22 Mar 2008 18:05:53 +0000 (GMT) From: Robert Watson <rwatson@FreeBSD.org> To: =?UTF-8?B?VsOhY2xhdiBIYWlzbWFu?= <V.Haisman@sh.cvut.cz> Cc: freebsd-fs@freebsd.org Subject: Re: Indication of extended attributes availability. Message-ID: <20080322180253.B27442@fledge.watson.org> In-Reply-To: <47E43496.5080201@sh.cvut.cz> References: <47E43496.5080201@sh.cvut.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --621616949-1182643006-1206209153=:27442 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Fri, 21 Mar 2008, V=E1clav Haisman wrote: > 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()= =20 > 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= =20 > try something else? I think the preferred programmatic approach is actually via fpathconf(2). = I=20 don't know if any other OS's have assigned a _PC constant for extended=20 attributes, but if they have we should probably use the same one. However,= I=20 guess there's a meta-question: is your goal to allow programs to be able to= =20 tell if extended attributes are available, or for administrators to be able= to=20 tell? Robert N M Watson Computer Laboratory University of Cambridge > > > --- ./sys/mount.h~=092007-04-10 12:12:44.000000000 +0200 > +++ ./sys/mount.h=092008-03-21 22:48:04.436630277 +0100 > @@ -218,7 +218,6 @@ void __mnt_vnode_markerfree(str > #define=09MNT_SYNCHRONOUS=090x00000002=09/* filesystem written=20 > synchronously */ > #define=09MNT_NOEXEC=090x00000004=09/* can't exec from filesystem=20 > */ > #define=09MNT_NOSUID=090x00000008=09/* don't honor setuid bits on=20 > fs */ > -#define=09MNT_NODEV=090=09=09/* Deprecated option */ > #define=09MNT_UNION=090x00000020=09/* union with underlying=20 > filesystem */ > #define=09MNT_ASYNC=090x00000040=09/* filesystem written=20 > asynchronously */ > #define=09MNT_SUIDDIR=090x00100000=09/* special handling of SUID=20 > 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= =20 > set) > */ > +#define MNT_EXTATTR=090x00000010=09/* filesystem with extended=20 > attributes */ > #define=09MNT_LOCAL=090x00001000=09/* filesystem is stored=20 > locally */ > #define=09MNT_QUOTA=090x00002000=09/* quotas are enabled on=20 > filesystem */ > #define=09MNT_ROOTFS=090x00004000=09/* identifies the root=20 > filesystem */ > @@ -265,7 +265,8 @@ void __mnt_vnode_markerfree(str > =09=09=09MNT_ROOTFS=09| MNT_NOATIME=09| MNT_NOCLUSTERR| \ > =09=09=09MNT_NOCLUSTERW=09| MNT_SUIDDIR=09| MNT_SOFTDEP=09| \ > =09=09=09MNT_IGNORE=09| MNT_EXPUBLIC=09| MNT_NOSYMFOLLOW | \ > -=09=09=09MNT_JAILDEVFS=09| MNT_MULTILABEL | MNT_ACLS) > +=09=09=09MNT_JAILDEVFS=09| MNT_MULTILABEL | MNT_ACLS | \ > +=09=09=09MNT_EXTATTR) > > /* Mask of flags that can be updated. */ > #define=09MNT_UPDATEMASK (MNT_NOSUID=09| MNT_NOEXEC=09| \ > --- ./ufs/ufs/ufs_extattr.c~=092006-03-13 04:08:08.000000000 +0100 > +++ ./ufs/ufs/ufs_extattr.c=092008-03-21 22:59:50.766939565 +0100 > @@ -220,6 +220,10 @@ ufs_extattr_start(struct mount *mp, stru > > =09ump->um_extattr.uepm_ucred =3D crhold(td->td_ucred); > > +=09MNT_ILOCK(mp); > +=09mp->f_flags |=3D MNT_EXTATTR; > +=09MNT_IUNLOCK(mp); > + > unlock: > =09ufs_extattr_uepm_unlock(ump, td); > > @@ -549,6 +553,10 @@ ufs_extattr_stop(struct mount *mp, struc > =09=09 uele->uele_attrname, td); > =09} > > +=09MNT_ILOCK(mp); > +=09mp->f_flags &=3D ~MNT_EXTATTR; > +=09MNT_IUNLOCK(mp); > + > =09ump->um_extattr.uepm_flags &=3D ~UFS_EXTATTR_UEPM_STARTED; > > =09crfree(ump->um_extattr.uepm_ucred); > > -- > VH > > --621616949-1182643006-1206209153=:27442--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080322180253.B27442>