Print this page
OS-4043 tmpfs should support gigabyte sizes
OS-4044 tmpfs should support "mode" option
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.
  23  * All rights reserved.  Use is subject to license terms.
  24  */



  25 
  26 #ifndef _SYS_FS_TMP_H
  27 #define _SYS_FS_TMP_H
  28 
  29 #pragma ident   "%Z%%M% %I%     %E% SMI"
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 /*
  36  * tmpfs per-mount data structure.
  37  *
  38  * All fields are protected by tm_contents.
  39  * File renames on a particular file system are protected tm_renamelck.
  40  */
  41 struct tmount {
  42         struct vfs      *tm_vfsp;       /* filesystem's vfs struct */
  43         struct tmpnode  *tm_rootnode;   /* root tmpnode */
  44         char            *tm_mntpath;    /* name of tmpfs mount point */
  45         ulong_t         tm_anonmax;     /* file system max anon reservation */
  46         pgcnt_t         tm_anonmem;     /* pages of reserved anon memory */
  47         dev_t           tm_dev;         /* unique dev # of mounted `device' */
  48         uint_t          tm_gen;         /* pseudo generation number for files */
  49         kmutex_t        tm_contents;    /* lock for tmount structure */
  50         kmutex_t        tm_renamelck;   /* rename lock for this mount */


  91 extern size_t   tmp_kmemspace;
  92 extern size_t   tmpfs_maxkmem;  /* Allocatable kernel memory in bytes */
  93 
  94 extern  void    tmpnode_init(struct tmount *, struct tmpnode *,
  95         struct vattr *, struct cred *);
  96 extern  int     tmpnode_trunc(struct tmount *, struct tmpnode *, ulong_t);
  97 extern  void    tmpnode_growmap(struct tmpnode *, ulong_t);
  98 extern  int     tdirlookup(struct tmpnode *, char *, struct tmpnode **,
  99     struct cred *);
 100 extern  int     tdirdelete(struct tmpnode *, struct tmpnode *, char *,
 101         enum dr_op, struct cred *);
 102 extern  void    tdirinit(struct tmpnode *, struct tmpnode *);
 103 extern  void    tdirtrunc(struct tmpnode *);
 104 extern  void    *tmp_memalloc(size_t, int);
 105 extern  void    tmp_memfree(void *, size_t);
 106 extern  int     tmp_resv(struct tmount *, struct tmpnode *, size_t, int);
 107 extern  int     tmp_taccess(void *, int, struct cred *);
 108 extern  int     tmp_sticky_remove_access(struct tmpnode *, struct tmpnode *,
 109         struct cred *);
 110 extern  int     tmp_convnum(char *, pgcnt_t *);

 111 extern  int     tdirenter(struct tmount *, struct tmpnode *, char *,
 112         enum de_op, struct tmpnode *, struct tmpnode *, struct vattr *,
 113         struct tmpnode **, struct cred *, caller_context_t *);
 114 
 115 #define TMP_MUSTHAVE    0x01
 116 
 117 #ifdef  __cplusplus
 118 }
 119 #endif
 120 
 121 #endif  /* _SYS_FS_TMP_H */


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2007 Sun Microsystems, Inc.
  23  * All rights reserved.  Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2015 Joyent, Inc.
  27  */
  28 
  29 #ifndef _SYS_FS_TMP_H
  30 #define _SYS_FS_TMP_H
  31 


  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /*
  37  * tmpfs per-mount data structure.
  38  *
  39  * All fields are protected by tm_contents.
  40  * File renames on a particular file system are protected tm_renamelck.
  41  */
  42 struct tmount {
  43         struct vfs      *tm_vfsp;       /* filesystem's vfs struct */
  44         struct tmpnode  *tm_rootnode;   /* root tmpnode */
  45         char            *tm_mntpath;    /* name of tmpfs mount point */
  46         ulong_t         tm_anonmax;     /* file system max anon reservation */
  47         pgcnt_t         tm_anonmem;     /* pages of reserved anon memory */
  48         dev_t           tm_dev;         /* unique dev # of mounted `device' */
  49         uint_t          tm_gen;         /* pseudo generation number for files */
  50         kmutex_t        tm_contents;    /* lock for tmount structure */
  51         kmutex_t        tm_renamelck;   /* rename lock for this mount */


  92 extern size_t   tmp_kmemspace;
  93 extern size_t   tmpfs_maxkmem;  /* Allocatable kernel memory in bytes */
  94 
  95 extern  void    tmpnode_init(struct tmount *, struct tmpnode *,
  96         struct vattr *, struct cred *);
  97 extern  int     tmpnode_trunc(struct tmount *, struct tmpnode *, ulong_t);
  98 extern  void    tmpnode_growmap(struct tmpnode *, ulong_t);
  99 extern  int     tdirlookup(struct tmpnode *, char *, struct tmpnode **,
 100     struct cred *);
 101 extern  int     tdirdelete(struct tmpnode *, struct tmpnode *, char *,
 102         enum dr_op, struct cred *);
 103 extern  void    tdirinit(struct tmpnode *, struct tmpnode *);
 104 extern  void    tdirtrunc(struct tmpnode *);
 105 extern  void    *tmp_memalloc(size_t, int);
 106 extern  void    tmp_memfree(void *, size_t);
 107 extern  int     tmp_resv(struct tmount *, struct tmpnode *, size_t, int);
 108 extern  int     tmp_taccess(void *, int, struct cred *);
 109 extern  int     tmp_sticky_remove_access(struct tmpnode *, struct tmpnode *,
 110         struct cred *);
 111 extern  int     tmp_convnum(char *, pgcnt_t *);
 112 extern  int     tmp_convmode(char *, mode_t *);
 113 extern  int     tdirenter(struct tmount *, struct tmpnode *, char *,
 114         enum de_op, struct tmpnode *, struct tmpnode *, struct vattr *,
 115         struct tmpnode **, struct cred *, caller_context_t *);
 116 
 117 #define TMP_MUSTHAVE    0x01
 118 
 119 #ifdef  __cplusplus
 120 }
 121 #endif
 122 
 123 #endif  /* _SYS_FS_TMP_H */