Results 1 to 5 of 5

Thread: Example bug when using Linux list macros

  1. #1
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Cool Example bug when using Linux list macros

    Two of us have (here at work) been chasing a bug for about 4+ days...

    We found this to be the faulty line of code:
    Code:
    list_for_each_entry(vha, &vfp->vp_list, vp_list)
    It should have read as follows:
    Code:
    list_for_each_entry(vha, &vfp->vp_list, vsan_list)
    Oh what fun we have been having...

  2. #2
    Senior Member
    Join Date
    Oct 2003
    Posts
    140

    Default

    Nothing like passing in the wrong list, huh?

  3. #3
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Exclamation

    Here's another good hole to fall into...

    Quote Originally Posted by linux manual page

    list_add_tail

    Name
    list_add_tail -- add a new entry

    Synopsis
    void list_add_tail (struct list_head * new, struct list_head * head);

    Arguments
    new new entry to be added
    head list head to add it before

    Description
    Insert a new entry before the specified head. This is useful for implementing queues.

    So what does the word "tail" mean in the name of this macro
    (it does not append the new entry at the tail of the list)
    ...?

    Last edited by joecar; October 6th, 2006 at 02:10 PM.

  4. #4
    Joe (Moderator) joecar's Avatar
    Join Date
    Apr 2003
    Posts
    28,403

    Default

    Quote Originally Posted by joecar
    So what does the word "tail" mean in the name of this macro
    (it does not append the new entry at the tail of the list)
    ...?
    Oh, I see it, it's a circular list, so before the head is the tail...

  5. #5
    Lifetime Member Garry's Avatar
    Join Date
    Jun 2006
    Posts
    649

    Default

    You can also use list_add, which will add it after the &head-entry ... In case you're wondering ...
    It seems like there were lots of "list_add(item, listitem.prev)" calls, so in order to make the calls more easily readable, the function was added ... slightly poor choice of name, though ...
    Garry Glendown * '17 Fifty 2SS MT * 99 Firehawk Convertible (for sale)

Similar Threads

  1. Why Linux?
    By Blacky in forum EFILive on Linux
    Replies: 105
    Last Post: April 6th, 2011, 07:42 AM
  2. EFILive on Linux
    By Chevy366 in forum EFILive on Linux
    Replies: 51
    Last Post: May 8th, 2009, 01:58 PM
  3. EFILive on Linux
    By Chevy366 in forum Lounge
    Replies: 21
    Last Post: December 16th, 2008, 10:46 PM
  4. Linux Version
    By Chevy366 in forum Lounge
    Replies: 25
    Last Post: September 30th, 2008, 09:03 AM
  5. Creating/editing macros
    By botteman in forum EFILive V4
    Replies: 3
    Last Post: June 1st, 2007, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •