当前位置: 首页>>代码示例>>C++>>正文


C++ NCP_FINFO函数代码示例

本文整理汇总了C++中NCP_FINFO函数的典型用法代码示例。如果您正苦于以下问题:C++ NCP_FINFO函数的具体用法?C++ NCP_FINFO怎么用?C++ NCP_FINFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了NCP_FINFO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ncp_update_inode

void ncp_update_inode(struct inode *inode, struct ncp_entry_info *nwinfo)
{
	ncp_update_dirent(inode, nwinfo);
	NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
	NCP_FINFO(inode)->access = nwinfo->access;
	memcpy(NCP_FINFO(inode)->file_handle, nwinfo->file_handle,
			sizeof(nwinfo->file_handle));
	DPRINTK("ncp_update_inode: updated %s, volnum=%d, dirent=%u\n",
		nwinfo->i.entryName, NCP_FINFO(inode)->volNumber,
		NCP_FINFO(inode)->dirEntNum);
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:11,代码来源:inode.c

示例2: ncp_symlink_readpage

static int ncp_symlink_readpage(struct file *file, struct page *page)
{
	struct inode *inode = page->mapping->host;
	int error, length, len;
	char *link, *rawlink;
	char *buf = kmap(page);

	error = -ENOMEM;
	rawlink = kmalloc(NCP_MAX_SYMLINK_SIZE, GFP_KERNEL);
	if (!rawlink)
		goto fail;

	if (ncp_make_open(inode,O_RDONLY))
		goto failEIO;

	error=ncp_read_kernel(NCP_SERVER(inode),NCP_FINFO(inode)->file_handle,
                         0,NCP_MAX_SYMLINK_SIZE,rawlink,&length);

	ncp_inode_close(inode);
	/* Close file handle if no other users... */
	ncp_make_closed(inode);
	if (error)
		goto failEIO;

	if (NCP_FINFO(inode)->flags & NCPI_KLUDGE_SYMLINK) {
		if (length<NCP_MIN_SYMLINK_SIZE || 
		    ((__le32 *)rawlink)[0]!=NCP_SYMLINK_MAGIC0 ||
		    ((__le32 *)rawlink)[1]!=NCP_SYMLINK_MAGIC1)
		    	goto failEIO;
		link = rawlink + 8;
		length -= 8;
	} else {
		link = rawlink;
	}

	len = NCP_MAX_SYMLINK_SIZE;
	error = ncp_vol2io(NCP_SERVER(inode), buf, &len, link, length, 0);
	kfree(rawlink);
	if (error)
		goto fail;
	SetPageUptodate(page);
	kunmap(page);
	unlock_page(page);
	return 0;

failEIO:
	error = -EIO;
	kfree(rawlink);
fail:
	SetPageError(page);
	kunmap(page);
	unlock_page(page);
	return error;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:54,代码来源:symlink.c

示例3: ncp_update_inode2

void ncp_update_inode2(struct inode* inode, struct ncp_entry_info *nwinfo)
{
	NCP_FINFO(inode)->flags = 0;
	if (!atomic_read(&NCP_FINFO(inode)->opened)) {
		NCP_FINFO(inode)->nwattr = nwinfo->i.attributes;
		ncp_update_attrs(inode, nwinfo);
	}

	ncp_update_dates(inode, &nwinfo->i);
	ncp_update_dirent(inode, nwinfo);
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:11,代码来源:inode.c

示例4: ncp_put_inode

/*
 * Defer release of inode_info and file_info structures until the inode
 * has been cleared.  This avoids a race condition allowing the inode to 
 * be put back in use before being cleared. Also, temporarily increment
 * i_count after clear_inode() so that the inode can't be reused.
 */
static void
ncp_put_inode(struct inode *inode)
{
	struct super_block	*sb	= inode->i_sb;
	struct ncp_server	*server	= NCP_SERVER(inode);
	struct ncp_inode_info	*iinfo	= NCP_INOP(inode);
        struct nw_file_info	*finfo	= NCP_FINFO(inode);

	/*
	 * This operation may block, so we lock before checking the count.
	 */
	lock_super(sb);

	if (inode->i_count > 1) {
printk("ncp_put_inode: inode in use device %s, inode %ld, count=%ld\n", 
kdevname(inode->i_dev), inode->i_ino, inode->i_count);
		goto unlock;
	}
	
	DDPRINTK("ncp_put_inode: put %s\n",
		 finfo->i.entryName);
	/*
	 * This operation should never block.
	 */
        if (S_ISDIR(inode->i_mode))
	{
                DDPRINTK("ncp_put_inode: put directory %ld\n",
			 inode->i_ino);
                ncp_invalid_dir_cache(inode);
        }                

	clear_inode(inode);

	/*
	 * After clearing the inode i_count will be 0 in 2.0.xx kernels.
	 * To keep the inode from being reused as free if we block while
	 * closing the file, increment i_count temporarily.
	 */
	inode->i_count++;

	if (finfo->opened != 0)
	{
		if (ncp_close_file(server, finfo->file_handle) != 0)
		{
			/* We can't do anything but complain. */
			printk("ncp_put_inode: could not close %s\n",
		 		finfo->i.entryName);
		}
	}

	ncp_free_inode_info(iinfo);
	inode->i_count--;
		
unlock:
	unlock_super(sb);
}
开发者ID:shattered,项目名称:linux-m68k,代码行数:62,代码来源:inode.c

示例5: printk

static struct dentry *ncp_follow_link(struct dentry *dentry,
				      struct dentry *base,
				      unsigned int follow)
{
	struct inode *inode=dentry->d_inode;
	int error, length, cnt;
	char *link;

#ifdef DEBUG
	printk("ncp_follow_link(dentry=%p,base=%p,follow=%u)\n",dentry,base,follow);
#endif

	if(!S_ISLNK(inode->i_mode)) {
		dput(base);
		return ERR_PTR(-EINVAL);
	}

	if(ncp_make_open(inode,O_RDONLY)) {
		dput(base);
		return ERR_PTR(-EIO);
	}

	for (cnt = 0; (link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1, GFP_NFS))==NULL; cnt++) {
		if (cnt > 10) {
			dput(base);
			return ERR_PTR(-EAGAIN); /* -ENOMEM? */
		}
		schedule();
	}

	error=ncp_read_kernel(NCP_SERVER(inode),NCP_FINFO(inode)->file_handle,
                         0,NCP_MAX_SYMLINK_SIZE,link,&length);

	if (error!=0 || length<NCP_MIN_SYMLINK_SIZE || 
	   ((__u32 *)link)[0]!=NCP_SYMLINK_MAGIC0 || ((__u32 *)link)[1]!=NCP_SYMLINK_MAGIC1) {
		dput(base);
		kfree(link);
		return ERR_PTR(-EIO);
	}
 
	link[length]=0;

	vol2io(NCP_SERVER(inode), link+8, 0);
	
	/* UPDATE_ATIME(inode); */
	base=lookup_dentry(link+8, base, follow);
	kfree(link);

	return base;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:50,代码来源:symlink.c

示例6: ncp_make_open

int
ncp_make_open(struct inode *i, int right)
{
    struct nw_file_info *finfo;

    if (i == NULL)
    {
        printk("ncp_make_open: got NULL inode\n");
        return -EINVAL;
    }

    finfo = NCP_FINFO(i);

    DPRINTK("ncp_make_open: dirent->opened = %d\n", finfo->opened);

    lock_super(i->i_sb);
    if (finfo->opened == 0)
    {
        finfo->access = -1;
        /* tries max. rights */
        if (ncp_open_create_file_or_subdir(NCP_SERVER(i),
                                           NULL, NULL,
                                           OC_MODE_OPEN, 0,
                                           AR_READ | AR_WRITE,
                                           finfo) == 0)
        {
            finfo->access = O_RDWR;
        }
        else if (ncp_open_create_file_or_subdir(NCP_SERVER(i),
                                                NULL, NULL,
                                                OC_MODE_OPEN, 0,
                                                AR_READ,
                                                finfo) == 0)
        {
            finfo->access = O_RDONLY;
        }
    }

    unlock_super(i->i_sb);

    if (   ((right == O_RDONLY) && (   (finfo->access == O_RDONLY)
                                       || (finfo->access == O_RDWR)))
            || ((right == O_WRONLY) && (   (finfo->access == O_WRONLY)
                                           || (finfo->access == O_RDWR)))
            || ((right == O_RDWR)   && (finfo->access == O_RDWR)))
        return 0;

    return -EACCES;
}
开发者ID:liexusong,项目名称:linux2.0-comment,代码行数:49,代码来源:file.c

示例7: ncp_update_attrs

static void ncp_update_attrs(struct inode *inode, struct ncp_entry_info *nwinfo)
{
	struct nw_info_struct *nwi = &nwinfo->i;
	struct ncp_server *server = NCP_SERVER(inode);

	if (nwi->attributes & aDIR) {
		inode->i_mode = server->m.dir_mode;
		/* for directories dataStreamSize seems to be some
		   Object ID ??? */
		i_size_write(inode, NCP_BLOCK_SIZE);
	} else {
		u32 size;

		inode->i_mode = server->m.file_mode;
		size = le32_to_cpu(nwi->dataStreamSize);
		i_size_write(inode, size);
#ifdef CONFIG_NCPFS_EXTRAS
		if ((server->m.flags & (NCP_MOUNT_EXTRAS|NCP_MOUNT_SYMLINKS)) 
		 && (nwi->attributes & aSHARED)) {
			switch (nwi->attributes & (aHIDDEN|aSYSTEM)) {
				case aHIDDEN:
					if (server->m.flags & NCP_MOUNT_SYMLINKS) {
						if (/* (size >= NCP_MIN_SYMLINK_SIZE)
						 && */ (size <= NCP_MAX_SYMLINK_SIZE)) {
							inode->i_mode = (inode->i_mode & ~S_IFMT) | S_IFLNK;
							NCP_FINFO(inode)->flags |= NCPI_KLUDGE_SYMLINK;
							break;
						}
					}
					/* FALLTHROUGH */
				case 0:
					if (server->m.flags & NCP_MOUNT_EXTRAS)
						inode->i_mode |= S_IRUGO;
					break;
				case aSYSTEM:
					if (server->m.flags & NCP_MOUNT_EXTRAS)
						inode->i_mode |= (inode->i_mode >> 2) & S_IXUGO;
					break;
				/* case aSYSTEM|aHIDDEN: */
				default:
					/* reserved combination */
					break;
			}
		}
#endif
	}
	if (nwi->attributes & aRONLY) inode->i_mode &= ~S_IWUGO;
}
开发者ID:kprog,项目名称:linux,代码行数:48,代码来源:inode.c

示例8: ncp_set_attr

/*
 * Fill in the inode based on the ncp_entry_info structure.
 */
static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
{
	struct ncp_server *server = NCP_SERVER(inode);

	NCP_FINFO(inode)->flags = 0;
	
	ncp_update_attrs(inode, nwinfo);

	DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode);

	inode->i_nlink = 1;
	inode->i_uid = server->m.uid;
	inode->i_gid = server->m.gid;

	ncp_update_dates(inode, &nwinfo->i);
	ncp_update_inode(inode, nwinfo);
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:20,代码来源:inode.c

示例9: ncp_symlink

int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) {
	int i,length;
	struct inode *inode;
	char *link;

#ifdef DEBUG
	printk("ncp_symlink(dir=%p,dentry=%p,symname=%s)\n",dir,dentry,symname);
#endif

	if (!(NCP_SERVER(dir)->m.flags & NCP_MOUNT_SYMLINKS))
		return -EPERM;	/* EPERM is returned by VFS if symlink procedure does not exist */

	if ((length=strlen(symname))>NCP_MAX_SYMLINK_SIZE)
		return -EINVAL;

	if ((link=(char *)kmalloc(length+9,GFP_NFS))==NULL)
		return -ENOMEM;

	if (ncp_create_new(dir,dentry,0,aSHARED|aHIDDEN)) {
		kfree(link);
		return -EIO;
	}

	inode=dentry->d_inode;

	((__u32 *)link)[0]=NCP_SYMLINK_MAGIC0;
	((__u32 *)link)[1]=NCP_SYMLINK_MAGIC1;
	memcpy(link+8, symname, length+1); /* including last zero for io2vol */

	/* map to/from server charset, do not touch upper/lower case as
	   symlink can point out of ncp filesystem */
	io2vol(NCP_SERVER(inode), link+8, 0);
	
	if(ncp_write_kernel(NCP_SERVER(inode), NCP_FINFO(inode)->file_handle, 
	    		    0, length+8, link, &i) || i!=length+8) {
		kfree(link);
		return -EIO;
	}

	kfree(link);
	return 0;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:42,代码来源:symlink.c

示例10: ncp_iget

/*
 * Get a new inode.
 */
struct inode * 
ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
{
	struct inode *inode;

	if (info == NULL) {
		printk(KERN_ERR "ncp_iget: info is NULL\n");
		return NULL;
	}

	inode = new_inode(sb);
	if (inode) {
		atomic_set(&NCP_FINFO(inode)->opened, info->opened);

		inode->i_mapping->backing_dev_info = sb->s_bdi;
		inode->i_ino = info->ino;
		ncp_set_attr(inode, info);
		if (S_ISREG(inode->i_mode)) {
			inode->i_op = &ncp_file_inode_operations;
			inode->i_fop = &ncp_file_operations;
		} else if (S_ISDIR(inode->i_mode)) {
			inode->i_op = &ncp_dir_inode_operations;
			inode->i_fop = &ncp_dir_operations;
#ifdef CONFIG_NCPFS_NFS_NS
		} else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) {
			init_special_inode(inode, inode->i_mode,
				new_decode_dev(info->i.nfs.rdev));
#endif
#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
		} else if (S_ISLNK(inode->i_mode)) {
			inode->i_op = &ncp_symlink_inode_operations;
			inode->i_data.a_ops = &ncp_symlink_aops;
#endif
		} else {
			make_bad_inode(inode);
		}
		insert_inode_hash(inode);
	} else
		printk(KERN_ERR "ncp_iget: iget failed!\n");
	return inode;
}
开发者ID:kprog,项目名称:linux,代码行数:44,代码来源:inode.c

示例11: ncp_readlink

static int ncp_readlink(struct dentry * dentry, char * buffer, int buflen)
{
	struct inode *inode=dentry->d_inode;
	char *link;
	int length,error;

#ifdef DEBUG
	printk("ncp_readlink(dentry=%p,buffer=%p,buflen=%d)\n",dentry,buffer,buflen);
#endif

	if(!S_ISLNK(inode->i_mode))
		return -EINVAL;

	if(ncp_make_open(inode,O_RDONLY))
		return -EIO;

	if((link=(char *)kmalloc(NCP_MAX_SYMLINK_SIZE+1,GFP_NFS))==NULL)
		return -ENOMEM;

	error = ncp_read_kernel(NCP_SERVER(inode),NCP_FINFO(inode)->file_handle,
		0,NCP_MAX_SYMLINK_SIZE,link,&length);

	if (error!=0 || length < NCP_MIN_SYMLINK_SIZE || buflen < (length-8) ||
	   ((__u32 *)link)[0]!=NCP_SYMLINK_MAGIC0 ||((__u32 *)link)[1]!=NCP_SYMLINK_MAGIC1) {
	   	error = -EIO;
		goto out;
	}

	link[length] = 0;

	vol2io(NCP_SERVER(inode), link+8, 0);
	
	error = length - 8;
	if(copy_to_user(buffer, link+8, error))
		error = -EFAULT;
      
out:;
	kfree(link);
	return error;
}
开发者ID:chinnyannieb,项目名称:empeg-hijack,代码行数:40,代码来源:symlink.c

示例12: ncp_file_write

static ssize_t
ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
	struct dentry *dentry = file->f_path.dentry;
	struct inode *inode = dentry->d_inode;
	size_t already_written = 0;
	off_t pos;
	size_t bufsize;
	int errno;
	void* bouncebuffer;

	DPRINTK("ncp_file_write: enter %s/%s\n",
		dentry->d_parent->d_name.name, dentry->d_name.name);
	if ((ssize_t) count < 0)
		return -EINVAL;
	pos = *ppos;
	if (file->f_flags & O_APPEND) {
		pos = i_size_read(inode);
	}

	if (pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
		if (pos >= MAX_NON_LFS) {
			return -EFBIG;
		}
		if (count > MAX_NON_LFS - (u32)pos) {
			count = MAX_NON_LFS - (u32)pos;
		}
	}
	if (pos >= inode->i_sb->s_maxbytes) {
		if (count || pos > inode->i_sb->s_maxbytes) {
			return -EFBIG;
		}
	}
	if (pos + count > inode->i_sb->s_maxbytes) {
		count = inode->i_sb->s_maxbytes - pos;
	}
	
	if (!count)
		return 0;
	errno = ncp_make_open(inode, O_WRONLY);
	if (errno) {
		DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno);
		return errno;
	}
	bufsize = NCP_SERVER(inode)->buffer_size;

	already_written = 0;

	bouncebuffer = vmalloc(bufsize);
	if (!bouncebuffer) {
		errno = -EIO;	/* -ENOMEM */
		goto outrel;
	}
	while (already_written < count) {
		int written_this_time;
		size_t to_write = min_t(unsigned int,
				      bufsize - (pos % bufsize),
				      count - already_written);

		if (copy_from_user(bouncebuffer, buf, to_write)) {
			errno = -EFAULT;
			break;
		}
		if (ncp_write_kernel(NCP_SERVER(inode), 
		    NCP_FINFO(inode)->file_handle,
		    pos, to_write, bouncebuffer, &written_this_time) != 0) {
			errno = -EIO;
			break;
		}
		pos += written_this_time;
		buf += written_this_time;
		already_written += written_this_time;

		if (written_this_time != to_write) {
			break;
		}
	}
	vfree(bouncebuffer);

	file_update_time(file);

	*ppos = pos;

	if (pos > i_size_read(inode)) {
		mutex_lock(&inode->i_mutex);
		if (pos > i_size_read(inode))
			i_size_write(inode, pos);
		mutex_unlock(&inode->i_mutex);
	}
	DPRINTK("ncp_file_write: exit %s/%s\n",
		dentry->d_parent->d_name.name, dentry->d_name.name);
outrel:
	ncp_inode_close(inode);		
	return already_written ? already_written : errno;
}
开发者ID:Adjustxx,项目名称:Savaged-Zen,代码行数:95,代码来源:file.c

示例13: ncp_update_dirent

/*
 * Fill in the ncpfs-specific information in the inode.
 */
static void ncp_update_dirent(struct inode *inode, struct ncp_entry_info *nwinfo)
{
	NCP_FINFO(inode)->DosDirNum = nwinfo->i.DosDirNum;
	NCP_FINFO(inode)->dirEntNum = nwinfo->i.dirEntNum;
	NCP_FINFO(inode)->volNumber = nwinfo->volume;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:9,代码来源:inode.c

示例14: ncp_i_callback

static void ncp_i_callback(struct rcu_head *head)
{
	struct inode *inode = container_of(head, struct inode, i_rcu);
	kmem_cache_free(ncp_inode_cachep, NCP_FINFO(inode));
}
开发者ID:kprog,项目名称:linux,代码行数:5,代码来源:inode.c

示例15: ncp_file_read_iter

static ssize_t
ncp_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
{
	struct file *file = iocb->ki_filp;
	struct inode *inode = file_inode(file);
	size_t already_read = 0;
	off_t pos = iocb->ki_pos;
	size_t bufsize;
	int error;
	void *freepage;
	size_t freelen;

	ncp_dbg(1, "enter %pD2\n", file);

	if (!iov_iter_count(to))
		return 0;
	if (pos > inode->i_sb->s_maxbytes)
		return 0;
	iov_iter_truncate(to, inode->i_sb->s_maxbytes - pos);

	error = ncp_make_open(inode, O_RDONLY);
	if (error) {
		ncp_dbg(1, "open failed, error=%d\n", error);
		return error;
	}

	bufsize = NCP_SERVER(inode)->buffer_size;

	error = -EIO;
	freelen = ncp_read_bounce_size(bufsize);
	freepage = vmalloc(freelen);
	if (!freepage)
		goto outrel;
	error = 0;
	/* First read in as much as possible for each bufsize. */
	while (iov_iter_count(to)) {
		int read_this_time;
		size_t to_read = min_t(size_t,
				     bufsize - (pos % bufsize),
				     iov_iter_count(to));

		error = ncp_read_bounce(NCP_SERVER(inode),
			 	NCP_FINFO(inode)->file_handle,
				pos, to_read, to, &read_this_time, 
				freepage, freelen);
		if (error) {
			error = -EIO;	/* NW errno -> Linux errno */
			break;
		}
		pos += read_this_time;
		already_read += read_this_time;

		if (read_this_time != to_read)
			break;
	}
	vfree(freepage);

	iocb->ki_pos = pos;

	file_accessed(file);

	ncp_dbg(1, "exit %pD2\n", file);
outrel:
	ncp_inode_close(inode);		
	return already_read ? already_read : error;
}
开发者ID:19Dan01,项目名称:linux,代码行数:66,代码来源:file.c


注:本文中的NCP_FINFO函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。