mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Throw const on some strings
In C, const indicates to the reader that mutation will not occur. It can also serve as a hint about ownership. Add const in a few places where it makes sense. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #10997
This commit is contained in:
@@ -131,7 +131,7 @@ static void zfsctl_snapshot_unmount_delay_impl(zfs_snapentry_t *se, int delay);
|
||||
* the snapshot name and provided mount point. No reference is taken.
|
||||
*/
|
||||
static zfs_snapentry_t *
|
||||
zfsctl_snapshot_alloc(char *full_name, char *full_path, spa_t *spa,
|
||||
zfsctl_snapshot_alloc(const char *full_name, const char *full_path, spa_t *spa,
|
||||
uint64_t objsetid, struct dentry *root_dentry)
|
||||
{
|
||||
zfs_snapentry_t *se;
|
||||
@@ -261,13 +261,13 @@ snapentry_compare_by_objsetid(const void *a, const void *b)
|
||||
* NULL will be returned.
|
||||
*/
|
||||
static zfs_snapentry_t *
|
||||
zfsctl_snapshot_find_by_name(char *snapname)
|
||||
zfsctl_snapshot_find_by_name(const char *snapname)
|
||||
{
|
||||
zfs_snapentry_t *se, search;
|
||||
|
||||
ASSERT(RW_LOCK_HELD(&zfs_snapshot_lock));
|
||||
|
||||
search.se_name = snapname;
|
||||
search.se_name = (char *)snapname;
|
||||
se = avl_find(&zfs_snapshots_by_name, &search, NULL);
|
||||
if (se)
|
||||
zfsctl_snapshot_hold(se);
|
||||
@@ -301,7 +301,7 @@ zfsctl_snapshot_find_by_objsetid(spa_t *spa, uint64_t objsetid)
|
||||
* removed, renamed, and added back to the new correct location in the tree.
|
||||
*/
|
||||
static int
|
||||
zfsctl_snapshot_rename(char *old_snapname, char *new_snapname)
|
||||
zfsctl_snapshot_rename(const char *old_snapname, const char *new_snapname)
|
||||
{
|
||||
zfs_snapentry_t *se;
|
||||
|
||||
@@ -410,7 +410,7 @@ zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid, int delay)
|
||||
* and zero when unmounted.
|
||||
*/
|
||||
static boolean_t
|
||||
zfsctl_snapshot_ismounted(char *snapname)
|
||||
zfsctl_snapshot_ismounted(const char *snapname)
|
||||
{
|
||||
zfs_snapentry_t *se;
|
||||
boolean_t ismounted = B_FALSE;
|
||||
@@ -751,7 +751,7 @@ out:
|
||||
* Special case the handling of "..".
|
||||
*/
|
||||
int
|
||||
zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp,
|
||||
zfsctl_root_lookup(struct inode *dip, const char *name, struct inode **ipp,
|
||||
int flags, cred_t *cr, int *direntflags, pathname_t *realpnp)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(dip);
|
||||
@@ -784,7 +784,7 @@ zfsctl_root_lookup(struct inode *dip, char *name, struct inode **ipp,
|
||||
* snapshot if it exist, creating the pseudo filesystem inode as necessary.
|
||||
*/
|
||||
int
|
||||
zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp,
|
||||
zfsctl_snapdir_lookup(struct inode *dip, const char *name, struct inode **ipp,
|
||||
int flags, cred_t *cr, int *direntflags, pathname_t *realpnp)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(dip);
|
||||
@@ -815,8 +815,8 @@ zfsctl_snapdir_lookup(struct inode *dip, char *name, struct inode **ipp,
|
||||
* to the '.zfs/snapshot' directory snapshots cannot be moved elsewhere.
|
||||
*/
|
||||
int
|
||||
zfsctl_snapdir_rename(struct inode *sdip, char *snm,
|
||||
struct inode *tdip, char *tnm, cred_t *cr, int flags)
|
||||
zfsctl_snapdir_rename(struct inode *sdip, const char *snm,
|
||||
struct inode *tdip, const char *tnm, cred_t *cr, int flags)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(sdip);
|
||||
char *to, *from, *real, *fsname;
|
||||
@@ -893,7 +893,8 @@ out:
|
||||
* the removal of the snapshot with the given name.
|
||||
*/
|
||||
int
|
||||
zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, int flags)
|
||||
zfsctl_snapdir_remove(struct inode *dip, const char *name, cred_t *cr,
|
||||
int flags)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(dip);
|
||||
char *snapname, *real;
|
||||
@@ -941,7 +942,7 @@ out:
|
||||
* the creation of a new snapshot with the given name.
|
||||
*/
|
||||
int
|
||||
zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap,
|
||||
zfsctl_snapdir_mkdir(struct inode *dip, const char *dirname, vattr_t *vap,
|
||||
struct inode **ipp, cred_t *cr, int flags)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(dip);
|
||||
@@ -1001,7 +1002,7 @@ exportfs_flush(void)
|
||||
* it's in use, the unmount will fail harmlessly.
|
||||
*/
|
||||
int
|
||||
zfsctl_snapshot_unmount(char *snapname, int flags)
|
||||
zfsctl_snapshot_unmount(const char *snapname, int flags)
|
||||
{
|
||||
char *argv[] = { "/usr/bin/env", "umount", "-t", "zfs", "-n", NULL,
|
||||
NULL };
|
||||
|
||||
@@ -60,8 +60,9 @@
|
||||
* of names after deciding which is the appropriate lookup interface.
|
||||
*/
|
||||
static int
|
||||
zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt,
|
||||
boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid)
|
||||
zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, const char *name,
|
||||
matchtype_t mt, boolean_t update, int *deflags, pathname_t *rpnp,
|
||||
uint64_t *zoid)
|
||||
{
|
||||
boolean_t conflict = B_FALSE;
|
||||
int error;
|
||||
@@ -139,8 +140,8 @@ zfs_match_find(zfsvfs_t *zfsvfs, znode_t *dzp, char *name, matchtype_t mt,
|
||||
* but return znode pointers to a single match.
|
||||
*/
|
||||
int
|
||||
zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name, znode_t **zpp,
|
||||
int flag, int *direntflags, pathname_t *realpnp)
|
||||
zfs_dirent_lock(zfs_dirlock_t **dlpp, znode_t *dzp, char *name,
|
||||
znode_t **zpp, int flag, int *direntflags, pathname_t *realpnp)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ZTOZSB(dzp);
|
||||
zfs_dirlock_t *dl;
|
||||
|
||||
@@ -1234,8 +1234,8 @@ zfs_access(struct inode *ip, int mode, int flag, cred_t *cr)
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
int
|
||||
zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags,
|
||||
cred_t *cr, int *direntflags, pathname_t *realpnp)
|
||||
zfs_lookup(znode_t *zdp, char *nm, znode_t **zpp, int flags, cred_t *cr,
|
||||
int *direntflags, pathname_t *realpnp)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ZTOZSB(zdp);
|
||||
int error = 0;
|
||||
|
||||
Reference in New Issue
Block a user