Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
{
int error;
struct fd arg = fdget(fd);
{
int error;
struct fd arg = fdget(fd);
- struct osf_dirent_callback buf;
+ struct osf_dirent_callback buf = {
+ .ctx.actor = osf_filldir,
+ .dirent = dirent,
+ .basep = basep,
+ .count = count
+ };
if (!arg.file)
return -EBADF;
if (!arg.file)
return -EBADF;
- buf.dirent = dirent;
- buf.basep = basep;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = osf_filldir;
-
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
{
struct fd arg;
struct hpux_dirent __user * lastdirent;
{
struct fd arg;
struct hpux_dirent __user * lastdirent;
- struct getdents_callback buf;
+ struct getdents_callback buf = {
+ .ctx.actor = filldir,
+ .current_dir = dirent,
+ .count = count
+ };
int error;
arg = fdget(fd);
if (!arg.file)
return -EBADF;
int error;
arg = fdget(fd);
if (!arg.file)
return -EBADF;
- buf.current_dir = dirent;
- buf.previous = NULL;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = filldir;
-
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(arg.file, &buf.ctx);
if (error >= 0)
error = buf.error;
{
int error;
struct fd f = fdget(fd);
{
int error;
struct fd f = fdget(fd);
- struct compat_readdir_callback buf;
+ struct compat_readdir_callback buf = {
+ .ctx.actor = compat_fillonedir,
+ .dirent = dirent
+ };
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.result = 0;
- buf.dirent = dirent;
- buf.ctx.actor = compat_fillonedir;
-
error = iterate_dir(f.file, &buf.ctx);
if (buf.result)
error = buf.result;
error = iterate_dir(f.file, &buf.ctx);
if (buf.result)
error = buf.result;
{
struct fd f;
struct compat_linux_dirent __user * lastdirent;
{
struct fd f;
struct compat_linux_dirent __user * lastdirent;
- struct compat_getdents_callback buf;
+ struct compat_getdents_callback buf = {
+ .ctx.actor = compat_filldir,
+ .current_dir = dirent,
+ .count = count
+ };
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.current_dir = dirent;
- buf.previous = NULL;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = compat_filldir;
-
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
{
struct fd f;
struct linux_dirent64 __user * lastdirent;
{
struct fd f;
struct linux_dirent64 __user * lastdirent;
- struct compat_getdents_callback64 buf;
+ struct compat_getdents_callback64 buf = {
+ .ctx.actor = compat_filldir64,
+ .current_dir = dirent,
+ .count = count
+ };
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.current_dir = dirent;
- buf.previous = NULL;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = compat_filldir64;
-
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
struct inode *dir = path->dentry->d_inode;
int error;
struct file *file;
struct inode *dir = path->dentry->d_inode;
int error;
struct file *file;
- struct getdents_callback buffer;
+ struct getdents_callback buffer = {
+ .ctx.actor = filldir_one,
+ .name = name,
+ .ino = child->d_inode->i_ino
+ };
error = -ENOTDIR;
if (!dir || !S_ISDIR(dir->i_mode))
error = -ENOTDIR;
if (!dir || !S_ISDIR(dir->i_mode))
if (!file->f_op->iterate)
goto out_close;
if (!file->f_op->iterate)
goto out_close;
- buffer.name = name;
- buffer.ino = child->d_inode->i_ino;
- buffer.found = 0;
- buffer.ctx.actor = filldir_one;
while (1) {
int old_seq = buffer.sequence;
while (1) {
int old_seq = buffer.sequence;
struct inode *dir = parent->d_inode;
struct inode *inode = child->d_inode;
struct gfs2_inode *dip, *ip;
struct inode *dir = parent->d_inode;
struct inode *inode = child->d_inode;
struct gfs2_inode *dip, *ip;
- struct get_name_filldir gnfd;
+ struct get_name_filldir gnfd = {
+ .ctx.actor = get_name_filldir,
+ .name = name
+ };
struct gfs2_holder gh;
int error;
struct file_ra_state f_ra = { .start = 0 };
struct gfs2_holder gh;
int error;
struct file_ra_state f_ra = { .start = 0 };
*name = 0;
gnfd.inum.no_addr = ip->i_no_addr;
gnfd.inum.no_formal_ino = ip->i_no_formal_ino;
*name = 0;
gnfd.inum.no_addr = ip->i_no_addr;
gnfd.inum.no_formal_ino = ip->i_no_formal_ino;
- gnfd.name = name;
- gnfd.ctx.actor = get_name_filldir;
- gnfd.ctx.pos = 0;
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh);
if (error)
error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh);
if (error)
{
const struct cred *original_cred;
struct dentry *dir = nn->rec_file->f_path.dentry;
{
const struct cred *original_cred;
struct dentry *dir = nn->rec_file->f_path.dentry;
- struct nfs4_dir_ctx ctx;
+ struct nfs4_dir_ctx ctx = {
+ .ctx.actor = nfsd4_build_namelist,
+ .names = LIST_HEAD_INIT(ctx.names)
+ };
int status;
status = nfs4_save_creds(&original_cred);
int status;
status = nfs4_save_creds(&original_cred);
- INIT_LIST_HEAD(&ctx.names);
- ctx.ctx.actor = nfsd4_build_namelist;
status = iterate_dir(nn->rec_file, &ctx.ctx);
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
while (!list_empty(&ctx.names)) {
status = iterate_dir(nn->rec_file, &ctx.ctx);
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
while (!list_empty(&ctx.names)) {
static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
struct readdir_cd *cdp, loff_t *offsetp)
{
static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
struct readdir_cd *cdp, loff_t *offsetp)
{
- struct readdir_data buf;
struct buffered_dirent *de;
int host_err;
int size;
loff_t offset;
struct buffered_dirent *de;
int host_err;
int size;
loff_t offset;
+ struct readdir_data buf = {
+ .ctx.actor = nfsd_buffered_filldir,
+ .dirent = (void *)__get_free_page(GFP_KERNEL)
+ };
- buf.ctx.actor = nfsd_buffered_filldir;
- buf.dirent = (void *)__get_free_page(GFP_KERNEL);
if (!buf.dirent)
return nfserrno(-ENOMEM);
if (!buf.dirent)
return nfserrno(-ENOMEM);
{
int error;
struct fd f = fdget(fd);
{
int error;
struct fd f = fdget(fd);
- struct readdir_callback buf;
+ struct readdir_callback buf = {
+ .ctx.actor = fillonedir,
+ .dirent = dirent
+ };
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.ctx.actor = fillonedir;
- buf.result = 0;
- buf.dirent = dirent;
-
error = iterate_dir(f.file, &buf.ctx);
if (buf.result)
error = buf.result;
error = iterate_dir(f.file, &buf.ctx);
if (buf.result)
error = buf.result;
{
struct fd f;
struct linux_dirent __user * lastdirent;
{
struct fd f;
struct linux_dirent __user * lastdirent;
- struct getdents_callback buf;
+ struct getdents_callback buf = {
+ .ctx.actor = filldir,
+ .count = count,
+ .current_dir = dirent
+ };
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.current_dir = dirent;
- buf.previous = NULL;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = filldir;
-
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
{
struct fd f;
struct linux_dirent64 __user * lastdirent;
{
struct fd f;
struct linux_dirent64 __user * lastdirent;
- struct getdents_callback64 buf;
+ struct getdents_callback64 buf = {
+ .ctx.actor = filldir64,
+ .count = count,
+ .current_dir = dirent
+ };
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
int error;
if (!access_ok(VERIFY_WRITE, dirent, count))
if (!f.file)
return -EBADF;
if (!f.file)
return -EBADF;
- buf.current_dir = dirent;
- buf.previous = NULL;
- buf.count = count;
- buf.error = 0;
- buf.ctx.actor = filldir64;
-
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
error = iterate_dir(f.file, &buf.ctx);
if (error >= 0)
error = buf.error;
*/
typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
struct dir_context {
*/
typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
struct dir_context {