Re: Hundreds of bugs in 2.3.99-pre3

From: Andrew Morton (andrewm@uow.edu.au)
Date: Fri Mar 31 2000 - 19:36:13 EST

  • Next message: Roger Larsson: "Re: designing fast, streaming disk i/o with mmap: help wanted"

    willy@thepuffingroup.com wrote:
    >
    > it's generally better to do:
    >
    > foo_open()
    > {
    > int result;
    > MOD_INC_USE_COUNT;
    > stuff..
    > result = -EBUSY;
    > if (fail)
    > goto out;
    > sleep..
    > stuff..
    > result = 0;
    > out:
    > if (result != 0) {
    > MOD_DEC_USE_COUNT;
    > }
    > return result;
    > }
    >
    > particularly if you have many possible failure cases.

    Or front-end it:

    foo_open()
    {
            int result;
            MOD_INC_USE_COUNT;
            result = old_foo_open();
            if (result != 0)
                    MOD_DEC_USE_COUNT;
            return result;
    }

    -- 
    -akpm-
    

    - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Fri Mar 31 2000 - 21:02:45 EST