6 #include <linux/export.h>
8 #include <linux/slab.h>
17 #include <asm/uaccess.h>
23 return dentry->
d_inode && !d_unhashed(dentry);
47 static int simple_delete_dentry(
const struct dentry *
dentry)
90 offset += file->
f_pos;
98 if (offset != file->
f_pos) {
100 if (file->
f_pos >= 2) {
103 loff_t
n = file->
f_pos - 2;
105 spin_lock(&dentry->
d_lock);
113 if (simple_positive(next))
115 spin_unlock(&next->
d_lock);
119 spin_unlock(&dentry->
d_lock);
127 static inline unsigned char dt_type(
struct inode *
inode)
129 return (inode->
i_mode >> 12) & 15;
149 if (filldir(dirent,
".", 1, i, ino,
DT_DIR) < 0)
156 if (filldir(dirent,
"..", 2, i, ino,
DT_DIR) < 0)
162 spin_lock(&dentry->
d_lock);
163 if (filp->
f_pos == 2)
170 if (!simple_positive(next)) {
171 spin_unlock(&next->
d_lock);
175 spin_unlock(&next->
d_lock);
176 spin_unlock(&dentry->
d_lock);
177 if (filldir(dirent, next->
d_name.name,
182 spin_lock(&dentry->
d_lock);
186 spin_unlock(&next->
d_lock);
190 spin_unlock(&dentry->
d_lock);
238 s->
s_op = ops ? ops : &simple_super_operations;
276 struct inode *inode = old_dentry->
d_inode;
288 struct dentry *
child;
291 spin_lock(&dentry->
d_lock);
294 if (simple_positive(child)) {
295 spin_unlock(&child->
d_lock);
298 spin_unlock(&child->
d_lock);
302 spin_unlock(&dentry->
d_lock);
308 struct inode *inode = dentry->
d_inode;
328 struct inode *new_dir,
struct dentry *new_dentry)
330 struct inode *inode = old_dentry->
d_inode;
342 }
else if (they_are_dirs) {
369 struct inode *inode = dentry->
d_inode;
381 mark_inode_dirty(inode);
388 clear_highpage(page);
390 SetPageUptodate(page);
396 loff_t
pos,
unsigned len,
unsigned flags,
397 struct page **pagep,
void **fsdata)
440 loff_t
pos,
unsigned len,
unsigned copied,
443 struct inode *inode = page->
mapping->host;
444 loff_t last_pos = pos + copied;
450 zero_user(page, from + copied, len - copied);
453 if (!PageUptodate(page))
454 SetPageUptodate(page);
459 if (last_pos > inode->
i_size)
460 i_size_write(inode, last_pos);
485 s->
s_op = &simple_super_operations;
504 for (i = 0; !files->
name || files->
name[0]; i++, files++) {
511 "with an index of 1!\n", __func__,
526 d_add(dentry, inode);
542 spin_lock(&pin_fs_lock);
544 spin_unlock(&pin_fs_lock);
548 spin_lock(&pin_fs_lock);
554 spin_unlock(&pin_fs_lock);
562 spin_lock(&pin_fs_lock);
566 spin_unlock(&pin_fs_lock);
592 if (pos >= available || !count)
594 if (count > available - pos)
595 count = available -
pos;
626 if (pos >= available || !count)
628 if (count > available - pos)
629 count = available -
pos;
659 if (pos >= available)
661 if (count > available - pos)
662 count = available -
pos;
663 memcpy(to, from + pos, count);
696 return ERR_PTR(-
EFBIG);
702 spin_lock(&simple_transaction_lock);
706 spin_unlock(&simple_transaction_lock);
708 return ERR_PTR(-
EBUSY);
713 spin_unlock(&simple_transaction_lock);
751 int (*
get)(
void *,
u64 *),
int (*
set)(
void *,
u64),
779 size_t len, loff_t *ppos)
798 ret = attr->
get(attr->
data, &val);
803 attr->
fmt, (
unsigned long long)val);
814 size_t len, loff_t *ppos)
836 ret = attr->
set(attr->
data, val);
857 int fh_len,
int fh_type,
struct inode *(*get_inode)
860 struct inode *inode =
NULL;
868 inode = get_inode(sb, fid->
i32.ino, fid->
i32.gen);
890 int fh_len,
int fh_type,
struct inode *(*get_inode)
893 struct inode *inode =
NULL;
900 inode = get_inode(sb, fid->
i32.parent_ino,
901 (fh_len > 3 ? fid->
i32.parent_gen : 0));
921 struct inode *inode = file->
f_mapping->host;
956 u64 last_fs_block = num_blocks - 1;
966 if ((last_fs_block > (
sector_t)(~0ULL) >> (blocksize_bits - 9)) ||
967 (last_fs_page > (
pgoff_t)(~0ULL))) {