示例#1
0
/*
 * Function to get the memory for a particular head
 */
int set_handle(int inode_num)
{
    struct head_node *head;
    int ret = -1;

    head = kmalloc(sizeof(struct head_node), GFP_KERNEL);
    if (NULL == head) {
        goto OUT;
    }

    /* Fill up the temporary head */
    head->inode = inode_num;
    head->next = NULL;
    head->data = NULL;
    head->num_data = 0;

    /* Insert the head in the correct place */
    ret = insert_obj(head);

OUT:
    if (ret < 0) {
        if (head) {
            kfree(head);
            head = NULL;
        }
    }

    return ret;
}
示例#2
0
  void serialize(std::vector<byte> & v) const {
    insert_obj(v, sizeof(WORD), _pt_size);

    auto font_name = widen(_name);
    insert_data(v, 1,
                (byte *) font_name.c_str(),
                (byte *) (font_name.c_str() +
                          font_name.size() + 1));
  }
示例#3
0
 void serialize(std::vector<byte> & v) const {
   if (_is_title) {
     auto text_item_title = widen(_title);
     insert_data(v, sizeof(WORD),
                 (byte *) text_item_title.c_str(),
                 (byte *) (text_item_title.c_str() +
                           text_item_title.size() + 1));
   }
   else {
     const uint16_t text_item_rsrc_id[] =
       {0xffff, _rsrc_id};
     insert_obj(v, sizeof(WORD), text_item_rsrc_id);
   }
 }