www.pudn.com > efs.rar > fs_inode.c


/***********************************************************************
 * fs_inode.c
 *
 * Posix interface for EFS2
 * Copyright (C) 2002, 2003, 2004, 2005, 2006 Qualcomm, Inc.
 *
 * This file includes the functions related to inode operations
 *
 ***********************************************************************/
/*===========================================================================

                        EDIT HISTORY FOR MODULE

  This section contains comments describing changes made to the module.
  Notice that changes are listed in reverse chronological order.

  $Header: //depot/asic/MSMSHARED/services/efs/MSM_EFS.01.02/fs_inode.c#4 $ $DateTime: 2006/01/18 16:33:52 $ $Author: davidb $

when          who     what, where, why
--------      ---     ------------------------------------------------------
2006-01-11    nrs     Fixed Copyright header
2005-10-22     sh     Lint cleanup
2005-10-18    nrs     Added GID and UID to inode constructor
2005-05-15    dlb     Update generation count on inode creation.
2004-10-15    dlb     Update copyright line.
2004-10-07    dlb     Whitespace cleanup.
2003-12-08     gr     Sets mtime on inode creation.
2003-10-17     gr     Now sets ctime on inode creation.
2002-08-27    drh     Changed comparisons of cluster_id types to remove
                      compiler warnings and added TO DO with them to check
                      later on.
2002-08-20    adm     Created.

===========================================================================*/

#include 
#include 

#include "fs_inode.h"
#include "fs_util.h"

/* Construct new inode. */
void
fs_inode_construct (efs_inode_type *ip, fs_mode_t mode, uint32 gid, uint32 uid)
{
  int i;
  uint32 curtime;

  curtime = fs_time ();

  ip->mode = mode;
  ip->size = 0;
  ip->nlink = 0;
  ip->mtime = curtime;
  ip->ctime = curtime;
  ip->blocks = 0;
  ip->gid = gid;
  ip->uid = uid;

  /* Yes, we aren't initializing this, but merely incrementing this.  The
   * inodes are allocated as all zeros, and this will increment the
   * generation count each time the inode is newly created. */
  ip->generation++;

  for (i = 0; i < FS_DIRECT_CLUSTER_COUNT + FS_DIRECTION_LEVELS - 1; i++)
    ip->data[i] = INVALID_CLUSTER_ID;
}