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/sys/alq.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) 2002, Jeffrey Roberson <jeff@freebsd.org>
    3  * Copyright (c) 2008-2009, Lawrence Stewart <lstewart@freebsd.org>
    4  * Copyright (c) 2010, The FreeBSD Foundation
    5  * All rights reserved.
    6  *
    7  * Portions of this software were developed at the Centre for Advanced
    8  * Internet Architectures, Swinburne University of Technology, Melbourne,
    9  * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice unmodified, this list of conditions, and the following
   16  *    disclaimer.
   17  * 2. Redistributions in binary form must reproduce the above copyright
   18  *    notice, this list of conditions and the following disclaimer in the
   19  *    documentation and/or other materials provided with the distribution.
   20  *
   21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   24  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   26  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   30  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   31  *
   32  * $FreeBSD: releng/10.2/sys/sys/alq.h 207223 2010-04-26 13:48:22Z lstewart $
   33  *
   34  */
   35 #ifndef _SYS_ALQ_H_
   36 #define _SYS_ALQ_H_
   37 
   38 /*
   39  * Opaque type for the Async. Logging Queue
   40  */
   41 struct alq;
   42 
   43 /* The thread for the logging daemon */
   44 extern struct thread *ald_thread;
   45 
   46 /*
   47  * Async. Logging Entry
   48  */
   49 struct ale {
   50         intptr_t        ae_bytesused;   /* # bytes written to ALE. */
   51         char            *ae_data;       /* Write ptr. */
   52         int             ae_pad;         /* Unused, compat. */
   53 };
   54 
   55 /* Flag options. */
   56 #define ALQ_NOWAIT      0x0001  /* ALQ may not sleep. */
   57 #define ALQ_WAITOK      0x0002  /* ALQ may sleep. */
   58 #define ALQ_NOACTIVATE  0x0004  /* Don't activate ALQ after write. */
   59 #define ALQ_ORDERED     0x0010  /* Maintain write ordering between threads. */
   60 
   61 /* Suggested mode for file creation. */
   62 #define ALQ_DEFAULT_CMODE       0600
   63 
   64 /*
   65  * alq_open_flags:  Creates a new queue
   66  *
   67  * Arguments:
   68  *      alq     Storage for a pointer to the newly created queue.
   69  *      file    The filename to open for logging.
   70  *      cred    Credential to authorize open and I/O with.
   71  *      cmode   Creation mode for file, if new.
   72  *      size    The size of the queue in bytes.
   73  *      flags   ALQ_ORDERED
   74  * Returns:
   75  *      error from open or 0 on success
   76  */
   77 struct ucred;
   78 int alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
   79             int size, int flags);
   80 int alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode,
   81             int size, int count);
   82 
   83 /*
   84  * alq_writen:  Write data into the queue
   85  *
   86  * Arguments:
   87  *      alq     The queue we're writing to
   88  *      data    The entry to be recorded
   89  *      len     The number of bytes to write from *data
   90  *      flags   (ALQ_NOWAIT || ALQ_WAITOK), ALQ_NOACTIVATE
   91  *
   92  * Returns:
   93  *      EWOULDBLOCK if:
   94  *              Waitok is ALQ_NOWAIT and the queue is full.
   95  *              The system is shutting down.
   96  *      0 on success.
   97  */
   98 int alq_writen(struct alq *alq, void *data, int len, int flags);
   99 int alq_write(struct alq *alq, void *data, int flags);
  100 
  101 /*
  102  * alq_flush:  Flush the queue out to disk
  103  */
  104 void alq_flush(struct alq *alq);
  105 
  106 /*
  107  * alq_close:  Flush the queue and free all resources.
  108  */
  109 void alq_close(struct alq *alq);
  110 
  111 /*
  112  * alq_getn:  Return an entry for direct access
  113  *
  114  * Arguments:
  115  *      alq     The queue to retrieve an entry from
  116  *      len     Max number of bytes required
  117  *      flags   (ALQ_NOWAIT || ALQ_WAITOK)
  118  *
  119  * Returns:
  120  *      The next available ale on success.
  121  *      NULL if:
  122  *              flags is ALQ_NOWAIT and the queue is full.
  123  *              The system is shutting down.
  124  *
  125  * This leaves the queue locked until a subsequent alq_post.
  126  */
  127 struct ale *alq_getn(struct alq *alq, int len, int flags);
  128 struct ale *alq_get(struct alq *alq, int flags);
  129 
  130 /*
  131  * alq_post_flags:  Schedule the ale retrieved by alq_get/alq_getn for writing.
  132  *      alq     The queue to post the entry to.
  133  *      ale     An asynch logging entry returned by alq_get.
  134  *      flags   ALQ_NOACTIVATE
  135  */
  136 void alq_post_flags(struct alq *alq, struct ale *ale, int flags);
  137 
  138 static __inline void
  139 alq_post(struct alq *alq, struct ale *ale)
  140 {
  141         alq_post_flags(alq, ale, 0);
  142 }
  143 
  144 #endif  /* _SYS_ALQ_H_ */

Cache object: 40c09bbecb75ddfd9f6406849b18600b


[ 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.