aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/hack-4.9/910-kobject_uevent.patch
blob: 734401e1c69a2a39ba6d17a006e7b92a7f5c3356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 0d37e6edc09c99e683dd91ca0e83bbc0df8477b3 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 16 Jul 2017 16:56:10 +0200
Subject: lib: add uevent_next_seqnum()

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 include/linux/kobject.h |  5 +++++
 lib/kobject_uevent.c    | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -52,6 +52,18 @@ static const char *kobject_actions[] = {
 	[KOBJ_OFFLINE] =	"offline",
 };
 
+u64 uevent_next_seqnum(void)
+{
+	u64 seq;
+
+	mutex_lock(&uevent_sock_mutex);
+	seq = ++uevent_seqnum;
+	mutex_unlock(&uevent_sock_mutex);
+
+	return seq;
+}
+EXPORT_SYMBOL_GPL(uevent_next_seqnum);
+
 /**
  * kobject_action_type - translate action string to numeric type
  *
r */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
#
# If you change any of these configuration options then you must
# 'make clean' before rebuilding.
#
verbose       ?= n
perfc         ?= n
perfc_arrays  ?= n
crash_debug   ?= n
frame_pointer ?= n

XEN_ROOT=$(BASEDIR)/..
include $(XEN_ROOT)/Config.mk

# Hardcoded configuration implications and dependencies.
# Do this is a neater way if it becomes unwieldy.
ifeq ($(debug),y)
verbose       := y
frame_pointer := y
endif
ifeq ($(perfc_arrays),y)
perfc := y
endif
ifeq ($(frame_pointer),y)
CFLAGS := $(shell echo $(CFLAGS) | sed -e 's/-f[^ ]*omit-frame-pointer//g')
endif

# Set ARCH/SUBARCH appropriately.
override COMPILE_SUBARCH := $(XEN_COMPILE_ARCH)
override TARGET_SUBARCH  := $(XEN_TARGET_ARCH)
override COMPILE_ARCH    := $(shell echo $(XEN_COMPILE_ARCH) | \
                              sed -e 's/x86.*/x86/' \
                                  -e 's/powerpc.*/powerpc/')
override TARGET_ARCH     := $(shell echo $(XEN_TARGET_ARCH) | \
                              sed -e 's/x86.*/x86/' \
                                  -e 's/powerpc.*/powerpc/')

TARGET := $(BASEDIR)/xen

HDRS := $(wildcard *.h)
HDRS += $(wildcard $(BASEDIR)/include/xen/*.h)
HDRS += $(wildcard $(BASEDIR)/include/xen/hvm/*.h)
HDRS += $(wildcard $(BASEDIR)/include/public/*.h)
HDRS += $(wildcard $(BASEDIR)/include/public/*/*.h)
HDRS += $(wildcard $(BASEDIR)/include/compat/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-$(TARGET_ARCH)/$(TARGET_SUBARCH)/*.h)

include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk

# Do not depend on auto-generated header files.
AHDRS := $(filter-out %/include/xen/compile.h,$(HDRS))
HDRS  := $(filter-out %/asm-offsets.h,$(AHDRS))

# Note that link order matters!
ALL_OBJS-y               += $(BASEDIR)/common/built_in.o
ALL_OBJS-y               += $(BASEDIR)/drivers/built_in.o
ALL_OBJS-y               += $(BASEDIR)/xsm/built_in.o
ALL_OBJS-y               += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o

CFLAGS-y                += -g -D__XEN__
CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE
CFLAGS-$(FLASK_ENABLE)  += -DFLASK_ENABLE -DXSM_MAGIC=0xf97cff8c
CFLAGS-$(FLASK_ENABLE)  += -DFLASK_DEVELOP -DFLASK_BOOTPARAM -DFLASK_AVC_STATS
CFLAGS-$(ACM_SECURITY)  += -DACM_SECURITY -DXSM_MAGIC=0xbcde0100
CFLAGS-$(verbose)       += -DVERBOSE
CFLAGS-$(crash_debug)   += -DCRASH_DEBUG
CFLAGS-$(perfc)         += -DPERF_COUNTERS
CFLAGS-$(perfc_arrays)  += -DPERF_ARRAYS
CFLAGS-$(frame_pointer) += -fno-omit-frame-pointer -DCONFIG_FRAME_POINTER

ifneq ($(max_phys_cpus),)
CFLAGS-y                += -DMAX_PHYS_CPUS=$(max_phys_cpus)
endif

AFLAGS-y                += -D__ASSEMBLY__

ALL_OBJS := $(ALL_OBJS-y)

CFLAGS   := $(strip $(CFLAGS) $(CFLAGS-y))

# Most CFLAGS are safe for assembly files:
#  -std=gnu{89,99} gets confused by #-prefixed end-of-line comments
AFLAGS   := $(strip $(AFLAGS) $(AFLAGS-y))
AFLAGS   += $(patsubst -std=gnu%,,$(CFLAGS))

# LDFLAGS are only passed directly to $(LD)
LDFLAGS  := $(strip $(LDFLAGS) $(LDFLAGS_DIRECT))

include Makefile

# Ensure each subdirectory has exactly one trailing slash.
subdir-n := $(patsubst %,%/,$(patsubst %/,%,$(subdir-n)))
subdir-y := $(patsubst %,%/,$(patsubst %/,%,$(subdir-y)))

# Add explicitly declared subdirectories to the object list.
obj-y += $(patsubst %/,%/built_in.o,$(subdir-y))

# Add implicitly declared subdirectories (in the object list) to the
# subdirectory list, and rewrite the object-list entry.
subdir-y += $(filter %/,$(obj-y))
obj-y    := $(patsubst %/,%/built-in.o,$(obj-y))

subdir-all := $(subdir-y) $(subdir-n)

built_in.o: $(obj-y)
	$(LD) $(LDFLAGS) -r -o $@ $^

# Force execution of pattern rules (for which PHONY cannot be directly used).
.PHONY: FORCE
FORCE:

%/built_in.o: FORCE
	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* built_in.o

.PHONY: clean
clean:: $(addprefix _clean_, $(subdir-all))
	rm -f *.o *~ core
_clean_%/: FORCE
	$(MAKE) -f $(BASEDIR)/Rules.mk -C $* clean

%.o: %.c $(HDRS) Makefile
	$(CC) $(CFLAGS) -c $< -o $@

%.o: %.S $(AHDRS) Makefile
	$(CC) $(AFLAGS) -c $< -o $@

%.i: %.c $(HDRS) Makefile
	$(CPP) $(CFLAGS) $< -o $@

# -std=gnu{89,99} gets confused by # as an end-of-line comment marker
%.s: %.S $(AHDRS) Makefile
	$(CPP) $(AFLAGS) $< -o $@