Lines Matching refs:uevent
148 static int CreateDeviceNode(const struct Uevent *uevent, const char *deviceNode, char **symLinks, b… in CreateDeviceNode() argument
151 int major = uevent->major; in CreateDeviceNode()
152 int minor = uevent->minor; in CreateDeviceNode()
153 uid_t uid = uevent->ug.uid; in CreateDeviceNode()
154 gid_t gid = uevent->ug.gid; in CreateDeviceNode()
300 static char **GetBlockDeviceSymbolLinks(const struct Uevent *uevent) in GetBlockDeviceSymbolLinks() argument
302 … if (uevent == NULL || uevent->subsystem == NULL || STRINGEQUAL(uevent->subsystem, "block") == 0) { in GetBlockDeviceSymbolLinks()
308 if (!STARTSWITH(uevent->syspath, "/devices")) { in GetBlockDeviceSymbolLinks()
315 if (snprintf_s(sysPath, SYSPATH_SIZE, SYSPATH_SIZE - 1, "/sys%s", uevent->syspath) == -1) { in GetBlockDeviceSymbolLinks()
316 INIT_LOGE("Failed to build sys path for device %s", uevent->syspath); in GetBlockDeviceSymbolLinks()
331 INIT_LOGE("Failed to build subsystem path for device \" %s \"", uevent->syspath); in GetBlockDeviceSymbolLinks()
346 …linkNum = BuildDeviceSymbolLinks(links, linkNum, parent, uevent->partitionName, uevent->deviceName… in GetBlockDeviceSymbolLinks()
358 static void HandleDeviceNode(const struct Uevent *uevent, const char *deviceNode, bool isBlock) in HandleDeviceNode() argument
360 ACTION action = uevent->action; in HandleDeviceNode()
367 symLinks = GetBlockDeviceSymbolLinks(uevent); in HandleDeviceNode()
371 if (CreateDeviceNode(uevent, deviceNode, symLinks, isBlock) < 0) { in HandleDeviceNode()
391 INIT_LOGV("Device %s changed", uevent->syspath); in HandleDeviceNode()
453 void HandleBlockDeviceEvent(const struct Uevent *uevent) in HandleBlockDeviceEvent() argument
456 if (uevent == NULL || uevent->subsystem == NULL) { in HandleBlockDeviceEvent()
461 if (strcmp(uevent->subsystem, "block") != 0) { in HandleBlockDeviceEvent()
462 …INIT_LOGE("Unexpected uevent subsystem \" %s \" received in block device handler", uevent->subsyst… in HandleBlockDeviceEvent()
466 if (uevent->major < 0 || uevent->minor < 0) { in HandleBlockDeviceEvent()
472 const char *devPath = GetDeviceBasePath(uevent->subsystem); in HandleBlockDeviceEvent()
476 if (uevent->syspath == NULL) { in HandleBlockDeviceEvent()
479 if (strncpy_s(sysPath, SYSPATH_SIZE - 1, uevent->syspath, strlen(uevent->syspath) != EOK)) { in HandleBlockDeviceEvent()
483 const char *devName = GetDeviceName(sysPath, uevent->deviceName); in HandleBlockDeviceEvent()
490 INIT_LOGE("Make device file for device [%d : %d]", uevent->major, uevent->minor); in HandleBlockDeviceEvent()
493 HandleDeviceNode(uevent, deviceNode, isBlock); in HandleBlockDeviceEvent()
496 void HandleOtherDeviceEvent(const struct Uevent *uevent) in HandleOtherDeviceEvent() argument
498 if (uevent == NULL || uevent->subsystem == NULL || uevent->syspath == NULL) { in HandleOtherDeviceEvent()
503 if (uevent->major < 0 || uevent->minor < 0) { in HandleOtherDeviceEvent()
509 if (strncpy_s(sysPath, SYSPATH_SIZE - 1, uevent->syspath, strlen(uevent->syspath)) != EOK) { in HandleOtherDeviceEvent()
513 const char *devName = GetDeviceName(sysPath, uevent->deviceName); in HandleOtherDeviceEvent()
514 const char *devPath = GetDeviceBasePath(uevent->subsystem); in HandleOtherDeviceEvent()
525 if (STRINGEQUAL(uevent->subsystem, "usb")) { in HandleOtherDeviceEvent()
526 if (uevent->deviceName != NULL) { in HandleOtherDeviceEvent()
527 …if (snprintf_s(deviceNode, DEVICE_FILE_SIZE, DEVICE_FILE_SIZE - 1, "/dev/%s", uevent->deviceName) … in HandleOtherDeviceEvent()
528 INIT_LOGE("Make device file for device [%d : %d]", uevent->major, uevent->minor); in HandleOtherDeviceEvent()
532 if (uevent->busNum < 0 || uevent->devNum < 0) { in HandleOtherDeviceEvent()
538 "/dev/bus/usb/%03d/%03d", uevent->busNum, uevent->devNum) == -1) { in HandleOtherDeviceEvent()
539 … INIT_LOGE("Make usb device node for device [%d : %d]", uevent->busNum, uevent->devNum); in HandleOtherDeviceEvent()
542 } else if (STARTSWITH(uevent->subsystem, "usb")) { in HandleOtherDeviceEvent()
546 if (strcmp(uevent->deviceName, "mapper/control") == 0) { in HandleOtherDeviceEvent()
550 INIT_LOGE("Make device file for device [%d : %d]", uevent->major, uevent->minor); in HandleOtherDeviceEvent()
554 HandleDeviceNode(uevent, deviceNode, false); in HandleOtherDeviceEvent()