本文整理汇总了C++中dbstart函数的典型用法代码示例。如果您正苦于以下问题:C++ dbstart函数的具体用法?C++ dbstart怎么用?C++ dbstart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbstart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unionfs_reinterpose
/* like interpose above, but for an already existing dentry */
void unionfs_reinterpose(struct dentry *dentry)
{
struct dentry *lower_dentry;
struct inode *inode;
int bindex, bstart, bend;
verify_locked(dentry);
/* This is pre-allocated inode */
inode = dentry->d_inode;
bstart = dbstart(dentry);
bend = dbend(dentry);
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!lower_dentry)
continue;
if (!lower_dentry->d_inode)
continue;
if (unionfs_lower_inode_idx(inode, bindex))
continue;
unionfs_set_lower_inode_idx(inode, bindex,
igrab(lower_dentry->d_inode));
}
ibstart(inode) = dbstart(dentry);
ibend(inode) = dbend(dentry);
}
示例2: __set_dentry
/* set lower dentry ptr and update bstart & bend if necessary */
static void __set_dentry(struct dentry *upper, struct dentry *lower,
int bindex)
{
unionfs_set_lower_dentry_idx(upper, bindex, lower);
if (likely(dbstart(upper) > bindex))
dbstart(upper) = bindex;
if (likely(dbend(upper) < bindex))
dbend(upper) = bindex;
}
示例3: unionfs_ioctl_queryfile
/*
* return to user-space the branch indices containing the file in question
*
* We use fd_set and therefore we are limited to the number of the branches
* to FD_SETSIZE, which is currently 1024 - plenty for most people
*/
static int unionfs_ioctl_queryfile(struct file *file, struct dentry *parent,
unsigned int cmd, unsigned long arg)
{
int err = 0;
fd_set branchlist;
int bstart = 0, bend = 0, bindex = 0;
int orig_bstart, orig_bend;
struct dentry *dentry, *lower_dentry;
struct vfsmount *mnt;
dentry = file->f_path.dentry;
orig_bstart = dbstart(dentry);
orig_bend = dbend(dentry);
err = unionfs_partial_lookup(dentry, parent);
if (err)
goto out;
bstart = dbstart(dentry);
bend = dbend(dentry);
FD_ZERO(&branchlist);
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!lower_dentry)
continue;
if (likely(lower_dentry->d_inode))
FD_SET(bindex, &branchlist);
/* purge any lower objects after partial_lookup */
if (bindex < orig_bstart || bindex > orig_bend) {
dput(lower_dentry);
unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
iput(unionfs_lower_inode_idx(dentry->d_inode, bindex));
unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
NULL);
mnt = unionfs_lower_mnt_idx(dentry, bindex);
if (!mnt)
continue;
unionfs_mntput(dentry, bindex);
unionfs_set_lower_mnt_idx(dentry, bindex, NULL);
}
}
/* restore original dentry's offsets */
dbstart(dentry) = orig_bstart;
dbend(dentry) = orig_bend;
ibstart(dentry->d_inode) = orig_bstart;
ibend(dentry->d_inode) = orig_bend;
err = copy_to_user((void __user *)arg, &branchlist, sizeof(fd_set));
if (unlikely(err))
err = -EFAULT;
out:
return err < 0 ? err : bend;
}
示例4: unionfs_rmdir
int unionfs_rmdir(struct inode *dir, struct dentry *dentry)
{
int err = 0;
struct unionfs_dir_state *namelist = NULL;
print_entry_location();
lock_dentry(dentry);
fist_print_dentry("IN unionfs_rmdir: ", dentry);
/* check if this unionfs directory is empty or not */
err = check_empty(dentry, &namelist);
if (err) {
goto out;
}
if (IS_SET(dir->i_sb, DELETE_WHITEOUT)) {
/* Delete the first directory. */
err = unionfs_rmdir_first(dir, dentry, namelist);
/* create whiteout */
if (!err) {
err = create_whiteout(dentry, dbstart(dentry));
} else {
int new_err;
if (dbstart(dentry) == 0)
goto out;
/* exit if the error returned was NOT -EROFS */
if (!IS_COPYUP_ERR(err))
goto out;
new_err = create_whiteout(dentry, dbstart(dentry) - 1);
if (new_err != -EEXIST)
err = new_err;
}
} else {
/* delete all. */
err = unionfs_rmdir_all(dir, dentry, namelist);
}
out:
/* call d_drop so the system "forgets" about us */
if (!err)
d_drop(dentry);
if (namelist)
free_rdstate(namelist);
unlock_dentry(dentry);
print_exit_status(err);
return err;
}
示例5: unionfs_fill_inode
static void unionfs_fill_inode(struct dentry *dentry,
struct inode *inode)
{
struct inode *lower_inode;
struct dentry *lower_dentry;
int bindex, bstart, bend;
bstart = dbstart(dentry);
bend = dbend(dentry);
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!lower_dentry) {
unionfs_set_lower_inode_idx(inode, bindex, NULL);
continue;
}
/* Initialize the lower inode to the new lower inode. */
if (!lower_dentry->d_inode)
continue;
unionfs_set_lower_inode_idx(inode, bindex,
igrab(lower_dentry->d_inode));
}
ibstart(inode) = dbstart(dentry);
ibend(inode) = dbend(dentry);
/* Use attributes from the first branch. */
lower_inode = unionfs_lower_inode(inode);
/* Use different set of inode ops for symlinks & directories */
if (S_ISLNK(lower_inode->i_mode))
inode->i_op = &unionfs_symlink_iops;
else if (S_ISDIR(lower_inode->i_mode))
inode->i_op = &unionfs_dir_iops;
/* Use different set of file ops for directories */
if (S_ISDIR(lower_inode->i_mode))
inode->i_fop = &unionfs_dir_fops;
/* properly initialize special inodes */
if (S_ISBLK(lower_inode->i_mode) || S_ISCHR(lower_inode->i_mode) ||
S_ISFIFO(lower_inode->i_mode) || S_ISSOCK(lower_inode->i_mode))
init_special_inode(inode, lower_inode->i_mode,
lower_inode->i_rdev);
/* all well, copy inode attributes */
unionfs_copy_attr_all(inode, lower_inode);
fsstack_copy_inode_size(inode, lower_inode);
}
示例6: __open_dir
/* unionfs_open helper function: open a directory */
static int __open_dir(struct inode *inode, struct file *file)
{
struct dentry *lower_dentry;
struct file *lower_file;
int bindex, bstart, bend;
struct vfsmount *mnt;
bstart = fbstart(file) = dbstart(file->f_path.dentry);
bend = fbend(file) = dbend(file->f_path.dentry);
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry =
unionfs_lower_dentry_idx(file->f_path.dentry, bindex);
if (!lower_dentry)
continue;
dget(lower_dentry);
unionfs_mntget(file->f_path.dentry, bindex);
mnt = unionfs_lower_mnt_idx(file->f_path.dentry, bindex);
lower_file = dentry_open(lower_dentry, mnt, file->f_flags,
current_cred());
if (IS_ERR(lower_file))
return PTR_ERR(lower_file);
unionfs_set_lower_file_idx(file, bindex, lower_file);
/*
* The branchget goes after the open, because otherwise
* we would miss the reference on release.
*/
branchget(inode->i_sb, bindex);
}
return 0;
}
示例7: open_all_files
/* open all lower files for a given file */
static int open_all_files(struct file *file)
{
int bindex, bstart, bend, err = 0;
struct file *lower_file;
struct dentry *lower_dentry;
struct dentry *dentry = file->f_path.dentry;
struct super_block *sb = dentry->d_sb;
bstart = dbstart(dentry);
bend = dbend(dentry);
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!lower_dentry)
continue;
dget(lower_dentry);
unionfs_mntget(dentry, bindex);
branchget(sb, bindex);
lower_file =
dentry_open(lower_dentry,
unionfs_lower_mnt_idx(dentry, bindex),
file->f_flags, current_cred());
if (IS_ERR(lower_file)) {
branchput(sb, bindex);
err = PTR_ERR(lower_file);
goto out;
} else {
unionfs_set_lower_file_idx(file, bindex, lower_file);
}
}
out:
return err;
}
示例8: update_bstart
/*
* scan through the lower dentry objects, and set bstart to reflect the
* starting branch
*/
void update_bstart(struct dentry *dentry)
{
int bindex;
int bstart = dbstart(dentry);
int bend = dbend(dentry);
struct dentry *lower_dentry;
for (bindex = bstart; bindex <= bend; bindex++) {
lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
if (!lower_dentry)
continue;
if (lower_dentry->d_inode) {
dbstart(dentry) = bindex;
break;
}
dput(lower_dentry);
unionfs_set_lower_dentry_idx(dentry, bindex, NULL);
}
}
示例9: __clear
/*
* dput the lower references for old and new dentry & clear a lower dentry
* pointer
*/
static void __clear(struct dentry *dentry, struct dentry *old_lower_dentry,
int old_bstart, int old_bend,
struct dentry *new_lower_dentry, int new_bindex)
{
/* get rid of the lower dentry and all its traces */
unionfs_set_lower_dentry_idx(dentry, new_bindex, NULL);
dbstart(dentry) = old_bstart;
dbend(dentry) = old_bend;
dput(new_lower_dentry);
dput(old_lower_dentry);
}
示例10: epilog
static void epilog(struct inode *dir, struct dentry *dentry,
aufs_bindex_t bindex)
{
d_drop(dentry);
dentry->d_inode->i_ctime = dir->i_ctime;
if (atomic_read(&dentry->d_count) == 1) {
set_h_dptr(dentry, dbstart(dentry), NULL);
au_update_dbstart(dentry);
}
if (ibstart(dir) == bindex)
au_cpup_attr_timesizes(dir);
dir->i_version++;
}
示例11: unionfs_postcopyup_release
/*
* Post-copyup helper to release all non-directory source objects of a
* copied-up file. Regular files should have only one lower object.
*/
void unionfs_postcopyup_release(struct dentry *dentry)
{
int bstart, bend;
BUG_ON(S_ISDIR(dentry->d_inode->i_mode));
bstart = dbstart(dentry);
bend = dbend(dentry);
path_put_lowers(dentry, bstart + 1, bend, false);
iput_lowers(dentry->d_inode, bstart + 1, bend, false);
dbend(dentry) = bstart;
ibend(dentry->d_inode) = ibstart(dentry->d_inode) = bstart;
}
示例12: may_rename_dir
/*
* We can't copyup a directory, because it may involve huge numbers of
* children, etc. Doing that in the kernel would be bad, so instead we
* return EXDEV to the user-space utility that caused this, and let the
* user-space recurse and ask us to copy up each file separately.
*/
static int may_rename_dir(struct dentry *dentry, struct dentry *parent)
{
int err, bstart;
err = check_empty(dentry, parent, NULL);
if (err == -ENOTEMPTY) {
if (is_robranch(dentry))
return -EXDEV;
} else if (err) {
return err;
}
bstart = dbstart(dentry);
if (dbend(dentry) == bstart || dbopaque(dentry) == bstart)
return 0;
dbstart(dentry) = bstart + 1;
err = check_empty(dentry, parent, NULL);
dbstart(dentry) = bstart;
if (err == -ENOTEMPTY)
err = -EXDEV;
return err;
}
示例13: unionfs_read_lock
/*
* unionfs_lookup is the only special function which takes a dentry, yet we
* do NOT want to call __unionfs_d_revalidate_chain because by definition,
* we don't have a valid dentry here yet.
*/
static struct dentry *unionfs_lookup(struct inode *dir,
struct dentry *dentry,
/* XXX: pass flags to lower? */
unsigned int flags_unused)
{
struct dentry *ret, *parent;
int err = 0;
unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
parent = unionfs_lock_parent(dentry, UNIONFS_DMUTEX_PARENT);
/*
* As long as we lock/dget the parent, then can skip validating the
* parent now; we may have to rebuild this dentry on the next
* ->d_revalidate, however.
*/
/* allocate dentry private data. We free it in ->d_release */
err = new_dentry_private_data(dentry, UNIONFS_DMUTEX_CHILD);
if (unlikely(err)) {
ret = ERR_PTR(err);
goto out;
}
ret = unionfs_lookup_full(dentry, parent, INTERPOSE_LOOKUP);
if (!IS_ERR(ret)) {
if (ret)
dentry = ret;
/* lookup_full can return multiple positive dentries */
if (dentry->d_inode && !S_ISDIR(dentry->d_inode->i_mode)) {
BUG_ON(dbstart(dentry) < 0);
unionfs_postcopyup_release(dentry);
}
unionfs_copy_attr_times(dentry->d_inode);
}
unionfs_check_inode(dir);
if (!IS_ERR(ret))
unionfs_check_dentry(dentry);
unionfs_check_dentry(parent);
unionfs_unlock_dentry(dentry); /* locked in new_dentry_private data */
out:
unionfs_unlock_parent(dentry, parent);
unionfs_read_unlock(dentry->d_sb);
return ret;
}
示例14: do_delayed_copyup
/* perform a delayed copyup of a read-write file on a read-only branch */
static int do_delayed_copyup(struct file *file, struct dentry *parent)
{
int bindex, bstart, bend, err = 0;
struct dentry *dentry = file->f_path.dentry;
struct inode *parent_inode = parent->d_inode;
bstart = fbstart(file);
bend = fbend(file);
BUG_ON(!S_ISREG(dentry->d_inode->i_mode));
unionfs_check_file(file);
for (bindex = bstart - 1; bindex >= 0; bindex--) {
if (!d_deleted(dentry))
err = copyup_file(parent_inode, file, bstart,
bindex,
i_size_read(dentry->d_inode));
else
err = copyup_deleted_file(file, dentry, parent,
bstart, bindex);
/* if succeeded, set lower open-file flags and break */
if (!err) {
struct file *lower_file;
lower_file = unionfs_lower_file_idx(file, bindex);
lower_file->f_flags = file->f_flags;
break;
}
}
if (err || (bstart <= fbstart(file)))
goto out;
bend = fbend(file);
for (bindex = bstart; bindex <= bend; bindex++) {
if (unionfs_lower_file_idx(file, bindex)) {
branchput(dentry->d_sb, bindex);
fput(unionfs_lower_file_idx(file, bindex));
unionfs_set_lower_file_idx(file, bindex, NULL);
}
}
path_put_lowers(dentry, bstart, bend, false);
iput_lowers(dentry->d_inode, bstart, bend, false);
/* for reg file, we only open it "once" */
fbend(file) = fbstart(file);
dbend(dentry) = dbstart(dentry);
ibend(dentry->d_inode) = ibstart(dentry->d_inode);
out:
unionfs_check_file(file);
return err;
}
示例15: __cleanup_dentry
/* purge a dentry's lower-branch states (dput/mntput, etc.) */
static void __cleanup_dentry(struct dentry *dentry, int bindex,
int old_bstart, int old_bend)
{
int loop_start;
int loop_end;
int new_bstart = -1;
int new_bend = -1;
int i;
loop_start = min(old_bstart, bindex);
loop_end = max(old_bend, bindex);
/*
* This loop sets the bstart and bend for the new dentry by
* traversing from left to right. It also dputs all negative
* dentries except bindex
*/
for (i = loop_start; i <= loop_end; i++) {
if (!unionfs_lower_dentry_idx(dentry, i))
continue;
if (i == bindex) {
new_bend = i;
if (new_bstart < 0)
new_bstart = i;
continue;
}
if (!unionfs_lower_dentry_idx(dentry, i)->d_inode) {
dput(unionfs_lower_dentry_idx(dentry, i));
unionfs_set_lower_dentry_idx(dentry, i, NULL);
unionfs_mntput(dentry, i);
unionfs_set_lower_mnt_idx(dentry, i, NULL);
} else {
if (new_bstart < 0)
new_bstart = i;
new_bend = i;
}
}
if (new_bstart < 0)
new_bstart = bindex;
if (new_bend < 0)
new_bend = bindex;
dbstart(dentry) = new_bstart;
dbend(dentry) = new_bend;
}