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
On Fri, 21 Mar 2008, Václav Haisman wrote: > 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? I think the preferred programmatic approach is actually via fpathconf(2). I don't know if any other OS's have assigned a _PC constant for extended attributes, but if they have we should probably use the same one. However, I guess there's a meta-question: is your goal to allow programs to be able to tell if extended attributes are available, or for administrators to be able to tell? Robert N M Watson Computer Laboratory University of Cambridge > > > --- ./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 > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080322180253.B27442>
