Print this page
3484 enhance and document tail follow support
Reviewed by: Joshua M. Clulow <jmc@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/portfs/port_fop.c
          +++ new/usr/src/uts/common/fs/portfs/port_fop.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
       26 +/*
       27 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
       28 + */
  26   29  
  27   30  /*
  28   31   * File Events Notification
  29   32   * ------------------------
  30   33   *
  31   34   * The File Events Notification facility provides file and directory change
  32   35   * notification. It is implemented as an event source(PORT_SOURCE_FILE)
  33   36   * under the Event Ports framework. Therefore the API is an extension to
  34   37   * the Event Ports API.
  35   38   *
↓ open down ↓ 1922 lines elided ↑ open up ↑
1958 1961           */
1959 1962          if (op & FOP_MODIFIED_MASK) {
1960 1963                  event  = FILE_MODIFIED;
1961 1964          }
1962 1965          if (op & FOP_ACCESS_MASK) {
1963 1966                  event  |= FILE_ACCESS;
1964 1967          }
1965 1968          if (op & FOP_ATTRIB_MASK) {
1966 1969                  event  |= FILE_ATTRIB;
1967 1970          }
1968      -
     1971 +        if (op & FOP_TRUNC_MASK) {
     1972 +                event  |= FILE_TRUNC;
     1973 +        }
1969 1974          if (event) {
1970 1975                  port_fop_sendevent(vp,  event, NULL, NULL);
1971 1976          }
1972 1977  }
1973 1978  
1974 1979  static int port_forceunmount(vfs_t *vfsp)
1975 1980  {
1976 1981          char *fsname = vfssw[vfsp->vfs_fstype].vsw_name;
1977 1982  
1978 1983          if (fsname == NULL) {
↓ open down ↓ 161 lines elided ↑ open up ↑
2140 2145   */
2141 2146  int
2142 2147  port_fop_setattr(femarg_t *vf, vattr_t *vap, int flags, cred_t *cr,
2143 2148      caller_context_t *ct)
2144 2149  {
2145 2150          int             retval;
2146 2151          vnode_t         *vp = (vnode_t *)vf->fa_fnode->fn_available;
2147 2152          int             events = 0;
2148 2153  
2149 2154          retval = vnext_setattr(vf, vap, flags, cr, ct);
     2155 +        if (vap->va_mask & AT_SIZE) {
     2156 +                events |= FOP_FILE_TRUNC;
     2157 +        }
2150 2158          if (vap->va_mask & (AT_SIZE|AT_MTIME)) {
2151 2159                  events |= FOP_FILE_SETATTR_MTIME;
2152 2160          }
2153 2161          if (vap->va_mask & AT_ATIME) {
2154 2162                  events |= FOP_FILE_SETATTR_ATIME;
2155 2163          }
2156 2164          events |= FOP_FILE_SETATTR_CTIME;
2157 2165  
2158 2166          port_fop(vp, events, retval);
2159 2167          return (retval);
↓ open down ↓ 155 lines elided ↑ open up ↑
2315 2323          case    VE_RENAME_DEST:
2316 2324                          port_fop_sendevent(vp, FILE_RENAME_TO, dvp, name);
2317 2325                  break;
2318 2326          case    VE_REMOVE:
2319 2327                          port_fop_sendevent(vp, FILE_DELETE, dvp, name);
2320 2328                  break;
2321 2329          case    VE_RMDIR:
2322 2330                          port_fop_sendevent(vp, FILE_DELETE, dvp, name);
2323 2331                  break;
2324 2332          case    VE_CREATE:
2325      -                        port_fop_sendevent(vp, FILE_MODIFIED|FILE_ATTRIB,
2326      -                            NULL, NULL);
     2333 +                        port_fop_sendevent(vp,
     2334 +                            FILE_MODIFIED|FILE_ATTRIB|FILE_TRUNC, NULL, NULL);
2327 2335                  break;
2328 2336          case    VE_LINK:
2329 2337                          port_fop_sendevent(vp, FILE_ATTRIB, NULL, NULL);
2330 2338                  break;
2331 2339  
2332 2340          case    VE_RENAME_DEST_DIR:
2333 2341                          port_fop_sendevent(vp, FILE_MODIFIED|FILE_ATTRIB,
2334 2342                              NULL, NULL);
2335 2343                  break;
2336 2344  
2337 2345          case    VE_MOUNTEDOVER:
2338 2346                          port_fop_sendevent(vp, MOUNTEDOVER, NULL, NULL);
2339 2347                  break;
2340 2348          default:
2341 2349                  break;
2342 2350          }
2343 2351          return (vnext_vnevent(vf, vnevent, dvp, name, ct));
2344 2352  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX