5 |
* |
* |
6 |
* Copyright (C) 2005-2007 NTT DATA CORPORATION |
* Copyright (C) 2005-2007 NTT DATA CORPORATION |
7 |
* |
* |
8 |
* Version: 1.5.0-pre 2007/08/06 |
* Version: 1.5.0-pre 2007/08/17 |
9 |
* |
* |
10 |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
11 |
* See README.ccs for ChangeLog. |
* See README.ccs for ChangeLog. |
47 |
u8 is_deleted; |
u8 is_deleted; |
48 |
u8 is_not; |
u8 is_not; |
49 |
u8 is_last_name; |
u8 is_last_name; |
|
u8 is_oldstyle; |
|
50 |
}; |
}; |
51 |
|
|
52 |
/***** The structure for domains to not to transit domains. *****/ |
/***** The structure for domains to not to transit domains. *****/ |
143 |
|
|
144 |
static struct domain_initializer_entry *domain_initializer_list = NULL; |
static struct domain_initializer_entry *domain_initializer_list = NULL; |
145 |
|
|
146 |
static int AddDomainInitializerEntry(const char *domainname, const char *program, const int is_not, const int is_delete, const int is_oldstyle) |
static int AddDomainInitializerEntry(const char *domainname, const char *program, const int is_not, const int is_delete) |
147 |
{ |
{ |
148 |
struct domain_initializer_entry *new_entry, *ptr; |
struct domain_initializer_entry *new_entry, *ptr; |
149 |
static DECLARE_MUTEX(lock); |
static DECLARE_MUTEX(lock); |
162 |
if ((saved_program = SaveName(program)) == NULL) return -ENOMEM; |
if ((saved_program = SaveName(program)) == NULL) return -ENOMEM; |
163 |
down(&lock); |
down(&lock); |
164 |
for (ptr = domain_initializer_list; ptr; ptr = ptr->next) { |
for (ptr = domain_initializer_list; ptr; ptr = ptr->next) { |
165 |
if (ptr->is_not == is_not && ptr->is_oldstyle == is_oldstyle && ptr->domainname == saved_domainname && ptr->program == saved_program) { |
if (ptr->is_not == is_not && ptr->domainname == saved_domainname && ptr->program == saved_program) { |
166 |
ptr->is_deleted = is_delete; |
ptr->is_deleted = is_delete; |
167 |
error = 0; |
error = 0; |
168 |
goto out; |
goto out; |
177 |
new_entry->program = saved_program; |
new_entry->program = saved_program; |
178 |
new_entry->is_not = is_not; |
new_entry->is_not = is_not; |
179 |
new_entry->is_last_name = is_last_name; |
new_entry->is_last_name = is_last_name; |
|
new_entry->is_oldstyle = is_oldstyle; |
|
180 |
mb(); /* Instead of using spinlock. */ |
mb(); /* Instead of using spinlock. */ |
181 |
if ((ptr = domain_initializer_list) != NULL) { |
if ((ptr = domain_initializer_list) != NULL) { |
182 |
while (ptr->next) ptr = ptr->next; ptr->next = new_entry; |
while (ptr->next) ptr = ptr->next; ptr->next = new_entry; |
197 |
head->read_var2 = ptr; |
head->read_var2 = ptr; |
198 |
if (!ptr->is_deleted) { |
if (!ptr->is_deleted) { |
199 |
if (ptr->domainname) { |
if (ptr->domainname) { |
200 |
if (io_printf(head, "%s%s%s from %s\n", ptr->is_not ? "no_" : "", ptr->is_oldstyle ? KEYWORD_INITIALIZER : KEYWORD_INITIALIZE_DOMAIN, ptr->program->name, ptr->domainname->name)) break; |
if (io_printf(head, "%s" KEYWORD_INITIALIZE_DOMAIN "%s from %s\n", ptr->is_not ? "no_" : "", ptr->program->name, ptr->domainname->name)) break; |
201 |
} else { |
} else { |
202 |
if (io_printf(head, "%s%s%s\n", ptr->is_not ? "no_" : "", ptr->is_oldstyle ? KEYWORD_INITIALIZER : KEYWORD_INITIALIZE_DOMAIN, ptr->program->name)) break; |
if (io_printf(head, "%s" KEYWORD_INITIALIZE_DOMAIN "%s\n", ptr->is_not ? "no_" : "", ptr->program->name)) break; |
203 |
} |
} |
204 |
} |
} |
205 |
ptr = ptr->next; |
ptr = ptr->next; |
207 |
return ptr ? -ENOMEM : 0; |
return ptr ? -ENOMEM : 0; |
208 |
} |
} |
209 |
|
|
210 |
int AddDomainInitializerPolicy(char *data, const int is_not, const int is_delete, const int is_oldstyle) |
int AddDomainInitializerPolicy(char *data, const int is_not, const int is_delete) |
211 |
{ |
{ |
212 |
char *cp = strstr(data, " from "); |
char *cp = strstr(data, " from "); |
213 |
if (cp) { |
if (cp) { |
214 |
*cp = '\0'; |
*cp = '\0'; |
215 |
return AddDomainInitializerEntry(cp + 6, data, is_not, is_delete, is_oldstyle); |
return AddDomainInitializerEntry(cp + 6, data, is_not, is_delete); |
216 |
} else { |
} else { |
217 |
return AddDomainInitializerEntry(NULL, data, is_not, is_delete, is_oldstyle); |
return AddDomainInitializerEntry(NULL, data, is_not, is_delete); |
218 |
} |
} |
219 |
} |
} |
220 |
|
|
693 |
*/ |
*/ |
694 |
static int first = 1; |
static int first = 1; |
695 |
if (first) { |
if (first) { |
696 |
AddDomainInitializerEntry(NULL, "/sbin/hotplug", 0, 0, 0); |
AddDomainInitializerEntry(NULL, "/sbin/hotplug", 0, 0); |
697 |
AddDomainInitializerEntry(NULL, "/sbin/modprobe", 0, 0, 0); |
AddDomainInitializerEntry(NULL, "/sbin/modprobe", 0, 0); |
698 |
first = 0; |
first = 0; |
699 |
} |
} |
700 |
} |
} |