sys/vfs/hammer: Fix comments on record initialization
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 24 Feb 2015 10:57:14 +0000 (19:57 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 24 Feb 2015 12:46:10 +0000 (21:46 +0900)
- hunk1 - Add description of manual data allocation.

- hunk2 - Make description of hammer_ip_add_record() up-to-date with code.

sys/vfs/hammer/hammer_object.c

index cc09b8d..2fae98e 100644 (file)
@@ -256,7 +256,9 @@ RB_GENERATE(hammer_rec_rb_tree, hammer_record, rb_node, hammer_rec_rb_compare);
 
 /*
  * Allocate a record for the caller to finish filling in.  The record is
- * returned referenced.
+ * returned referenced.  In order to manually set data call this function
+ * with data_len=0 and then manually set record->leaf.data_len and
+ * record->data later.
  */
 hammer_record_t
 hammer_alloc_mem_record(hammer_inode_t ip, int data_len)
@@ -874,16 +876,16 @@ hammer_ip_del_directory(struct hammer_transaction *trans,
 /*
  * Add a record to an inode.
  *
- * The caller must allocate the record with hammer_alloc_mem_record(ip) and
- * initialize the following additional fields:
+ * The caller must allocate the record with hammer_alloc_mem_record(ip,len) and
+ * initialize the following additional fields that are not initialized by these
+ * functions.
  *
  * The related inode should be share-locked by the caller.  The caller is
  * on the frontend.
  *
- * record->rec.entry.base.base.key
- * record->rec.entry.base.base.rec_type
- * record->rec.entry.base.base.data_len
- * record->data                (a copy will be kmalloc'd if it cannot be embedded)
+ * record->leaf.base.key
+ * record->leaf.base.rec_type
+ * record->leaf.base.localization
  */
 int
 hammer_ip_add_record(struct hammer_transaction *trans, hammer_record_t record)