// SPDX-License-Identifier: GPL-2.0-or-later /* AFS filesystem directory editing * * Copyright (C) 2018 Red Hat, Inc. All Rights Reserved. * Written by David Howells ([email protected]) */ #include <linux/kernel.h> #include <linux/fs.h> #include <linux/namei.h> #include <linux/pagemap.h> #include <linux/iversion.h> #include "internal.h" #include "xdr_fs.h" /* * Find a number of contiguous clear bits in a directory block bitmask. * * There are 64 slots, which means we can load the entire bitmap into a * variable. The first bit doesn't count as it corresponds to the block header * slot. nr_slots is between 1 and 9. */ static int afs_find_contig_bits(union afs_xdr_dir_block *block, unsigned int nr_slots) { … } /* * Set a number of contiguous bits in the directory block bitmap. */ static void afs_set_contig_bits(union afs_xdr_dir_block *block, int bit, unsigned int nr_slots) { … } /* * Clear a number of contiguous bits in the directory block bitmap. */ static void afs_clear_contig_bits(union afs_xdr_dir_block *block, int bit, unsigned int nr_slots) { … } /* * Get a new directory folio. */ static struct folio *afs_dir_get_folio(struct afs_vnode *vnode, pgoff_t index) { … } /* * Scan a directory block looking for a dirent of the right name. */ static int afs_dir_scan_block(union afs_xdr_dir_block *block, struct qstr *name, unsigned int blocknum) { … } /* * Initialise a new directory block. Note that block 0 is special and contains * some extra metadata. */ static void afs_edit_init_block(union afs_xdr_dir_block *meta, union afs_xdr_dir_block *block, int block_num) { … } /* * Edit a directory's file data to add a new directory entry. Doing this after * create, mkdir, symlink, link or rename if the data version number is * incremented by exactly one avoids the need to re-download the entire * directory contents. * * The caller must hold the inode locked. */ void afs_edit_dir_add(struct afs_vnode *vnode, struct qstr *name, struct afs_fid *new_fid, enum afs_edit_dir_reason why) { … } /* * Edit a directory's file data to remove a new directory entry. Doing this * after unlink, rmdir or rename if the data version number is incremented by * exactly one avoids the need to re-download the entire directory contents. * * The caller must hold the inode locked. */ void afs_edit_dir_remove(struct afs_vnode *vnode, struct qstr *name, enum afs_edit_dir_reason why) { … }