Re: udev_queue_get_seqnum_is_finished

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 23, 2009 at 11:39, Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx> wrote:
> I'm puzzled by this function:
>
>
> int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum)
> {
>        char filename[UTIL_PATH_SIZE];
>        struct stat statbuf;
>
>        if (udev_queue == NULL)
>                return -EINVAL;
>        /* if we have not seen this seqnum, check if it is/was already queued */
>        if (seqnum < udev_queue->last_seen_udev_seqnum) {
>                udev_queue_get_udev_seqnum(udev_queue);
>                if (seqnum < udev_queue->last_seen_udev_seqnum)
>                        return 0;
>        }
>
>
> Shouldn't the test be (seqnum > udev_queue->last_seen_udev_seqnum) ?
> I.e. "greater than" instead of "less than".

Sounds like.

> If the code is right, then why does it need to re-check after calling
> udev_queue_get_udev_seqnum() ?  The udev seqnum can only increase, so if
> the first test is true then the second cannot fail either.

The udev_queue->last_seen_udev_seqnum can change with the
udev_queue_get_udev_seqnum() call, hence the second check. It will
work when the <  turns into a >, I guess. :)

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux