nfs4recover.c (03ab8e6297acd1bc0eedaa050e2a1635c576fd11) nfs4recover.c (25885a35a72007cf28ec5f9ba7169c5c798f7167)
1/*
2* Copyright (c) 2004 The Regents of the University of Michigan.
3* Copyright (c) 2012 Jeff Layton <jlayton@redhat.com>
4* All rights reserved.
5*
6* Andy Adamson <andros@citi.umich.edu>
7*
8* Redistribution and use in source and binary forms, with or without

--- 252 unchanged lines hidden (view full) ---

261 struct list_head list;
262};
263
264struct nfs4_dir_ctx {
265 struct dir_context ctx;
266 struct list_head names;
267};
268
1/*
2* Copyright (c) 2004 The Regents of the University of Michigan.
3* Copyright (c) 2012 Jeff Layton <jlayton@redhat.com>
4* All rights reserved.
5*
6* Andy Adamson <andros@citi.umich.edu>
7*
8* Redistribution and use in source and binary forms, with or without

--- 252 unchanged lines hidden (view full) ---

261 struct list_head list;
262};
263
264struct nfs4_dir_ctx {
265 struct dir_context ctx;
266 struct list_head names;
267};
268
269static int
269static bool
270nfsd4_build_namelist(struct dir_context *__ctx, const char *name, int namlen,
271 loff_t offset, u64 ino, unsigned int d_type)
272{
273 struct nfs4_dir_ctx *ctx =
274 container_of(__ctx, struct nfs4_dir_ctx, ctx);
275 struct name_list *entry;
276
277 if (namlen != HEXDIR_LEN - 1)
270nfsd4_build_namelist(struct dir_context *__ctx, const char *name, int namlen,
271 loff_t offset, u64 ino, unsigned int d_type)
272{
273 struct nfs4_dir_ctx *ctx =
274 container_of(__ctx, struct nfs4_dir_ctx, ctx);
275 struct name_list *entry;
276
277 if (namlen != HEXDIR_LEN - 1)
278 return 0;
278 return true;
279 entry = kmalloc(sizeof(struct name_list), GFP_KERNEL);
280 if (entry == NULL)
279 entry = kmalloc(sizeof(struct name_list), GFP_KERNEL);
280 if (entry == NULL)
281 return -ENOMEM;
281 return false;
282 memcpy(entry->name, name, HEXDIR_LEN - 1);
283 entry->name[HEXDIR_LEN - 1] = '\0';
284 list_add(&entry->list, &ctx->names);
282 memcpy(entry->name, name, HEXDIR_LEN - 1);
283 entry->name[HEXDIR_LEN - 1] = '\0';
284 list_add(&entry->list, &ctx->names);
285 return 0;
285 return true;
286}
287
288static int
289nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn)
290{
291 const struct cred *original_cred;
292 struct dentry *dir = nn->rec_file->f_path.dentry;
293 struct nfs4_dir_ctx ctx = {

--- 1874 unchanged lines hidden ---
286}
287
288static int
289nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn)
290{
291 const struct cred *original_cred;
292 struct dentry *dir = nn->rec_file->f_path.dentry;
293 struct nfs4_dir_ctx ctx = {

--- 1874 unchanged lines hidden ---