213-kobject_uevent.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Index: linux-2.6.21.7/lib/kobject_uevent.c
  2. ===================================================================
  3. --- linux-2.6.21.7.orig/lib/kobject_uevent.c
  4. +++ linux-2.6.21.7/lib/kobject_uevent.c
  5. @@ -30,9 +30,22 @@ u64 uevent_seqnum;
  6. char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
  7. static DEFINE_SPINLOCK(sequence_lock);
  8. #if defined(CONFIG_NET)
  9. -static struct sock *uevent_sock;
  10. +struct sock *uevent_sock = NULL;
  11. +EXPORT_SYMBOL_GPL(uevent_sock);
  12. #endif
  13. +u64 uevent_next_seqnum(void)
  14. +{
  15. + u64 seq;
  16. +
  17. + spin_lock(&sequence_lock);
  18. + seq = ++uevent_seqnum;
  19. + spin_unlock(&sequence_lock);
  20. +
  21. + return seq;
  22. +}
  23. +EXPORT_SYMBOL_GPL(uevent_next_seqnum);
  24. +
  25. static char *action_to_string(enum kobject_action action)
  26. {
  27. switch (action) {
  28. @@ -171,9 +184,7 @@ int kobject_uevent_env(struct kobject *k
  29. }
  30. /* we will send an event, request a new sequence number */
  31. - spin_lock(&sequence_lock);
  32. - seq = ++uevent_seqnum;
  33. - spin_unlock(&sequence_lock);
  34. + seq = uevent_next_seqnum();
  35. sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq);
  36. #if defined(CONFIG_NET)