Exemple #1
0
static void walk_pgd_level(struct seq_file *m)
{
#ifdef CONFIG_X86_64
	pgd_t *start = (pgd_t *) &init_level4_pgt;
#else
	pgd_t *start = swapper_pg_dir;
#endif
	int i;
	struct pg_state st;

	memset(&st, 0, sizeof(st));

	for (i = 0; i < PTRS_PER_PGD; i++) {
		st.current_address = normalize_addr(i * PGD_LEVEL_MULT);
		if (!pgd_none(*start)) {
			pgprotval_t prot = pgd_val(*start) & PTE_FLAGS_MASK;

			if (pgd_large(*start) || !pgd_present(*start))
				note_page(m, &st, __pgprot(prot), 1);
			else
				walk_pud_level(m, &st, *start,
					       i * PGD_LEVEL_MULT);
		} else
			note_page(m, &st, __pgprot(0), 1);

		start++;
	}

	/* Flush out the last page */
	st.current_address = normalize_addr(PTRS_PER_PGD*PGD_LEVEL_MULT);
	note_page(m, &st, __pgprot(0), 0);
}
Exemple #2
0
static void walk_pte_level(struct seq_file *m, struct pg_state *st, pmd_t addr,
							unsigned long P)
{
	int i;
	pte_t *start;

	start = (pte_t *) pmd_page_vaddr(addr);
	for (i = 0; i < PTRS_PER_PTE; i++) {
		pgprot_t prot = pte_pgprot(*start);

		st->current_address = normalize_addr(P + i * PTE_LEVEL_MULT);
		note_page(m, st, prot, 4);
		start++;
	}
}
int
linux_bluez_register_psmove(char *addr)
{
    int errors = 0;

    addr = normalize_addr(addr);
    if (addr == NULL) {
        printf("Cannot parse bluetooth address!\n");
        return 0;
    }

    char *base = get_bluez_config_base_path();
    if (base == NULL) {
        printf("Can't find Bluetooth directory in '" BLUEZ_CONFIG_DIR "'\n");
        return 0;
    }

    // First, let's check if the entries are already okay..
    errors = for_all_entries(check_entry_in_file, base, addr);

    if (errors) {
        // In this case, we have missing or invalid values and need to update
        // the Bluetooth configuration files and restart Bluez' bluetoothd

        // FIXME: This is Ubuntu-specific
        if (system("service bluetooth stop") != 0) {
            printf("Automatic stopping of bluetoothd failed.\n"
                   "You might have to stop it manually before pairing.\n");
        }

        errors = for_all_entries(write_entry_to_file, base, addr);

        // FIXME: This is Ubuntu-specific
        if (system("service bluetooth start") != 0) {
            printf("Automatic starting of bluetoothd failed.\n"
                   "You might have to start it manually after pairing.\n");
        }

        free(base);
        free(addr);
    }

    return (errors == 0);
}
Exemple #4
0
static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr,
							unsigned long P)
{
	int i;
	pmd_t *start;

	start = (pmd_t *) pud_page_vaddr(addr);
	for (i = 0; i < PTRS_PER_PMD; i++) {
		st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT);
		if (!pmd_none(*start)) {
			pgprotval_t prot = pmd_val(*start) & PTE_FLAGS_MASK;

			if (pmd_large(*start) || !pmd_present(*start))
				note_page(m, st, __pgprot(prot), 3);
			else
				walk_pte_level(m, st, *start,
					       P + i * PMD_LEVEL_MULT);
		} else
			note_page(m, st, __pgprot(0), 3);
		start++;
	}
}