コード例 #1
0
ファイル: dir.c プロジェクト: rohsaini/mkunity
static int nfs_symlink(struct inode *dir, const char *name, int len,
		       const char *symname)
{
	struct nfs_sattr sattr;
	int error;

	if (!dir || !S_ISDIR(dir->i_mode)) {
		printk("nfs_symlink: inode is NULL or not a directory\n");
		iput(dir);
		return -ENOENT;
	}
	if (len > NFS_MAXNAMLEN) {
		iput(dir);
		return -ENAMETOOLONG;
	}
	if (strlen(symname) > NFS_MAXPATHLEN) {
		iput(dir);
		return -ENAMETOOLONG;
	}
	sattr.mode = S_IFLNK | S_IRWXUGO; /* SunOS 4.1.2 crashes without this! */
	sattr.uid = sattr.gid = sattr.size = (unsigned) -1;
	sattr.atime.seconds = sattr.mtime.seconds = (unsigned) -1;
	error = nfs_proc_symlink(NFS_SERVER(dir), NFS_FH(dir),
		name, symname, &sattr);
	iput(dir);
	return error;
}
コード例 #2
0
ファイル: nfs_proc.c プロジェクト: aunali1/exopc
int 
nfs_symlink(struct file *dir_filp, 
	   const char *name,const char *to) {
  struct nfs_fh *dhandle;

  struct nfs_sattr temp_sattr;

  int status;

  DPRINTF(CLU_LEVEL,("nfs_symlink:\n"));
  demand(dir_filp, bogus dir_filp);

  dhandle = GETFHANDLE(dir_filp);

  temp_sattr.mode = 0100666; 
  temp_sattr.uid  = __current->uid;
  temp_sattr.gid  = __current->egid;
  temp_sattr.size = strlen(to);
  temp_sattr.atime.seconds  = -1;
  temp_sattr.atime.useconds = -1;
  temp_sattr.mtime.seconds  = -1;
  temp_sattr.mtime.useconds = -1;
  status = nfs_proc_symlink(dhandle,
			    name,
			    to,
			    &temp_sattr);
  
  if (status == 0) {
    nfs_flush_filp(dir_filp);
    nfs_cache_remove(dir_filp,name);
    return 0;
  } else {
      errno = status; return -1;
  }
}