]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/sys/buf.h
xnu-2422.90.20.tar.gz
[apple/xnu.git] / bsd / sys / buf.h
index 08216cac0e1e898b9eb60eb073a8d4222019eeed..93c885982970009ea9867cd8804c28005ddd4125 100644 (file)
 #define        B_FUA           0x00000400      /* Write-through disk cache(if supported) */
 #define B_PASSIVE      0x00000800      /* PASSIVE I/Os are ignored by THROTTLE I/O */
 #define        B_IOSTREAMING   0x00001000      /* sequential access pattern detected */
-#define B_THROTTLED_IO 0x00002000      /* low priority I/O */
+#define B_THROTTLED_IO 0x00002000      /* low priority I/O (deprecated) */
 #define B_ENCRYPTED_IO 0x00004000      /* Encrypted I/O */
+#define B_STATICCONTENT 0x00008000     /* Buffer is likely to remain unaltered */
+
 /*
  * make sure to check when adding flags that
  * that the new flags don't overlap the definitions
@@ -1033,35 +1035,151 @@ void   buf_set_redundancy_flags(buf_t, uint32_t);
  */
 bufattr_t buf_attr(buf_t);
 
+/*!
+ @function buf_markstatic
+ @abstract Mark a buffer as being likely to contain static data.
+ @param bp Buffer to mark.
+ @return void.
+ */
+ void buf_markstatic(buf_t);
+
+/*!
+ @function buf_static
+ @abstract Check if a buffer contains static data.
+ @param bp Buffer to test.
+ @return Nonzero if buffer has static data, 0 otherwise.
+ */
+int    buf_static(buf_t);
+
 #ifdef KERNEL_PRIVATE
 void   buf_setfilter(buf_t, void (*)(buf_t, void *), void *, void (**)(buf_t, void *), void **);
 
+bufattr_t bufattr_alloc(void);
+
+void bufattr_free(bufattr_t bap);
+
+/*!
+ @function bufattr_cpaddr
+ @abstract Get the address of cp_entry on a buffer.
+ @param bap Buffer Attribute whose cp_entry to get.
+ @return int.
+ */
+void *bufattr_cpaddr(bufattr_t);
 
 /*!
- @function buf_getcpaddr
- @abstract Set the address of cp_entry on a buffer.
- @param bp Buffer whose cp entry value has to be set
+ @function bufattr_cpoff
+ @abstract Gets the file offset on the buffer.
+ @param bap Buffer Attribute whose file offset value is used
  @return void.
  */
-void buf_setcpaddr(buf_t, void *);
+uint64_t bufattr_cpoff(bufattr_t);
+
 
 /*!
- @function buf_getcpaddr
- @abstract Get the address of cp_entry on a buffer.
- @param bp Buffer whose error value to set.
- @return int.
+ @function bufattr_setcpaddr
+ @abstract Set the address of cp_entry on a buffer attribute.
+ @param bap Buffer Attribute whose cp entry value has to be set
+ @return void.
+ */
+void bufattr_setcpaddr(bufattr_t, void *);
+
+/*!
+ @function bufattr_setcpoff
+ @abstract Set the file offset for a content protected I/O on 
+ a buffer attribute.
+ @param bap Buffer Attribute whose cp file offset has to be set
+ @return void.
+ */
+void bufattr_setcpoff(bufattr_t, uint64_t);
+
+/*!
+ @function bufattr_rawencrypted
+ @abstract Check if a buffer contains raw encrypted data.
+ @param bap Buffer attribute to test.
+ @return Nonzero if buffer has raw encrypted data, 0 otherwise.
+ */
+int bufattr_rawencrypted(bufattr_t bap);
+
+/*!
+ @function bufattr_markgreedymode
+ @abstract Mark a buffer to use the greedy mode for writing.
+ @param bap Buffer attributes to mark.
+ @discussion Greedy Mode: request improved write performance from the underlying device at the expense of storage effeciency
+ @return void.
+ */
+ void bufattr_markgreedymode(bufattr_t bap);
+
+/*!
+ @function bufattr_greedymode
+ @abstract Check if a buffer is written using the Greedy Mode
+ @param bap Buffer attributes to test.
+ @discussion Greedy Mode: request improved write performance from the underlying device at the expense of storage effeciency
+ @return Nonzero if buffer uses greedy mode, 0 otherwise.
  */
-void *buf_getcpaddr(buf_t);
+int    bufattr_greedymode(bufattr_t bap);
 
 /*!
- @function buf_throttled
+ @function bufattr_throttled
  @abstract Check if a buffer is throttled.
  @param bap Buffer attribute to test.
  @return Nonzero if the buffer is throttled, 0 otherwise.
  */
 int bufattr_throttled(bufattr_t bap);
-#endif /* KERNEL_PRIVATE */
 
+/*!
+ @function bufattr_nocache
+ @abstract Check if a buffer has nocache attribute.
+ @param bap Buffer attribute to test.
+ @return Nonzero if the buffer is not cached, 0 otherwise.
+ */
+int bufattr_nocache(bufattr_t bap);
+
+/*!
+ @function bufattr_meta
+ @abstract Check if a buffer has meta attribute.
+ @param bap Buffer attribute to test.
+ @return Nonzero if the buffer has meta attribute, 0 otherwise.
+ */
+
+int bufattr_meta(bufattr_t bap);
+
+/*!
+ @function bufattr_delayidlesleep
+ @abstract Check if a buffer is marked to delay idle sleep on disk IO.
+ @param bap Buffer attribute to test.
+ @return Nonzero if the buffer is marked to delay idle sleep on disk IO, 0 otherwise.
+ */
+int bufattr_delayidlesleep(bufattr_t bap);
+
+/*!
+ @function buf_kernel_addrperm_addr
+ @abstract Obfuscate the buf pointers.
+ @param addr Buf_t pointer.
+ @return Obfuscated pointer if addr is non zero, 0 otherwise.
+ */
+vm_offset_t buf_kernel_addrperm_addr(void * addr);
+
+/*!
+ @function bufattr_markquickcomplete
+ @abstract Mark a buffer to hint quick completion to the driver.
+ @discussion This flag hints the storage driver that some thread is waiting for this I/O to complete.
+ It should therefore attempt to complete it as soon as possible at the cost of device efficiency.
+ @param bap Buffer attributes to mark.
+ @return void.
+ */
+void bufattr_markquickcomplete(bufattr_t bap);
+
+/*!
+ @function bufattr_quickcomplete
+ @abstract Check if a buffer is marked for quick completion
+ @discussion This flag hints the storage driver that some thread is waiting for this I/O to complete.
+ It should therefore attempt to complete it as soon as possible at the cost of device efficiency.
+ @param bap Buffer attribute to test.
+ @return Nonzero if the buffer is marked for quick completion, 0 otherwise.
+ */
+int bufattr_quickcomplete(bufattr_t bap);
+
+#endif /* KERNEL_PRIVATE */
 
 __END_DECLS