Skip to content

Commit 835c92d

Browse files
committed
Merge branch 'work.const-qstr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull qstr constification updates from Al Viro: "Fairly self-contained bunch - surprising lot of places passes struct qstr * as an argument when const struct qstr * would suffice; it complicates analysis for no good reason. I'd prefer to feed that separately from the assorted fixes (those are in #for-linus and with somewhat trickier topology)" * 'work.const-qstr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: qstr: constify instances in adfs qstr: constify instances in lustre qstr: constify instances in f2fs qstr: constify instances in ext2 qstr: constify instances in vfat qstr: constify instances in procfs qstr: constify instances in fuse qstr constify instances in fs/dcache.c qstr: constify instances in nfs qstr: constify instances in ocfs2 qstr: constify instances in autofs4 qstr: constify instances in hfs qstr: constify instances in hfsplus qstr: constify instances in logfs qstr: constify dentry_init_security
2 parents ce804bf + 19a6d89 commit 835c92d

37 files changed

Lines changed: 95 additions & 100 deletions

‎drivers/staging/lustre/lustre/llite/statahead.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ static int sa_args_init(struct inode *dir, struct inode *child,
781781
struct ll_sa_entry *entry, struct md_enqueue_info **pmi,
782782
struct ldlm_enqueue_info **pei)
783783
{
784-
struct qstr *qstr = &entry->se_qstr;
784+
const struct qstr *qstr = &entry->se_qstr;
785785
struct ll_inode_info *lli = ll_i2info(dir);
786786
struct md_enqueue_info *minfo;
787787
struct ldlm_enqueue_info *einfo;
@@ -1340,7 +1340,7 @@ enum {
13401340
static int is_first_dirent(struct inode *dir, struct dentry *dentry)
13411341
{
13421342
struct ll_dir_chain chain;
1343-
struct qstr *target = &dentry->d_name;
1343+
const struct qstr *target = &dentry->d_name;
13441344
struct page *page;
13451345
__u64 pos = 0;
13461346
int dot_de;

‎fs/adfs/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait)
101101
}
102102

103103
static int
104-
adfs_match(struct qstr *name, struct object_info *obj)
104+
adfs_match(const struct qstr *name, struct object_info *obj)
105105
{
106106
int i;
107107

@@ -126,7 +126,7 @@ adfs_match(struct qstr *name, struct object_info *obj)
126126
}
127127

128128
static int
129-
adfs_dir_lookup_byname(struct inode *inode, struct qstr *name, struct object_info *obj)
129+
adfs_dir_lookup_byname(struct inode *inode, const struct qstr *name, struct object_info *obj)
130130
{
131131
struct super_block *sb = inode->i_sb;
132132
const struct adfs_dir_ops *ops = ADFS_SB(sb)->s_dir;

‎fs/autofs4/root.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
159159
{
160160
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
161161
struct dentry *parent = dentry->d_parent;
162-
struct qstr *name = &dentry->d_name;
162+
const struct qstr *name = &dentry->d_name;
163163
unsigned int len = name->len;
164164
unsigned int hash = name->hash;
165165
const unsigned char *str = name->name;
@@ -172,7 +172,7 @@ static struct dentry *autofs4_lookup_active(struct dentry *dentry)
172172
list_for_each(p, head) {
173173
struct autofs_info *ino;
174174
struct dentry *active;
175-
struct qstr *qstr;
175+
const struct qstr *qstr;
176176

177177
ino = list_entry(p, struct autofs_info, active);
178178
active = ino->dentry;
@@ -214,7 +214,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
214214
{
215215
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
216216
struct dentry *parent = dentry->d_parent;
217-
struct qstr *name = &dentry->d_name;
217+
const struct qstr *name = &dentry->d_name;
218218
unsigned int len = name->len;
219219
unsigned int hash = name->hash;
220220
const unsigned char *str = name->name;
@@ -227,7 +227,7 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
227227
list_for_each(p, head) {
228228
struct autofs_info *ino;
229229
struct dentry *expiring;
230-
struct qstr *qstr;
230+
const struct qstr *qstr;
231231

232232
if (rcu_walk) {
233233
spin_unlock(&sbi->lookup_lock);

‎fs/autofs4/waitq.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static int autofs4_getpath(struct autofs_sb_info *sbi,
225225
}
226226

227227
static struct autofs_wait_queue *
228-
autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr)
228+
autofs4_find_wait(struct autofs_sb_info *sbi, const struct qstr *qstr)
229229
{
230230
struct autofs_wait_queue *wq;
231231

@@ -249,7 +249,7 @@ autofs4_find_wait(struct autofs_sb_info *sbi, struct qstr *qstr)
249249
*/
250250
static int validate_request(struct autofs_wait_queue **wait,
251251
struct autofs_sb_info *sbi,
252-
struct qstr *qstr,
252+
const struct qstr *qstr,
253253
struct dentry *dentry, enum autofs_notify notify)
254254
{
255255
struct autofs_wait_queue *wq;

‎fs/dcache.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,7 +2636,7 @@ EXPORT_SYMBOL(d_exact_alias);
26362636
* Parent inode i_mutex must be held over d_lookup and into this call (to
26372637
* keep renames and concurrent inserts, and readdir(2) away).
26382638
*/
2639-
void dentry_update_name_case(struct dentry *dentry, struct qstr *name)
2639+
void dentry_update_name_case(struct dentry *dentry, const struct qstr *name)
26402640
{
26412641
BUG_ON(!inode_is_locked(dentry->d_parent->d_inode));
26422642
BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */
@@ -3038,7 +3038,7 @@ static int prepend(char **buffer, int *buflen, const char *str, int namelen)
30383038
* Data dependency barrier is needed to make sure that we see that terminating
30393039
* NUL. Alpha strikes again, film at 11...
30403040
*/
3041-
static int prepend_name(char **buffer, int *buflen, struct qstr *name)
3041+
static int prepend_name(char **buffer, int *buflen, const struct qstr *name)
30423042
{
30433043
const char *dname = ACCESS_ONCE(name->name);
30443044
u32 dlen = ACCESS_ONCE(name->len);

‎fs/ext2/dir.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ ext2_readdir(struct file *file, struct dir_context *ctx)
358358
* and the entry itself. Page is returned mapped and unlocked.
359359
* Entry is guaranteed to be valid.
360360
*/
361-
struct ext2_dir_entry_2 *ext2_find_entry (struct inode * dir,
362-
struct qstr *child, struct page ** res_page)
361+
struct ext2_dir_entry_2 *ext2_find_entry (struct inode *dir,
362+
const struct qstr *child, struct page **res_page)
363363
{
364364
const char *name = child->name;
365365
int namelen = child->len;
@@ -435,7 +435,7 @@ struct ext2_dir_entry_2 * ext2_dotdot (struct inode *dir, struct page **p)
435435
return de;
436436
}
437437

438-
ino_t ext2_inode_by_name(struct inode *dir, struct qstr *child)
438+
ino_t ext2_inode_by_name(struct inode *dir, const struct qstr *child)
439439
{
440440
ino_t res = 0;
441441
struct ext2_dir_entry_2 *de;

‎fs/ext2/ext2.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,9 @@ extern void ext2_rsv_window_add(struct super_block *sb, struct ext2_reserve_wind
757757

758758
/* dir.c */
759759
extern int ext2_add_link (struct dentry *, struct inode *);
760-
extern ino_t ext2_inode_by_name(struct inode *, struct qstr *);
760+
extern ino_t ext2_inode_by_name(struct inode *, const struct qstr *);
761761
extern int ext2_make_empty(struct inode *, struct inode *);
762-
extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,struct qstr *, struct page **);
762+
extern struct ext2_dir_entry_2 * ext2_find_entry (struct inode *,const struct qstr *, struct page **);
763763
extern int ext2_delete_entry (struct ext2_dir_entry_2 *, struct page *);
764764
extern int ext2_empty_dir (struct inode *);
765765
extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **);

‎fs/f2fs/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static struct f2fs_dir_entry *find_in_level(struct inode *dir,
219219
* Entry is guaranteed to be valid.
220220
*/
221221
struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
222-
struct qstr *child, struct page **res_page)
222+
const struct qstr *child, struct page **res_page)
223223
{
224224
unsigned long npages = dir_blocks(dir);
225225
struct f2fs_dir_entry *de = NULL;
@@ -272,7 +272,7 @@ struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p)
272272
return f2fs_find_entry(dir, &dotdot, p);
273273
}
274274

275-
ino_t f2fs_inode_by_name(struct inode *dir, struct qstr *qstr,
275+
ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr,
276276
struct page **page)
277277
{
278278
ino_t res = 0;

‎fs/f2fs/f2fs.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,10 +1914,10 @@ struct page *init_inode_metadata(struct inode *, struct inode *,
19141914
void update_parent_metadata(struct inode *, struct inode *, unsigned int);
19151915
int room_for_filename(const void *, int, int);
19161916
void f2fs_drop_nlink(struct inode *, struct inode *);
1917-
struct f2fs_dir_entry *f2fs_find_entry(struct inode *, struct qstr *,
1917+
struct f2fs_dir_entry *f2fs_find_entry(struct inode *, const struct qstr *,
19181918
struct page **);
19191919
struct f2fs_dir_entry *f2fs_parent_dir(struct inode *, struct page **);
1920-
ino_t f2fs_inode_by_name(struct inode *, struct qstr *, struct page **);
1920+
ino_t f2fs_inode_by_name(struct inode *, const struct qstr *, struct page **);
19211921
void f2fs_set_link(struct inode *, struct f2fs_dir_entry *,
19221922
struct page *, struct inode *);
19231923
int update_dent_inode(struct inode *, struct inode *, const struct qstr *);

‎fs/fat/namei_vfat.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
652652
return err;
653653
}
654654

655-
static int vfat_add_entry(struct inode *dir, struct qstr *qname, int is_dir,
656-
int cluster, struct timespec *ts,
655+
static int vfat_add_entry(struct inode *dir, const struct qstr *qname,
656+
int is_dir, int cluster, struct timespec *ts,
657657
struct fat_slot_info *sinfo)
658658
{
659659
struct msdos_dir_slot *slots;
@@ -688,7 +688,7 @@ static int vfat_add_entry(struct inode *dir, struct qstr *qname, int is_dir,
688688
return err;
689689
}
690690

691-
static int vfat_find(struct inode *dir, struct qstr *qname,
691+
static int vfat_find(struct inode *dir, const struct qstr *qname,
692692
struct fat_slot_info *sinfo)
693693
{
694694
unsigned int len = vfat_striptail_len(qname);

0 commit comments

Comments
 (0)