The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/bsd/sys/fsevents.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
    5  * 
    6  * This file contains Original Code and/or Modifications of Original Code
    7  * as defined in and that are subject to the Apple Public Source License
    8  * Version 2.0 (the 'License'). You may not use this file except in
    9  * compliance with the License. The rights granted to you under the License
   10  * may not be used to create, or enable the creation or redistribution of,
   11  * unlawful or unlicensed copies of an Apple operating system, or to
   12  * circumvent, violate, or enable the circumvention or violation of, any
   13  * terms of an Apple operating system software license agreement.
   14  * 
   15  * Please obtain a copy of the License at
   16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
   17  * 
   18  * The Original Code and all software distributed under the License are
   19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   23  * Please see the License for the specific language governing rights and
   24  * limitations under the License.
   25  * 
   26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
   27  */
   28 #ifndef FSEVENT_H
   29 #define FSEVENT_H 1
   30 
   31 // Event types that you can ask to listen for
   32 #define FSE_INVALID             -1
   33 #define FSE_CREATE_FILE          0
   34 #define FSE_DELETE               1
   35 #define FSE_STAT_CHANGED         2
   36 #define FSE_RENAME               3
   37 #define FSE_CONTENT_MODIFIED     4
   38 #define FSE_EXCHANGE             5
   39 #define FSE_FINDER_INFO_CHANGED  6
   40 #define FSE_CREATE_DIR           7
   41 #define FSE_CHOWN                8
   42 #define FSE_XATTR_MODIFIED       9
   43 #define FSE_XATTR_REMOVED       10
   44 
   45 #define FSE_MAX_EVENTS          11
   46 #define FSE_ALL_EVENTS         998
   47 
   48 #define FSE_EVENTS_DROPPED     999
   49 
   50 //
   51 // These defines only apply if you've asked for extended
   52 // type info.  In that case the type field's low 12-bits
   53 // contain the basic types defined above and the top 4
   54 // bits contain flags that indicate if an event had other
   55 // events combined with it or if it represents a directory
   56 // that has dropped events below it.
   57 //
   58 #define FSE_TYPE_MASK          0x0fff
   59 #define FSE_FLAG_MASK          0xf000
   60 #define FSE_FLAG_SHIFT         12
   61 #define FSE_GET_FLAGS(type)    (((type) >> 12) & 0x000f)
   62 
   63 #define FSE_COMBINED_EVENTS          0x0001
   64 #define FSE_CONTAINS_DROPPED_EVENTS  0x0002
   65 
   66 
   67 // Actions for each event type
   68 #define FSE_IGNORE    0
   69 #define FSE_REPORT    1
   70 #define FSE_ASK       2    // Not implemented yet
   71 
   72 // The types of each of the arguments for an event
   73 // Each type is followed by the size and then the
   74 // data.  FSE_ARG_VNODE is just a path string
   75 #define FSE_ARG_VNODE    0x0001   // next arg is a vnode pointer
   76 #define FSE_ARG_STRING   0x0002   // next arg is length followed by string ptr
   77 #define FSE_ARG_PATH     0x0003   // next arg is a full path
   78 #define FSE_ARG_INT32    0x0004   // next arg is a 32-bit int
   79 #define FSE_ARG_INT64    0x0005   // next arg is a 64-bit int
   80 #define FSE_ARG_RAW      0x0006   // next arg is a length followed by a void ptr
   81 #define FSE_ARG_INO      0x0007   // next arg is the inode number (ino_t)
   82 #define FSE_ARG_UID      0x0008   // next arg is the file's uid (uid_t)
   83 #define FSE_ARG_DEV      0x0009   // next arg is the file's dev_t
   84 #define FSE_ARG_MODE     0x000a   // next arg is the file's mode (as an int32, file type only)
   85 #define FSE_ARG_GID      0x000b   // next arg is the file's gid (gid_t)
   86 #define FSE_ARG_FINFO    0x000c   // next arg is a packed finfo (dev, ino, mode, uid, gid)
   87 #define FSE_ARG_DONE     0xb33f   // no more arguments
   88 
   89 #define FSE_MAX_ARGS     12
   90 
   91 //
   92 // These are special bits that be set in the 32-bit mode
   93 // field that /dev/fsevents provides.
   94 //
   95 #define FSE_MODE_HLINK         (1 << 31)    // notification is for a hard-link
   96 #define FSE_MODE_LAST_HLINK    (1 << 30)    // link count == 0 on a hard-link delete 
   97 #define FSE_REMOTE_DIR_EVENT   (1 << 29)    // this is a remotely generated directory-level granularity event
   98 #define FSE_TRUNCATED_PATH     (1 << 28)    // the path for this item had to be truncated
   99 
  100 // ioctl's on /dev/fsevents
  101 #if __LP64__
  102 typedef struct fsevent_clone_args {
  103     int8_t  *event_list;
  104     int32_t  num_events;
  105     int32_t  event_queue_depth;
  106     int32_t *fd;
  107 } fsevent_clone_args;
  108 #else
  109 typedef struct fsevent_clone_args {
  110     int8_t  *event_list;
  111     int32_t  pad1;
  112     int32_t  num_events;
  113     int32_t  event_queue_depth;
  114     int32_t *fd;
  115     int32_t  pad2;
  116 } fsevent_clone_args;
  117 #endif
  118 
  119 #define FSEVENTS_CLONE          _IOW('s', 1, fsevent_clone_args)
  120 
  121 
  122 // ioctl's on the cloned fd
  123 #if __LP64__
  124 #pragma pack(push, 4)
  125 typedef struct fsevent_dev_filter_args {
  126     uint32_t  num_devices;
  127     dev_t    *devices;
  128 } fsevent_dev_filter_args;
  129 #pragma pack(pop)
  130 #else
  131 typedef struct fsevent_dev_filter_args {
  132     uint32_t  num_devices;
  133     dev_t    *devices;
  134     int32_t   pad1;
  135 } fsevent_dev_filter_args;
  136 #endif
  137 
  138 #define FSEVENTS_DEVICE_FILTER          _IOW('s', 100, fsevent_dev_filter_args)
  139 #define FSEVENTS_WANT_COMPACT_EVENTS    _IO('s', 101)
  140 #define FSEVENTS_WANT_EXTENDED_INFO     _IO('s', 102)
  141 #define FSEVENTS_GET_CURRENT_ID         _IOR('s', 103, uint64_t)
  142 
  143 
  144 #ifdef KERNEL
  145 
  146 void fsevents_init(void);
  147 int  need_fsevent(int type, vnode_t vp);
  148 int  add_fsevent(int type, vfs_context_t, ...);
  149 void fsevent_unmount(struct mount *mp);
  150 struct vnode_attr;
  151 void create_fsevent_from_kevent(vnode_t vp, uint32_t kevents, struct vnode_attr *vap);
  152 
  153 // misc utility functions for fsevent info and pathbuffers...
  154 typedef struct fse_info {
  155     ino64_t    ino;
  156     dev_t      dev;
  157     int32_t    mode;   // note: this is not a mode_t (it's 32-bits, not 16)
  158     uid_t      uid;
  159     gid_t      gid;
  160     uint64_t   nlink;  // only filled in if the vnode is marked as a hardlink
  161 } fse_info;
  162 
  163 int   get_fse_info(struct vnode *vp, fse_info *fse, vfs_context_t ctx);
  164 int   vnode_get_fse_info_from_vap(vnode_t vp, fse_info *fse, struct vnode_attr *vap);
  165 
  166 char *get_pathbuff(void);
  167 void  release_pathbuff(char *path);
  168 
  169 #endif /* KERNEL */
  170 
  171 #endif /* FSEVENT_H */

Cache object: 279488d0c66a5154b1261399ace01a69


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.