オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Diff of /trunk/1.8.x/ccs-patch/security/ccsecurity/memory.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3131 by kumaneko, Tue Nov 3 03:51:07 2009 UTC revision 3162 by kumaneko, Mon Nov 9 06:10:32 2009 UTC
# Line 3  Line 3 
3   *   *
4   * Copyright (C) 2005-2009  NTT DATA CORPORATION   * Copyright (C) 2005-2009  NTT DATA CORPORATION
5   *   *
6   * Version: 1.7.1-pre   2009/11/03   * Version: 1.7.1-rc   2009/11/09
7   *   *
8   * 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.
9   * See README.ccs for ChangeLog.   * See README.ccs for ChangeLog.
# Line 11  Line 11 
11   */   */
12    
13  #include "internal.h"  #include "internal.h"
14    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(RHEL_MAJOR)
15    #include <linux/hash.h>
16    #endif
17    
18  void ccs_warn_oom(const char *function)  void ccs_warn_oom(const char *function)
19  {  {
# Line 138  const struct ccs_path_info *ccs_get_name Line 141  const struct ccs_path_info *ccs_get_name
141          unsigned int hash;          unsigned int hash;
142          int len;          int len;
143          int allocated_len;          int allocated_len;
144            struct list_head *head;
145    
146          if (!name)          if (!name)
147                  return NULL;                  return NULL;
148          len = strlen(name) + 1;          len = strlen(name) + 1;
149          hash = full_name_hash((const unsigned char *) name, len - 1);          hash = full_name_hash((const unsigned char *) name, len - 1);
150    #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) || defined(RHEL_MAJOR)
151            head = &ccs_name_list[hash_long(hash, CCS_HASH_BITS)];
152    #else
153            head = &ccs_name_list[hash % CCS_MAX_HASH];
154    #endif
155          mutex_lock(&ccs_name_list_lock);          mutex_lock(&ccs_name_list_lock);
156          list_for_each_entry(ptr, &ccs_name_list[hash % CCS_MAX_HASH], list) {          list_for_each_entry(ptr, head, list) {
157                  if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name))                  if (hash != ptr->entry.hash || strcmp(name, ptr->entry.name))
158                          continue;                          continue;
159                  atomic_inc(&ptr->users);                  atomic_inc(&ptr->users);
# Line 166  const struct ccs_path_info *ccs_get_name Line 175  const struct ccs_path_info *ccs_get_name
175          atomic_set(&ptr->users, 1);          atomic_set(&ptr->users, 1);
176          ccs_fill_path_info(&ptr->entry);          ccs_fill_path_info(&ptr->entry);
177          ptr->size = allocated_len;          ptr->size = allocated_len;
178          list_add_tail(&ptr->list, &ccs_name_list[hash % CCS_MAX_HASH]);          list_add_tail(&ptr->list, head);
179   out:   out:
180          mutex_unlock(&ccs_name_list_lock);          mutex_unlock(&ccs_name_list_lock);
181          return ptr ? &ptr->entry : NULL;          return ptr ? &ptr->entry : NULL;

Legend:
Removed from v.3131  
changed lines
  Added in v.3162

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26