summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-10-02 20:44:10 -0400
committerGitHub <[email protected]>2020-10-02 17:44:10 -0700
commit4d55ea811d4f5b832398f4e3b24c4da365956d62 (patch)
treec799540f0984809efa47a3b5d2218940def15297 /include
parent5b525165e9113e7faabd230b504ae4e9b85d35a5 (diff)
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 <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10997
Diffstat (limited to 'include')
-rw-r--r--include/os/freebsd/zfs/sys/zfs_ctldir.h2
-rw-r--r--include/os/freebsd/zfs/sys/zfs_dir.h4
-rw-r--r--include/os/freebsd/zfs/sys/zfs_vnops.h14
-rw-r--r--include/os/linux/zfs/sys/zfs_ctldir.h18
-rw-r--r--include/os/linux/zfs/sys/zfs_vnops.h4
-rw-r--r--include/sys/dmu.h2
-rw-r--r--include/sys/spa.h6
-rw-r--r--include/sys/u8_textprep.h2
-rw-r--r--include/sys/zfs_znode.h13
9 files changed, 31 insertions, 34 deletions
diff --git a/include/os/freebsd/zfs/sys/zfs_ctldir.h b/include/os/freebsd/zfs/sys/zfs_ctldir.h
index 28a026603..da02863a7 100644
--- a/include/os/freebsd/zfs/sys/zfs_ctldir.h
+++ b/include/os/freebsd/zfs/sys/zfs_ctldir.h
@@ -48,7 +48,7 @@ int zfsctl_root(zfsvfs_t *, int, vnode_t **);
void zfsctl_init(void);
void zfsctl_fini(void);
boolean_t zfsctl_is_node(vnode_t *);
-int zfsctl_snapshot_unmount(char *snapname, int flags);
+int zfsctl_snapshot_unmount(const char *snapname, int flags);
int zfsctl_rename_snapshot(const char *from, const char *to);
int zfsctl_destroy_snapshot(const char *snapname, int force);
int zfsctl_umount_snapshots(vfs_t *, int, cred_t *);
diff --git a/include/os/freebsd/zfs/sys/zfs_dir.h b/include/os/freebsd/zfs/sys/zfs_dir.h
index f6f8ab5c4..4197e1188 100644
--- a/include/os/freebsd/zfs/sys/zfs_dir.h
+++ b/include/os/freebsd/zfs/sys/zfs_dir.h
@@ -52,11 +52,7 @@ extern int zfs_dirent_lookup(znode_t *, const char *, znode_t **, int);
extern int zfs_link_create(znode_t *, const char *, znode_t *, dmu_tx_t *, int);
extern int zfs_link_destroy(znode_t *, const char *, znode_t *, dmu_tx_t *, int,
boolean_t *);
-#if 0
-extern int zfs_dirlook(vnode_t *, const char *, vnode_t **, int);
-#else
extern int zfs_dirlook(znode_t *, const char *name, znode_t **);
-#endif
extern void zfs_mknode(znode_t *, vattr_t *, dmu_tx_t *, cred_t *,
uint_t, znode_t **, zfs_acl_ids_t *);
extern void zfs_rmnode(znode_t *);
diff --git a/include/os/freebsd/zfs/sys/zfs_vnops.h b/include/os/freebsd/zfs/sys/zfs_vnops.h
index 6237372b9..587650af6 100644
--- a/include/os/freebsd/zfs/sys/zfs_vnops.h
+++ b/include/os/freebsd/zfs/sys/zfs_vnops.h
@@ -32,21 +32,21 @@ int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset,
uint64_t size, struct vm_page **ppa, dmu_tx_t *tx);
int dmu_read_pages(objset_t *os, uint64_t object, vm_page_t *ma, int count,
int *rbehind, int *rahead, int last_size);
-extern int zfs_remove(znode_t *dzp, char *name, cred_t *cr, int flags);
-extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
+extern int zfs_remove(znode_t *dzp, const char *name, cred_t *cr, int flags);
+extern int zfs_mkdir(znode_t *dzp, const char *dirname, vattr_t *vap,
znode_t **zpp, cred_t *cr, int flags, vsecattr_t *vsecp);
-extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
+extern int zfs_rmdir(znode_t *dzp, const char *name, znode_t *cwd,
cred_t *cr, int flags);
extern int zfs_setattr(znode_t *zp, vattr_t *vap, int flag, cred_t *cr);
-extern int zfs_rename(znode_t *sdzp, char *snm, znode_t *tdzp,
- char *tnm, cred_t *cr, int flags);
+extern int zfs_rename(znode_t *sdzp, const char *snm, znode_t *tdzp,
+ const char *tnm, cred_t *cr, int flags);
extern int zfs_symlink(znode_t *dzp, const char *name, vattr_t *vap,
const char *link, znode_t **zpp, cred_t *cr, int flags);
extern int zfs_link(znode_t *tdzp, znode_t *sp,
- char *name, cred_t *cr, int flags);
+ const char *name, cred_t *cr, int flags);
extern int zfs_space(znode_t *zp, int cmd, struct flock *bfp, int flag,
offset_t offset, cred_t *cr);
-extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
+extern int zfs_create(znode_t *dzp, const char *name, vattr_t *vap, int excl,
int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp);
extern int zfs_setsecattr(znode_t *zp, vsecattr_t *vsecp, int flag,
cred_t *cr);
diff --git a/include/os/linux/zfs/sys/zfs_ctldir.h b/include/os/linux/zfs/sys/zfs_ctldir.h
index 51933bc4f..beee34979 100644
--- a/include/os/linux/zfs/sys/zfs_ctldir.h
+++ b/include/os/linux/zfs/sys/zfs_ctldir.h
@@ -60,22 +60,22 @@ extern boolean_t zfsctl_is_snapdir(struct inode *ip);
extern int zfsctl_fid(struct inode *ip, fid_t *fidp);
/* zfsctl '.zfs' functions */
-extern int zfsctl_root_lookup(struct inode *dip, char *name,
+extern int zfsctl_root_lookup(struct inode *dip, const char *name,
struct inode **ipp, int flags, cred_t *cr, int *direntflags,
pathname_t *realpnp);
/* zfsctl '.zfs/snapshot' functions */
-extern int zfsctl_snapdir_lookup(struct inode *dip, char *name,
+extern int zfsctl_snapdir_lookup(struct inode *dip, const char *name,
struct inode **ipp, int flags, cred_t *cr, int *direntflags,
pathname_t *realpnp);
-extern int zfsctl_snapdir_rename(struct inode *sdip, char *sname,
- struct inode *tdip, char *tname, cred_t *cr, int flags);
-extern int zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr,
- int flags);
-extern int zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap,
- struct inode **ipp, cred_t *cr, int flags);
+extern int zfsctl_snapdir_rename(struct inode *sdip, const char *sname,
+ struct inode *tdip, const char *tname, cred_t *cr, int flags);
+extern int zfsctl_snapdir_remove(struct inode *dip, const char *name,
+ cred_t *cr, int flags);
+extern int zfsctl_snapdir_mkdir(struct inode *dip, const char *dirname,
+ vattr_t *vap, struct inode **ipp, cred_t *cr, int flags);
extern int zfsctl_snapshot_mount(struct path *path, int flags);
-extern int zfsctl_snapshot_unmount(char *snapname, int flags);
+extern int zfsctl_snapshot_unmount(const char *snapname, int flags);
extern int zfsctl_snapshot_unmount_delay(spa_t *spa, uint64_t objsetid,
int delay);
extern int zfsctl_snapdir_vget(struct super_block *sb, uint64_t objsetid,
diff --git a/include/os/linux/zfs/sys/zfs_vnops.h b/include/os/linux/zfs/sys/zfs_vnops.h
index 24a2082d3..2b41f3863 100644
--- a/include/os/linux/zfs/sys/zfs_vnops.h
+++ b/include/os/linux/zfs/sys/zfs_vnops.h
@@ -46,8 +46,8 @@ extern int zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr);
extern int zfs_write_simple(znode_t *zp, const void *data, size_t len,
loff_t pos, size_t *resid);
extern int zfs_access(struct inode *ip, int mode, int flag, cred_t *cr);
-extern int zfs_lookup(znode_t *dzp, char *nm, znode_t **zpp,
- int flags, cred_t *cr, int *direntflags, pathname_t *realpnp);
+extern int zfs_lookup(znode_t *dzp, char *nm, znode_t **zpp, int flags,
+ cred_t *cr, int *direntflags, pathname_t *realpnp);
extern int zfs_create(znode_t *dzp, char *name, vattr_t *vap, int excl,
int mode, znode_t **zpp, cred_t *cr, int flag, vsecattr_t *vsecp);
extern int zfs_tmpfile(struct inode *dip, vattr_t *vapzfs, int excl,
diff --git a/include/sys/dmu.h b/include/sys/dmu.h
index d6efe2595..9c700e2d7 100644
--- a/include/sys/dmu.h
+++ b/include/sys/dmu.h
@@ -1009,7 +1009,7 @@ extern int dmu_objset_blksize(objset_t *os);
extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name,
uint64_t *id, uint64_t *offp, boolean_t *case_conflict);
extern int dmu_snapshot_lookup(objset_t *os, const char *name, uint64_t *val);
-extern int dmu_snapshot_realname(objset_t *os, char *name, char *real,
+extern int dmu_snapshot_realname(objset_t *os, const char *name, char *real,
int maxlen, boolean_t *conflict);
extern int dmu_dir_list_next(objset_t *os, int namelen, char *name,
uint64_t *idp, uint64_t *offp);
diff --git a/include/sys/spa.h b/include/sys/spa.h
index ddce8cc91..045431c20 100644
--- a/include/sys/spa.h
+++ b/include/sys/spa.h
@@ -768,12 +768,12 @@ extern int spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props,
extern int spa_import(char *pool, nvlist_t *config, nvlist_t *props,
uint64_t flags);
extern nvlist_t *spa_tryimport(nvlist_t *tryconfig);
-extern int spa_destroy(char *pool);
+extern int spa_destroy(const char *pool);
extern int spa_checkpoint(const char *pool);
extern int spa_checkpoint_discard(const char *pool);
-extern int spa_export(char *pool, nvlist_t **oldconfig, boolean_t force,
+extern int spa_export(const char *pool, nvlist_t **oldconfig, boolean_t force,
boolean_t hardforce);
-extern int spa_reset(char *pool);
+extern int spa_reset(const char *pool);
extern void spa_async_request(spa_t *spa, int flag);
extern void spa_async_unrequest(spa_t *spa, int flag);
extern void spa_async_suspend(spa_t *spa);
diff --git a/include/sys/u8_textprep.h b/include/sys/u8_textprep.h
index f8b5bed6e..09ab13af2 100644
--- a/include/sys/u8_textprep.h
+++ b/include/sys/u8_textprep.h
@@ -101,7 +101,7 @@ extern int uconv_u8tou32(const uchar_t *, size_t *, uint32_t *, size_t *, int);
#define U8_ILLEGAL_CHAR (-1)
#define U8_OUT_OF_RANGE_CHAR (-2)
-extern int u8_validate(char *, size_t, char **, int, int *);
+extern int u8_validate(const char *, size_t, char **, int, int *);
extern int u8_strcmp(const char *, const char *, size_t, int, size_t, int *);
extern size_t u8_textprep_str(char *, size_t *, char *, size_t *, int, size_t,
int *);
diff --git a/include/sys/zfs_znode.h b/include/sys/zfs_znode.h
index d7823221e..4138f6eba 100644
--- a/include/sys/zfs_znode.h
+++ b/include/sys/zfs_znode.h
@@ -262,19 +262,20 @@ extern boolean_t zfs_get_vfs_flag_unmounted(objset_t *os);
extern void zfs_znode_dmu_fini(znode_t *);
extern void zfs_log_create(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
- znode_t *dzp, znode_t *zp, char *name, vsecattr_t *, zfs_fuid_info_t *,
- vattr_t *vap);
+ znode_t *dzp, znode_t *zp, const char *name, vsecattr_t *,
+ zfs_fuid_info_t *, vattr_t *vap);
extern int zfs_log_create_txtype(zil_create_t, vsecattr_t *vsecp,
vattr_t *vap);
extern void zfs_log_remove(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
- znode_t *dzp, char *name, uint64_t foid, boolean_t unlinked);
+ znode_t *dzp, const char *name, uint64_t foid, boolean_t unlinked);
#define ZFS_NO_OBJECT 0 /* no object id */
extern void zfs_log_link(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
- znode_t *dzp, znode_t *zp, char *name);
+ znode_t *dzp, znode_t *zp, const char *name);
extern void zfs_log_symlink(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
- znode_t *dzp, znode_t *zp, char *name, char *link);
+ znode_t *dzp, znode_t *zp, const char *name, const char *link);
extern void zfs_log_rename(zilog_t *zilog, dmu_tx_t *tx, uint64_t txtype,
- znode_t *sdzp, char *sname, znode_t *tdzp, char *dname, znode_t *szp);
+ znode_t *sdzp, const char *sname, znode_t *tdzp, const char *dname,
+ znode_t *szp);
extern void zfs_log_write(zilog_t *zilog, dmu_tx_t *tx, int txtype,
znode_t *zp, offset_t off, ssize_t len, int ioflag,
zil_callback_t callback, void *callback_data);