svn commit: r230252 - head/sys/fs/tmpfs

Mikolaj Golub trociny at freebsd.org
Sat Apr 14 16:07:03 UTC 2012


On Fri, 13 Apr 2012 09:11:39 +0300 Jaakko Heinonen wrote:

 JH> On 2012-01-23, Mikolaj Golub wrote:
 >> I see two issues with this patch:

 JH> What do you think about this patch?

I think it is much better than we have currently :-).

 JH> %%%
 JH> Index: sys/fs/tmpfs/tmpfs.h
 JH> ===================================================================
 JH> --- sys/fs/tmpfs/tmpfs.h        (revision 234201)
 JH> +++ sys/fs/tmpfs/tmpfs.h        (working copy)
 JH> @@ -387,6 +387,9 @@ struct tmpfs_mount {
 JH>           * tmpfs_pool.c. */
 JH>          uma_zone_t                tm_dirent_pool;
 JH>          uma_zone_t                tm_node_pool;
 JH> +
 JH> +        /* Read-only status. */
 JH> +        int                        tm_ronly;
 JH>  };
 JH>  #define TMPFS_LOCK(tm) mtx_lock(&(tm)->allnode_lock)
 JH>  #define TMPFS_UNLOCK(tm) mtx_unlock(&(tm)->allnode_lock)
 JH> Index: sys/fs/tmpfs/tmpfs_vfsops.c
 JH> ===================================================================
 JH> --- sys/fs/tmpfs/tmpfs_vfsops.c        (revision 234201)
 JH> +++ sys/fs/tmpfs/tmpfs_vfsops.c        (working copy)
 JH> @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
 JH>          NULL
 JH>  };
 JH>  
 JH> +static const char *tmpfs_updateopts[] = {
 JH> +        "from", "export", NULL
 JH> +};
 JH> +
 JH>  /* --------------------------------------------------------------------- */
 JH>  
 JH>  static int
 JH> @@ -150,12 +154,13 @@ tmpfs_mount(struct mount *mp)
 JH>                  return (EINVAL);
 JH>  
 JH>          if (mp->mnt_flag & MNT_UPDATE) {
 JH> -                /*
 JH> -                 * Only support update mounts for NFS export.
 JH> -                 */
 JH> -                if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
 JH> -                        return (0);
 JH> -                return (EOPNOTSUPP);
 JH> +                /* Only support update mounts for certain options. */
 JH> +                if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
 JH> +                        return (EOPNOTSUPP);
 JH> +                if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) != 
 JH> +                    ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly)
 JH> +                        return (EOPNOTSUPP);
 JH> +                return (0);
 JH>          }
 JH>  
 JH>          vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
 JH> @@ -228,6 +233,7 @@ tmpfs_mount(struct mount *mp)
 JH>              tmpfs_node_ctor, tmpfs_node_dtor,
 JH>              tmpfs_node_init, tmpfs_node_fini,
 JH>              UMA_ALIGN_PTR, 0);
 JH> +        tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
 JH>  
 JH>          /* Allocate the root node. */
 JH>          error = tmpfs_alloc_node(tmp, VDIR, root_uid,
 JH> %%%

 JH> -- 
 JH> Jaakko

-- 
Mikolaj Golub


More information about the svn-src-head mailing list