diff options
Diffstat (limited to 'fs')
179 files changed, 426 insertions, 6536 deletions
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index 410ffd6ceb5f..dc95a252523d 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
@@ -54,9 +54,9 @@ extern struct kmem_cache *v9fs_inode_cache; | |||
54 | 54 | ||
55 | struct inode *v9fs_alloc_inode(struct super_block *sb); | 55 | struct inode *v9fs_alloc_inode(struct super_block *sb); |
56 | void v9fs_destroy_inode(struct inode *inode); | 56 | void v9fs_destroy_inode(struct inode *inode); |
57 | struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t); | 57 | struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t); |
58 | int v9fs_init_inode(struct v9fs_session_info *v9ses, | 58 | int v9fs_init_inode(struct v9fs_session_info *v9ses, |
59 | struct inode *inode, int mode, dev_t); | 59 | struct inode *inode, umode_t mode, dev_t); |
60 | void v9fs_evict_inode(struct inode *inode); | 60 | void v9fs_evict_inode(struct inode *inode); |
61 | ino_t v9fs_qid2ino(struct p9_qid *qid); | 61 | ino_t v9fs_qid2ino(struct p9_qid *qid); |
62 | void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); | 62 | void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 2310cc9eb402..e0f20de6aa2b 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -59,15 +59,13 @@ static const struct inode_operations v9fs_symlink_inode_operations; | |||
59 | * | 59 | * |
60 | */ | 60 | */ |
61 | 61 | ||
62 | static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) | 62 | static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode) |
63 | { | 63 | { |
64 | int res; | 64 | int res; |
65 | res = mode & 0777; | 65 | res = mode & 0777; |
66 | if (S_ISDIR(mode)) | 66 | if (S_ISDIR(mode)) |
67 | res |= P9_DMDIR; | 67 | res |= P9_DMDIR; |
68 | if (v9fs_proto_dotu(v9ses)) { | 68 | if (v9fs_proto_dotu(v9ses)) { |
69 | if (S_ISLNK(mode)) | ||
70 | res |= P9_DMSYMLINK; | ||
71 | if (v9ses->nodev == 0) { | 69 | if (v9ses->nodev == 0) { |
72 | if (S_ISSOCK(mode)) | 70 | if (S_ISSOCK(mode)) |
73 | res |= P9_DMSOCKET; | 71 | res |= P9_DMSOCKET; |
@@ -85,10 +83,7 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) | |||
85 | res |= P9_DMSETGID; | 83 | res |= P9_DMSETGID; |
86 | if ((mode & S_ISVTX) == S_ISVTX) | 84 | if ((mode & S_ISVTX) == S_ISVTX) |
87 | res |= P9_DMSETVTX; | 85 | res |= P9_DMSETVTX; |
88 | if ((mode & P9_DMLINK)) | ||
89 | res |= P9_DMLINK; | ||
90 | } | 86 | } |
91 | |||
92 | return res; | 87 | return res; |
93 | } | 88 | } |
94 | 89 | ||
@@ -99,11 +94,11 @@ static int unixmode2p9mode(struct v9fs_session_info *v9ses, int mode) | |||
99 | * @rdev: major number, minor number in case of device files. | 94 | * @rdev: major number, minor number in case of device files. |
100 | * | 95 | * |
101 | */ | 96 | */ |
102 | static int p9mode2unixmode(struct v9fs_session_info *v9ses, | 97 | static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses, |
103 | struct p9_wstat *stat, dev_t *rdev) | 98 | struct p9_wstat *stat, dev_t *rdev) |
104 | { | 99 | { |
105 | int res; | 100 | int res; |
106 | int mode = stat->mode; | 101 | u32 mode = stat->mode; |
107 | 102 | ||
108 | res = mode & S_IALLUGO; | 103 | res = mode & S_IALLUGO; |
109 | *rdev = 0; | 104 | *rdev = 0; |
@@ -260,7 +255,7 @@ void v9fs_destroy_inode(struct inode *inode) | |||
260 | } | 255 | } |
261 | 256 | ||
262 | int v9fs_init_inode(struct v9fs_session_info *v9ses, | 257 | int v9fs_init_inode(struct v9fs_session_info *v9ses, |
263 | struct inode *inode, int mode, dev_t rdev) | 258 | struct inode *inode, umode_t mode, dev_t rdev) |
264 | { | 259 | { |
265 | int err = 0; | 260 | int err = 0; |
266 | 261 | ||
@@ -334,7 +329,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, | |||
334 | 329 | ||
335 | break; | 330 | break; |
336 | default: | 331 | default: |
337 | P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", | 332 | P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%hx S_IFMT 0x%x\n", |
338 | mode, mode & S_IFMT); | 333 | mode, mode & S_IFMT); |
339 | err = -EINVAL; | 334 | err = -EINVAL; |
340 | goto error; | 335 | goto error; |
@@ -351,13 +346,13 @@ error: | |||
351 | * | 346 | * |
352 | */ | 347 | */ |
353 | 348 | ||
354 | struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev) | 349 | struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t rdev) |
355 | { | 350 | { |
356 | int err; | 351 | int err; |
357 | struct inode *inode; | 352 | struct inode *inode; |
358 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 353 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
359 | 354 | ||
360 | P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); | 355 | P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %ho\n", sb, mode); |
361 | 356 | ||
362 | inode = new_inode(sb); | 357 | inode = new_inode(sb); |
363 | if (!inode) { | 358 | if (!inode) { |
@@ -491,7 +486,8 @@ static struct inode *v9fs_qid_iget(struct super_block *sb, | |||
491 | int new) | 486 | int new) |
492 | { | 487 | { |
493 | dev_t rdev; | 488 | dev_t rdev; |
494 | int retval, umode; | 489 | int retval; |
490 | umode_t umode; | ||
495 | unsigned long i_ino; | 491 | unsigned long i_ino; |
496 | struct inode *inode; | 492 | struct inode *inode; |
497 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 493 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
@@ -702,7 +698,7 @@ error: | |||
702 | */ | 698 | */ |
703 | 699 | ||
704 | static int | 700 | static int |
705 | v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | 701 | v9fs_vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
706 | struct nameidata *nd) | 702 | struct nameidata *nd) |
707 | { | 703 | { |
708 | int err; | 704 | int err; |
@@ -785,7 +781,7 @@ error: | |||
785 | * | 781 | * |
786 | */ | 782 | */ |
787 | 783 | ||
788 | static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 784 | static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
789 | { | 785 | { |
790 | int err; | 786 | int err; |
791 | u32 perm; | 787 | u32 perm; |
@@ -1130,7 +1126,7 @@ void | |||
1130 | v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, | 1126 | v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, |
1131 | struct super_block *sb) | 1127 | struct super_block *sb) |
1132 | { | 1128 | { |
1133 | mode_t mode; | 1129 | umode_t mode; |
1134 | char ext[32]; | 1130 | char ext[32]; |
1135 | char tag_name[14]; | 1131 | char tag_name[14]; |
1136 | unsigned int i_nlink; | 1132 | unsigned int i_nlink; |
@@ -1303,9 +1299,8 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p) | |||
1303 | */ | 1299 | */ |
1304 | 1300 | ||
1305 | static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | 1301 | static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, |
1306 | int mode, const char *extension) | 1302 | u32 perm, const char *extension) |
1307 | { | 1303 | { |
1308 | u32 perm; | ||
1309 | struct p9_fid *fid; | 1304 | struct p9_fid *fid; |
1310 | struct v9fs_session_info *v9ses; | 1305 | struct v9fs_session_info *v9ses; |
1311 | 1306 | ||
@@ -1315,7 +1310,6 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1315 | return -EPERM; | 1310 | return -EPERM; |
1316 | } | 1311 | } |
1317 | 1312 | ||
1318 | perm = unixmode2p9mode(v9ses, mode); | ||
1319 | fid = v9fs_create(v9ses, dir, dentry, (char *) extension, perm, | 1313 | fid = v9fs_create(v9ses, dir, dentry, (char *) extension, perm, |
1320 | P9_OREAD); | 1314 | P9_OREAD); |
1321 | if (IS_ERR(fid)) | 1315 | if (IS_ERR(fid)) |
@@ -1342,7 +1336,7 @@ v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
1342 | P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, | 1336 | P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, |
1343 | dentry->d_name.name, symname); | 1337 | dentry->d_name.name, symname); |
1344 | 1338 | ||
1345 | return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname); | 1339 | return v9fs_vfs_mkspecial(dir, dentry, P9_DMSYMLINK, symname); |
1346 | } | 1340 | } |
1347 | 1341 | ||
1348 | /** | 1342 | /** |
@@ -1397,13 +1391,15 @@ clunk_fid: | |||
1397 | */ | 1391 | */ |
1398 | 1392 | ||
1399 | static int | 1393 | static int |
1400 | v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | 1394 | v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
1401 | { | 1395 | { |
1396 | struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); | ||
1402 | int retval; | 1397 | int retval; |
1403 | char *name; | 1398 | char *name; |
1399 | u32 perm; | ||
1404 | 1400 | ||
1405 | P9_DPRINTK(P9_DEBUG_VFS, | 1401 | P9_DPRINTK(P9_DEBUG_VFS, |
1406 | " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, | 1402 | " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", dir->i_ino, |
1407 | dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev)); | 1403 | dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev)); |
1408 | 1404 | ||
1409 | if (!new_valid_dev(rdev)) | 1405 | if (!new_valid_dev(rdev)) |
@@ -1426,7 +1422,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1426 | return -EINVAL; | 1422 | return -EINVAL; |
1427 | } | 1423 | } |
1428 | 1424 | ||
1429 | retval = v9fs_vfs_mkspecial(dir, dentry, mode, name); | 1425 | perm = unixmode2p9mode(v9ses, mode); |
1426 | retval = v9fs_vfs_mkspecial(dir, dentry, perm, name); | ||
1430 | __putname(name); | 1427 | __putname(name); |
1431 | 1428 | ||
1432 | return retval; | 1429 | return retval; |
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 0b5745e21946..8ef152ac6a16 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include "acl.h" | 48 | #include "acl.h" |
49 | 49 | ||
50 | static int | 50 | static int |
51 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | 51 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
52 | dev_t rdev); | 52 | dev_t rdev); |
53 | 53 | ||
54 | /** | 54 | /** |
@@ -253,7 +253,7 @@ int v9fs_open_to_dotl_flags(int flags) | |||
253 | */ | 253 | */ |
254 | 254 | ||
255 | static int | 255 | static int |
256 | v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | 256 | v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
257 | struct nameidata *nd) | 257 | struct nameidata *nd) |
258 | { | 258 | { |
259 | int err = 0; | 259 | int err = 0; |
@@ -284,7 +284,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
284 | 284 | ||
285 | name = (char *) dentry->d_name.name; | 285 | name = (char *) dentry->d_name.name; |
286 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " | 286 | P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " |
287 | "mode:0x%x\n", name, flags, omode); | 287 | "mode:0x%hx\n", name, flags, omode); |
288 | 288 | ||
289 | dfid = v9fs_fid_lookup(dentry->d_parent); | 289 | dfid = v9fs_fid_lookup(dentry->d_parent); |
290 | if (IS_ERR(dfid)) { | 290 | if (IS_ERR(dfid)) { |
@@ -395,7 +395,7 @@ err_clunk_old_fid: | |||
395 | */ | 395 | */ |
396 | 396 | ||
397 | static int v9fs_vfs_mkdir_dotl(struct inode *dir, | 397 | static int v9fs_vfs_mkdir_dotl(struct inode *dir, |
398 | struct dentry *dentry, int omode) | 398 | struct dentry *dentry, umode_t omode) |
399 | { | 399 | { |
400 | int err; | 400 | int err; |
401 | struct v9fs_session_info *v9ses; | 401 | struct v9fs_session_info *v9ses; |
@@ -594,7 +594,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr) | |||
594 | void | 594 | void |
595 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) | 595 | v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) |
596 | { | 596 | { |
597 | mode_t mode; | 597 | umode_t mode; |
598 | struct v9fs_inode *v9inode = V9FS_I(inode); | 598 | struct v9fs_inode *v9inode = V9FS_I(inode); |
599 | 599 | ||
600 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { | 600 | if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { |
@@ -799,7 +799,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, | |||
799 | * | 799 | * |
800 | */ | 800 | */ |
801 | static int | 801 | static int |
802 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | 802 | v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, umode_t omode, |
803 | dev_t rdev) | 803 | dev_t rdev) |
804 | { | 804 | { |
805 | int err; | 805 | int err; |
@@ -814,7 +814,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, | |||
814 | struct posix_acl *dacl = NULL, *pacl = NULL; | 814 | struct posix_acl *dacl = NULL, *pacl = NULL; |
815 | 815 | ||
816 | P9_DPRINTK(P9_DEBUG_VFS, | 816 | P9_DPRINTK(P9_DEBUG_VFS, |
817 | " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, | 817 | " %lu,%s mode: %hx MAJOR: %u MINOR: %u\n", dir->i_ino, |
818 | dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev)); | 818 | dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev)); |
819 | 819 | ||
820 | if (!new_valid_dev(rdev)) | 820 | if (!new_valid_dev(rdev)) |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index c70251d47ed1..f68ff65a32a5 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -117,7 +117,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, | |||
117 | struct inode *inode = NULL; | 117 | struct inode *inode = NULL; |
118 | struct dentry *root = NULL; | 118 | struct dentry *root = NULL; |
119 | struct v9fs_session_info *v9ses = NULL; | 119 | struct v9fs_session_info *v9ses = NULL; |
120 | int mode = S_IRWXUGO | S_ISVTX; | 120 | umode_t mode = S_IRWXUGO | S_ISVTX; |
121 | struct p9_fid *fid; | 121 | struct p9_fid *fid; |
122 | int retval = 0; | 122 | int retval = 0; |
123 | 123 | ||
diff --git a/fs/Kconfig b/fs/Kconfig index 5f4c45d4aa10..30145d886bc2 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -266,14 +266,6 @@ source "fs/9p/Kconfig" | |||
266 | 266 | ||
267 | endif # NETWORK_FILESYSTEMS | 267 | endif # NETWORK_FILESYSTEMS |
268 | 268 | ||
269 | if BLOCK | ||
270 | menu "Partition Types" | ||
271 | |||
272 | source "fs/partitions/Kconfig" | ||
273 | |||
274 | endmenu | ||
275 | endif | ||
276 | |||
277 | source "fs/nls/Kconfig" | 269 | source "fs/nls/Kconfig" |
278 | source "fs/dlm/Kconfig" | 270 | source "fs/dlm/Kconfig" |
279 | 271 | ||
diff --git a/fs/Makefile b/fs/Makefile index 310cfc4e69d3..93804d4d66e1 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -54,7 +54,6 @@ obj-$(CONFIG_FHANDLE) += fhandle.o | |||
54 | obj-y += quota/ | 54 | obj-y += quota/ |
55 | 55 | ||
56 | obj-$(CONFIG_PROC_FS) += proc/ | 56 | obj-$(CONFIG_PROC_FS) += proc/ |
57 | obj-y += partitions/ | ||
58 | obj-$(CONFIG_SYSFS) += sysfs/ | 57 | obj-$(CONFIG_SYSFS) += sysfs/ |
59 | obj-$(CONFIG_CONFIGFS_FS) += configfs/ | 58 | obj-$(CONFIG_CONFIGFS_FS) += configfs/ |
60 | obj-y += devpts/ | 59 | obj-y += devpts/ |
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index c2b9c79eb64e..45a0ce45d7b4 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -136,7 +136,7 @@ extern int affs_remove_header(struct dentry *dentry); | |||
136 | extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh); | 136 | extern u32 affs_checksum_block(struct super_block *sb, struct buffer_head *bh); |
137 | extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh); | 137 | extern void affs_fix_checksum(struct super_block *sb, struct buffer_head *bh); |
138 | extern void secs_to_datestamp(time_t secs, struct affs_date *ds); | 138 | extern void secs_to_datestamp(time_t secs, struct affs_date *ds); |
139 | extern mode_t prot_to_mode(u32 prot); | 139 | extern umode_t prot_to_mode(u32 prot); |
140 | extern void mode_to_prot(struct inode *inode); | 140 | extern void mode_to_prot(struct inode *inode); |
141 | extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...); | 141 | extern void affs_error(struct super_block *sb, const char *function, const char *fmt, ...); |
142 | extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...); | 142 | extern void affs_warning(struct super_block *sb, const char *function, const char *fmt, ...); |
@@ -156,8 +156,8 @@ extern void affs_free_bitmap(struct super_block *sb); | |||
156 | extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); | 156 | extern int affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len); |
157 | extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *); | 157 | extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *); |
158 | extern int affs_unlink(struct inode *dir, struct dentry *dentry); | 158 | extern int affs_unlink(struct inode *dir, struct dentry *dentry); |
159 | extern int affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *); | 159 | extern int affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *); |
160 | extern int affs_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 160 | extern int affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); |
161 | extern int affs_rmdir(struct inode *dir, struct dentry *dentry); | 161 | extern int affs_rmdir(struct inode *dir, struct dentry *dentry); |
162 | extern int affs_link(struct dentry *olddentry, struct inode *dir, | 162 | extern int affs_link(struct dentry *olddentry, struct inode *dir, |
163 | struct dentry *dentry); | 163 | struct dentry *dentry); |
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c index de37ec842340..52a6407682e6 100644 --- a/fs/affs/amigaffs.c +++ b/fs/affs/amigaffs.c | |||
@@ -390,10 +390,10 @@ secs_to_datestamp(time_t secs, struct affs_date *ds) | |||
390 | ds->ticks = cpu_to_be32(secs * 50); | 390 | ds->ticks = cpu_to_be32(secs * 50); |
391 | } | 391 | } |
392 | 392 | ||
393 | mode_t | 393 | umode_t |
394 | prot_to_mode(u32 prot) | 394 | prot_to_mode(u32 prot) |
395 | { | 395 | { |
396 | int mode = 0; | 396 | umode_t mode = 0; |
397 | 397 | ||
398 | if (!(prot & FIBF_NOWRITE)) | 398 | if (!(prot & FIBF_NOWRITE)) |
399 | mode |= S_IWUSR; | 399 | mode |= S_IWUSR; |
@@ -421,7 +421,7 @@ void | |||
421 | mode_to_prot(struct inode *inode) | 421 | mode_to_prot(struct inode *inode) |
422 | { | 422 | { |
423 | u32 prot = AFFS_I(inode)->i_protect; | 423 | u32 prot = AFFS_I(inode)->i_protect; |
424 | mode_t mode = inode->i_mode; | 424 | umode_t mode = inode->i_mode; |
425 | 425 | ||
426 | if (!(mode & S_IXUSR)) | 426 | if (!(mode & S_IXUSR)) |
427 | prot |= FIBF_NOEXECUTE; | 427 | prot |= FIBF_NOEXECUTE; |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 780a11dc6318..47806940aac0 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -255,13 +255,13 @@ affs_unlink(struct inode *dir, struct dentry *dentry) | |||
255 | } | 255 | } |
256 | 256 | ||
257 | int | 257 | int |
258 | affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | 258 | affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) |
259 | { | 259 | { |
260 | struct super_block *sb = dir->i_sb; | 260 | struct super_block *sb = dir->i_sb; |
261 | struct inode *inode; | 261 | struct inode *inode; |
262 | int error; | 262 | int error; |
263 | 263 | ||
264 | pr_debug("AFFS: create(%lu,\"%.*s\",0%o)\n",dir->i_ino,(int)dentry->d_name.len, | 264 | pr_debug("AFFS: create(%lu,\"%.*s\",0%ho)\n",dir->i_ino,(int)dentry->d_name.len, |
265 | dentry->d_name.name,mode); | 265 | dentry->d_name.name,mode); |
266 | 266 | ||
267 | inode = affs_new_inode(dir); | 267 | inode = affs_new_inode(dir); |
@@ -285,12 +285,12 @@ affs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata | |||
285 | } | 285 | } |
286 | 286 | ||
287 | int | 287 | int |
288 | affs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 288 | affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
289 | { | 289 | { |
290 | struct inode *inode; | 290 | struct inode *inode; |
291 | int error; | 291 | int error; |
292 | 292 | ||
293 | pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%o)\n",dir->i_ino, | 293 | pr_debug("AFFS: mkdir(%lu,\"%.*s\",0%ho)\n",dir->i_ino, |
294 | (int)dentry->d_name.len,dentry->d_name.name,mode); | 294 | (int)dentry->d_name.len,dentry->d_name.name,mode); |
295 | 295 | ||
296 | inode = affs_new_inode(dir); | 296 | inode = affs_new_inode(dir); |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 1b0b19550015..e22dc4b4a503 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -28,9 +28,9 @@ static int afs_d_delete(const struct dentry *dentry); | |||
28 | static void afs_d_release(struct dentry *dentry); | 28 | static void afs_d_release(struct dentry *dentry); |
29 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, | 29 | static int afs_lookup_filldir(void *_cookie, const char *name, int nlen, |
30 | loff_t fpos, u64 ino, unsigned dtype); | 30 | loff_t fpos, u64 ino, unsigned dtype); |
31 | static int afs_create(struct inode *dir, struct dentry *dentry, int mode, | 31 | static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
32 | struct nameidata *nd); | 32 | struct nameidata *nd); |
33 | static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 33 | static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode); |
34 | static int afs_rmdir(struct inode *dir, struct dentry *dentry); | 34 | static int afs_rmdir(struct inode *dir, struct dentry *dentry); |
35 | static int afs_unlink(struct inode *dir, struct dentry *dentry); | 35 | static int afs_unlink(struct inode *dir, struct dentry *dentry); |
36 | static int afs_link(struct dentry *from, struct inode *dir, | 36 | static int afs_link(struct dentry *from, struct inode *dir, |
@@ -764,7 +764,7 @@ static void afs_d_release(struct dentry *dentry) | |||
764 | /* | 764 | /* |
765 | * create a directory on an AFS filesystem | 765 | * create a directory on an AFS filesystem |
766 | */ | 766 | */ |
767 | static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 767 | static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
768 | { | 768 | { |
769 | struct afs_file_status status; | 769 | struct afs_file_status status; |
770 | struct afs_callback cb; | 770 | struct afs_callback cb; |
@@ -777,7 +777,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
777 | 777 | ||
778 | dvnode = AFS_FS_I(dir); | 778 | dvnode = AFS_FS_I(dir); |
779 | 779 | ||
780 | _enter("{%x:%u},{%s},%o", | 780 | _enter("{%x:%u},{%s},%ho", |
781 | dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); | 781 | dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); |
782 | 782 | ||
783 | ret = -ENAMETOOLONG; | 783 | ret = -ENAMETOOLONG; |
@@ -948,7 +948,7 @@ error: | |||
948 | /* | 948 | /* |
949 | * create a regular file on an AFS filesystem | 949 | * create a regular file on an AFS filesystem |
950 | */ | 950 | */ |
951 | static int afs_create(struct inode *dir, struct dentry *dentry, int mode, | 951 | static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
952 | struct nameidata *nd) | 952 | struct nameidata *nd) |
953 | { | 953 | { |
954 | struct afs_file_status status; | 954 | struct afs_file_status status; |
@@ -962,7 +962,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
962 | 962 | ||
963 | dvnode = AFS_FS_I(dir); | 963 | dvnode = AFS_FS_I(dir); |
964 | 964 | ||
965 | _enter("{%x:%u},{%s},%o,", | 965 | _enter("{%x:%u},{%s},%ho,", |
966 | dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); | 966 | dvnode->fid.vid, dvnode->fid.vnode, dentry->d_name.name, mode); |
967 | 967 | ||
968 | ret = -ENAMETOOLONG; | 968 | ret = -ENAMETOOLONG; |
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(setattr_copy); | |||
166 | int notify_change(struct dentry * dentry, struct iattr * attr) | 166 | int notify_change(struct dentry * dentry, struct iattr * attr) |
167 | { | 167 | { |
168 | struct inode *inode = dentry->d_inode; | 168 | struct inode *inode = dentry->d_inode; |
169 | mode_t mode = inode->i_mode; | 169 | umode_t mode = inode->i_mode; |
170 | int error; | 170 | int error; |
171 | struct timespec now; | 171 | struct timespec now; |
172 | unsigned int ia_valid = attr->ia_valid; | 172 | unsigned int ia_valid = attr->ia_valid; |
@@ -177,7 +177,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | if ((ia_valid & ATTR_MODE)) { | 179 | if ((ia_valid & ATTR_MODE)) { |
180 | mode_t amode = attr->ia_mode; | 180 | umode_t amode = attr->ia_mode; |
181 | /* Flag setting protected by i_mutex */ | 181 | /* Flag setting protected by i_mutex */ |
182 | if (is_sxid(amode)) | 182 | if (is_sxid(amode)) |
183 | inode->i_flags &= ~S_NOSEC; | 183 | inode->i_flags &= ~S_NOSEC; |
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h index 326dc08d3e3f..5869d4e974a9 100644 --- a/fs/autofs4/autofs_i.h +++ b/fs/autofs4/autofs_i.h | |||
@@ -155,7 +155,7 @@ static inline int autofs4_ispending(struct dentry *dentry) | |||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | struct inode *autofs4_get_inode(struct super_block *, mode_t); | 158 | struct inode *autofs4_get_inode(struct super_block *, umode_t); |
159 | void autofs4_free_ino(struct autofs_info *); | 159 | void autofs4_free_ino(struct autofs_info *); |
160 | 160 | ||
161 | /* Expiration */ | 161 | /* Expiration */ |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 8179f1ab8175..f799efad52a8 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -326,7 +326,7 @@ fail_unlock: | |||
326 | return -EINVAL; | 326 | return -EINVAL; |
327 | } | 327 | } |
328 | 328 | ||
329 | struct inode *autofs4_get_inode(struct super_block *sb, mode_t mode) | 329 | struct inode *autofs4_get_inode(struct super_block *sb, umode_t mode) |
330 | { | 330 | { |
331 | struct inode *inode = new_inode(sb); | 331 | struct inode *inode = new_inode(sb); |
332 | 332 | ||
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index f55ae23b137e..75e5f1c8e028 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -26,7 +26,7 @@ | |||
26 | static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); | 26 | static int autofs4_dir_symlink(struct inode *,struct dentry *,const char *); |
27 | static int autofs4_dir_unlink(struct inode *,struct dentry *); | 27 | static int autofs4_dir_unlink(struct inode *,struct dentry *); |
28 | static int autofs4_dir_rmdir(struct inode *,struct dentry *); | 28 | static int autofs4_dir_rmdir(struct inode *,struct dentry *); |
29 | static int autofs4_dir_mkdir(struct inode *,struct dentry *,int); | 29 | static int autofs4_dir_mkdir(struct inode *,struct dentry *,umode_t); |
30 | static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); | 30 | static long autofs4_root_ioctl(struct file *,unsigned int,unsigned long); |
31 | #ifdef CONFIG_COMPAT | 31 | #ifdef CONFIG_COMPAT |
32 | static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); | 32 | static long autofs4_root_compat_ioctl(struct file *,unsigned int,unsigned long); |
@@ -699,7 +699,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry) | |||
699 | return 0; | 699 | return 0; |
700 | } | 700 | } |
701 | 701 | ||
702 | static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 702 | static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
703 | { | 703 | { |
704 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); | 704 | struct autofs_sb_info *sbi = autofs4_sbi(dir->i_sb); |
705 | struct autofs_info *ino = autofs4_dentry_ino(dentry); | 705 | struct autofs_info *ino = autofs4_dentry_ino(dentry); |
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index 9205cf25f1c6..22e9a78872ff 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -173,7 +173,7 @@ static const struct file_operations bad_file_ops = | |||
173 | }; | 173 | }; |
174 | 174 | ||
175 | static int bad_inode_create (struct inode *dir, struct dentry *dentry, | 175 | static int bad_inode_create (struct inode *dir, struct dentry *dentry, |
176 | int mode, struct nameidata *nd) | 176 | umode_t mode, struct nameidata *nd) |
177 | { | 177 | { |
178 | return -EIO; | 178 | return -EIO; |
179 | } | 179 | } |
@@ -202,7 +202,7 @@ static int bad_inode_symlink (struct inode *dir, struct dentry *dentry, | |||
202 | } | 202 | } |
203 | 203 | ||
204 | static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, | 204 | static int bad_inode_mkdir(struct inode *dir, struct dentry *dentry, |
205 | int mode) | 205 | umode_t mode) |
206 | { | 206 | { |
207 | return -EIO; | 207 | return -EIO; |
208 | } | 208 | } |
@@ -213,7 +213,7 @@ static int bad_inode_rmdir (struct inode *dir, struct dentry *dentry) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, | 215 | static int bad_inode_mknod (struct inode *dir, struct dentry *dentry, |
216 | int mode, dev_t rdev) | 216 | umode_t mode, dev_t rdev) |
217 | { | 217 | { |
218 | return -EIO; | 218 | return -EIO; |
219 | } | 219 | } |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 9cc074019479..d12c7966db27 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -84,7 +84,7 @@ const struct file_operations bfs_dir_operations = { | |||
84 | 84 | ||
85 | extern void dump_imap(const char *, struct super_block *); | 85 | extern void dump_imap(const char *, struct super_block *); |
86 | 86 | ||
87 | static int bfs_create(struct inode *dir, struct dentry *dentry, int mode, | 87 | static int bfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
88 | struct nameidata *nd) | 88 | struct nameidata *nd) |
89 | { | 89 | { |
90 | int err; | 90 | int err; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 7866cdd9fe70..69a5b6fbee2b 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/blkpg.h> | 18 | #include <linux/blkpg.h> |
19 | #include <linux/buffer_head.h> | 19 | #include <linux/buffer_head.h> |
20 | #include <linux/swap.h> | ||
20 | #include <linux/pagevec.h> | 21 | #include <linux/pagevec.h> |
21 | #include <linux/writeback.h> | 22 | #include <linux/writeback.h> |
22 | #include <linux/mpage.h> | 23 | #include <linux/mpage.h> |
@@ -25,6 +26,7 @@ | |||
25 | #include <linux/namei.h> | 26 | #include <linux/namei.h> |
26 | #include <linux/log2.h> | 27 | #include <linux/log2.h> |
27 | #include <linux/kmemleak.h> | 28 | #include <linux/kmemleak.h> |
29 | #include <linux/cleancache.h> | ||
28 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
29 | #include "internal.h" | 31 | #include "internal.h" |
30 | 32 | ||
@@ -82,13 +84,35 @@ static sector_t max_block(struct block_device *bdev) | |||
82 | } | 84 | } |
83 | 85 | ||
84 | /* Kill _all_ buffers and pagecache , dirty or not.. */ | 86 | /* Kill _all_ buffers and pagecache , dirty or not.. */ |
85 | static void kill_bdev(struct block_device *bdev) | 87 | void kill_bdev(struct block_device *bdev) |
86 | { | 88 | { |
87 | if (bdev->bd_inode->i_mapping->nrpages == 0) | 89 | struct address_space *mapping = bdev->bd_inode->i_mapping; |
90 | |||
91 | if (mapping->nrpages == 0) | ||
88 | return; | 92 | return; |
93 | |||
89 | invalidate_bh_lrus(); | 94 | invalidate_bh_lrus(); |
90 | truncate_inode_pages(bdev->bd_inode->i_mapping, 0); | 95 | truncate_inode_pages(mapping, 0); |
91 | } | 96 | } |
97 | EXPORT_SYMBOL(kill_bdev); | ||
98 | |||
99 | /* Invalidate clean unused buffers and pagecache. */ | ||
100 | void invalidate_bdev(struct block_device *bdev) | ||
101 | { | ||
102 | struct address_space *mapping = bdev->bd_inode->i_mapping; | ||
103 | |||
104 | if (mapping->nrpages == 0) | ||
105 | return; | ||
106 | |||
107 | invalidate_bh_lrus(); | ||
108 | lru_add_drain_all(); /* make sure all lru add caches are flushed */ | ||
109 | invalidate_mapping_pages(mapping, 0, -1); | ||
110 | /* 99% of the time, we don't need to flush the cleancache on the bdev. | ||
111 | * But, for the strange corners, lets be cautious | ||
112 | */ | ||
113 | cleancache_flush_inode(mapping); | ||
114 | } | ||
115 | EXPORT_SYMBOL(invalidate_bdev); | ||
92 | 116 | ||
93 | int set_blocksize(struct block_device *bdev, int size) | 117 | int set_blocksize(struct block_device *bdev, int size) |
94 | { | 118 | { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f8ff9738558a..2f426a51e60d 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4412,8 +4412,8 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans, | |||
4412 | struct btrfs_root *root, | 4412 | struct btrfs_root *root, |
4413 | struct inode *dir, | 4413 | struct inode *dir, |
4414 | const char *name, int name_len, | 4414 | const char *name, int name_len, |
4415 | u64 ref_objectid, u64 objectid, int mode, | 4415 | u64 ref_objectid, u64 objectid, |
4416 | u64 *index) | 4416 | umode_t mode, u64 *index) |
4417 | { | 4417 | { |
4418 | struct inode *inode; | 4418 | struct inode *inode; |
4419 | struct btrfs_inode_item *inode_item; | 4419 | struct btrfs_inode_item *inode_item; |
@@ -4596,7 +4596,7 @@ static int btrfs_add_nondir(struct btrfs_trans_handle *trans, | |||
4596 | } | 4596 | } |
4597 | 4597 | ||
4598 | static int btrfs_mknod(struct inode *dir, struct dentry *dentry, | 4598 | static int btrfs_mknod(struct inode *dir, struct dentry *dentry, |
4599 | int mode, dev_t rdev) | 4599 | umode_t mode, dev_t rdev) |
4600 | { | 4600 | { |
4601 | struct btrfs_trans_handle *trans; | 4601 | struct btrfs_trans_handle *trans; |
4602 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4602 | struct btrfs_root *root = BTRFS_I(dir)->root; |
@@ -4665,7 +4665,7 @@ out_unlock: | |||
4665 | } | 4665 | } |
4666 | 4666 | ||
4667 | static int btrfs_create(struct inode *dir, struct dentry *dentry, | 4667 | static int btrfs_create(struct inode *dir, struct dentry *dentry, |
4668 | int mode, struct nameidata *nd) | 4668 | umode_t mode, struct nameidata *nd) |
4669 | { | 4669 | { |
4670 | struct btrfs_trans_handle *trans; | 4670 | struct btrfs_trans_handle *trans; |
4671 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4671 | struct btrfs_root *root = BTRFS_I(dir)->root; |
@@ -4792,7 +4792,7 @@ fail: | |||
4792 | return err; | 4792 | return err; |
4793 | } | 4793 | } |
4794 | 4794 | ||
4795 | static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 4795 | static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
4796 | { | 4796 | { |
4797 | struct inode *inode = NULL; | 4797 | struct inode *inode = NULL; |
4798 | struct btrfs_trans_handle *trans; | 4798 | struct btrfs_trans_handle *trans; |
diff --git a/fs/buffer.c b/fs/buffer.c index 19d8eb7fdc81..1a30db77af32 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <linux/bitops.h> | 41 | #include <linux/bitops.h> |
42 | #include <linux/mpage.h> | 42 | #include <linux/mpage.h> |
43 | #include <linux/bit_spinlock.h> | 43 | #include <linux/bit_spinlock.h> |
44 | #include <linux/cleancache.h> | ||
45 | 44 | ||
46 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); | 45 | static int fsync_buffers_list(spinlock_t *lock, struct list_head *list); |
47 | 46 | ||
@@ -231,55 +230,6 @@ out: | |||
231 | return ret; | 230 | return ret; |
232 | } | 231 | } |
233 | 232 | ||
234 | /* If invalidate_buffers() will trash dirty buffers, it means some kind | ||
235 | of fs corruption is going on. Trashing dirty data always imply losing | ||
236 | information that was supposed to be just stored on the physical layer | ||
237 | by the user. | ||
238 | |||
239 | Thus invalidate_buffers in general usage is not allwowed to trash | ||
240 | dirty buffers. For example ioctl(FLSBLKBUF) expects dirty data to | ||
241 | be preserved. These buffers are simply skipped. | ||
242 | |||
243 | We also skip buffers which are still in use. For example this can | ||
244 | happen if a userspace program is reading the block device. | ||
245 | |||
246 | NOTE: In the case where the user removed a removable-media-disk even if | ||
247 | there's still dirty data not synced on disk (due a bug in the device driver | ||
248 | or due an error of the user), by not destroying the dirty buffers we could | ||
249 | generate corruption also on the next media inserted, thus a parameter is | ||
250 | necessary to handle this case in the most safe way possible (trying | ||
251 | to not corrupt also the new disk inserted with the data belonging to | ||
252 | the old now corrupted disk). Also for the ramdisk the natural thing | ||
253 | to do in order to release the ramdisk memory is to destroy dirty buffers. | ||
254 | |||
255 | These are two special cases. Normal usage imply the device driver | ||
256 | to issue a sync on the device (without waiting I/O completion) and | ||
257 | then an invalidate_buffers call that doesn't trash dirty buffers. | ||
258 | |||
259 | For handling cache coherency with the blkdev pagecache the 'update' case | ||
260 | is been introduced. It is needed to re-read from disk any pinned | ||
261 | buffer. NOTE: re-reading from disk is destructive so we can do it only | ||
262 | when we assume nobody is changing the buffercache under our I/O and when | ||
263 | we think the disk contains more recent information than the buffercache. | ||
264 | The update == 1 pass marks the buffers we need to update, the update == 2 | ||
265 | pass does the actual I/O. */ | ||
266 | void invalidate_bdev(struct block_device *bdev) | ||
267 | { | ||
268 | struct address_space *mapping = bdev->bd_inode->i_mapping; | ||
269 | |||
270 | if (mapping->nrpages == 0) | ||
271 | return; | ||
272 | |||
273 | invalidate_bh_lrus(); | ||
274 | lru_add_drain_all(); /* make sure all lru add caches are flushed */ | ||
275 | invalidate_mapping_pages(mapping, 0, -1); | ||
276 | /* 99% of the time, we don't need to flush the cleancache on the bdev. | ||
277 | * But, for the strange corners, lets be cautious | ||
278 | */ | ||
279 | cleancache_flush_inode(mapping); | ||
280 | } | ||
281 | EXPORT_SYMBOL(invalidate_bdev); | ||
282 | |||
283 | /* | 233 | /* |
284 | * Kick the writeback threads then try to free up some ZONE_NORMAL memory. | 234 | * Kick the writeback threads then try to free up some ZONE_NORMAL memory. |
285 | */ | 235 | */ |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index 1064805e653b..67bef6d01484 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/mount.h> | 13 | #include <linux/mount.h> |
14 | #include <linux/buffer_head.h> | ||
15 | #include "internal.h" | 14 | #include "internal.h" |
16 | 15 | ||
17 | #define list_to_page(head) (list_entry((head)->prev, struct page, lru)) | 16 | #define list_to_page(head) (list_entry((head)->prev, struct page, lru)) |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 8b53193e4f7c..b60fc8bfb3e9 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -928,7 +928,7 @@ static int send_cap_msg(struct ceph_mds_session *session, | |||
928 | u64 size, u64 max_size, | 928 | u64 size, u64 max_size, |
929 | struct timespec *mtime, struct timespec *atime, | 929 | struct timespec *mtime, struct timespec *atime, |
930 | u64 time_warp_seq, | 930 | u64 time_warp_seq, |
931 | uid_t uid, gid_t gid, mode_t mode, | 931 | uid_t uid, gid_t gid, umode_t mode, |
932 | u64 xattr_version, | 932 | u64 xattr_version, |
933 | struct ceph_buffer *xattrs_buf, | 933 | struct ceph_buffer *xattrs_buf, |
934 | u64 follows) | 934 | u64 follows) |
@@ -1078,7 +1078,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1078 | u64 size, max_size; | 1078 | u64 size, max_size; |
1079 | struct timespec mtime, atime; | 1079 | struct timespec mtime, atime; |
1080 | int wake = 0; | 1080 | int wake = 0; |
1081 | mode_t mode; | 1081 | umode_t mode; |
1082 | uid_t uid; | 1082 | uid_t uid; |
1083 | gid_t gid; | 1083 | gid_t gid; |
1084 | struct ceph_mds_session *session; | 1084 | struct ceph_mds_session *session; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 98954003a8d3..74fd74719dc2 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -666,7 +666,7 @@ int ceph_handle_notrace_create(struct inode *dir, struct dentry *dentry) | |||
666 | } | 666 | } |
667 | 667 | ||
668 | static int ceph_mknod(struct inode *dir, struct dentry *dentry, | 668 | static int ceph_mknod(struct inode *dir, struct dentry *dentry, |
669 | int mode, dev_t rdev) | 669 | umode_t mode, dev_t rdev) |
670 | { | 670 | { |
671 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 671 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
672 | struct ceph_mds_client *mdsc = fsc->mdsc; | 672 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -676,7 +676,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
676 | if (ceph_snap(dir) != CEPH_NOSNAP) | 676 | if (ceph_snap(dir) != CEPH_NOSNAP) |
677 | return -EROFS; | 677 | return -EROFS; |
678 | 678 | ||
679 | dout("mknod in dir %p dentry %p mode 0%o rdev %d\n", | 679 | dout("mknod in dir %p dentry %p mode 0%ho rdev %d\n", |
680 | dir, dentry, mode, rdev); | 680 | dir, dentry, mode, rdev); |
681 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS); | 681 | req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_MKNOD, USE_AUTH_MDS); |
682 | if (IS_ERR(req)) { | 682 | if (IS_ERR(req)) { |
@@ -699,7 +699,7 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
699 | return err; | 699 | return err; |
700 | } | 700 | } |
701 | 701 | ||
702 | static int ceph_create(struct inode *dir, struct dentry *dentry, int mode, | 702 | static int ceph_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
703 | struct nameidata *nd) | 703 | struct nameidata *nd) |
704 | { | 704 | { |
705 | dout("create in dir %p dentry %p name '%.*s'\n", | 705 | dout("create in dir %p dentry %p name '%.*s'\n", |
@@ -753,7 +753,7 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, | |||
753 | return err; | 753 | return err; |
754 | } | 754 | } |
755 | 755 | ||
756 | static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 756 | static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
757 | { | 757 | { |
758 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); | 758 | struct ceph_fs_client *fsc = ceph_sb_to_client(dir->i_sb); |
759 | struct ceph_mds_client *mdsc = fsc->mdsc; | 759 | struct ceph_mds_client *mdsc = fsc->mdsc; |
@@ -767,7 +767,7 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
767 | dout("mksnap dir %p snap '%.*s' dn %p\n", dir, | 767 | dout("mksnap dir %p snap '%.*s' dn %p\n", dir, |
768 | dentry->d_name.len, dentry->d_name.name, dentry); | 768 | dentry->d_name.len, dentry->d_name.name, dentry); |
769 | } else if (ceph_snap(dir) == CEPH_NOSNAP) { | 769 | } else if (ceph_snap(dir) == CEPH_NOSNAP) { |
770 | dout("mkdir dir %p dn %p mode 0%o\n", dir, dentry, mode); | 770 | dout("mkdir dir %p dn %p mode 0%ho\n", dir, dentry, mode); |
771 | op = CEPH_MDS_OP_MKDIR; | 771 | op = CEPH_MDS_OP_MKDIR; |
772 | } else { | 772 | } else { |
773 | goto out; | 773 | goto out; |
@@ -870,7 +870,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) | |||
870 | } else if (ceph_snap(dir) == CEPH_NOSNAP) { | 870 | } else if (ceph_snap(dir) == CEPH_NOSNAP) { |
871 | dout("unlink/rmdir dir %p dn %p inode %p\n", | 871 | dout("unlink/rmdir dir %p dn %p inode %p\n", |
872 | dir, dentry, inode); | 872 | dir, dentry, inode); |
873 | op = ((dentry->d_inode->i_mode & S_IFMT) == S_IFDIR) ? | 873 | op = S_ISDIR(dentry->d_inode->i_mode) ? |
874 | CEPH_MDS_OP_RMDIR : CEPH_MDS_OP_UNLINK; | 874 | CEPH_MDS_OP_RMDIR : CEPH_MDS_OP_UNLINK; |
875 | } else | 875 | } else |
876 | goto out; | 876 | goto out; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index edcbf3774a56..cb3652b37271 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -136,7 +136,7 @@ struct ceph_cap_snap { | |||
136 | int issued, dirty; | 136 | int issued, dirty; |
137 | struct ceph_snap_context *context; | 137 | struct ceph_snap_context *context; |
138 | 138 | ||
139 | mode_t mode; | 139 | umode_t mode; |
140 | uid_t uid; | 140 | uid_t uid; |
141 | gid_t gid; | 141 | gid_t gid; |
142 | 142 | ||
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index 500d65859279..c865bfdfe819 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h | |||
@@ -59,8 +59,8 @@ struct cifs_sb_info { | |||
59 | gid_t mnt_gid; | 59 | gid_t mnt_gid; |
60 | uid_t mnt_backupuid; | 60 | uid_t mnt_backupuid; |
61 | gid_t mnt_backupgid; | 61 | gid_t mnt_backupgid; |
62 | mode_t mnt_file_mode; | 62 | umode_t mnt_file_mode; |
63 | mode_t mnt_dir_mode; | 63 | umode_t mnt_dir_mode; |
64 | unsigned int mnt_cifs_flags; | 64 | unsigned int mnt_cifs_flags; |
65 | char *mountdata; /* options received at mount time or via DFS refs */ | 65 | char *mountdata; /* options received at mount time or via DFS refs */ |
66 | struct backing_dev_info bdi; | 66 | struct backing_dev_info bdi; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 8f1fe324162b..5bb961c13c4d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -393,7 +393,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) | |||
393 | cifs_show_address(s, tcon->ses->server); | 393 | cifs_show_address(s, tcon->ses->server); |
394 | 394 | ||
395 | if (!tcon->unix_ext) | 395 | if (!tcon->unix_ext) |
396 | seq_printf(s, ",file_mode=0%o,dir_mode=0%o", | 396 | seq_printf(s, ",file_mode=0%ho,dir_mode=0%ho", |
397 | cifs_sb->mnt_file_mode, | 397 | cifs_sb->mnt_file_mode, |
398 | cifs_sb->mnt_dir_mode); | 398 | cifs_sb->mnt_dir_mode); |
399 | if (tcon->seal) | 399 | if (tcon->seal) |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 30ff56005d8f..fe5ecf1b422a 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -44,14 +44,14 @@ extern const struct address_space_operations cifs_addr_ops_smallbuf; | |||
44 | /* Functions related to inodes */ | 44 | /* Functions related to inodes */ |
45 | extern const struct inode_operations cifs_dir_inode_ops; | 45 | extern const struct inode_operations cifs_dir_inode_ops; |
46 | extern struct inode *cifs_root_iget(struct super_block *); | 46 | extern struct inode *cifs_root_iget(struct super_block *); |
47 | extern int cifs_create(struct inode *, struct dentry *, int, | 47 | extern int cifs_create(struct inode *, struct dentry *, umode_t, |
48 | struct nameidata *); | 48 | struct nameidata *); |
49 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, | 49 | extern struct dentry *cifs_lookup(struct inode *, struct dentry *, |
50 | struct nameidata *); | 50 | struct nameidata *); |
51 | extern int cifs_unlink(struct inode *dir, struct dentry *dentry); | 51 | extern int cifs_unlink(struct inode *dir, struct dentry *dentry); |
52 | extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); | 52 | extern int cifs_hardlink(struct dentry *, struct inode *, struct dentry *); |
53 | extern int cifs_mknod(struct inode *, struct dentry *, int, dev_t); | 53 | extern int cifs_mknod(struct inode *, struct dentry *, umode_t, dev_t); |
54 | extern int cifs_mkdir(struct inode *, struct dentry *, int); | 54 | extern int cifs_mkdir(struct inode *, struct dentry *, umode_t); |
55 | extern int cifs_rmdir(struct inode *, struct dentry *); | 55 | extern int cifs_rmdir(struct inode *, struct dentry *); |
56 | extern int cifs_rename(struct inode *, struct dentry *, struct inode *, | 56 | extern int cifs_rename(struct inode *, struct dentry *, struct inode *, |
57 | struct dentry *); | 57 | struct dentry *); |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8238aa13e01c..ba53c1c6c6cc 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -169,8 +169,8 @@ struct smb_vol { | |||
169 | gid_t linux_gid; | 169 | gid_t linux_gid; |
170 | uid_t backupuid; | 170 | uid_t backupuid; |
171 | gid_t backupgid; | 171 | gid_t backupgid; |
172 | mode_t file_mode; | 172 | umode_t file_mode; |
173 | mode_t dir_mode; | 173 | umode_t dir_mode; |
174 | unsigned secFlg; | 174 | unsigned secFlg; |
175 | bool retry:1; | 175 | bool retry:1; |
176 | bool intr:1; | 176 | bool intr:1; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 8cd4b52d4217..be1e8f91c0ad 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2819,7 +2819,7 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2819 | cifs_sb->mnt_backupgid = pvolume_info->backupgid; | 2819 | cifs_sb->mnt_backupgid = pvolume_info->backupgid; |
2820 | cifs_sb->mnt_file_mode = pvolume_info->file_mode; | 2820 | cifs_sb->mnt_file_mode = pvolume_info->file_mode; |
2821 | cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; | 2821 | cifs_sb->mnt_dir_mode = pvolume_info->dir_mode; |
2822 | cFYI(1, "file mode: 0x%x dir mode: 0x%x", | 2822 | cFYI(1, "file mode: 0x%hx dir mode: 0x%hx", |
2823 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); | 2823 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); |
2824 | 2824 | ||
2825 | cifs_sb->actimeo = pvolume_info->actimeo; | 2825 | cifs_sb->actimeo = pvolume_info->actimeo; |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index d7eeb9d3ed6f..df8fecb5b993 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -136,7 +136,7 @@ cifs_bp_rename_retry: | |||
136 | /* Inode operations in similar order to how they appear in Linux file fs.h */ | 136 | /* Inode operations in similar order to how they appear in Linux file fs.h */ |
137 | 137 | ||
138 | int | 138 | int |
139 | cifs_create(struct inode *inode, struct dentry *direntry, int mode, | 139 | cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, |
140 | struct nameidata *nd) | 140 | struct nameidata *nd) |
141 | { | 141 | { |
142 | int rc = -ENOENT; | 142 | int rc = -ENOENT; |
@@ -355,7 +355,7 @@ cifs_create_out: | |||
355 | return rc; | 355 | return rc; |
356 | } | 356 | } |
357 | 357 | ||
358 | int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | 358 | int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, |
359 | dev_t device_number) | 359 | dev_t device_number) |
360 | { | 360 | { |
361 | int rc = -EPERM; | 361 | int rc = -EPERM; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index e851d5b8931e..a5f54b7d9822 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1264,7 +1264,7 @@ unlink_out: | |||
1264 | return rc; | 1264 | return rc; |
1265 | } | 1265 | } |
1266 | 1266 | ||
1267 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | 1267 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) |
1268 | { | 1268 | { |
1269 | int rc = 0, tmprc; | 1269 | int rc = 0, tmprc; |
1270 | int xid; | 1270 | int xid; |
@@ -1275,7 +1275,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1275 | struct inode *newinode = NULL; | 1275 | struct inode *newinode = NULL; |
1276 | struct cifs_fattr fattr; | 1276 | struct cifs_fattr fattr; |
1277 | 1277 | ||
1278 | cFYI(1, "In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode); | 1278 | cFYI(1, "In cifs_mkdir, mode = 0x%hx inode = 0x%p", mode, inode); |
1279 | 1279 | ||
1280 | cifs_sb = CIFS_SB(inode->i_sb); | 1280 | cifs_sb = CIFS_SB(inode->i_sb); |
1281 | tlink = cifs_sb_tlink(cifs_sb); | 1281 | tlink = cifs_sb_tlink(cifs_sb); |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 28e7e135cfab..83d2fd8ec24b 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -30,14 +30,14 @@ | |||
30 | #include "coda_int.h" | 30 | #include "coda_int.h" |
31 | 31 | ||
32 | /* dir inode-ops */ | 32 | /* dir inode-ops */ |
33 | static int coda_create(struct inode *dir, struct dentry *new, int mode, struct nameidata *nd); | 33 | static int coda_create(struct inode *dir, struct dentry *new, umode_t mode, struct nameidata *nd); |
34 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd); | 34 | static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd); |
35 | static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, | 35 | static int coda_link(struct dentry *old_dentry, struct inode *dir_inode, |
36 | struct dentry *entry); | 36 | struct dentry *entry); |
37 | static int coda_unlink(struct inode *dir_inode, struct dentry *entry); | 37 | static int coda_unlink(struct inode *dir_inode, struct dentry *entry); |
38 | static int coda_symlink(struct inode *dir_inode, struct dentry *entry, | 38 | static int coda_symlink(struct inode *dir_inode, struct dentry *entry, |
39 | const char *symname); | 39 | const char *symname); |
40 | static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, int mode); | 40 | static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, umode_t mode); |
41 | static int coda_rmdir(struct inode *dir_inode, struct dentry *entry); | 41 | static int coda_rmdir(struct inode *dir_inode, struct dentry *entry); |
42 | static int coda_rename(struct inode *old_inode, struct dentry *old_dentry, | 42 | static int coda_rename(struct inode *old_inode, struct dentry *old_dentry, |
43 | struct inode *new_inode, struct dentry *new_dentry); | 43 | struct inode *new_inode, struct dentry *new_dentry); |
@@ -191,7 +191,7 @@ static inline void coda_dir_drop_nlink(struct inode *dir) | |||
191 | } | 191 | } |
192 | 192 | ||
193 | /* creation routines: create, mknod, mkdir, link, symlink */ | 193 | /* creation routines: create, mknod, mkdir, link, symlink */ |
194 | static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd) | 194 | static int coda_create(struct inode *dir, struct dentry *de, umode_t mode, struct nameidata *nd) |
195 | { | 195 | { |
196 | int error; | 196 | int error; |
197 | const char *name=de->d_name.name; | 197 | const char *name=de->d_name.name; |
@@ -223,7 +223,7 @@ err_out: | |||
223 | return error; | 223 | return error; |
224 | } | 224 | } |
225 | 225 | ||
226 | static int coda_mkdir(struct inode *dir, struct dentry *de, int mode) | 226 | static int coda_mkdir(struct inode *dir, struct dentry *de, umode_t mode) |
227 | { | 227 | { |
228 | struct inode *inode; | 228 | struct inode *inode; |
229 | struct coda_vattr attrs; | 229 | struct coda_vattr attrs; |
diff --git a/fs/compat.c b/fs/compat.c index 9db5a6076610..fa9d721ecfee 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1281,7 +1281,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32, | |||
1281 | * O_LARGEFILE flag. | 1281 | * O_LARGEFILE flag. |
1282 | */ | 1282 | */ |
1283 | asmlinkage long | 1283 | asmlinkage long |
1284 | compat_sys_open(const char __user *filename, int flags, int mode) | 1284 | compat_sys_open(const char __user *filename, int flags, umode_t mode) |
1285 | { | 1285 | { |
1286 | return do_sys_open(AT_FDCWD, filename, flags, mode); | 1286 | return do_sys_open(AT_FDCWD, filename, flags, mode); |
1287 | } | 1287 | } |
@@ -1291,7 +1291,7 @@ compat_sys_open(const char __user *filename, int flags, int mode) | |||
1291 | * O_LARGEFILE flag. | 1291 | * O_LARGEFILE flag. |
1292 | */ | 1292 | */ |
1293 | asmlinkage long | 1293 | asmlinkage long |
1294 | compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, int mode) | 1294 | compat_sys_openat(unsigned int dfd, const char __user *filename, int flags, umode_t mode) |
1295 | { | 1295 | { |
1296 | return do_sys_open(dfd, filename, flags, mode); | 1296 | return do_sys_open(dfd, filename, flags, mode); |
1297 | } | 1297 | } |
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index 82bda8fdfc1c..ede857d20a04 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h | |||
@@ -63,8 +63,8 @@ extern struct kmem_cache *configfs_dir_cachep; | |||
63 | 63 | ||
64 | extern int configfs_is_root(struct config_item *item); | 64 | extern int configfs_is_root(struct config_item *item); |
65 | 65 | ||
66 | extern struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent *); | 66 | extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *); |
67 | extern int configfs_create(struct dentry *, int mode, int (*init)(struct inode *)); | 67 | extern int configfs_create(struct dentry *, umode_t mode, int (*init)(struct inode *)); |
68 | extern int configfs_inode_init(void); | 68 | extern int configfs_inode_init(void); |
69 | extern void configfs_inode_exit(void); | 69 | extern void configfs_inode_exit(void); |
70 | 70 | ||
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 1c5296911104..5ddd7ebd9dcd 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -1170,7 +1170,7 @@ void configfs_undepend_item(struct configfs_subsystem *subsys, | |||
1170 | } | 1170 | } |
1171 | EXPORT_SYMBOL(configfs_undepend_item); | 1171 | EXPORT_SYMBOL(configfs_undepend_item); |
1172 | 1172 | ||
1173 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 1173 | static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
1174 | { | 1174 | { |
1175 | int ret = 0; | 1175 | int ret = 0; |
1176 | int module_got = 0; | 1176 | int module_got = 0; |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 9d8715c45f25..3ee36d418863 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -116,7 +116,7 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) | |||
116 | return error; | 116 | return error; |
117 | } | 117 | } |
118 | 118 | ||
119 | static inline void set_default_inode_attr(struct inode * inode, mode_t mode) | 119 | static inline void set_default_inode_attr(struct inode * inode, umode_t mode) |
120 | { | 120 | { |
121 | inode->i_mode = mode; | 121 | inode->i_mode = mode; |
122 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 122 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
@@ -132,7 +132,7 @@ static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) | |||
132 | inode->i_ctime = iattr->ia_ctime; | 132 | inode->i_ctime = iattr->ia_ctime; |
133 | } | 133 | } |
134 | 134 | ||
135 | struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd) | 135 | struct inode *configfs_new_inode(umode_t mode, struct configfs_dirent * sd) |
136 | { | 136 | { |
137 | struct inode * inode = new_inode(configfs_sb); | 137 | struct inode * inode = new_inode(configfs_sb); |
138 | if (inode) { | 138 | if (inode) { |
@@ -185,7 +185,7 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd, | |||
185 | 185 | ||
186 | #endif /* CONFIG_LOCKDEP */ | 186 | #endif /* CONFIG_LOCKDEP */ |
187 | 187 | ||
188 | int configfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *)) | 188 | int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct inode *)) |
189 | { | 189 | { |
190 | int error = 0; | 190 | int error = 0; |
191 | struct inode * inode = NULL; | 191 | struct inode * inode = NULL; |
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 739fb59bcdc2..a2ee8f9f5a38 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/cramfs_fs.h> | 20 | #include <linux/cramfs_fs.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/cramfs_fs_sb.h> | 22 | #include <linux/cramfs_fs_sb.h> |
23 | #include <linux/buffer_head.h> | ||
24 | #include <linux/vfs.h> | 23 | #include <linux/vfs.h> |
25 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
26 | 25 | ||
@@ -378,7 +377,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
378 | unsigned long nextoffset; | 377 | unsigned long nextoffset; |
379 | char *name; | 378 | char *name; |
380 | ino_t ino; | 379 | ino_t ino; |
381 | mode_t mode; | 380 | umode_t mode; |
382 | int namelen, error; | 381 | int namelen, error; |
383 | 382 | ||
384 | mutex_lock(&read_mutex); | 383 | mutex_lock(&read_mutex); |
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index 90f76575c056..d5016606fb27 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c | |||
@@ -95,7 +95,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u8_wo, NULL, debugfs_u8_set, "%llu\n"); | |||
95 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 95 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
96 | * code. | 96 | * code. |
97 | */ | 97 | */ |
98 | struct dentry *debugfs_create_u8(const char *name, mode_t mode, | 98 | struct dentry *debugfs_create_u8(const char *name, umode_t mode, |
99 | struct dentry *parent, u8 *value) | 99 | struct dentry *parent, u8 *value) |
100 | { | 100 | { |
101 | /* if there are no write bits set, make read only */ | 101 | /* if there are no write bits set, make read only */ |
@@ -147,7 +147,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u16_wo, NULL, debugfs_u16_set, "%llu\n"); | |||
147 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 147 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
148 | * code. | 148 | * code. |
149 | */ | 149 | */ |
150 | struct dentry *debugfs_create_u16(const char *name, mode_t mode, | 150 | struct dentry *debugfs_create_u16(const char *name, umode_t mode, |
151 | struct dentry *parent, u16 *value) | 151 | struct dentry *parent, u16 *value) |
152 | { | 152 | { |
153 | /* if there are no write bits set, make read only */ | 153 | /* if there are no write bits set, make read only */ |
@@ -199,7 +199,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u32_wo, NULL, debugfs_u32_set, "%llu\n"); | |||
199 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 199 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
200 | * code. | 200 | * code. |
201 | */ | 201 | */ |
202 | struct dentry *debugfs_create_u32(const char *name, mode_t mode, | 202 | struct dentry *debugfs_create_u32(const char *name, umode_t mode, |
203 | struct dentry *parent, u32 *value) | 203 | struct dentry *parent, u32 *value) |
204 | { | 204 | { |
205 | /* if there are no write bits set, make read only */ | 205 | /* if there are no write bits set, make read only */ |
@@ -252,7 +252,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_u64_wo, NULL, debugfs_u64_set, "%llu\n"); | |||
252 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 252 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
253 | * code. | 253 | * code. |
254 | */ | 254 | */ |
255 | struct dentry *debugfs_create_u64(const char *name, mode_t mode, | 255 | struct dentry *debugfs_create_u64(const char *name, umode_t mode, |
256 | struct dentry *parent, u64 *value) | 256 | struct dentry *parent, u64 *value) |
257 | { | 257 | { |
258 | /* if there are no write bits set, make read only */ | 258 | /* if there are no write bits set, make read only */ |
@@ -298,7 +298,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_x64, debugfs_u64_get, debugfs_u64_set, "0x%016llx\n | |||
298 | * @value: a pointer to the variable that the file should read to and write | 298 | * @value: a pointer to the variable that the file should read to and write |
299 | * from. | 299 | * from. |
300 | */ | 300 | */ |
301 | struct dentry *debugfs_create_x8(const char *name, mode_t mode, | 301 | struct dentry *debugfs_create_x8(const char *name, umode_t mode, |
302 | struct dentry *parent, u8 *value) | 302 | struct dentry *parent, u8 *value) |
303 | { | 303 | { |
304 | /* if there are no write bits set, make read only */ | 304 | /* if there are no write bits set, make read only */ |
@@ -322,7 +322,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x8); | |||
322 | * @value: a pointer to the variable that the file should read to and write | 322 | * @value: a pointer to the variable that the file should read to and write |
323 | * from. | 323 | * from. |
324 | */ | 324 | */ |
325 | struct dentry *debugfs_create_x16(const char *name, mode_t mode, | 325 | struct dentry *debugfs_create_x16(const char *name, umode_t mode, |
326 | struct dentry *parent, u16 *value) | 326 | struct dentry *parent, u16 *value) |
327 | { | 327 | { |
328 | /* if there are no write bits set, make read only */ | 328 | /* if there are no write bits set, make read only */ |
@@ -346,7 +346,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x16); | |||
346 | * @value: a pointer to the variable that the file should read to and write | 346 | * @value: a pointer to the variable that the file should read to and write |
347 | * from. | 347 | * from. |
348 | */ | 348 | */ |
349 | struct dentry *debugfs_create_x32(const char *name, mode_t mode, | 349 | struct dentry *debugfs_create_x32(const char *name, umode_t mode, |
350 | struct dentry *parent, u32 *value) | 350 | struct dentry *parent, u32 *value) |
351 | { | 351 | { |
352 | /* if there are no write bits set, make read only */ | 352 | /* if there are no write bits set, make read only */ |
@@ -370,7 +370,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_x32); | |||
370 | * @value: a pointer to the variable that the file should read to and write | 370 | * @value: a pointer to the variable that the file should read to and write |
371 | * from. | 371 | * from. |
372 | */ | 372 | */ |
373 | struct dentry *debugfs_create_x64(const char *name, mode_t mode, | 373 | struct dentry *debugfs_create_x64(const char *name, umode_t mode, |
374 | struct dentry *parent, u64 *value) | 374 | struct dentry *parent, u64 *value) |
375 | { | 375 | { |
376 | return debugfs_create_file(name, mode, parent, value, &fops_x64); | 376 | return debugfs_create_file(name, mode, parent, value, &fops_x64); |
@@ -401,7 +401,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_size_t, debugfs_size_t_get, debugfs_size_t_set, | |||
401 | * @value: a pointer to the variable that the file should read to and write | 401 | * @value: a pointer to the variable that the file should read to and write |
402 | * from. | 402 | * from. |
403 | */ | 403 | */ |
404 | struct dentry *debugfs_create_size_t(const char *name, mode_t mode, | 404 | struct dentry *debugfs_create_size_t(const char *name, umode_t mode, |
405 | struct dentry *parent, size_t *value) | 405 | struct dentry *parent, size_t *value) |
406 | { | 406 | { |
407 | return debugfs_create_file(name, mode, parent, value, &fops_size_t); | 407 | return debugfs_create_file(name, mode, parent, value, &fops_size_t); |
@@ -473,7 +473,7 @@ static const struct file_operations fops_bool = { | |||
473 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 473 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
474 | * code. | 474 | * code. |
475 | */ | 475 | */ |
476 | struct dentry *debugfs_create_bool(const char *name, mode_t mode, | 476 | struct dentry *debugfs_create_bool(const char *name, umode_t mode, |
477 | struct dentry *parent, u32 *value) | 477 | struct dentry *parent, u32 *value) |
478 | { | 478 | { |
479 | return debugfs_create_file(name, mode, parent, value, &fops_bool); | 479 | return debugfs_create_file(name, mode, parent, value, &fops_bool); |
@@ -518,7 +518,7 @@ static const struct file_operations fops_blob = { | |||
518 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling | 518 | * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling |
519 | * code. | 519 | * code. |
520 | */ | 520 | */ |
521 | struct dentry *debugfs_create_blob(const char *name, mode_t mode, | 521 | struct dentry *debugfs_create_blob(const char *name, umode_t mode, |
522 | struct dentry *parent, | 522 | struct dentry *parent, |
523 | struct debugfs_blob_wrapper *blob) | 523 | struct debugfs_blob_wrapper *blob) |
524 | { | 524 | { |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index c9dc08d0c100..956d5ddddf6e 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -30,7 +30,7 @@ static struct vfsmount *debugfs_mount; | |||
30 | static int debugfs_mount_count; | 30 | static int debugfs_mount_count; |
31 | static bool debugfs_registered; | 31 | static bool debugfs_registered; |
32 | 32 | ||
33 | static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev, | 33 | static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev_t dev, |
34 | void *data, const struct file_operations *fops) | 34 | void *data, const struct file_operations *fops) |
35 | 35 | ||
36 | { | 36 | { |
@@ -69,7 +69,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d | |||
69 | 69 | ||
70 | /* SMP-safe */ | 70 | /* SMP-safe */ |
71 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | 71 | static int debugfs_mknod(struct inode *dir, struct dentry *dentry, |
72 | int mode, dev_t dev, void *data, | 72 | umode_t mode, dev_t dev, void *data, |
73 | const struct file_operations *fops) | 73 | const struct file_operations *fops) |
74 | { | 74 | { |
75 | struct inode *inode; | 75 | struct inode *inode; |
@@ -87,7 +87,7 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry, | |||
87 | return error; | 87 | return error; |
88 | } | 88 | } |
89 | 89 | ||
90 | static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode, | 90 | static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode, |
91 | void *data, const struct file_operations *fops) | 91 | void *data, const struct file_operations *fops) |
92 | { | 92 | { |
93 | int res; | 93 | int res; |
@@ -101,14 +101,14 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode, | |||
101 | return res; | 101 | return res; |
102 | } | 102 | } |
103 | 103 | ||
104 | static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode, | 104 | static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode, |
105 | void *data, const struct file_operations *fops) | 105 | void *data, const struct file_operations *fops) |
106 | { | 106 | { |
107 | mode = (mode & S_IALLUGO) | S_IFLNK; | 107 | mode = (mode & S_IALLUGO) | S_IFLNK; |
108 | return debugfs_mknod(dir, dentry, mode, 0, data, fops); | 108 | return debugfs_mknod(dir, dentry, mode, 0, data, fops); |
109 | } | 109 | } |
110 | 110 | ||
111 | static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode, | 111 | static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
112 | void *data, const struct file_operations *fops) | 112 | void *data, const struct file_operations *fops) |
113 | { | 113 | { |
114 | int res; | 114 | int res; |
@@ -146,7 +146,7 @@ static struct file_system_type debug_fs_type = { | |||
146 | .kill_sb = kill_litter_super, | 146 | .kill_sb = kill_litter_super, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static int debugfs_create_by_name(const char *name, mode_t mode, | 149 | static int debugfs_create_by_name(const char *name, umode_t mode, |
150 | struct dentry *parent, | 150 | struct dentry *parent, |
151 | struct dentry **dentry, | 151 | struct dentry **dentry, |
152 | void *data, | 152 | void *data, |
@@ -214,7 +214,7 @@ static int debugfs_create_by_name(const char *name, mode_t mode, | |||
214 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be | 214 | * If debugfs is not enabled in the kernel, the value -%ENODEV will be |
215 | * returned. | 215 | * returned. |
216 | */ | 216 | */ |
217 | struct dentry *debugfs_create_file(const char *name, mode_t mode, | 217 | struct dentry *debugfs_create_file(const char *name, umode_t mode, |
218 | struct dentry *parent, void *data, | 218 | struct dentry *parent, void *data, |
219 | const struct file_operations *fops) | 219 | const struct file_operations *fops) |
220 | { | 220 | { |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 32f90a3ae63e..19a8ca4ab1dd 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -144,24 +144,6 @@ static int ecryptfs_interpose(struct dentry *lower_dentry, | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
147 | * ecryptfs_create_underlying_file | ||
148 | * @lower_dir_inode: inode of the parent in the lower fs of the new file | ||
149 | * @dentry: New file's dentry | ||
150 | * @mode: The mode of the new file | ||
151 | * | ||
152 | * Creates the file in the lower file system. | ||
153 | * | ||
154 | * Returns zero on success; non-zero on error condition | ||
155 | */ | ||
156 | static int | ||
157 | ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | ||
158 | struct dentry *dentry, int mode) | ||
159 | { | ||
160 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | ||
161 | return vfs_create(lower_dir_inode, lower_dentry, mode, NULL); | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * ecryptfs_do_create | 147 | * ecryptfs_do_create |
166 | * @directory_inode: inode of the new file's dentry's parent in ecryptfs | 148 | * @directory_inode: inode of the new file's dentry's parent in ecryptfs |
167 | * @ecryptfs_dentry: New file's dentry in ecryptfs | 149 | * @ecryptfs_dentry: New file's dentry in ecryptfs |
@@ -176,7 +158,7 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
176 | */ | 158 | */ |
177 | static struct inode * | 159 | static struct inode * |
178 | ecryptfs_do_create(struct inode *directory_inode, | 160 | ecryptfs_do_create(struct inode *directory_inode, |
179 | struct dentry *ecryptfs_dentry, int mode) | 161 | struct dentry *ecryptfs_dentry, umode_t mode) |
180 | { | 162 | { |
181 | int rc; | 163 | int rc; |
182 | struct dentry *lower_dentry; | 164 | struct dentry *lower_dentry; |
@@ -191,8 +173,7 @@ ecryptfs_do_create(struct inode *directory_inode, | |||
191 | inode = ERR_CAST(lower_dir_dentry); | 173 | inode = ERR_CAST(lower_dir_dentry); |
192 | goto out; | 174 | goto out; |
193 | } | 175 | } |
194 | rc = ecryptfs_create_underlying_file(lower_dir_dentry->d_inode, | 176 | rc = vfs_create(lower_dir_dentry->d_inode, lower_dentry, mode, NULL); |
195 | ecryptfs_dentry, mode); | ||
196 | if (rc) { | 177 | if (rc) { |
197 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " | 178 | printk(KERN_ERR "%s: Failure to create dentry in lower fs; " |
198 | "rc = [%d]\n", __func__, rc); | 179 | "rc = [%d]\n", __func__, rc); |
@@ -267,7 +248,7 @@ out: | |||
267 | */ | 248 | */ |
268 | static int | 249 | static int |
269 | ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, | 250 | ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, |
270 | int mode, struct nameidata *nd) | 251 | umode_t mode, struct nameidata *nd) |
271 | { | 252 | { |
272 | struct inode *ecryptfs_inode; | 253 | struct inode *ecryptfs_inode; |
273 | int rc; | 254 | int rc; |
@@ -559,7 +540,7 @@ out_lock: | |||
559 | return rc; | 540 | return rc; |
560 | } | 541 | } |
561 | 542 | ||
562 | static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 543 | static int ecryptfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
563 | { | 544 | { |
564 | int rc; | 545 | int rc; |
565 | struct dentry *lower_dentry; | 546 | struct dentry *lower_dentry; |
@@ -607,7 +588,7 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
607 | } | 588 | } |
608 | 589 | ||
609 | static int | 590 | static int |
610 | ecryptfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 591 | ecryptfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) |
611 | { | 592 | { |
612 | int rc; | 593 | int rc; |
613 | struct dentry *lower_dentry; | 594 | struct dentry *lower_dentry; |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index d0941c6a1f72..80405836ba6e 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
@@ -234,7 +234,7 @@ static unsigned char exofs_type_by_mode[S_IFMT >> S_SHIFT] = { | |||
234 | static inline | 234 | static inline |
235 | void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode) | 235 | void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode) |
236 | { | 236 | { |
237 | mode_t mode = inode->i_mode; | 237 | umode_t mode = inode->i_mode; |
238 | de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; | 238 | de->file_type = exofs_type_by_mode[(mode & S_IFMT) >> S_SHIFT]; |
239 | } | 239 | } |
240 | 240 | ||
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index 51f4b4c40f09..ca9d49665ef6 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
@@ -154,7 +154,7 @@ int exofs_write_begin(struct file *file, struct address_space *mapping, | |||
154 | loff_t pos, unsigned len, unsigned flags, | 154 | loff_t pos, unsigned len, unsigned flags, |
155 | struct page **pagep, void **fsdata); | 155 | struct page **pagep, void **fsdata); |
156 | extern struct inode *exofs_iget(struct super_block *, unsigned long); | 156 | extern struct inode *exofs_iget(struct super_block *, unsigned long); |
157 | struct inode *exofs_new_inode(struct inode *, int); | 157 | struct inode *exofs_new_inode(struct inode *, umode_t); |
158 | extern int exofs_write_inode(struct inode *, struct writeback_control *wbc); | 158 | extern int exofs_write_inode(struct inode *, struct writeback_control *wbc); |
159 | extern void exofs_evict_inode(struct inode *); | 159 | extern void exofs_evict_inode(struct inode *); |
160 | 160 | ||
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index f6dbf7768ce6..ea5e1f97806a 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
@@ -1276,7 +1276,7 @@ static void create_done(struct ore_io_state *ios, void *p) | |||
1276 | /* | 1276 | /* |
1277 | * Set up a new inode and create an object for it on the OSD | 1277 | * Set up a new inode and create an object for it on the OSD |
1278 | */ | 1278 | */ |
1279 | struct inode *exofs_new_inode(struct inode *dir, int mode) | 1279 | struct inode *exofs_new_inode(struct inode *dir, umode_t mode) |
1280 | { | 1280 | { |
1281 | struct super_block *sb = dir->i_sb; | 1281 | struct super_block *sb = dir->i_sb; |
1282 | struct exofs_sb_info *sbi = sb->s_fs_info; | 1282 | struct exofs_sb_info *sbi = sb->s_fs_info; |
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index b54c43775f17..9dbf0c301030 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c | |||
@@ -59,7 +59,7 @@ static struct dentry *exofs_lookup(struct inode *dir, struct dentry *dentry, | |||
59 | return d_splice_alias(inode, dentry); | 59 | return d_splice_alias(inode, dentry); |
60 | } | 60 | } |
61 | 61 | ||
62 | static int exofs_create(struct inode *dir, struct dentry *dentry, int mode, | 62 | static int exofs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
63 | struct nameidata *nd) | 63 | struct nameidata *nd) |
64 | { | 64 | { |
65 | struct inode *inode = exofs_new_inode(dir, mode); | 65 | struct inode *inode = exofs_new_inode(dir, mode); |
@@ -74,7 +74,7 @@ static int exofs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
74 | return err; | 74 | return err; |
75 | } | 75 | } |
76 | 76 | ||
77 | static int exofs_mknod(struct inode *dir, struct dentry *dentry, int mode, | 77 | static int exofs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, |
78 | dev_t rdev) | 78 | dev_t rdev) |
79 | { | 79 | { |
80 | struct inode *inode; | 80 | struct inode *inode; |
@@ -153,7 +153,7 @@ static int exofs_link(struct dentry *old_dentry, struct inode *dir, | |||
153 | return exofs_add_nondir(dentry, inode); | 153 | return exofs_add_nondir(dentry, inode); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int exofs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 156 | static int exofs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
157 | { | 157 | { |
158 | struct inode *inode; | 158 | struct inode *inode; |
159 | int err = -EMLINK; | 159 | int err = -EMLINK; |
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c index 47cda410b548..d37df352d324 100644 --- a/fs/ext2/dir.c +++ b/fs/ext2/dir.c | |||
@@ -279,7 +279,7 @@ static unsigned char ext2_type_by_mode[S_IFMT >> S_SHIFT] = { | |||
279 | 279 | ||
280 | static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode) | 280 | static inline void ext2_set_de_type(ext2_dirent *de, struct inode *inode) |
281 | { | 281 | { |
282 | mode_t mode = inode->i_mode; | 282 | umode_t mode = inode->i_mode; |
283 | if (EXT2_HAS_INCOMPAT_FEATURE(inode->i_sb, EXT2_FEATURE_INCOMPAT_FILETYPE)) | 283 | if (EXT2_HAS_INCOMPAT_FEATURE(inode->i_sb, EXT2_FEATURE_INCOMPAT_FILETYPE)) |
284 | de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; | 284 | de->file_type = ext2_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; |
285 | else | 285 | else |
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 9a4e5e206d08..75ad433c6691 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h | |||
@@ -110,7 +110,7 @@ extern struct ext2_dir_entry_2 * ext2_dotdot (struct inode *, struct page **); | |||
110 | extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); | 110 | extern void ext2_set_link(struct inode *, struct ext2_dir_entry_2 *, struct page *, struct inode *, int); |
111 | 111 | ||
112 | /* ialloc.c */ | 112 | /* ialloc.c */ |
113 | extern struct inode * ext2_new_inode (struct inode *, int, const struct qstr *); | 113 | extern struct inode * ext2_new_inode (struct inode *, umode_t, const struct qstr *); |
114 | extern void ext2_free_inode (struct inode *); | 114 | extern void ext2_free_inode (struct inode *); |
115 | extern unsigned long ext2_count_free_inodes (struct super_block *); | 115 | extern unsigned long ext2_count_free_inodes (struct super_block *); |
116 | extern void ext2_check_inodes_bitmap (struct super_block *); | 116 | extern void ext2_check_inodes_bitmap (struct super_block *); |
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index c4e81dfb74ba..cd7f5f424a75 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -429,7 +429,7 @@ found: | |||
429 | return group; | 429 | return group; |
430 | } | 430 | } |
431 | 431 | ||
432 | struct inode *ext2_new_inode(struct inode *dir, int mode, | 432 | struct inode *ext2_new_inode(struct inode *dir, umode_t mode, |
433 | const struct qstr *qstr) | 433 | const struct qstr *qstr) |
434 | { | 434 | { |
435 | struct super_block *sb; | 435 | struct super_block *sb; |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 761fde807fc9..080419814bae 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -94,7 +94,7 @@ struct dentry *ext2_get_parent(struct dentry *child) | |||
94 | * If the create succeeds, we fill in the inode information | 94 | * If the create succeeds, we fill in the inode information |
95 | * with d_instantiate(). | 95 | * with d_instantiate(). |
96 | */ | 96 | */ |
97 | static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) | 97 | static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd) |
98 | { | 98 | { |
99 | struct inode *inode; | 99 | struct inode *inode; |
100 | 100 | ||
@@ -119,7 +119,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode, st | |||
119 | return ext2_add_nondir(dentry, inode); | 119 | return ext2_add_nondir(dentry, inode); |
120 | } | 120 | } |
121 | 121 | ||
122 | static int ext2_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) | 122 | static int ext2_mknod (struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
123 | { | 123 | { |
124 | struct inode * inode; | 124 | struct inode * inode; |
125 | int err; | 125 | int err; |
@@ -214,7 +214,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir, | |||
214 | return err; | 214 | return err; |
215 | } | 215 | } |
216 | 216 | ||
217 | static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 217 | static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) |
218 | { | 218 | { |
219 | struct inode * inode; | 219 | struct inode * inode; |
220 | int err = -EMLINK; | 220 | int err = -EMLINK; |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 5c866e06e7ab..92cc86dfa23d 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -371,7 +371,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent) | |||
371 | * group to find a free inode. | 371 | * group to find a free inode. |
372 | */ | 372 | */ |
373 | struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, | 373 | struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, |
374 | const struct qstr *qstr, int mode) | 374 | const struct qstr *qstr, umode_t mode) |
375 | { | 375 | { |
376 | struct super_block *sb; | 376 | struct super_block *sb; |
377 | struct buffer_head *bitmap_bh = NULL; | 377 | struct buffer_head *bitmap_bh = NULL; |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 642dc6d66dfd..4f35b2f315d4 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1698,7 +1698,7 @@ static int ext3_add_nondir(handle_t *handle, | |||
1698 | * If the create succeeds, we fill in the inode information | 1698 | * If the create succeeds, we fill in the inode information |
1699 | * with d_instantiate(). | 1699 | * with d_instantiate(). |
1700 | */ | 1700 | */ |
1701 | static int ext3_create (struct inode * dir, struct dentry * dentry, int mode, | 1701 | static int ext3_create (struct inode * dir, struct dentry * dentry, umode_t mode, |
1702 | struct nameidata *nd) | 1702 | struct nameidata *nd) |
1703 | { | 1703 | { |
1704 | handle_t *handle; | 1704 | handle_t *handle; |
@@ -1732,7 +1732,7 @@ retry: | |||
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | static int ext3_mknod (struct inode * dir, struct dentry *dentry, | 1734 | static int ext3_mknod (struct inode * dir, struct dentry *dentry, |
1735 | int mode, dev_t rdev) | 1735 | umode_t mode, dev_t rdev) |
1736 | { | 1736 | { |
1737 | handle_t *handle; | 1737 | handle_t *handle; |
1738 | struct inode *inode; | 1738 | struct inode *inode; |
@@ -1768,7 +1768,7 @@ retry: | |||
1768 | return err; | 1768 | return err; |
1769 | } | 1769 | } |
1770 | 1770 | ||
1771 | static int ext3_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 1771 | static int ext3_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) |
1772 | { | 1772 | { |
1773 | handle_t *handle; | 1773 | handle_t *handle; |
1774 | struct inode * inode; | 1774 | struct inode * inode; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 5b0e26a1272d..1554b15f91bc 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1819,7 +1819,7 @@ extern int ext4fs_dirhash(const char *name, int len, struct | |||
1819 | dx_hash_info *hinfo); | 1819 | dx_hash_info *hinfo); |
1820 | 1820 | ||
1821 | /* ialloc.c */ | 1821 | /* ialloc.c */ |
1822 | extern struct inode *ext4_new_inode(handle_t *, struct inode *, int, | 1822 | extern struct inode *ext4_new_inode(handle_t *, struct inode *, umode_t, |
1823 | const struct qstr *qstr, __u32 goal, | 1823 | const struct qstr *qstr, __u32 goal, |
1824 | uid_t *owner); | 1824 | uid_t *owner); |
1825 | extern void ext4_free_inode(handle_t *, struct inode *); | 1825 | extern void ext4_free_inode(handle_t *, struct inode *); |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 00beb4f9cc4f..4637af036d9c 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -351,7 +351,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, | |||
351 | */ | 351 | */ |
352 | 352 | ||
353 | static int find_group_orlov(struct super_block *sb, struct inode *parent, | 353 | static int find_group_orlov(struct super_block *sb, struct inode *parent, |
354 | ext4_group_t *group, int mode, | 354 | ext4_group_t *group, umode_t mode, |
355 | const struct qstr *qstr) | 355 | const struct qstr *qstr) |
356 | { | 356 | { |
357 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; | 357 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; |
@@ -497,7 +497,7 @@ fallback_retry: | |||
497 | } | 497 | } |
498 | 498 | ||
499 | static int find_group_other(struct super_block *sb, struct inode *parent, | 499 | static int find_group_other(struct super_block *sb, struct inode *parent, |
500 | ext4_group_t *group, int mode) | 500 | ext4_group_t *group, umode_t mode) |
501 | { | 501 | { |
502 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; | 502 | ext4_group_t parent_group = EXT4_I(parent)->i_block_group; |
503 | ext4_group_t i, last, ngroups = ext4_get_groups_count(sb); | 503 | ext4_group_t i, last, ngroups = ext4_get_groups_count(sb); |
@@ -602,7 +602,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent, | |||
602 | */ | 602 | */ |
603 | static int ext4_claim_inode(struct super_block *sb, | 603 | static int ext4_claim_inode(struct super_block *sb, |
604 | struct buffer_head *inode_bitmap_bh, | 604 | struct buffer_head *inode_bitmap_bh, |
605 | unsigned long ino, ext4_group_t group, int mode) | 605 | unsigned long ino, ext4_group_t group, umode_t mode) |
606 | { | 606 | { |
607 | int free = 0, retval = 0, count; | 607 | int free = 0, retval = 0, count; |
608 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 608 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
@@ -690,7 +690,7 @@ err_ret: | |||
690 | * For other inodes, search forward from the parent directory's block | 690 | * For other inodes, search forward from the parent directory's block |
691 | * group to find a free inode. | 691 | * group to find a free inode. |
692 | */ | 692 | */ |
693 | struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode, | 693 | struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, umode_t mode, |
694 | const struct qstr *qstr, __u32 goal, uid_t *owner) | 694 | const struct qstr *qstr, __u32 goal, uid_t *owner) |
695 | { | 695 | { |
696 | struct super_block *sb; | 696 | struct super_block *sb; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index aa4c782c9dd7..86edc45b52a4 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1736,7 +1736,7 @@ static int ext4_add_nondir(handle_t *handle, | |||
1736 | * If the create succeeds, we fill in the inode information | 1736 | * If the create succeeds, we fill in the inode information |
1737 | * with d_instantiate(). | 1737 | * with d_instantiate(). |
1738 | */ | 1738 | */ |
1739 | static int ext4_create(struct inode *dir, struct dentry *dentry, int mode, | 1739 | static int ext4_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
1740 | struct nameidata *nd) | 1740 | struct nameidata *nd) |
1741 | { | 1741 | { |
1742 | handle_t *handle; | 1742 | handle_t *handle; |
@@ -1770,7 +1770,7 @@ retry: | |||
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | static int ext4_mknod(struct inode *dir, struct dentry *dentry, | 1772 | static int ext4_mknod(struct inode *dir, struct dentry *dentry, |
1773 | int mode, dev_t rdev) | 1773 | umode_t mode, dev_t rdev) |
1774 | { | 1774 | { |
1775 | handle_t *handle; | 1775 | handle_t *handle; |
1776 | struct inode *inode; | 1776 | struct inode *inode; |
@@ -1806,7 +1806,7 @@ retry: | |||
1806 | return err; | 1806 | return err; |
1807 | } | 1807 | } |
1808 | 1808 | ||
1809 | static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 1809 | static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
1810 | { | 1810 | { |
1811 | handle_t *handle; | 1811 | handle_t *handle; |
1812 | struct inode *inode; | 1812 | struct inode *inode; |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 1510a4d51990..66994f316e18 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -141,7 +141,7 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode) | |||
141 | static inline int fat_mode_can_hold_ro(struct inode *inode) | 141 | static inline int fat_mode_can_hold_ro(struct inode *inode) |
142 | { | 142 | { |
143 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 143 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
144 | mode_t mask; | 144 | umode_t mask; |
145 | 145 | ||
146 | if (S_ISDIR(inode->i_mode)) { | 146 | if (S_ISDIR(inode->i_mode)) { |
147 | if (!sbi->options.rodir) | 147 | if (!sbi->options.rodir) |
@@ -156,8 +156,8 @@ static inline int fat_mode_can_hold_ro(struct inode *inode) | |||
156 | } | 156 | } |
157 | 157 | ||
158 | /* Convert attribute bits and a mask to the UNIX mode. */ | 158 | /* Convert attribute bits and a mask to the UNIX mode. */ |
159 | static inline mode_t fat_make_mode(struct msdos_sb_info *sbi, | 159 | static inline umode_t fat_make_mode(struct msdos_sb_info *sbi, |
160 | u8 attrs, mode_t mode) | 160 | u8 attrs, umode_t mode) |
161 | { | 161 | { |
162 | if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) | 162 | if (attrs & ATTR_RO && !((attrs & ATTR_DIR) && !sbi->options.rodir)) |
163 | mode &= ~S_IWUGO; | 163 | mode &= ~S_IWUGO; |
diff --git a/fs/fat/file.c b/fs/fat/file.c index d81d01a99b2c..a71fe3715ee8 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -314,7 +314,7 @@ EXPORT_SYMBOL_GPL(fat_getattr); | |||
314 | static int fat_sanitize_mode(const struct msdos_sb_info *sbi, | 314 | static int fat_sanitize_mode(const struct msdos_sb_info *sbi, |
315 | struct inode *inode, umode_t *mode_ptr) | 315 | struct inode *inode, umode_t *mode_ptr) |
316 | { | 316 | { |
317 | mode_t mask, perm; | 317 | umode_t mask, perm; |
318 | 318 | ||
319 | /* | 319 | /* |
320 | * Note, the basic check is already done by a caller of | 320 | * Note, the basic check is already done by a caller of |
@@ -351,7 +351,7 @@ static int fat_sanitize_mode(const struct msdos_sb_info *sbi, | |||
351 | 351 | ||
352 | static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) | 352 | static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) |
353 | { | 353 | { |
354 | mode_t allow_utime = sbi->options.allow_utime; | 354 | umode_t allow_utime = sbi->options.allow_utime; |
355 | 355 | ||
356 | if (current_fsuid() != inode->i_uid) { | 356 | if (current_fsuid() != inode->i_uid) { |
357 | if (in_group_p(inode->i_gid)) | 357 | if (in_group_p(inode->i_gid)) |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 216b419f30e2..c5938c9084b9 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -264,7 +264,7 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name, | |||
264 | } | 264 | } |
265 | 265 | ||
266 | /***** Create a file */ | 266 | /***** Create a file */ |
267 | static int msdos_create(struct inode *dir, struct dentry *dentry, int mode, | 267 | static int msdos_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
268 | struct nameidata *nd) | 268 | struct nameidata *nd) |
269 | { | 269 | { |
270 | struct super_block *sb = dir->i_sb; | 270 | struct super_block *sb = dir->i_sb; |
@@ -346,7 +346,7 @@ out: | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /***** Make a directory */ | 348 | /***** Make a directory */ |
349 | static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 349 | static int msdos_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
350 | { | 350 | { |
351 | struct super_block *sb = dir->i_sb; | 351 | struct super_block *sb = dir->i_sb; |
352 | struct fat_slot_info sinfo; | 352 | struct fat_slot_info sinfo; |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index a87a65663c25..3a444b4e2368 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -781,7 +781,7 @@ error: | |||
781 | return ERR_PTR(err); | 781 | return ERR_PTR(err); |
782 | } | 782 | } |
783 | 783 | ||
784 | static int vfat_create(struct inode *dir, struct dentry *dentry, int mode, | 784 | static int vfat_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
785 | struct nameidata *nd) | 785 | struct nameidata *nd) |
786 | { | 786 | { |
787 | struct super_block *sb = dir->i_sb; | 787 | struct super_block *sb = dir->i_sb; |
@@ -870,7 +870,7 @@ out: | |||
870 | return err; | 870 | return err; |
871 | } | 871 | } |
872 | 872 | ||
873 | static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 873 | static int vfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
874 | { | 874 | { |
875 | struct super_block *sb = dir->i_sb; | 875 | struct super_block *sb = dir->i_sb; |
876 | struct inode *inode; | 876 | struct inode *inode; |
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index 41ef6e715d2f..cf9ef918a2a9 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c | |||
@@ -187,10 +187,10 @@ vxfs_stiget(struct super_block *sbp, ino_t ino) | |||
187 | * vxfs_transmod returns a Linux mode_t for a given | 187 | * vxfs_transmod returns a Linux mode_t for a given |
188 | * VxFS inode structure. | 188 | * VxFS inode structure. |
189 | */ | 189 | */ |
190 | static __inline__ mode_t | 190 | static __inline__ umode_t |
191 | vxfs_transmod(struct vxfs_inode_info *vip) | 191 | vxfs_transmod(struct vxfs_inode_info *vip) |
192 | { | 192 | { |
193 | mode_t ret = vip->vii_mode & ~VXFS_TYPE_MASK; | 193 | umode_t ret = vip->vii_mode & ~VXFS_TYPE_MASK; |
194 | 194 | ||
195 | if (VXFS_ISFIFO(vip)) | 195 | if (VXFS_ISFIFO(vip)) |
196 | ret |= S_IFIFO; | 196 | ret |= S_IFIFO; |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 517f211a3bd4..80a4574028f1 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/writeback.h> | 25 | #include <linux/writeback.h> |
26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/buffer_head.h> | ||
29 | #include <linux/tracepoint.h> | 28 | #include <linux/tracepoint.h> |
30 | #include "internal.h" | 29 | #include "internal.h" |
31 | 30 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 9f63e493a9b6..5ddd6ea8f839 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -369,8 +369,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
369 | * If the filesystem doesn't support this, then fall back to separate | 369 | * If the filesystem doesn't support this, then fall back to separate |
370 | * 'mknod' + 'open' requests. | 370 | * 'mknod' + 'open' requests. |
371 | */ | 371 | */ |
372 | static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | 372 | static int fuse_create_open(struct inode *dir, struct dentry *entry, |
373 | struct nameidata *nd) | 373 | umode_t mode, struct nameidata *nd) |
374 | { | 374 | { |
375 | int err; | 375 | int err; |
376 | struct inode *inode; | 376 | struct inode *inode; |
@@ -480,7 +480,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
480 | */ | 480 | */ |
481 | static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | 481 | static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, |
482 | struct inode *dir, struct dentry *entry, | 482 | struct inode *dir, struct dentry *entry, |
483 | int mode) | 483 | umode_t mode) |
484 | { | 484 | { |
485 | struct fuse_entry_out outarg; | 485 | struct fuse_entry_out outarg; |
486 | struct inode *inode; | 486 | struct inode *inode; |
@@ -547,7 +547,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
547 | return err; | 547 | return err; |
548 | } | 548 | } |
549 | 549 | ||
550 | static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, | 550 | static int fuse_mknod(struct inode *dir, struct dentry *entry, umode_t mode, |
551 | dev_t rdev) | 551 | dev_t rdev) |
552 | { | 552 | { |
553 | struct fuse_mknod_in inarg; | 553 | struct fuse_mknod_in inarg; |
@@ -573,7 +573,7 @@ static int fuse_mknod(struct inode *dir, struct dentry *entry, int mode, | |||
573 | return create_new_entry(fc, req, dir, entry, mode); | 573 | return create_new_entry(fc, req, dir, entry, mode); |
574 | } | 574 | } |
575 | 575 | ||
576 | static int fuse_create(struct inode *dir, struct dentry *entry, int mode, | 576 | static int fuse_create(struct inode *dir, struct dentry *entry, umode_t mode, |
577 | struct nameidata *nd) | 577 | struct nameidata *nd) |
578 | { | 578 | { |
579 | if (nd) { | 579 | if (nd) { |
@@ -585,7 +585,7 @@ static int fuse_create(struct inode *dir, struct dentry *entry, int mode, | |||
585 | return fuse_mknod(dir, entry, mode, 0); | 585 | return fuse_mknod(dir, entry, mode, 0); |
586 | } | 586 | } |
587 | 587 | ||
588 | static int fuse_mkdir(struct inode *dir, struct dentry *entry, int mode) | 588 | static int fuse_mkdir(struct inode *dir, struct dentry *entry, umode_t mode) |
589 | { | 589 | { |
590 | struct fuse_mkdir_in inarg; | 590 | struct fuse_mkdir_in inarg; |
591 | struct fuse_conn *fc = get_fuse_conn(dir); | 591 | struct fuse_conn *fc = get_fuse_conn(dir); |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index cf6db0a93219..1964da0257d9 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -80,7 +80,7 @@ struct fuse_inode { | |||
80 | 80 | ||
81 | /** The sticky bit in inode->i_mode may have been removed, so | 81 | /** The sticky bit in inode->i_mode may have been removed, so |
82 | preserve the original mode */ | 82 | preserve the original mode */ |
83 | mode_t orig_i_mode; | 83 | umode_t orig_i_mode; |
84 | 84 | ||
85 | /** Version of last attribute change */ | 85 | /** Version of last attribute change */ |
86 | u64 attr_version; | 86 | u64 attr_version; |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index cfd4959b218c..4b0e59e0a249 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -333,7 +333,7 @@ out: | |||
333 | */ | 333 | */ |
334 | 334 | ||
335 | static int create_ok(struct gfs2_inode *dip, const struct qstr *name, | 335 | static int create_ok(struct gfs2_inode *dip, const struct qstr *name, |
336 | unsigned int mode) | 336 | umode_t mode) |
337 | { | 337 | { |
338 | int error; | 338 | int error; |
339 | 339 | ||
@@ -364,7 +364,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name, | |||
364 | return 0; | 364 | return 0; |
365 | } | 365 | } |
366 | 366 | ||
367 | static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode, | 367 | static void munge_mode_uid_gid(struct gfs2_inode *dip, umode_t *mode, |
368 | unsigned int *uid, unsigned int *gid) | 368 | unsigned int *uid, unsigned int *gid) |
369 | { | 369 | { |
370 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && | 370 | if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && |
@@ -447,7 +447,7 @@ static void gfs2_init_dir(struct buffer_head *dibh, | |||
447 | */ | 447 | */ |
448 | 448 | ||
449 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 449 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
450 | const struct gfs2_inum_host *inum, unsigned int mode, | 450 | const struct gfs2_inum_host *inum, umode_t mode, |
451 | unsigned int uid, unsigned int gid, | 451 | unsigned int uid, unsigned int gid, |
452 | const u64 *generation, dev_t dev, const char *symname, | 452 | const u64 *generation, dev_t dev, const char *symname, |
453 | unsigned size, struct buffer_head **bhp) | 453 | unsigned size, struct buffer_head **bhp) |
@@ -516,7 +516,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
516 | } | 516 | } |
517 | 517 | ||
518 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 518 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
519 | unsigned int mode, const struct gfs2_inum_host *inum, | 519 | umode_t mode, const struct gfs2_inum_host *inum, |
520 | const u64 *generation, dev_t dev, const char *symname, | 520 | const u64 *generation, dev_t dev, const char *symname, |
521 | unsigned int size, struct buffer_head **bhp) | 521 | unsigned int size, struct buffer_head **bhp) |
522 | { | 522 | { |
@@ -659,7 +659,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip, | |||
659 | */ | 659 | */ |
660 | 660 | ||
661 | static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, | 661 | static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, |
662 | unsigned int mode, dev_t dev, const char *symname, | 662 | umode_t mode, dev_t dev, const char *symname, |
663 | unsigned int size, int excl) | 663 | unsigned int size, int excl) |
664 | { | 664 | { |
665 | const struct qstr *name = &dentry->d_name; | 665 | const struct qstr *name = &dentry->d_name; |
@@ -760,7 +760,7 @@ fail: | |||
760 | */ | 760 | */ |
761 | 761 | ||
762 | static int gfs2_create(struct inode *dir, struct dentry *dentry, | 762 | static int gfs2_create(struct inode *dir, struct dentry *dentry, |
763 | int mode, struct nameidata *nd) | 763 | umode_t mode, struct nameidata *nd) |
764 | { | 764 | { |
765 | int excl = 0; | 765 | int excl = 0; |
766 | if (nd && (nd->flags & LOOKUP_EXCL)) | 766 | if (nd && (nd->flags & LOOKUP_EXCL)) |
@@ -1129,7 +1129,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry, | |||
1129 | * Returns: errno | 1129 | * Returns: errno |
1130 | */ | 1130 | */ |
1131 | 1131 | ||
1132 | static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 1132 | static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
1133 | { | 1133 | { |
1134 | return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0, 0); | 1134 | return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0, 0); |
1135 | } | 1135 | } |
@@ -1143,7 +1143,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
1143 | * | 1143 | * |
1144 | */ | 1144 | */ |
1145 | 1145 | ||
1146 | static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode, | 1146 | static int gfs2_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, |
1147 | dev_t dev) | 1147 | dev_t dev) |
1148 | { | 1148 | { |
1149 | return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0, 0); | 1149 | return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0, 0); |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index bce4eef91a06..62fc14ea4b73 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -186,7 +186,7 @@ static int hfs_dir_release(struct inode *inode, struct file *file) | |||
186 | * a directory and return a corresponding inode, given the inode for | 186 | * a directory and return a corresponding inode, given the inode for |
187 | * the directory and the name (and its length) of the new file. | 187 | * the directory and the name (and its length) of the new file. |
188 | */ | 188 | */ |
189 | static int hfs_create(struct inode *dir, struct dentry *dentry, int mode, | 189 | static int hfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
190 | struct nameidata *nd) | 190 | struct nameidata *nd) |
191 | { | 191 | { |
192 | struct inode *inode; | 192 | struct inode *inode; |
@@ -216,7 +216,7 @@ static int hfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
216 | * in a directory, given the inode for the parent directory and the | 216 | * in a directory, given the inode for the parent directory and the |
217 | * name (and its length) of the new directory. | 217 | * name (and its length) of the new directory. |
218 | */ | 218 | */ |
219 | static int hfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 219 | static int hfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
220 | { | 220 | { |
221 | struct inode *inode; | 221 | struct inode *inode; |
222 | int res; | 222 | int res; |
diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h index ad97c2d58287..1bf967c6bfdc 100644 --- a/fs/hfs/hfs_fs.h +++ b/fs/hfs/hfs_fs.h | |||
@@ -184,7 +184,7 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int); | |||
184 | extern const struct address_space_operations hfs_aops; | 184 | extern const struct address_space_operations hfs_aops; |
185 | extern const struct address_space_operations hfs_btree_aops; | 185 | extern const struct address_space_operations hfs_btree_aops; |
186 | 186 | ||
187 | extern struct inode *hfs_new_inode(struct inode *, struct qstr *, int); | 187 | extern struct inode *hfs_new_inode(struct inode *, struct qstr *, umode_t); |
188 | extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); | 188 | extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *); |
189 | extern int hfs_write_inode(struct inode *, struct writeback_control *); | 189 | extern int hfs_write_inode(struct inode *, struct writeback_control *); |
190 | extern int hfs_inode_setattr(struct dentry *, struct iattr *); | 190 | extern int hfs_inode_setattr(struct dentry *, struct iattr *); |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index a1a9fdcd2a00..737dbeb64320 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -169,7 +169,7 @@ const struct address_space_operations hfs_aops = { | |||
169 | /* | 169 | /* |
170 | * hfs_new_inode | 170 | * hfs_new_inode |
171 | */ | 171 | */ |
172 | struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, int mode) | 172 | struct inode *hfs_new_inode(struct inode *dir, struct qstr *name, umode_t mode) |
173 | { | 173 | { |
174 | struct super_block *sb = dir->i_sb; | 174 | struct super_block *sb = dir->i_sb; |
175 | struct inode *inode = new_inode(sb); | 175 | struct inode *inode = new_inode(sb); |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index 4536cd3f15ae..88e155f895c6 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -424,7 +424,7 @@ out: | |||
424 | } | 424 | } |
425 | 425 | ||
426 | static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, | 426 | static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, |
427 | int mode, dev_t rdev) | 427 | umode_t mode, dev_t rdev) |
428 | { | 428 | { |
429 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 429 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
430 | struct inode *inode; | 430 | struct inode *inode; |
@@ -453,13 +453,13 @@ out: | |||
453 | return res; | 453 | return res; |
454 | } | 454 | } |
455 | 455 | ||
456 | static int hfsplus_create(struct inode *dir, struct dentry *dentry, int mode, | 456 | static int hfsplus_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
457 | struct nameidata *nd) | 457 | struct nameidata *nd) |
458 | { | 458 | { |
459 | return hfsplus_mknod(dir, dentry, mode, 0); | 459 | return hfsplus_mknod(dir, dentry, mode, 0); |
460 | } | 460 | } |
461 | 461 | ||
462 | static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 462 | static int hfsplus_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
463 | { | 463 | { |
464 | return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); | 464 | return hfsplus_mknod(dir, dentry, mode | S_IFDIR, 0); |
465 | } | 465 | } |
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index d7674d051f52..3a6c025414e2 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h | |||
@@ -402,7 +402,7 @@ void hfsplus_inode_read_fork(struct inode *, struct hfsplus_fork_raw *); | |||
402 | void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); | 402 | void hfsplus_inode_write_fork(struct inode *, struct hfsplus_fork_raw *); |
403 | int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); | 403 | int hfsplus_cat_read_inode(struct inode *, struct hfs_find_data *); |
404 | int hfsplus_cat_write_inode(struct inode *); | 404 | int hfsplus_cat_write_inode(struct inode *); |
405 | struct inode *hfsplus_new_inode(struct super_block *, int); | 405 | struct inode *hfsplus_new_inode(struct super_block *, umode_t); |
406 | void hfsplus_delete_inode(struct inode *); | 406 | void hfsplus_delete_inode(struct inode *); |
407 | int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | 407 | int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, |
408 | int datasync); | 408 | int datasync); |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 40e1413be4cf..6643b242bdd7 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -378,7 +378,7 @@ static const struct file_operations hfsplus_file_operations = { | |||
378 | .unlocked_ioctl = hfsplus_ioctl, | 378 | .unlocked_ioctl = hfsplus_ioctl, |
379 | }; | 379 | }; |
380 | 380 | ||
381 | struct inode *hfsplus_new_inode(struct super_block *sb, int mode) | 381 | struct inode *hfsplus_new_inode(struct super_block *sb, umode_t mode) |
382 | { | 382 | { |
383 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); | 383 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); |
384 | struct inode *inode = new_inode(sb); | 384 | struct inode *inode = new_inode(sb); |
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index bf15a43016b9..3cbfa93cd782 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h | |||
@@ -39,7 +39,7 @@ | |||
39 | 39 | ||
40 | struct hostfs_iattr { | 40 | struct hostfs_iattr { |
41 | unsigned int ia_valid; | 41 | unsigned int ia_valid; |
42 | mode_t ia_mode; | 42 | unsigned short ia_mode; |
43 | uid_t ia_uid; | 43 | uid_t ia_uid; |
44 | gid_t ia_gid; | 44 | gid_t ia_gid; |
45 | loff_t ia_size; | 45 | loff_t ia_size; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 343ea632b97c..a7340e710a90 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -551,7 +551,7 @@ static int read_name(struct inode *ino, char *name) | |||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | 553 | ||
554 | int hostfs_create(struct inode *dir, struct dentry *dentry, int mode, | 554 | int hostfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
555 | struct nameidata *nd) | 555 | struct nameidata *nd) |
556 | { | 556 | { |
557 | struct inode *inode; | 557 | struct inode *inode; |
@@ -676,7 +676,7 @@ int hostfs_symlink(struct inode *ino, struct dentry *dentry, const char *to) | |||
676 | return err; | 676 | return err; |
677 | } | 677 | } |
678 | 678 | ||
679 | int hostfs_mkdir(struct inode *ino, struct dentry *dentry, int mode) | 679 | int hostfs_mkdir(struct inode *ino, struct dentry *dentry, umode_t mode) |
680 | { | 680 | { |
681 | char *file; | 681 | char *file; |
682 | int err; | 682 | int err; |
@@ -700,7 +700,7 @@ int hostfs_rmdir(struct inode *ino, struct dentry *dentry) | |||
700 | return err; | 700 | return err; |
701 | } | 701 | } |
702 | 702 | ||
703 | int hostfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 703 | static int hostfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) |
704 | { | 704 | { |
705 | struct inode *inode; | 705 | struct inode *inode; |
706 | char *name; | 706 | char *name; |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index ea91fcb0ef9b..30dd7b10b507 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include "hpfs_fn.h" | 9 | #include "hpfs_fn.h" |
10 | 10 | ||
11 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 11 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
12 | { | 12 | { |
13 | const unsigned char *name = dentry->d_name.name; | 13 | const unsigned char *name = dentry->d_name.name; |
14 | unsigned len = dentry->d_name.len; | 14 | unsigned len = dentry->d_name.len; |
@@ -115,7 +115,7 @@ bail: | |||
115 | return err; | 115 | return err; |
116 | } | 116 | } |
117 | 117 | ||
118 | static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | 118 | static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) |
119 | { | 119 | { |
120 | const unsigned char *name = dentry->d_name.name; | 120 | const unsigned char *name = dentry->d_name.name; |
121 | unsigned len = dentry->d_name.len; | 121 | unsigned len = dentry->d_name.len; |
@@ -201,7 +201,7 @@ bail: | |||
201 | return err; | 201 | return err; |
202 | } | 202 | } |
203 | 203 | ||
204 | static int hpfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | 204 | static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
205 | { | 205 | { |
206 | const unsigned char *name = dentry->d_name.name; | 206 | const unsigned char *name = dentry->d_name.name; |
207 | unsigned len = dentry->d_name.len; | 207 | unsigned len = dentry->d_name.len; |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 9c4ec538725b..e425ad9d0490 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -447,8 +447,8 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | 450 | static struct inode *hugetlbfs_get_root(struct super_block *sb, |
451 | gid_t gid, int mode, dev_t dev) | 451 | struct hugetlbfs_config *config) |
452 | { | 452 | { |
453 | struct inode *inode; | 453 | struct inode *inode; |
454 | 454 | ||
@@ -456,9 +456,31 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
456 | if (inode) { | 456 | if (inode) { |
457 | struct hugetlbfs_inode_info *info; | 457 | struct hugetlbfs_inode_info *info; |
458 | inode->i_ino = get_next_ino(); | 458 | inode->i_ino = get_next_ino(); |
459 | inode->i_mode = mode; | 459 | inode->i_mode = S_IFDIR | config->mode; |
460 | inode->i_uid = uid; | 460 | inode->i_uid = config->uid; |
461 | inode->i_gid = gid; | 461 | inode->i_gid = config->gid; |
462 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | ||
463 | info = HUGETLBFS_I(inode); | ||
464 | mpol_shared_policy_init(&info->policy, NULL); | ||
465 | inode->i_op = &hugetlbfs_dir_inode_operations; | ||
466 | inode->i_fop = &simple_dir_operations; | ||
467 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | ||
468 | inc_nlink(inode); | ||
469 | } | ||
470 | return inode; | ||
471 | } | ||
472 | |||
473 | static struct inode *hugetlbfs_get_inode(struct super_block *sb, | ||
474 | struct inode *dir, | ||
475 | umode_t mode, dev_t dev) | ||
476 | { | ||
477 | struct inode *inode; | ||
478 | |||
479 | inode = new_inode(sb); | ||
480 | if (inode) { | ||
481 | struct hugetlbfs_inode_info *info; | ||
482 | inode->i_ino = get_next_ino(); | ||
483 | inode_init_owner(inode, dir, mode); | ||
462 | inode->i_mapping->a_ops = &hugetlbfs_aops; | 484 | inode->i_mapping->a_ops = &hugetlbfs_aops; |
463 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; | 485 | inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; |
464 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 486 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
@@ -500,20 +522,12 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
500 | * File creation. Allocate an inode, and we're done.. | 522 | * File creation. Allocate an inode, and we're done.. |
501 | */ | 523 | */ |
502 | static int hugetlbfs_mknod(struct inode *dir, | 524 | static int hugetlbfs_mknod(struct inode *dir, |
503 | struct dentry *dentry, int mode, dev_t dev) | 525 | struct dentry *dentry, umode_t mode, dev_t dev) |
504 | { | 526 | { |
505 | struct inode *inode; | 527 | struct inode *inode; |
506 | int error = -ENOSPC; | 528 | int error = -ENOSPC; |
507 | gid_t gid; | 529 | |
508 | 530 | inode = hugetlbfs_get_inode(dir->i_sb, dir, mode, dev); | |
509 | if (dir->i_mode & S_ISGID) { | ||
510 | gid = dir->i_gid; | ||
511 | if (S_ISDIR(mode)) | ||
512 | mode |= S_ISGID; | ||
513 | } else { | ||
514 | gid = current_fsgid(); | ||
515 | } | ||
516 | inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), gid, mode, dev); | ||
517 | if (inode) { | 531 | if (inode) { |
518 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 532 | dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
519 | d_instantiate(dentry, inode); | 533 | d_instantiate(dentry, inode); |
@@ -523,7 +537,7 @@ static int hugetlbfs_mknod(struct inode *dir, | |||
523 | return error; | 537 | return error; |
524 | } | 538 | } |
525 | 539 | ||
526 | static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 540 | static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
527 | { | 541 | { |
528 | int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0); | 542 | int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0); |
529 | if (!retval) | 543 | if (!retval) |
@@ -531,7 +545,7 @@ static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
531 | return retval; | 545 | return retval; |
532 | } | 546 | } |
533 | 547 | ||
534 | static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | 548 | static int hugetlbfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) |
535 | { | 549 | { |
536 | return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0); | 550 | return hugetlbfs_mknod(dir, dentry, mode | S_IFREG, 0); |
537 | } | 551 | } |
@@ -541,15 +555,8 @@ static int hugetlbfs_symlink(struct inode *dir, | |||
541 | { | 555 | { |
542 | struct inode *inode; | 556 | struct inode *inode; |
543 | int error = -ENOSPC; | 557 | int error = -ENOSPC; |
544 | gid_t gid; | ||
545 | |||
546 | if (dir->i_mode & S_ISGID) | ||
547 | gid = dir->i_gid; | ||
548 | else | ||
549 | gid = current_fsgid(); | ||
550 | 558 | ||
551 | inode = hugetlbfs_get_inode(dir->i_sb, current_fsuid(), | 559 | inode = hugetlbfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0); |
552 | gid, S_IFLNK|S_IRWXUGO, 0); | ||
553 | if (inode) { | 560 | if (inode) { |
554 | int l = strlen(symname)+1; | 561 | int l = strlen(symname)+1; |
555 | error = page_symlink(inode, symname, l); | 562 | error = page_symlink(inode, symname, l); |
@@ -857,8 +864,7 @@ hugetlbfs_fill_super(struct super_block *sb, void *data, int silent) | |||
857 | sb->s_magic = HUGETLBFS_MAGIC; | 864 | sb->s_magic = HUGETLBFS_MAGIC; |
858 | sb->s_op = &hugetlbfs_ops; | 865 | sb->s_op = &hugetlbfs_ops; |
859 | sb->s_time_gran = 1; | 866 | sb->s_time_gran = 1; |
860 | inode = hugetlbfs_get_inode(sb, config.uid, config.gid, | 867 | inode = hugetlbfs_get_root(sb, &config); |
861 | S_IFDIR | config.mode, 0); | ||
862 | if (!inode) | 868 | if (!inode) |
863 | goto out_free; | 869 | goto out_free; |
864 | 870 | ||
@@ -956,8 +962,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size, | |||
956 | 962 | ||
957 | path.mnt = mntget(hugetlbfs_vfsmount); | 963 | path.mnt = mntget(hugetlbfs_vfsmount); |
958 | error = -ENOSPC; | 964 | error = -ENOSPC; |
959 | inode = hugetlbfs_get_inode(root->d_sb, current_fsuid(), | 965 | inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0); |
960 | current_fsgid(), S_IFREG | S_IRWXUGO, 0); | ||
961 | if (!inode) | 966 | if (!inode) |
962 | goto out_dentry; | 967 | goto out_dentry; |
963 | 968 | ||
diff --git a/fs/inode.c b/fs/inode.c index 24d02907e196..961355d00e38 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1646,7 +1646,7 @@ EXPORT_SYMBOL(init_special_inode); | |||
1646 | * @mode: mode of the new inode | 1646 | * @mode: mode of the new inode |
1647 | */ | 1647 | */ |
1648 | void inode_init_owner(struct inode *inode, const struct inode *dir, | 1648 | void inode_init_owner(struct inode *inode, const struct inode *dir, |
1649 | mode_t mode) | 1649 | umode_t mode) |
1650 | { | 1650 | { |
1651 | inode->i_uid = current_fsuid(); | 1651 | inode->i_uid = current_fsuid(); |
1652 | if (dir && dir->i_mode & S_ISGID) { | 1652 | if (dir && dir->i_mode & S_ISGID) { |
diff --git a/fs/internal.h b/fs/internal.h index 6aab61a4f36f..2523a4029452 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -88,7 +88,7 @@ extern struct file *nameidata_to_filp(struct nameidata *); | |||
88 | extern void release_open_intent(struct nameidata *); | 88 | extern void release_open_intent(struct nameidata *); |
89 | struct open_flags { | 89 | struct open_flags { |
90 | int open_flag; | 90 | int open_flag; |
91 | int mode; | 91 | umode_t mode; |
92 | int acc_mode; | 92 | int acc_mode; |
93 | int intent; | 93 | int intent; |
94 | }; | 94 | }; |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index b71f6311a337..7b99f5f460be 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -169,8 +169,8 @@ struct iso9660_options{ | |||
169 | unsigned char map; | 169 | unsigned char map; |
170 | unsigned char check; | 170 | unsigned char check; |
171 | unsigned int blocksize; | 171 | unsigned int blocksize; |
172 | mode_t fmode; | 172 | umode_t fmode; |
173 | mode_t dmode; | 173 | umode_t dmode; |
174 | gid_t gid; | 174 | gid_t gid; |
175 | uid_t uid; | 175 | uid_t uid; |
176 | char *iocharset; | 176 | char *iocharset; |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 7d33de84f52a..0e73f63d9274 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -50,14 +50,14 @@ struct isofs_sb_info { | |||
50 | unsigned int s_uid_set:1; | 50 | unsigned int s_uid_set:1; |
51 | unsigned int s_gid_set:1; | 51 | unsigned int s_gid_set:1; |
52 | 52 | ||
53 | mode_t s_fmode; | 53 | umode_t s_fmode; |
54 | mode_t s_dmode; | 54 | umode_t s_dmode; |
55 | gid_t s_gid; | 55 | gid_t s_gid; |
56 | uid_t s_uid; | 56 | uid_t s_uid; |
57 | struct nls_table *s_nls_iocharset; /* Native language support table */ | 57 | struct nls_table *s_nls_iocharset; /* Native language support table */ |
58 | }; | 58 | }; |
59 | 59 | ||
60 | #define ISOFS_INVALID_MODE ((mode_t) -1) | 60 | #define ISOFS_INVALID_MODE ((umode_t) -1) |
61 | 61 | ||
62 | static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb) | 62 | static inline struct isofs_sb_info *ISOFS_SB(struct super_block *sb) |
63 | { | 63 | { |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index be6169bd8acd..973ac5822bd7 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -22,16 +22,16 @@ | |||
22 | 22 | ||
23 | static int jffs2_readdir (struct file *, void *, filldir_t); | 23 | static int jffs2_readdir (struct file *, void *, filldir_t); |
24 | 24 | ||
25 | static int jffs2_create (struct inode *,struct dentry *,int, | 25 | static int jffs2_create (struct inode *,struct dentry *,umode_t, |
26 | struct nameidata *); | 26 | struct nameidata *); |
27 | static struct dentry *jffs2_lookup (struct inode *,struct dentry *, | 27 | static struct dentry *jffs2_lookup (struct inode *,struct dentry *, |
28 | struct nameidata *); | 28 | struct nameidata *); |
29 | static int jffs2_link (struct dentry *,struct inode *,struct dentry *); | 29 | static int jffs2_link (struct dentry *,struct inode *,struct dentry *); |
30 | static int jffs2_unlink (struct inode *,struct dentry *); | 30 | static int jffs2_unlink (struct inode *,struct dentry *); |
31 | static int jffs2_symlink (struct inode *,struct dentry *,const char *); | 31 | static int jffs2_symlink (struct inode *,struct dentry *,const char *); |
32 | static int jffs2_mkdir (struct inode *,struct dentry *,int); | 32 | static int jffs2_mkdir (struct inode *,struct dentry *,umode_t); |
33 | static int jffs2_rmdir (struct inode *,struct dentry *); | 33 | static int jffs2_rmdir (struct inode *,struct dentry *); |
34 | static int jffs2_mknod (struct inode *,struct dentry *,int,dev_t); | 34 | static int jffs2_mknod (struct inode *,struct dentry *,umode_t,dev_t); |
35 | static int jffs2_rename (struct inode *, struct dentry *, | 35 | static int jffs2_rename (struct inode *, struct dentry *, |
36 | struct inode *, struct dentry *); | 36 | struct inode *, struct dentry *); |
37 | 37 | ||
@@ -169,8 +169,8 @@ static int jffs2_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
169 | /***********************************************************************/ | 169 | /***********************************************************************/ |
170 | 170 | ||
171 | 171 | ||
172 | static int jffs2_create(struct inode *dir_i, struct dentry *dentry, int mode, | 172 | static int jffs2_create(struct inode *dir_i, struct dentry *dentry, |
173 | struct nameidata *nd) | 173 | umode_t mode, struct nameidata *nd) |
174 | { | 174 | { |
175 | struct jffs2_raw_inode *ri; | 175 | struct jffs2_raw_inode *ri; |
176 | struct jffs2_inode_info *f, *dir_f; | 176 | struct jffs2_inode_info *f, *dir_f; |
@@ -450,7 +450,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode) | 453 | static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode) |
454 | { | 454 | { |
455 | struct jffs2_inode_info *f, *dir_f; | 455 | struct jffs2_inode_info *f, *dir_f; |
456 | struct jffs2_sb_info *c; | 456 | struct jffs2_sb_info *c; |
@@ -618,7 +618,7 @@ static int jffs2_rmdir (struct inode *dir_i, struct dentry *dentry) | |||
618 | return ret; | 618 | return ret; |
619 | } | 619 | } |
620 | 620 | ||
621 | static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, int mode, dev_t rdev) | 621 | static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode, dev_t rdev) |
622 | { | 622 | { |
623 | struct jffs2_inode_info *f, *dir_f; | 623 | struct jffs2_inode_info *f, *dir_f; |
624 | struct jffs2_sb_info *c; | 624 | struct jffs2_sb_info *c; |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index a112ad96e474..5f7c160ea64f 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -72,7 +72,7 @@ static inline void free_ea_wmap(struct inode *inode) | |||
72 | * RETURN: Errors from subroutines | 72 | * RETURN: Errors from subroutines |
73 | * | 73 | * |
74 | */ | 74 | */ |
75 | static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, | 75 | static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, |
76 | struct nameidata *nd) | 76 | struct nameidata *nd) |
77 | { | 77 | { |
78 | int rc = 0; | 78 | int rc = 0; |
@@ -205,7 +205,7 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, int mode, | |||
205 | * note: | 205 | * note: |
206 | * EACCESS: user needs search+write permission on the parent directory | 206 | * EACCESS: user needs search+write permission on the parent directory |
207 | */ | 207 | */ |
208 | static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode) | 208 | static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) |
209 | { | 209 | { |
210 | int rc = 0; | 210 | int rc = 0; |
211 | tid_t tid; /* transaction id */ | 211 | tid_t tid; /* transaction id */ |
@@ -1353,7 +1353,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1353 | * FUNCTION: Create a special file (device) | 1353 | * FUNCTION: Create a special file (device) |
1354 | */ | 1354 | */ |
1355 | static int jfs_mknod(struct inode *dir, struct dentry *dentry, | 1355 | static int jfs_mknod(struct inode *dir, struct dentry *dentry, |
1356 | int mode, dev_t rdev) | 1356 | umode_t mode, dev_t rdev) |
1357 | { | 1357 | { |
1358 | struct jfs_inode_info *jfs_ip; | 1358 | struct jfs_inode_info *jfs_ip; |
1359 | struct btstack btstack; | 1359 | struct btstack btstack; |
diff --git a/fs/libfs.c b/fs/libfs.c index f6d411eef1e7..5b2dbb3ba4fc 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
13 | #include <linux/exportfs.h> | 13 | #include <linux/exportfs.h> |
14 | #include <linux/writeback.h> | 14 | #include <linux/writeback.h> |
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> /* sync_mapping_buffers */ |
16 | 16 | ||
17 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
18 | 18 | ||
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index b7d7f67cee5a..501043e8966c 100644 --- a/fs/logfs/dir.c +++ b/fs/logfs/dir.c | |||
@@ -482,7 +482,7 @@ out: | |||
482 | return ret; | 482 | return ret; |
483 | } | 483 | } |
484 | 484 | ||
485 | static int logfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 485 | static int logfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
486 | { | 486 | { |
487 | struct inode *inode; | 487 | struct inode *inode; |
488 | 488 | ||
@@ -501,7 +501,7 @@ static int logfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
501 | return __logfs_create(dir, dentry, inode, NULL, 0); | 501 | return __logfs_create(dir, dentry, inode, NULL, 0); |
502 | } | 502 | } |
503 | 503 | ||
504 | static int logfs_create(struct inode *dir, struct dentry *dentry, int mode, | 504 | static int logfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
505 | struct nameidata *nd) | 505 | struct nameidata *nd) |
506 | { | 506 | { |
507 | struct inode *inode; | 507 | struct inode *inode; |
@@ -517,7 +517,7 @@ static int logfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
517 | return __logfs_create(dir, dentry, inode, NULL, 0); | 517 | return __logfs_create(dir, dentry, inode, NULL, 0); |
518 | } | 518 | } |
519 | 519 | ||
520 | static int logfs_mknod(struct inode *dir, struct dentry *dentry, int mode, | 520 | static int logfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, |
521 | dev_t rdev) | 521 | dev_t rdev) |
522 | { | 522 | { |
523 | struct inode *inode; | 523 | struct inode *inode; |
diff --git a/fs/logfs/inode.c b/fs/logfs/inode.c index 4d1af42bfd24..388df1aa35e5 100644 --- a/fs/logfs/inode.c +++ b/fs/logfs/inode.c | |||
@@ -323,7 +323,7 @@ static void logfs_set_ino_generation(struct super_block *sb, | |||
323 | mutex_unlock(&super->s_journal_mutex); | 323 | mutex_unlock(&super->s_journal_mutex); |
324 | } | 324 | } |
325 | 325 | ||
326 | struct inode *logfs_new_inode(struct inode *dir, int mode) | 326 | struct inode *logfs_new_inode(struct inode *dir, umode_t mode) |
327 | { | 327 | { |
328 | struct super_block *sb = dir->i_sb; | 328 | struct super_block *sb = dir->i_sb; |
329 | struct inode *inode; | 329 | struct inode *inode; |
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h index 398ecff6e548..926373866a55 100644 --- a/fs/logfs/logfs.h +++ b/fs/logfs/logfs.h | |||
@@ -520,7 +520,7 @@ extern const struct super_operations logfs_super_operations; | |||
520 | struct inode *logfs_iget(struct super_block *sb, ino_t ino); | 520 | struct inode *logfs_iget(struct super_block *sb, ino_t ino); |
521 | struct inode *logfs_safe_iget(struct super_block *sb, ino_t ino, int *cookie); | 521 | struct inode *logfs_safe_iget(struct super_block *sb, ino_t ino, int *cookie); |
522 | void logfs_safe_iput(struct inode *inode, int cookie); | 522 | void logfs_safe_iput(struct inode *inode, int cookie); |
523 | struct inode *logfs_new_inode(struct inode *dir, int mode); | 523 | struct inode *logfs_new_inode(struct inode *dir, umode_t mode); |
524 | struct inode *logfs_new_meta_inode(struct super_block *sb, u64 ino); | 524 | struct inode *logfs_new_meta_inode(struct super_block *sb, u64 ino); |
525 | struct inode *logfs_read_meta_inode(struct super_block *sb, u64 ino); | 525 | struct inode *logfs_read_meta_inode(struct super_block *sb, u64 ino); |
526 | int logfs_init_inode_cache(void); | 526 | int logfs_init_inode_cache(void); |
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index ef175cb8cfd8..4bc50dac8e97 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -209,7 +209,7 @@ void minix_free_inode(struct inode * inode) | |||
209 | mark_buffer_dirty(bh); | 209 | mark_buffer_dirty(bh); |
210 | } | 210 | } |
211 | 211 | ||
212 | struct inode *minix_new_inode(const struct inode *dir, int mode, int *error) | 212 | struct inode *minix_new_inode(const struct inode *dir, umode_t mode, int *error) |
213 | { | 213 | { |
214 | struct super_block *sb = dir->i_sb; | 214 | struct super_block *sb = dir->i_sb; |
215 | struct minix_sb_info *sbi = minix_sb(sb); | 215 | struct minix_sb_info *sbi = minix_sb(sb); |
diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 26bbd55e82ea..c889ef0aa571 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h | |||
@@ -46,7 +46,7 @@ struct minix_sb_info { | |||
46 | extern struct inode *minix_iget(struct super_block *, unsigned long); | 46 | extern struct inode *minix_iget(struct super_block *, unsigned long); |
47 | extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); | 47 | extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **); |
48 | extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); | 48 | extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **); |
49 | extern struct inode * minix_new_inode(const struct inode *, int, int *); | 49 | extern struct inode * minix_new_inode(const struct inode *, umode_t, int *); |
50 | extern void minix_free_inode(struct inode * inode); | 50 | extern void minix_free_inode(struct inode * inode); |
51 | extern unsigned long minix_count_free_inodes(struct super_block *sb); | 51 | extern unsigned long minix_count_free_inodes(struct super_block *sb); |
52 | extern int minix_new_block(struct inode * inode); | 52 | extern int minix_new_block(struct inode * inode); |
diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 6e6777f1b4b2..2f76e38c2065 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c | |||
@@ -36,7 +36,7 @@ static struct dentry *minix_lookup(struct inode * dir, struct dentry *dentry, st | |||
36 | return NULL; | 36 | return NULL; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) | 39 | static int minix_mknod(struct inode * dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
40 | { | 40 | { |
41 | int error; | 41 | int error; |
42 | struct inode *inode; | 42 | struct inode *inode; |
@@ -54,7 +54,7 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_ | |||
54 | return error; | 54 | return error; |
55 | } | 55 | } |
56 | 56 | ||
57 | static int minix_create(struct inode * dir, struct dentry *dentry, int mode, | 57 | static int minix_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
58 | struct nameidata *nd) | 58 | struct nameidata *nd) |
59 | { | 59 | { |
60 | return minix_mknod(dir, dentry, mode, 0); | 60 | return minix_mknod(dir, dentry, mode, 0); |
@@ -103,7 +103,7 @@ static int minix_link(struct dentry * old_dentry, struct inode * dir, | |||
103 | return add_nondir(dentry, inode); | 103 | return add_nondir(dentry, inode); |
104 | } | 104 | } |
105 | 105 | ||
106 | static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode) | 106 | static int minix_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode) |
107 | { | 107 | { |
108 | struct inode * inode; | 108 | struct inode * inode; |
109 | int err = -EMLINK; | 109 | int err = -EMLINK; |
diff --git a/fs/namei.c b/fs/namei.c index 87363aab43f0..c283a1ec008e 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1979,7 +1979,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2) | |||
1979 | } | 1979 | } |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | 1982 | int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
1983 | struct nameidata *nd) | 1983 | struct nameidata *nd) |
1984 | { | 1984 | { |
1985 | int error = may_create(dir, dentry); | 1985 | int error = may_create(dir, dentry); |
@@ -2180,7 +2180,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2180 | 2180 | ||
2181 | /* Negative dentry, just create the file */ | 2181 | /* Negative dentry, just create the file */ |
2182 | if (!dentry->d_inode) { | 2182 | if (!dentry->d_inode) { |
2183 | int mode = op->mode; | 2183 | umode_t mode = op->mode; |
2184 | if (!IS_POSIXACL(dir->d_inode)) | 2184 | if (!IS_POSIXACL(dir->d_inode)) |
2185 | mode &= ~current_umask(); | 2185 | mode &= ~current_umask(); |
2186 | /* | 2186 | /* |
@@ -2447,7 +2447,7 @@ struct dentry *user_path_create(int dfd, const char __user *pathname, struct pat | |||
2447 | } | 2447 | } |
2448 | EXPORT_SYMBOL(user_path_create); | 2448 | EXPORT_SYMBOL(user_path_create); |
2449 | 2449 | ||
2450 | int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 2450 | int vfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) |
2451 | { | 2451 | { |
2452 | int error = may_create(dir, dentry); | 2452 | int error = may_create(dir, dentry); |
2453 | 2453 | ||
@@ -2475,7 +2475,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
2475 | return error; | 2475 | return error; |
2476 | } | 2476 | } |
2477 | 2477 | ||
2478 | static int may_mknod(mode_t mode) | 2478 | static int may_mknod(umode_t mode) |
2479 | { | 2479 | { |
2480 | switch (mode & S_IFMT) { | 2480 | switch (mode & S_IFMT) { |
2481 | case S_IFREG: | 2481 | case S_IFREG: |
@@ -2492,7 +2492,7 @@ static int may_mknod(mode_t mode) | |||
2492 | } | 2492 | } |
2493 | } | 2493 | } |
2494 | 2494 | ||
2495 | SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode, | 2495 | SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, umode_t, mode, |
2496 | unsigned, dev) | 2496 | unsigned, dev) |
2497 | { | 2497 | { |
2498 | struct dentry *dentry; | 2498 | struct dentry *dentry; |
@@ -2539,12 +2539,12 @@ out_dput: | |||
2539 | return error; | 2539 | return error; |
2540 | } | 2540 | } |
2541 | 2541 | ||
2542 | SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev) | 2542 | SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev) |
2543 | { | 2543 | { |
2544 | return sys_mknodat(AT_FDCWD, filename, mode, dev); | 2544 | return sys_mknodat(AT_FDCWD, filename, mode, dev); |
2545 | } | 2545 | } |
2546 | 2546 | ||
2547 | int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 2547 | int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
2548 | { | 2548 | { |
2549 | int error = may_create(dir, dentry); | 2549 | int error = may_create(dir, dentry); |
2550 | 2550 | ||
@@ -2565,7 +2565,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
2565 | return error; | 2565 | return error; |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode) | 2568 | SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, umode_t, mode) |
2569 | { | 2569 | { |
2570 | struct dentry *dentry; | 2570 | struct dentry *dentry; |
2571 | struct path path; | 2571 | struct path path; |
@@ -2593,7 +2593,7 @@ out_dput: | |||
2593 | return error; | 2593 | return error; |
2594 | } | 2594 | } |
2595 | 2595 | ||
2596 | SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode) | 2596 | SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode) |
2597 | { | 2597 | { |
2598 | return sys_mkdirat(AT_FDCWD, pathname, mode); | 2598 | return sys_mkdirat(AT_FDCWD, pathname, mode); |
2599 | } | 2599 | } |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index 9c51f621e901..aeed93a6bde0 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -30,15 +30,15 @@ static void ncp_do_readdir(struct file *, void *, filldir_t, | |||
30 | 30 | ||
31 | static int ncp_readdir(struct file *, void *, filldir_t); | 31 | static int ncp_readdir(struct file *, void *, filldir_t); |
32 | 32 | ||
33 | static int ncp_create(struct inode *, struct dentry *, int, struct nameidata *); | 33 | static int ncp_create(struct inode *, struct dentry *, umode_t, struct nameidata *); |
34 | static struct dentry *ncp_lookup(struct inode *, struct dentry *, struct nameidata *); | 34 | static struct dentry *ncp_lookup(struct inode *, struct dentry *, struct nameidata *); |
35 | static int ncp_unlink(struct inode *, struct dentry *); | 35 | static int ncp_unlink(struct inode *, struct dentry *); |
36 | static int ncp_mkdir(struct inode *, struct dentry *, int); | 36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); |
37 | static int ncp_rmdir(struct inode *, struct dentry *); | 37 | static int ncp_rmdir(struct inode *, struct dentry *); |
38 | static int ncp_rename(struct inode *, struct dentry *, | 38 | static int ncp_rename(struct inode *, struct dentry *, |
39 | struct inode *, struct dentry *); | 39 | struct inode *, struct dentry *); |
40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, | 40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, |
41 | int mode, dev_t rdev); | 41 | umode_t mode, dev_t rdev); |
42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | 42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) |
43 | extern int ncp_symlink(struct inode *, struct dentry *, const char *); | 43 | extern int ncp_symlink(struct inode *, struct dentry *, const char *); |
44 | #else | 44 | #else |
@@ -919,7 +919,7 @@ out_close: | |||
919 | goto out; | 919 | goto out; |
920 | } | 920 | } |
921 | 921 | ||
922 | int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode, | 922 | int ncp_create_new(struct inode *dir, struct dentry *dentry, umode_t mode, |
923 | dev_t rdev, __le32 attributes) | 923 | dev_t rdev, __le32 attributes) |
924 | { | 924 | { |
925 | struct ncp_server *server = NCP_SERVER(dir); | 925 | struct ncp_server *server = NCP_SERVER(dir); |
@@ -928,7 +928,7 @@ int ncp_create_new(struct inode *dir, struct dentry *dentry, int mode, | |||
928 | int opmode; | 928 | int opmode; |
929 | __u8 __name[NCP_MAXPATHLEN + 1]; | 929 | __u8 __name[NCP_MAXPATHLEN + 1]; |
930 | 930 | ||
931 | PPRINTK("ncp_create_new: creating %s/%s, mode=%x\n", | 931 | PPRINTK("ncp_create_new: creating %s/%s, mode=%hx\n", |
932 | dentry->d_parent->d_name.name, dentry->d_name.name, mode); | 932 | dentry->d_parent->d_name.name, dentry->d_name.name, mode); |
933 | 933 | ||
934 | ncp_age_dentry(server, dentry); | 934 | ncp_age_dentry(server, dentry); |
@@ -979,13 +979,13 @@ out: | |||
979 | return error; | 979 | return error; |
980 | } | 980 | } |
981 | 981 | ||
982 | static int ncp_create(struct inode *dir, struct dentry *dentry, int mode, | 982 | static int ncp_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
983 | struct nameidata *nd) | 983 | struct nameidata *nd) |
984 | { | 984 | { |
985 | return ncp_create_new(dir, dentry, mode, 0, 0); | 985 | return ncp_create_new(dir, dentry, mode, 0, 0); |
986 | } | 986 | } |
987 | 987 | ||
988 | static int ncp_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 988 | static int ncp_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
989 | { | 989 | { |
990 | struct ncp_entry_info finfo; | 990 | struct ncp_entry_info finfo; |
991 | struct ncp_server *server = NCP_SERVER(dir); | 991 | struct ncp_server *server = NCP_SERVER(dir); |
@@ -1201,12 +1201,12 @@ out: | |||
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, | 1203 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, |
1204 | int mode, dev_t rdev) | 1204 | umode_t mode, dev_t rdev) |
1205 | { | 1205 | { |
1206 | if (!new_valid_dev(rdev)) | 1206 | if (!new_valid_dev(rdev)) |
1207 | return -EINVAL; | 1207 | return -EINVAL; |
1208 | if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { | 1208 | if (ncp_is_nfs_extras(NCP_SERVER(dir), NCP_FINFO(dir)->volNumber)) { |
1209 | DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%o\n", mode); | 1209 | DPRINTK(KERN_DEBUG "ncp_mknod: mode = 0%ho\n", mode); |
1210 | return ncp_create_new(dir, dentry, mode, rdev, 0); | 1210 | return ncp_create_new(dir, dentry, mode, rdev, 0); |
1211 | } | 1211 | } |
1212 | return -EPERM; /* Strange, but true */ | 1212 | return -EPERM; /* Strange, but true */ |
diff --git a/fs/ncpfs/ncplib_kernel.h b/fs/ncpfs/ncplib_kernel.h index 09881e6aa5ad..32c06587351a 100644 --- a/fs/ncpfs/ncplib_kernel.h +++ b/fs/ncpfs/ncplib_kernel.h | |||
@@ -114,7 +114,7 @@ int ncp_dirhandle_alloc(struct ncp_server *, __u8 vol, __le32 dirent, __u8 *dirh | |||
114 | int ncp_dirhandle_free(struct ncp_server *, __u8 dirhandle); | 114 | int ncp_dirhandle_free(struct ncp_server *, __u8 dirhandle); |
115 | 115 | ||
116 | int ncp_create_new(struct inode *dir, struct dentry *dentry, | 116 | int ncp_create_new(struct inode *dir, struct dentry *dentry, |
117 | int mode, dev_t rdev, __le32 attributes); | 117 | umode_t mode, dev_t rdev, __le32 attributes); |
118 | 118 | ||
119 | static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) { | 119 | static inline int ncp_is_nfs_extras(struct ncp_server* server, unsigned int volnum) { |
120 | #ifdef CONFIG_NCPFS_NFS_NS | 120 | #ifdef CONFIG_NCPFS_NFS_NS |
diff --git a/fs/ncpfs/symlink.c b/fs/ncpfs/symlink.c index 661f861d80c6..52439ddc8de0 100644 --- a/fs/ncpfs/symlink.c +++ b/fs/ncpfs/symlink.c | |||
@@ -108,7 +108,7 @@ int ncp_symlink(struct inode *dir, struct dentry *dentry, const char *symname) { | |||
108 | char *rawlink; | 108 | char *rawlink; |
109 | int length, err, i, outlen; | 109 | int length, err, i, outlen; |
110 | int kludge; | 110 | int kludge; |
111 | int mode; | 111 | umode_t mode; |
112 | __le32 attr; | 112 | __le32 attr; |
113 | unsigned int hdr; | 113 | unsigned int hdr; |
114 | 114 | ||
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 23be134b3193..fd9a872fada0 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -47,13 +47,13 @@ static int nfs_opendir(struct inode *, struct file *); | |||
47 | static int nfs_closedir(struct inode *, struct file *); | 47 | static int nfs_closedir(struct inode *, struct file *); |
48 | static int nfs_readdir(struct file *, void *, filldir_t); | 48 | static int nfs_readdir(struct file *, void *, filldir_t); |
49 | static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); | 49 | static struct dentry *nfs_lookup(struct inode *, struct dentry *, struct nameidata *); |
50 | static int nfs_create(struct inode *, struct dentry *, int, struct nameidata *); | 50 | static int nfs_create(struct inode *, struct dentry *, umode_t, struct nameidata *); |
51 | static int nfs_mkdir(struct inode *, struct dentry *, int); | 51 | static int nfs_mkdir(struct inode *, struct dentry *, umode_t); |
52 | static int nfs_rmdir(struct inode *, struct dentry *); | 52 | static int nfs_rmdir(struct inode *, struct dentry *); |
53 | static int nfs_unlink(struct inode *, struct dentry *); | 53 | static int nfs_unlink(struct inode *, struct dentry *); |
54 | static int nfs_symlink(struct inode *, struct dentry *, const char *); | 54 | static int nfs_symlink(struct inode *, struct dentry *, const char *); |
55 | static int nfs_link(struct dentry *, struct inode *, struct dentry *); | 55 | static int nfs_link(struct dentry *, struct inode *, struct dentry *); |
56 | static int nfs_mknod(struct inode *, struct dentry *, int, dev_t); | 56 | static int nfs_mknod(struct inode *, struct dentry *, umode_t, dev_t); |
57 | static int nfs_rename(struct inode *, struct dentry *, | 57 | static int nfs_rename(struct inode *, struct dentry *, |
58 | struct inode *, struct dentry *); | 58 | struct inode *, struct dentry *); |
59 | static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); | 59 | static int nfs_fsync_dir(struct file *, loff_t, loff_t, int); |
@@ -112,7 +112,7 @@ const struct inode_operations nfs3_dir_inode_operations = { | |||
112 | #ifdef CONFIG_NFS_V4 | 112 | #ifdef CONFIG_NFS_V4 |
113 | 113 | ||
114 | static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); | 114 | static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); |
115 | static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd); | 115 | static int nfs_open_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd); |
116 | const struct inode_operations nfs4_dir_inode_operations = { | 116 | const struct inode_operations nfs4_dir_inode_operations = { |
117 | .create = nfs_open_create, | 117 | .create = nfs_open_create, |
118 | .lookup = nfs_atomic_lookup, | 118 | .lookup = nfs_atomic_lookup, |
@@ -1573,8 +1573,8 @@ no_open: | |||
1573 | return nfs_lookup_revalidate(dentry, nd); | 1573 | return nfs_lookup_revalidate(dentry, nd); |
1574 | } | 1574 | } |
1575 | 1575 | ||
1576 | static int nfs_open_create(struct inode *dir, struct dentry *dentry, int mode, | 1576 | static int nfs_open_create(struct inode *dir, struct dentry *dentry, |
1577 | struct nameidata *nd) | 1577 | umode_t mode, struct nameidata *nd) |
1578 | { | 1578 | { |
1579 | struct nfs_open_context *ctx = NULL; | 1579 | struct nfs_open_context *ctx = NULL; |
1580 | struct iattr attr; | 1580 | struct iattr attr; |
@@ -1664,8 +1664,8 @@ out_error: | |||
1664 | * that the operation succeeded on the server, but an error in the | 1664 | * that the operation succeeded on the server, but an error in the |
1665 | * reply path made it appear to have failed. | 1665 | * reply path made it appear to have failed. |
1666 | */ | 1666 | */ |
1667 | static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, | 1667 | static int nfs_create(struct inode *dir, struct dentry *dentry, |
1668 | struct nameidata *nd) | 1668 | umode_t mode, struct nameidata *nd) |
1669 | { | 1669 | { |
1670 | struct iattr attr; | 1670 | struct iattr attr; |
1671 | int error; | 1671 | int error; |
@@ -1693,7 +1693,7 @@ out_err: | |||
1693 | * See comments for nfs_proc_create regarding failed operations. | 1693 | * See comments for nfs_proc_create regarding failed operations. |
1694 | */ | 1694 | */ |
1695 | static int | 1695 | static int |
1696 | nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | 1696 | nfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
1697 | { | 1697 | { |
1698 | struct iattr attr; | 1698 | struct iattr attr; |
1699 | int status; | 1699 | int status; |
@@ -1719,7 +1719,7 @@ out_err: | |||
1719 | /* | 1719 | /* |
1720 | * See comments for nfs_proc_create regarding failed operations. | 1720 | * See comments for nfs_proc_create regarding failed operations. |
1721 | */ | 1721 | */ |
1722 | static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 1722 | static int nfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
1723 | { | 1723 | { |
1724 | struct iattr attr; | 1724 | struct iattr attr; |
1725 | int error; | 1725 | int error; |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index c763de5c1157..68454e75fce9 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -59,7 +59,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry) | |||
59 | * the write call). | 59 | * the write call). |
60 | */ | 60 | */ |
61 | static inline __be32 | 61 | static inline __be32 |
62 | nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int requested) | 62 | nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, umode_t requested) |
63 | { | 63 | { |
64 | mode &= S_IFMT; | 64 | mode &= S_IFMT; |
65 | 65 | ||
@@ -293,7 +293,7 @@ out: | |||
293 | * include/linux/nfsd/nfsd.h. | 293 | * include/linux/nfsd/nfsd.h. |
294 | */ | 294 | */ |
295 | __be32 | 295 | __be32 |
296 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | 296 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) |
297 | { | 297 | { |
298 | struct svc_export *exp; | 298 | struct svc_export *exp; |
299 | struct dentry *dentry; | 299 | struct dentry *dentry; |
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index c16f8d8331b5..e5e6707ba687 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h | |||
@@ -102,7 +102,7 @@ extern char * SVCFH_fmt(struct svc_fh *fhp); | |||
102 | /* | 102 | /* |
103 | * Function prototypes | 103 | * Function prototypes |
104 | */ | 104 | */ |
105 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, int, int); | 105 | __be32 fh_verify(struct svc_rqst *, struct svc_fh *, umode_t, int); |
106 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); | 106 | __be32 fh_compose(struct svc_fh *, struct svc_export *, struct dentry *, struct svc_fh *); |
107 | __be32 fh_update(struct svc_fh *); | 107 | __be32 fh_update(struct svc_fh *); |
108 | void fh_put(struct svc_fh *); | 108 | void fh_put(struct svc_fh *); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 29b1202313e9..d25a723b68ad 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -307,7 +307,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
307 | struct dentry *dentry; | 307 | struct dentry *dentry; |
308 | struct inode *inode; | 308 | struct inode *inode; |
309 | int accmode = NFSD_MAY_SATTR; | 309 | int accmode = NFSD_MAY_SATTR; |
310 | int ftype = 0; | 310 | umode_t ftype = 0; |
311 | __be32 err; | 311 | __be32 err; |
312 | int host_err; | 312 | int host_err; |
313 | int size_change = 0; | 313 | int size_change = 0; |
@@ -730,7 +730,7 @@ static int nfsd_open_break_lease(struct inode *inode, int access) | |||
730 | * N.B. After this call fhp needs an fh_put | 730 | * N.B. After this call fhp needs an fh_put |
731 | */ | 731 | */ |
732 | __be32 | 732 | __be32 |
733 | nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | 733 | nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, |
734 | int access, struct file **filp) | 734 | int access, struct file **filp) |
735 | { | 735 | { |
736 | struct dentry *dentry; | 736 | struct dentry *dentry; |
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index cee6a12296e8..1dcd238e11a0 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h | |||
@@ -66,7 +66,7 @@ __be32 do_nfsd_create(struct svc_rqst *, struct svc_fh *, | |||
66 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, | 66 | __be32 nfsd_commit(struct svc_rqst *, struct svc_fh *, |
67 | loff_t, unsigned long); | 67 | loff_t, unsigned long); |
68 | #endif /* CONFIG_NFSD_V3 */ | 68 | #endif /* CONFIG_NFSD_V3 */ |
69 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, int, | 69 | __be32 nfsd_open(struct svc_rqst *, struct svc_fh *, umode_t, |
70 | int, struct file **); | 70 | int, struct file **); |
71 | void nfsd_close(struct file *); | 71 | void nfsd_close(struct file *); |
72 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, | 72 | __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, |
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 3a1923943b14..ca35b3a46d17 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -251,7 +251,7 @@ nilfs_type_by_mode[S_IFMT >> S_SHIFT] = { | |||
251 | 251 | ||
252 | static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode) | 252 | static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode) |
253 | { | 253 | { |
254 | mode_t mode = inode->i_mode; | 254 | umode_t mode = inode->i_mode; |
255 | 255 | ||
256 | de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; | 256 | de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; |
257 | } | 257 | } |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index b50ffb72e5b3..8f7b95ac1f7e 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -291,7 +291,7 @@ const struct address_space_operations nilfs_aops = { | |||
291 | .is_partially_uptodate = block_is_partially_uptodate, | 291 | .is_partially_uptodate = block_is_partially_uptodate, |
292 | }; | 292 | }; |
293 | 293 | ||
294 | struct inode *nilfs_new_inode(struct inode *dir, int mode) | 294 | struct inode *nilfs_new_inode(struct inode *dir, umode_t mode) |
295 | { | 295 | { |
296 | struct super_block *sb = dir->i_sb; | 296 | struct super_block *sb = dir->i_sb; |
297 | struct the_nilfs *nilfs = sb->s_fs_info; | 297 | struct the_nilfs *nilfs = sb->s_fs_info; |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 768982de10e4..1cd3f624dffc 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -84,7 +84,7 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) | |||
84 | * If the create succeeds, we fill in the inode information | 84 | * If the create succeeds, we fill in the inode information |
85 | * with d_instantiate(). | 85 | * with d_instantiate(). |
86 | */ | 86 | */ |
87 | static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode, | 87 | static int nilfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
88 | struct nameidata *nd) | 88 | struct nameidata *nd) |
89 | { | 89 | { |
90 | struct inode *inode; | 90 | struct inode *inode; |
@@ -112,7 +112,7 @@ static int nilfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
112 | } | 112 | } |
113 | 113 | ||
114 | static int | 114 | static int |
115 | nilfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | 115 | nilfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
116 | { | 116 | { |
117 | struct inode *inode; | 117 | struct inode *inode; |
118 | struct nilfs_transaction_info ti; | 118 | struct nilfs_transaction_info ti; |
@@ -213,7 +213,7 @@ static int nilfs_link(struct dentry *old_dentry, struct inode *dir, | |||
213 | return err; | 213 | return err; |
214 | } | 214 | } |
215 | 215 | ||
216 | static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 216 | static int nilfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
217 | { | 217 | { |
218 | struct inode *inode; | 218 | struct inode *inode; |
219 | struct nilfs_transaction_info ti; | 219 | struct nilfs_transaction_info ti; |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 3777d138f895..250add84da76 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -246,7 +246,7 @@ int nilfs_ioctl_prepare_clean_segments(struct the_nilfs *, struct nilfs_argv *, | |||
246 | /* inode.c */ | 246 | /* inode.c */ |
247 | void nilfs_inode_add_blocks(struct inode *inode, int n); | 247 | void nilfs_inode_add_blocks(struct inode *inode, int n); |
248 | void nilfs_inode_sub_blocks(struct inode *inode, int n); | 248 | void nilfs_inode_sub_blocks(struct inode *inode, int n); |
249 | extern struct inode *nilfs_new_inode(struct inode *, int); | 249 | extern struct inode *nilfs_new_inode(struct inode *, umode_t); |
250 | extern void nilfs_free_inode(struct inode *); | 250 | extern void nilfs_free_inode(struct inode *); |
251 | extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int); | 251 | extern int nilfs_get_block(struct inode *, sector_t, struct buffer_head *, int); |
252 | extern void nilfs_set_inode_flags(struct inode *); | 252 | extern void nilfs_set_inode_flags(struct inode *); |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index b52706da4645..608be4516091 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -104,7 +104,7 @@ static bool parse_options(ntfs_volume *vol, char *opt) | |||
104 | int errors = 0, sloppy = 0; | 104 | int errors = 0, sloppy = 0; |
105 | uid_t uid = (uid_t)-1; | 105 | uid_t uid = (uid_t)-1; |
106 | gid_t gid = (gid_t)-1; | 106 | gid_t gid = (gid_t)-1; |
107 | mode_t fmask = (mode_t)-1, dmask = (mode_t)-1; | 107 | umode_t fmask = (umode_t)-1, dmask = (umode_t)-1; |
108 | int mft_zone_multiplier = -1, on_errors = -1; | 108 | int mft_zone_multiplier = -1, on_errors = -1; |
109 | int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1; | 109 | int show_sys_files = -1, case_sensitive = -1, disable_sparse = -1; |
110 | struct nls_table *nls_map = NULL, *old_nls; | 110 | struct nls_table *nls_map = NULL, *old_nls; |
@@ -287,9 +287,9 @@ no_mount_options: | |||
287 | vol->uid = uid; | 287 | vol->uid = uid; |
288 | if (gid != (gid_t)-1) | 288 | if (gid != (gid_t)-1) |
289 | vol->gid = gid; | 289 | vol->gid = gid; |
290 | if (fmask != (mode_t)-1) | 290 | if (fmask != (umode_t)-1) |
291 | vol->fmask = fmask; | 291 | vol->fmask = fmask; |
292 | if (dmask != (mode_t)-1) | 292 | if (dmask != (umode_t)-1) |
293 | vol->dmask = dmask; | 293 | vol->dmask = dmask; |
294 | if (show_sys_files != -1) { | 294 | if (show_sys_files != -1) { |
295 | if (show_sys_files) | 295 | if (show_sys_files) |
diff --git a/fs/ntfs/volume.h b/fs/ntfs/volume.h index 406ab55dfb32..15e3ba8d521a 100644 --- a/fs/ntfs/volume.h +++ b/fs/ntfs/volume.h | |||
@@ -48,8 +48,8 @@ typedef struct { | |||
48 | unsigned long flags; /* Miscellaneous flags, see below. */ | 48 | unsigned long flags; /* Miscellaneous flags, see below. */ |
49 | uid_t uid; /* uid that files will be mounted as. */ | 49 | uid_t uid; /* uid that files will be mounted as. */ |
50 | gid_t gid; /* gid that files will be mounted as. */ | 50 | gid_t gid; /* gid that files will be mounted as. */ |
51 | mode_t fmask; /* The mask for file permissions. */ | 51 | umode_t fmask; /* The mask for file permissions. */ |
52 | mode_t dmask; /* The mask for directory | 52 | umode_t dmask; /* The mask for directory |
53 | permissions. */ | 53 | permissions. */ |
54 | u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ | 54 | u8 mft_zone_multiplier; /* Initial mft zone multiplier. */ |
55 | u8 on_errors; /* What to do on filesystem errors. */ | 55 | u8 on_errors; /* What to do on filesystem errors. */ |
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c index dc45deb19e68..73ba81928bce 100644 --- a/fs/ocfs2/cluster/netdebug.c +++ b/fs/ocfs2/cluster/netdebug.c | |||
@@ -553,7 +553,7 @@ void o2net_debugfs_exit(void) | |||
553 | 553 | ||
554 | int o2net_debugfs_init(void) | 554 | int o2net_debugfs_init(void) |
555 | { | 555 | { |
556 | mode_t mode = S_IFREG|S_IRUSR; | 556 | umode_t mode = S_IFREG|S_IRUSR; |
557 | 557 | ||
558 | o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL); | 558 | o2net_dentry = debugfs_create_dir(O2NET_DEBUG_DIR, NULL); |
559 | if (o2net_dentry) | 559 | if (o2net_dentry) |
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index a9f007de1da8..abfac0d7ae9c 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
@@ -400,16 +400,14 @@ static struct backing_dev_info dlmfs_backing_dev_info = { | |||
400 | static struct inode *dlmfs_get_root_inode(struct super_block *sb) | 400 | static struct inode *dlmfs_get_root_inode(struct super_block *sb) |
401 | { | 401 | { |
402 | struct inode *inode = new_inode(sb); | 402 | struct inode *inode = new_inode(sb); |
403 | int mode = S_IFDIR | 0755; | 403 | umode_t mode = S_IFDIR | 0755; |
404 | struct dlmfs_inode_private *ip; | 404 | struct dlmfs_inode_private *ip; |
405 | 405 | ||
406 | if (inode) { | 406 | if (inode) { |
407 | ip = DLMFS_I(inode); | 407 | ip = DLMFS_I(inode); |
408 | 408 | ||
409 | inode->i_ino = get_next_ino(); | 409 | inode->i_ino = get_next_ino(); |
410 | inode->i_mode = mode; | 410 | inode_init_owner(inode, NULL, mode); |
411 | inode->i_uid = current_fsuid(); | ||
412 | inode->i_gid = current_fsgid(); | ||
413 | inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; | 411 | inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; |
414 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 412 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
415 | inc_nlink(inode); | 413 | inc_nlink(inode); |
@@ -423,7 +421,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb) | |||
423 | 421 | ||
424 | static struct inode *dlmfs_get_inode(struct inode *parent, | 422 | static struct inode *dlmfs_get_inode(struct inode *parent, |
425 | struct dentry *dentry, | 423 | struct dentry *dentry, |
426 | int mode) | 424 | umode_t mode) |
427 | { | 425 | { |
428 | struct super_block *sb = parent->i_sb; | 426 | struct super_block *sb = parent->i_sb; |
429 | struct inode * inode = new_inode(sb); | 427 | struct inode * inode = new_inode(sb); |
@@ -433,9 +431,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent, | |||
433 | return NULL; | 431 | return NULL; |
434 | 432 | ||
435 | inode->i_ino = get_next_ino(); | 433 | inode->i_ino = get_next_ino(); |
436 | inode->i_mode = mode; | 434 | inode_init_owner(inode, parent, mode); |
437 | inode->i_uid = current_fsuid(); | ||
438 | inode->i_gid = current_fsgid(); | ||
439 | inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; | 435 | inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; |
440 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 436 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
441 | 437 | ||
@@ -472,13 +468,6 @@ static struct inode *dlmfs_get_inode(struct inode *parent, | |||
472 | inc_nlink(inode); | 468 | inc_nlink(inode); |
473 | break; | 469 | break; |
474 | } | 470 | } |
475 | |||
476 | if (parent->i_mode & S_ISGID) { | ||
477 | inode->i_gid = parent->i_gid; | ||
478 | if (S_ISDIR(mode)) | ||
479 | inode->i_mode |= S_ISGID; | ||
480 | } | ||
481 | |||
482 | return inode; | 471 | return inode; |
483 | } | 472 | } |
484 | 473 | ||
@@ -488,7 +477,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent, | |||
488 | /* SMP-safe */ | 477 | /* SMP-safe */ |
489 | static int dlmfs_mkdir(struct inode * dir, | 478 | static int dlmfs_mkdir(struct inode * dir, |
490 | struct dentry * dentry, | 479 | struct dentry * dentry, |
491 | int mode) | 480 | umode_t mode) |
492 | { | 481 | { |
493 | int status; | 482 | int status; |
494 | struct inode *inode = NULL; | 483 | struct inode *inode = NULL; |
@@ -536,7 +525,7 @@ bail: | |||
536 | 525 | ||
537 | static int dlmfs_create(struct inode *dir, | 526 | static int dlmfs_create(struct inode *dir, |
538 | struct dentry *dentry, | 527 | struct dentry *dentry, |
539 | int mode, | 528 | umode_t mode, |
540 | struct nameidata *nd) | 529 | struct nameidata *nd) |
541 | { | 530 | { |
542 | int status = 0; | 531 | int status = 0; |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index a8b2bfea574e..be244692550d 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -185,7 +185,7 @@ bail: | |||
185 | return ret; | 185 | return ret; |
186 | } | 186 | } |
187 | 187 | ||
188 | static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode) | 188 | static struct inode *ocfs2_get_init_inode(struct inode *dir, umode_t mode) |
189 | { | 189 | { |
190 | struct inode *inode; | 190 | struct inode *inode; |
191 | 191 | ||
@@ -207,7 +207,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode) | |||
207 | 207 | ||
208 | static int ocfs2_mknod(struct inode *dir, | 208 | static int ocfs2_mknod(struct inode *dir, |
209 | struct dentry *dentry, | 209 | struct dentry *dentry, |
210 | int mode, | 210 | umode_t mode, |
211 | dev_t dev) | 211 | dev_t dev) |
212 | { | 212 | { |
213 | int status = 0; | 213 | int status = 0; |
@@ -602,7 +602,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb, | |||
602 | 602 | ||
603 | static int ocfs2_mkdir(struct inode *dir, | 603 | static int ocfs2_mkdir(struct inode *dir, |
604 | struct dentry *dentry, | 604 | struct dentry *dentry, |
605 | int mode) | 605 | umode_t mode) |
606 | { | 606 | { |
607 | int ret; | 607 | int ret; |
608 | 608 | ||
@@ -617,7 +617,7 @@ static int ocfs2_mkdir(struct inode *dir, | |||
617 | 617 | ||
618 | static int ocfs2_create(struct inode *dir, | 618 | static int ocfs2_create(struct inode *dir, |
619 | struct dentry *dentry, | 619 | struct dentry *dentry, |
620 | int mode, | 620 | umode_t mode, |
621 | struct nameidata *nd) | 621 | struct nameidata *nd) |
622 | { | 622 | { |
623 | int ret; | 623 | int ret; |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index aa9e8777b09a..0ba9ea1e7961 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -623,7 +623,7 @@ int ocfs2_calc_security_init(struct inode *dir, | |||
623 | 623 | ||
624 | int ocfs2_calc_xattr_init(struct inode *dir, | 624 | int ocfs2_calc_xattr_init(struct inode *dir, |
625 | struct buffer_head *dir_bh, | 625 | struct buffer_head *dir_bh, |
626 | int mode, | 626 | umode_t mode, |
627 | struct ocfs2_security_xattr_info *si, | 627 | struct ocfs2_security_xattr_info *si, |
628 | int *want_clusters, | 628 | int *want_clusters, |
629 | int *xattr_credits, | 629 | int *xattr_credits, |
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h index d63cfb72316b..e5c7f15465b4 100644 --- a/fs/ocfs2/xattr.h +++ b/fs/ocfs2/xattr.h | |||
@@ -68,7 +68,7 @@ int ocfs2_calc_security_init(struct inode *, | |||
68 | struct ocfs2_security_xattr_info *, | 68 | struct ocfs2_security_xattr_info *, |
69 | int *, int *, struct ocfs2_alloc_context **); | 69 | int *, int *, struct ocfs2_alloc_context **); |
70 | int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, | 70 | int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *, |
71 | int, struct ocfs2_security_xattr_info *, | 71 | umode_t, struct ocfs2_security_xattr_info *, |
72 | int *, int *, int *); | 72 | int *, int *, int *); |
73 | 73 | ||
74 | /* | 74 | /* |
diff --git a/fs/omfs/dir.c b/fs/omfs/dir.c index 98e544274390..f00576ec320f 100644 --- a/fs/omfs/dir.c +++ b/fs/omfs/dir.c | |||
@@ -255,7 +255,7 @@ static int omfs_remove(struct inode *dir, struct dentry *dentry) | |||
255 | return 0; | 255 | return 0; |
256 | } | 256 | } |
257 | 257 | ||
258 | static int omfs_add_node(struct inode *dir, struct dentry *dentry, int mode) | 258 | static int omfs_add_node(struct inode *dir, struct dentry *dentry, umode_t mode) |
259 | { | 259 | { |
260 | int err; | 260 | int err; |
261 | struct inode *inode = omfs_new_inode(dir, mode); | 261 | struct inode *inode = omfs_new_inode(dir, mode); |
@@ -279,12 +279,12 @@ out_free_inode: | |||
279 | return err; | 279 | return err; |
280 | } | 280 | } |
281 | 281 | ||
282 | static int omfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 282 | static int omfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
283 | { | 283 | { |
284 | return omfs_add_node(dir, dentry, mode | S_IFDIR); | 284 | return omfs_add_node(dir, dentry, mode | S_IFDIR); |
285 | } | 285 | } |
286 | 286 | ||
287 | static int omfs_create(struct inode *dir, struct dentry *dentry, int mode, | 287 | static int omfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
288 | struct nameidata *nd) | 288 | struct nameidata *nd) |
289 | { | 289 | { |
290 | return omfs_add_node(dir, dentry, mode | S_IFREG); | 290 | return omfs_add_node(dir, dentry, mode | S_IFREG); |
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index e043c4cb9a97..6065bb0ba207 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c | |||
@@ -28,7 +28,7 @@ struct buffer_head *omfs_bread(struct super_block *sb, sector_t block) | |||
28 | return sb_bread(sb, clus_to_blk(sbi, block)); | 28 | return sb_bread(sb, clus_to_blk(sbi, block)); |
29 | } | 29 | } |
30 | 30 | ||
31 | struct inode *omfs_new_inode(struct inode *dir, int mode) | 31 | struct inode *omfs_new_inode(struct inode *dir, umode_t mode) |
32 | { | 32 | { |
33 | struct inode *inode; | 33 | struct inode *inode; |
34 | u64 new_block; | 34 | u64 new_block; |
diff --git a/fs/omfs/omfs.h b/fs/omfs/omfs.h index 7d414fef501a..8941f12c6b01 100644 --- a/fs/omfs/omfs.h +++ b/fs/omfs/omfs.h | |||
@@ -60,7 +60,7 @@ extern int omfs_shrink_inode(struct inode *inode); | |||
60 | /* inode.c */ | 60 | /* inode.c */ |
61 | extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block); | 61 | extern struct buffer_head *omfs_bread(struct super_block *sb, sector_t block); |
62 | extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); | 62 | extern struct inode *omfs_iget(struct super_block *sb, ino_t inode); |
63 | extern struct inode *omfs_new_inode(struct inode *dir, int mode); | 63 | extern struct inode *omfs_new_inode(struct inode *dir, umode_t mode); |
64 | extern int omfs_reserve_block(struct super_block *sb, sector_t block); | 64 | extern int omfs_reserve_block(struct super_block *sb, sector_t block); |
65 | extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); | 65 | extern int omfs_find_empty_block(struct super_block *sb, int mode, ino_t *ino); |
66 | extern int omfs_sync_inode(struct inode *inode); | 66 | extern int omfs_sync_inode(struct inode *inode); |
@@ -468,7 +468,7 @@ out_unlock: | |||
468 | return error; | 468 | return error; |
469 | } | 469 | } |
470 | 470 | ||
471 | SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) | 471 | SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode) |
472 | { | 472 | { |
473 | struct file * file; | 473 | struct file * file; |
474 | int err = -EBADF; | 474 | int err = -EBADF; |
@@ -482,7 +482,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode) | |||
482 | return err; | 482 | return err; |
483 | } | 483 | } |
484 | 484 | ||
485 | SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) | 485 | SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, umode_t, mode) |
486 | { | 486 | { |
487 | struct path path; | 487 | struct path path; |
488 | int error; | 488 | int error; |
@@ -495,7 +495,7 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode) | |||
495 | return error; | 495 | return error; |
496 | } | 496 | } |
497 | 497 | ||
498 | SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode) | 498 | SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode) |
499 | { | 499 | { |
500 | return sys_fchmodat(AT_FDCWD, filename, mode); | 500 | return sys_fchmodat(AT_FDCWD, filename, mode); |
501 | } | 501 | } |
@@ -877,7 +877,7 @@ void fd_install(unsigned int fd, struct file *file) | |||
877 | 877 | ||
878 | EXPORT_SYMBOL(fd_install); | 878 | EXPORT_SYMBOL(fd_install); |
879 | 879 | ||
880 | static inline int build_open_flags(int flags, int mode, struct open_flags *op) | 880 | static inline int build_open_flags(int flags, umode_t mode, struct open_flags *op) |
881 | { | 881 | { |
882 | int lookup_flags = 0; | 882 | int lookup_flags = 0; |
883 | int acc_mode; | 883 | int acc_mode; |
@@ -948,7 +948,7 @@ static inline int build_open_flags(int flags, int mode, struct open_flags *op) | |||
948 | * have to. But in generally you should not do this, so please move | 948 | * have to. But in generally you should not do this, so please move |
949 | * along, nothing to see here.. | 949 | * along, nothing to see here.. |
950 | */ | 950 | */ |
951 | struct file *filp_open(const char *filename, int flags, int mode) | 951 | struct file *filp_open(const char *filename, int flags, umode_t mode) |
952 | { | 952 | { |
953 | struct open_flags op; | 953 | struct open_flags op; |
954 | int lookup = build_open_flags(flags, mode, &op); | 954 | int lookup = build_open_flags(flags, mode, &op); |
@@ -970,7 +970,7 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt, | |||
970 | } | 970 | } |
971 | EXPORT_SYMBOL(file_open_root); | 971 | EXPORT_SYMBOL(file_open_root); |
972 | 972 | ||
973 | long do_sys_open(int dfd, const char __user *filename, int flags, int mode) | 973 | long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode) |
974 | { | 974 | { |
975 | struct open_flags op; | 975 | struct open_flags op; |
976 | int lookup = build_open_flags(flags, mode, &op); | 976 | int lookup = build_open_flags(flags, mode, &op); |
@@ -994,7 +994,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode) | |||
994 | return fd; | 994 | return fd; |
995 | } | 995 | } |
996 | 996 | ||
997 | SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) | 997 | SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, umode_t, mode) |
998 | { | 998 | { |
999 | long ret; | 999 | long ret; |
1000 | 1000 | ||
@@ -1008,7 +1008,7 @@ SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) | |||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, | 1010 | SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, |
1011 | int, mode) | 1011 | umode_t, mode) |
1012 | { | 1012 | { |
1013 | long ret; | 1013 | long ret; |
1014 | 1014 | ||
@@ -1027,7 +1027,7 @@ SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags, | |||
1027 | * For backward compatibility? Maybe this should be moved | 1027 | * For backward compatibility? Maybe this should be moved |
1028 | * into arch/i386 instead? | 1028 | * into arch/i386 instead? |
1029 | */ | 1029 | */ |
1030 | SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode) | 1030 | SYSCALL_DEFINE2(creat, const char __user *, pathname, umode_t, mode) |
1031 | { | 1031 | { |
1032 | return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); | 1032 | return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); |
1033 | } | 1033 | } |
diff --git a/fs/partitions/Kconfig b/fs/partitions/Kconfig deleted file mode 100644 index cb5f0a3f1b03..000000000000 --- a/fs/partitions/Kconfig +++ /dev/null | |||
@@ -1,251 +0,0 @@ | |||
1 | # | ||
2 | # Partition configuration | ||
3 | # | ||
4 | config PARTITION_ADVANCED | ||
5 | bool "Advanced partition selection" | ||
6 | help | ||
7 | Say Y here if you would like to use hard disks under Linux which | ||
8 | were partitioned under an operating system running on a different | ||
9 | architecture than your Linux system. | ||
10 | |||
11 | Note that the answer to this question won't directly affect the | ||
12 | kernel: saying N will just cause the configurator to skip all | ||
13 | the questions about foreign partitioning schemes. | ||
14 | |||
15 | If unsure, say N. | ||
16 | |||
17 | config ACORN_PARTITION | ||
18 | bool "Acorn partition support" if PARTITION_ADVANCED | ||
19 | default y if ARCH_ACORN | ||
20 | help | ||
21 | Support hard disks partitioned under Acorn operating systems. | ||
22 | |||
23 | config ACORN_PARTITION_CUMANA | ||
24 | bool "Cumana partition support" if PARTITION_ADVANCED | ||
25 | default y if ARCH_ACORN | ||
26 | depends on ACORN_PARTITION | ||
27 | help | ||
28 | Say Y here if you would like to use hard disks under Linux which | ||
29 | were partitioned using the Cumana interface on Acorn machines. | ||
30 | |||
31 | config ACORN_PARTITION_EESOX | ||
32 | bool "EESOX partition support" if PARTITION_ADVANCED | ||
33 | default y if ARCH_ACORN | ||
34 | depends on ACORN_PARTITION | ||
35 | |||
36 | config ACORN_PARTITION_ICS | ||
37 | bool "ICS partition support" if PARTITION_ADVANCED | ||
38 | default y if ARCH_ACORN | ||
39 | depends on ACORN_PARTITION | ||
40 | help | ||
41 | Say Y here if you would like to use hard disks under Linux which | ||
42 | were partitioned using the ICS interface on Acorn machines. | ||
43 | |||
44 | config ACORN_PARTITION_ADFS | ||
45 | bool "Native filecore partition support" if PARTITION_ADVANCED | ||
46 | default y if ARCH_ACORN | ||
47 | depends on ACORN_PARTITION | ||
48 | help | ||
49 | The Acorn Disc Filing System is the standard file system of the | ||
50 | RiscOS operating system which runs on Acorn's ARM-based Risc PC | ||
51 | systems and the Acorn Archimedes range of machines. If you say | ||
52 | `Y' here, Linux will support disk partitions created under ADFS. | ||
53 | |||
54 | config ACORN_PARTITION_POWERTEC | ||
55 | bool "PowerTec partition support" if PARTITION_ADVANCED | ||
56 | default y if ARCH_ACORN | ||
57 | depends on ACORN_PARTITION | ||
58 | help | ||
59 | Support reading partition tables created on Acorn machines using | ||
60 | the PowerTec SCSI drive. | ||
61 | |||
62 | config ACORN_PARTITION_RISCIX | ||
63 | bool "RISCiX partition support" if PARTITION_ADVANCED | ||
64 | default y if ARCH_ACORN | ||
65 | depends on ACORN_PARTITION | ||
66 | help | ||
67 | Once upon a time, there was a native Unix port for the Acorn series | ||
68 | of machines called RISCiX. If you say 'Y' here, Linux will be able | ||
69 | to read disks partitioned under RISCiX. | ||
70 | |||
71 | config OSF_PARTITION | ||
72 | bool "Alpha OSF partition support" if PARTITION_ADVANCED | ||
73 | default y if ALPHA | ||
74 | help | ||
75 | Say Y here if you would like to use hard disks under Linux which | ||
76 | were partitioned on an Alpha machine. | ||
77 | |||
78 | config AMIGA_PARTITION | ||
79 | bool "Amiga partition table support" if PARTITION_ADVANCED | ||
80 | default y if (AMIGA || AFFS_FS=y) | ||
81 | help | ||
82 | Say Y here if you would like to use hard disks under Linux which | ||
83 | were partitioned under AmigaOS. | ||
84 | |||
85 | config ATARI_PARTITION | ||
86 | bool "Atari partition table support" if PARTITION_ADVANCED | ||
87 | default y if ATARI | ||
88 | help | ||
89 | Say Y here if you would like to use hard disks under Linux which | ||
90 | were partitioned under the Atari OS. | ||
91 | |||
92 | config IBM_PARTITION | ||
93 | bool "IBM disk label and partition support" | ||
94 | depends on PARTITION_ADVANCED && S390 | ||
95 | help | ||
96 | Say Y here if you would like to be able to read the hard disk | ||
97 | partition table format used by IBM DASD disks operating under CMS. | ||
98 | Otherwise, say N. | ||
99 | |||
100 | config MAC_PARTITION | ||
101 | bool "Macintosh partition map support" if PARTITION_ADVANCED | ||
102 | default y if (MAC || PPC_PMAC) | ||
103 | help | ||
104 | Say Y here if you would like to use hard disks under Linux which | ||
105 | were partitioned on a Macintosh. | ||
106 | |||
107 | config MSDOS_PARTITION | ||
108 | bool "PC BIOS (MSDOS partition tables) support" if PARTITION_ADVANCED | ||
109 | default y | ||
110 | help | ||
111 | Say Y here. | ||
112 | |||
113 | config BSD_DISKLABEL | ||
114 | bool "BSD disklabel (FreeBSD partition tables) support" | ||
115 | depends on PARTITION_ADVANCED && MSDOS_PARTITION | ||
116 | help | ||
117 | FreeBSD uses its own hard disk partition scheme on your PC. It | ||
118 | requires only one entry in the primary partition table of your disk | ||
119 | and manages it similarly to DOS extended partitions, putting in its | ||
120 | first sector a new partition table in BSD disklabel format. Saying Y | ||
121 | here allows you to read these disklabels and further mount FreeBSD | ||
122 | partitions from within Linux if you have also said Y to "UFS | ||
123 | file system support", above. If you don't know what all this is | ||
124 | about, say N. | ||
125 | |||
126 | config MINIX_SUBPARTITION | ||
127 | bool "Minix subpartition support" | ||
128 | depends on PARTITION_ADVANCED && MSDOS_PARTITION | ||
129 | help | ||
130 | Minix 2.0.0/2.0.2 subpartition table support for Linux. | ||
131 | Say Y here if you want to mount and use Minix 2.0.0/2.0.2 | ||
132 | subpartitions. | ||
133 | |||
134 | config SOLARIS_X86_PARTITION | ||
135 | bool "Solaris (x86) partition table support" | ||
136 | depends on PARTITION_ADVANCED && MSDOS_PARTITION | ||
137 | help | ||
138 | Like most systems, Solaris x86 uses its own hard disk partition | ||
139 | table format, incompatible with all others. Saying Y here allows you | ||
140 | to read these partition tables and further mount Solaris x86 | ||
141 | partitions from within Linux if you have also said Y to "UFS | ||
142 | file system support", above. | ||
143 | |||
144 | config UNIXWARE_DISKLABEL | ||
145 | bool "Unixware slices support" | ||
146 | depends on PARTITION_ADVANCED && MSDOS_PARTITION | ||
147 | ---help--- | ||
148 | Like some systems, UnixWare uses its own slice table inside a | ||
149 | partition (VTOC - Virtual Table of Contents). Its format is | ||
150 | incompatible with all other OSes. Saying Y here allows you to read | ||
151 | VTOC and further mount UnixWare partitions read-only from within | ||
152 | Linux if you have also said Y to "UFS file system support" or | ||
153 | "System V and Coherent file system support", above. | ||
154 | |||
155 | This is mainly used to carry data from a UnixWare box to your | ||
156 | Linux box via a removable medium like magneto-optical, ZIP or | ||
157 | removable IDE drives. Note, however, that a good portable way to | ||
158 | transport files and directories between unixes (and even other | ||
159 | operating systems) is given by the tar program ("man tar" or | ||
160 | preferably "info tar"). | ||
161 | |||
162 | If you don't know what all this is about, say N. | ||
163 | |||
164 | config LDM_PARTITION | ||
165 | bool "Windows Logical Disk Manager (Dynamic Disk) support" | ||
166 | depends on PARTITION_ADVANCED | ||
167 | ---help--- | ||
168 | Say Y here if you would like to use hard disks under Linux which | ||
169 | were partitioned using Windows 2000's/XP's or Vista's Logical Disk | ||
170 | Manager. They are also known as "Dynamic Disks". | ||
171 | |||
172 | Note this driver only supports Dynamic Disks with a protective MBR | ||
173 | label, i.e. DOS partition table. It does not support GPT labelled | ||
174 | Dynamic Disks yet as can be created with Vista. | ||
175 | |||
176 | Windows 2000 introduced the concept of Dynamic Disks to get around | ||
177 | the limitations of the PC's partitioning scheme. The Logical Disk | ||
178 | Manager allows the user to repartition a disk and create spanned, | ||
179 | mirrored, striped or RAID volumes, all without the need for | ||
180 | rebooting. | ||
181 | |||
182 | Normal partitions are now called Basic Disks under Windows 2000, XP, | ||
183 | and Vista. | ||
184 | |||
185 | For a fuller description read <file:Documentation/ldm.txt>. | ||
186 | |||
187 | If unsure, say N. | ||
188 | |||
189 | config LDM_DEBUG | ||
190 | bool "Windows LDM extra logging" | ||
191 | depends on LDM_PARTITION | ||
192 | help | ||
193 | Say Y here if you would like LDM to log verbosely. This could be | ||
194 | helpful if the driver doesn't work as expected and you'd like to | ||
195 | report a bug. | ||
196 | |||
197 | If unsure, say N. | ||
198 | |||
199 | config SGI_PARTITION | ||
200 | bool "SGI partition support" if PARTITION_ADVANCED | ||
201 | default y if DEFAULT_SGI_PARTITION | ||
202 | help | ||
203 | Say Y here if you would like to be able to read the hard disk | ||
204 | partition table format used by SGI machines. | ||
205 | |||
206 | config ULTRIX_PARTITION | ||
207 | bool "Ultrix partition table support" if PARTITION_ADVANCED | ||
208 | default y if MACH_DECSTATION | ||
209 | help | ||
210 | Say Y here if you would like to be able to read the hard disk | ||
211 | partition table format used by DEC (now Compaq) Ultrix machines. | ||
212 | Otherwise, say N. | ||
213 | |||
214 | config SUN_PARTITION | ||
215 | bool "Sun partition tables support" if PARTITION_ADVANCED | ||
216 | default y if (SPARC || SUN3 || SUN3X) | ||
217 | ---help--- | ||
218 | Like most systems, SunOS uses its own hard disk partition table | ||
219 | format, incompatible with all others. Saying Y here allows you to | ||
220 | read these partition tables and further mount SunOS partitions from | ||
221 | within Linux if you have also said Y to "UFS file system support", | ||
222 | above. This is mainly used to carry data from a SPARC under SunOS to | ||
223 | your Linux box via a removable medium like magneto-optical or ZIP | ||
224 | drives; note however that a good portable way to transport files and | ||
225 | directories between unixes (and even other operating systems) is | ||
226 | given by the tar program ("man tar" or preferably "info tar"). If | ||
227 | you don't know what all this is about, say N. | ||
228 | |||
229 | config KARMA_PARTITION | ||
230 | bool "Karma Partition support" | ||
231 | depends on PARTITION_ADVANCED | ||
232 | help | ||
233 | Say Y here if you would like to mount the Rio Karma MP3 player, as it | ||
234 | uses a proprietary partition table. | ||
235 | |||
236 | config EFI_PARTITION | ||
237 | bool "EFI GUID Partition support" | ||
238 | depends on PARTITION_ADVANCED | ||
239 | select CRC32 | ||
240 | help | ||
241 | Say Y here if you would like to use hard disks under Linux which | ||
242 | were partitioned using EFI GPT. | ||
243 | |||
244 | config SYSV68_PARTITION | ||
245 | bool "SYSV68 partition table support" if PARTITION_ADVANCED | ||
246 | default y if VME | ||
247 | help | ||
248 | Say Y here if you would like to be able to read the hard disk | ||
249 | partition table format used by Motorola Delta machines (using | ||
250 | sysv68). | ||
251 | Otherwise, say N. | ||
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile deleted file mode 100644 index 03af8eac51da..000000000000 --- a/fs/partitions/Makefile +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the linux kernel. | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_BLOCK) := check.o | ||
6 | |||
7 | obj-$(CONFIG_ACORN_PARTITION) += acorn.o | ||
8 | obj-$(CONFIG_AMIGA_PARTITION) += amiga.o | ||
9 | obj-$(CONFIG_ATARI_PARTITION) += atari.o | ||
10 | obj-$(CONFIG_MAC_PARTITION) += mac.o | ||
11 | obj-$(CONFIG_LDM_PARTITION) += ldm.o | ||
12 | obj-$(CONFIG_MSDOS_PARTITION) += msdos.o | ||
13 | obj-$(CONFIG_OSF_PARTITION) += osf.o | ||
14 | obj-$(CONFIG_SGI_PARTITION) += sgi.o | ||
15 | obj-$(CONFIG_SUN_PARTITION) += sun.o | ||
16 | obj-$(CONFIG_ULTRIX_PARTITION) += ultrix.o | ||
17 | obj-$(CONFIG_IBM_PARTITION) += ibm.o | ||
18 | obj-$(CONFIG_EFI_PARTITION) += efi.o | ||
19 | obj-$(CONFIG_KARMA_PARTITION) += karma.o | ||
20 | obj-$(CONFIG_SYSV68_PARTITION) += sysv68.o | ||
diff --git a/fs/partitions/acorn.c b/fs/partitions/acorn.c deleted file mode 100644 index fbeb697374d5..000000000000 --- a/fs/partitions/acorn.c +++ /dev/null | |||
@@ -1,556 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/partitions/acorn.c | ||
3 | * | ||
4 | * Copyright (c) 1996-2000 Russell King. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * Scan ADFS partitions on hard disk drives. Unfortunately, there | ||
11 | * isn't a standard for partitioning drives on Acorn machines, so | ||
12 | * every single manufacturer of SCSI and IDE cards created their own | ||
13 | * method. | ||
14 | */ | ||
15 | #include <linux/buffer_head.h> | ||
16 | #include <linux/adfs_fs.h> | ||
17 | |||
18 | #include "check.h" | ||
19 | #include "acorn.h" | ||
20 | |||
21 | /* | ||
22 | * Partition types. (Oh for reusability) | ||
23 | */ | ||
24 | #define PARTITION_RISCIX_MFM 1 | ||
25 | #define PARTITION_RISCIX_SCSI 2 | ||
26 | #define PARTITION_LINUX 9 | ||
27 | |||
28 | #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \ | ||
29 | defined(CONFIG_ACORN_PARTITION_ADFS) | ||
30 | static struct adfs_discrecord * | ||
31 | adfs_partition(struct parsed_partitions *state, char *name, char *data, | ||
32 | unsigned long first_sector, int slot) | ||
33 | { | ||
34 | struct adfs_discrecord *dr; | ||
35 | unsigned int nr_sects; | ||
36 | |||
37 | if (adfs_checkbblk(data)) | ||
38 | return NULL; | ||
39 | |||
40 | dr = (struct adfs_discrecord *)(data + 0x1c0); | ||
41 | |||
42 | if (dr->disc_size == 0 && dr->disc_size_high == 0) | ||
43 | return NULL; | ||
44 | |||
45 | nr_sects = (le32_to_cpu(dr->disc_size_high) << 23) | | ||
46 | (le32_to_cpu(dr->disc_size) >> 9); | ||
47 | |||
48 | if (name) { | ||
49 | strlcat(state->pp_buf, " [", PAGE_SIZE); | ||
50 | strlcat(state->pp_buf, name, PAGE_SIZE); | ||
51 | strlcat(state->pp_buf, "]", PAGE_SIZE); | ||
52 | } | ||
53 | put_partition(state, slot, first_sector, nr_sects); | ||
54 | return dr; | ||
55 | } | ||
56 | #endif | ||
57 | |||
58 | #ifdef CONFIG_ACORN_PARTITION_RISCIX | ||
59 | |||
60 | struct riscix_part { | ||
61 | __le32 start; | ||
62 | __le32 length; | ||
63 | __le32 one; | ||
64 | char name[16]; | ||
65 | }; | ||
66 | |||
67 | struct riscix_record { | ||
68 | __le32 magic; | ||
69 | #define RISCIX_MAGIC cpu_to_le32(0x4a657320) | ||
70 | __le32 date; | ||
71 | struct riscix_part part[8]; | ||
72 | }; | ||
73 | |||
74 | #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \ | ||
75 | defined(CONFIG_ACORN_PARTITION_ADFS) | ||
76 | static int riscix_partition(struct parsed_partitions *state, | ||
77 | unsigned long first_sect, int slot, | ||
78 | unsigned long nr_sects) | ||
79 | { | ||
80 | Sector sect; | ||
81 | struct riscix_record *rr; | ||
82 | |||
83 | rr = read_part_sector(state, first_sect, §); | ||
84 | if (!rr) | ||
85 | return -1; | ||
86 | |||
87 | strlcat(state->pp_buf, " [RISCiX]", PAGE_SIZE); | ||
88 | |||
89 | |||
90 | if (rr->magic == RISCIX_MAGIC) { | ||
91 | unsigned long size = nr_sects > 2 ? 2 : nr_sects; | ||
92 | int part; | ||
93 | |||
94 | strlcat(state->pp_buf, " <", PAGE_SIZE); | ||
95 | |||
96 | put_partition(state, slot++, first_sect, size); | ||
97 | for (part = 0; part < 8; part++) { | ||
98 | if (rr->part[part].one && | ||
99 | memcmp(rr->part[part].name, "All\0", 4)) { | ||
100 | put_partition(state, slot++, | ||
101 | le32_to_cpu(rr->part[part].start), | ||
102 | le32_to_cpu(rr->part[part].length)); | ||
103 | strlcat(state->pp_buf, "(", PAGE_SIZE); | ||
104 | strlcat(state->pp_buf, rr->part[part].name, PAGE_SIZE); | ||
105 | strlcat(state->pp_buf, ")", PAGE_SIZE); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | strlcat(state->pp_buf, " >\n", PAGE_SIZE); | ||
110 | } else { | ||
111 | put_partition(state, slot++, first_sect, nr_sects); | ||
112 | } | ||
113 | |||
114 | put_dev_sector(sect); | ||
115 | return slot; | ||
116 | } | ||
117 | #endif | ||
118 | #endif | ||
119 | |||
120 | #define LINUX_NATIVE_MAGIC 0xdeafa1de | ||
121 | #define LINUX_SWAP_MAGIC 0xdeafab1e | ||
122 | |||
123 | struct linux_part { | ||
124 | __le32 magic; | ||
125 | __le32 start_sect; | ||
126 | __le32 nr_sects; | ||
127 | }; | ||
128 | |||
129 | #if defined(CONFIG_ACORN_PARTITION_CUMANA) || \ | ||
130 | defined(CONFIG_ACORN_PARTITION_ADFS) | ||
131 | static int linux_partition(struct parsed_partitions *state, | ||
132 | unsigned long first_sect, int slot, | ||
133 | unsigned long nr_sects) | ||
134 | { | ||
135 | Sector sect; | ||
136 | struct linux_part *linuxp; | ||
137 | unsigned long size = nr_sects > 2 ? 2 : nr_sects; | ||
138 | |||
139 | strlcat(state->pp_buf, " [Linux]", PAGE_SIZE); | ||
140 | |||
141 | put_partition(state, slot++, first_sect, size); | ||
142 | |||
143 | linuxp = read_part_sector(state, first_sect, §); | ||
144 | if (!linuxp) | ||
145 | return -1; | ||
146 | |||
147 | strlcat(state->pp_buf, " <", PAGE_SIZE); | ||
148 | while (linuxp->magic == cpu_to_le32(LINUX_NATIVE_MAGIC) || | ||
149 | linuxp->magic == cpu_to_le32(LINUX_SWAP_MAGIC)) { | ||
150 | if (slot == state->limit) | ||
151 | break; | ||
152 | put_partition(state, slot++, first_sect + | ||
153 | le32_to_cpu(linuxp->start_sect), | ||
154 | le32_to_cpu(linuxp->nr_sects)); | ||
155 | linuxp ++; | ||
156 | } | ||
157 | strlcat(state->pp_buf, " >", PAGE_SIZE); | ||
158 | |||
159 | put_dev_sector(sect); | ||
160 | return slot; | ||
161 | } | ||
162 | #endif | ||
163 | |||
164 | #ifdef CONFIG_ACORN_PARTITION_CUMANA | ||
165 | int adfspart_check_CUMANA(struct parsed_partitions *state) | ||
166 | { | ||
167 | unsigned long first_sector = 0; | ||
168 | unsigned int start_blk = 0; | ||
169 | Sector sect; | ||
170 | unsigned char *data; | ||
171 | char *name = "CUMANA/ADFS"; | ||
172 | int first = 1; | ||
173 | int slot = 1; | ||
174 | |||
175 | /* | ||
176 | * Try Cumana style partitions - sector 6 contains ADFS boot block | ||
177 | * with pointer to next 'drive'. | ||
178 | * | ||
179 | * There are unknowns in this code - is the 'cylinder number' of the | ||
180 | * next partition relative to the start of this one - I'm assuming | ||
181 | * it is. | ||
182 | * | ||
183 | * Also, which ID did Cumana use? | ||
184 | * | ||
185 | * This is totally unfinished, and will require more work to get it | ||
186 | * going. Hence it is totally untested. | ||
187 | */ | ||
188 | do { | ||
189 | struct adfs_discrecord *dr; | ||
190 | unsigned int nr_sects; | ||
191 | |||
192 | data = read_part_sector(state, start_blk * 2 + 6, §); | ||
193 | if (!data) | ||
194 | return -1; | ||
195 | |||
196 | if (slot == state->limit) | ||
197 | break; | ||
198 | |||
199 | dr = adfs_partition(state, name, data, first_sector, slot++); | ||
200 | if (!dr) | ||
201 | break; | ||
202 | |||
203 | name = NULL; | ||
204 | |||
205 | nr_sects = (data[0x1fd] + (data[0x1fe] << 8)) * | ||
206 | (dr->heads + (dr->lowsector & 0x40 ? 1 : 0)) * | ||
207 | dr->secspertrack; | ||
208 | |||
209 | if (!nr_sects) | ||
210 | break; | ||
211 | |||
212 | first = 0; | ||
213 | first_sector += nr_sects; | ||
214 | start_blk += nr_sects >> (BLOCK_SIZE_BITS - 9); | ||
215 | nr_sects = 0; /* hmm - should be partition size */ | ||
216 | |||
217 | switch (data[0x1fc] & 15) { | ||
218 | case 0: /* No partition / ADFS? */ | ||
219 | break; | ||
220 | |||
221 | #ifdef CONFIG_ACORN_PARTITION_RISCIX | ||
222 | case PARTITION_RISCIX_SCSI: | ||
223 | /* RISCiX - we don't know how to find the next one. */ | ||
224 | slot = riscix_partition(state, first_sector, slot, | ||
225 | nr_sects); | ||
226 | break; | ||
227 | #endif | ||
228 | |||
229 | case PARTITION_LINUX: | ||
230 | slot = linux_partition(state, first_sector, slot, | ||
231 | nr_sects); | ||
232 | break; | ||
233 | } | ||
234 | put_dev_sector(sect); | ||
235 | if (slot == -1) | ||
236 | return -1; | ||
237 | } while (1); | ||
238 | put_dev_sector(sect); | ||
239 | return first ? 0 : 1; | ||
240 | } | ||
241 | #endif | ||
242 | |||
243 | #ifdef CONFIG_ACORN_PARTITION_ADFS | ||
244 | /* | ||
245 | * Purpose: allocate ADFS partitions. | ||
246 | * | ||
247 | * Params : hd - pointer to gendisk structure to store partition info. | ||
248 | * dev - device number to access. | ||
249 | * | ||
250 | * Returns: -1 on error, 0 for no ADFS boot sector, 1 for ok. | ||
251 | * | ||
252 | * Alloc : hda = whole drive | ||
253 | * hda1 = ADFS partition on first drive. | ||
254 | * hda2 = non-ADFS partition. | ||
255 | */ | ||
256 | int adfspart_check_ADFS(struct parsed_partitions *state) | ||
257 | { | ||
258 | unsigned long start_sect, nr_sects, sectscyl, heads; | ||
259 | Sector sect; | ||
260 | unsigned char *data; | ||
261 | struct adfs_discrecord *dr; | ||
262 | unsigned char id; | ||
263 | int slot = 1; | ||
264 | |||
265 | data = read_part_sector(state, 6, §); | ||
266 | if (!data) | ||
267 | return -1; | ||
268 | |||
269 | dr = adfs_partition(state, "ADFS", data, 0, slot++); | ||
270 | if (!dr) { | ||
271 | put_dev_sector(sect); | ||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | heads = dr->heads + ((dr->lowsector >> 6) & 1); | ||
276 | sectscyl = dr->secspertrack * heads; | ||
277 | start_sect = ((data[0x1fe] << 8) + data[0x1fd]) * sectscyl; | ||
278 | id = data[0x1fc] & 15; | ||
279 | put_dev_sector(sect); | ||
280 | |||
281 | /* | ||
282 | * Work out start of non-adfs partition. | ||
283 | */ | ||
284 | nr_sects = (state->bdev->bd_inode->i_size >> 9) - start_sect; | ||
285 | |||
286 | if (start_sect) { | ||
287 | switch (id) { | ||
288 | #ifdef CONFIG_ACORN_PARTITION_RISCIX | ||
289 | case PARTITION_RISCIX_SCSI: | ||
290 | case PARTITION_RISCIX_MFM: | ||
291 | slot = riscix_partition(state, start_sect, slot, | ||
292 | nr_sects); | ||
293 | break; | ||
294 | #endif | ||
295 | |||
296 | case PARTITION_LINUX: | ||
297 | slot = linux_partition(state, start_sect, slot, | ||
298 | nr_sects); | ||
299 | break; | ||
300 | } | ||
301 | } | ||
302 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
303 | return 1; | ||
304 | } | ||
305 | #endif | ||
306 | |||
307 | #ifdef CONFIG_ACORN_PARTITION_ICS | ||
308 | |||
309 | struct ics_part { | ||
310 | __le32 start; | ||
311 | __le32 size; | ||
312 | }; | ||
313 | |||
314 | static int adfspart_check_ICSLinux(struct parsed_partitions *state, | ||
315 | unsigned long block) | ||
316 | { | ||
317 | Sector sect; | ||
318 | unsigned char *data = read_part_sector(state, block, §); | ||
319 | int result = 0; | ||
320 | |||
321 | if (data) { | ||
322 | if (memcmp(data, "LinuxPart", 9) == 0) | ||
323 | result = 1; | ||
324 | put_dev_sector(sect); | ||
325 | } | ||
326 | |||
327 | return result; | ||
328 | } | ||
329 | |||
330 | /* | ||
331 | * Check for a valid ICS partition using the checksum. | ||
332 | */ | ||
333 | static inline int valid_ics_sector(const unsigned char *data) | ||
334 | { | ||
335 | unsigned long sum; | ||
336 | int i; | ||
337 | |||
338 | for (i = 0, sum = 0x50617274; i < 508; i++) | ||
339 | sum += data[i]; | ||
340 | |||
341 | sum -= le32_to_cpu(*(__le32 *)(&data[508])); | ||
342 | |||
343 | return sum == 0; | ||
344 | } | ||
345 | |||
346 | /* | ||
347 | * Purpose: allocate ICS partitions. | ||
348 | * Params : hd - pointer to gendisk structure to store partition info. | ||
349 | * dev - device number to access. | ||
350 | * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok. | ||
351 | * Alloc : hda = whole drive | ||
352 | * hda1 = ADFS partition 0 on first drive. | ||
353 | * hda2 = ADFS partition 1 on first drive. | ||
354 | * ..etc.. | ||
355 | */ | ||
356 | int adfspart_check_ICS(struct parsed_partitions *state) | ||
357 | { | ||
358 | const unsigned char *data; | ||
359 | const struct ics_part *p; | ||
360 | int slot; | ||
361 | Sector sect; | ||
362 | |||
363 | /* | ||
364 | * Try ICS style partitions - sector 0 contains partition info. | ||
365 | */ | ||
366 | data = read_part_sector(state, 0, §); | ||
367 | if (!data) | ||
368 | return -1; | ||
369 | |||
370 | if (!valid_ics_sector(data)) { | ||
371 | put_dev_sector(sect); | ||
372 | return 0; | ||
373 | } | ||
374 | |||
375 | strlcat(state->pp_buf, " [ICS]", PAGE_SIZE); | ||
376 | |||
377 | for (slot = 1, p = (const struct ics_part *)data; p->size; p++) { | ||
378 | u32 start = le32_to_cpu(p->start); | ||
379 | s32 size = le32_to_cpu(p->size); /* yes, it's signed. */ | ||
380 | |||
381 | if (slot == state->limit) | ||
382 | break; | ||
383 | |||
384 | /* | ||
385 | * Negative sizes tell the RISC OS ICS driver to ignore | ||
386 | * this partition - in effect it says that this does not | ||
387 | * contain an ADFS filesystem. | ||
388 | */ | ||
389 | if (size < 0) { | ||
390 | size = -size; | ||
391 | |||
392 | /* | ||
393 | * Our own extension - We use the first sector | ||
394 | * of the partition to identify what type this | ||
395 | * partition is. We must not make this visible | ||
396 | * to the filesystem. | ||
397 | */ | ||
398 | if (size > 1 && adfspart_check_ICSLinux(state, start)) { | ||
399 | start += 1; | ||
400 | size -= 1; | ||
401 | } | ||
402 | } | ||
403 | |||
404 | if (size) | ||
405 | put_partition(state, slot++, start, size); | ||
406 | } | ||
407 | |||
408 | put_dev_sector(sect); | ||
409 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
410 | return 1; | ||
411 | } | ||
412 | #endif | ||
413 | |||
414 | #ifdef CONFIG_ACORN_PARTITION_POWERTEC | ||
415 | struct ptec_part { | ||
416 | __le32 unused1; | ||
417 | __le32 unused2; | ||
418 | __le32 start; | ||
419 | __le32 size; | ||
420 | __le32 unused5; | ||
421 | char type[8]; | ||
422 | }; | ||
423 | |||
424 | static inline int valid_ptec_sector(const unsigned char *data) | ||
425 | { | ||
426 | unsigned char checksum = 0x2a; | ||
427 | int i; | ||
428 | |||
429 | /* | ||
430 | * If it looks like a PC/BIOS partition, then it | ||
431 | * probably isn't PowerTec. | ||
432 | */ | ||
433 | if (data[510] == 0x55 && data[511] == 0xaa) | ||
434 | return 0; | ||
435 | |||
436 | for (i = 0; i < 511; i++) | ||
437 | checksum += data[i]; | ||
438 | |||
439 | return checksum == data[511]; | ||
440 | } | ||
441 | |||
442 | /* | ||
443 | * Purpose: allocate ICS partitions. | ||
444 | * Params : hd - pointer to gendisk structure to store partition info. | ||
445 | * dev - device number to access. | ||
446 | * Returns: -1 on error, 0 for no ICS table, 1 for partitions ok. | ||
447 | * Alloc : hda = whole drive | ||
448 | * hda1 = ADFS partition 0 on first drive. | ||
449 | * hda2 = ADFS partition 1 on first drive. | ||
450 | * ..etc.. | ||
451 | */ | ||
452 | int adfspart_check_POWERTEC(struct parsed_partitions *state) | ||
453 | { | ||
454 | Sector sect; | ||
455 | const unsigned char *data; | ||
456 | const struct ptec_part *p; | ||
457 | int slot = 1; | ||
458 | int i; | ||
459 | |||
460 | data = read_part_sector(state, 0, §); | ||
461 | if (!data) | ||
462 | return -1; | ||
463 | |||
464 | if (!valid_ptec_sector(data)) { | ||
465 | put_dev_sector(sect); | ||
466 | return 0; | ||
467 | } | ||
468 | |||
469 | strlcat(state->pp_buf, " [POWERTEC]", PAGE_SIZE); | ||
470 | |||
471 | for (i = 0, p = (const struct ptec_part *)data; i < 12; i++, p++) { | ||
472 | u32 start = le32_to_cpu(p->start); | ||
473 | u32 size = le32_to_cpu(p->size); | ||
474 | |||
475 | if (size) | ||
476 | put_partition(state, slot++, start, size); | ||
477 | } | ||
478 | |||
479 | put_dev_sector(sect); | ||
480 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
481 | return 1; | ||
482 | } | ||
483 | #endif | ||
484 | |||
485 | #ifdef CONFIG_ACORN_PARTITION_EESOX | ||
486 | struct eesox_part { | ||
487 | char magic[6]; | ||
488 | char name[10]; | ||
489 | __le32 start; | ||
490 | __le32 unused6; | ||
491 | __le32 unused7; | ||
492 | __le32 unused8; | ||
493 | }; | ||
494 | |||
495 | /* | ||
496 | * Guess who created this format? | ||
497 | */ | ||
498 | static const char eesox_name[] = { | ||
499 | 'N', 'e', 'i', 'l', ' ', | ||
500 | 'C', 'r', 'i', 't', 'c', 'h', 'e', 'l', 'l', ' ', ' ' | ||
501 | }; | ||
502 | |||
503 | /* | ||
504 | * EESOX SCSI partition format. | ||
505 | * | ||
506 | * This is a goddamned awful partition format. We don't seem to store | ||
507 | * the size of the partition in this table, only the start addresses. | ||
508 | * | ||
509 | * There are two possibilities where the size comes from: | ||
510 | * 1. The individual ADFS boot block entries that are placed on the disk. | ||
511 | * 2. The start address of the next entry. | ||
512 | */ | ||
513 | int adfspart_check_EESOX(struct parsed_partitions *state) | ||
514 | { | ||
515 | Sector sect; | ||
516 | const unsigned char *data; | ||
517 | unsigned char buffer[256]; | ||
518 | struct eesox_part *p; | ||
519 | sector_t start = 0; | ||
520 | int i, slot = 1; | ||
521 | |||
522 | data = read_part_sector(state, 7, §); | ||
523 | if (!data) | ||
524 | return -1; | ||
525 | |||
526 | /* | ||
527 | * "Decrypt" the partition table. God knows why... | ||
528 | */ | ||
529 | for (i = 0; i < 256; i++) | ||
530 | buffer[i] = data[i] ^ eesox_name[i & 15]; | ||
531 | |||
532 | put_dev_sector(sect); | ||
533 | |||
534 | for (i = 0, p = (struct eesox_part *)buffer; i < 8; i++, p++) { | ||
535 | sector_t next; | ||
536 | |||
537 | if (memcmp(p->magic, "Eesox", 6)) | ||
538 | break; | ||
539 | |||
540 | next = le32_to_cpu(p->start); | ||
541 | if (i) | ||
542 | put_partition(state, slot++, start, next - start); | ||
543 | start = next; | ||
544 | } | ||
545 | |||
546 | if (i != 0) { | ||
547 | sector_t size; | ||
548 | |||
549 | size = get_capacity(state->bdev->bd_disk); | ||
550 | put_partition(state, slot++, start, size - start); | ||
551 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
552 | } | ||
553 | |||
554 | return i ? 1 : 0; | ||
555 | } | ||
556 | #endif | ||
diff --git a/fs/partitions/acorn.h b/fs/partitions/acorn.h deleted file mode 100644 index ede828529692..000000000000 --- a/fs/partitions/acorn.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/partitions/acorn.h | ||
3 | * | ||
4 | * Copyright (C) 1996-2001 Russell King. | ||
5 | * | ||
6 | * I _hate_ this partitioning mess - why can't we have one defined | ||
7 | * format, and everyone stick to it? | ||
8 | */ | ||
9 | |||
10 | int adfspart_check_CUMANA(struct parsed_partitions *state); | ||
11 | int adfspart_check_ADFS(struct parsed_partitions *state); | ||
12 | int adfspart_check_ICS(struct parsed_partitions *state); | ||
13 | int adfspart_check_POWERTEC(struct parsed_partitions *state); | ||
14 | int adfspart_check_EESOX(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/amiga.c b/fs/partitions/amiga.c deleted file mode 100644 index 70cbf44a1560..000000000000 --- a/fs/partitions/amiga.c +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/amiga.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * | ||
6 | * Copyright (C) 1991-1998 Linus Torvalds | ||
7 | * Re-organised Feb 1998 Russell King | ||
8 | */ | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | #include <linux/affs_hardblocks.h> | ||
12 | |||
13 | #include "check.h" | ||
14 | #include "amiga.h" | ||
15 | |||
16 | static __inline__ u32 | ||
17 | checksum_block(__be32 *m, int size) | ||
18 | { | ||
19 | u32 sum = 0; | ||
20 | |||
21 | while (size--) | ||
22 | sum += be32_to_cpu(*m++); | ||
23 | return sum; | ||
24 | } | ||
25 | |||
26 | int amiga_partition(struct parsed_partitions *state) | ||
27 | { | ||
28 | Sector sect; | ||
29 | unsigned char *data; | ||
30 | struct RigidDiskBlock *rdb; | ||
31 | struct PartitionBlock *pb; | ||
32 | int start_sect, nr_sects, blk, part, res = 0; | ||
33 | int blksize = 1; /* Multiplier for disk block size */ | ||
34 | int slot = 1; | ||
35 | char b[BDEVNAME_SIZE]; | ||
36 | |||
37 | for (blk = 0; ; blk++, put_dev_sector(sect)) { | ||
38 | if (blk == RDB_ALLOCATION_LIMIT) | ||
39 | goto rdb_done; | ||
40 | data = read_part_sector(state, blk, §); | ||
41 | if (!data) { | ||
42 | if (warn_no_part) | ||
43 | printk("Dev %s: unable to read RDB block %d\n", | ||
44 | bdevname(state->bdev, b), blk); | ||
45 | res = -1; | ||
46 | goto rdb_done; | ||
47 | } | ||
48 | if (*(__be32 *)data != cpu_to_be32(IDNAME_RIGIDDISK)) | ||
49 | continue; | ||
50 | |||
51 | rdb = (struct RigidDiskBlock *)data; | ||
52 | if (checksum_block((__be32 *)data, be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F) == 0) | ||
53 | break; | ||
54 | /* Try again with 0xdc..0xdf zeroed, Windows might have | ||
55 | * trashed it. | ||
56 | */ | ||
57 | *(__be32 *)(data+0xdc) = 0; | ||
58 | if (checksum_block((__be32 *)data, | ||
59 | be32_to_cpu(rdb->rdb_SummedLongs) & 0x7F)==0) { | ||
60 | printk("Warning: Trashed word at 0xd0 in block %d " | ||
61 | "ignored in checksum calculation\n",blk); | ||
62 | break; | ||
63 | } | ||
64 | |||
65 | printk("Dev %s: RDB in block %d has bad checksum\n", | ||
66 | bdevname(state->bdev, b), blk); | ||
67 | } | ||
68 | |||
69 | /* blksize is blocks per 512 byte standard block */ | ||
70 | blksize = be32_to_cpu( rdb->rdb_BlockBytes ) / 512; | ||
71 | |||
72 | { | ||
73 | char tmp[7 + 10 + 1 + 1]; | ||
74 | |||
75 | /* Be more informative */ | ||
76 | snprintf(tmp, sizeof(tmp), " RDSK (%d)", blksize * 512); | ||
77 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
78 | } | ||
79 | blk = be32_to_cpu(rdb->rdb_PartitionList); | ||
80 | put_dev_sector(sect); | ||
81 | for (part = 1; blk>0 && part<=16; part++, put_dev_sector(sect)) { | ||
82 | blk *= blksize; /* Read in terms partition table understands */ | ||
83 | data = read_part_sector(state, blk, §); | ||
84 | if (!data) { | ||
85 | if (warn_no_part) | ||
86 | printk("Dev %s: unable to read partition block %d\n", | ||
87 | bdevname(state->bdev, b), blk); | ||
88 | res = -1; | ||
89 | goto rdb_done; | ||
90 | } | ||
91 | pb = (struct PartitionBlock *)data; | ||
92 | blk = be32_to_cpu(pb->pb_Next); | ||
93 | if (pb->pb_ID != cpu_to_be32(IDNAME_PARTITION)) | ||
94 | continue; | ||
95 | if (checksum_block((__be32 *)pb, be32_to_cpu(pb->pb_SummedLongs) & 0x7F) != 0 ) | ||
96 | continue; | ||
97 | |||
98 | /* Tell Kernel about it */ | ||
99 | |||
100 | nr_sects = (be32_to_cpu(pb->pb_Environment[10]) + 1 - | ||
101 | be32_to_cpu(pb->pb_Environment[9])) * | ||
102 | be32_to_cpu(pb->pb_Environment[3]) * | ||
103 | be32_to_cpu(pb->pb_Environment[5]) * | ||
104 | blksize; | ||
105 | if (!nr_sects) | ||
106 | continue; | ||
107 | start_sect = be32_to_cpu(pb->pb_Environment[9]) * | ||
108 | be32_to_cpu(pb->pb_Environment[3]) * | ||
109 | be32_to_cpu(pb->pb_Environment[5]) * | ||
110 | blksize; | ||
111 | put_partition(state,slot++,start_sect,nr_sects); | ||
112 | { | ||
113 | /* Be even more informative to aid mounting */ | ||
114 | char dostype[4]; | ||
115 | char tmp[42]; | ||
116 | |||
117 | __be32 *dt = (__be32 *)dostype; | ||
118 | *dt = pb->pb_Environment[16]; | ||
119 | if (dostype[3] < ' ') | ||
120 | snprintf(tmp, sizeof(tmp), " (%c%c%c^%c)", | ||
121 | dostype[0], dostype[1], | ||
122 | dostype[2], dostype[3] + '@' ); | ||
123 | else | ||
124 | snprintf(tmp, sizeof(tmp), " (%c%c%c%c)", | ||
125 | dostype[0], dostype[1], | ||
126 | dostype[2], dostype[3]); | ||
127 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
128 | snprintf(tmp, sizeof(tmp), "(res %d spb %d)", | ||
129 | be32_to_cpu(pb->pb_Environment[6]), | ||
130 | be32_to_cpu(pb->pb_Environment[4])); | ||
131 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
132 | } | ||
133 | res = 1; | ||
134 | } | ||
135 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
136 | |||
137 | rdb_done: | ||
138 | return res; | ||
139 | } | ||
diff --git a/fs/partitions/amiga.h b/fs/partitions/amiga.h deleted file mode 100644 index d094585cadaa..000000000000 --- a/fs/partitions/amiga.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/amiga.h | ||
3 | */ | ||
4 | |||
5 | int amiga_partition(struct parsed_partitions *state); | ||
6 | |||
diff --git a/fs/partitions/atari.c b/fs/partitions/atari.c deleted file mode 100644 index 9875b05e80a2..000000000000 --- a/fs/partitions/atari.c +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/atari.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * | ||
6 | * Copyright (C) 1991-1998 Linus Torvalds | ||
7 | * Re-organised Feb 1998 Russell King | ||
8 | */ | ||
9 | |||
10 | #include <linux/ctype.h> | ||
11 | #include "check.h" | ||
12 | #include "atari.h" | ||
13 | |||
14 | /* ++guenther: this should be settable by the user ("make config")?. | ||
15 | */ | ||
16 | #define ICD_PARTS | ||
17 | |||
18 | /* check if a partition entry looks valid -- Atari format is assumed if at | ||
19 | least one of the primary entries is ok this way */ | ||
20 | #define VALID_PARTITION(pi,hdsiz) \ | ||
21 | (((pi)->flg & 1) && \ | ||
22 | isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \ | ||
23 | be32_to_cpu((pi)->st) <= (hdsiz) && \ | ||
24 | be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz)) | ||
25 | |||
26 | static inline int OK_id(char *s) | ||
27 | { | ||
28 | return memcmp (s, "GEM", 3) == 0 || memcmp (s, "BGM", 3) == 0 || | ||
29 | memcmp (s, "LNX", 3) == 0 || memcmp (s, "SWP", 3) == 0 || | ||
30 | memcmp (s, "RAW", 3) == 0 ; | ||
31 | } | ||
32 | |||
33 | int atari_partition(struct parsed_partitions *state) | ||
34 | { | ||
35 | Sector sect; | ||
36 | struct rootsector *rs; | ||
37 | struct partition_info *pi; | ||
38 | u32 extensect; | ||
39 | u32 hd_size; | ||
40 | int slot; | ||
41 | #ifdef ICD_PARTS | ||
42 | int part_fmt = 0; /* 0:unknown, 1:AHDI, 2:ICD/Supra */ | ||
43 | #endif | ||
44 | |||
45 | rs = read_part_sector(state, 0, §); | ||
46 | if (!rs) | ||
47 | return -1; | ||
48 | |||
49 | /* Verify this is an Atari rootsector: */ | ||
50 | hd_size = state->bdev->bd_inode->i_size >> 9; | ||
51 | if (!VALID_PARTITION(&rs->part[0], hd_size) && | ||
52 | !VALID_PARTITION(&rs->part[1], hd_size) && | ||
53 | !VALID_PARTITION(&rs->part[2], hd_size) && | ||
54 | !VALID_PARTITION(&rs->part[3], hd_size)) { | ||
55 | /* | ||
56 | * if there's no valid primary partition, assume that no Atari | ||
57 | * format partition table (there's no reliable magic or the like | ||
58 | * :-() | ||
59 | */ | ||
60 | put_dev_sector(sect); | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | pi = &rs->part[0]; | ||
65 | strlcat(state->pp_buf, " AHDI", PAGE_SIZE); | ||
66 | for (slot = 1; pi < &rs->part[4] && slot < state->limit; slot++, pi++) { | ||
67 | struct rootsector *xrs; | ||
68 | Sector sect2; | ||
69 | ulong partsect; | ||
70 | |||
71 | if ( !(pi->flg & 1) ) | ||
72 | continue; | ||
73 | /* active partition */ | ||
74 | if (memcmp (pi->id, "XGM", 3) != 0) { | ||
75 | /* we don't care about other id's */ | ||
76 | put_partition (state, slot, be32_to_cpu(pi->st), | ||
77 | be32_to_cpu(pi->siz)); | ||
78 | continue; | ||
79 | } | ||
80 | /* extension partition */ | ||
81 | #ifdef ICD_PARTS | ||
82 | part_fmt = 1; | ||
83 | #endif | ||
84 | strlcat(state->pp_buf, " XGM<", PAGE_SIZE); | ||
85 | partsect = extensect = be32_to_cpu(pi->st); | ||
86 | while (1) { | ||
87 | xrs = read_part_sector(state, partsect, §2); | ||
88 | if (!xrs) { | ||
89 | printk (" block %ld read failed\n", partsect); | ||
90 | put_dev_sector(sect); | ||
91 | return -1; | ||
92 | } | ||
93 | |||
94 | /* ++roman: sanity check: bit 0 of flg field must be set */ | ||
95 | if (!(xrs->part[0].flg & 1)) { | ||
96 | printk( "\nFirst sub-partition in extended partition is not valid!\n" ); | ||
97 | put_dev_sector(sect2); | ||
98 | break; | ||
99 | } | ||
100 | |||
101 | put_partition(state, slot, | ||
102 | partsect + be32_to_cpu(xrs->part[0].st), | ||
103 | be32_to_cpu(xrs->part[0].siz)); | ||
104 | |||
105 | if (!(xrs->part[1].flg & 1)) { | ||
106 | /* end of linked partition list */ | ||
107 | put_dev_sector(sect2); | ||
108 | break; | ||
109 | } | ||
110 | if (memcmp( xrs->part[1].id, "XGM", 3 ) != 0) { | ||
111 | printk("\nID of extended partition is not XGM!\n"); | ||
112 | put_dev_sector(sect2); | ||
113 | break; | ||
114 | } | ||
115 | |||
116 | partsect = be32_to_cpu(xrs->part[1].st) + extensect; | ||
117 | put_dev_sector(sect2); | ||
118 | if (++slot == state->limit) { | ||
119 | printk( "\nMaximum number of partitions reached!\n" ); | ||
120 | break; | ||
121 | } | ||
122 | } | ||
123 | strlcat(state->pp_buf, " >", PAGE_SIZE); | ||
124 | } | ||
125 | #ifdef ICD_PARTS | ||
126 | if ( part_fmt!=1 ) { /* no extended partitions -> test ICD-format */ | ||
127 | pi = &rs->icdpart[0]; | ||
128 | /* sanity check: no ICD format if first partition invalid */ | ||
129 | if (OK_id(pi->id)) { | ||
130 | strlcat(state->pp_buf, " ICD<", PAGE_SIZE); | ||
131 | for (; pi < &rs->icdpart[8] && slot < state->limit; slot++, pi++) { | ||
132 | /* accept only GEM,BGM,RAW,LNX,SWP partitions */ | ||
133 | if (!((pi->flg & 1) && OK_id(pi->id))) | ||
134 | continue; | ||
135 | part_fmt = 2; | ||
136 | put_partition (state, slot, | ||
137 | be32_to_cpu(pi->st), | ||
138 | be32_to_cpu(pi->siz)); | ||
139 | } | ||
140 | strlcat(state->pp_buf, " >", PAGE_SIZE); | ||
141 | } | ||
142 | } | ||
143 | #endif | ||
144 | put_dev_sector(sect); | ||
145 | |||
146 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
147 | |||
148 | return 1; | ||
149 | } | ||
diff --git a/fs/partitions/atari.h b/fs/partitions/atari.h deleted file mode 100644 index fe2d32a89f36..000000000000 --- a/fs/partitions/atari.h +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/atari.h | ||
3 | * Moved by Russell King from: | ||
4 | * | ||
5 | * linux/include/linux/atari_rootsec.h | ||
6 | * definitions for Atari Rootsector layout | ||
7 | * by Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de) | ||
8 | * | ||
9 | * modified for ICD/Supra partitioning scheme restricted to at most 12 | ||
10 | * partitions | ||
11 | * by Guenther Kelleter (guenther@pool.informatik.rwth-aachen.de) | ||
12 | */ | ||
13 | |||
14 | struct partition_info | ||
15 | { | ||
16 | u8 flg; /* bit 0: active; bit 7: bootable */ | ||
17 | char id[3]; /* "GEM", "BGM", "XGM", or other */ | ||
18 | __be32 st; /* start of partition */ | ||
19 | __be32 siz; /* length of partition */ | ||
20 | }; | ||
21 | |||
22 | struct rootsector | ||
23 | { | ||
24 | char unused[0x156]; /* room for boot code */ | ||
25 | struct partition_info icdpart[8]; /* info for ICD-partitions 5..12 */ | ||
26 | char unused2[0xc]; | ||
27 | u32 hd_siz; /* size of disk in blocks */ | ||
28 | struct partition_info part[4]; | ||
29 | u32 bsl_st; /* start of bad sector list */ | ||
30 | u32 bsl_cnt; /* length of bad sector list */ | ||
31 | u16 checksum; /* checksum for bootable disks */ | ||
32 | } __attribute__((__packed__)); | ||
33 | |||
34 | int atari_partition(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/check.c b/fs/partitions/check.c deleted file mode 100644 index e3c63d1c5e13..000000000000 --- a/fs/partitions/check.c +++ /dev/null | |||
@@ -1,687 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/check.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * Copyright (C) 1991-1998 Linus Torvalds | ||
6 | * Re-organised Feb 1998 Russell King | ||
7 | * | ||
8 | * We now have independent partition support from the | ||
9 | * block drivers, which allows all the partition code to | ||
10 | * be grouped in one location, and it to be mostly self | ||
11 | * contained. | ||
12 | * | ||
13 | * Added needed MAJORS for new pairs, {hdi,hdj}, {hdk,hdl} | ||
14 | */ | ||
15 | |||
16 | #include <linux/init.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/kmod.h> | ||
21 | #include <linux/ctype.h> | ||
22 | #include <linux/genhd.h> | ||
23 | #include <linux/blktrace_api.h> | ||
24 | |||
25 | #include "check.h" | ||
26 | |||
27 | #include "acorn.h" | ||
28 | #include "amiga.h" | ||
29 | #include "atari.h" | ||
30 | #include "ldm.h" | ||
31 | #include "mac.h" | ||
32 | #include "msdos.h" | ||
33 | #include "osf.h" | ||
34 | #include "sgi.h" | ||
35 | #include "sun.h" | ||
36 | #include "ibm.h" | ||
37 | #include "ultrix.h" | ||
38 | #include "efi.h" | ||
39 | #include "karma.h" | ||
40 | #include "sysv68.h" | ||
41 | |||
42 | #ifdef CONFIG_BLK_DEV_MD | ||
43 | extern void md_autodetect_dev(dev_t dev); | ||
44 | #endif | ||
45 | |||
46 | int warn_no_part = 1; /*This is ugly: should make genhd removable media aware*/ | ||
47 | |||
48 | static int (*check_part[])(struct parsed_partitions *) = { | ||
49 | /* | ||
50 | * Probe partition formats with tables at disk address 0 | ||
51 | * that also have an ADFS boot block at 0xdc0. | ||
52 | */ | ||
53 | #ifdef CONFIG_ACORN_PARTITION_ICS | ||
54 | adfspart_check_ICS, | ||
55 | #endif | ||
56 | #ifdef CONFIG_ACORN_PARTITION_POWERTEC | ||
57 | adfspart_check_POWERTEC, | ||
58 | #endif | ||
59 | #ifdef CONFIG_ACORN_PARTITION_EESOX | ||
60 | adfspart_check_EESOX, | ||
61 | #endif | ||
62 | |||
63 | /* | ||
64 | * Now move on to formats that only have partition info at | ||
65 | * disk address 0xdc0. Since these may also have stale | ||
66 | * PC/BIOS partition tables, they need to come before | ||
67 | * the msdos entry. | ||
68 | */ | ||
69 | #ifdef CONFIG_ACORN_PARTITION_CUMANA | ||
70 | adfspart_check_CUMANA, | ||
71 | #endif | ||
72 | #ifdef CONFIG_ACORN_PARTITION_ADFS | ||
73 | adfspart_check_ADFS, | ||
74 | #endif | ||
75 | |||
76 | #ifdef CONFIG_EFI_PARTITION | ||
77 | efi_partition, /* this must come before msdos */ | ||
78 | #endif | ||
79 | #ifdef CONFIG_SGI_PARTITION | ||
80 | sgi_partition, | ||
81 | #endif | ||
82 | #ifdef CONFIG_LDM_PARTITION | ||
83 | ldm_partition, /* this must come before msdos */ | ||
84 | #endif | ||
85 | #ifdef CONFIG_MSDOS_PARTITION | ||
86 | msdos_partition, | ||
87 | #endif | ||
88 | #ifdef CONFIG_OSF_PARTITION | ||
89 | osf_partition, | ||
90 | #endif | ||
91 | #ifdef CONFIG_SUN_PARTITION | ||
92 | sun_partition, | ||
93 | #endif | ||
94 | #ifdef CONFIG_AMIGA_PARTITION | ||
95 | amiga_partition, | ||
96 | #endif | ||
97 | #ifdef CONFIG_ATARI_PARTITION | ||
98 | atari_partition, | ||
99 | #endif | ||
100 | #ifdef CONFIG_MAC_PARTITION | ||
101 | mac_partition, | ||
102 | #endif | ||
103 | #ifdef CONFIG_ULTRIX_PARTITION | ||
104 | ultrix_partition, | ||
105 | #endif | ||
106 | #ifdef CONFIG_IBM_PARTITION | ||
107 | ibm_partition, | ||
108 | #endif | ||
109 | #ifdef CONFIG_KARMA_PARTITION | ||
110 | karma_partition, | ||
111 | #endif | ||
112 | #ifdef CONFIG_SYSV68_PARTITION | ||
113 | sysv68_partition, | ||
114 | #endif | ||
115 | NULL | ||
116 | }; | ||
117 | |||
118 | /* | ||
119 | * disk_name() is used by partition check code and the genhd driver. | ||
120 | * It formats the devicename of the indicated disk into | ||
121 | * the supplied buffer (of size at least 32), and returns | ||
122 | * a pointer to that same buffer (for convenience). | ||
123 | */ | ||
124 | |||
125 | char *disk_name(struct gendisk *hd, int partno, char *buf) | ||
126 | { | ||
127 | if (!partno) | ||
128 | snprintf(buf, BDEVNAME_SIZE, "%s", hd->disk_name); | ||
129 | else if (isdigit(hd->disk_name[strlen(hd->disk_name)-1])) | ||
130 | snprintf(buf, BDEVNAME_SIZE, "%sp%d", hd->disk_name, partno); | ||
131 | else | ||
132 | snprintf(buf, BDEVNAME_SIZE, "%s%d", hd->disk_name, partno); | ||
133 | |||
134 | return buf; | ||
135 | } | ||
136 | |||
137 | const char *bdevname(struct block_device *bdev, char *buf) | ||
138 | { | ||
139 | return disk_name(bdev->bd_disk, bdev->bd_part->partno, buf); | ||
140 | } | ||
141 | |||
142 | EXPORT_SYMBOL(bdevname); | ||
143 | |||
144 | /* | ||
145 | * There's very little reason to use this, you should really | ||
146 | * have a struct block_device just about everywhere and use | ||
147 | * bdevname() instead. | ||
148 | */ | ||
149 | const char *__bdevname(dev_t dev, char *buffer) | ||
150 | { | ||
151 | scnprintf(buffer, BDEVNAME_SIZE, "unknown-block(%u,%u)", | ||
152 | MAJOR(dev), MINOR(dev)); | ||
153 | return buffer; | ||
154 | } | ||
155 | |||
156 | EXPORT_SYMBOL(__bdevname); | ||
157 | |||
158 | static struct parsed_partitions * | ||
159 | check_partition(struct gendisk *hd, struct block_device *bdev) | ||
160 | { | ||
161 | struct parsed_partitions *state; | ||
162 | int i, res, err; | ||
163 | |||
164 | state = kzalloc(sizeof(struct parsed_partitions), GFP_KERNEL); | ||
165 | if (!state) | ||
166 | return NULL; | ||
167 | state->pp_buf = (char *)__get_free_page(GFP_KERNEL); | ||
168 | if (!state->pp_buf) { | ||
169 | kfree(state); | ||
170 | return NULL; | ||
171 | } | ||
172 | state->pp_buf[0] = '\0'; | ||
173 | |||
174 | state->bdev = bdev; | ||
175 | disk_name(hd, 0, state->name); | ||
176 | snprintf(state->pp_buf, PAGE_SIZE, " %s:", state->name); | ||
177 | if (isdigit(state->name[strlen(state->name)-1])) | ||
178 | sprintf(state->name, "p"); | ||
179 | |||
180 | state->limit = disk_max_parts(hd); | ||
181 | i = res = err = 0; | ||
182 | while (!res && check_part[i]) { | ||
183 | memset(&state->parts, 0, sizeof(state->parts)); | ||
184 | res = check_part[i++](state); | ||
185 | if (res < 0) { | ||
186 | /* We have hit an I/O error which we don't report now. | ||
187 | * But record it, and let the others do their job. | ||
188 | */ | ||
189 | err = res; | ||
190 | res = 0; | ||
191 | } | ||
192 | |||
193 | } | ||
194 | if (res > 0) { | ||
195 | printk(KERN_INFO "%s", state->pp_buf); | ||
196 | |||
197 | free_page((unsigned long)state->pp_buf); | ||
198 | return state; | ||
199 | } | ||
200 | if (state->access_beyond_eod) | ||
201 | err = -ENOSPC; | ||
202 | if (err) | ||
203 | /* The partition is unrecognized. So report I/O errors if there were any */ | ||
204 | res = err; | ||
205 | if (!res) | ||
206 | strlcat(state->pp_buf, " unknown partition table\n", PAGE_SIZE); | ||
207 | else if (warn_no_part) | ||
208 | strlcat(state->pp_buf, " unable to read partition table\n", PAGE_SIZE); | ||
209 | |||
210 | printk(KERN_INFO "%s", state->pp_buf); | ||
211 | |||
212 | free_page((unsigned long)state->pp_buf); | ||
213 | kfree(state); | ||
214 | return ERR_PTR(res); | ||
215 | } | ||
216 | |||
217 | static ssize_t part_partition_show(struct device *dev, | ||
218 | struct device_attribute *attr, char *buf) | ||
219 | { | ||
220 | struct hd_struct *p = dev_to_part(dev); | ||
221 | |||
222 | return sprintf(buf, "%d\n", p->partno); | ||
223 | } | ||
224 | |||
225 | static ssize_t part_start_show(struct device *dev, | ||
226 | struct device_attribute *attr, char *buf) | ||
227 | { | ||
228 | struct hd_struct *p = dev_to_part(dev); | ||
229 | |||
230 | return sprintf(buf, "%llu\n",(unsigned long long)p->start_sect); | ||
231 | } | ||
232 | |||
233 | ssize_t part_size_show(struct device *dev, | ||
234 | struct device_attribute *attr, char *buf) | ||
235 | { | ||
236 | struct hd_struct *p = dev_to_part(dev); | ||
237 | return sprintf(buf, "%llu\n",(unsigned long long)p->nr_sects); | ||
238 | } | ||
239 | |||
240 | static ssize_t part_ro_show(struct device *dev, | ||
241 | struct device_attribute *attr, char *buf) | ||
242 | { | ||
243 | struct hd_struct *p = dev_to_part(dev); | ||
244 | return sprintf(buf, "%d\n", p->policy ? 1 : 0); | ||
245 | } | ||
246 | |||
247 | static ssize_t part_alignment_offset_show(struct device *dev, | ||
248 | struct device_attribute *attr, char *buf) | ||
249 | { | ||
250 | struct hd_struct *p = dev_to_part(dev); | ||
251 | return sprintf(buf, "%llu\n", (unsigned long long)p->alignment_offset); | ||
252 | } | ||
253 | |||
254 | static ssize_t part_discard_alignment_show(struct device *dev, | ||
255 | struct device_attribute *attr, char *buf) | ||
256 | { | ||
257 | struct hd_struct *p = dev_to_part(dev); | ||
258 | return sprintf(buf, "%u\n", p->discard_alignment); | ||
259 | } | ||
260 | |||
261 | ssize_t part_stat_show(struct device *dev, | ||
262 | struct device_attribute *attr, char *buf) | ||
263 | { | ||
264 | struct hd_struct *p = dev_to_part(dev); | ||
265 | int cpu; | ||
266 | |||
267 | cpu = part_stat_lock(); | ||
268 | part_round_stats(cpu, p); | ||
269 | part_stat_unlock(); | ||
270 | return sprintf(buf, | ||
271 | "%8lu %8lu %8llu %8u " | ||
272 | "%8lu %8lu %8llu %8u " | ||
273 | "%8u %8u %8u" | ||
274 | "\n", | ||
275 | part_stat_read(p, ios[READ]), | ||
276 | part_stat_read(p, merges[READ]), | ||
277 | (unsigned long long)part_stat_read(p, sectors[READ]), | ||
278 | jiffies_to_msecs(part_stat_read(p, ticks[READ])), | ||
279 | part_stat_read(p, ios[WRITE]), | ||
280 | part_stat_read(p, merges[WRITE]), | ||
281 | (unsigned long long)part_stat_read(p, sectors[WRITE]), | ||
282 | jiffies_to_msecs(part_stat_read(p, ticks[WRITE])), | ||
283 | part_in_flight(p), | ||
284 | jiffies_to_msecs(part_stat_read(p, io_ticks)), | ||
285 | jiffies_to_msecs(part_stat_read(p, time_in_queue))); | ||
286 | } | ||
287 | |||
288 | ssize_t part_inflight_show(struct device *dev, | ||
289 | struct device_attribute *attr, char *buf) | ||
290 | { | ||
291 | struct hd_struct *p = dev_to_part(dev); | ||
292 | |||
293 | return sprintf(buf, "%8u %8u\n", atomic_read(&p->in_flight[0]), | ||
294 | atomic_read(&p->in_flight[1])); | ||
295 | } | ||
296 | |||
297 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
298 | ssize_t part_fail_show(struct device *dev, | ||
299 | struct device_attribute *attr, char *buf) | ||
300 | { | ||
301 | struct hd_struct *p = dev_to_part(dev); | ||
302 | |||
303 | return sprintf(buf, "%d\n", p->make_it_fail); | ||
304 | } | ||
305 | |||
306 | ssize_t part_fail_store(struct device *dev, | ||
307 | struct device_attribute *attr, | ||
308 | const char *buf, size_t count) | ||
309 | { | ||
310 | struct hd_struct *p = dev_to_part(dev); | ||
311 | int i; | ||
312 | |||
313 | if (count > 0 && sscanf(buf, "%d", &i) > 0) | ||
314 | p->make_it_fail = (i == 0) ? 0 : 1; | ||
315 | |||
316 | return count; | ||
317 | } | ||
318 | #endif | ||
319 | |||
320 | static DEVICE_ATTR(partition, S_IRUGO, part_partition_show, NULL); | ||
321 | static DEVICE_ATTR(start, S_IRUGO, part_start_show, NULL); | ||
322 | static DEVICE_ATTR(size, S_IRUGO, part_size_show, NULL); | ||
323 | static DEVICE_ATTR(ro, S_IRUGO, part_ro_show, NULL); | ||
324 | static DEVICE_ATTR(alignment_offset, S_IRUGO, part_alignment_offset_show, NULL); | ||
325 | static DEVICE_ATTR(discard_alignment, S_IRUGO, part_discard_alignment_show, | ||
326 | NULL); | ||
327 | static DEVICE_ATTR(stat, S_IRUGO, part_stat_show, NULL); | ||
328 | static DEVICE_ATTR(inflight, S_IRUGO, part_inflight_show, NULL); | ||
329 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
330 | static struct device_attribute dev_attr_fail = | ||
331 | __ATTR(make-it-fail, S_IRUGO|S_IWUSR, part_fail_show, part_fail_store); | ||
332 | #endif | ||
333 | |||
334 | static struct attribute *part_attrs[] = { | ||
335 | &dev_attr_partition.attr, | ||
336 | &dev_attr_start.attr, | ||
337 | &dev_attr_size.attr, | ||
338 | &dev_attr_ro.attr, | ||
339 | &dev_attr_alignment_offset.attr, | ||
340 | &dev_attr_discard_alignment.attr, | ||
341 | &dev_attr_stat.attr, | ||
342 | &dev_attr_inflight.attr, | ||
343 | #ifdef CONFIG_FAIL_MAKE_REQUEST | ||
344 | &dev_attr_fail.attr, | ||
345 | #endif | ||
346 | NULL | ||
347 | }; | ||
348 | |||
349 | static struct attribute_group part_attr_group = { | ||
350 | .attrs = part_attrs, | ||
351 | }; | ||
352 | |||
353 | static const struct attribute_group *part_attr_groups[] = { | ||
354 | &part_attr_group, | ||
355 | #ifdef CONFIG_BLK_DEV_IO_TRACE | ||
356 | &blk_trace_attr_group, | ||
357 | #endif | ||
358 | NULL | ||
359 | }; | ||
360 | |||
361 | static void part_release(struct device *dev) | ||
362 | { | ||
363 | struct hd_struct *p = dev_to_part(dev); | ||
364 | free_part_stats(p); | ||
365 | free_part_info(p); | ||
366 | kfree(p); | ||
367 | } | ||
368 | |||
369 | struct device_type part_type = { | ||
370 | .name = "partition", | ||
371 | .groups = part_attr_groups, | ||
372 | .release = part_release, | ||
373 | }; | ||
374 | |||
375 | static void delete_partition_rcu_cb(struct rcu_head *head) | ||
376 | { | ||
377 | struct hd_struct *part = container_of(head, struct hd_struct, rcu_head); | ||
378 | |||
379 | part->start_sect = 0; | ||
380 | part->nr_sects = 0; | ||
381 | part_stat_set_all(part, 0); | ||
382 | put_device(part_to_dev(part)); | ||
383 | } | ||
384 | |||
385 | void __delete_partition(struct hd_struct *part) | ||
386 | { | ||
387 | call_rcu(&part->rcu_head, delete_partition_rcu_cb); | ||
388 | } | ||
389 | |||
390 | void delete_partition(struct gendisk *disk, int partno) | ||
391 | { | ||
392 | struct disk_part_tbl *ptbl = disk->part_tbl; | ||
393 | struct hd_struct *part; | ||
394 | |||
395 | if (partno >= ptbl->len) | ||
396 | return; | ||
397 | |||
398 | part = ptbl->part[partno]; | ||
399 | if (!part) | ||
400 | return; | ||
401 | |||
402 | blk_free_devt(part_devt(part)); | ||
403 | rcu_assign_pointer(ptbl->part[partno], NULL); | ||
404 | rcu_assign_pointer(ptbl->last_lookup, NULL); | ||
405 | kobject_put(part->holder_dir); | ||
406 | device_del(part_to_dev(part)); | ||
407 | |||
408 | hd_struct_put(part); | ||
409 | } | ||
410 | |||
411 | static ssize_t whole_disk_show(struct device *dev, | ||
412 | struct device_attribute *attr, char *buf) | ||
413 | { | ||
414 | return 0; | ||
415 | } | ||
416 | static DEVICE_ATTR(whole_disk, S_IRUSR | S_IRGRP | S_IROTH, | ||
417 | whole_disk_show, NULL); | ||
418 | |||
419 | struct hd_struct *add_partition(struct gendisk *disk, int partno, | ||
420 | sector_t start, sector_t len, int flags, | ||
421 | struct partition_meta_info *info) | ||
422 | { | ||
423 | struct hd_struct *p; | ||
424 | dev_t devt = MKDEV(0, 0); | ||
425 | struct device *ddev = disk_to_dev(disk); | ||
426 | struct device *pdev; | ||
427 | struct disk_part_tbl *ptbl; | ||
428 | const char *dname; | ||
429 | int err; | ||
430 | |||
431 | err = disk_expand_part_tbl(disk, partno); | ||
432 | if (err) | ||
433 | return ERR_PTR(err); | ||
434 | ptbl = disk->part_tbl; | ||
435 | |||
436 | if (ptbl->part[partno]) | ||
437 | return ERR_PTR(-EBUSY); | ||
438 | |||
439 | p = kzalloc(sizeof(*p), GFP_KERNEL); | ||
440 | if (!p) | ||
441 | return ERR_PTR(-EBUSY); | ||
442 | |||
443 | if (!init_part_stats(p)) { | ||
444 | err = -ENOMEM; | ||
445 | goto out_free; | ||
446 | } | ||
447 | pdev = part_to_dev(p); | ||
448 | |||
449 | p->start_sect = start; | ||
450 | p->alignment_offset = | ||
451 | queue_limit_alignment_offset(&disk->queue->limits, start); | ||
452 | p->discard_alignment = | ||
453 | queue_limit_discard_alignment(&disk->queue->limits, start); | ||
454 | p->nr_sects = len; | ||
455 | p->partno = partno; | ||
456 | p->policy = get_disk_ro(disk); | ||
457 | |||
458 | if (info) { | ||
459 | struct partition_meta_info *pinfo = alloc_part_info(disk); | ||
460 | if (!pinfo) | ||
461 | goto out_free_stats; | ||
462 | memcpy(pinfo, info, sizeof(*info)); | ||
463 | p->info = pinfo; | ||
464 | } | ||
465 | |||
466 | dname = dev_name(ddev); | ||
467 | if (isdigit(dname[strlen(dname) - 1])) | ||
468 | dev_set_name(pdev, "%sp%d", dname, partno); | ||
469 | else | ||
470 | dev_set_name(pdev, "%s%d", dname, partno); | ||
471 | |||
472 | device_initialize(pdev); | ||
473 | pdev->class = &block_class; | ||
474 | pdev->type = &part_type; | ||
475 | pdev->parent = ddev; | ||
476 | |||
477 | err = blk_alloc_devt(p, &devt); | ||
478 | if (err) | ||
479 | goto out_free_info; | ||
480 | pdev->devt = devt; | ||
481 | |||
482 | /* delay uevent until 'holders' subdir is created */ | ||
483 | dev_set_uevent_suppress(pdev, 1); | ||
484 | err = device_add(pdev); | ||
485 | if (err) | ||
486 | goto out_put; | ||
487 | |||
488 | err = -ENOMEM; | ||
489 | p->holder_dir = kobject_create_and_add("holders", &pdev->kobj); | ||
490 | if (!p->holder_dir) | ||
491 | goto out_del; | ||
492 | |||
493 | dev_set_uevent_suppress(pdev, 0); | ||
494 | if (flags & ADDPART_FLAG_WHOLEDISK) { | ||
495 | err = device_create_file(pdev, &dev_attr_whole_disk); | ||
496 | if (err) | ||
497 | goto out_del; | ||
498 | } | ||
499 | |||
500 | /* everything is up and running, commence */ | ||
501 | rcu_assign_pointer(ptbl->part[partno], p); | ||
502 | |||
503 | /* suppress uevent if the disk suppresses it */ | ||
504 | if (!dev_get_uevent_suppress(ddev)) | ||
505 | kobject_uevent(&pdev->kobj, KOBJ_ADD); | ||
506 | |||
507 | hd_ref_init(p); | ||
508 | return p; | ||
509 | |||
510 | out_free_info: | ||
511 | free_part_info(p); | ||
512 | out_free_stats: | ||
513 | free_part_stats(p); | ||
514 | out_free: | ||
515 | kfree(p); | ||
516 | return ERR_PTR(err); | ||
517 | out_del: | ||
518 | kobject_put(p->holder_dir); | ||
519 | device_del(pdev); | ||
520 | out_put: | ||
521 | put_device(pdev); | ||
522 | blk_free_devt(devt); | ||
523 | return ERR_PTR(err); | ||
524 | } | ||
525 | |||
526 | static bool disk_unlock_native_capacity(struct gendisk *disk) | ||
527 | { | ||
528 | const struct block_device_operations *bdops = disk->fops; | ||
529 | |||
530 | if (bdops->unlock_native_capacity && | ||
531 | !(disk->flags & GENHD_FL_NATIVE_CAPACITY)) { | ||
532 | printk(KERN_CONT "enabling native capacity\n"); | ||
533 | bdops->unlock_native_capacity(disk); | ||
534 | disk->flags |= GENHD_FL_NATIVE_CAPACITY; | ||
535 | return true; | ||
536 | } else { | ||
537 | printk(KERN_CONT "truncated\n"); | ||
538 | return false; | ||
539 | } | ||
540 | } | ||
541 | |||
542 | int rescan_partitions(struct gendisk *disk, struct block_device *bdev) | ||
543 | { | ||
544 | struct parsed_partitions *state = NULL; | ||
545 | struct disk_part_iter piter; | ||
546 | struct hd_struct *part; | ||
547 | int p, highest, res; | ||
548 | rescan: | ||
549 | if (state && !IS_ERR(state)) { | ||
550 | kfree(state); | ||
551 | state = NULL; | ||
552 | } | ||
553 | |||
554 | if (bdev->bd_part_count) | ||
555 | return -EBUSY; | ||
556 | res = invalidate_partition(disk, 0); | ||
557 | if (res) | ||
558 | return res; | ||
559 | |||
560 | disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY); | ||
561 | while ((part = disk_part_iter_next(&piter))) | ||
562 | delete_partition(disk, part->partno); | ||
563 | disk_part_iter_exit(&piter); | ||
564 | |||
565 | if (disk->fops->revalidate_disk) | ||
566 | disk->fops->revalidate_disk(disk); | ||
567 | check_disk_size_change(disk, bdev); | ||
568 | bdev->bd_invalidated = 0; | ||
569 | if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) | ||
570 | return 0; | ||
571 | if (IS_ERR(state)) { | ||
572 | /* | ||
573 | * I/O error reading the partition table. If any | ||
574 | * partition code tried to read beyond EOD, retry | ||
575 | * after unlocking native capacity. | ||
576 | */ | ||
577 | if (PTR_ERR(state) == -ENOSPC) { | ||
578 | printk(KERN_WARNING "%s: partition table beyond EOD, ", | ||
579 | disk->disk_name); | ||
580 | if (disk_unlock_native_capacity(disk)) | ||
581 | goto rescan; | ||
582 | } | ||
583 | return -EIO; | ||
584 | } | ||
585 | /* | ||
586 | * If any partition code tried to read beyond EOD, try | ||
587 | * unlocking native capacity even if partition table is | ||
588 | * successfully read as we could be missing some partitions. | ||
589 | */ | ||
590 | if (state->access_beyond_eod) { | ||
591 | printk(KERN_WARNING | ||
592 | "%s: partition table partially beyond EOD, ", | ||
593 | disk->disk_name); | ||
594 | if (disk_unlock_native_capacity(disk)) | ||
595 | goto rescan; | ||
596 | } | ||
597 | |||
598 | /* tell userspace that the media / partition table may have changed */ | ||
599 | kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE); | ||
600 | |||
601 | /* Detect the highest partition number and preallocate | ||
602 | * disk->part_tbl. This is an optimization and not strictly | ||
603 | * necessary. | ||
604 | */ | ||
605 | for (p = 1, highest = 0; p < state->limit; p++) | ||
606 | if (state->parts[p].size) | ||
607 | highest = p; | ||
608 | |||
609 | disk_expand_part_tbl(disk, highest); | ||
610 | |||
611 | /* add partitions */ | ||
612 | for (p = 1; p < state->limit; p++) { | ||
613 | sector_t size, from; | ||
614 | struct partition_meta_info *info = NULL; | ||
615 | |||
616 | size = state->parts[p].size; | ||
617 | if (!size) | ||
618 | continue; | ||
619 | |||
620 | from = state->parts[p].from; | ||
621 | if (from >= get_capacity(disk)) { | ||
622 | printk(KERN_WARNING | ||
623 | "%s: p%d start %llu is beyond EOD, ", | ||
624 | disk->disk_name, p, (unsigned long long) from); | ||
625 | if (disk_unlock_native_capacity(disk)) | ||
626 | goto rescan; | ||
627 | continue; | ||
628 | } | ||
629 | |||
630 | if (from + size > get_capacity(disk)) { | ||
631 | printk(KERN_WARNING | ||
632 | "%s: p%d size %llu extends beyond EOD, ", | ||
633 | disk->disk_name, p, (unsigned long long) size); | ||
634 | |||
635 | if (disk_unlock_native_capacity(disk)) { | ||
636 | /* free state and restart */ | ||
637 | goto rescan; | ||
638 | } else { | ||
639 | /* | ||
640 | * we can not ignore partitions of broken tables | ||
641 | * created by for example camera firmware, but | ||
642 | * we limit them to the end of the disk to avoid | ||
643 | * creating invalid block devices | ||
644 | */ | ||
645 | size = get_capacity(disk) - from; | ||
646 | } | ||
647 | } | ||
648 | |||
649 | if (state->parts[p].has_info) | ||
650 | info = &state->parts[p].info; | ||
651 | part = add_partition(disk, p, from, size, | ||
652 | state->parts[p].flags, | ||
653 | &state->parts[p].info); | ||
654 | if (IS_ERR(part)) { | ||
655 | printk(KERN_ERR " %s: p%d could not be added: %ld\n", | ||
656 | disk->disk_name, p, -PTR_ERR(part)); | ||
657 | continue; | ||
658 | } | ||
659 | #ifdef CONFIG_BLK_DEV_MD | ||
660 | if (state->parts[p].flags & ADDPART_FLAG_RAID) | ||
661 | md_autodetect_dev(part_to_dev(part)->devt); | ||
662 | #endif | ||
663 | } | ||
664 | kfree(state); | ||
665 | return 0; | ||
666 | } | ||
667 | |||
668 | unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) | ||
669 | { | ||
670 | struct address_space *mapping = bdev->bd_inode->i_mapping; | ||
671 | struct page *page; | ||
672 | |||
673 | page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), | ||
674 | NULL); | ||
675 | if (!IS_ERR(page)) { | ||
676 | if (PageError(page)) | ||
677 | goto fail; | ||
678 | p->v = page; | ||
679 | return (unsigned char *)page_address(page) + ((n & ((1 << (PAGE_CACHE_SHIFT - 9)) - 1)) << 9); | ||
680 | fail: | ||
681 | page_cache_release(page); | ||
682 | } | ||
683 | p->v = NULL; | ||
684 | return NULL; | ||
685 | } | ||
686 | |||
687 | EXPORT_SYMBOL(read_dev_sector); | ||
diff --git a/fs/partitions/check.h b/fs/partitions/check.h deleted file mode 100644 index d68bf4dc3bc2..000000000000 --- a/fs/partitions/check.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | #include <linux/pagemap.h> | ||
2 | #include <linux/blkdev.h> | ||
3 | #include <linux/genhd.h> | ||
4 | |||
5 | /* | ||
6 | * add_gd_partition adds a partitions details to the devices partition | ||
7 | * description. | ||
8 | */ | ||
9 | struct parsed_partitions { | ||
10 | struct block_device *bdev; | ||
11 | char name[BDEVNAME_SIZE]; | ||
12 | struct { | ||
13 | sector_t from; | ||
14 | sector_t size; | ||
15 | int flags; | ||
16 | bool has_info; | ||
17 | struct partition_meta_info info; | ||
18 | } parts[DISK_MAX_PARTS]; | ||
19 | int next; | ||
20 | int limit; | ||
21 | bool access_beyond_eod; | ||
22 | char *pp_buf; | ||
23 | }; | ||
24 | |||
25 | static inline void *read_part_sector(struct parsed_partitions *state, | ||
26 | sector_t n, Sector *p) | ||
27 | { | ||
28 | if (n >= get_capacity(state->bdev->bd_disk)) { | ||
29 | state->access_beyond_eod = true; | ||
30 | return NULL; | ||
31 | } | ||
32 | return read_dev_sector(state->bdev, n, p); | ||
33 | } | ||
34 | |||
35 | static inline void | ||
36 | put_partition(struct parsed_partitions *p, int n, sector_t from, sector_t size) | ||
37 | { | ||
38 | if (n < p->limit) { | ||
39 | char tmp[1 + BDEVNAME_SIZE + 10 + 1]; | ||
40 | |||
41 | p->parts[n].from = from; | ||
42 | p->parts[n].size = size; | ||
43 | snprintf(tmp, sizeof(tmp), " %s%d", p->name, n); | ||
44 | strlcat(p->pp_buf, tmp, PAGE_SIZE); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | extern int warn_no_part; | ||
49 | |||
diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c deleted file mode 100644 index 6296b403c67a..000000000000 --- a/fs/partitions/efi.c +++ /dev/null | |||
@@ -1,675 +0,0 @@ | |||
1 | /************************************************************ | ||
2 | * EFI GUID Partition Table handling | ||
3 | * | ||
4 | * http://www.uefi.org/specs/ | ||
5 | * http://www.intel.com/technology/efi/ | ||
6 | * | ||
7 | * efi.[ch] by Matt Domsch <Matt_Domsch@dell.com> | ||
8 | * Copyright 2000,2001,2002,2004 Dell Inc. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | * | ||
24 | * | ||
25 | * TODO: | ||
26 | * | ||
27 | * Changelog: | ||
28 | * Mon Nov 09 2004 Matt Domsch <Matt_Domsch@dell.com> | ||
29 | * - test for valid PMBR and valid PGPT before ever reading | ||
30 | * AGPT, allow override with 'gpt' kernel command line option. | ||
31 | * - check for first/last_usable_lba outside of size of disk | ||
32 | * | ||
33 | * Tue Mar 26 2002 Matt Domsch <Matt_Domsch@dell.com> | ||
34 | * - Ported to 2.5.7-pre1 and 2.5.7-dj2 | ||
35 | * - Applied patch to avoid fault in alternate header handling | ||
36 | * - cleaned up find_valid_gpt | ||
37 | * - On-disk structure and copy in memory is *always* LE now - | ||
38 | * swab fields as needed | ||
39 | * - remove print_gpt_header() | ||
40 | * - only use first max_p partition entries, to keep the kernel minor number | ||
41 | * and partition numbers tied. | ||
42 | * | ||
43 | * Mon Feb 04 2002 Matt Domsch <Matt_Domsch@dell.com> | ||
44 | * - Removed __PRIPTR_PREFIX - not being used | ||
45 | * | ||
46 | * Mon Jan 14 2002 Matt Domsch <Matt_Domsch@dell.com> | ||
47 | * - Ported to 2.5.2-pre11 + library crc32 patch Linus applied | ||
48 | * | ||
49 | * Thu Dec 6 2001 Matt Domsch <Matt_Domsch@dell.com> | ||
50 | * - Added compare_gpts(). | ||
51 | * - moved le_efi_guid_to_cpus() back into this file. GPT is the only | ||
52 | * thing that keeps EFI GUIDs on disk. | ||
53 | * - Changed gpt structure names and members to be simpler and more Linux-like. | ||
54 | * | ||
55 | * Wed Oct 17 2001 Matt Domsch <Matt_Domsch@dell.com> | ||
56 | * - Removed CONFIG_DEVFS_VOLUMES_UUID code entirely per Martin Wilck | ||
57 | * | ||
58 | * Wed Oct 10 2001 Matt Domsch <Matt_Domsch@dell.com> | ||
59 | * - Changed function comments to DocBook style per Andreas Dilger suggestion. | ||
60 | * | ||
61 | * Mon Oct 08 2001 Matt Domsch <Matt_Domsch@dell.com> | ||
62 | * - Change read_lba() to use the page cache per Al Viro's work. | ||
63 | * - print u64s properly on all architectures | ||
64 | * - fixed debug_printk(), now Dprintk() | ||
65 | * | ||
66 | * Mon Oct 01 2001 Matt Domsch <Matt_Domsch@dell.com> | ||
67 | * - Style cleanups | ||
68 | * - made most functions static | ||
69 | * - Endianness addition | ||
70 | * - remove test for second alternate header, as it's not per spec, | ||
71 | * and is unnecessary. There's now a method to read/write the last | ||
72 | * sector of an odd-sized disk from user space. No tools have ever | ||
73 | * been released which used this code, so it's effectively dead. | ||
74 | * - Per Asit Mallick of Intel, added a test for a valid PMBR. | ||
75 | * - Added kernel command line option 'gpt' to override valid PMBR test. | ||
76 | * | ||
77 | * Wed Jun 6 2001 Martin Wilck <Martin.Wilck@Fujitsu-Siemens.com> | ||
78 | * - added devfs volume UUID support (/dev/volumes/uuids) for | ||
79 | * mounting file systems by the partition GUID. | ||
80 | * | ||
81 | * Tue Dec 5 2000 Matt Domsch <Matt_Domsch@dell.com> | ||
82 | * - Moved crc32() to linux/lib, added efi_crc32(). | ||
83 | * | ||
84 | * Thu Nov 30 2000 Matt Domsch <Matt_Domsch@dell.com> | ||
85 | * - Replaced Intel's CRC32 function with an equivalent | ||
86 | * non-license-restricted version. | ||
87 | * | ||
88 | * Wed Oct 25 2000 Matt Domsch <Matt_Domsch@dell.com> | ||
89 | * - Fixed the last_lba() call to return the proper last block | ||
90 | * | ||
91 | * Thu Oct 12 2000 Matt Domsch <Matt_Domsch@dell.com> | ||
92 | * - Thanks to Andries Brouwer for his debugging assistance. | ||
93 | * - Code works, detects all the partitions. | ||
94 | * | ||
95 | ************************************************************/ | ||
96 | #include <linux/crc32.h> | ||
97 | #include <linux/ctype.h> | ||
98 | #include <linux/math64.h> | ||
99 | #include <linux/slab.h> | ||
100 | #include "check.h" | ||
101 | #include "efi.h" | ||
102 | |||
103 | /* This allows a kernel command line option 'gpt' to override | ||
104 | * the test for invalid PMBR. Not __initdata because reloading | ||
105 | * the partition tables happens after init too. | ||
106 | */ | ||
107 | static int force_gpt; | ||
108 | static int __init | ||
109 | force_gpt_fn(char *str) | ||
110 | { | ||
111 | force_gpt = 1; | ||
112 | return 1; | ||
113 | } | ||
114 | __setup("gpt", force_gpt_fn); | ||
115 | |||
116 | |||
117 | /** | ||
118 | * efi_crc32() - EFI version of crc32 function | ||
119 | * @buf: buffer to calculate crc32 of | ||
120 | * @len - length of buf | ||
121 | * | ||
122 | * Description: Returns EFI-style CRC32 value for @buf | ||
123 | * | ||
124 | * This function uses the little endian Ethernet polynomial | ||
125 | * but seeds the function with ~0, and xor's with ~0 at the end. | ||
126 | * Note, the EFI Specification, v1.02, has a reference to | ||
127 | * Dr. Dobbs Journal, May 1994 (actually it's in May 1992). | ||
128 | */ | ||
129 | static inline u32 | ||
130 | efi_crc32(const void *buf, unsigned long len) | ||
131 | { | ||
132 | return (crc32(~0L, buf, len) ^ ~0L); | ||
133 | } | ||
134 | |||
135 | /** | ||
136 | * last_lba(): return number of last logical block of device | ||
137 | * @bdev: block device | ||
138 | * | ||
139 | * Description: Returns last LBA value on success, 0 on error. | ||
140 | * This is stored (by sd and ide-geometry) in | ||
141 | * the part[0] entry for this disk, and is the number of | ||
142 | * physical sectors available on the disk. | ||
143 | */ | ||
144 | static u64 last_lba(struct block_device *bdev) | ||
145 | { | ||
146 | if (!bdev || !bdev->bd_inode) | ||
147 | return 0; | ||
148 | return div_u64(bdev->bd_inode->i_size, | ||
149 | bdev_logical_block_size(bdev)) - 1ULL; | ||
150 | } | ||
151 | |||
152 | static inline int | ||
153 | pmbr_part_valid(struct partition *part) | ||
154 | { | ||
155 | if (part->sys_ind == EFI_PMBR_OSTYPE_EFI_GPT && | ||
156 | le32_to_cpu(part->start_sect) == 1UL) | ||
157 | return 1; | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * is_pmbr_valid(): test Protective MBR for validity | ||
163 | * @mbr: pointer to a legacy mbr structure | ||
164 | * | ||
165 | * Description: Returns 1 if PMBR is valid, 0 otherwise. | ||
166 | * Validity depends on two things: | ||
167 | * 1) MSDOS signature is in the last two bytes of the MBR | ||
168 | * 2) One partition of type 0xEE is found | ||
169 | */ | ||
170 | static int | ||
171 | is_pmbr_valid(legacy_mbr *mbr) | ||
172 | { | ||
173 | int i; | ||
174 | if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE) | ||
175 | return 0; | ||
176 | for (i = 0; i < 4; i++) | ||
177 | if (pmbr_part_valid(&mbr->partition_record[i])) | ||
178 | return 1; | ||
179 | return 0; | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * read_lba(): Read bytes from disk, starting at given LBA | ||
184 | * @state | ||
185 | * @lba | ||
186 | * @buffer | ||
187 | * @size_t | ||
188 | * | ||
189 | * Description: Reads @count bytes from @state->bdev into @buffer. | ||
190 | * Returns number of bytes read on success, 0 on error. | ||
191 | */ | ||
192 | static size_t read_lba(struct parsed_partitions *state, | ||
193 | u64 lba, u8 *buffer, size_t count) | ||
194 | { | ||
195 | size_t totalreadcount = 0; | ||
196 | struct block_device *bdev = state->bdev; | ||
197 | sector_t n = lba * (bdev_logical_block_size(bdev) / 512); | ||
198 | |||
199 | if (!buffer || lba > last_lba(bdev)) | ||
200 | return 0; | ||
201 | |||
202 | while (count) { | ||
203 | int copied = 512; | ||
204 | Sector sect; | ||
205 | unsigned char *data = read_part_sector(state, n++, §); | ||
206 | if (!data) | ||
207 | break; | ||
208 | if (copied > count) | ||
209 | copied = count; | ||
210 | memcpy(buffer, data, copied); | ||
211 | put_dev_sector(sect); | ||
212 | buffer += copied; | ||
213 | totalreadcount +=copied; | ||
214 | count -= copied; | ||
215 | } | ||
216 | return totalreadcount; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * alloc_read_gpt_entries(): reads partition entries from disk | ||
221 | * @state | ||
222 | * @gpt - GPT header | ||
223 | * | ||
224 | * Description: Returns ptes on success, NULL on error. | ||
225 | * Allocates space for PTEs based on information found in @gpt. | ||
226 | * Notes: remember to free pte when you're done! | ||
227 | */ | ||
228 | static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state, | ||
229 | gpt_header *gpt) | ||
230 | { | ||
231 | size_t count; | ||
232 | gpt_entry *pte; | ||
233 | |||
234 | if (!gpt) | ||
235 | return NULL; | ||
236 | |||
237 | count = le32_to_cpu(gpt->num_partition_entries) * | ||
238 | le32_to_cpu(gpt->sizeof_partition_entry); | ||
239 | if (!count) | ||
240 | return NULL; | ||
241 | pte = kzalloc(count, GFP_KERNEL); | ||
242 | if (!pte) | ||
243 | return NULL; | ||
244 | |||
245 | if (read_lba(state, le64_to_cpu(gpt->partition_entry_lba), | ||
246 | (u8 *) pte, | ||
247 | count) < count) { | ||
248 | kfree(pte); | ||
249 | pte=NULL; | ||
250 | return NULL; | ||
251 | } | ||
252 | return pte; | ||
253 | } | ||
254 | |||
255 | /** | ||
256 | * alloc_read_gpt_header(): Allocates GPT header, reads into it from disk | ||
257 | * @state | ||
258 | * @lba is the Logical Block Address of the partition table | ||
259 | * | ||
260 | * Description: returns GPT header on success, NULL on error. Allocates | ||
261 | * and fills a GPT header starting at @ from @state->bdev. | ||
262 | * Note: remember to free gpt when finished with it. | ||
263 | */ | ||
264 | static gpt_header *alloc_read_gpt_header(struct parsed_partitions *state, | ||
265 | u64 lba) | ||
266 | { | ||
267 | gpt_header *gpt; | ||
268 | unsigned ssz = bdev_logical_block_size(state->bdev); | ||
269 | |||
270 | gpt = kzalloc(ssz, GFP_KERNEL); | ||
271 | if (!gpt) | ||
272 | return NULL; | ||
273 | |||
274 | if (read_lba(state, lba, (u8 *) gpt, ssz) < ssz) { | ||
275 | kfree(gpt); | ||
276 | gpt=NULL; | ||
277 | return NULL; | ||
278 | } | ||
279 | |||
280 | return gpt; | ||
281 | } | ||
282 | |||
283 | /** | ||
284 | * is_gpt_valid() - tests one GPT header and PTEs for validity | ||
285 | * @state | ||
286 | * @lba is the logical block address of the GPT header to test | ||
287 | * @gpt is a GPT header ptr, filled on return. | ||
288 | * @ptes is a PTEs ptr, filled on return. | ||
289 | * | ||
290 | * Description: returns 1 if valid, 0 on error. | ||
291 | * If valid, returns pointers to newly allocated GPT header and PTEs. | ||
292 | */ | ||
293 | static int is_gpt_valid(struct parsed_partitions *state, u64 lba, | ||
294 | gpt_header **gpt, gpt_entry **ptes) | ||
295 | { | ||
296 | u32 crc, origcrc; | ||
297 | u64 lastlba; | ||
298 | |||
299 | if (!ptes) | ||
300 | return 0; | ||
301 | if (!(*gpt = alloc_read_gpt_header(state, lba))) | ||
302 | return 0; | ||
303 | |||
304 | /* Check the GUID Partition Table signature */ | ||
305 | if (le64_to_cpu((*gpt)->signature) != GPT_HEADER_SIGNATURE) { | ||
306 | pr_debug("GUID Partition Table Header signature is wrong:" | ||
307 | "%lld != %lld\n", | ||
308 | (unsigned long long)le64_to_cpu((*gpt)->signature), | ||
309 | (unsigned long long)GPT_HEADER_SIGNATURE); | ||
310 | goto fail; | ||
311 | } | ||
312 | |||
313 | /* Check the GUID Partition Table header size */ | ||
314 | if (le32_to_cpu((*gpt)->header_size) > | ||
315 | bdev_logical_block_size(state->bdev)) { | ||
316 | pr_debug("GUID Partition Table Header size is wrong: %u > %u\n", | ||
317 | le32_to_cpu((*gpt)->header_size), | ||
318 | bdev_logical_block_size(state->bdev)); | ||
319 | goto fail; | ||
320 | } | ||
321 | |||
322 | /* Check the GUID Partition Table CRC */ | ||
323 | origcrc = le32_to_cpu((*gpt)->header_crc32); | ||
324 | (*gpt)->header_crc32 = 0; | ||
325 | crc = efi_crc32((const unsigned char *) (*gpt), le32_to_cpu((*gpt)->header_size)); | ||
326 | |||
327 | if (crc != origcrc) { | ||
328 | pr_debug("GUID Partition Table Header CRC is wrong: %x != %x\n", | ||
329 | crc, origcrc); | ||
330 | goto fail; | ||
331 | } | ||
332 | (*gpt)->header_crc32 = cpu_to_le32(origcrc); | ||
333 | |||
334 | /* Check that the my_lba entry points to the LBA that contains | ||
335 | * the GUID Partition Table */ | ||
336 | if (le64_to_cpu((*gpt)->my_lba) != lba) { | ||
337 | pr_debug("GPT my_lba incorrect: %lld != %lld\n", | ||
338 | (unsigned long long)le64_to_cpu((*gpt)->my_lba), | ||
339 | (unsigned long long)lba); | ||
340 | goto fail; | ||
341 | } | ||
342 | |||
343 | /* Check the first_usable_lba and last_usable_lba are | ||
344 | * within the disk. | ||
345 | */ | ||
346 | lastlba = last_lba(state->bdev); | ||
347 | if (le64_to_cpu((*gpt)->first_usable_lba) > lastlba) { | ||
348 | pr_debug("GPT: first_usable_lba incorrect: %lld > %lld\n", | ||
349 | (unsigned long long)le64_to_cpu((*gpt)->first_usable_lba), | ||
350 | (unsigned long long)lastlba); | ||
351 | goto fail; | ||
352 | } | ||
353 | if (le64_to_cpu((*gpt)->last_usable_lba) > lastlba) { | ||
354 | pr_debug("GPT: last_usable_lba incorrect: %lld > %lld\n", | ||
355 | (unsigned long long)le64_to_cpu((*gpt)->last_usable_lba), | ||
356 | (unsigned long long)lastlba); | ||
357 | goto fail; | ||
358 | } | ||
359 | |||
360 | /* Check that sizeof_partition_entry has the correct value */ | ||
361 | if (le32_to_cpu((*gpt)->sizeof_partition_entry) != sizeof(gpt_entry)) { | ||
362 | pr_debug("GUID Partitition Entry Size check failed.\n"); | ||
363 | goto fail; | ||
364 | } | ||
365 | |||
366 | if (!(*ptes = alloc_read_gpt_entries(state, *gpt))) | ||
367 | goto fail; | ||
368 | |||
369 | /* Check the GUID Partition Entry Array CRC */ | ||
370 | crc = efi_crc32((const unsigned char *) (*ptes), | ||
371 | le32_to_cpu((*gpt)->num_partition_entries) * | ||
372 | le32_to_cpu((*gpt)->sizeof_partition_entry)); | ||
373 | |||
374 | if (crc != le32_to_cpu((*gpt)->partition_entry_array_crc32)) { | ||
375 | pr_debug("GUID Partitition Entry Array CRC check failed.\n"); | ||
376 | goto fail_ptes; | ||
377 | } | ||
378 | |||
379 | /* We're done, all's well */ | ||
380 | return 1; | ||
381 | |||
382 | fail_ptes: | ||
383 | kfree(*ptes); | ||
384 | *ptes = NULL; | ||
385 | fail: | ||
386 | kfree(*gpt); | ||
387 | *gpt = NULL; | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | /** | ||
392 | * is_pte_valid() - tests one PTE for validity | ||
393 | * @pte is the pte to check | ||
394 | * @lastlba is last lba of the disk | ||
395 | * | ||
396 | * Description: returns 1 if valid, 0 on error. | ||
397 | */ | ||
398 | static inline int | ||
399 | is_pte_valid(const gpt_entry *pte, const u64 lastlba) | ||
400 | { | ||
401 | if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) || | ||
402 | le64_to_cpu(pte->starting_lba) > lastlba || | ||
403 | le64_to_cpu(pte->ending_lba) > lastlba) | ||
404 | return 0; | ||
405 | return 1; | ||
406 | } | ||
407 | |||
408 | /** | ||
409 | * compare_gpts() - Search disk for valid GPT headers and PTEs | ||
410 | * @pgpt is the primary GPT header | ||
411 | * @agpt is the alternate GPT header | ||
412 | * @lastlba is the last LBA number | ||
413 | * Description: Returns nothing. Sanity checks pgpt and agpt fields | ||
414 | * and prints warnings on discrepancies. | ||
415 | * | ||
416 | */ | ||
417 | static void | ||
418 | compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba) | ||
419 | { | ||
420 | int error_found = 0; | ||
421 | if (!pgpt || !agpt) | ||
422 | return; | ||
423 | if (le64_to_cpu(pgpt->my_lba) != le64_to_cpu(agpt->alternate_lba)) { | ||
424 | printk(KERN_WARNING | ||
425 | "GPT:Primary header LBA != Alt. header alternate_lba\n"); | ||
426 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
427 | (unsigned long long)le64_to_cpu(pgpt->my_lba), | ||
428 | (unsigned long long)le64_to_cpu(agpt->alternate_lba)); | ||
429 | error_found++; | ||
430 | } | ||
431 | if (le64_to_cpu(pgpt->alternate_lba) != le64_to_cpu(agpt->my_lba)) { | ||
432 | printk(KERN_WARNING | ||
433 | "GPT:Primary header alternate_lba != Alt. header my_lba\n"); | ||
434 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
435 | (unsigned long long)le64_to_cpu(pgpt->alternate_lba), | ||
436 | (unsigned long long)le64_to_cpu(agpt->my_lba)); | ||
437 | error_found++; | ||
438 | } | ||
439 | if (le64_to_cpu(pgpt->first_usable_lba) != | ||
440 | le64_to_cpu(agpt->first_usable_lba)) { | ||
441 | printk(KERN_WARNING "GPT:first_usable_lbas don't match.\n"); | ||
442 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
443 | (unsigned long long)le64_to_cpu(pgpt->first_usable_lba), | ||
444 | (unsigned long long)le64_to_cpu(agpt->first_usable_lba)); | ||
445 | error_found++; | ||
446 | } | ||
447 | if (le64_to_cpu(pgpt->last_usable_lba) != | ||
448 | le64_to_cpu(agpt->last_usable_lba)) { | ||
449 | printk(KERN_WARNING "GPT:last_usable_lbas don't match.\n"); | ||
450 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
451 | (unsigned long long)le64_to_cpu(pgpt->last_usable_lba), | ||
452 | (unsigned long long)le64_to_cpu(agpt->last_usable_lba)); | ||
453 | error_found++; | ||
454 | } | ||
455 | if (efi_guidcmp(pgpt->disk_guid, agpt->disk_guid)) { | ||
456 | printk(KERN_WARNING "GPT:disk_guids don't match.\n"); | ||
457 | error_found++; | ||
458 | } | ||
459 | if (le32_to_cpu(pgpt->num_partition_entries) != | ||
460 | le32_to_cpu(agpt->num_partition_entries)) { | ||
461 | printk(KERN_WARNING "GPT:num_partition_entries don't match: " | ||
462 | "0x%x != 0x%x\n", | ||
463 | le32_to_cpu(pgpt->num_partition_entries), | ||
464 | le32_to_cpu(agpt->num_partition_entries)); | ||
465 | error_found++; | ||
466 | } | ||
467 | if (le32_to_cpu(pgpt->sizeof_partition_entry) != | ||
468 | le32_to_cpu(agpt->sizeof_partition_entry)) { | ||
469 | printk(KERN_WARNING | ||
470 | "GPT:sizeof_partition_entry values don't match: " | ||
471 | "0x%x != 0x%x\n", | ||
472 | le32_to_cpu(pgpt->sizeof_partition_entry), | ||
473 | le32_to_cpu(agpt->sizeof_partition_entry)); | ||
474 | error_found++; | ||
475 | } | ||
476 | if (le32_to_cpu(pgpt->partition_entry_array_crc32) != | ||
477 | le32_to_cpu(agpt->partition_entry_array_crc32)) { | ||
478 | printk(KERN_WARNING | ||
479 | "GPT:partition_entry_array_crc32 values don't match: " | ||
480 | "0x%x != 0x%x\n", | ||
481 | le32_to_cpu(pgpt->partition_entry_array_crc32), | ||
482 | le32_to_cpu(agpt->partition_entry_array_crc32)); | ||
483 | error_found++; | ||
484 | } | ||
485 | if (le64_to_cpu(pgpt->alternate_lba) != lastlba) { | ||
486 | printk(KERN_WARNING | ||
487 | "GPT:Primary header thinks Alt. header is not at the end of the disk.\n"); | ||
488 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
489 | (unsigned long long)le64_to_cpu(pgpt->alternate_lba), | ||
490 | (unsigned long long)lastlba); | ||
491 | error_found++; | ||
492 | } | ||
493 | |||
494 | if (le64_to_cpu(agpt->my_lba) != lastlba) { | ||
495 | printk(KERN_WARNING | ||
496 | "GPT:Alternate GPT header not at the end of the disk.\n"); | ||
497 | printk(KERN_WARNING "GPT:%lld != %lld\n", | ||
498 | (unsigned long long)le64_to_cpu(agpt->my_lba), | ||
499 | (unsigned long long)lastlba); | ||
500 | error_found++; | ||
501 | } | ||
502 | |||
503 | if (error_found) | ||
504 | printk(KERN_WARNING | ||
505 | "GPT: Use GNU Parted to correct GPT errors.\n"); | ||
506 | return; | ||
507 | } | ||
508 | |||
509 | /** | ||
510 | * find_valid_gpt() - Search disk for valid GPT headers and PTEs | ||
511 | * @state | ||
512 | * @gpt is a GPT header ptr, filled on return. | ||
513 | * @ptes is a PTEs ptr, filled on return. | ||
514 | * Description: Returns 1 if valid, 0 on error. | ||
515 | * If valid, returns pointers to newly allocated GPT header and PTEs. | ||
516 | * Validity depends on PMBR being valid (or being overridden by the | ||
517 | * 'gpt' kernel command line option) and finding either the Primary | ||
518 | * GPT header and PTEs valid, or the Alternate GPT header and PTEs | ||
519 | * valid. If the Primary GPT header is not valid, the Alternate GPT header | ||
520 | * is not checked unless the 'gpt' kernel command line option is passed. | ||
521 | * This protects against devices which misreport their size, and forces | ||
522 | * the user to decide to use the Alternate GPT. | ||
523 | */ | ||
524 | static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt, | ||
525 | gpt_entry **ptes) | ||
526 | { | ||
527 | int good_pgpt = 0, good_agpt = 0, good_pmbr = 0; | ||
528 | gpt_header *pgpt = NULL, *agpt = NULL; | ||
529 | gpt_entry *pptes = NULL, *aptes = NULL; | ||
530 | legacy_mbr *legacymbr; | ||
531 | u64 lastlba; | ||
532 | |||
533 | if (!ptes) | ||
534 | return 0; | ||
535 | |||
536 | lastlba = last_lba(state->bdev); | ||
537 | if (!force_gpt) { | ||
538 | /* This will be added to the EFI Spec. per Intel after v1.02. */ | ||
539 | legacymbr = kzalloc(sizeof (*legacymbr), GFP_KERNEL); | ||
540 | if (legacymbr) { | ||
541 | read_lba(state, 0, (u8 *) legacymbr, | ||
542 | sizeof (*legacymbr)); | ||
543 | good_pmbr = is_pmbr_valid(legacymbr); | ||
544 | kfree(legacymbr); | ||
545 | } | ||
546 | if (!good_pmbr) | ||
547 | goto fail; | ||
548 | } | ||
549 | |||
550 | good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA, | ||
551 | &pgpt, &pptes); | ||
552 | if (good_pgpt) | ||
553 | good_agpt = is_gpt_valid(state, | ||
554 | le64_to_cpu(pgpt->alternate_lba), | ||
555 | &agpt, &aptes); | ||
556 | if (!good_agpt && force_gpt) | ||
557 | good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes); | ||
558 | |||
559 | /* The obviously unsuccessful case */ | ||
560 | if (!good_pgpt && !good_agpt) | ||
561 | goto fail; | ||
562 | |||
563 | compare_gpts(pgpt, agpt, lastlba); | ||
564 | |||
565 | /* The good cases */ | ||
566 | if (good_pgpt) { | ||
567 | *gpt = pgpt; | ||
568 | *ptes = pptes; | ||
569 | kfree(agpt); | ||
570 | kfree(aptes); | ||
571 | if (!good_agpt) { | ||
572 | printk(KERN_WARNING | ||
573 | "Alternate GPT is invalid, " | ||
574 | "using primary GPT.\n"); | ||
575 | } | ||
576 | return 1; | ||
577 | } | ||
578 | else if (good_agpt) { | ||
579 | *gpt = agpt; | ||
580 | *ptes = aptes; | ||
581 | kfree(pgpt); | ||
582 | kfree(pptes); | ||
583 | printk(KERN_WARNING | ||
584 | "Primary GPT is invalid, using alternate GPT.\n"); | ||
585 | return 1; | ||
586 | } | ||
587 | |||
588 | fail: | ||
589 | kfree(pgpt); | ||
590 | kfree(agpt); | ||
591 | kfree(pptes); | ||
592 | kfree(aptes); | ||
593 | *gpt = NULL; | ||
594 | *ptes = NULL; | ||
595 | return 0; | ||
596 | } | ||
597 | |||
598 | /** | ||
599 | * efi_partition(struct parsed_partitions *state) | ||
600 | * @state | ||
601 | * | ||
602 | * Description: called from check.c, if the disk contains GPT | ||
603 | * partitions, sets up partition entries in the kernel. | ||
604 | * | ||
605 | * If the first block on the disk is a legacy MBR, | ||
606 | * it will get handled by msdos_partition(). | ||
607 | * If it's a Protective MBR, we'll handle it here. | ||
608 | * | ||
609 | * We do not create a Linux partition for GPT, but | ||
610 | * only for the actual data partitions. | ||
611 | * Returns: | ||
612 | * -1 if unable to read the partition table | ||
613 | * 0 if this isn't our partition table | ||
614 | * 1 if successful | ||
615 | * | ||
616 | */ | ||
617 | int efi_partition(struct parsed_partitions *state) | ||
618 | { | ||
619 | gpt_header *gpt = NULL; | ||
620 | gpt_entry *ptes = NULL; | ||
621 | u32 i; | ||
622 | unsigned ssz = bdev_logical_block_size(state->bdev) / 512; | ||
623 | u8 unparsed_guid[37]; | ||
624 | |||
625 | if (!find_valid_gpt(state, &gpt, &ptes) || !gpt || !ptes) { | ||
626 | kfree(gpt); | ||
627 | kfree(ptes); | ||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | pr_debug("GUID Partition Table is valid! Yea!\n"); | ||
632 | |||
633 | for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) { | ||
634 | struct partition_meta_info *info; | ||
635 | unsigned label_count = 0; | ||
636 | unsigned label_max; | ||
637 | u64 start = le64_to_cpu(ptes[i].starting_lba); | ||
638 | u64 size = le64_to_cpu(ptes[i].ending_lba) - | ||
639 | le64_to_cpu(ptes[i].starting_lba) + 1ULL; | ||
640 | |||
641 | if (!is_pte_valid(&ptes[i], last_lba(state->bdev))) | ||
642 | continue; | ||
643 | |||
644 | put_partition(state, i+1, start * ssz, size * ssz); | ||
645 | |||
646 | /* If this is a RAID volume, tell md */ | ||
647 | if (!efi_guidcmp(ptes[i].partition_type_guid, | ||
648 | PARTITION_LINUX_RAID_GUID)) | ||
649 | state->parts[i + 1].flags = ADDPART_FLAG_RAID; | ||
650 | |||
651 | info = &state->parts[i + 1].info; | ||
652 | /* Instead of doing a manual swap to big endian, reuse the | ||
653 | * common ASCII hex format as the interim. | ||
654 | */ | ||
655 | efi_guid_unparse(&ptes[i].unique_partition_guid, unparsed_guid); | ||
656 | part_pack_uuid(unparsed_guid, info->uuid); | ||
657 | |||
658 | /* Naively convert UTF16-LE to 7 bits. */ | ||
659 | label_max = min(sizeof(info->volname) - 1, | ||
660 | sizeof(ptes[i].partition_name)); | ||
661 | info->volname[label_max] = 0; | ||
662 | while (label_count < label_max) { | ||
663 | u8 c = ptes[i].partition_name[label_count] & 0xff; | ||
664 | if (c && !isprint(c)) | ||
665 | c = '!'; | ||
666 | info->volname[label_count] = c; | ||
667 | label_count++; | ||
668 | } | ||
669 | state->parts[i + 1].has_info = true; | ||
670 | } | ||
671 | kfree(ptes); | ||
672 | kfree(gpt); | ||
673 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
674 | return 1; | ||
675 | } | ||
diff --git a/fs/partitions/efi.h b/fs/partitions/efi.h deleted file mode 100644 index b69ab729558f..000000000000 --- a/fs/partitions/efi.h +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /************************************************************ | ||
2 | * EFI GUID Partition Table | ||
3 | * Per Intel EFI Specification v1.02 | ||
4 | * http://developer.intel.com/technology/efi/efi.htm | ||
5 | * | ||
6 | * By Matt Domsch <Matt_Domsch@dell.com> Fri Sep 22 22:15:56 CDT 2000 | ||
7 | * Copyright 2000,2001 Dell Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | ************************************************************/ | ||
24 | |||
25 | #ifndef FS_PART_EFI_H_INCLUDED | ||
26 | #define FS_PART_EFI_H_INCLUDED | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/fs.h> | ||
30 | #include <linux/genhd.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/major.h> | ||
33 | #include <linux/string.h> | ||
34 | #include <linux/efi.h> | ||
35 | |||
36 | #define MSDOS_MBR_SIGNATURE 0xaa55 | ||
37 | #define EFI_PMBR_OSTYPE_EFI 0xEF | ||
38 | #define EFI_PMBR_OSTYPE_EFI_GPT 0xEE | ||
39 | |||
40 | #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL | ||
41 | #define GPT_HEADER_REVISION_V1 0x00010000 | ||
42 | #define GPT_PRIMARY_PARTITION_TABLE_LBA 1 | ||
43 | |||
44 | #define PARTITION_SYSTEM_GUID \ | ||
45 | EFI_GUID( 0xC12A7328, 0xF81F, 0x11d2, \ | ||
46 | 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B) | ||
47 | #define LEGACY_MBR_PARTITION_GUID \ | ||
48 | EFI_GUID( 0x024DEE41, 0x33E7, 0x11d3, \ | ||
49 | 0x9D, 0x69, 0x00, 0x08, 0xC7, 0x81, 0xF3, 0x9F) | ||
50 | #define PARTITION_MSFT_RESERVED_GUID \ | ||
51 | EFI_GUID( 0xE3C9E316, 0x0B5C, 0x4DB8, \ | ||
52 | 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE) | ||
53 | #define PARTITION_BASIC_DATA_GUID \ | ||
54 | EFI_GUID( 0xEBD0A0A2, 0xB9E5, 0x4433, \ | ||
55 | 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7) | ||
56 | #define PARTITION_LINUX_RAID_GUID \ | ||
57 | EFI_GUID( 0xa19d880f, 0x05fc, 0x4d3b, \ | ||
58 | 0xa0, 0x06, 0x74, 0x3f, 0x0f, 0x84, 0x91, 0x1e) | ||
59 | #define PARTITION_LINUX_SWAP_GUID \ | ||
60 | EFI_GUID( 0x0657fd6d, 0xa4ab, 0x43c4, \ | ||
61 | 0x84, 0xe5, 0x09, 0x33, 0xc8, 0x4b, 0x4f, 0x4f) | ||
62 | #define PARTITION_LINUX_LVM_GUID \ | ||
63 | EFI_GUID( 0xe6d6d379, 0xf507, 0x44c2, \ | ||
64 | 0xa2, 0x3c, 0x23, 0x8f, 0x2a, 0x3d, 0xf9, 0x28) | ||
65 | |||
66 | typedef struct _gpt_header { | ||
67 | __le64 signature; | ||
68 | __le32 revision; | ||
69 | __le32 header_size; | ||
70 | __le32 header_crc32; | ||
71 | __le32 reserved1; | ||
72 | __le64 my_lba; | ||
73 | __le64 alternate_lba; | ||
74 | __le64 first_usable_lba; | ||
75 | __le64 last_usable_lba; | ||
76 | efi_guid_t disk_guid; | ||
77 | __le64 partition_entry_lba; | ||
78 | __le32 num_partition_entries; | ||
79 | __le32 sizeof_partition_entry; | ||
80 | __le32 partition_entry_array_crc32; | ||
81 | |||
82 | /* The rest of the logical block is reserved by UEFI and must be zero. | ||
83 | * EFI standard handles this by: | ||
84 | * | ||
85 | * uint8_t reserved2[ BlockSize - 92 ]; | ||
86 | */ | ||
87 | } __attribute__ ((packed)) gpt_header; | ||
88 | |||
89 | typedef struct _gpt_entry_attributes { | ||
90 | u64 required_to_function:1; | ||
91 | u64 reserved:47; | ||
92 | u64 type_guid_specific:16; | ||
93 | } __attribute__ ((packed)) gpt_entry_attributes; | ||
94 | |||
95 | typedef struct _gpt_entry { | ||
96 | efi_guid_t partition_type_guid; | ||
97 | efi_guid_t unique_partition_guid; | ||
98 | __le64 starting_lba; | ||
99 | __le64 ending_lba; | ||
100 | gpt_entry_attributes attributes; | ||
101 | efi_char16_t partition_name[72 / sizeof (efi_char16_t)]; | ||
102 | } __attribute__ ((packed)) gpt_entry; | ||
103 | |||
104 | typedef struct _legacy_mbr { | ||
105 | u8 boot_code[440]; | ||
106 | __le32 unique_mbr_signature; | ||
107 | __le16 unknown; | ||
108 | struct partition partition_record[4]; | ||
109 | __le16 signature; | ||
110 | } __attribute__ ((packed)) legacy_mbr; | ||
111 | |||
112 | /* Functions */ | ||
113 | extern int efi_partition(struct parsed_partitions *state); | ||
114 | |||
115 | #endif | ||
116 | |||
117 | /* | ||
118 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
119 | * Emacs will notice this stuff at the end of the file and automatically | ||
120 | * adjust the settings for this buffer only. This must remain at the end | ||
121 | * of the file. | ||
122 | * -------------------------------------------------------------------------- | ||
123 | * Local variables: | ||
124 | * c-indent-level: 4 | ||
125 | * c-brace-imaginary-offset: 0 | ||
126 | * c-brace-offset: -4 | ||
127 | * c-argdecl-indent: 4 | ||
128 | * c-label-offset: -4 | ||
129 | * c-continued-statement-offset: 4 | ||
130 | * c-continued-brace-offset: 0 | ||
131 | * indent-tabs-mode: nil | ||
132 | * tab-width: 8 | ||
133 | * End: | ||
134 | */ | ||
diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c deleted file mode 100644 index d513a07f44bb..000000000000 --- a/fs/partitions/ibm.c +++ /dev/null | |||
@@ -1,275 +0,0 @@ | |||
1 | /* | ||
2 | * File...........: linux/fs/partitions/ibm.c | ||
3 | * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> | ||
4 | * Volker Sameske <sameske@de.ibm.com> | ||
5 | * Bugreports.to..: <Linux390@de.ibm.com> | ||
6 | * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 | ||
7 | */ | ||
8 | |||
9 | #include <linux/buffer_head.h> | ||
10 | #include <linux/hdreg.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <asm/dasd.h> | ||
13 | #include <asm/ebcdic.h> | ||
14 | #include <asm/uaccess.h> | ||
15 | #include <asm/vtoc.h> | ||
16 | |||
17 | #include "check.h" | ||
18 | #include "ibm.h" | ||
19 | |||
20 | /* | ||
21 | * compute the block number from a | ||
22 | * cyl-cyl-head-head structure | ||
23 | */ | ||
24 | static sector_t | ||
25 | cchh2blk (struct vtoc_cchh *ptr, struct hd_geometry *geo) { | ||
26 | |||
27 | sector_t cyl; | ||
28 | __u16 head; | ||
29 | |||
30 | /*decode cylinder and heads for large volumes */ | ||
31 | cyl = ptr->hh & 0xFFF0; | ||
32 | cyl <<= 12; | ||
33 | cyl |= ptr->cc; | ||
34 | head = ptr->hh & 0x000F; | ||
35 | return cyl * geo->heads * geo->sectors + | ||
36 | head * geo->sectors; | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * compute the block number from a | ||
41 | * cyl-cyl-head-head-block structure | ||
42 | */ | ||
43 | static sector_t | ||
44 | cchhb2blk (struct vtoc_cchhb *ptr, struct hd_geometry *geo) { | ||
45 | |||
46 | sector_t cyl; | ||
47 | __u16 head; | ||
48 | |||
49 | /*decode cylinder and heads for large volumes */ | ||
50 | cyl = ptr->hh & 0xFFF0; | ||
51 | cyl <<= 12; | ||
52 | cyl |= ptr->cc; | ||
53 | head = ptr->hh & 0x000F; | ||
54 | return cyl * geo->heads * geo->sectors + | ||
55 | head * geo->sectors + | ||
56 | ptr->b; | ||
57 | } | ||
58 | |||
59 | /* | ||
60 | */ | ||
61 | int ibm_partition(struct parsed_partitions *state) | ||
62 | { | ||
63 | struct block_device *bdev = state->bdev; | ||
64 | int blocksize, res; | ||
65 | loff_t i_size, offset, size, fmt_size; | ||
66 | dasd_information2_t *info; | ||
67 | struct hd_geometry *geo; | ||
68 | char type[5] = {0,}; | ||
69 | char name[7] = {0,}; | ||
70 | union label_t { | ||
71 | struct vtoc_volume_label_cdl vol; | ||
72 | struct vtoc_volume_label_ldl lnx; | ||
73 | struct vtoc_cms_label cms; | ||
74 | } *label; | ||
75 | unsigned char *data; | ||
76 | Sector sect; | ||
77 | sector_t labelsect; | ||
78 | char tmp[64]; | ||
79 | |||
80 | res = 0; | ||
81 | blocksize = bdev_logical_block_size(bdev); | ||
82 | if (blocksize <= 0) | ||
83 | goto out_exit; | ||
84 | i_size = i_size_read(bdev->bd_inode); | ||
85 | if (i_size == 0) | ||
86 | goto out_exit; | ||
87 | |||
88 | info = kmalloc(sizeof(dasd_information2_t), GFP_KERNEL); | ||
89 | if (info == NULL) | ||
90 | goto out_exit; | ||
91 | geo = kmalloc(sizeof(struct hd_geometry), GFP_KERNEL); | ||
92 | if (geo == NULL) | ||
93 | goto out_nogeo; | ||
94 | label = kmalloc(sizeof(union label_t), GFP_KERNEL); | ||
95 | if (label == NULL) | ||
96 | goto out_nolab; | ||
97 | |||
98 | if (ioctl_by_bdev(bdev, BIODASDINFO2, (unsigned long)info) != 0 || | ||
99 | ioctl_by_bdev(bdev, HDIO_GETGEO, (unsigned long)geo) != 0) | ||
100 | goto out_freeall; | ||
101 | |||
102 | /* | ||
103 | * Special case for FBA disks: label sector does not depend on | ||
104 | * blocksize. | ||
105 | */ | ||
106 | if ((info->cu_type == 0x6310 && info->dev_type == 0x9336) || | ||
107 | (info->cu_type == 0x3880 && info->dev_type == 0x3370)) | ||
108 | labelsect = info->label_block; | ||
109 | else | ||
110 | labelsect = info->label_block * (blocksize >> 9); | ||
111 | |||
112 | /* | ||
113 | * Get volume label, extract name and type. | ||
114 | */ | ||
115 | data = read_part_sector(state, labelsect, §); | ||
116 | if (data == NULL) | ||
117 | goto out_readerr; | ||
118 | |||
119 | memcpy(label, data, sizeof(union label_t)); | ||
120 | put_dev_sector(sect); | ||
121 | |||
122 | if ((!info->FBA_layout) && (!strcmp(info->type, "ECKD"))) { | ||
123 | strncpy(type, label->vol.vollbl, 4); | ||
124 | strncpy(name, label->vol.volid, 6); | ||
125 | } else { | ||
126 | strncpy(type, label->lnx.vollbl, 4); | ||
127 | strncpy(name, label->lnx.volid, 6); | ||
128 | } | ||
129 | EBCASC(type, 4); | ||
130 | EBCASC(name, 6); | ||
131 | |||
132 | res = 1; | ||
133 | |||
134 | /* | ||
135 | * Three different formats: LDL, CDL and unformated disk | ||
136 | * | ||
137 | * identified by info->format | ||
138 | * | ||
139 | * unformated disks we do not have to care about | ||
140 | */ | ||
141 | if (info->format == DASD_FORMAT_LDL) { | ||
142 | if (strncmp(type, "CMS1", 4) == 0) { | ||
143 | /* | ||
144 | * VM style CMS1 labeled disk | ||
145 | */ | ||
146 | blocksize = label->cms.block_size; | ||
147 | if (label->cms.disk_offset != 0) { | ||
148 | snprintf(tmp, sizeof(tmp), "CMS1/%8s(MDSK):", name); | ||
149 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
150 | /* disk is reserved minidisk */ | ||
151 | offset = label->cms.disk_offset; | ||
152 | size = (label->cms.block_count - 1) | ||
153 | * (blocksize >> 9); | ||
154 | } else { | ||
155 | snprintf(tmp, sizeof(tmp), "CMS1/%8s:", name); | ||
156 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
157 | offset = (info->label_block + 1); | ||
158 | size = label->cms.block_count | ||
159 | * (blocksize >> 9); | ||
160 | } | ||
161 | put_partition(state, 1, offset*(blocksize >> 9), | ||
162 | size-offset*(blocksize >> 9)); | ||
163 | } else { | ||
164 | if (strncmp(type, "LNX1", 4) == 0) { | ||
165 | snprintf(tmp, sizeof(tmp), "LNX1/%8s:", name); | ||
166 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
167 | if (label->lnx.ldl_version == 0xf2) { | ||
168 | fmt_size = label->lnx.formatted_blocks | ||
169 | * (blocksize >> 9); | ||
170 | } else if (!strcmp(info->type, "ECKD")) { | ||
171 | /* formated w/o large volume support */ | ||
172 | fmt_size = geo->cylinders * geo->heads | ||
173 | * geo->sectors * (blocksize >> 9); | ||
174 | } else { | ||
175 | /* old label and no usable disk geometry | ||
176 | * (e.g. DIAG) */ | ||
177 | fmt_size = i_size >> 9; | ||
178 | } | ||
179 | size = i_size >> 9; | ||
180 | if (fmt_size < size) | ||
181 | size = fmt_size; | ||
182 | offset = (info->label_block + 1); | ||
183 | } else { | ||
184 | /* unlabeled disk */ | ||
185 | strlcat(state->pp_buf, "(nonl)", PAGE_SIZE); | ||
186 | size = i_size >> 9; | ||
187 | offset = (info->label_block + 1); | ||
188 | } | ||
189 | put_partition(state, 1, offset*(blocksize >> 9), | ||
190 | size-offset*(blocksize >> 9)); | ||
191 | } | ||
192 | } else if (info->format == DASD_FORMAT_CDL) { | ||
193 | /* | ||
194 | * New style CDL formatted disk | ||
195 | */ | ||
196 | sector_t blk; | ||
197 | int counter; | ||
198 | |||
199 | /* | ||
200 | * check if VOL1 label is available | ||
201 | * if not, something is wrong, skipping partition detection | ||
202 | */ | ||
203 | if (strncmp(type, "VOL1", 4) == 0) { | ||
204 | snprintf(tmp, sizeof(tmp), "VOL1/%8s:", name); | ||
205 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
206 | /* | ||
207 | * get block number and read then go through format1 | ||
208 | * labels | ||
209 | */ | ||
210 | blk = cchhb2blk(&label->vol.vtoc, geo) + 1; | ||
211 | counter = 0; | ||
212 | data = read_part_sector(state, blk * (blocksize/512), | ||
213 | §); | ||
214 | while (data != NULL) { | ||
215 | struct vtoc_format1_label f1; | ||
216 | |||
217 | memcpy(&f1, data, | ||
218 | sizeof(struct vtoc_format1_label)); | ||
219 | put_dev_sector(sect); | ||
220 | |||
221 | /* skip FMT4 / FMT5 / FMT7 labels */ | ||
222 | if (f1.DS1FMTID == _ascebc['4'] | ||
223 | || f1.DS1FMTID == _ascebc['5'] | ||
224 | || f1.DS1FMTID == _ascebc['7'] | ||
225 | || f1.DS1FMTID == _ascebc['9']) { | ||
226 | blk++; | ||
227 | data = read_part_sector(state, | ||
228 | blk * (blocksize/512), §); | ||
229 | continue; | ||
230 | } | ||
231 | |||
232 | /* only FMT1 and 8 labels valid at this point */ | ||
233 | if (f1.DS1FMTID != _ascebc['1'] && | ||
234 | f1.DS1FMTID != _ascebc['8']) | ||
235 | break; | ||
236 | |||
237 | /* OK, we got valid partition data */ | ||
238 | offset = cchh2blk(&f1.DS1EXT1.llimit, geo); | ||
239 | size = cchh2blk(&f1.DS1EXT1.ulimit, geo) - | ||
240 | offset + geo->sectors; | ||
241 | if (counter >= state->limit) | ||
242 | break; | ||
243 | put_partition(state, counter + 1, | ||
244 | offset * (blocksize >> 9), | ||
245 | size * (blocksize >> 9)); | ||
246 | counter++; | ||
247 | blk++; | ||
248 | data = read_part_sector(state, | ||
249 | blk * (blocksize/512), §); | ||
250 | } | ||
251 | |||
252 | if (!data) | ||
253 | /* Are we not supposed to report this ? */ | ||
254 | goto out_readerr; | ||
255 | } else | ||
256 | printk(KERN_WARNING "Warning, expected Label VOL1 not " | ||
257 | "found, treating as CDL formated Disk"); | ||
258 | |||
259 | } | ||
260 | |||
261 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
262 | goto out_freeall; | ||
263 | |||
264 | |||
265 | out_readerr: | ||
266 | res = -1; | ||
267 | out_freeall: | ||
268 | kfree(label); | ||
269 | out_nolab: | ||
270 | kfree(geo); | ||
271 | out_nogeo: | ||
272 | kfree(info); | ||
273 | out_exit: | ||
274 | return res; | ||
275 | } | ||
diff --git a/fs/partitions/ibm.h b/fs/partitions/ibm.h deleted file mode 100644 index 08fb0804a812..000000000000 --- a/fs/partitions/ibm.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | int ibm_partition(struct parsed_partitions *); | ||
diff --git a/fs/partitions/karma.c b/fs/partitions/karma.c deleted file mode 100644 index 0ea19312706b..000000000000 --- a/fs/partitions/karma.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/karma.c | ||
3 | * Rio Karma partition info. | ||
4 | * | ||
5 | * Copyright (C) 2006 Bob Copeland (me@bobcopeland.com) | ||
6 | * based on osf.c | ||
7 | */ | ||
8 | |||
9 | #include "check.h" | ||
10 | #include "karma.h" | ||
11 | |||
12 | int karma_partition(struct parsed_partitions *state) | ||
13 | { | ||
14 | int i; | ||
15 | int slot = 1; | ||
16 | Sector sect; | ||
17 | unsigned char *data; | ||
18 | struct disklabel { | ||
19 | u8 d_reserved[270]; | ||
20 | struct d_partition { | ||
21 | __le32 p_res; | ||
22 | u8 p_fstype; | ||
23 | u8 p_res2[3]; | ||
24 | __le32 p_offset; | ||
25 | __le32 p_size; | ||
26 | } d_partitions[2]; | ||
27 | u8 d_blank[208]; | ||
28 | __le16 d_magic; | ||
29 | } __attribute__((packed)) *label; | ||
30 | struct d_partition *p; | ||
31 | |||
32 | data = read_part_sector(state, 0, §); | ||
33 | if (!data) | ||
34 | return -1; | ||
35 | |||
36 | label = (struct disklabel *)data; | ||
37 | if (le16_to_cpu(label->d_magic) != KARMA_LABEL_MAGIC) { | ||
38 | put_dev_sector(sect); | ||
39 | return 0; | ||
40 | } | ||
41 | |||
42 | p = label->d_partitions; | ||
43 | for (i = 0 ; i < 2; i++, p++) { | ||
44 | if (slot == state->limit) | ||
45 | break; | ||
46 | |||
47 | if (p->p_fstype == 0x4d && le32_to_cpu(p->p_size)) { | ||
48 | put_partition(state, slot, le32_to_cpu(p->p_offset), | ||
49 | le32_to_cpu(p->p_size)); | ||
50 | } | ||
51 | slot++; | ||
52 | } | ||
53 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
54 | put_dev_sector(sect); | ||
55 | return 1; | ||
56 | } | ||
57 | |||
diff --git a/fs/partitions/karma.h b/fs/partitions/karma.h deleted file mode 100644 index c764b2e9df21..000000000000 --- a/fs/partitions/karma.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/karma.h | ||
3 | */ | ||
4 | |||
5 | #define KARMA_LABEL_MAGIC 0xAB56 | ||
6 | |||
7 | int karma_partition(struct parsed_partitions *state); | ||
8 | |||
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c deleted file mode 100644 index bd8ae788f689..000000000000 --- a/fs/partitions/ldm.c +++ /dev/null | |||
@@ -1,1570 +0,0 @@ | |||
1 | /** | ||
2 | * ldm - Support for Windows Logical Disk Manager (Dynamic Disks) | ||
3 | * | ||
4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> | ||
5 | * Copyright (c) 2001-2007 Anton Altaparmakov | ||
6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> | ||
7 | * | ||
8 | * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it under | ||
11 | * the terms of the GNU General Public License as published by the Free Software | ||
12 | * Foundation; either version 2 of the License, or (at your option) any later | ||
13 | * version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, but WITHOUT | ||
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
17 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
18 | * details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License along with | ||
21 | * this program (in the main directory of the source in the file COPYING); if | ||
22 | * not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
23 | * Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | #include <linux/slab.h> | ||
27 | #include <linux/pagemap.h> | ||
28 | #include <linux/stringify.h> | ||
29 | #include <linux/kernel.h> | ||
30 | #include "ldm.h" | ||
31 | #include "check.h" | ||
32 | #include "msdos.h" | ||
33 | |||
34 | /** | ||
35 | * ldm_debug/info/error/crit - Output an error message | ||
36 | * @f: A printf format string containing the message | ||
37 | * @...: Variables to substitute into @f | ||
38 | * | ||
39 | * ldm_debug() writes a DEBUG level message to the syslog but only if the | ||
40 | * driver was compiled with debug enabled. Otherwise, the call turns into a NOP. | ||
41 | */ | ||
42 | #ifndef CONFIG_LDM_DEBUG | ||
43 | #define ldm_debug(...) do {} while (0) | ||
44 | #else | ||
45 | #define ldm_debug(f, a...) _ldm_printk (KERN_DEBUG, __func__, f, ##a) | ||
46 | #endif | ||
47 | |||
48 | #define ldm_crit(f, a...) _ldm_printk (KERN_CRIT, __func__, f, ##a) | ||
49 | #define ldm_error(f, a...) _ldm_printk (KERN_ERR, __func__, f, ##a) | ||
50 | #define ldm_info(f, a...) _ldm_printk (KERN_INFO, __func__, f, ##a) | ||
51 | |||
52 | static __printf(3, 4) | ||
53 | void _ldm_printk(const char *level, const char *function, const char *fmt, ...) | ||
54 | { | ||
55 | struct va_format vaf; | ||
56 | va_list args; | ||
57 | |||
58 | va_start (args, fmt); | ||
59 | |||
60 | vaf.fmt = fmt; | ||
61 | vaf.va = &args; | ||
62 | |||
63 | printk("%s%s(): %pV\n", level, function, &vaf); | ||
64 | |||
65 | va_end(args); | ||
66 | } | ||
67 | |||
68 | /** | ||
69 | * ldm_parse_hexbyte - Convert a ASCII hex number to a byte | ||
70 | * @src: Pointer to at least 2 characters to convert. | ||
71 | * | ||
72 | * Convert a two character ASCII hex string to a number. | ||
73 | * | ||
74 | * Return: 0-255 Success, the byte was parsed correctly | ||
75 | * -1 Error, an invalid character was supplied | ||
76 | */ | ||
77 | static int ldm_parse_hexbyte (const u8 *src) | ||
78 | { | ||
79 | unsigned int x; /* For correct wrapping */ | ||
80 | int h; | ||
81 | |||
82 | /* high part */ | ||
83 | x = h = hex_to_bin(src[0]); | ||
84 | if (h < 0) | ||
85 | return -1; | ||
86 | |||
87 | /* low part */ | ||
88 | h = hex_to_bin(src[1]); | ||
89 | if (h < 0) | ||
90 | return -1; | ||
91 | |||
92 | return (x << 4) + h; | ||
93 | } | ||
94 | |||
95 | /** | ||
96 | * ldm_parse_guid - Convert GUID from ASCII to binary | ||
97 | * @src: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba | ||
98 | * @dest: Memory block to hold binary GUID (16 bytes) | ||
99 | * | ||
100 | * N.B. The GUID need not be NULL terminated. | ||
101 | * | ||
102 | * Return: 'true' @dest contains binary GUID | ||
103 | * 'false' @dest contents are undefined | ||
104 | */ | ||
105 | static bool ldm_parse_guid (const u8 *src, u8 *dest) | ||
106 | { | ||
107 | static const int size[] = { 4, 2, 2, 2, 6 }; | ||
108 | int i, j, v; | ||
109 | |||
110 | if (src[8] != '-' || src[13] != '-' || | ||
111 | src[18] != '-' || src[23] != '-') | ||
112 | return false; | ||
113 | |||
114 | for (j = 0; j < 5; j++, src++) | ||
115 | for (i = 0; i < size[j]; i++, src+=2, *dest++ = v) | ||
116 | if ((v = ldm_parse_hexbyte (src)) < 0) | ||
117 | return false; | ||
118 | |||
119 | return true; | ||
120 | } | ||
121 | |||
122 | /** | ||
123 | * ldm_parse_privhead - Read the LDM Database PRIVHEAD structure | ||
124 | * @data: Raw database PRIVHEAD structure loaded from the device | ||
125 | * @ph: In-memory privhead structure in which to return parsed information | ||
126 | * | ||
127 | * This parses the LDM database PRIVHEAD structure supplied in @data and | ||
128 | * sets up the in-memory privhead structure @ph with the obtained information. | ||
129 | * | ||
130 | * Return: 'true' @ph contains the PRIVHEAD data | ||
131 | * 'false' @ph contents are undefined | ||
132 | */ | ||
133 | static bool ldm_parse_privhead(const u8 *data, struct privhead *ph) | ||
134 | { | ||
135 | bool is_vista = false; | ||
136 | |||
137 | BUG_ON(!data || !ph); | ||
138 | if (MAGIC_PRIVHEAD != get_unaligned_be64(data)) { | ||
139 | ldm_error("Cannot find PRIVHEAD structure. LDM database is" | ||
140 | " corrupt. Aborting."); | ||
141 | return false; | ||
142 | } | ||
143 | ph->ver_major = get_unaligned_be16(data + 0x000C); | ||
144 | ph->ver_minor = get_unaligned_be16(data + 0x000E); | ||
145 | ph->logical_disk_start = get_unaligned_be64(data + 0x011B); | ||
146 | ph->logical_disk_size = get_unaligned_be64(data + 0x0123); | ||
147 | ph->config_start = get_unaligned_be64(data + 0x012B); | ||
148 | ph->config_size = get_unaligned_be64(data + 0x0133); | ||
149 | /* Version 2.11 is Win2k/XP and version 2.12 is Vista. */ | ||
150 | if (ph->ver_major == 2 && ph->ver_minor == 12) | ||
151 | is_vista = true; | ||
152 | if (!is_vista && (ph->ver_major != 2 || ph->ver_minor != 11)) { | ||
153 | ldm_error("Expected PRIVHEAD version 2.11 or 2.12, got %d.%d." | ||
154 | " Aborting.", ph->ver_major, ph->ver_minor); | ||
155 | return false; | ||
156 | } | ||
157 | ldm_debug("PRIVHEAD version %d.%d (Windows %s).", ph->ver_major, | ||
158 | ph->ver_minor, is_vista ? "Vista" : "2000/XP"); | ||
159 | if (ph->config_size != LDM_DB_SIZE) { /* 1 MiB in sectors. */ | ||
160 | /* Warn the user and continue, carefully. */ | ||
161 | ldm_info("Database is normally %u bytes, it claims to " | ||
162 | "be %llu bytes.", LDM_DB_SIZE, | ||
163 | (unsigned long long)ph->config_size); | ||
164 | } | ||
165 | if ((ph->logical_disk_size == 0) || (ph->logical_disk_start + | ||
166 | ph->logical_disk_size > ph->config_start)) { | ||
167 | ldm_error("PRIVHEAD disk size doesn't match real disk size"); | ||
168 | return false; | ||
169 | } | ||
170 | if (!ldm_parse_guid(data + 0x0030, ph->disk_id)) { | ||
171 | ldm_error("PRIVHEAD contains an invalid GUID."); | ||
172 | return false; | ||
173 | } | ||
174 | ldm_debug("Parsed PRIVHEAD successfully."); | ||
175 | return true; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * ldm_parse_tocblock - Read the LDM Database TOCBLOCK structure | ||
180 | * @data: Raw database TOCBLOCK structure loaded from the device | ||
181 | * @toc: In-memory toc structure in which to return parsed information | ||
182 | * | ||
183 | * This parses the LDM Database TOCBLOCK (table of contents) structure supplied | ||
184 | * in @data and sets up the in-memory tocblock structure @toc with the obtained | ||
185 | * information. | ||
186 | * | ||
187 | * N.B. The *_start and *_size values returned in @toc are not range-checked. | ||
188 | * | ||
189 | * Return: 'true' @toc contains the TOCBLOCK data | ||
190 | * 'false' @toc contents are undefined | ||
191 | */ | ||
192 | static bool ldm_parse_tocblock (const u8 *data, struct tocblock *toc) | ||
193 | { | ||
194 | BUG_ON (!data || !toc); | ||
195 | |||
196 | if (MAGIC_TOCBLOCK != get_unaligned_be64(data)) { | ||
197 | ldm_crit ("Cannot find TOCBLOCK, database may be corrupt."); | ||
198 | return false; | ||
199 | } | ||
200 | strncpy (toc->bitmap1_name, data + 0x24, sizeof (toc->bitmap1_name)); | ||
201 | toc->bitmap1_name[sizeof (toc->bitmap1_name) - 1] = 0; | ||
202 | toc->bitmap1_start = get_unaligned_be64(data + 0x2E); | ||
203 | toc->bitmap1_size = get_unaligned_be64(data + 0x36); | ||
204 | |||
205 | if (strncmp (toc->bitmap1_name, TOC_BITMAP1, | ||
206 | sizeof (toc->bitmap1_name)) != 0) { | ||
207 | ldm_crit ("TOCBLOCK's first bitmap is '%s', should be '%s'.", | ||
208 | TOC_BITMAP1, toc->bitmap1_name); | ||
209 | return false; | ||
210 | } | ||
211 | strncpy (toc->bitmap2_name, data + 0x46, sizeof (toc->bitmap2_name)); | ||
212 | toc->bitmap2_name[sizeof (toc->bitmap2_name) - 1] = 0; | ||
213 | toc->bitmap2_start = get_unaligned_be64(data + 0x50); | ||
214 | toc->bitmap2_size = get_unaligned_be64(data + 0x58); | ||
215 | if (strncmp (toc->bitmap2_name, TOC_BITMAP2, | ||
216 | sizeof (toc->bitmap2_name)) != 0) { | ||
217 | ldm_crit ("TOCBLOCK's second bitmap is '%s', should be '%s'.", | ||
218 | TOC_BITMAP2, toc->bitmap2_name); | ||
219 | return false; | ||
220 | } | ||
221 | ldm_debug ("Parsed TOCBLOCK successfully."); | ||
222 | return true; | ||
223 | } | ||
224 | |||
225 | /** | ||
226 | * ldm_parse_vmdb - Read the LDM Database VMDB structure | ||
227 | * @data: Raw database VMDB structure loaded from the device | ||
228 | * @vm: In-memory vmdb structure in which to return parsed information | ||
229 | * | ||
230 | * This parses the LDM Database VMDB structure supplied in @data and sets up | ||
231 | * the in-memory vmdb structure @vm with the obtained information. | ||
232 | * | ||
233 | * N.B. The *_start, *_size and *_seq values will be range-checked later. | ||
234 | * | ||
235 | * Return: 'true' @vm contains VMDB info | ||
236 | * 'false' @vm contents are undefined | ||
237 | */ | ||
238 | static bool ldm_parse_vmdb (const u8 *data, struct vmdb *vm) | ||
239 | { | ||
240 | BUG_ON (!data || !vm); | ||
241 | |||
242 | if (MAGIC_VMDB != get_unaligned_be32(data)) { | ||
243 | ldm_crit ("Cannot find the VMDB, database may be corrupt."); | ||
244 | return false; | ||
245 | } | ||
246 | |||
247 | vm->ver_major = get_unaligned_be16(data + 0x12); | ||
248 | vm->ver_minor = get_unaligned_be16(data + 0x14); | ||
249 | if ((vm->ver_major != 4) || (vm->ver_minor != 10)) { | ||
250 | ldm_error ("Expected VMDB version %d.%d, got %d.%d. " | ||
251 | "Aborting.", 4, 10, vm->ver_major, vm->ver_minor); | ||
252 | return false; | ||
253 | } | ||
254 | |||
255 | vm->vblk_size = get_unaligned_be32(data + 0x08); | ||
256 | if (vm->vblk_size == 0) { | ||
257 | ldm_error ("Illegal VBLK size"); | ||
258 | return false; | ||
259 | } | ||
260 | |||
261 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); | ||
262 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); | ||
263 | |||
264 | ldm_debug ("Parsed VMDB successfully."); | ||
265 | return true; | ||
266 | } | ||
267 | |||
268 | /** | ||
269 | * ldm_compare_privheads - Compare two privhead objects | ||
270 | * @ph1: First privhead | ||
271 | * @ph2: Second privhead | ||
272 | * | ||
273 | * This compares the two privhead structures @ph1 and @ph2. | ||
274 | * | ||
275 | * Return: 'true' Identical | ||
276 | * 'false' Different | ||
277 | */ | ||
278 | static bool ldm_compare_privheads (const struct privhead *ph1, | ||
279 | const struct privhead *ph2) | ||
280 | { | ||
281 | BUG_ON (!ph1 || !ph2); | ||
282 | |||
283 | return ((ph1->ver_major == ph2->ver_major) && | ||
284 | (ph1->ver_minor == ph2->ver_minor) && | ||
285 | (ph1->logical_disk_start == ph2->logical_disk_start) && | ||
286 | (ph1->logical_disk_size == ph2->logical_disk_size) && | ||
287 | (ph1->config_start == ph2->config_start) && | ||
288 | (ph1->config_size == ph2->config_size) && | ||
289 | !memcmp (ph1->disk_id, ph2->disk_id, GUID_SIZE)); | ||
290 | } | ||
291 | |||
292 | /** | ||
293 | * ldm_compare_tocblocks - Compare two tocblock objects | ||
294 | * @toc1: First toc | ||
295 | * @toc2: Second toc | ||
296 | * | ||
297 | * This compares the two tocblock structures @toc1 and @toc2. | ||
298 | * | ||
299 | * Return: 'true' Identical | ||
300 | * 'false' Different | ||
301 | */ | ||
302 | static bool ldm_compare_tocblocks (const struct tocblock *toc1, | ||
303 | const struct tocblock *toc2) | ||
304 | { | ||
305 | BUG_ON (!toc1 || !toc2); | ||
306 | |||
307 | return ((toc1->bitmap1_start == toc2->bitmap1_start) && | ||
308 | (toc1->bitmap1_size == toc2->bitmap1_size) && | ||
309 | (toc1->bitmap2_start == toc2->bitmap2_start) && | ||
310 | (toc1->bitmap2_size == toc2->bitmap2_size) && | ||
311 | !strncmp (toc1->bitmap1_name, toc2->bitmap1_name, | ||
312 | sizeof (toc1->bitmap1_name)) && | ||
313 | !strncmp (toc1->bitmap2_name, toc2->bitmap2_name, | ||
314 | sizeof (toc1->bitmap2_name))); | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * ldm_validate_privheads - Compare the primary privhead with its backups | ||
319 | * @state: Partition check state including device holding the LDM Database | ||
320 | * @ph1: Memory struct to fill with ph contents | ||
321 | * | ||
322 | * Read and compare all three privheads from disk. | ||
323 | * | ||
324 | * The privheads on disk show the size and location of the main disk area and | ||
325 | * the configuration area (the database). The values are range-checked against | ||
326 | * @hd, which contains the real size of the disk. | ||
327 | * | ||
328 | * Return: 'true' Success | ||
329 | * 'false' Error | ||
330 | */ | ||
331 | static bool ldm_validate_privheads(struct parsed_partitions *state, | ||
332 | struct privhead *ph1) | ||
333 | { | ||
334 | static const int off[3] = { OFF_PRIV1, OFF_PRIV2, OFF_PRIV3 }; | ||
335 | struct privhead *ph[3] = { ph1 }; | ||
336 | Sector sect; | ||
337 | u8 *data; | ||
338 | bool result = false; | ||
339 | long num_sects; | ||
340 | int i; | ||
341 | |||
342 | BUG_ON (!state || !ph1); | ||
343 | |||
344 | ph[1] = kmalloc (sizeof (*ph[1]), GFP_KERNEL); | ||
345 | ph[2] = kmalloc (sizeof (*ph[2]), GFP_KERNEL); | ||
346 | if (!ph[1] || !ph[2]) { | ||
347 | ldm_crit ("Out of memory."); | ||
348 | goto out; | ||
349 | } | ||
350 | |||
351 | /* off[1 & 2] are relative to ph[0]->config_start */ | ||
352 | ph[0]->config_start = 0; | ||
353 | |||
354 | /* Read and parse privheads */ | ||
355 | for (i = 0; i < 3; i++) { | ||
356 | data = read_part_sector(state, ph[0]->config_start + off[i], | ||
357 | §); | ||
358 | if (!data) { | ||
359 | ldm_crit ("Disk read failed."); | ||
360 | goto out; | ||
361 | } | ||
362 | result = ldm_parse_privhead (data, ph[i]); | ||
363 | put_dev_sector (sect); | ||
364 | if (!result) { | ||
365 | ldm_error ("Cannot find PRIVHEAD %d.", i+1); /* Log again */ | ||
366 | if (i < 2) | ||
367 | goto out; /* Already logged */ | ||
368 | else | ||
369 | break; /* FIXME ignore for now, 3rd PH can fail on odd-sized disks */ | ||
370 | } | ||
371 | } | ||
372 | |||
373 | num_sects = state->bdev->bd_inode->i_size >> 9; | ||
374 | |||
375 | if ((ph[0]->config_start > num_sects) || | ||
376 | ((ph[0]->config_start + ph[0]->config_size) > num_sects)) { | ||
377 | ldm_crit ("Database extends beyond the end of the disk."); | ||
378 | goto out; | ||
379 | } | ||
380 | |||
381 | if ((ph[0]->logical_disk_start > ph[0]->config_start) || | ||
382 | ((ph[0]->logical_disk_start + ph[0]->logical_disk_size) | ||
383 | > ph[0]->config_start)) { | ||
384 | ldm_crit ("Disk and database overlap."); | ||
385 | goto out; | ||
386 | } | ||
387 | |||
388 | if (!ldm_compare_privheads (ph[0], ph[1])) { | ||
389 | ldm_crit ("Primary and backup PRIVHEADs don't match."); | ||
390 | goto out; | ||
391 | } | ||
392 | /* FIXME ignore this for now | ||
393 | if (!ldm_compare_privheads (ph[0], ph[2])) { | ||
394 | ldm_crit ("Primary and backup PRIVHEADs don't match."); | ||
395 | goto out; | ||
396 | }*/ | ||
397 | ldm_debug ("Validated PRIVHEADs successfully."); | ||
398 | result = true; | ||
399 | out: | ||
400 | kfree (ph[1]); | ||
401 | kfree (ph[2]); | ||
402 | return result; | ||
403 | } | ||
404 | |||
405 | /** | ||
406 | * ldm_validate_tocblocks - Validate the table of contents and its backups | ||
407 | * @state: Partition check state including device holding the LDM Database | ||
408 | * @base: Offset, into @state->bdev, of the database | ||
409 | * @ldb: Cache of the database structures | ||
410 | * | ||
411 | * Find and compare the four tables of contents of the LDM Database stored on | ||
412 | * @state->bdev and return the parsed information into @toc1. | ||
413 | * | ||
414 | * The offsets and sizes of the configs are range-checked against a privhead. | ||
415 | * | ||
416 | * Return: 'true' @toc1 contains validated TOCBLOCK info | ||
417 | * 'false' @toc1 contents are undefined | ||
418 | */ | ||
419 | static bool ldm_validate_tocblocks(struct parsed_partitions *state, | ||
420 | unsigned long base, struct ldmdb *ldb) | ||
421 | { | ||
422 | static const int off[4] = { OFF_TOCB1, OFF_TOCB2, OFF_TOCB3, OFF_TOCB4}; | ||
423 | struct tocblock *tb[4]; | ||
424 | struct privhead *ph; | ||
425 | Sector sect; | ||
426 | u8 *data; | ||
427 | int i, nr_tbs; | ||
428 | bool result = false; | ||
429 | |||
430 | BUG_ON(!state || !ldb); | ||
431 | ph = &ldb->ph; | ||
432 | tb[0] = &ldb->toc; | ||
433 | tb[1] = kmalloc(sizeof(*tb[1]) * 3, GFP_KERNEL); | ||
434 | if (!tb[1]) { | ||
435 | ldm_crit("Out of memory."); | ||
436 | goto err; | ||
437 | } | ||
438 | tb[2] = (struct tocblock*)((u8*)tb[1] + sizeof(*tb[1])); | ||
439 | tb[3] = (struct tocblock*)((u8*)tb[2] + sizeof(*tb[2])); | ||
440 | /* | ||
441 | * Try to read and parse all four TOCBLOCKs. | ||
442 | * | ||
443 | * Windows Vista LDM v2.12 does not always have all four TOCBLOCKs so | ||
444 | * skip any that fail as long as we get at least one valid TOCBLOCK. | ||
445 | */ | ||
446 | for (nr_tbs = i = 0; i < 4; i++) { | ||
447 | data = read_part_sector(state, base + off[i], §); | ||
448 | if (!data) { | ||
449 | ldm_error("Disk read failed for TOCBLOCK %d.", i); | ||
450 | continue; | ||
451 | } | ||
452 | if (ldm_parse_tocblock(data, tb[nr_tbs])) | ||
453 | nr_tbs++; | ||
454 | put_dev_sector(sect); | ||
455 | } | ||
456 | if (!nr_tbs) { | ||
457 | ldm_crit("Failed to find a valid TOCBLOCK."); | ||
458 | goto err; | ||
459 | } | ||
460 | /* Range check the TOCBLOCK against a privhead. */ | ||
461 | if (((tb[0]->bitmap1_start + tb[0]->bitmap1_size) > ph->config_size) || | ||
462 | ((tb[0]->bitmap2_start + tb[0]->bitmap2_size) > | ||
463 | ph->config_size)) { | ||
464 | ldm_crit("The bitmaps are out of range. Giving up."); | ||
465 | goto err; | ||
466 | } | ||
467 | /* Compare all loaded TOCBLOCKs. */ | ||
468 | for (i = 1; i < nr_tbs; i++) { | ||
469 | if (!ldm_compare_tocblocks(tb[0], tb[i])) { | ||
470 | ldm_crit("TOCBLOCKs 0 and %d do not match.", i); | ||
471 | goto err; | ||
472 | } | ||
473 | } | ||
474 | ldm_debug("Validated %d TOCBLOCKs successfully.", nr_tbs); | ||
475 | result = true; | ||
476 | err: | ||
477 | kfree(tb[1]); | ||
478 | return result; | ||
479 | } | ||
480 | |||
481 | /** | ||
482 | * ldm_validate_vmdb - Read the VMDB and validate it | ||
483 | * @state: Partition check state including device holding the LDM Database | ||
484 | * @base: Offset, into @bdev, of the database | ||
485 | * @ldb: Cache of the database structures | ||
486 | * | ||
487 | * Find the vmdb of the LDM Database stored on @bdev and return the parsed | ||
488 | * information in @ldb. | ||
489 | * | ||
490 | * Return: 'true' @ldb contains validated VBDB info | ||
491 | * 'false' @ldb contents are undefined | ||
492 | */ | ||
493 | static bool ldm_validate_vmdb(struct parsed_partitions *state, | ||
494 | unsigned long base, struct ldmdb *ldb) | ||
495 | { | ||
496 | Sector sect; | ||
497 | u8 *data; | ||
498 | bool result = false; | ||
499 | struct vmdb *vm; | ||
500 | struct tocblock *toc; | ||
501 | |||
502 | BUG_ON (!state || !ldb); | ||
503 | |||
504 | vm = &ldb->vm; | ||
505 | toc = &ldb->toc; | ||
506 | |||
507 | data = read_part_sector(state, base + OFF_VMDB, §); | ||
508 | if (!data) { | ||
509 | ldm_crit ("Disk read failed."); | ||
510 | return false; | ||
511 | } | ||
512 | |||
513 | if (!ldm_parse_vmdb (data, vm)) | ||
514 | goto out; /* Already logged */ | ||
515 | |||
516 | /* Are there uncommitted transactions? */ | ||
517 | if (get_unaligned_be16(data + 0x10) != 0x01) { | ||
518 | ldm_crit ("Database is not in a consistent state. Aborting."); | ||
519 | goto out; | ||
520 | } | ||
521 | |||
522 | if (vm->vblk_offset != 512) | ||
523 | ldm_info ("VBLKs start at offset 0x%04x.", vm->vblk_offset); | ||
524 | |||
525 | /* | ||
526 | * The last_vblkd_seq can be before the end of the vmdb, just make sure | ||
527 | * it is not out of bounds. | ||
528 | */ | ||
529 | if ((vm->vblk_size * vm->last_vblk_seq) > (toc->bitmap1_size << 9)) { | ||
530 | ldm_crit ("VMDB exceeds allowed size specified by TOCBLOCK. " | ||
531 | "Database is corrupt. Aborting."); | ||
532 | goto out; | ||
533 | } | ||
534 | |||
535 | result = true; | ||
536 | out: | ||
537 | put_dev_sector (sect); | ||
538 | return result; | ||
539 | } | ||
540 | |||
541 | |||
542 | /** | ||
543 | * ldm_validate_partition_table - Determine whether bdev might be a dynamic disk | ||
544 | * @state: Partition check state including device holding the LDM Database | ||
545 | * | ||
546 | * This function provides a weak test to decide whether the device is a dynamic | ||
547 | * disk or not. It looks for an MS-DOS-style partition table containing at | ||
548 | * least one partition of type 0x42 (formerly SFS, now used by Windows for | ||
549 | * dynamic disks). | ||
550 | * | ||
551 | * N.B. The only possible error can come from the read_part_sector and that is | ||
552 | * only likely to happen if the underlying device is strange. If that IS | ||
553 | * the case we should return zero to let someone else try. | ||
554 | * | ||
555 | * Return: 'true' @state->bdev is a dynamic disk | ||
556 | * 'false' @state->bdev is not a dynamic disk, or an error occurred | ||
557 | */ | ||
558 | static bool ldm_validate_partition_table(struct parsed_partitions *state) | ||
559 | { | ||
560 | Sector sect; | ||
561 | u8 *data; | ||
562 | struct partition *p; | ||
563 | int i; | ||
564 | bool result = false; | ||
565 | |||
566 | BUG_ON(!state); | ||
567 | |||
568 | data = read_part_sector(state, 0, §); | ||
569 | if (!data) { | ||
570 | ldm_info ("Disk read failed."); | ||
571 | return false; | ||
572 | } | ||
573 | |||
574 | if (*(__le16*) (data + 0x01FE) != cpu_to_le16 (MSDOS_LABEL_MAGIC)) | ||
575 | goto out; | ||
576 | |||
577 | p = (struct partition*)(data + 0x01BE); | ||
578 | for (i = 0; i < 4; i++, p++) | ||
579 | if (SYS_IND (p) == LDM_PARTITION) { | ||
580 | result = true; | ||
581 | break; | ||
582 | } | ||
583 | |||
584 | if (result) | ||
585 | ldm_debug ("Found W2K dynamic disk partition type."); | ||
586 | |||
587 | out: | ||
588 | put_dev_sector (sect); | ||
589 | return result; | ||
590 | } | ||
591 | |||
592 | /** | ||
593 | * ldm_get_disk_objid - Search a linked list of vblk's for a given Disk Id | ||
594 | * @ldb: Cache of the database structures | ||
595 | * | ||
596 | * The LDM Database contains a list of all partitions on all dynamic disks. | ||
597 | * The primary PRIVHEAD, at the beginning of the physical disk, tells us | ||
598 | * the GUID of this disk. This function searches for the GUID in a linked | ||
599 | * list of vblk's. | ||
600 | * | ||
601 | * Return: Pointer, A matching vblk was found | ||
602 | * NULL, No match, or an error | ||
603 | */ | ||
604 | static struct vblk * ldm_get_disk_objid (const struct ldmdb *ldb) | ||
605 | { | ||
606 | struct list_head *item; | ||
607 | |||
608 | BUG_ON (!ldb); | ||
609 | |||
610 | list_for_each (item, &ldb->v_disk) { | ||
611 | struct vblk *v = list_entry (item, struct vblk, list); | ||
612 | if (!memcmp (v->vblk.disk.disk_id, ldb->ph.disk_id, GUID_SIZE)) | ||
613 | return v; | ||
614 | } | ||
615 | |||
616 | return NULL; | ||
617 | } | ||
618 | |||
619 | /** | ||
620 | * ldm_create_data_partitions - Create data partitions for this device | ||
621 | * @pp: List of the partitions parsed so far | ||
622 | * @ldb: Cache of the database structures | ||
623 | * | ||
624 | * The database contains ALL the partitions for ALL disk groups, so we need to | ||
625 | * filter out this specific disk. Using the disk's object id, we can find all | ||
626 | * the partitions in the database that belong to this disk. | ||
627 | * | ||
628 | * Add each partition in our database, to the parsed_partitions structure. | ||
629 | * | ||
630 | * N.B. This function creates the partitions in the order it finds partition | ||
631 | * objects in the linked list. | ||
632 | * | ||
633 | * Return: 'true' Partition created | ||
634 | * 'false' Error, probably a range checking problem | ||
635 | */ | ||
636 | static bool ldm_create_data_partitions (struct parsed_partitions *pp, | ||
637 | const struct ldmdb *ldb) | ||
638 | { | ||
639 | struct list_head *item; | ||
640 | struct vblk *vb; | ||
641 | struct vblk *disk; | ||
642 | struct vblk_part *part; | ||
643 | int part_num = 1; | ||
644 | |||
645 | BUG_ON (!pp || !ldb); | ||
646 | |||
647 | disk = ldm_get_disk_objid (ldb); | ||
648 | if (!disk) { | ||
649 | ldm_crit ("Can't find the ID of this disk in the database."); | ||
650 | return false; | ||
651 | } | ||
652 | |||
653 | strlcat(pp->pp_buf, " [LDM]", PAGE_SIZE); | ||
654 | |||
655 | /* Create the data partitions */ | ||
656 | list_for_each (item, &ldb->v_part) { | ||
657 | vb = list_entry (item, struct vblk, list); | ||
658 | part = &vb->vblk.part; | ||
659 | |||
660 | if (part->disk_id != disk->obj_id) | ||
661 | continue; | ||
662 | |||
663 | put_partition (pp, part_num, ldb->ph.logical_disk_start + | ||
664 | part->start, part->size); | ||
665 | part_num++; | ||
666 | } | ||
667 | |||
668 | strlcat(pp->pp_buf, "\n", PAGE_SIZE); | ||
669 | return true; | ||
670 | } | ||
671 | |||
672 | |||
673 | /** | ||
674 | * ldm_relative - Calculate the next relative offset | ||
675 | * @buffer: Block of data being worked on | ||
676 | * @buflen: Size of the block of data | ||
677 | * @base: Size of the previous fixed width fields | ||
678 | * @offset: Cumulative size of the previous variable-width fields | ||
679 | * | ||
680 | * Because many of the VBLK fields are variable-width, it's necessary | ||
681 | * to calculate each offset based on the previous one and the length | ||
682 | * of the field it pointed to. | ||
683 | * | ||
684 | * Return: -1 Error, the calculated offset exceeded the size of the buffer | ||
685 | * n OK, a range-checked offset into buffer | ||
686 | */ | ||
687 | static int ldm_relative(const u8 *buffer, int buflen, int base, int offset) | ||
688 | { | ||
689 | |||
690 | base += offset; | ||
691 | if (!buffer || offset < 0 || base > buflen) { | ||
692 | if (!buffer) | ||
693 | ldm_error("!buffer"); | ||
694 | if (offset < 0) | ||
695 | ldm_error("offset (%d) < 0", offset); | ||
696 | if (base > buflen) | ||
697 | ldm_error("base (%d) > buflen (%d)", base, buflen); | ||
698 | return -1; | ||
699 | } | ||
700 | if (base + buffer[base] >= buflen) { | ||
701 | ldm_error("base (%d) + buffer[base] (%d) >= buflen (%d)", base, | ||
702 | buffer[base], buflen); | ||
703 | return -1; | ||
704 | } | ||
705 | return buffer[base] + offset + 1; | ||
706 | } | ||
707 | |||
708 | /** | ||
709 | * ldm_get_vnum - Convert a variable-width, big endian number, into cpu order | ||
710 | * @block: Pointer to the variable-width number to convert | ||
711 | * | ||
712 | * Large numbers in the LDM Database are often stored in a packed format. Each | ||
713 | * number is prefixed by a one byte width marker. All numbers in the database | ||
714 | * are stored in big-endian byte order. This function reads one of these | ||
715 | * numbers and returns the result | ||
716 | * | ||
717 | * N.B. This function DOES NOT perform any range checking, though the most | ||
718 | * it will read is eight bytes. | ||
719 | * | ||
720 | * Return: n A number | ||
721 | * 0 Zero, or an error occurred | ||
722 | */ | ||
723 | static u64 ldm_get_vnum (const u8 *block) | ||
724 | { | ||
725 | u64 tmp = 0; | ||
726 | u8 length; | ||
727 | |||
728 | BUG_ON (!block); | ||
729 | |||
730 | length = *block++; | ||
731 | |||
732 | if (length && length <= 8) | ||
733 | while (length--) | ||
734 | tmp = (tmp << 8) | *block++; | ||
735 | else | ||
736 | ldm_error ("Illegal length %d.", length); | ||
737 | |||
738 | return tmp; | ||
739 | } | ||
740 | |||
741 | /** | ||
742 | * ldm_get_vstr - Read a length-prefixed string into a buffer | ||
743 | * @block: Pointer to the length marker | ||
744 | * @buffer: Location to copy string to | ||
745 | * @buflen: Size of the output buffer | ||
746 | * | ||
747 | * Many of the strings in the LDM Database are not NULL terminated. Instead | ||
748 | * they are prefixed by a one byte length marker. This function copies one of | ||
749 | * these strings into a buffer. | ||
750 | * | ||
751 | * N.B. This function DOES NOT perform any range checking on the input. | ||
752 | * If the buffer is too small, the output will be truncated. | ||
753 | * | ||
754 | * Return: 0, Error and @buffer contents are undefined | ||
755 | * n, String length in characters (excluding NULL) | ||
756 | * buflen-1, String was truncated. | ||
757 | */ | ||
758 | static int ldm_get_vstr (const u8 *block, u8 *buffer, int buflen) | ||
759 | { | ||
760 | int length; | ||
761 | |||
762 | BUG_ON (!block || !buffer); | ||
763 | |||
764 | length = block[0]; | ||
765 | if (length >= buflen) { | ||
766 | ldm_error ("Truncating string %d -> %d.", length, buflen); | ||
767 | length = buflen - 1; | ||
768 | } | ||
769 | memcpy (buffer, block + 1, length); | ||
770 | buffer[length] = 0; | ||
771 | return length; | ||
772 | } | ||
773 | |||
774 | |||
775 | /** | ||
776 | * ldm_parse_cmp3 - Read a raw VBLK Component object into a vblk structure | ||
777 | * @buffer: Block of data being worked on | ||
778 | * @buflen: Size of the block of data | ||
779 | * @vb: In-memory vblk in which to return information | ||
780 | * | ||
781 | * Read a raw VBLK Component object (version 3) into a vblk structure. | ||
782 | * | ||
783 | * Return: 'true' @vb contains a Component VBLK | ||
784 | * 'false' @vb contents are not defined | ||
785 | */ | ||
786 | static bool ldm_parse_cmp3 (const u8 *buffer, int buflen, struct vblk *vb) | ||
787 | { | ||
788 | int r_objid, r_name, r_vstate, r_child, r_parent, r_stripe, r_cols, len; | ||
789 | struct vblk_comp *comp; | ||
790 | |||
791 | BUG_ON (!buffer || !vb); | ||
792 | |||
793 | r_objid = ldm_relative (buffer, buflen, 0x18, 0); | ||
794 | r_name = ldm_relative (buffer, buflen, 0x18, r_objid); | ||
795 | r_vstate = ldm_relative (buffer, buflen, 0x18, r_name); | ||
796 | r_child = ldm_relative (buffer, buflen, 0x1D, r_vstate); | ||
797 | r_parent = ldm_relative (buffer, buflen, 0x2D, r_child); | ||
798 | |||
799 | if (buffer[0x12] & VBLK_FLAG_COMP_STRIPE) { | ||
800 | r_stripe = ldm_relative (buffer, buflen, 0x2E, r_parent); | ||
801 | r_cols = ldm_relative (buffer, buflen, 0x2E, r_stripe); | ||
802 | len = r_cols; | ||
803 | } else { | ||
804 | r_stripe = 0; | ||
805 | r_cols = 0; | ||
806 | len = r_parent; | ||
807 | } | ||
808 | if (len < 0) | ||
809 | return false; | ||
810 | |||
811 | len += VBLK_SIZE_CMP3; | ||
812 | if (len != get_unaligned_be32(buffer + 0x14)) | ||
813 | return false; | ||
814 | |||
815 | comp = &vb->vblk.comp; | ||
816 | ldm_get_vstr (buffer + 0x18 + r_name, comp->state, | ||
817 | sizeof (comp->state)); | ||
818 | comp->type = buffer[0x18 + r_vstate]; | ||
819 | comp->children = ldm_get_vnum (buffer + 0x1D + r_vstate); | ||
820 | comp->parent_id = ldm_get_vnum (buffer + 0x2D + r_child); | ||
821 | comp->chunksize = r_stripe ? ldm_get_vnum (buffer+r_parent+0x2E) : 0; | ||
822 | |||
823 | return true; | ||
824 | } | ||
825 | |||
826 | /** | ||
827 | * ldm_parse_dgr3 - Read a raw VBLK Disk Group object into a vblk structure | ||
828 | * @buffer: Block of data being worked on | ||
829 | * @buflen: Size of the block of data | ||
830 | * @vb: In-memory vblk in which to return information | ||
831 | * | ||
832 | * Read a raw VBLK Disk Group object (version 3) into a vblk structure. | ||
833 | * | ||
834 | * Return: 'true' @vb contains a Disk Group VBLK | ||
835 | * 'false' @vb contents are not defined | ||
836 | */ | ||
837 | static int ldm_parse_dgr3 (const u8 *buffer, int buflen, struct vblk *vb) | ||
838 | { | ||
839 | int r_objid, r_name, r_diskid, r_id1, r_id2, len; | ||
840 | struct vblk_dgrp *dgrp; | ||
841 | |||
842 | BUG_ON (!buffer || !vb); | ||
843 | |||
844 | r_objid = ldm_relative (buffer, buflen, 0x18, 0); | ||
845 | r_name = ldm_relative (buffer, buflen, 0x18, r_objid); | ||
846 | r_diskid = ldm_relative (buffer, buflen, 0x18, r_name); | ||
847 | |||
848 | if (buffer[0x12] & VBLK_FLAG_DGR3_IDS) { | ||
849 | r_id1 = ldm_relative (buffer, buflen, 0x24, r_diskid); | ||
850 | r_id2 = ldm_relative (buffer, buflen, 0x24, r_id1); | ||
851 | len = r_id2; | ||
852 | } else { | ||
853 | r_id1 = 0; | ||
854 | r_id2 = 0; | ||
855 | len = r_diskid; | ||
856 | } | ||
857 | if (len < 0) | ||
858 | return false; | ||
859 | |||
860 | len += VBLK_SIZE_DGR3; | ||
861 | if (len != get_unaligned_be32(buffer + 0x14)) | ||
862 | return false; | ||
863 | |||
864 | dgrp = &vb->vblk.dgrp; | ||
865 | ldm_get_vstr (buffer + 0x18 + r_name, dgrp->disk_id, | ||
866 | sizeof (dgrp->disk_id)); | ||
867 | return true; | ||
868 | } | ||
869 | |||
870 | /** | ||
871 | * ldm_parse_dgr4 - Read a raw VBLK Disk Group object into a vblk structure | ||
872 | * @buffer: Block of data being worked on | ||
873 | * @buflen: Size of the block of data | ||
874 | * @vb: In-memory vblk in which to return information | ||
875 | * | ||
876 | * Read a raw VBLK Disk Group object (version 4) into a vblk structure. | ||
877 | * | ||
878 | * Return: 'true' @vb contains a Disk Group VBLK | ||
879 | * 'false' @vb contents are not defined | ||
880 | */ | ||
881 | static bool ldm_parse_dgr4 (const u8 *buffer, int buflen, struct vblk *vb) | ||
882 | { | ||
883 | char buf[64]; | ||
884 | int r_objid, r_name, r_id1, r_id2, len; | ||
885 | struct vblk_dgrp *dgrp; | ||
886 | |||
887 | BUG_ON (!buffer || !vb); | ||
888 | |||
889 | r_objid = ldm_relative (buffer, buflen, 0x18, 0); | ||
890 | r_name = ldm_relative (buffer, buflen, 0x18, r_objid); | ||
891 | |||
892 | if (buffer[0x12] & VBLK_FLAG_DGR4_IDS) { | ||
893 | r_id1 = ldm_relative (buffer, buflen, 0x44, r_name); | ||
894 | r_id2 = ldm_relative (buffer, buflen, 0x44, r_id1); | ||
895 | len = r_id2; | ||
896 | } else { | ||
897 | r_id1 = 0; | ||
898 | r_id2 = 0; | ||
899 | len = r_name; | ||
900 | } | ||
901 | if (len < 0) | ||
902 | return false; | ||
903 | |||
904 | len += VBLK_SIZE_DGR4; | ||
905 | if (len != get_unaligned_be32(buffer + 0x14)) | ||
906 | return false; | ||
907 | |||
908 | dgrp = &vb->vblk.dgrp; | ||
909 | |||
910 | ldm_get_vstr (buffer + 0x18 + r_objid, buf, sizeof (buf)); | ||
911 | return true; | ||
912 | } | ||
913 | |||
914 | /** | ||
915 | * ldm_parse_dsk3 - Read a raw VBLK Disk object into a vblk structure | ||
916 | * @buffer: Block of data being worked on | ||
917 | * @buflen: Size of the block of data | ||
918 | * @vb: In-memory vblk in which to return information | ||
919 | * | ||
920 | * Read a raw VBLK Disk object (version 3) into a vblk structure. | ||
921 | * | ||
922 | * Return: 'true' @vb contains a Disk VBLK | ||
923 | * 'false' @vb contents are not defined | ||
924 | */ | ||
925 | static bool ldm_parse_dsk3 (const u8 *buffer, int buflen, struct vblk *vb) | ||
926 | { | ||
927 | int r_objid, r_name, r_diskid, r_altname, len; | ||
928 | struct vblk_disk *disk; | ||
929 | |||
930 | BUG_ON (!buffer || !vb); | ||
931 | |||
932 | r_objid = ldm_relative (buffer, buflen, 0x18, 0); | ||
933 | r_name = ldm_relative (buffer, buflen, 0x18, r_objid); | ||
934 | r_diskid = ldm_relative (buffer, buflen, 0x18, r_name); | ||
935 | r_altname = ldm_relative (buffer, buflen, 0x18, r_diskid); | ||
936 | len = r_altname; | ||
937 | if (len < 0) | ||
938 | return false; | ||
939 | |||
940 | len += VBLK_SIZE_DSK3; | ||
941 | if (len != get_unaligned_be32(buffer + 0x14)) | ||
942 | return false; | ||
943 | |||
944 | disk = &vb->vblk.disk; | ||
945 | ldm_get_vstr (buffer + 0x18 + r_diskid, disk->alt_name, | ||
946 | sizeof (disk->alt_name)); | ||
947 | if (!ldm_parse_guid (buffer + 0x19 + r_name, disk->disk_id)) | ||
948 | return false; | ||
949 | |||
950 | return true; | ||
951 | } | ||
952 | |||
953 | /** | ||
954 | * ldm_parse_dsk4 - Read a raw VBLK Disk object into a vblk structure | ||
955 | * @buffer: Block of data being worked on | ||
956 | * @buflen: Size of the block of data | ||
957 | * @vb: In-memory vblk in which to return information | ||
958 | * | ||
959 | * Read a raw VBLK Disk object (version 4) into a vblk structure. | ||
960 | * | ||
961 | * Return: 'true' @vb contains a Disk VBLK | ||
962 | * 'false' @vb contents are not defined | ||
963 | */ | ||
964 | static bool ldm_parse_dsk4 (const u8 *buffer, int buflen, struct vblk *vb) | ||
965 | { | ||
966 | int r_objid, r_name, len; | ||
967 | struct vblk_disk *disk; | ||
968 | |||
969 | BUG_ON (!buffer || !vb); | ||
970 | |||
971 | r_objid = ldm_relative (buffer, buflen, 0x18, 0); | ||
972 | r_name = ldm_relative (buffer, buflen, 0x18, r_objid); | ||
973 | len = r_name; | ||
974 | if (len < 0) | ||
975 | return false; | ||
976 | |||
977 | len += VBLK_SIZE_DSK4; | ||
978 | if (len != get_unaligned_be32(buffer + 0x14)) | ||
979 | return false; | ||
980 | |||
981 | disk = &vb->vblk.disk; | ||
982 | memcpy (disk->disk_id, buffer + 0x18 + r_name, GUID_SIZE); | ||
983 | return true; | ||
984 | } | ||
985 | |||
986 | /** | ||
987 | * ldm_parse_prt3 - Read a raw VBLK Partition object into a vblk structure | ||
988 | * @buffer: Block of data being worked on | ||
989 | * @buflen: Size of the block of data | ||
990 | * @vb: In-memory vblk in which to return information | ||
991 | * | ||
992 | * Read a raw VBLK Partition object (version 3) into a vblk structure. | ||
993 | * | ||
994 | * Return: 'true' @vb contains a Partition VBLK | ||
995 | * 'false' @vb contents are not defined | ||
996 | */ | ||
997 | static bool ldm_parse_prt3(const u8 *buffer, int buflen, struct vblk *vb) | ||
998 | { | ||
999 | int r_objid, r_name, r_size, r_parent, r_diskid, r_index, len; | ||
1000 | struct vblk_part *part; | ||
1001 | |||
1002 | BUG_ON(!buffer || !vb); | ||
1003 | r_objid = ldm_relative(buffer, buflen, 0x18, 0); | ||
1004 | if (r_objid < 0) { | ||
1005 | ldm_error("r_objid %d < 0", r_objid); | ||
1006 | return false; | ||
1007 | } | ||
1008 | r_name = ldm_relative(buffer, buflen, 0x18, r_objid); | ||
1009 | if (r_name < 0) { | ||
1010 | ldm_error("r_name %d < 0", r_name); | ||
1011 | return false; | ||
1012 | } | ||
1013 | r_size = ldm_relative(buffer, buflen, 0x34, r_name); | ||
1014 | if (r_size < 0) { | ||
1015 | ldm_error("r_size %d < 0", r_size); | ||
1016 | return false; | ||
1017 | } | ||
1018 | r_parent = ldm_relative(buffer, buflen, 0x34, r_size); | ||
1019 | if (r_parent < 0) { | ||
1020 | ldm_error("r_parent %d < 0", r_parent); | ||
1021 | return false; | ||
1022 | } | ||
1023 | r_diskid = ldm_relative(buffer, buflen, 0x34, r_parent); | ||
1024 | if (r_diskid < 0) { | ||
1025 | ldm_error("r_diskid %d < 0", r_diskid); | ||
1026 | return false; | ||
1027 | } | ||
1028 | if (buffer[0x12] & VBLK_FLAG_PART_INDEX) { | ||
1029 | r_index = ldm_relative(buffer, buflen, 0x34, r_diskid); | ||
1030 | if (r_index < 0) { | ||
1031 | ldm_error("r_index %d < 0", r_index); | ||
1032 | return false; | ||
1033 | } | ||
1034 | len = r_index; | ||
1035 | } else { | ||
1036 | r_index = 0; | ||
1037 | len = r_diskid; | ||
1038 | } | ||
1039 | if (len < 0) { | ||
1040 | ldm_error("len %d < 0", len); | ||
1041 | return false; | ||
1042 | } | ||
1043 | len += VBLK_SIZE_PRT3; | ||
1044 | if (len > get_unaligned_be32(buffer + 0x14)) { | ||
1045 | ldm_error("len %d > BE32(buffer + 0x14) %d", len, | ||
1046 | get_unaligned_be32(buffer + 0x14)); | ||
1047 | return false; | ||
1048 | } | ||
1049 | part = &vb->vblk.part; | ||
1050 | part->start = get_unaligned_be64(buffer + 0x24 + r_name); | ||
1051 | part->volume_offset = get_unaligned_be64(buffer + 0x2C + r_name); | ||
1052 | part->size = ldm_get_vnum(buffer + 0x34 + r_name); | ||
1053 | part->parent_id = ldm_get_vnum(buffer + 0x34 + r_size); | ||
1054 | part->disk_id = ldm_get_vnum(buffer + 0x34 + r_parent); | ||
1055 | if (vb->flags & VBLK_FLAG_PART_INDEX) | ||
1056 | part->partnum = buffer[0x35 + r_diskid]; | ||
1057 | else | ||
1058 | part->partnum = 0; | ||
1059 | return true; | ||
1060 | } | ||
1061 | |||
1062 | /** | ||
1063 | * ldm_parse_vol5 - Read a raw VBLK Volume object into a vblk structure | ||
1064 | * @buffer: Block of data being worked on | ||
1065 | * @buflen: Size of the block of data | ||
1066 | * @vb: In-memory vblk in which to return information | ||
1067 | * | ||
1068 | * Read a raw VBLK Volume object (version 5) into a vblk structure. | ||
1069 | * | ||
1070 | * Return: 'true' @vb contains a Volume VBLK | ||
1071 | * 'false' @vb contents are not defined | ||
1072 | */ | ||
1073 | static bool ldm_parse_vol5(const u8 *buffer, int buflen, struct vblk *vb) | ||
1074 | { | ||
1075 | int r_objid, r_name, r_vtype, r_disable_drive_letter, r_child, r_size; | ||
1076 | int r_id1, r_id2, r_size2, r_drive, len; | ||
1077 | struct vblk_volu *volu; | ||
1078 | |||
1079 | BUG_ON(!buffer || !vb); | ||
1080 | r_objid = ldm_relative(buffer, buflen, 0x18, 0); | ||
1081 | if (r_objid < 0) { | ||
1082 | ldm_error("r_objid %d < 0", r_objid); | ||
1083 | return false; | ||
1084 | } | ||
1085 | r_name = ldm_relative(buffer, buflen, 0x18, r_objid); | ||
1086 | if (r_name < 0) { | ||
1087 | ldm_error("r_name %d < 0", r_name); | ||
1088 | return false; | ||
1089 | } | ||
1090 | r_vtype = ldm_relative(buffer, buflen, 0x18, r_name); | ||
1091 | if (r_vtype < 0) { | ||
1092 | ldm_error("r_vtype %d < 0", r_vtype); | ||
1093 | return false; | ||
1094 | } | ||
1095 | r_disable_drive_letter = ldm_relative(buffer, buflen, 0x18, r_vtype); | ||
1096 | if (r_disable_drive_letter < 0) { | ||
1097 | ldm_error("r_disable_drive_letter %d < 0", | ||
1098 | r_disable_drive_letter); | ||
1099 | return false; | ||
1100 | } | ||
1101 | r_child = ldm_relative(buffer, buflen, 0x2D, r_disable_drive_letter); | ||
1102 | if (r_child < 0) { | ||
1103 | ldm_error("r_child %d < 0", r_child); | ||
1104 | return false; | ||
1105 | } | ||
1106 | r_size = ldm_relative(buffer, buflen, 0x3D, r_child); | ||
1107 | if (r_size < 0) { | ||
1108 | ldm_error("r_size %d < 0", r_size); | ||
1109 | return false; | ||
1110 | } | ||
1111 | if (buffer[0x12] & VBLK_FLAG_VOLU_ID1) { | ||
1112 | r_id1 = ldm_relative(buffer, buflen, 0x52, r_size); | ||
1113 | if (r_id1 < 0) { | ||
1114 | ldm_error("r_id1 %d < 0", r_id1); | ||
1115 | return false; | ||
1116 | } | ||
1117 | } else | ||
1118 | r_id1 = r_size; | ||
1119 | if (buffer[0x12] & VBLK_FLAG_VOLU_ID2) { | ||
1120 | r_id2 = ldm_relative(buffer, buflen, 0x52, r_id1); | ||
1121 | if (r_id2 < 0) { | ||
1122 | ldm_error("r_id2 %d < 0", r_id2); | ||
1123 | return false; | ||
1124 | } | ||
1125 | } else | ||
1126 | r_id2 = r_id1; | ||
1127 | if (buffer[0x12] & VBLK_FLAG_VOLU_SIZE) { | ||
1128 | r_size2 = ldm_relative(buffer, buflen, 0x52, r_id2); | ||
1129 | if (r_size2 < 0) { | ||
1130 | ldm_error("r_size2 %d < 0", r_size2); | ||
1131 | return false; | ||
1132 | } | ||
1133 | } else | ||
1134 | r_size2 = r_id2; | ||
1135 | if (buffer[0x12] & VBLK_FLAG_VOLU_DRIVE) { | ||
1136 | r_drive = ldm_relative(buffer, buflen, 0x52, r_size2); | ||
1137 | if (r_drive < 0) { | ||
1138 | ldm_error("r_drive %d < 0", r_drive); | ||
1139 | return false; | ||
1140 | } | ||
1141 | } else | ||
1142 | r_drive = r_size2; | ||
1143 | len = r_drive; | ||
1144 | if (len < 0) { | ||
1145 | ldm_error("len %d < 0", len); | ||
1146 | return false; | ||
1147 | } | ||
1148 | len += VBLK_SIZE_VOL5; | ||
1149 | if (len > get_unaligned_be32(buffer + 0x14)) { | ||
1150 | ldm_error("len %d > BE32(buffer + 0x14) %d", len, | ||
1151 | get_unaligned_be32(buffer + 0x14)); | ||
1152 | return false; | ||
1153 | } | ||
1154 | volu = &vb->vblk.volu; | ||
1155 | ldm_get_vstr(buffer + 0x18 + r_name, volu->volume_type, | ||
1156 | sizeof(volu->volume_type)); | ||
1157 | memcpy(volu->volume_state, buffer + 0x18 + r_disable_drive_letter, | ||
1158 | sizeof(volu->volume_state)); | ||
1159 | volu->size = ldm_get_vnum(buffer + 0x3D + r_child); | ||
1160 | volu->partition_type = buffer[0x41 + r_size]; | ||
1161 | memcpy(volu->guid, buffer + 0x42 + r_size, sizeof(volu->guid)); | ||
1162 | if (buffer[0x12] & VBLK_FLAG_VOLU_DRIVE) { | ||
1163 | ldm_get_vstr(buffer + 0x52 + r_size, volu->drive_hint, | ||
1164 | sizeof(volu->drive_hint)); | ||
1165 | } | ||
1166 | return true; | ||
1167 | } | ||
1168 | |||
1169 | /** | ||
1170 | * ldm_parse_vblk - Read a raw VBLK object into a vblk structure | ||
1171 | * @buf: Block of data being worked on | ||
1172 | * @len: Size of the block of data | ||
1173 | * @vb: In-memory vblk in which to return information | ||
1174 | * | ||
1175 | * Read a raw VBLK object into a vblk structure. This function just reads the | ||
1176 | * information common to all VBLK types, then delegates the rest of the work to | ||
1177 | * helper functions: ldm_parse_*. | ||
1178 | * | ||
1179 | * Return: 'true' @vb contains a VBLK | ||
1180 | * 'false' @vb contents are not defined | ||
1181 | */ | ||
1182 | static bool ldm_parse_vblk (const u8 *buf, int len, struct vblk *vb) | ||
1183 | { | ||
1184 | bool result = false; | ||
1185 | int r_objid; | ||
1186 | |||
1187 | BUG_ON (!buf || !vb); | ||
1188 | |||
1189 | r_objid = ldm_relative (buf, len, 0x18, 0); | ||
1190 | if (r_objid < 0) { | ||
1191 | ldm_error ("VBLK header is corrupt."); | ||
1192 | return false; | ||
1193 | } | ||
1194 | |||
1195 | vb->flags = buf[0x12]; | ||
1196 | vb->type = buf[0x13]; | ||
1197 | vb->obj_id = ldm_get_vnum (buf + 0x18); | ||
1198 | ldm_get_vstr (buf+0x18+r_objid, vb->name, sizeof (vb->name)); | ||
1199 | |||
1200 | switch (vb->type) { | ||
1201 | case VBLK_CMP3: result = ldm_parse_cmp3 (buf, len, vb); break; | ||
1202 | case VBLK_DSK3: result = ldm_parse_dsk3 (buf, len, vb); break; | ||
1203 | case VBLK_DSK4: result = ldm_parse_dsk4 (buf, len, vb); break; | ||
1204 | case VBLK_DGR3: result = ldm_parse_dgr3 (buf, len, vb); break; | ||
1205 | case VBLK_DGR4: result = ldm_parse_dgr4 (buf, len, vb); break; | ||
1206 | case VBLK_PRT3: result = ldm_parse_prt3 (buf, len, vb); break; | ||
1207 | case VBLK_VOL5: result = ldm_parse_vol5 (buf, len, vb); break; | ||
1208 | } | ||
1209 | |||
1210 | if (result) | ||
1211 | ldm_debug ("Parsed VBLK 0x%llx (type: 0x%02x) ok.", | ||
1212 | (unsigned long long) vb->obj_id, vb->type); | ||
1213 | else | ||
1214 | ldm_error ("Failed to parse VBLK 0x%llx (type: 0x%02x).", | ||
1215 | (unsigned long long) vb->obj_id, vb->type); | ||
1216 | |||
1217 | return result; | ||
1218 | } | ||
1219 | |||
1220 | |||
1221 | /** | ||
1222 | * ldm_ldmdb_add - Adds a raw VBLK entry to the ldmdb database | ||
1223 | * @data: Raw VBLK to add to the database | ||
1224 | * @len: Size of the raw VBLK | ||
1225 | * @ldb: Cache of the database structures | ||
1226 | * | ||
1227 | * The VBLKs are sorted into categories. Partitions are also sorted by offset. | ||
1228 | * | ||
1229 | * N.B. This function does not check the validity of the VBLKs. | ||
1230 | * | ||
1231 | * Return: 'true' The VBLK was added | ||
1232 | * 'false' An error occurred | ||
1233 | */ | ||
1234 | static bool ldm_ldmdb_add (u8 *data, int len, struct ldmdb *ldb) | ||
1235 | { | ||
1236 | struct vblk *vb; | ||
1237 | struct list_head *item; | ||
1238 | |||
1239 | BUG_ON (!data || !ldb); | ||
1240 | |||
1241 | vb = kmalloc (sizeof (*vb), GFP_KERNEL); | ||
1242 | if (!vb) { | ||
1243 | ldm_crit ("Out of memory."); | ||
1244 | return false; | ||
1245 | } | ||
1246 | |||
1247 | if (!ldm_parse_vblk (data, len, vb)) { | ||
1248 | kfree(vb); | ||
1249 | return false; /* Already logged */ | ||
1250 | } | ||
1251 | |||
1252 | /* Put vblk into the correct list. */ | ||
1253 | switch (vb->type) { | ||
1254 | case VBLK_DGR3: | ||
1255 | case VBLK_DGR4: | ||
1256 | list_add (&vb->list, &ldb->v_dgrp); | ||
1257 | break; | ||
1258 | case VBLK_DSK3: | ||
1259 | case VBLK_DSK4: | ||
1260 | list_add (&vb->list, &ldb->v_disk); | ||
1261 | break; | ||
1262 | case VBLK_VOL5: | ||
1263 | list_add (&vb->list, &ldb->v_volu); | ||
1264 | break; | ||
1265 | case VBLK_CMP3: | ||
1266 | list_add (&vb->list, &ldb->v_comp); | ||
1267 | break; | ||
1268 | case VBLK_PRT3: | ||
1269 | /* Sort by the partition's start sector. */ | ||
1270 | list_for_each (item, &ldb->v_part) { | ||
1271 | struct vblk *v = list_entry (item, struct vblk, list); | ||
1272 | if ((v->vblk.part.disk_id == vb->vblk.part.disk_id) && | ||
1273 | (v->vblk.part.start > vb->vblk.part.start)) { | ||
1274 | list_add_tail (&vb->list, &v->list); | ||
1275 | return true; | ||
1276 | } | ||
1277 | } | ||
1278 | list_add_tail (&vb->list, &ldb->v_part); | ||
1279 | break; | ||
1280 | } | ||
1281 | return true; | ||
1282 | } | ||
1283 | |||
1284 | /** | ||
1285 | * ldm_frag_add - Add a VBLK fragment to a list | ||
1286 | * @data: Raw fragment to be added to the list | ||
1287 | * @size: Size of the raw fragment | ||
1288 | * @frags: Linked list of VBLK fragments | ||
1289 | * | ||
1290 | * Fragmented VBLKs may not be consecutive in the database, so they are placed | ||
1291 | * in a list so they can be pieced together later. | ||
1292 | * | ||
1293 | * Return: 'true' Success, the VBLK was added to the list | ||
1294 | * 'false' Error, a problem occurred | ||
1295 | */ | ||
1296 | static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) | ||
1297 | { | ||
1298 | struct frag *f; | ||
1299 | struct list_head *item; | ||
1300 | int rec, num, group; | ||
1301 | |||
1302 | BUG_ON (!data || !frags); | ||
1303 | |||
1304 | if (size < 2 * VBLK_SIZE_HEAD) { | ||
1305 | ldm_error("Value of size is to small."); | ||
1306 | return false; | ||
1307 | } | ||
1308 | |||
1309 | group = get_unaligned_be32(data + 0x08); | ||
1310 | rec = get_unaligned_be16(data + 0x0C); | ||
1311 | num = get_unaligned_be16(data + 0x0E); | ||
1312 | if ((num < 1) || (num > 4)) { | ||
1313 | ldm_error ("A VBLK claims to have %d parts.", num); | ||
1314 | return false; | ||
1315 | } | ||
1316 | if (rec >= num) { | ||
1317 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, num); | ||
1318 | return false; | ||
1319 | } | ||
1320 | |||
1321 | list_for_each (item, frags) { | ||
1322 | f = list_entry (item, struct frag, list); | ||
1323 | if (f->group == group) | ||
1324 | goto found; | ||
1325 | } | ||
1326 | |||
1327 | f = kmalloc (sizeof (*f) + size*num, GFP_KERNEL); | ||
1328 | if (!f) { | ||
1329 | ldm_crit ("Out of memory."); | ||
1330 | return false; | ||
1331 | } | ||
1332 | |||
1333 | f->group = group; | ||
1334 | f->num = num; | ||
1335 | f->rec = rec; | ||
1336 | f->map = 0xFF << num; | ||
1337 | |||
1338 | list_add_tail (&f->list, frags); | ||
1339 | found: | ||
1340 | if (rec >= f->num) { | ||
1341 | ldm_error("REC value (%d) exceeds NUM value (%d)", rec, f->num); | ||
1342 | return false; | ||
1343 | } | ||
1344 | |||
1345 | if (f->map & (1 << rec)) { | ||
1346 | ldm_error ("Duplicate VBLK, part %d.", rec); | ||
1347 | f->map &= 0x7F; /* Mark the group as broken */ | ||
1348 | return false; | ||
1349 | } | ||
1350 | |||
1351 | f->map |= (1 << rec); | ||
1352 | |||
1353 | data += VBLK_SIZE_HEAD; | ||
1354 | size -= VBLK_SIZE_HEAD; | ||
1355 | |||
1356 | memcpy (f->data+rec*(size-VBLK_SIZE_HEAD)+VBLK_SIZE_HEAD, data, size); | ||
1357 | |||
1358 | return true; | ||
1359 | } | ||
1360 | |||
1361 | /** | ||
1362 | * ldm_frag_free - Free a linked list of VBLK fragments | ||
1363 | * @list: Linked list of fragments | ||
1364 | * | ||
1365 | * Free a linked list of VBLK fragments | ||
1366 | * | ||
1367 | * Return: none | ||
1368 | */ | ||
1369 | static void ldm_frag_free (struct list_head *list) | ||
1370 | { | ||
1371 | struct list_head *item, *tmp; | ||
1372 | |||
1373 | BUG_ON (!list); | ||
1374 | |||
1375 | list_for_each_safe (item, tmp, list) | ||
1376 | kfree (list_entry (item, struct frag, list)); | ||
1377 | } | ||
1378 | |||
1379 | /** | ||
1380 | * ldm_frag_commit - Validate fragmented VBLKs and add them to the database | ||
1381 | * @frags: Linked list of VBLK fragments | ||
1382 | * @ldb: Cache of the database structures | ||
1383 | * | ||
1384 | * Now that all the fragmented VBLKs have been collected, they must be added to | ||
1385 | * the database for later use. | ||
1386 | * | ||
1387 | * Return: 'true' All the fragments we added successfully | ||
1388 | * 'false' One or more of the fragments we invalid | ||
1389 | */ | ||
1390 | static bool ldm_frag_commit (struct list_head *frags, struct ldmdb *ldb) | ||
1391 | { | ||
1392 | struct frag *f; | ||
1393 | struct list_head *item; | ||
1394 | |||
1395 | BUG_ON (!frags || !ldb); | ||
1396 | |||
1397 | list_for_each (item, frags) { | ||
1398 | f = list_entry (item, struct frag, list); | ||
1399 | |||
1400 | if (f->map != 0xFF) { | ||
1401 | ldm_error ("VBLK group %d is incomplete (0x%02x).", | ||
1402 | f->group, f->map); | ||
1403 | return false; | ||
1404 | } | ||
1405 | |||
1406 | if (!ldm_ldmdb_add (f->data, f->num*ldb->vm.vblk_size, ldb)) | ||
1407 | return false; /* Already logged */ | ||
1408 | } | ||
1409 | return true; | ||
1410 | } | ||
1411 | |||
1412 | /** | ||
1413 | * ldm_get_vblks - Read the on-disk database of VBLKs into memory | ||
1414 | * @state: Partition check state including device holding the LDM Database | ||
1415 | * @base: Offset, into @state->bdev, of the database | ||
1416 | * @ldb: Cache of the database structures | ||
1417 | * | ||
1418 | * To use the information from the VBLKs, they need to be read from the disk, | ||
1419 | * unpacked and validated. We cache them in @ldb according to their type. | ||
1420 | * | ||
1421 | * Return: 'true' All the VBLKs were read successfully | ||
1422 | * 'false' An error occurred | ||
1423 | */ | ||
1424 | static bool ldm_get_vblks(struct parsed_partitions *state, unsigned long base, | ||
1425 | struct ldmdb *ldb) | ||
1426 | { | ||
1427 | int size, perbuf, skip, finish, s, v, recs; | ||
1428 | u8 *data = NULL; | ||
1429 | Sector sect; | ||
1430 | bool result = false; | ||
1431 | LIST_HEAD (frags); | ||
1432 | |||
1433 | BUG_ON(!state || !ldb); | ||
1434 | |||
1435 | size = ldb->vm.vblk_size; | ||
1436 | perbuf = 512 / size; | ||
1437 | skip = ldb->vm.vblk_offset >> 9; /* Bytes to sectors */ | ||
1438 | finish = (size * ldb->vm.last_vblk_seq) >> 9; | ||
1439 | |||
1440 | for (s = skip; s < finish; s++) { /* For each sector */ | ||
1441 | data = read_part_sector(state, base + OFF_VMDB + s, §); | ||
1442 | if (!data) { | ||
1443 | ldm_crit ("Disk read failed."); | ||
1444 | goto out; | ||
1445 | } | ||
1446 | |||
1447 | for (v = 0; v < perbuf; v++, data+=size) { /* For each vblk */ | ||
1448 | if (MAGIC_VBLK != get_unaligned_be32(data)) { | ||
1449 | ldm_error ("Expected to find a VBLK."); | ||
1450 | goto out; | ||
1451 | } | ||
1452 | |||
1453 | recs = get_unaligned_be16(data + 0x0E); /* Number of records */ | ||
1454 | if (recs == 1) { | ||
1455 | if (!ldm_ldmdb_add (data, size, ldb)) | ||
1456 | goto out; /* Already logged */ | ||
1457 | } else if (recs > 1) { | ||
1458 | if (!ldm_frag_add (data, size, &frags)) | ||
1459 | goto out; /* Already logged */ | ||
1460 | } | ||
1461 | /* else Record is not in use, ignore it. */ | ||
1462 | } | ||
1463 | put_dev_sector (sect); | ||
1464 | data = NULL; | ||
1465 | } | ||
1466 | |||
1467 | result = ldm_frag_commit (&frags, ldb); /* Failures, already logged */ | ||
1468 | out: | ||
1469 | if (data) | ||
1470 | put_dev_sector (sect); | ||
1471 | ldm_frag_free (&frags); | ||
1472 | |||
1473 | return result; | ||
1474 | } | ||
1475 | |||
1476 | /** | ||
1477 | * ldm_free_vblks - Free a linked list of vblk's | ||
1478 | * @lh: Head of a linked list of struct vblk | ||
1479 | * | ||
1480 | * Free a list of vblk's and free the memory used to maintain the list. | ||
1481 | * | ||
1482 | * Return: none | ||
1483 | */ | ||
1484 | static void ldm_free_vblks (struct list_head *lh) | ||
1485 | { | ||
1486 | struct list_head *item, *tmp; | ||
1487 | |||
1488 | BUG_ON (!lh); | ||
1489 | |||
1490 | list_for_each_safe (item, tmp, lh) | ||
1491 | kfree (list_entry (item, struct vblk, list)); | ||
1492 | } | ||
1493 | |||
1494 | |||
1495 | /** | ||
1496 | * ldm_partition - Find out whether a device is a dynamic disk and handle it | ||
1497 | * @state: Partition check state including device holding the LDM Database | ||
1498 | * | ||
1499 | * This determines whether the device @bdev is a dynamic disk and if so creates | ||
1500 | * the partitions necessary in the gendisk structure pointed to by @hd. | ||
1501 | * | ||
1502 | * We create a dummy device 1, which contains the LDM database, and then create | ||
1503 | * each partition described by the LDM database in sequence as devices 2+. For | ||
1504 | * example, if the device is hda, we would have: hda1: LDM database, hda2, hda3, | ||
1505 | * and so on: the actual data containing partitions. | ||
1506 | * | ||
1507 | * Return: 1 Success, @state->bdev is a dynamic disk and we handled it | ||
1508 | * 0 Success, @state->bdev is not a dynamic disk | ||
1509 | * -1 An error occurred before enough information had been read | ||
1510 | * Or @state->bdev is a dynamic disk, but it may be corrupted | ||
1511 | */ | ||
1512 | int ldm_partition(struct parsed_partitions *state) | ||
1513 | { | ||
1514 | struct ldmdb *ldb; | ||
1515 | unsigned long base; | ||
1516 | int result = -1; | ||
1517 | |||
1518 | BUG_ON(!state); | ||
1519 | |||
1520 | /* Look for signs of a Dynamic Disk */ | ||
1521 | if (!ldm_validate_partition_table(state)) | ||
1522 | return 0; | ||
1523 | |||
1524 | ldb = kmalloc (sizeof (*ldb), GFP_KERNEL); | ||
1525 | if (!ldb) { | ||
1526 | ldm_crit ("Out of memory."); | ||
1527 | goto out; | ||
1528 | } | ||
1529 | |||
1530 | /* Parse and check privheads. */ | ||
1531 | if (!ldm_validate_privheads(state, &ldb->ph)) | ||
1532 | goto out; /* Already logged */ | ||
1533 | |||
1534 | /* All further references are relative to base (database start). */ | ||
1535 | base = ldb->ph.config_start; | ||
1536 | |||
1537 | /* Parse and check tocs and vmdb. */ | ||
1538 | if (!ldm_validate_tocblocks(state, base, ldb) || | ||
1539 | !ldm_validate_vmdb(state, base, ldb)) | ||
1540 | goto out; /* Already logged */ | ||
1541 | |||
1542 | /* Initialize vblk lists in ldmdb struct */ | ||
1543 | INIT_LIST_HEAD (&ldb->v_dgrp); | ||
1544 | INIT_LIST_HEAD (&ldb->v_disk); | ||
1545 | INIT_LIST_HEAD (&ldb->v_volu); | ||
1546 | INIT_LIST_HEAD (&ldb->v_comp); | ||
1547 | INIT_LIST_HEAD (&ldb->v_part); | ||
1548 | |||
1549 | if (!ldm_get_vblks(state, base, ldb)) { | ||
1550 | ldm_crit ("Failed to read the VBLKs from the database."); | ||
1551 | goto cleanup; | ||
1552 | } | ||
1553 | |||
1554 | /* Finally, create the data partition devices. */ | ||
1555 | if (ldm_create_data_partitions(state, ldb)) { | ||
1556 | ldm_debug ("Parsed LDM database successfully."); | ||
1557 | result = 1; | ||
1558 | } | ||
1559 | /* else Already logged */ | ||
1560 | |||
1561 | cleanup: | ||
1562 | ldm_free_vblks (&ldb->v_dgrp); | ||
1563 | ldm_free_vblks (&ldb->v_disk); | ||
1564 | ldm_free_vblks (&ldb->v_volu); | ||
1565 | ldm_free_vblks (&ldb->v_comp); | ||
1566 | ldm_free_vblks (&ldb->v_part); | ||
1567 | out: | ||
1568 | kfree (ldb); | ||
1569 | return result; | ||
1570 | } | ||
diff --git a/fs/partitions/ldm.h b/fs/partitions/ldm.h deleted file mode 100644 index 374242c0971a..000000000000 --- a/fs/partitions/ldm.h +++ /dev/null | |||
@@ -1,215 +0,0 @@ | |||
1 | /** | ||
2 | * ldm - Part of the Linux-NTFS project. | ||
3 | * | ||
4 | * Copyright (C) 2001,2002 Richard Russon <ldm@flatcap.org> | ||
5 | * Copyright (c) 2001-2007 Anton Altaparmakov | ||
6 | * Copyright (C) 2001,2002 Jakob Kemi <jakob.kemi@telia.com> | ||
7 | * | ||
8 | * Documentation is available at http://www.linux-ntfs.org/doku.php?id=downloads | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the Free | ||
12 | * Software Foundation; either version 2 of the License, or (at your option) | ||
13 | * any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program (in the main directory of the Linux-NTFS source | ||
22 | * in the file COPYING); if not, write to the Free Software Foundation, | ||
23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | #ifndef _FS_PT_LDM_H_ | ||
27 | #define _FS_PT_LDM_H_ | ||
28 | |||
29 | #include <linux/types.h> | ||
30 | #include <linux/list.h> | ||
31 | #include <linux/genhd.h> | ||
32 | #include <linux/fs.h> | ||
33 | #include <asm/unaligned.h> | ||
34 | #include <asm/byteorder.h> | ||
35 | |||
36 | struct parsed_partitions; | ||
37 | |||
38 | /* Magic numbers in CPU format. */ | ||
39 | #define MAGIC_VMDB 0x564D4442 /* VMDB */ | ||
40 | #define MAGIC_VBLK 0x56424C4B /* VBLK */ | ||
41 | #define MAGIC_PRIVHEAD 0x5052495648454144ULL /* PRIVHEAD */ | ||
42 | #define MAGIC_TOCBLOCK 0x544F43424C4F434BULL /* TOCBLOCK */ | ||
43 | |||
44 | /* The defined vblk types. */ | ||
45 | #define VBLK_VOL5 0x51 /* Volume, version 5 */ | ||
46 | #define VBLK_CMP3 0x32 /* Component, version 3 */ | ||
47 | #define VBLK_PRT3 0x33 /* Partition, version 3 */ | ||
48 | #define VBLK_DSK3 0x34 /* Disk, version 3 */ | ||
49 | #define VBLK_DSK4 0x44 /* Disk, version 4 */ | ||
50 | #define VBLK_DGR3 0x35 /* Disk Group, version 3 */ | ||
51 | #define VBLK_DGR4 0x45 /* Disk Group, version 4 */ | ||
52 | |||
53 | /* vblk flags indicating extra information will be present */ | ||
54 | #define VBLK_FLAG_COMP_STRIPE 0x10 | ||
55 | #define VBLK_FLAG_PART_INDEX 0x08 | ||
56 | #define VBLK_FLAG_DGR3_IDS 0x08 | ||
57 | #define VBLK_FLAG_DGR4_IDS 0x08 | ||
58 | #define VBLK_FLAG_VOLU_ID1 0x08 | ||
59 | #define VBLK_FLAG_VOLU_ID2 0x20 | ||
60 | #define VBLK_FLAG_VOLU_SIZE 0x80 | ||
61 | #define VBLK_FLAG_VOLU_DRIVE 0x02 | ||
62 | |||
63 | /* size of a vblk's static parts */ | ||
64 | #define VBLK_SIZE_HEAD 16 | ||
65 | #define VBLK_SIZE_CMP3 22 /* Name and version */ | ||
66 | #define VBLK_SIZE_DGR3 12 | ||
67 | #define VBLK_SIZE_DGR4 44 | ||
68 | #define VBLK_SIZE_DSK3 12 | ||
69 | #define VBLK_SIZE_DSK4 45 | ||
70 | #define VBLK_SIZE_PRT3 28 | ||
71 | #define VBLK_SIZE_VOL5 58 | ||
72 | |||
73 | /* component types */ | ||
74 | #define COMP_STRIPE 0x01 /* Stripe-set */ | ||
75 | #define COMP_BASIC 0x02 /* Basic disk */ | ||
76 | #define COMP_RAID 0x03 /* Raid-set */ | ||
77 | |||
78 | /* Other constants. */ | ||
79 | #define LDM_DB_SIZE 2048 /* Size in sectors (= 1MiB). */ | ||
80 | |||
81 | #define OFF_PRIV1 6 /* Offset of the first privhead | ||
82 | relative to the start of the | ||
83 | device in sectors */ | ||
84 | |||
85 | /* Offsets to structures within the LDM Database in sectors. */ | ||
86 | #define OFF_PRIV2 1856 /* Backup private headers. */ | ||
87 | #define OFF_PRIV3 2047 | ||
88 | |||
89 | #define OFF_TOCB1 1 /* Tables of contents. */ | ||
90 | #define OFF_TOCB2 2 | ||
91 | #define OFF_TOCB3 2045 | ||
92 | #define OFF_TOCB4 2046 | ||
93 | |||
94 | #define OFF_VMDB 17 /* List of partitions. */ | ||
95 | |||
96 | #define LDM_PARTITION 0x42 /* Formerly SFS (Landis). */ | ||
97 | |||
98 | #define TOC_BITMAP1 "config" /* Names of the two defined */ | ||
99 | #define TOC_BITMAP2 "log" /* bitmaps in the TOCBLOCK. */ | ||
100 | |||
101 | /* Borrowed from msdos.c */ | ||
102 | #define SYS_IND(p) (get_unaligned(&(p)->sys_ind)) | ||
103 | |||
104 | struct frag { /* VBLK Fragment handling */ | ||
105 | struct list_head list; | ||
106 | u32 group; | ||
107 | u8 num; /* Total number of records */ | ||
108 | u8 rec; /* This is record number n */ | ||
109 | u8 map; /* Which portions are in use */ | ||
110 | u8 data[0]; | ||
111 | }; | ||
112 | |||
113 | /* In memory LDM database structures. */ | ||
114 | |||
115 | #define GUID_SIZE 16 | ||
116 | |||
117 | struct privhead { /* Offsets and sizes are in sectors. */ | ||
118 | u16 ver_major; | ||
119 | u16 ver_minor; | ||
120 | u64 logical_disk_start; | ||
121 | u64 logical_disk_size; | ||
122 | u64 config_start; | ||
123 | u64 config_size; | ||
124 | u8 disk_id[GUID_SIZE]; | ||
125 | }; | ||
126 | |||
127 | struct tocblock { /* We have exactly two bitmaps. */ | ||
128 | u8 bitmap1_name[16]; | ||
129 | u64 bitmap1_start; | ||
130 | u64 bitmap1_size; | ||
131 | u8 bitmap2_name[16]; | ||
132 | u64 bitmap2_start; | ||
133 | u64 bitmap2_size; | ||
134 | }; | ||
135 | |||
136 | struct vmdb { /* VMDB: The database header */ | ||
137 | u16 ver_major; | ||
138 | u16 ver_minor; | ||
139 | u32 vblk_size; | ||
140 | u32 vblk_offset; | ||
141 | u32 last_vblk_seq; | ||
142 | }; | ||
143 | |||
144 | struct vblk_comp { /* VBLK Component */ | ||
145 | u8 state[16]; | ||
146 | u64 parent_id; | ||
147 | u8 type; | ||
148 | u8 children; | ||
149 | u16 chunksize; | ||
150 | }; | ||
151 | |||
152 | struct vblk_dgrp { /* VBLK Disk Group */ | ||
153 | u8 disk_id[64]; | ||
154 | }; | ||
155 | |||
156 | struct vblk_disk { /* VBLK Disk */ | ||
157 | u8 disk_id[GUID_SIZE]; | ||
158 | u8 alt_name[128]; | ||
159 | }; | ||
160 | |||
161 | struct vblk_part { /* VBLK Partition */ | ||
162 | u64 start; | ||
163 | u64 size; /* start, size and vol_off in sectors */ | ||
164 | u64 volume_offset; | ||
165 | u64 parent_id; | ||
166 | u64 disk_id; | ||
167 | u8 partnum; | ||
168 | }; | ||
169 | |||
170 | struct vblk_volu { /* VBLK Volume */ | ||
171 | u8 volume_type[16]; | ||
172 | u8 volume_state[16]; | ||
173 | u8 guid[16]; | ||
174 | u8 drive_hint[4]; | ||
175 | u64 size; | ||
176 | u8 partition_type; | ||
177 | }; | ||
178 | |||
179 | struct vblk_head { /* VBLK standard header */ | ||
180 | u32 group; | ||
181 | u16 rec; | ||
182 | u16 nrec; | ||
183 | }; | ||
184 | |||
185 | struct vblk { /* Generalised VBLK */ | ||
186 | u8 name[64]; | ||
187 | u64 obj_id; | ||
188 | u32 sequence; | ||
189 | u8 flags; | ||
190 | u8 type; | ||
191 | union { | ||
192 | struct vblk_comp comp; | ||
193 | struct vblk_dgrp dgrp; | ||
194 | struct vblk_disk disk; | ||
195 | struct vblk_part part; | ||
196 | struct vblk_volu volu; | ||
197 | } vblk; | ||
198 | struct list_head list; | ||
199 | }; | ||
200 | |||
201 | struct ldmdb { /* Cache of the database */ | ||
202 | struct privhead ph; | ||
203 | struct tocblock toc; | ||
204 | struct vmdb vm; | ||
205 | struct list_head v_dgrp; | ||
206 | struct list_head v_disk; | ||
207 | struct list_head v_volu; | ||
208 | struct list_head v_comp; | ||
209 | struct list_head v_part; | ||
210 | }; | ||
211 | |||
212 | int ldm_partition(struct parsed_partitions *state); | ||
213 | |||
214 | #endif /* _FS_PT_LDM_H_ */ | ||
215 | |||
diff --git a/fs/partitions/mac.c b/fs/partitions/mac.c deleted file mode 100644 index 11f688bd76c5..000000000000 --- a/fs/partitions/mac.c +++ /dev/null | |||
@@ -1,134 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/mac.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * Copyright (C) 1991-1998 Linus Torvalds | ||
6 | * Re-organised Feb 1998 Russell King | ||
7 | */ | ||
8 | |||
9 | #include <linux/ctype.h> | ||
10 | #include "check.h" | ||
11 | #include "mac.h" | ||
12 | |||
13 | #ifdef CONFIG_PPC_PMAC | ||
14 | #include <asm/machdep.h> | ||
15 | extern void note_bootable_part(dev_t dev, int part, int goodness); | ||
16 | #endif | ||
17 | |||
18 | /* | ||
19 | * Code to understand MacOS partition tables. | ||
20 | */ | ||
21 | |||
22 | static inline void mac_fix_string(char *stg, int len) | ||
23 | { | ||
24 | int i; | ||
25 | |||
26 | for (i = len - 1; i >= 0 && stg[i] == ' '; i--) | ||
27 | stg[i] = 0; | ||
28 | } | ||
29 | |||
30 | int mac_partition(struct parsed_partitions *state) | ||
31 | { | ||
32 | Sector sect; | ||
33 | unsigned char *data; | ||
34 | int slot, blocks_in_map; | ||
35 | unsigned secsize; | ||
36 | #ifdef CONFIG_PPC_PMAC | ||
37 | int found_root = 0; | ||
38 | int found_root_goodness = 0; | ||
39 | #endif | ||
40 | struct mac_partition *part; | ||
41 | struct mac_driver_desc *md; | ||
42 | |||
43 | /* Get 0th block and look at the first partition map entry. */ | ||
44 | md = read_part_sector(state, 0, §); | ||
45 | if (!md) | ||
46 | return -1; | ||
47 | if (be16_to_cpu(md->signature) != MAC_DRIVER_MAGIC) { | ||
48 | put_dev_sector(sect); | ||
49 | return 0; | ||
50 | } | ||
51 | secsize = be16_to_cpu(md->block_size); | ||
52 | put_dev_sector(sect); | ||
53 | data = read_part_sector(state, secsize/512, §); | ||
54 | if (!data) | ||
55 | return -1; | ||
56 | part = (struct mac_partition *) (data + secsize%512); | ||
57 | if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) { | ||
58 | put_dev_sector(sect); | ||
59 | return 0; /* not a MacOS disk */ | ||
60 | } | ||
61 | blocks_in_map = be32_to_cpu(part->map_count); | ||
62 | if (blocks_in_map < 0 || blocks_in_map >= DISK_MAX_PARTS) { | ||
63 | put_dev_sector(sect); | ||
64 | return 0; | ||
65 | } | ||
66 | strlcat(state->pp_buf, " [mac]", PAGE_SIZE); | ||
67 | for (slot = 1; slot <= blocks_in_map; ++slot) { | ||
68 | int pos = slot * secsize; | ||
69 | put_dev_sector(sect); | ||
70 | data = read_part_sector(state, pos/512, §); | ||
71 | if (!data) | ||
72 | return -1; | ||
73 | part = (struct mac_partition *) (data + pos%512); | ||
74 | if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) | ||
75 | break; | ||
76 | put_partition(state, slot, | ||
77 | be32_to_cpu(part->start_block) * (secsize/512), | ||
78 | be32_to_cpu(part->block_count) * (secsize/512)); | ||
79 | |||
80 | if (!strnicmp(part->type, "Linux_RAID", 10)) | ||
81 | state->parts[slot].flags = ADDPART_FLAG_RAID; | ||
82 | #ifdef CONFIG_PPC_PMAC | ||
83 | /* | ||
84 | * If this is the first bootable partition, tell the | ||
85 | * setup code, in case it wants to make this the root. | ||
86 | */ | ||
87 | if (machine_is(powermac)) { | ||
88 | int goodness = 0; | ||
89 | |||
90 | mac_fix_string(part->processor, 16); | ||
91 | mac_fix_string(part->name, 32); | ||
92 | mac_fix_string(part->type, 32); | ||
93 | |||
94 | if ((be32_to_cpu(part->status) & MAC_STATUS_BOOTABLE) | ||
95 | && strcasecmp(part->processor, "powerpc") == 0) | ||
96 | goodness++; | ||
97 | |||
98 | if (strcasecmp(part->type, "Apple_UNIX_SVR2") == 0 | ||
99 | || (strnicmp(part->type, "Linux", 5) == 0 | ||
100 | && strcasecmp(part->type, "Linux_swap") != 0)) { | ||
101 | int i, l; | ||
102 | |||
103 | goodness++; | ||
104 | l = strlen(part->name); | ||
105 | if (strcmp(part->name, "/") == 0) | ||
106 | goodness++; | ||
107 | for (i = 0; i <= l - 4; ++i) { | ||
108 | if (strnicmp(part->name + i, "root", | ||
109 | 4) == 0) { | ||
110 | goodness += 2; | ||
111 | break; | ||
112 | } | ||
113 | } | ||
114 | if (strnicmp(part->name, "swap", 4) == 0) | ||
115 | goodness--; | ||
116 | } | ||
117 | |||
118 | if (goodness > found_root_goodness) { | ||
119 | found_root = slot; | ||
120 | found_root_goodness = goodness; | ||
121 | } | ||
122 | } | ||
123 | #endif /* CONFIG_PPC_PMAC */ | ||
124 | } | ||
125 | #ifdef CONFIG_PPC_PMAC | ||
126 | if (found_root_goodness) | ||
127 | note_bootable_part(state->bdev->bd_dev, found_root, | ||
128 | found_root_goodness); | ||
129 | #endif | ||
130 | |||
131 | put_dev_sector(sect); | ||
132 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
133 | return 1; | ||
134 | } | ||
diff --git a/fs/partitions/mac.h b/fs/partitions/mac.h deleted file mode 100644 index 3c7d98436380..000000000000 --- a/fs/partitions/mac.h +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/mac.h | ||
3 | */ | ||
4 | |||
5 | #define MAC_PARTITION_MAGIC 0x504d | ||
6 | |||
7 | /* type field value for A/UX or other Unix partitions */ | ||
8 | #define APPLE_AUX_TYPE "Apple_UNIX_SVR2" | ||
9 | |||
10 | struct mac_partition { | ||
11 | __be16 signature; /* expected to be MAC_PARTITION_MAGIC */ | ||
12 | __be16 res1; | ||
13 | __be32 map_count; /* # blocks in partition map */ | ||
14 | __be32 start_block; /* absolute starting block # of partition */ | ||
15 | __be32 block_count; /* number of blocks in partition */ | ||
16 | char name[32]; /* partition name */ | ||
17 | char type[32]; /* string type description */ | ||
18 | __be32 data_start; /* rel block # of first data block */ | ||
19 | __be32 data_count; /* number of data blocks */ | ||
20 | __be32 status; /* partition status bits */ | ||
21 | __be32 boot_start; | ||
22 | __be32 boot_size; | ||
23 | __be32 boot_load; | ||
24 | __be32 boot_load2; | ||
25 | __be32 boot_entry; | ||
26 | __be32 boot_entry2; | ||
27 | __be32 boot_cksum; | ||
28 | char processor[16]; /* identifies ISA of boot */ | ||
29 | /* there is more stuff after this that we don't need */ | ||
30 | }; | ||
31 | |||
32 | #define MAC_STATUS_BOOTABLE 8 /* partition is bootable */ | ||
33 | |||
34 | #define MAC_DRIVER_MAGIC 0x4552 | ||
35 | |||
36 | /* Driver descriptor structure, in block 0 */ | ||
37 | struct mac_driver_desc { | ||
38 | __be16 signature; /* expected to be MAC_DRIVER_MAGIC */ | ||
39 | __be16 block_size; | ||
40 | __be32 block_count; | ||
41 | /* ... more stuff */ | ||
42 | }; | ||
43 | |||
44 | int mac_partition(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c deleted file mode 100644 index 5f79a6677c69..000000000000 --- a/fs/partitions/msdos.c +++ /dev/null | |||
@@ -1,552 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/msdos.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * Copyright (C) 1991-1998 Linus Torvalds | ||
6 | * | ||
7 | * Thanks to Branko Lankester, lankeste@fwi.uva.nl, who found a bug | ||
8 | * in the early extended-partition checks and added DM partitions | ||
9 | * | ||
10 | * Support for DiskManager v6.0x added by Mark Lord, | ||
11 | * with information provided by OnTrack. This now works for linux fdisk | ||
12 | * and LILO, as well as loadlin and bootln. Note that disks other than | ||
13 | * /dev/hda *must* have a "DOS" type 0x51 partition in the first slot (hda1). | ||
14 | * | ||
15 | * More flexible handling of extended partitions - aeb, 950831 | ||
16 | * | ||
17 | * Check partition table on IDE disks for common CHS translations | ||
18 | * | ||
19 | * Re-organised Feb 1998 Russell King | ||
20 | */ | ||
21 | #include <linux/msdos_fs.h> | ||
22 | |||
23 | #include "check.h" | ||
24 | #include "msdos.h" | ||
25 | #include "efi.h" | ||
26 | |||
27 | /* | ||
28 | * Many architectures don't like unaligned accesses, while | ||
29 | * the nr_sects and start_sect partition table entries are | ||
30 | * at a 2 (mod 4) address. | ||
31 | */ | ||
32 | #include <asm/unaligned.h> | ||
33 | |||
34 | #define SYS_IND(p) get_unaligned(&p->sys_ind) | ||
35 | |||
36 | static inline sector_t nr_sects(struct partition *p) | ||
37 | { | ||
38 | return (sector_t)get_unaligned_le32(&p->nr_sects); | ||
39 | } | ||
40 | |||
41 | static inline sector_t start_sect(struct partition *p) | ||
42 | { | ||
43 | return (sector_t)get_unaligned_le32(&p->start_sect); | ||
44 | } | ||
45 | |||
46 | static inline int is_extended_partition(struct partition *p) | ||
47 | { | ||
48 | return (SYS_IND(p) == DOS_EXTENDED_PARTITION || | ||
49 | SYS_IND(p) == WIN98_EXTENDED_PARTITION || | ||
50 | SYS_IND(p) == LINUX_EXTENDED_PARTITION); | ||
51 | } | ||
52 | |||
53 | #define MSDOS_LABEL_MAGIC1 0x55 | ||
54 | #define MSDOS_LABEL_MAGIC2 0xAA | ||
55 | |||
56 | static inline int | ||
57 | msdos_magic_present(unsigned char *p) | ||
58 | { | ||
59 | return (p[0] == MSDOS_LABEL_MAGIC1 && p[1] == MSDOS_LABEL_MAGIC2); | ||
60 | } | ||
61 | |||
62 | /* Value is EBCDIC 'IBMA' */ | ||
63 | #define AIX_LABEL_MAGIC1 0xC9 | ||
64 | #define AIX_LABEL_MAGIC2 0xC2 | ||
65 | #define AIX_LABEL_MAGIC3 0xD4 | ||
66 | #define AIX_LABEL_MAGIC4 0xC1 | ||
67 | static int aix_magic_present(struct parsed_partitions *state, unsigned char *p) | ||
68 | { | ||
69 | struct partition *pt = (struct partition *) (p + 0x1be); | ||
70 | Sector sect; | ||
71 | unsigned char *d; | ||
72 | int slot, ret = 0; | ||
73 | |||
74 | if (!(p[0] == AIX_LABEL_MAGIC1 && | ||
75 | p[1] == AIX_LABEL_MAGIC2 && | ||
76 | p[2] == AIX_LABEL_MAGIC3 && | ||
77 | p[3] == AIX_LABEL_MAGIC4)) | ||
78 | return 0; | ||
79 | /* Assume the partition table is valid if Linux partitions exists */ | ||
80 | for (slot = 1; slot <= 4; slot++, pt++) { | ||
81 | if (pt->sys_ind == LINUX_SWAP_PARTITION || | ||
82 | pt->sys_ind == LINUX_RAID_PARTITION || | ||
83 | pt->sys_ind == LINUX_DATA_PARTITION || | ||
84 | pt->sys_ind == LINUX_LVM_PARTITION || | ||
85 | is_extended_partition(pt)) | ||
86 | return 0; | ||
87 | } | ||
88 | d = read_part_sector(state, 7, §); | ||
89 | if (d) { | ||
90 | if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M') | ||
91 | ret = 1; | ||
92 | put_dev_sector(sect); | ||
93 | }; | ||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Create devices for each logical partition in an extended partition. | ||
99 | * The logical partitions form a linked list, with each entry being | ||
100 | * a partition table with two entries. The first entry | ||
101 | * is the real data partition (with a start relative to the partition | ||
102 | * table start). The second is a pointer to the next logical partition | ||
103 | * (with a start relative to the entire extended partition). | ||
104 | * We do not create a Linux partition for the partition tables, but | ||
105 | * only for the actual data partitions. | ||
106 | */ | ||
107 | |||
108 | static void parse_extended(struct parsed_partitions *state, | ||
109 | sector_t first_sector, sector_t first_size) | ||
110 | { | ||
111 | struct partition *p; | ||
112 | Sector sect; | ||
113 | unsigned char *data; | ||
114 | sector_t this_sector, this_size; | ||
115 | sector_t sector_size = bdev_logical_block_size(state->bdev) / 512; | ||
116 | int loopct = 0; /* number of links followed | ||
117 | without finding a data partition */ | ||
118 | int i; | ||
119 | |||
120 | this_sector = first_sector; | ||
121 | this_size = first_size; | ||
122 | |||
123 | while (1) { | ||
124 | if (++loopct > 100) | ||
125 | return; | ||
126 | if (state->next == state->limit) | ||
127 | return; | ||
128 | data = read_part_sector(state, this_sector, §); | ||
129 | if (!data) | ||
130 | return; | ||
131 | |||
132 | if (!msdos_magic_present(data + 510)) | ||
133 | goto done; | ||
134 | |||
135 | p = (struct partition *) (data + 0x1be); | ||
136 | |||
137 | /* | ||
138 | * Usually, the first entry is the real data partition, | ||
139 | * the 2nd entry is the next extended partition, or empty, | ||
140 | * and the 3rd and 4th entries are unused. | ||
141 | * However, DRDOS sometimes has the extended partition as | ||
142 | * the first entry (when the data partition is empty), | ||
143 | * and OS/2 seems to use all four entries. | ||
144 | */ | ||
145 | |||
146 | /* | ||
147 | * First process the data partition(s) | ||
148 | */ | ||
149 | for (i=0; i<4; i++, p++) { | ||
150 | sector_t offs, size, next; | ||
151 | if (!nr_sects(p) || is_extended_partition(p)) | ||
152 | continue; | ||
153 | |||
154 | /* Check the 3rd and 4th entries - | ||
155 | these sometimes contain random garbage */ | ||
156 | offs = start_sect(p)*sector_size; | ||
157 | size = nr_sects(p)*sector_size; | ||
158 | next = this_sector + offs; | ||
159 | if (i >= 2) { | ||
160 | if (offs + size > this_size) | ||
161 | continue; | ||
162 | if (next < first_sector) | ||
163 | continue; | ||
164 | if (next + size > first_sector + first_size) | ||
165 | continue; | ||
166 | } | ||
167 | |||
168 | put_partition(state, state->next, next, size); | ||
169 | if (SYS_IND(p) == LINUX_RAID_PARTITION) | ||
170 | state->parts[state->next].flags = ADDPART_FLAG_RAID; | ||
171 | loopct = 0; | ||
172 | if (++state->next == state->limit) | ||
173 | goto done; | ||
174 | } | ||
175 | /* | ||
176 | * Next, process the (first) extended partition, if present. | ||
177 | * (So far, there seems to be no reason to make | ||
178 | * parse_extended() recursive and allow a tree | ||
179 | * of extended partitions.) | ||
180 | * It should be a link to the next logical partition. | ||
181 | */ | ||
182 | p -= 4; | ||
183 | for (i=0; i<4; i++, p++) | ||
184 | if (nr_sects(p) && is_extended_partition(p)) | ||
185 | break; | ||
186 | if (i == 4) | ||
187 | goto done; /* nothing left to do */ | ||
188 | |||
189 | this_sector = first_sector + start_sect(p) * sector_size; | ||
190 | this_size = nr_sects(p) * sector_size; | ||
191 | put_dev_sector(sect); | ||
192 | } | ||
193 | done: | ||
194 | put_dev_sector(sect); | ||
195 | } | ||
196 | |||
197 | /* james@bpgc.com: Solaris has a nasty indicator: 0x82 which also | ||
198 | indicates linux swap. Be careful before believing this is Solaris. */ | ||
199 | |||
200 | static void parse_solaris_x86(struct parsed_partitions *state, | ||
201 | sector_t offset, sector_t size, int origin) | ||
202 | { | ||
203 | #ifdef CONFIG_SOLARIS_X86_PARTITION | ||
204 | Sector sect; | ||
205 | struct solaris_x86_vtoc *v; | ||
206 | int i; | ||
207 | short max_nparts; | ||
208 | |||
209 | v = read_part_sector(state, offset + 1, §); | ||
210 | if (!v) | ||
211 | return; | ||
212 | if (le32_to_cpu(v->v_sanity) != SOLARIS_X86_VTOC_SANE) { | ||
213 | put_dev_sector(sect); | ||
214 | return; | ||
215 | } | ||
216 | { | ||
217 | char tmp[1 + BDEVNAME_SIZE + 10 + 11 + 1]; | ||
218 | |||
219 | snprintf(tmp, sizeof(tmp), " %s%d: <solaris:", state->name, origin); | ||
220 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
221 | } | ||
222 | if (le32_to_cpu(v->v_version) != 1) { | ||
223 | char tmp[64]; | ||
224 | |||
225 | snprintf(tmp, sizeof(tmp), " cannot handle version %d vtoc>\n", | ||
226 | le32_to_cpu(v->v_version)); | ||
227 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
228 | put_dev_sector(sect); | ||
229 | return; | ||
230 | } | ||
231 | /* Ensure we can handle previous case of VTOC with 8 entries gracefully */ | ||
232 | max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8; | ||
233 | for (i=0; i<max_nparts && state->next<state->limit; i++) { | ||
234 | struct solaris_x86_slice *s = &v->v_slice[i]; | ||
235 | char tmp[3 + 10 + 1 + 1]; | ||
236 | |||
237 | if (s->s_size == 0) | ||
238 | continue; | ||
239 | snprintf(tmp, sizeof(tmp), " [s%d]", i); | ||
240 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
241 | /* solaris partitions are relative to current MS-DOS | ||
242 | * one; must add the offset of the current partition */ | ||
243 | put_partition(state, state->next++, | ||
244 | le32_to_cpu(s->s_start)+offset, | ||
245 | le32_to_cpu(s->s_size)); | ||
246 | } | ||
247 | put_dev_sector(sect); | ||
248 | strlcat(state->pp_buf, " >\n", PAGE_SIZE); | ||
249 | #endif | ||
250 | } | ||
251 | |||
252 | #if defined(CONFIG_BSD_DISKLABEL) | ||
253 | /* | ||
254 | * Create devices for BSD partitions listed in a disklabel, under a | ||
255 | * dos-like partition. See parse_extended() for more information. | ||
256 | */ | ||
257 | static void parse_bsd(struct parsed_partitions *state, | ||
258 | sector_t offset, sector_t size, int origin, char *flavour, | ||
259 | int max_partitions) | ||
260 | { | ||
261 | Sector sect; | ||
262 | struct bsd_disklabel *l; | ||
263 | struct bsd_partition *p; | ||
264 | char tmp[64]; | ||
265 | |||
266 | l = read_part_sector(state, offset + 1, §); | ||
267 | if (!l) | ||
268 | return; | ||
269 | if (le32_to_cpu(l->d_magic) != BSD_DISKMAGIC) { | ||
270 | put_dev_sector(sect); | ||
271 | return; | ||
272 | } | ||
273 | |||
274 | snprintf(tmp, sizeof(tmp), " %s%d: <%s:", state->name, origin, flavour); | ||
275 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
276 | |||
277 | if (le16_to_cpu(l->d_npartitions) < max_partitions) | ||
278 | max_partitions = le16_to_cpu(l->d_npartitions); | ||
279 | for (p = l->d_partitions; p - l->d_partitions < max_partitions; p++) { | ||
280 | sector_t bsd_start, bsd_size; | ||
281 | |||
282 | if (state->next == state->limit) | ||
283 | break; | ||
284 | if (p->p_fstype == BSD_FS_UNUSED) | ||
285 | continue; | ||
286 | bsd_start = le32_to_cpu(p->p_offset); | ||
287 | bsd_size = le32_to_cpu(p->p_size); | ||
288 | if (offset == bsd_start && size == bsd_size) | ||
289 | /* full parent partition, we have it already */ | ||
290 | continue; | ||
291 | if (offset > bsd_start || offset+size < bsd_start+bsd_size) { | ||
292 | strlcat(state->pp_buf, "bad subpartition - ignored\n", PAGE_SIZE); | ||
293 | continue; | ||
294 | } | ||
295 | put_partition(state, state->next++, bsd_start, bsd_size); | ||
296 | } | ||
297 | put_dev_sector(sect); | ||
298 | if (le16_to_cpu(l->d_npartitions) > max_partitions) { | ||
299 | snprintf(tmp, sizeof(tmp), " (ignored %d more)", | ||
300 | le16_to_cpu(l->d_npartitions) - max_partitions); | ||
301 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
302 | } | ||
303 | strlcat(state->pp_buf, " >\n", PAGE_SIZE); | ||
304 | } | ||
305 | #endif | ||
306 | |||
307 | static void parse_freebsd(struct parsed_partitions *state, | ||
308 | sector_t offset, sector_t size, int origin) | ||
309 | { | ||
310 | #ifdef CONFIG_BSD_DISKLABEL | ||
311 | parse_bsd(state, offset, size, origin, "bsd", BSD_MAXPARTITIONS); | ||
312 | #endif | ||
313 | } | ||
314 | |||
315 | static void parse_netbsd(struct parsed_partitions *state, | ||
316 | sector_t offset, sector_t size, int origin) | ||
317 | { | ||
318 | #ifdef CONFIG_BSD_DISKLABEL | ||
319 | parse_bsd(state, offset, size, origin, "netbsd", BSD_MAXPARTITIONS); | ||
320 | #endif | ||
321 | } | ||
322 | |||
323 | static void parse_openbsd(struct parsed_partitions *state, | ||
324 | sector_t offset, sector_t size, int origin) | ||
325 | { | ||
326 | #ifdef CONFIG_BSD_DISKLABEL | ||
327 | parse_bsd(state, offset, size, origin, "openbsd", | ||
328 | OPENBSD_MAXPARTITIONS); | ||
329 | #endif | ||
330 | } | ||
331 | |||
332 | /* | ||
333 | * Create devices for Unixware partitions listed in a disklabel, under a | ||
334 | * dos-like partition. See parse_extended() for more information. | ||
335 | */ | ||
336 | static void parse_unixware(struct parsed_partitions *state, | ||
337 | sector_t offset, sector_t size, int origin) | ||
338 | { | ||
339 | #ifdef CONFIG_UNIXWARE_DISKLABEL | ||
340 | Sector sect; | ||
341 | struct unixware_disklabel *l; | ||
342 | struct unixware_slice *p; | ||
343 | |||
344 | l = read_part_sector(state, offset + 29, §); | ||
345 | if (!l) | ||
346 | return; | ||
347 | if (le32_to_cpu(l->d_magic) != UNIXWARE_DISKMAGIC || | ||
348 | le32_to_cpu(l->vtoc.v_magic) != UNIXWARE_DISKMAGIC2) { | ||
349 | put_dev_sector(sect); | ||
350 | return; | ||
351 | } | ||
352 | { | ||
353 | char tmp[1 + BDEVNAME_SIZE + 10 + 12 + 1]; | ||
354 | |||
355 | snprintf(tmp, sizeof(tmp), " %s%d: <unixware:", state->name, origin); | ||
356 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
357 | } | ||
358 | p = &l->vtoc.v_slice[1]; | ||
359 | /* I omit the 0th slice as it is the same as whole disk. */ | ||
360 | while (p - &l->vtoc.v_slice[0] < UNIXWARE_NUMSLICE) { | ||
361 | if (state->next == state->limit) | ||
362 | break; | ||
363 | |||
364 | if (p->s_label != UNIXWARE_FS_UNUSED) | ||
365 | put_partition(state, state->next++, | ||
366 | le32_to_cpu(p->start_sect), | ||
367 | le32_to_cpu(p->nr_sects)); | ||
368 | p++; | ||
369 | } | ||
370 | put_dev_sector(sect); | ||
371 | strlcat(state->pp_buf, " >\n", PAGE_SIZE); | ||
372 | #endif | ||
373 | } | ||
374 | |||
375 | /* | ||
376 | * Minix 2.0.0/2.0.2 subpartition support. | ||
377 | * Anand Krishnamurthy <anandk@wiproge.med.ge.com> | ||
378 | * Rajeev V. Pillai <rajeevvp@yahoo.com> | ||
379 | */ | ||
380 | static void parse_minix(struct parsed_partitions *state, | ||
381 | sector_t offset, sector_t size, int origin) | ||
382 | { | ||
383 | #ifdef CONFIG_MINIX_SUBPARTITION | ||
384 | Sector sect; | ||
385 | unsigned char *data; | ||
386 | struct partition *p; | ||
387 | int i; | ||
388 | |||
389 | data = read_part_sector(state, offset, §); | ||
390 | if (!data) | ||
391 | return; | ||
392 | |||
393 | p = (struct partition *)(data + 0x1be); | ||
394 | |||
395 | /* The first sector of a Minix partition can have either | ||
396 | * a secondary MBR describing its subpartitions, or | ||
397 | * the normal boot sector. */ | ||
398 | if (msdos_magic_present (data + 510) && | ||
399 | SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */ | ||
400 | char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1]; | ||
401 | |||
402 | snprintf(tmp, sizeof(tmp), " %s%d: <minix:", state->name, origin); | ||
403 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
404 | for (i = 0; i < MINIX_NR_SUBPARTITIONS; i++, p++) { | ||
405 | if (state->next == state->limit) | ||
406 | break; | ||
407 | /* add each partition in use */ | ||
408 | if (SYS_IND(p) == MINIX_PARTITION) | ||
409 | put_partition(state, state->next++, | ||
410 | start_sect(p), nr_sects(p)); | ||
411 | } | ||
412 | strlcat(state->pp_buf, " >\n", PAGE_SIZE); | ||
413 | } | ||
414 | put_dev_sector(sect); | ||
415 | #endif /* CONFIG_MINIX_SUBPARTITION */ | ||
416 | } | ||
417 | |||
418 | static struct { | ||
419 | unsigned char id; | ||
420 | void (*parse)(struct parsed_partitions *, sector_t, sector_t, int); | ||
421 | } subtypes[] = { | ||
422 | {FREEBSD_PARTITION, parse_freebsd}, | ||
423 | {NETBSD_PARTITION, parse_netbsd}, | ||
424 | {OPENBSD_PARTITION, parse_openbsd}, | ||
425 | {MINIX_PARTITION, parse_minix}, | ||
426 | {UNIXWARE_PARTITION, parse_unixware}, | ||
427 | {SOLARIS_X86_PARTITION, parse_solaris_x86}, | ||
428 | {NEW_SOLARIS_X86_PARTITION, parse_solaris_x86}, | ||
429 | {0, NULL}, | ||
430 | }; | ||
431 | |||
432 | int msdos_partition(struct parsed_partitions *state) | ||
433 | { | ||
434 | sector_t sector_size = bdev_logical_block_size(state->bdev) / 512; | ||
435 | Sector sect; | ||
436 | unsigned char *data; | ||
437 | struct partition *p; | ||
438 | struct fat_boot_sector *fb; | ||
439 | int slot; | ||
440 | |||
441 | data = read_part_sector(state, 0, §); | ||
442 | if (!data) | ||
443 | return -1; | ||
444 | if (!msdos_magic_present(data + 510)) { | ||
445 | put_dev_sector(sect); | ||
446 | return 0; | ||
447 | } | ||
448 | |||
449 | if (aix_magic_present(state, data)) { | ||
450 | put_dev_sector(sect); | ||
451 | strlcat(state->pp_buf, " [AIX]", PAGE_SIZE); | ||
452 | return 0; | ||
453 | } | ||
454 | |||
455 | /* | ||
456 | * Now that the 55aa signature is present, this is probably | ||
457 | * either the boot sector of a FAT filesystem or a DOS-type | ||
458 | * partition table. Reject this in case the boot indicator | ||
459 | * is not 0 or 0x80. | ||
460 | */ | ||
461 | p = (struct partition *) (data + 0x1be); | ||
462 | for (slot = 1; slot <= 4; slot++, p++) { | ||
463 | if (p->boot_ind != 0 && p->boot_ind != 0x80) { | ||
464 | /* | ||
465 | * Even without a valid boot inidicator value | ||
466 | * its still possible this is valid FAT filesystem | ||
467 | * without a partition table. | ||
468 | */ | ||
469 | fb = (struct fat_boot_sector *) data; | ||
470 | if (slot == 1 && fb->reserved && fb->fats | ||
471 | && fat_valid_media(fb->media)) { | ||
472 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
473 | put_dev_sector(sect); | ||
474 | return 1; | ||
475 | } else { | ||
476 | put_dev_sector(sect); | ||
477 | return 0; | ||
478 | } | ||
479 | } | ||
480 | } | ||
481 | |||
482 | #ifdef CONFIG_EFI_PARTITION | ||
483 | p = (struct partition *) (data + 0x1be); | ||
484 | for (slot = 1 ; slot <= 4 ; slot++, p++) { | ||
485 | /* If this is an EFI GPT disk, msdos should ignore it. */ | ||
486 | if (SYS_IND(p) == EFI_PMBR_OSTYPE_EFI_GPT) { | ||
487 | put_dev_sector(sect); | ||
488 | return 0; | ||
489 | } | ||
490 | } | ||
491 | #endif | ||
492 | p = (struct partition *) (data + 0x1be); | ||
493 | |||
494 | /* | ||
495 | * Look for partitions in two passes: | ||
496 | * First find the primary and DOS-type extended partitions. | ||
497 | * On the second pass look inside *BSD, Unixware and Solaris partitions. | ||
498 | */ | ||
499 | |||
500 | state->next = 5; | ||
501 | for (slot = 1 ; slot <= 4 ; slot++, p++) { | ||
502 | sector_t start = start_sect(p)*sector_size; | ||
503 | sector_t size = nr_sects(p)*sector_size; | ||
504 | if (!size) | ||
505 | continue; | ||
506 | if (is_extended_partition(p)) { | ||
507 | /* | ||
508 | * prevent someone doing mkfs or mkswap on an | ||
509 | * extended partition, but leave room for LILO | ||
510 | * FIXME: this uses one logical sector for > 512b | ||
511 | * sector, although it may not be enough/proper. | ||
512 | */ | ||
513 | sector_t n = 2; | ||
514 | n = min(size, max(sector_size, n)); | ||
515 | put_partition(state, slot, start, n); | ||
516 | |||
517 | strlcat(state->pp_buf, " <", PAGE_SIZE); | ||
518 | parse_extended(state, start, size); | ||
519 | strlcat(state->pp_buf, " >", PAGE_SIZE); | ||
520 | continue; | ||
521 | } | ||
522 | put_partition(state, slot, start, size); | ||
523 | if (SYS_IND(p) == LINUX_RAID_PARTITION) | ||
524 | state->parts[slot].flags = ADDPART_FLAG_RAID; | ||
525 | if (SYS_IND(p) == DM6_PARTITION) | ||
526 | strlcat(state->pp_buf, "[DM]", PAGE_SIZE); | ||
527 | if (SYS_IND(p) == EZD_PARTITION) | ||
528 | strlcat(state->pp_buf, "[EZD]", PAGE_SIZE); | ||
529 | } | ||
530 | |||
531 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
532 | |||
533 | /* second pass - output for each on a separate line */ | ||
534 | p = (struct partition *) (0x1be + data); | ||
535 | for (slot = 1 ; slot <= 4 ; slot++, p++) { | ||
536 | unsigned char id = SYS_IND(p); | ||
537 | int n; | ||
538 | |||
539 | if (!nr_sects(p)) | ||
540 | continue; | ||
541 | |||
542 | for (n = 0; subtypes[n].parse && id != subtypes[n].id; n++) | ||
543 | ; | ||
544 | |||
545 | if (!subtypes[n].parse) | ||
546 | continue; | ||
547 | subtypes[n].parse(state, start_sect(p) * sector_size, | ||
548 | nr_sects(p) * sector_size, slot); | ||
549 | } | ||
550 | put_dev_sector(sect); | ||
551 | return 1; | ||
552 | } | ||
diff --git a/fs/partitions/msdos.h b/fs/partitions/msdos.h deleted file mode 100644 index 38c781c490b3..000000000000 --- a/fs/partitions/msdos.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/msdos.h | ||
3 | */ | ||
4 | |||
5 | #define MSDOS_LABEL_MAGIC 0xAA55 | ||
6 | |||
7 | int msdos_partition(struct parsed_partitions *state); | ||
8 | |||
diff --git a/fs/partitions/osf.c b/fs/partitions/osf.c deleted file mode 100644 index 764b86a01965..000000000000 --- a/fs/partitions/osf.c +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/osf.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * | ||
6 | * Copyright (C) 1991-1998 Linus Torvalds | ||
7 | * Re-organised Feb 1998 Russell King | ||
8 | */ | ||
9 | |||
10 | #include "check.h" | ||
11 | #include "osf.h" | ||
12 | |||
13 | #define MAX_OSF_PARTITIONS 18 | ||
14 | |||
15 | int osf_partition(struct parsed_partitions *state) | ||
16 | { | ||
17 | int i; | ||
18 | int slot = 1; | ||
19 | unsigned int npartitions; | ||
20 | Sector sect; | ||
21 | unsigned char *data; | ||
22 | struct disklabel { | ||
23 | __le32 d_magic; | ||
24 | __le16 d_type,d_subtype; | ||
25 | u8 d_typename[16]; | ||
26 | u8 d_packname[16]; | ||
27 | __le32 d_secsize; | ||
28 | __le32 d_nsectors; | ||
29 | __le32 d_ntracks; | ||
30 | __le32 d_ncylinders; | ||
31 | __le32 d_secpercyl; | ||
32 | __le32 d_secprtunit; | ||
33 | __le16 d_sparespertrack; | ||
34 | __le16 d_sparespercyl; | ||
35 | __le32 d_acylinders; | ||
36 | __le16 d_rpm, d_interleave, d_trackskew, d_cylskew; | ||
37 | __le32 d_headswitch, d_trkseek, d_flags; | ||
38 | __le32 d_drivedata[5]; | ||
39 | __le32 d_spare[5]; | ||
40 | __le32 d_magic2; | ||
41 | __le16 d_checksum; | ||
42 | __le16 d_npartitions; | ||
43 | __le32 d_bbsize, d_sbsize; | ||
44 | struct d_partition { | ||
45 | __le32 p_size; | ||
46 | __le32 p_offset; | ||
47 | __le32 p_fsize; | ||
48 | u8 p_fstype; | ||
49 | u8 p_frag; | ||
50 | __le16 p_cpg; | ||
51 | } d_partitions[MAX_OSF_PARTITIONS]; | ||
52 | } * label; | ||
53 | struct d_partition * partition; | ||
54 | |||
55 | data = read_part_sector(state, 0, §); | ||
56 | if (!data) | ||
57 | return -1; | ||
58 | |||
59 | label = (struct disklabel *) (data+64); | ||
60 | partition = label->d_partitions; | ||
61 | if (le32_to_cpu(label->d_magic) != DISKLABELMAGIC) { | ||
62 | put_dev_sector(sect); | ||
63 | return 0; | ||
64 | } | ||
65 | if (le32_to_cpu(label->d_magic2) != DISKLABELMAGIC) { | ||
66 | put_dev_sector(sect); | ||
67 | return 0; | ||
68 | } | ||
69 | npartitions = le16_to_cpu(label->d_npartitions); | ||
70 | if (npartitions > MAX_OSF_PARTITIONS) { | ||
71 | put_dev_sector(sect); | ||
72 | return 0; | ||
73 | } | ||
74 | for (i = 0 ; i < npartitions; i++, partition++) { | ||
75 | if (slot == state->limit) | ||
76 | break; | ||
77 | if (le32_to_cpu(partition->p_size)) | ||
78 | put_partition(state, slot, | ||
79 | le32_to_cpu(partition->p_offset), | ||
80 | le32_to_cpu(partition->p_size)); | ||
81 | slot++; | ||
82 | } | ||
83 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
84 | put_dev_sector(sect); | ||
85 | return 1; | ||
86 | } | ||
diff --git a/fs/partitions/osf.h b/fs/partitions/osf.h deleted file mode 100644 index 20ed2315ec16..000000000000 --- a/fs/partitions/osf.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/osf.h | ||
3 | */ | ||
4 | |||
5 | #define DISKLABELMAGIC (0x82564557UL) | ||
6 | |||
7 | int osf_partition(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/sgi.c b/fs/partitions/sgi.c deleted file mode 100644 index ea8a86dceaf4..000000000000 --- a/fs/partitions/sgi.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/sgi.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | */ | ||
6 | |||
7 | #include "check.h" | ||
8 | #include "sgi.h" | ||
9 | |||
10 | struct sgi_disklabel { | ||
11 | __be32 magic_mushroom; /* Big fat spliff... */ | ||
12 | __be16 root_part_num; /* Root partition number */ | ||
13 | __be16 swap_part_num; /* Swap partition number */ | ||
14 | s8 boot_file[16]; /* Name of boot file for ARCS */ | ||
15 | u8 _unused0[48]; /* Device parameter useless crapola.. */ | ||
16 | struct sgi_volume { | ||
17 | s8 name[8]; /* Name of volume */ | ||
18 | __be32 block_num; /* Logical block number */ | ||
19 | __be32 num_bytes; /* How big, in bytes */ | ||
20 | } volume[15]; | ||
21 | struct sgi_partition { | ||
22 | __be32 num_blocks; /* Size in logical blocks */ | ||
23 | __be32 first_block; /* First logical block */ | ||
24 | __be32 type; /* Type of this partition */ | ||
25 | } partitions[16]; | ||
26 | __be32 csum; /* Disk label checksum */ | ||
27 | __be32 _unused1; /* Padding */ | ||
28 | }; | ||
29 | |||
30 | int sgi_partition(struct parsed_partitions *state) | ||
31 | { | ||
32 | int i, csum; | ||
33 | __be32 magic; | ||
34 | int slot = 1; | ||
35 | unsigned int start, blocks; | ||
36 | __be32 *ui, cs; | ||
37 | Sector sect; | ||
38 | struct sgi_disklabel *label; | ||
39 | struct sgi_partition *p; | ||
40 | char b[BDEVNAME_SIZE]; | ||
41 | |||
42 | label = read_part_sector(state, 0, §); | ||
43 | if (!label) | ||
44 | return -1; | ||
45 | p = &label->partitions[0]; | ||
46 | magic = label->magic_mushroom; | ||
47 | if(be32_to_cpu(magic) != SGI_LABEL_MAGIC) { | ||
48 | /*printk("Dev %s SGI disklabel: bad magic %08x\n", | ||
49 | bdevname(bdev, b), be32_to_cpu(magic));*/ | ||
50 | put_dev_sector(sect); | ||
51 | return 0; | ||
52 | } | ||
53 | ui = ((__be32 *) (label + 1)) - 1; | ||
54 | for(csum = 0; ui >= ((__be32 *) label);) { | ||
55 | cs = *ui--; | ||
56 | csum += be32_to_cpu(cs); | ||
57 | } | ||
58 | if(csum) { | ||
59 | printk(KERN_WARNING "Dev %s SGI disklabel: csum bad, label corrupted\n", | ||
60 | bdevname(state->bdev, b)); | ||
61 | put_dev_sector(sect); | ||
62 | return 0; | ||
63 | } | ||
64 | /* All SGI disk labels have 16 partitions, disks under Linux only | ||
65 | * have 15 minor's. Luckily there are always a few zero length | ||
66 | * partitions which we don't care about so we never overflow the | ||
67 | * current_minor. | ||
68 | */ | ||
69 | for(i = 0; i < 16; i++, p++) { | ||
70 | blocks = be32_to_cpu(p->num_blocks); | ||
71 | start = be32_to_cpu(p->first_block); | ||
72 | if (blocks) { | ||
73 | put_partition(state, slot, start, blocks); | ||
74 | if (be32_to_cpu(p->type) == LINUX_RAID_PARTITION) | ||
75 | state->parts[slot].flags = ADDPART_FLAG_RAID; | ||
76 | } | ||
77 | slot++; | ||
78 | } | ||
79 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
80 | put_dev_sector(sect); | ||
81 | return 1; | ||
82 | } | ||
diff --git a/fs/partitions/sgi.h b/fs/partitions/sgi.h deleted file mode 100644 index b9553ebdd5a9..000000000000 --- a/fs/partitions/sgi.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/sgi.h | ||
3 | */ | ||
4 | |||
5 | extern int sgi_partition(struct parsed_partitions *state); | ||
6 | |||
7 | #define SGI_LABEL_MAGIC 0x0be5a941 | ||
8 | |||
diff --git a/fs/partitions/sun.c b/fs/partitions/sun.c deleted file mode 100644 index b5b6fcfb3d36..000000000000 --- a/fs/partitions/sun.c +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/sun.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * | ||
6 | * Copyright (C) 1991-1998 Linus Torvalds | ||
7 | * Re-organised Feb 1998 Russell King | ||
8 | */ | ||
9 | |||
10 | #include "check.h" | ||
11 | #include "sun.h" | ||
12 | |||
13 | int sun_partition(struct parsed_partitions *state) | ||
14 | { | ||
15 | int i; | ||
16 | __be16 csum; | ||
17 | int slot = 1; | ||
18 | __be16 *ush; | ||
19 | Sector sect; | ||
20 | struct sun_disklabel { | ||
21 | unsigned char info[128]; /* Informative text string */ | ||
22 | struct sun_vtoc { | ||
23 | __be32 version; /* Layout version */ | ||
24 | char volume[8]; /* Volume name */ | ||
25 | __be16 nparts; /* Number of partitions */ | ||
26 | struct sun_info { /* Partition hdrs, sec 2 */ | ||
27 | __be16 id; | ||
28 | __be16 flags; | ||
29 | } infos[8]; | ||
30 | __be16 padding; /* Alignment padding */ | ||
31 | __be32 bootinfo[3]; /* Info needed by mboot */ | ||
32 | __be32 sanity; /* To verify vtoc sanity */ | ||
33 | __be32 reserved[10]; /* Free space */ | ||
34 | __be32 timestamp[8]; /* Partition timestamp */ | ||
35 | } vtoc; | ||
36 | __be32 write_reinstruct; /* sectors to skip, writes */ | ||
37 | __be32 read_reinstruct; /* sectors to skip, reads */ | ||
38 | unsigned char spare[148]; /* Padding */ | ||
39 | __be16 rspeed; /* Disk rotational speed */ | ||
40 | __be16 pcylcount; /* Physical cylinder count */ | ||
41 | __be16 sparecyl; /* extra sects per cylinder */ | ||
42 | __be16 obs1; /* gap1 */ | ||
43 | __be16 obs2; /* gap2 */ | ||
44 | __be16 ilfact; /* Interleave factor */ | ||
45 | __be16 ncyl; /* Data cylinder count */ | ||
46 | __be16 nacyl; /* Alt. cylinder count */ | ||
47 | __be16 ntrks; /* Tracks per cylinder */ | ||
48 | __be16 nsect; /* Sectors per track */ | ||
49 | __be16 obs3; /* bhead - Label head offset */ | ||
50 | __be16 obs4; /* ppart - Physical Partition */ | ||
51 | struct sun_partition { | ||
52 | __be32 start_cylinder; | ||
53 | __be32 num_sectors; | ||
54 | } partitions[8]; | ||
55 | __be16 magic; /* Magic number */ | ||
56 | __be16 csum; /* Label xor'd checksum */ | ||
57 | } * label; | ||
58 | struct sun_partition *p; | ||
59 | unsigned long spc; | ||
60 | char b[BDEVNAME_SIZE]; | ||
61 | int use_vtoc; | ||
62 | int nparts; | ||
63 | |||
64 | label = read_part_sector(state, 0, §); | ||
65 | if (!label) | ||
66 | return -1; | ||
67 | |||
68 | p = label->partitions; | ||
69 | if (be16_to_cpu(label->magic) != SUN_LABEL_MAGIC) { | ||
70 | /* printk(KERN_INFO "Dev %s Sun disklabel: bad magic %04x\n", | ||
71 | bdevname(bdev, b), be16_to_cpu(label->magic)); */ | ||
72 | put_dev_sector(sect); | ||
73 | return 0; | ||
74 | } | ||
75 | /* Look at the checksum */ | ||
76 | ush = ((__be16 *) (label+1)) - 1; | ||
77 | for (csum = 0; ush >= ((__be16 *) label);) | ||
78 | csum ^= *ush--; | ||
79 | if (csum) { | ||
80 | printk("Dev %s Sun disklabel: Csum bad, label corrupted\n", | ||
81 | bdevname(state->bdev, b)); | ||
82 | put_dev_sector(sect); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | /* Check to see if we can use the VTOC table */ | ||
87 | use_vtoc = ((be32_to_cpu(label->vtoc.sanity) == SUN_VTOC_SANITY) && | ||
88 | (be32_to_cpu(label->vtoc.version) == 1) && | ||
89 | (be16_to_cpu(label->vtoc.nparts) <= 8)); | ||
90 | |||
91 | /* Use 8 partition entries if not specified in validated VTOC */ | ||
92 | nparts = (use_vtoc) ? be16_to_cpu(label->vtoc.nparts) : 8; | ||
93 | |||
94 | /* | ||
95 | * So that old Linux-Sun partitions continue to work, | ||
96 | * alow the VTOC to be used under the additional condition ... | ||
97 | */ | ||
98 | use_vtoc = use_vtoc || !(label->vtoc.sanity || | ||
99 | label->vtoc.version || label->vtoc.nparts); | ||
100 | spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect); | ||
101 | for (i = 0; i < nparts; i++, p++) { | ||
102 | unsigned long st_sector; | ||
103 | unsigned int num_sectors; | ||
104 | |||
105 | st_sector = be32_to_cpu(p->start_cylinder) * spc; | ||
106 | num_sectors = be32_to_cpu(p->num_sectors); | ||
107 | if (num_sectors) { | ||
108 | put_partition(state, slot, st_sector, num_sectors); | ||
109 | state->parts[slot].flags = 0; | ||
110 | if (use_vtoc) { | ||
111 | if (be16_to_cpu(label->vtoc.infos[i].id) == LINUX_RAID_PARTITION) | ||
112 | state->parts[slot].flags |= ADDPART_FLAG_RAID; | ||
113 | else if (be16_to_cpu(label->vtoc.infos[i].id) == SUN_WHOLE_DISK) | ||
114 | state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK; | ||
115 | } | ||
116 | } | ||
117 | slot++; | ||
118 | } | ||
119 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
120 | put_dev_sector(sect); | ||
121 | return 1; | ||
122 | } | ||
diff --git a/fs/partitions/sun.h b/fs/partitions/sun.h deleted file mode 100644 index 2424baa8319f..000000000000 --- a/fs/partitions/sun.h +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/sun.h | ||
3 | */ | ||
4 | |||
5 | #define SUN_LABEL_MAGIC 0xDABE | ||
6 | #define SUN_VTOC_SANITY 0x600DDEEE | ||
7 | |||
8 | int sun_partition(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/sysv68.c b/fs/partitions/sysv68.c deleted file mode 100644 index 9627ccffc1c4..000000000000 --- a/fs/partitions/sysv68.c +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/sysv68.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Philippe De Muyter <phdm@macqel.be> | ||
5 | */ | ||
6 | |||
7 | #include "check.h" | ||
8 | #include "sysv68.h" | ||
9 | |||
10 | /* | ||
11 | * Volume ID structure: on first 256-bytes sector of disk | ||
12 | */ | ||
13 | |||
14 | struct volumeid { | ||
15 | u8 vid_unused[248]; | ||
16 | u8 vid_mac[8]; /* ASCII string "MOTOROLA" */ | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * config block: second 256-bytes sector on disk | ||
21 | */ | ||
22 | |||
23 | struct dkconfig { | ||
24 | u8 ios_unused0[128]; | ||
25 | __be32 ios_slcblk; /* Slice table block number */ | ||
26 | __be16 ios_slccnt; /* Number of entries in slice table */ | ||
27 | u8 ios_unused1[122]; | ||
28 | }; | ||
29 | |||
30 | /* | ||
31 | * combined volumeid and dkconfig block | ||
32 | */ | ||
33 | |||
34 | struct dkblk0 { | ||
35 | struct volumeid dk_vid; | ||
36 | struct dkconfig dk_ios; | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Slice Table Structure | ||
41 | */ | ||
42 | |||
43 | struct slice { | ||
44 | __be32 nblocks; /* slice size (in blocks) */ | ||
45 | __be32 blkoff; /* block offset of slice */ | ||
46 | }; | ||
47 | |||
48 | |||
49 | int sysv68_partition(struct parsed_partitions *state) | ||
50 | { | ||
51 | int i, slices; | ||
52 | int slot = 1; | ||
53 | Sector sect; | ||
54 | unsigned char *data; | ||
55 | struct dkblk0 *b; | ||
56 | struct slice *slice; | ||
57 | char tmp[64]; | ||
58 | |||
59 | data = read_part_sector(state, 0, §); | ||
60 | if (!data) | ||
61 | return -1; | ||
62 | |||
63 | b = (struct dkblk0 *)data; | ||
64 | if (memcmp(b->dk_vid.vid_mac, "MOTOROLA", sizeof(b->dk_vid.vid_mac))) { | ||
65 | put_dev_sector(sect); | ||
66 | return 0; | ||
67 | } | ||
68 | slices = be16_to_cpu(b->dk_ios.ios_slccnt); | ||
69 | i = be32_to_cpu(b->dk_ios.ios_slcblk); | ||
70 | put_dev_sector(sect); | ||
71 | |||
72 | data = read_part_sector(state, i, §); | ||
73 | if (!data) | ||
74 | return -1; | ||
75 | |||
76 | slices -= 1; /* last slice is the whole disk */ | ||
77 | snprintf(tmp, sizeof(tmp), "sysV68: %s(s%u)", state->name, slices); | ||
78 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
79 | slice = (struct slice *)data; | ||
80 | for (i = 0; i < slices; i++, slice++) { | ||
81 | if (slot == state->limit) | ||
82 | break; | ||
83 | if (be32_to_cpu(slice->nblocks)) { | ||
84 | put_partition(state, slot, | ||
85 | be32_to_cpu(slice->blkoff), | ||
86 | be32_to_cpu(slice->nblocks)); | ||
87 | snprintf(tmp, sizeof(tmp), "(s%u)", i); | ||
88 | strlcat(state->pp_buf, tmp, PAGE_SIZE); | ||
89 | } | ||
90 | slot++; | ||
91 | } | ||
92 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
93 | put_dev_sector(sect); | ||
94 | return 1; | ||
95 | } | ||
diff --git a/fs/partitions/sysv68.h b/fs/partitions/sysv68.h deleted file mode 100644 index bf2f5ffa97ac..000000000000 --- a/fs/partitions/sysv68.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | extern int sysv68_partition(struct parsed_partitions *state); | ||
diff --git a/fs/partitions/ultrix.c b/fs/partitions/ultrix.c deleted file mode 100644 index 8dbaf9f77a99..000000000000 --- a/fs/partitions/ultrix.c +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/ultrix.c | ||
3 | * | ||
4 | * Code extracted from drivers/block/genhd.c | ||
5 | * | ||
6 | * Re-organised Jul 1999 Russell King | ||
7 | */ | ||
8 | |||
9 | #include "check.h" | ||
10 | #include "ultrix.h" | ||
11 | |||
12 | int ultrix_partition(struct parsed_partitions *state) | ||
13 | { | ||
14 | int i; | ||
15 | Sector sect; | ||
16 | unsigned char *data; | ||
17 | struct ultrix_disklabel { | ||
18 | s32 pt_magic; /* magic no. indicating part. info exits */ | ||
19 | s32 pt_valid; /* set by driver if pt is current */ | ||
20 | struct pt_info { | ||
21 | s32 pi_nblocks; /* no. of sectors */ | ||
22 | u32 pi_blkoff; /* block offset for start */ | ||
23 | } pt_part[8]; | ||
24 | } *label; | ||
25 | |||
26 | #define PT_MAGIC 0x032957 /* Partition magic number */ | ||
27 | #define PT_VALID 1 /* Indicates if struct is valid */ | ||
28 | |||
29 | data = read_part_sector(state, (16384 - sizeof(*label))/512, §); | ||
30 | if (!data) | ||
31 | return -1; | ||
32 | |||
33 | label = (struct ultrix_disklabel *)(data + 512 - sizeof(*label)); | ||
34 | |||
35 | if (label->pt_magic == PT_MAGIC && label->pt_valid == PT_VALID) { | ||
36 | for (i=0; i<8; i++) | ||
37 | if (label->pt_part[i].pi_nblocks) | ||
38 | put_partition(state, i+1, | ||
39 | label->pt_part[i].pi_blkoff, | ||
40 | label->pt_part[i].pi_nblocks); | ||
41 | put_dev_sector(sect); | ||
42 | strlcat(state->pp_buf, "\n", PAGE_SIZE); | ||
43 | return 1; | ||
44 | } else { | ||
45 | put_dev_sector(sect); | ||
46 | return 0; | ||
47 | } | ||
48 | } | ||
diff --git a/fs/partitions/ultrix.h b/fs/partitions/ultrix.h deleted file mode 100644 index a3cc00b2bded..000000000000 --- a/fs/partitions/ultrix.h +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | /* | ||
2 | * fs/partitions/ultrix.h | ||
3 | */ | ||
4 | |||
5 | int ultrix_partition(struct parsed_partitions *state); | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 07446b55b7cc..a1dddda999f2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -101,7 +101,7 @@ | |||
101 | struct pid_entry { | 101 | struct pid_entry { |
102 | char *name; | 102 | char *name; |
103 | int len; | 103 | int len; |
104 | mode_t mode; | 104 | umode_t mode; |
105 | const struct inode_operations *iop; | 105 | const struct inode_operations *iop; |
106 | const struct file_operations *fop; | 106 | const struct file_operations *fop; |
107 | union proc_op op; | 107 | union proc_op op; |
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 10090d9c7ad5..2edf34f2eb61 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -597,7 +597,7 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp | |||
597 | 597 | ||
598 | static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, | 598 | static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, |
599 | const char *name, | 599 | const char *name, |
600 | mode_t mode, | 600 | umode_t mode, |
601 | nlink_t nlink) | 601 | nlink_t nlink) |
602 | { | 602 | { |
603 | struct proc_dir_entry *ent = NULL; | 603 | struct proc_dir_entry *ent = NULL; |
@@ -659,7 +659,7 @@ struct proc_dir_entry *proc_symlink(const char *name, | |||
659 | } | 659 | } |
660 | EXPORT_SYMBOL(proc_symlink); | 660 | EXPORT_SYMBOL(proc_symlink); |
661 | 661 | ||
662 | struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode, | 662 | struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode, |
663 | struct proc_dir_entry *parent) | 663 | struct proc_dir_entry *parent) |
664 | { | 664 | { |
665 | struct proc_dir_entry *ent; | 665 | struct proc_dir_entry *ent; |
@@ -699,7 +699,7 @@ struct proc_dir_entry *proc_mkdir(const char *name, | |||
699 | } | 699 | } |
700 | EXPORT_SYMBOL(proc_mkdir); | 700 | EXPORT_SYMBOL(proc_mkdir); |
701 | 701 | ||
702 | struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, | 702 | struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode, |
703 | struct proc_dir_entry *parent) | 703 | struct proc_dir_entry *parent) |
704 | { | 704 | { |
705 | struct proc_dir_entry *ent; | 705 | struct proc_dir_entry *ent; |
@@ -728,7 +728,7 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, | |||
728 | } | 728 | } |
729 | EXPORT_SYMBOL(create_proc_entry); | 729 | EXPORT_SYMBOL(create_proc_entry); |
730 | 730 | ||
731 | struct proc_dir_entry *proc_create_data(const char *name, mode_t mode, | 731 | struct proc_dir_entry *proc_create_data(const char *name, umode_t mode, |
732 | struct proc_dir_entry *parent, | 732 | struct proc_dir_entry *parent, |
733 | const struct file_operations *proc_fops, | 733 | const struct file_operations *proc_fops, |
734 | void *data) | 734 | void *data) |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index f738024ccc8e..06e1cc17caf6 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -179,7 +179,7 @@ const struct file_operations proc_net_operations = { | |||
179 | 179 | ||
180 | 180 | ||
181 | struct proc_dir_entry *proc_net_fops_create(struct net *net, | 181 | struct proc_dir_entry *proc_net_fops_create(struct net *net, |
182 | const char *name, mode_t mode, const struct file_operations *fops) | 182 | const char *name, umode_t mode, const struct file_operations *fops) |
183 | { | 183 | { |
184 | return proc_create(name, mode, net->proc_net, fops); | 184 | return proc_create(name, mode, net->proc_net, fops); |
185 | } | 185 | } |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 5b572c89e6c4..5d81e92daf83 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -73,7 +73,6 @@ | |||
73 | #include <linux/security.h> | 73 | #include <linux/security.h> |
74 | #include <linux/kmod.h> | 74 | #include <linux/kmod.h> |
75 | #include <linux/namei.h> | 75 | #include <linux/namei.h> |
76 | #include <linux/buffer_head.h> | ||
77 | #include <linux/capability.h> | 76 | #include <linux/capability.h> |
78 | #include <linux/quotaops.h> | 77 | #include <linux/quotaops.h> |
79 | #include "../internal.h" /* ugh */ | 78 | #include "../internal.h" /* ugh */ |
diff --git a/fs/quota/quota.c b/fs/quota/quota.c index 35f4b0ecdeb3..7898cd688a00 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/security.h> | 14 | #include <linux/security.h> |
15 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
16 | #include <linux/buffer_head.h> | ||
17 | #include <linux/capability.h> | 16 | #include <linux/capability.h> |
18 | #include <linux/quotaops.h> | 17 | #include <linux/quotaops.h> |
19 | #include <linux/types.h> | 18 | #include <linux/types.h> |
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 462ceb38fec6..aec766abe3af 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -52,7 +52,7 @@ static struct backing_dev_info ramfs_backing_dev_info = { | |||
52 | }; | 52 | }; |
53 | 53 | ||
54 | struct inode *ramfs_get_inode(struct super_block *sb, | 54 | struct inode *ramfs_get_inode(struct super_block *sb, |
55 | const struct inode *dir, int mode, dev_t dev) | 55 | const struct inode *dir, umode_t mode, dev_t dev) |
56 | { | 56 | { |
57 | struct inode * inode = new_inode(sb); | 57 | struct inode * inode = new_inode(sb); |
58 | 58 | ||
@@ -92,7 +92,7 @@ struct inode *ramfs_get_inode(struct super_block *sb, | |||
92 | */ | 92 | */ |
93 | /* SMP-safe */ | 93 | /* SMP-safe */ |
94 | static int | 94 | static int |
95 | ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 95 | ramfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) |
96 | { | 96 | { |
97 | struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev); | 97 | struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev); |
98 | int error = -ENOSPC; | 98 | int error = -ENOSPC; |
@@ -106,7 +106,7 @@ ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | |||
106 | return error; | 106 | return error; |
107 | } | 107 | } |
108 | 108 | ||
109 | static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 109 | static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) |
110 | { | 110 | { |
111 | int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0); | 111 | int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0); |
112 | if (!retval) | 112 | if (!retval) |
@@ -114,7 +114,7 @@ static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
114 | return retval; | 114 | return retval; |
115 | } | 115 | } |
116 | 116 | ||
117 | static int ramfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) | 117 | static int ramfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, struct nameidata *nd) |
118 | { | 118 | { |
119 | return ramfs_mknod(dir, dentry, mode | S_IFREG, 0); | 119 | return ramfs_mknod(dir, dentry, mode | S_IFREG, 0); |
120 | } | 120 | } |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 950f13af0951..9e8cd5acd79c 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1766,7 +1766,7 @@ static int reiserfs_new_symlink(struct reiserfs_transaction_handle *th, struct i | |||
1766 | for the fresh inode. This can only be done outside a transaction, so | 1766 | for the fresh inode. This can only be done outside a transaction, so |
1767 | if we return non-zero, we also end the transaction. */ | 1767 | if we return non-zero, we also end the transaction. */ |
1768 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | 1768 | int reiserfs_new_inode(struct reiserfs_transaction_handle *th, |
1769 | struct inode *dir, int mode, const char *symname, | 1769 | struct inode *dir, umode_t mode, const char *symname, |
1770 | /* 0 for regular, EMTRY_DIR_SIZE for dirs, | 1770 | /* 0 for regular, EMTRY_DIR_SIZE for dirs, |
1771 | strlen (symname) for symlinks) */ | 1771 | strlen (symname) for symlinks) */ |
1772 | loff_t i_size, struct dentry *dentry, | 1772 | loff_t i_size, struct dentry *dentry, |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 80058e8ce361..146378865239 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -559,7 +559,7 @@ static int drop_new_inode(struct inode *inode) | |||
559 | ** outside of a transaction, so we had to pull some bits of | 559 | ** outside of a transaction, so we had to pull some bits of |
560 | ** reiserfs_new_inode out into this func. | 560 | ** reiserfs_new_inode out into this func. |
561 | */ | 561 | */ |
562 | static int new_inode_init(struct inode *inode, struct inode *dir, int mode) | 562 | static int new_inode_init(struct inode *inode, struct inode *dir, umode_t mode) |
563 | { | 563 | { |
564 | /* Make inode invalid - just in case we are going to drop it before | 564 | /* Make inode invalid - just in case we are going to drop it before |
565 | * the initialization happens */ | 565 | * the initialization happens */ |
@@ -572,7 +572,7 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode) | |||
572 | return 0; | 572 | return 0; |
573 | } | 573 | } |
574 | 574 | ||
575 | static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode, | 575 | static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
576 | struct nameidata *nd) | 576 | struct nameidata *nd) |
577 | { | 577 | { |
578 | int retval; | 578 | int retval; |
@@ -643,7 +643,7 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
643 | return retval; | 643 | return retval; |
644 | } | 644 | } |
645 | 645 | ||
646 | static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode, | 646 | static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, |
647 | dev_t rdev) | 647 | dev_t rdev) |
648 | { | 648 | { |
649 | int retval; | 649 | int retval; |
@@ -721,7 +721,7 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, int mode, | |||
721 | return retval; | 721 | return retval; |
722 | } | 722 | } |
723 | 723 | ||
724 | static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 724 | static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
725 | { | 725 | { |
726 | int retval; | 726 | int retval; |
727 | struct inode *inode; | 727 | struct inode *inode; |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 6bc346c160e7..c24deda8a8bc 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -66,7 +66,7 @@ static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) | |||
66 | } | 66 | } |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 69 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
70 | { | 70 | { |
71 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 71 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); |
72 | return dir->i_op->mkdir(dir, dentry, mode); | 72 | return dir->i_op->mkdir(dir, dentry, mode); |
diff --git a/fs/splice.c b/fs/splice.c index fa2defa8afcf..1ec0493266b3 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/mm_inline.h> | 25 | #include <linux/mm_inline.h> |
26 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
27 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
28 | #include <linux/buffer_head.h> | ||
29 | #include <linux/module.h> | 28 | #include <linux/module.h> |
30 | #include <linux/syscalls.h> | 29 | #include <linux/syscalls.h> |
31 | #include <linux/uio.h> | 30 | #include <linux/uio.h> |
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/quotaops.h> | 16 | #include <linux/quotaops.h> |
17 | #include <linux/buffer_head.h> | ||
18 | #include <linux/backing-dev.h> | 17 | #include <linux/backing-dev.h> |
19 | #include "internal.h" | 18 | #include "internal.h" |
20 | 19 | ||
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index d4e6080b4b20..62f4fb37789e 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -518,7 +518,7 @@ out: | |||
518 | } | 518 | } |
519 | 519 | ||
520 | int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, | 520 | int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, |
521 | const struct attribute *attr, int type, mode_t amode) | 521 | const struct attribute *attr, int type, umode_t amode) |
522 | { | 522 | { |
523 | umode_t mode = (amode & S_IALLUGO) | S_IFREG; | 523 | umode_t mode = (amode & S_IALLUGO) | S_IFREG; |
524 | struct sysfs_addrm_cxt acxt; | 524 | struct sysfs_addrm_cxt acxt; |
@@ -618,7 +618,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_file_to_group); | |||
618 | * | 618 | * |
619 | */ | 619 | */ |
620 | int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, | 620 | int sysfs_chmod_file(struct kobject *kobj, const struct attribute *attr, |
621 | mode_t mode) | 621 | umode_t mode) |
622 | { | 622 | { |
623 | struct sysfs_dirent *sd; | 623 | struct sysfs_dirent *sd; |
624 | struct iattr newattrs; | 624 | struct iattr newattrs; |
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 194414f8298c..dd1701caecc9 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
@@ -33,7 +33,7 @@ static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, | |||
33 | int error = 0, i; | 33 | int error = 0, i; |
34 | 34 | ||
35 | for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { | 35 | for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { |
36 | mode_t mode = 0; | 36 | umode_t mode = 0; |
37 | 37 | ||
38 | /* in update mode, we're changing the permissions or | 38 | /* in update mode, we're changing the permissions or |
39 | * visibility. Do this by first removing then | 39 | * visibility. Do this by first removing then |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index c81b22f3ace1..4a802b4a9056 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -187,7 +187,7 @@ out: | |||
187 | return error; | 187 | return error; |
188 | } | 188 | } |
189 | 189 | ||
190 | static inline void set_default_inode_attr(struct inode * inode, mode_t mode) | 190 | static inline void set_default_inode_attr(struct inode * inode, umode_t mode) |
191 | { | 191 | { |
192 | inode->i_mode = mode; | 192 | inode->i_mode = mode; |
193 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 193 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index ce29e28b766d..7484a36ee678 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -79,7 +79,7 @@ struct sysfs_dirent { | |||
79 | }; | 79 | }; |
80 | 80 | ||
81 | unsigned int s_flags; | 81 | unsigned int s_flags; |
82 | unsigned short s_mode; | 82 | umode_t s_mode; |
83 | ino_t s_ino; | 83 | ino_t s_ino; |
84 | struct sysfs_inode_attrs *s_iattr; | 84 | struct sysfs_inode_attrs *s_iattr; |
85 | }; | 85 | }; |
@@ -229,7 +229,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, | |||
229 | const struct attribute *attr, int type); | 229 | const struct attribute *attr, int type); |
230 | 230 | ||
231 | int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, | 231 | int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, |
232 | const struct attribute *attr, int type, mode_t amode); | 232 | const struct attribute *attr, int type, umode_t amode); |
233 | /* | 233 | /* |
234 | * bin.c | 234 | * bin.c |
235 | */ | 235 | */ |
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c index 0c96c98bd1db..8233b02eccae 100644 --- a/fs/sysv/ialloc.c +++ b/fs/sysv/ialloc.c | |||
@@ -132,7 +132,7 @@ void sysv_free_inode(struct inode * inode) | |||
132 | brelse(bh); | 132 | brelse(bh); |
133 | } | 133 | } |
134 | 134 | ||
135 | struct inode * sysv_new_inode(const struct inode * dir, mode_t mode) | 135 | struct inode * sysv_new_inode(const struct inode * dir, umode_t mode) |
136 | { | 136 | { |
137 | struct super_block *sb = dir->i_sb; | 137 | struct super_block *sb = dir->i_sb; |
138 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 138 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index e474fbcf8bde..b217797e621b 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
@@ -61,7 +61,7 @@ static struct dentry *sysv_lookup(struct inode * dir, struct dentry * dentry, st | |||
61 | return NULL; | 61 | return NULL; |
62 | } | 62 | } |
63 | 63 | ||
64 | static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_t rdev) | 64 | static int sysv_mknod(struct inode * dir, struct dentry * dentry, umode_t mode, dev_t rdev) |
65 | { | 65 | { |
66 | struct inode * inode; | 66 | struct inode * inode; |
67 | int err; | 67 | int err; |
@@ -80,7 +80,7 @@ static int sysv_mknod(struct inode * dir, struct dentry * dentry, int mode, dev_ | |||
80 | return err; | 80 | return err; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int sysv_create(struct inode * dir, struct dentry * dentry, int mode, struct nameidata *nd) | 83 | static int sysv_create(struct inode * dir, struct dentry * dentry, umode_t mode, struct nameidata *nd) |
84 | { | 84 | { |
85 | return sysv_mknod(dir, dentry, mode, 0); | 85 | return sysv_mknod(dir, dentry, mode, 0); |
86 | } | 86 | } |
@@ -131,7 +131,7 @@ static int sysv_link(struct dentry * old_dentry, struct inode * dir, | |||
131 | return add_nondir(dentry, inode); | 131 | return add_nondir(dentry, inode); |
132 | } | 132 | } |
133 | 133 | ||
134 | static int sysv_mkdir(struct inode * dir, struct dentry *dentry, int mode) | 134 | static int sysv_mkdir(struct inode * dir, struct dentry *dentry, umode_t mode) |
135 | { | 135 | { |
136 | struct inode * inode; | 136 | struct inode * inode; |
137 | int err = -EMLINK; | 137 | int err = -EMLINK; |
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h index bb55cdb394bf..0e4b821c5691 100644 --- a/fs/sysv/sysv.h +++ b/fs/sysv/sysv.h | |||
@@ -125,7 +125,7 @@ static inline void dirty_sb(struct super_block *sb) | |||
125 | /* ialloc.c */ | 125 | /* ialloc.c */ |
126 | extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned, | 126 | extern struct sysv_inode *sysv_raw_inode(struct super_block *, unsigned, |
127 | struct buffer_head **); | 127 | struct buffer_head **); |
128 | extern struct inode * sysv_new_inode(const struct inode *, mode_t); | 128 | extern struct inode * sysv_new_inode(const struct inode *, umode_t); |
129 | extern void sysv_free_inode(struct inode *); | 129 | extern void sysv_free_inode(struct inode *); |
130 | extern unsigned long sysv_count_free_inodes(struct super_block *); | 130 | extern unsigned long sysv_count_free_inodes(struct super_block *); |
131 | 131 | ||
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 683492043317..d6fe1c79f18b 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * | 56 | * |
57 | * This function returns the inherited flags. | 57 | * This function returns the inherited flags. |
58 | */ | 58 | */ |
59 | static int inherit_flags(const struct inode *dir, int mode) | 59 | static int inherit_flags(const struct inode *dir, umode_t mode) |
60 | { | 60 | { |
61 | int flags; | 61 | int flags; |
62 | const struct ubifs_inode *ui = ubifs_inode(dir); | 62 | const struct ubifs_inode *ui = ubifs_inode(dir); |
@@ -86,7 +86,7 @@ static int inherit_flags(const struct inode *dir, int mode) | |||
86 | * case of failure. | 86 | * case of failure. |
87 | */ | 87 | */ |
88 | struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, | 88 | struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, |
89 | int mode) | 89 | umode_t mode) |
90 | { | 90 | { |
91 | struct inode *inode; | 91 | struct inode *inode; |
92 | struct ubifs_inode *ui; | 92 | struct ubifs_inode *ui; |
@@ -253,7 +253,7 @@ out: | |||
253 | return ERR_PTR(err); | 253 | return ERR_PTR(err); |
254 | } | 254 | } |
255 | 255 | ||
256 | static int ubifs_create(struct inode *dir, struct dentry *dentry, int mode, | 256 | static int ubifs_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
257 | struct nameidata *nd) | 257 | struct nameidata *nd) |
258 | { | 258 | { |
259 | struct inode *inode; | 259 | struct inode *inode; |
@@ -268,7 +268,7 @@ static int ubifs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
268 | * parent directory inode. | 268 | * parent directory inode. |
269 | */ | 269 | */ |
270 | 270 | ||
271 | dbg_gen("dent '%.*s', mode %#x in dir ino %lu", | 271 | dbg_gen("dent '%.*s', mode %#hx in dir ino %lu", |
272 | dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); | 272 | dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); |
273 | 273 | ||
274 | err = ubifs_budget_space(c, &req); | 274 | err = ubifs_budget_space(c, &req); |
@@ -712,7 +712,7 @@ out_cancel: | |||
712 | return err; | 712 | return err; |
713 | } | 713 | } |
714 | 714 | ||
715 | static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 715 | static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
716 | { | 716 | { |
717 | struct inode *inode; | 717 | struct inode *inode; |
718 | struct ubifs_inode *dir_ui = ubifs_inode(dir); | 718 | struct ubifs_inode *dir_ui = ubifs_inode(dir); |
@@ -725,7 +725,7 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
725 | * directory inode. | 725 | * directory inode. |
726 | */ | 726 | */ |
727 | 727 | ||
728 | dbg_gen("dent '%.*s', mode %#x in dir ino %lu", | 728 | dbg_gen("dent '%.*s', mode %#hx in dir ino %lu", |
729 | dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); | 729 | dentry->d_name.len, dentry->d_name.name, mode, dir->i_ino); |
730 | 730 | ||
731 | err = ubifs_budget_space(c, &req); | 731 | err = ubifs_budget_space(c, &req); |
@@ -769,7 +769,7 @@ out_budg: | |||
769 | } | 769 | } |
770 | 770 | ||
771 | static int ubifs_mknod(struct inode *dir, struct dentry *dentry, | 771 | static int ubifs_mknod(struct inode *dir, struct dentry *dentry, |
772 | int mode, dev_t rdev) | 772 | umode_t mode, dev_t rdev) |
773 | { | 773 | { |
774 | struct inode *inode; | 774 | struct inode *inode; |
775 | struct ubifs_inode *ui; | 775 | struct ubifs_inode *ui; |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 27f22551f805..12e94774aa88 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -1734,7 +1734,7 @@ int ubifs_setattr(struct dentry *dentry, struct iattr *attr); | |||
1734 | 1734 | ||
1735 | /* dir.c */ | 1735 | /* dir.c */ |
1736 | struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, | 1736 | struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, |
1737 | int mode); | 1737 | umode_t mode); |
1738 | int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | 1738 | int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry, |
1739 | struct kstat *stat); | 1739 | struct kstat *stat); |
1740 | 1740 | ||
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 6fb7e0adcda0..05ab48195be9 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -46,7 +46,7 @@ void udf_free_inode(struct inode *inode) | |||
46 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); | 46 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
47 | } | 47 | } |
48 | 48 | ||
49 | struct inode *udf_new_inode(struct inode *dir, int mode, int *err) | 49 | struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) |
50 | { | 50 | { |
51 | struct super_block *sb = dir->i_sb; | 51 | struct super_block *sb = dir->i_sb; |
52 | struct udf_sb_info *sbi = UDF_SB(sb); | 52 | struct udf_sb_info *sbi = UDF_SB(sb); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 4fd1d809738c..4598904be1bb 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -48,7 +48,7 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | #define EXTENT_MERGE_SIZE 5 | 49 | #define EXTENT_MERGE_SIZE 5 |
50 | 50 | ||
51 | static mode_t udf_convert_permissions(struct fileEntry *); | 51 | static umode_t udf_convert_permissions(struct fileEntry *); |
52 | static int udf_update_inode(struct inode *, int); | 52 | static int udf_update_inode(struct inode *, int); |
53 | static void udf_fill_inode(struct inode *, struct buffer_head *); | 53 | static void udf_fill_inode(struct inode *, struct buffer_head *); |
54 | static int udf_sync_inode(struct inode *inode); | 54 | static int udf_sync_inode(struct inode *inode); |
@@ -1452,9 +1452,9 @@ static int udf_alloc_i_data(struct inode *inode, size_t size) | |||
1452 | return 0; | 1452 | return 0; |
1453 | } | 1453 | } |
1454 | 1454 | ||
1455 | static mode_t udf_convert_permissions(struct fileEntry *fe) | 1455 | static umode_t udf_convert_permissions(struct fileEntry *fe) |
1456 | { | 1456 | { |
1457 | mode_t mode; | 1457 | umode_t mode; |
1458 | uint32_t permissions; | 1458 | uint32_t permissions; |
1459 | uint32_t flags; | 1459 | uint32_t flags; |
1460 | 1460 | ||
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 4639e137222f..08bf46edf9c4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -552,7 +552,7 @@ static int udf_delete_entry(struct inode *inode, struct fileIdentDesc *fi, | |||
552 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); | 552 | return udf_write_fi(inode, cfi, fi, fibh, NULL, NULL); |
553 | } | 553 | } |
554 | 554 | ||
555 | static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | 555 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
556 | struct nameidata *nd) | 556 | struct nameidata *nd) |
557 | { | 557 | { |
558 | struct udf_fileident_bh fibh; | 558 | struct udf_fileident_bh fibh; |
@@ -596,7 +596,7 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode, | |||
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode, | 599 | static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, |
600 | dev_t rdev) | 600 | dev_t rdev) |
601 | { | 601 | { |
602 | struct inode *inode; | 602 | struct inode *inode; |
@@ -640,7 +640,7 @@ out: | |||
640 | return err; | 640 | return err; |
641 | } | 641 | } |
642 | 642 | ||
643 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 643 | static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
644 | { | 644 | { |
645 | struct inode *inode; | 645 | struct inode *inode; |
646 | struct udf_fileident_bh fibh; | 646 | struct udf_fileident_bh fibh; |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 7cbe669e1026..c94fc889a486 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -195,11 +195,11 @@ struct udf_options { | |||
195 | unsigned int fileset; | 195 | unsigned int fileset; |
196 | unsigned int rootdir; | 196 | unsigned int rootdir; |
197 | unsigned int flags; | 197 | unsigned int flags; |
198 | mode_t umask; | 198 | umode_t umask; |
199 | gid_t gid; | 199 | gid_t gid; |
200 | uid_t uid; | 200 | uid_t uid; |
201 | mode_t fmode; | 201 | umode_t fmode; |
202 | mode_t dmode; | 202 | umode_t dmode; |
203 | struct nls_table *nls_map; | 203 | struct nls_table *nls_map; |
204 | }; | 204 | }; |
205 | 205 | ||
@@ -279,11 +279,11 @@ static int udf_show_options(struct seq_file *seq, struct vfsmount *mnt) | |||
279 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) | 279 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET)) |
280 | seq_printf(seq, ",gid=%u", sbi->s_gid); | 280 | seq_printf(seq, ",gid=%u", sbi->s_gid); |
281 | if (sbi->s_umask != 0) | 281 | if (sbi->s_umask != 0) |
282 | seq_printf(seq, ",umask=%o", sbi->s_umask); | 282 | seq_printf(seq, ",umask=%ho", sbi->s_umask); |
283 | if (sbi->s_fmode != UDF_INVALID_MODE) | 283 | if (sbi->s_fmode != UDF_INVALID_MODE) |
284 | seq_printf(seq, ",mode=%o", sbi->s_fmode); | 284 | seq_printf(seq, ",mode=%ho", sbi->s_fmode); |
285 | if (sbi->s_dmode != UDF_INVALID_MODE) | 285 | if (sbi->s_dmode != UDF_INVALID_MODE) |
286 | seq_printf(seq, ",dmode=%o", sbi->s_dmode); | 286 | seq_printf(seq, ",dmode=%ho", sbi->s_dmode); |
287 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) | 287 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) |
288 | seq_printf(seq, ",session=%u", sbi->s_session); | 288 | seq_printf(seq, ",session=%u", sbi->s_session); |
289 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) | 289 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) |
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 5142a82e3276..42ad69ac9576 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define UDF_SPARABLE_MAP15 0x1522U | 50 | #define UDF_SPARABLE_MAP15 0x1522U |
51 | #define UDF_METADATA_MAP25 0x2511U | 51 | #define UDF_METADATA_MAP25 0x2511U |
52 | 52 | ||
53 | #define UDF_INVALID_MODE ((mode_t)-1) | 53 | #define UDF_INVALID_MODE ((umode_t)-1) |
54 | 54 | ||
55 | #pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ | 55 | #pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ |
56 | 56 | ||
@@ -127,11 +127,11 @@ struct udf_sb_info { | |||
127 | struct buffer_head *s_lvid_bh; | 127 | struct buffer_head *s_lvid_bh; |
128 | 128 | ||
129 | /* Default permissions */ | 129 | /* Default permissions */ |
130 | mode_t s_umask; | 130 | umode_t s_umask; |
131 | gid_t s_gid; | 131 | gid_t s_gid; |
132 | uid_t s_uid; | 132 | uid_t s_uid; |
133 | mode_t s_fmode; | 133 | umode_t s_fmode; |
134 | mode_t s_dmode; | 134 | umode_t s_dmode; |
135 | /* Lock protecting consistency of above permission settings */ | 135 | /* Lock protecting consistency of above permission settings */ |
136 | rwlock_t s_cred_lock; | 136 | rwlock_t s_cred_lock; |
137 | 137 | ||
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index f34e6fc0cdaa..ebe10314e512 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -215,7 +215,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *); | |||
215 | 215 | ||
216 | /* ialloc.c */ | 216 | /* ialloc.c */ |
217 | extern void udf_free_inode(struct inode *); | 217 | extern void udf_free_inode(struct inode *); |
218 | extern struct inode *udf_new_inode(struct inode *, int, int *); | 218 | extern struct inode *udf_new_inode(struct inode *, umode_t, int *); |
219 | 219 | ||
220 | /* truncate.c */ | 220 | /* truncate.c */ |
221 | extern void udf_truncate_tail_extent(struct inode *); | 221 | extern void udf_truncate_tail_extent(struct inode *); |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 78a4c70d46b5..4ec5c1085a87 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -170,7 +170,7 @@ static void ufs2_init_inodes_chunk(struct super_block *sb, | |||
170 | * For other inodes, search forward from the parent directory's block | 170 | * For other inodes, search forward from the parent directory's block |
171 | * group to find a free inode. | 171 | * group to find a free inode. |
172 | */ | 172 | */ |
173 | struct inode * ufs_new_inode(struct inode * dir, int mode) | 173 | struct inode *ufs_new_inode(struct inode *dir, umode_t mode) |
174 | { | 174 | { |
175 | struct super_block * sb; | 175 | struct super_block * sb; |
176 | struct ufs_sb_info * sbi; | 176 | struct ufs_sb_info * sbi; |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 879b13436fa4..9094e1d917be 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -583,7 +583,7 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
583 | { | 583 | { |
584 | struct ufs_inode_info *ufsi = UFS_I(inode); | 584 | struct ufs_inode_info *ufsi = UFS_I(inode); |
585 | struct super_block *sb = inode->i_sb; | 585 | struct super_block *sb = inode->i_sb; |
586 | mode_t mode; | 586 | umode_t mode; |
587 | 587 | ||
588 | /* | 588 | /* |
589 | * Copy data to the in-core inode. | 589 | * Copy data to the in-core inode. |
@@ -630,7 +630,7 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
630 | { | 630 | { |
631 | struct ufs_inode_info *ufsi = UFS_I(inode); | 631 | struct ufs_inode_info *ufsi = UFS_I(inode); |
632 | struct super_block *sb = inode->i_sb; | 632 | struct super_block *sb = inode->i_sb; |
633 | mode_t mode; | 633 | umode_t mode; |
634 | 634 | ||
635 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); | 635 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); |
636 | /* | 636 | /* |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 639d49162241..38cac199edff 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -70,7 +70,7 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, stru | |||
70 | * If the create succeeds, we fill in the inode information | 70 | * If the create succeeds, we fill in the inode information |
71 | * with d_instantiate(). | 71 | * with d_instantiate(). |
72 | */ | 72 | */ |
73 | static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, | 73 | static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode, |
74 | struct nameidata *nd) | 74 | struct nameidata *nd) |
75 | { | 75 | { |
76 | struct inode *inode; | 76 | struct inode *inode; |
@@ -94,7 +94,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, | |||
94 | return err; | 94 | return err; |
95 | } | 95 | } |
96 | 96 | ||
97 | static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) | 97 | static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) |
98 | { | 98 | { |
99 | struct inode *inode; | 99 | struct inode *inode; |
100 | int err; | 100 | int err; |
@@ -180,7 +180,7 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
180 | return error; | 180 | return error; |
181 | } | 181 | } |
182 | 182 | ||
183 | static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 183 | static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) |
184 | { | 184 | { |
185 | struct inode * inode; | 185 | struct inode * inode; |
186 | int err = -EMLINK; | 186 | int err = -EMLINK; |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index c26f2bcec264..528750b7e701 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
@@ -104,7 +104,7 @@ extern const struct address_space_operations ufs_aops; | |||
104 | 104 | ||
105 | /* ialloc.c */ | 105 | /* ialloc.c */ |
106 | extern void ufs_free_inode (struct inode *inode); | 106 | extern void ufs_free_inode (struct inode *inode); |
107 | extern struct inode * ufs_new_inode (struct inode *, int); | 107 | extern struct inode * ufs_new_inode (struct inode *, umode_t); |
108 | 108 | ||
109 | /* inode.c */ | 109 | /* inode.c */ |
110 | extern struct inode *ufs_iget(struct super_block *, unsigned long); | 110 | extern struct inode *ufs_iget(struct super_block *, unsigned long); |
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 169380e66057..dad1a31aa4fc 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -447,7 +447,7 @@ STATIC xfs_buf_t * /* allocation group buffer */ | |||
447 | xfs_ialloc_ag_select( | 447 | xfs_ialloc_ag_select( |
448 | xfs_trans_t *tp, /* transaction pointer */ | 448 | xfs_trans_t *tp, /* transaction pointer */ |
449 | xfs_ino_t parent, /* parent directory inode number */ | 449 | xfs_ino_t parent, /* parent directory inode number */ |
450 | mode_t mode, /* bits set to indicate file type */ | 450 | umode_t mode, /* bits set to indicate file type */ |
451 | int okalloc) /* ok to allocate more space */ | 451 | int okalloc) /* ok to allocate more space */ |
452 | { | 452 | { |
453 | xfs_buf_t *agbp; /* allocation group header buffer */ | 453 | xfs_buf_t *agbp; /* allocation group header buffer */ |
@@ -640,7 +640,7 @@ int | |||
640 | xfs_dialloc( | 640 | xfs_dialloc( |
641 | xfs_trans_t *tp, /* transaction pointer */ | 641 | xfs_trans_t *tp, /* transaction pointer */ |
642 | xfs_ino_t parent, /* parent inode (directory) */ | 642 | xfs_ino_t parent, /* parent inode (directory) */ |
643 | mode_t mode, /* mode bits for new inode */ | 643 | umode_t mode, /* mode bits for new inode */ |
644 | int okalloc, /* ok to allocate more space */ | 644 | int okalloc, /* ok to allocate more space */ |
645 | xfs_buf_t **IO_agbp, /* in/out ag header's buffer */ | 645 | xfs_buf_t **IO_agbp, /* in/out ag header's buffer */ |
646 | boolean_t *alloc_done, /* true if we needed to replenish | 646 | boolean_t *alloc_done, /* true if we needed to replenish |
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h index bb5385475e1f..666a037398d6 100644 --- a/fs/xfs/xfs_ialloc.h +++ b/fs/xfs/xfs_ialloc.h | |||
@@ -81,7 +81,7 @@ int /* error */ | |||
81 | xfs_dialloc( | 81 | xfs_dialloc( |
82 | struct xfs_trans *tp, /* transaction pointer */ | 82 | struct xfs_trans *tp, /* transaction pointer */ |
83 | xfs_ino_t parent, /* parent inode (directory) */ | 83 | xfs_ino_t parent, /* parent inode (directory) */ |
84 | mode_t mode, /* mode bits for new inode */ | 84 | umode_t mode, /* mode bits for new inode */ |
85 | int okalloc, /* ok to allocate more space */ | 85 | int okalloc, /* ok to allocate more space */ |
86 | struct xfs_buf **agbp, /* buf for a.g. inode header */ | 86 | struct xfs_buf **agbp, /* buf for a.g. inode header */ |
87 | boolean_t *alloc_done, /* an allocation was done to replenish | 87 | boolean_t *alloc_done, /* an allocation was done to replenish |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 755ee8164880..9dda7cc32848 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -961,7 +961,7 @@ int | |||
961 | xfs_ialloc( | 961 | xfs_ialloc( |
962 | xfs_trans_t *tp, | 962 | xfs_trans_t *tp, |
963 | xfs_inode_t *pip, | 963 | xfs_inode_t *pip, |
964 | mode_t mode, | 964 | umode_t mode, |
965 | xfs_nlink_t nlink, | 965 | xfs_nlink_t nlink, |
966 | xfs_dev_t rdev, | 966 | xfs_dev_t rdev, |
967 | prid_t prid, | 967 | prid_t prid, |
@@ -1002,7 +1002,7 @@ xfs_ialloc( | |||
1002 | return error; | 1002 | return error; |
1003 | ASSERT(ip != NULL); | 1003 | ASSERT(ip != NULL); |
1004 | 1004 | ||
1005 | ip->i_d.di_mode = (__uint16_t)mode; | 1005 | ip->i_d.di_mode = mode; |
1006 | ip->i_d.di_onlink = 0; | 1006 | ip->i_d.di_onlink = 0; |
1007 | ip->i_d.di_nlink = nlink; | 1007 | ip->i_d.di_nlink = nlink; |
1008 | ASSERT(ip->i_d.di_nlink == nlink); | 1008 | ASSERT(ip->i_d.di_nlink == nlink); |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index b4cd4739f98e..f0e6b151ba37 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -481,7 +481,7 @@ void xfs_inode_free(struct xfs_inode *ip); | |||
481 | /* | 481 | /* |
482 | * xfs_inode.c prototypes. | 482 | * xfs_inode.c prototypes. |
483 | */ | 483 | */ |
484 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, | 484 | int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, umode_t, |
485 | xfs_nlink_t, xfs_dev_t, prid_t, int, | 485 | xfs_nlink_t, xfs_dev_t, prid_t, int, |
486 | struct xfs_buf **, boolean_t *, xfs_inode_t **); | 486 | struct xfs_buf **, boolean_t *, xfs_inode_t **); |
487 | 487 | ||
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 23ce927973a4..f9babd179223 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c | |||
@@ -168,7 +168,7 @@ STATIC int | |||
168 | xfs_vn_mknod( | 168 | xfs_vn_mknod( |
169 | struct inode *dir, | 169 | struct inode *dir, |
170 | struct dentry *dentry, | 170 | struct dentry *dentry, |
171 | int mode, | 171 | umode_t mode, |
172 | dev_t rdev) | 172 | dev_t rdev) |
173 | { | 173 | { |
174 | struct inode *inode; | 174 | struct inode *inode; |
@@ -231,7 +231,7 @@ STATIC int | |||
231 | xfs_vn_create( | 231 | xfs_vn_create( |
232 | struct inode *dir, | 232 | struct inode *dir, |
233 | struct dentry *dentry, | 233 | struct dentry *dentry, |
234 | int mode, | 234 | umode_t mode, |
235 | struct nameidata *nd) | 235 | struct nameidata *nd) |
236 | { | 236 | { |
237 | return xfs_vn_mknod(dir, dentry, mode, 0); | 237 | return xfs_vn_mknod(dir, dentry, mode, 0); |
@@ -241,7 +241,7 @@ STATIC int | |||
241 | xfs_vn_mkdir( | 241 | xfs_vn_mkdir( |
242 | struct inode *dir, | 242 | struct inode *dir, |
243 | struct dentry *dentry, | 243 | struct dentry *dentry, |
244 | int mode) | 244 | umode_t mode) |
245 | { | 245 | { |
246 | return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0); | 246 | return xfs_vn_mknod(dir, dentry, mode|S_IFDIR, 0); |
247 | } | 247 | } |
@@ -366,7 +366,7 @@ xfs_vn_symlink( | |||
366 | struct xfs_inode *cip = NULL; | 366 | struct xfs_inode *cip = NULL; |
367 | struct xfs_name name; | 367 | struct xfs_name name; |
368 | int error; | 368 | int error; |
369 | mode_t mode; | 369 | umode_t mode; |
370 | 370 | ||
371 | mode = S_IFLNK | | 371 | mode = S_IFLNK | |
372 | (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO); | 372 | (irix_symlink_mode ? 0777 & ~current_umask() : S_IRWXUGO); |
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index 8b32d1a4c5a1..89dbb4a50872 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c | |||
@@ -53,7 +53,7 @@ xfs_dir_ialloc( | |||
53 | output: may be a new transaction. */ | 53 | output: may be a new transaction. */ |
54 | xfs_inode_t *dp, /* directory within whose allocate | 54 | xfs_inode_t *dp, /* directory within whose allocate |
55 | the inode. */ | 55 | the inode. */ |
56 | mode_t mode, | 56 | umode_t mode, |
57 | xfs_nlink_t nlink, | 57 | xfs_nlink_t nlink, |
58 | xfs_dev_t rdev, | 58 | xfs_dev_t rdev, |
59 | prid_t prid, /* project id */ | 59 | prid_t prid, /* project id */ |
diff --git a/fs/xfs/xfs_utils.h b/fs/xfs/xfs_utils.h index 456fca314933..5eeab4690cfe 100644 --- a/fs/xfs/xfs_utils.h +++ b/fs/xfs/xfs_utils.h | |||
@@ -18,7 +18,7 @@ | |||
18 | #ifndef __XFS_UTILS_H__ | 18 | #ifndef __XFS_UTILS_H__ |
19 | #define __XFS_UTILS_H__ | 19 | #define __XFS_UTILS_H__ |
20 | 20 | ||
21 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, mode_t, xfs_nlink_t, | 21 | extern int xfs_dir_ialloc(xfs_trans_t **, xfs_inode_t *, umode_t, xfs_nlink_t, |
22 | xfs_dev_t, prid_t, int, xfs_inode_t **, int *); | 22 | xfs_dev_t, prid_t, int, xfs_inode_t **, int *); |
23 | extern int xfs_droplink(xfs_trans_t *, xfs_inode_t *); | 23 | extern int xfs_droplink(xfs_trans_t *, xfs_inode_t *); |
24 | extern int xfs_bumplink(xfs_trans_t *, xfs_inode_t *); | 24 | extern int xfs_bumplink(xfs_trans_t *, xfs_inode_t *); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index ce9268a2f56b..f2fea868d4db 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -822,7 +822,7 @@ int | |||
822 | xfs_create( | 822 | xfs_create( |
823 | xfs_inode_t *dp, | 823 | xfs_inode_t *dp, |
824 | struct xfs_name *name, | 824 | struct xfs_name *name, |
825 | mode_t mode, | 825 | umode_t mode, |
826 | xfs_dev_t rdev, | 826 | xfs_dev_t rdev, |
827 | xfs_inode_t **ipp) | 827 | xfs_inode_t **ipp) |
828 | { | 828 | { |
@@ -1481,7 +1481,7 @@ xfs_symlink( | |||
1481 | xfs_inode_t *dp, | 1481 | xfs_inode_t *dp, |
1482 | struct xfs_name *link_name, | 1482 | struct xfs_name *link_name, |
1483 | const char *target_path, | 1483 | const char *target_path, |
1484 | mode_t mode, | 1484 | umode_t mode, |
1485 | xfs_inode_t **ipp) | 1485 | xfs_inode_t **ipp) |
1486 | { | 1486 | { |
1487 | xfs_mount_t *mp = dp->i_mount; | 1487 | xfs_mount_t *mp = dp->i_mount; |
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h index 35d3d513e1e9..0c877cbde142 100644 --- a/fs/xfs/xfs_vnodeops.h +++ b/fs/xfs/xfs_vnodeops.h | |||
@@ -26,7 +26,7 @@ int xfs_release(struct xfs_inode *ip); | |||
26 | int xfs_inactive(struct xfs_inode *ip); | 26 | int xfs_inactive(struct xfs_inode *ip); |
27 | int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, | 27 | int xfs_lookup(struct xfs_inode *dp, struct xfs_name *name, |
28 | struct xfs_inode **ipp, struct xfs_name *ci_name); | 28 | struct xfs_inode **ipp, struct xfs_name *ci_name); |
29 | int xfs_create(struct xfs_inode *dp, struct xfs_name *name, mode_t mode, | 29 | int xfs_create(struct xfs_inode *dp, struct xfs_name *name, umode_t mode, |
30 | xfs_dev_t rdev, struct xfs_inode **ipp); | 30 | xfs_dev_t rdev, struct xfs_inode **ipp); |
31 | int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, | 31 | int xfs_remove(struct xfs_inode *dp, struct xfs_name *name, |
32 | struct xfs_inode *ip); | 32 | struct xfs_inode *ip); |
@@ -35,7 +35,7 @@ int xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip, | |||
35 | int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, | 35 | int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize, |
36 | xfs_off_t *offset, filldir_t filldir); | 36 | xfs_off_t *offset, filldir_t filldir); |
37 | int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name, | 37 | int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name, |
38 | const char *target_path, mode_t mode, struct xfs_inode **ipp); | 38 | const char *target_path, umode_t mode, struct xfs_inode **ipp); |
39 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); | 39 | int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); |
40 | int xfs_change_file_space(struct xfs_inode *ip, int cmd, | 40 | int xfs_change_file_space(struct xfs_inode *ip, int cmd, |
41 | xfs_flock64_t *bf, xfs_off_t offset, int attr_flags); | 41 | xfs_flock64_t *bf, xfs_off_t offset, int attr_flags); |