Print this page
remove support for non-ANSI compilation


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


  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_FS_CACHEFS_DIR_H
  28 #define _SYS_FS_CACHEFS_DIR_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include <sys/types.h>
  33 #include <sys/fs/cachefs_fs.h>
  34 
  35 #ifdef __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 /*
  40  * c_dirent is stored on disk, so it needs to be the same 32-bit vs. 64-bit.
  41  */
  42 
  43 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
  44 #pragma pack(4)
  45 #endif
  46 
  47 struct c_dirent {
  48         uint_t          d_length;       /* entry length */
  49         uint_t          d_flag;         /* entry flags */
  50         cfs_cid_t       d_id;           /* file id */
  51         offset_t        d_offset;       /* disk offset of this entry */


  54         char            d_name[1];      /* name */
  55 };
  56 
  57 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
  58 #pragma pack()
  59 #endif
  60 
  61 #define C_DIRSIZ(dp) \
  62         (((dp)->d_namelen + (uint_t)sizeof (struct c_dirent) + 7) & ~7)
  63 
  64 #define CDE_SIZE(NM) \
  65         ((strlen(NM) + sizeof (struct c_dirent) + 7) & ~7)
  66 
  67 /*
  68  * Various flags stored in c_dirent flag field.
  69  */
  70 #define CDE_VALID       0x1             /* entry is valid */
  71 #define CDE_COMPLETE    0x2             /* entry is complete */
  72 
  73 
  74 #if defined(_KERNEL) && defined(__STDC__)
  75 int cachefs_dir_look(cnode_t *dcp, char *nm, fid_t *cookiep, uint_t *flagp,
  76     u_offset_t *d_offsetp, cfs_cid_t *cidp);
  77 int cachefs_dir_new(cnode_t *dcp, cnode_t *cp);
  78 int cachefs_dir_enter(cnode_t *dcp, char *nm, fid_t *cookiep, cfs_cid_t *cidp,
  79     int issync);
  80 int cachefs_dir_rmentry(cnode_t *dcp, char *nm);
  81 void cachefs_dir_modentry(cnode_t *dcp, u_offset_t offset, fid_t *cookiep,
  82     cfs_cid_t *cidp);
  83 int cachefs_dir_read(struct cnode *dcp, struct uio *uiop, int *eofp);
  84 int cachefs_dir_fill(cnode_t *dcp, cred_t *cr);
  85 int cachefs_dir_empty(cnode_t *dcp);
  86 int cachefs_async_populate_dir(struct cachefs_populate_req *, cred_t *,
  87     vnode_t *, vnode_t *);
  88 
  89 #endif /* defined(_KERNEL) && defined(__STDC__) */
  90 
  91 #ifdef __cplusplus
  92 }
  93 #endif
  94 
  95 #endif /* _SYS_FS_CACHEFS_DIR_H */


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


  32 #include <sys/types.h>
  33 #include <sys/fs/cachefs_fs.h>
  34 
  35 #ifdef __cplusplus
  36 extern "C" {
  37 #endif
  38 
  39 /*
  40  * c_dirent is stored on disk, so it needs to be the same 32-bit vs. 64-bit.
  41  */
  42 
  43 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
  44 #pragma pack(4)
  45 #endif
  46 
  47 struct c_dirent {
  48         uint_t          d_length;       /* entry length */
  49         uint_t          d_flag;         /* entry flags */
  50         cfs_cid_t       d_id;           /* file id */
  51         offset_t        d_offset;       /* disk offset of this entry */


  54         char            d_name[1];      /* name */
  55 };
  56 
  57 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
  58 #pragma pack()
  59 #endif
  60 
  61 #define C_DIRSIZ(dp) \
  62         (((dp)->d_namelen + (uint_t)sizeof (struct c_dirent) + 7) & ~7)
  63 
  64 #define CDE_SIZE(NM) \
  65         ((strlen(NM) + sizeof (struct c_dirent) + 7) & ~7)
  66 
  67 /*
  68  * Various flags stored in c_dirent flag field.
  69  */
  70 #define CDE_VALID       0x1             /* entry is valid */
  71 #define CDE_COMPLETE    0x2             /* entry is complete */
  72 
  73 
  74 #if defined(_KERNEL)
  75 int cachefs_dir_look(cnode_t *dcp, char *nm, fid_t *cookiep, uint_t *flagp,
  76     u_offset_t *d_offsetp, cfs_cid_t *cidp);
  77 int cachefs_dir_new(cnode_t *dcp, cnode_t *cp);
  78 int cachefs_dir_enter(cnode_t *dcp, char *nm, fid_t *cookiep, cfs_cid_t *cidp,
  79     int issync);
  80 int cachefs_dir_rmentry(cnode_t *dcp, char *nm);
  81 void cachefs_dir_modentry(cnode_t *dcp, u_offset_t offset, fid_t *cookiep,
  82     cfs_cid_t *cidp);
  83 int cachefs_dir_read(struct cnode *dcp, struct uio *uiop, int *eofp);
  84 int cachefs_dir_fill(cnode_t *dcp, cred_t *cr);
  85 int cachefs_dir_empty(cnode_t *dcp);
  86 int cachefs_async_populate_dir(struct cachefs_populate_req *, cred_t *,
  87     vnode_t *, vnode_t *);
  88 
  89 #endif /* defined(_KERNEL) */
  90 
  91 #ifdef __cplusplus
  92 }
  93 #endif
  94 
  95 #endif /* _SYS_FS_CACHEFS_DIR_H */