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

Subversion リポジトリの参照

Diff of /trunk/1.6.x/ccs-patch/fs/realpath.c

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

revision 325 by kumaneko, Mon Aug 6 12:55:41 2007 UTC revision 581 by kumaneko, Tue Oct 16 08:00:21 2007 UTC
# Line 5  Line 5 
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.1-pre   2007/10/16
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.
# Line 54  static int GetAbsolutePath(struct dentry Line 54  static int GetAbsolutePath(struct dentry
54  {  {
55          char *start = buffer;          char *start = buffer;
56          char *end = buffer + buflen;          char *end = buffer + buflen;
57          int is_dir = (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode));          u8 is_dir = (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode));
58    
59          if (buflen < 256) goto out;          if (buflen < 256) goto out;
60    
# Line 167  int realpath_from_dentry2(struct dentry Line 167  int realpath_from_dentry2(struct dentry
167          struct dentry *d_dentry;          struct dentry *d_dentry;
168          struct vfsmount *d_mnt;          struct vfsmount *d_mnt;
169          if (!dentry || !mnt || !newname || newname_len <= 0) return -EINVAL;          if (!dentry || !mnt || !newname || newname_len <= 0) return -EINVAL;
         if (!current->fs) {  
                 printk("%s: current->fs == NULL for pid=%d\n", __FUNCTION__, current->pid);  
                 return -ENOENT;  
         }  
170          d_dentry = dget(dentry);          d_dentry = dget(dentry);
171          d_mnt = mntget(mnt);          d_mnt = mntget(mnt);
172          /***** CRITICAL SECTION START *****/          /***** CRITICAL SECTION START *****/
# Line 395  unsigned int GetMemoryUsedForDynamic(voi Line 391  unsigned int GetMemoryUsedForDynamic(voi
391          return dynamic_memory_size;          return dynamic_memory_size;
392  }  }
393    
394    #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
395    static int round2(size_t size)
396    {
397    #if PAGE_SIZE == 4096
398            size_t bsize = 32;
399    #else
400            size_t bsize = 64;
401    #endif
402            while (size > bsize) bsize <<= 1;
403            return bsize;
404    }
405    #endif
406    
407  void *ccs_alloc(const size_t size)  void *ccs_alloc(const size_t size)
408  {  {
409          void *ret = kmalloc(size, GFP_KERNEL);          void *ret = kmalloc(size, GFP_KERNEL);
# Line 405  void *ccs_alloc(const size_t size) Line 414  void *ccs_alloc(const size_t size)
414                  } else {                  } else {
415                          INIT_LIST_HEAD(&new_entry->list);                          INIT_LIST_HEAD(&new_entry->list);
416                          new_entry->ptr = ret;                          new_entry->ptr = ret;
417                          new_entry->size = size;  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
418                            new_entry->size = ksize(ret);
419    #else
420                            new_entry->size = round2(size);
421    #endif
422                          spin_lock(&cache_list_lock);                          spin_lock(&cache_list_lock);
423                          list_add_tail(&new_entry->list, &cache_list);                          list_add_tail(&new_entry->list, &cache_list);
424                          dynamic_memory_size += size;                          dynamic_memory_size += new_entry->size;
425                          spin_unlock(&cache_list_lock);                          spin_unlock(&cache_list_lock);
426                          memset(ret, 0, size);                          memset(ret, 0, size);
427                  }                  }

Legend:
Removed from v.325  
changed lines
  Added in v.581

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