コード例 #1
0
ファイル: dbinput.c プロジェクト: 0-T-0/ps4-linux
static u32 acpi_db_get_line(char *input_buffer)
{
	u32 i;
	u32 count;
	char *next;
	char *this;

	if (acpi_ut_safe_strcpy
	    (acpi_gbl_db_parsed_buf, sizeof(acpi_gbl_db_parsed_buf),
	     input_buffer)) {
		acpi_os_printf
		    ("Buffer overflow while parsing input line (max %u characters)\n",
		     sizeof(acpi_gbl_db_parsed_buf));
		return (0);
	}

	this = acpi_gbl_db_parsed_buf;
	for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) {
		acpi_gbl_db_args[i] = acpi_db_get_next_token(this, &next,
							     &acpi_gbl_db_arg_types
							     [i]);
		if (!acpi_gbl_db_args[i]) {
			break;
		}

		this = next;
	}

	/* Uppercase the actual command */

	if (acpi_gbl_db_args[0]) {
		acpi_ut_strupr(acpi_gbl_db_args[0]);
	}

	count = i;
	if (count) {
		count--;	/* Number of args only */
	}

	return (count);
}
コード例 #2
0
acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object)
{
	char *this;
	char *next;
	u32 i;
	acpi_object_type type;
	union acpi_object *elements;
	acpi_status status;

	elements =
	    ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
				 sizeof(union acpi_object));

	this = string;
	for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
		this = acpi_db_get_next_token(this, &next, &type);
		if (!this) {
			break;
		}

		/* Recursive call to convert each package element */

		status = acpi_db_convert_to_object(type, this, &elements[i]);
		if (ACPI_FAILURE(status)) {
			acpi_db_delete_objects(i + 1, elements);
			ACPI_FREE(elements);
			return (status);
		}

		this = next;
	}

	object->type = ACPI_TYPE_PACKAGE;
	object->package.count = i;
	object->package.elements = elements;
	return (AE_OK);
}