Commit 838bee9e authored by Jan Kara's avatar Jan Kara

Merge udf, isofs, quota, ext2 changes for 4.15-rc1.

parents ac3d7939 88d8ff97
* *
* Documentation/filesystems/udf.txt * Documentation/filesystems/udf.txt
* *
UDF Filesystem version 0.9.8.1
If you encounter problems with reading UDF discs using this driver, If you encounter problems with reading UDF discs using this driver,
please report them to linux_udf@hpesjro.fc.hp.com, which is the please report them according to MAINTAINERS file.
developer's list.
Write support requires a block driver which supports writing. Currently Write support requires a block driver which supports writing. Currently
dvd+rw drives and media support true random sector writes, and so a udf dvd+rw drives and media support true random sector writes, and so a udf
...@@ -73,10 +71,8 @@ The following expect a offset from the partition root. ...@@ -73,10 +71,8 @@ The following expect a offset from the partition root.
For the latest version and toolset see: For the latest version and toolset see:
http://linux-udf.sourceforge.net/ https://github.com/pali/udftools
Documentation on UDF and ECMA 167 is available FREE from: Documentation on UDF and ECMA 167 is available FREE from:
http://www.osta.org/ http://www.osta.org/
http://www.ecma-international.org/ http://www.ecma-international.org/
Ben Fennema <bfennema@falcon.csc.calpoly.edu>
This diff is collapsed.
...@@ -72,41 +72,41 @@ static inline struct iso_inode_info *ISOFS_I(struct inode *inode) ...@@ -72,41 +72,41 @@ static inline struct iso_inode_info *ISOFS_I(struct inode *inode)
return container_of(inode, struct iso_inode_info, vfs_inode); return container_of(inode, struct iso_inode_info, vfs_inode);
} }
static inline int isonum_711(char *p) static inline int isonum_711(u8 *p)
{ {
return *(u8 *)p; return *p;
} }
static inline int isonum_712(char *p) static inline int isonum_712(s8 *p)
{ {
return *(s8 *)p; return *p;
} }
static inline unsigned int isonum_721(char *p) static inline unsigned int isonum_721(u8 *p)
{ {
return get_unaligned_le16(p); return get_unaligned_le16(p);
} }
static inline unsigned int isonum_722(char *p) static inline unsigned int isonum_722(u8 *p)
{ {
return get_unaligned_be16(p); return get_unaligned_be16(p);
} }
static inline unsigned int isonum_723(char *p) static inline unsigned int isonum_723(u8 *p)
{ {
/* Ignore bigendian datum due to broken mastering programs */ /* Ignore bigendian datum due to broken mastering programs */
return get_unaligned_le16(p); return get_unaligned_le16(p);
} }
static inline unsigned int isonum_731(char *p) static inline unsigned int isonum_731(u8 *p)
{ {
return get_unaligned_le32(p); return get_unaligned_le32(p);
} }
static inline unsigned int isonum_732(char *p) static inline unsigned int isonum_732(u8 *p)
{ {
return get_unaligned_be32(p); return get_unaligned_be32(p);
} }
static inline unsigned int isonum_733(char *p) static inline unsigned int isonum_733(u8 *p)
{ {
/* Ignore bigendian datum due to broken mastering programs */ /* Ignore bigendian datum due to broken mastering programs */
return get_unaligned_le32(p); return get_unaligned_le32(p);
} }
extern int iso_date(char *, int); extern int iso_date(u8 *, int);
struct inode; /* To make gcc happy */ struct inode; /* To make gcc happy */
......
...@@ -6,78 +6,78 @@ ...@@ -6,78 +6,78 @@
*/ */
struct SU_SP_s { struct SU_SP_s {
unsigned char magic[2]; __u8 magic[2];
unsigned char skip; __u8 skip;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct SU_CE_s { struct SU_CE_s {
char extent[8]; __u8 extent[8];
char offset[8]; __u8 offset[8];
char size[8]; __u8 size[8];
}; };
struct SU_ER_s { struct SU_ER_s {
unsigned char len_id; __u8 len_id;
unsigned char len_des; __u8 len_des;
unsigned char len_src; __u8 len_src;
unsigned char ext_ver; __u8 ext_ver;
char data[0]; __u8 data[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_RR_s { struct RR_RR_s {
char flags[1]; __u8 flags[1];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_PX_s { struct RR_PX_s {
char mode[8]; __u8 mode[8];
char n_links[8]; __u8 n_links[8];
char uid[8]; __u8 uid[8];
char gid[8]; __u8 gid[8];
}; };
struct RR_PN_s { struct RR_PN_s {
char dev_high[8]; __u8 dev_high[8];
char dev_low[8]; __u8 dev_low[8];
}; };
struct SL_component { struct SL_component {
unsigned char flags; __u8 flags;
unsigned char len; __u8 len;
char text[0]; __u8 text[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_SL_s { struct RR_SL_s {
unsigned char flags; __u8 flags;
struct SL_component link; struct SL_component link;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_NM_s { struct RR_NM_s {
unsigned char flags; __u8 flags;
char name[0]; char name[0];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_CL_s { struct RR_CL_s {
char location[8]; __u8 location[8];
}; };
struct RR_PL_s { struct RR_PL_s {
char location[8]; __u8 location[8];
}; };
struct stamp { struct stamp {
char time[7]; __u8 time[7]; /* actually 6 unsigned, 1 signed */
} __attribute__ ((packed)); } __attribute__ ((packed));
struct RR_TF_s { struct RR_TF_s {
char flags; __u8 flags;
struct stamp times[0]; /* Variable number of these beasts */ struct stamp times[0]; /* Variable number of these beasts */
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Linux-specific extension for transparent decompression */ /* Linux-specific extension for transparent decompression */
struct RR_ZF_s { struct RR_ZF_s {
char algorithm[2]; __u8 algorithm[2];
char parms[2]; __u8 parms[2];
char real_size[8]; __u8 real_size[8];
}; };
/* /*
...@@ -93,9 +93,9 @@ struct RR_ZF_s { ...@@ -93,9 +93,9 @@ struct RR_ZF_s {
#define TF_LONG_FORM 128 #define TF_LONG_FORM 128
struct rock_ridge { struct rock_ridge {
char signature[2]; __u8 signature[2];
unsigned char len; __u8 len;
unsigned char version; __u8 version;
union { union {
struct SU_SP_s SP; struct SU_SP_s SP;
struct SU_CE_s CE; struct SU_CE_s CE;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* to GMT. Thus we should always be correct. * to GMT. Thus we should always be correct.
*/ */
int iso_date(char * p, int flag) int iso_date(u8 *p, int flag)
{ {
int year, month, day, hour, minute, second, tz; int year, month, day, hour, minute, second, tz;
int crtime; int crtime;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/sched/user.h> #include <linux/sched/user.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/audit.h>
#include "fanotify.h" #include "fanotify.h"
...@@ -78,7 +79,7 @@ static int fanotify_get_response(struct fsnotify_group *group, ...@@ -78,7 +79,7 @@ static int fanotify_get_response(struct fsnotify_group *group,
fsnotify_finish_user_wait(iter_info); fsnotify_finish_user_wait(iter_info);
out: out:
/* userspace responded, convert to something usable */ /* userspace responded, convert to something usable */
switch (event->response) { switch (event->response & ~FAN_AUDIT) {
case FAN_ALLOW: case FAN_ALLOW:
ret = 0; ret = 0;
break; break;
...@@ -86,6 +87,11 @@ static int fanotify_get_response(struct fsnotify_group *group, ...@@ -86,6 +87,11 @@ static int fanotify_get_response(struct fsnotify_group *group,
default: default:
ret = -EPERM; ret = -EPERM;
} }
/* Check if the response should be audited */
if (event->response & FAN_AUDIT)
audit_fanotify(event->response & ~FAN_AUDIT);
event->response = 0; event->response = 0;
pr_debug("%s: group=%p event=%p about to return ret=%d\n", __func__, pr_debug("%s: group=%p event=%p about to return ret=%d\n", __func__,
......
...@@ -179,7 +179,7 @@ static int process_access_response(struct fsnotify_group *group, ...@@ -179,7 +179,7 @@ static int process_access_response(struct fsnotify_group *group,
* userspace can send a valid response or we will clean it up after the * userspace can send a valid response or we will clean it up after the
* timeout * timeout
*/ */
switch (response) { switch (response & ~FAN_AUDIT) {
case FAN_ALLOW: case FAN_ALLOW:
case FAN_DENY: case FAN_DENY:
break; break;
...@@ -190,6 +190,9 @@ static int process_access_response(struct fsnotify_group *group, ...@@ -190,6 +190,9 @@ static int process_access_response(struct fsnotify_group *group,
if (fd < 0) if (fd < 0)
return -EINVAL; return -EINVAL;
if ((response & FAN_AUDIT) && !group->fanotify_data.audit)
return -EINVAL;
event = dequeue_event(group, fd); event = dequeue_event(group, fd);
if (!event) if (!event)
return -ENOENT; return -ENOENT;
...@@ -721,7 +724,11 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) ...@@ -721,7 +724,11 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
#ifdef CONFIG_AUDITSYSCALL
if (flags & ~(FAN_ALL_INIT_FLAGS | FAN_ENABLE_AUDIT))
#else
if (flags & ~FAN_ALL_INIT_FLAGS) if (flags & ~FAN_ALL_INIT_FLAGS)
#endif
return -EINVAL; return -EINVAL;
if (event_f_flags & ~FANOTIFY_INIT_ALL_EVENT_F_BITS) if (event_f_flags & ~FANOTIFY_INIT_ALL_EVENT_F_BITS)
...@@ -805,6 +812,13 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) ...@@ -805,6 +812,13 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS; group->fanotify_data.max_marks = FANOTIFY_DEFAULT_MAX_MARKS;
} }
if (flags & FAN_ENABLE_AUDIT) {
fd = -EPERM;
if (!capable(CAP_AUDIT_WRITE))
goto out_destroy_group;
group->fanotify_data.audit = true;
}
fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags); fd = anon_inode_getfd("[fanotify]", &fanotify_fops, group, f_flags);
if (fd < 0) if (fd < 0)
goto out_destroy_group; goto out_destroy_group;
......
...@@ -156,6 +156,9 @@ void fanotify_show_fdinfo(struct seq_file *m, struct file *f) ...@@ -156,6 +156,9 @@ void fanotify_show_fdinfo(struct seq_file *m, struct file *f)
if (group->fanotify_data.max_marks == UINT_MAX) if (group->fanotify_data.max_marks == UINT_MAX)
flags |= FAN_UNLIMITED_MARKS; flags |= FAN_UNLIMITED_MARKS;
if (group->fanotify_data.audit)
flags |= FAN_ENABLE_AUDIT;
seq_printf(m, "fanotify flags:%x event-flags:%x\n", seq_printf(m, "fanotify flags:%x event-flags:%x\n",
flags, group->fanotify_data.f_flags); flags, group->fanotify_data.f_flags);
......
...@@ -644,8 +644,15 @@ int dquot_writeback_dquots(struct super_block *sb, int type) ...@@ -644,8 +644,15 @@ int dquot_writeback_dquots(struct super_block *sb, int type)
spin_unlock(&dq_list_lock); spin_unlock(&dq_list_lock);
dqstats_inc(DQST_LOOKUPS); dqstats_inc(DQST_LOOKUPS);
err = sb->dq_op->write_dquot(dquot); err = sb->dq_op->write_dquot(dquot);
if (!ret && err) if (err) {
/*
* Clear dirty bit anyway to avoid infinite
* loop here.
*/
clear_dquot_dirty(dquot);
if (!ret)
ret = err; ret = err;
}
dqput(dquot); dqput(dquot);
spin_lock(&dq_list_lock); spin_lock(&dq_list_lock);
} }
...@@ -2138,7 +2145,7 @@ int dquot_file_open(struct inode *inode, struct file *file) ...@@ -2138,7 +2145,7 @@ int dquot_file_open(struct inode *inode, struct file *file)
error = generic_file_open(inode, file); error = generic_file_open(inode, file);
if (!error && (file->f_mode & FMODE_WRITE)) if (!error && (file->f_mode & FMODE_WRITE))
dquot_initialize(inode); error = dquot_initialize(inode);
return error; return error;
} }
EXPORT_SYMBOL(dquot_file_open); EXPORT_SYMBOL(dquot_file_open);
......
...@@ -58,7 +58,7 @@ static int __load_block_bitmap(struct super_block *sb, ...@@ -58,7 +58,7 @@ static int __load_block_bitmap(struct super_block *sb,
int nr_groups = bitmap->s_nr_groups; int nr_groups = bitmap->s_nr_groups;
if (block_group >= nr_groups) { if (block_group >= nr_groups) {
udf_debug("block_group (%d) > nr_groups (%d)\n", udf_debug("block_group (%u) > nr_groups (%d)\n",
block_group, nr_groups); block_group, nr_groups);
} }
...@@ -122,7 +122,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb, ...@@ -122,7 +122,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
if (bloc->logicalBlockNum + count < count || if (bloc->logicalBlockNum + count < count ||
(bloc->logicalBlockNum + count) > partmap->s_partition_len) { (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
udf_debug("%d < %d || %d + %d > %d\n", udf_debug("%u < %d || %u + %u > %u\n",
bloc->logicalBlockNum, 0, bloc->logicalBlockNum, 0,
bloc->logicalBlockNum, count, bloc->logicalBlockNum, count,
partmap->s_partition_len); partmap->s_partition_len);
...@@ -151,9 +151,9 @@ static void udf_bitmap_free_blocks(struct super_block *sb, ...@@ -151,9 +151,9 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
bh = bitmap->s_block_bitmap[bitmap_nr]; bh = bitmap->s_block_bitmap[bitmap_nr];
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (udf_set_bit(bit + i, bh->b_data)) { if (udf_set_bit(bit + i, bh->b_data)) {
udf_debug("bit %ld already set\n", bit + i); udf_debug("bit %lu already set\n", bit + i);
udf_debug("byte=%2x\n", udf_debug("byte=%2x\n",
((char *)bh->b_data)[(bit + i) >> 3]); ((__u8 *)bh->b_data)[(bit + i) >> 3]);
} }
} }
udf_add_free_space(sb, sbi->s_partition, count); udf_add_free_space(sb, sbi->s_partition, count);
...@@ -218,16 +218,18 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb, ...@@ -218,16 +218,18 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb,
return alloc_count; return alloc_count;
} }
static int udf_bitmap_new_block(struct super_block *sb, static udf_pblk_t udf_bitmap_new_block(struct super_block *sb,
struct udf_bitmap *bitmap, uint16_t partition, struct udf_bitmap *bitmap, uint16_t partition,
uint32_t goal, int *err) uint32_t goal, int *err)
{ {
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
int newbit, bit = 0, block, block_group, group_start; int newbit, bit = 0;
udf_pblk_t block;
int block_group, group_start;
int end_goal, nr_groups, bitmap_nr, i; int end_goal, nr_groups, bitmap_nr, i;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
char *ptr; char *ptr;
int newblock = 0; udf_pblk_t newblock = 0;
*err = -ENOSPC; *err = -ENOSPC;
mutex_lock(&sbi->s_alloc_mutex); mutex_lock(&sbi->s_alloc_mutex);
...@@ -362,7 +364,7 @@ static void udf_table_free_blocks(struct super_block *sb, ...@@ -362,7 +364,7 @@ static void udf_table_free_blocks(struct super_block *sb,
partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
if (bloc->logicalBlockNum + count < count || if (bloc->logicalBlockNum + count < count ||
(bloc->logicalBlockNum + count) > partmap->s_partition_len) { (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
udf_debug("%d < %d || %d + %d > %d\n", udf_debug("%u < %d || %u + %u > %u\n",
bloc->logicalBlockNum, 0, bloc->logicalBlockNum, 0,
bloc->logicalBlockNum, count, bloc->logicalBlockNum, count,
partmap->s_partition_len); partmap->s_partition_len);
...@@ -515,7 +517,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, ...@@ -515,7 +517,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
while (first_block != eloc.logicalBlockNum && while (first_block != eloc.logicalBlockNum &&
(etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) { (etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
udf_debug("eloc=%d, elen=%d, first_block=%d\n", udf_debug("eloc=%u, elen=%u, first_block=%u\n",
eloc.logicalBlockNum, elen, first_block); eloc.logicalBlockNum, elen, first_block);
; /* empty loop body */ ; /* empty loop body */
} }
...@@ -545,13 +547,14 @@ static int udf_table_prealloc_blocks(struct super_block *sb, ...@@ -545,13 +547,14 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
return alloc_count; return alloc_count;
} }
static int udf_table_new_block(struct super_block *sb, static udf_pblk_t udf_table_new_block(struct super_block *sb,
struct inode *table, uint16_t partition, struct inode *table, uint16_t partition,
uint32_t goal, int *err) uint32_t goal, int *err)
{ {
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF; uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
uint32_t newblock = 0, adsize; udf_pblk_t newblock = 0;
uint32_t adsize;
uint32_t elen, goal_elen = 0; uint32_t elen, goal_elen = 0;
struct kernel_lb_addr eloc, uninitialized_var(goal_eloc); struct kernel_lb_addr eloc, uninitialized_var(goal_eloc);
struct extent_position epos, goal_epos; struct extent_position epos, goal_epos;
...@@ -700,12 +703,12 @@ inline int udf_prealloc_blocks(struct super_block *sb, ...@@ -700,12 +703,12 @@ inline int udf_prealloc_blocks(struct super_block *sb,
return allocated; return allocated;
} }
inline int udf_new_block(struct super_block *sb, inline udf_pblk_t udf_new_block(struct super_block *sb,
struct inode *inode, struct inode *inode,
uint16_t partition, uint32_t goal, int *err) uint16_t partition, uint32_t goal, int *err)
{ {
struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
int block; udf_pblk_t block;
if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
block = udf_bitmap_new_block(sb, block = udf_bitmap_new_block(sb,
......
...@@ -43,7 +43,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx) ...@@ -43,7 +43,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL}; struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL};
struct fileIdentDesc *fi = NULL; struct fileIdentDesc *fi = NULL;
struct fileIdentDesc cfi; struct fileIdentDesc cfi;
int block, iblock; udf_pblk_t block, iblock;
loff_t nf_pos; loff_t nf_pos;
int flen; int flen;
unsigned char *fname = NULL, *copy_name = NULL; unsigned char *fname = NULL, *copy_name = NULL;
......
...@@ -26,7 +26,8 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -26,7 +26,8 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
sector_t *offset) sector_t *offset)
{ {
struct fileIdentDesc *fi; struct fileIdentDesc *fi;
int i, num, block; int i, num;
udf_pblk_t block;
struct buffer_head *tmp, *bha[16]; struct buffer_head *tmp, *bha[16];
struct udf_inode_info *iinfo = UDF_I(dir); struct udf_inode_info *iinfo = UDF_I(dir);
...@@ -51,7 +52,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -51,7 +52,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
} }
if (fibh->eoffset == dir->i_sb->s_blocksize) { if (fibh->eoffset == dir->i_sb->s_blocksize) {
int lextoffset = epos->offset; uint32_t lextoffset = epos->offset;
unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits; unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
if (udf_next_aext(dir, epos, eloc, elen, 1) != if (udf_next_aext(dir, epos, eloc, elen, 1) !=
...@@ -110,7 +111,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos, ...@@ -110,7 +111,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
memcpy((uint8_t *)cfi, (uint8_t *)fi, memcpy((uint8_t *)cfi, (uint8_t *)fi,
sizeof(struct fileIdentDesc)); sizeof(struct fileIdentDesc));
} else if (fibh->eoffset > dir->i_sb->s_blocksize) { } else if (fibh->eoffset > dir->i_sb->s_blocksize) {
int lextoffset = epos->offset; uint32_t lextoffset = epos->offset;
if (udf_next_aext(dir, epos, eloc, elen, 1) != if (udf_next_aext(dir, epos, eloc, elen, 1) !=
(EXT_RECORDED_ALLOCATED >> 30)) (EXT_RECORDED_ALLOCATED >> 30))
...@@ -175,7 +176,7 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset) ...@@ -175,7 +176,7 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) { if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) {
udf_debug("0x%x != TAG_IDENT_FID\n", udf_debug("0x%x != TAG_IDENT_FID\n",
le16_to_cpu(fi->descTag.tagIdent)); le16_to_cpu(fi->descTag.tagIdent));
udf_debug("offset: %u sizeof: %lu bufsize: %u\n", udf_debug("offset: %d sizeof: %lu bufsize: %d\n",
*offset, (unsigned long)sizeof(struct fileIdentDesc), *offset, (unsigned long)sizeof(struct fileIdentDesc),
bufsize); bufsize);
return NULL; return NULL;
......
...@@ -50,7 +50,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode) ...@@ -50,7 +50,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
struct inode *inode; struct inode *inode;
int block; udf_pblk_t block;
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
struct udf_inode_info *dinfo = UDF_I(dir); struct udf_inode_info *dinfo = UDF_I(dir);
......
...@@ -52,7 +52,7 @@ static int udf_alloc_i_data(struct inode *inode, size_t size); ...@@ -52,7 +52,7 @@ static int udf_alloc_i_data(struct inode *inode, size_t size);
static sector_t inode_getblk(struct inode *, sector_t, int *, int *); static sector_t inode_getblk(struct inode *, sector_t, int *, int *);
static int8_t udf_insert_aext(struct inode *, struct extent_position, static int8_t udf_insert_aext(struct inode *, struct extent_position,
struct kernel_lb_addr, uint32_t); struct kernel_lb_addr, uint32_t);
static void udf_split_extents(struct inode *, int *, int, int, static void udf_split_extents(struct inode *, int *, int, udf_pblk_t,
struct kernel_long_ad *, int *); struct kernel_long_ad *, int *);
static void udf_prealloc_extents(struct inode *, int, int, static void udf_prealloc_extents(struct inode *, int, int,
struct kernel_long_ad *, int *); struct kernel_long_ad *, int *);
...@@ -316,10 +316,10 @@ int udf_expand_file_adinicb(struct inode *inode) ...@@ -316,10 +316,10 @@ int udf_expand_file_adinicb(struct inode *inode)
return err; return err;
} }
struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
int *err) udf_pblk_t *block, int *err)
{ {
int newblock; udf_pblk_t newblock;
struct buffer_head *dbh = NULL; struct buffer_head *dbh = NULL;
struct kernel_lb_addr eloc; struct kernel_lb_addr eloc;
uint8_t alloctype; uint8_t alloctype;
...@@ -446,7 +446,7 @@ static int udf_get_block(struct inode *inode, sector_t block, ...@@ -446,7 +446,7 @@ static int udf_get_block(struct inode *inode, sector_t block,
return err; return err;
} }
static struct buffer_head *udf_getblk(struct inode *inode, long block, static struct buffer_head *udf_getblk(struct inode *inode, udf_pblk_t block,
int create, int *err) int create, int *err)
{ {
struct buffer_head *bh; struct buffer_head *bh;
...@@ -480,7 +480,7 @@ static int udf_do_extend_file(struct inode *inode, ...@@ -480,7 +480,7 @@ static int udf_do_extend_file(struct inode *inode,
int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK); int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct kernel_lb_addr prealloc_loc = {}; struct kernel_lb_addr prealloc_loc = {};
int prealloc_len = 0; uint32_t prealloc_len = 0;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
int err; int err;
...@@ -663,11 +663,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -663,11 +663,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
struct kernel_lb_addr eloc, tmpeloc; struct kernel_lb_addr eloc, tmpeloc;
int c = 1; int c = 1;
loff_t lbcount = 0, b_off = 0; loff_t lbcount = 0, b_off = 0;
uint32_t newblocknum, newblock; udf_pblk_t newblocknum, newblock;
sector_t offset = 0; sector_t offset = 0;
int8_t etype; int8_t etype;
struct udf_inode_info *iinfo = UDF_I(inode); struct udf_inode_info *iinfo = UDF_I(inode);
int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; udf_pblk_t goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
int lastblock = 0; int lastblock = 0;
bool isBeyondEOF; bool isBeyondEOF;
...@@ -879,8 +879,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, ...@@ -879,8 +879,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
} }
static void udf_split_extents(struct inode *inode, int *c, int offset, static void udf_split_extents(struct inode *inode, int *c, int offset,
int newblocknum, struct kernel_long_ad *laarr, udf_pblk_t newblocknum,
int *endnum) struct kernel_long_ad *laarr, int *endnum)
{ {
unsigned long blocksize = inode->i_sb->s_blocksize; unsigned long blocksize = inode->i_sb->s_blocksize;
unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
...@@ -1166,7 +1166,7 @@ static void udf_update_extents(struct inode *inode, struct kernel_long_ad *laarr ...@@ -1166,7 +1166,7 @@ static void udf_update_extents(struct inode *inode, struct kernel_long_ad *laarr
} }
} }
struct buffer_head *udf_bread(struct inode *inode, int block, struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
int create, int *err) int create, int *err)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
...@@ -1193,7 +1193,7 @@ int udf_setsize(struct inode *inode, loff_t newsize) ...@@ -1193,7 +1193,7 @@ int udf_setsize(struct inode *inode, loff_t newsize)
{ {
int err; int err;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
int bsize = i_blocksize(inode); unsigned int bsize = i_blocksize(inode);
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode))) S_ISLNK(inode->i_mode)))
...@@ -1278,14 +1278,14 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) ...@@ -1278,14 +1278,14 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
reread: reread:
if (iloc->partitionReferenceNum >= sbi->s_partitions) { if (iloc->partitionReferenceNum >= sbi->s_partitions) {
udf_debug("partition reference: %d > logical volume partitions: %d\n", udf_debug("partition reference: %u > logical volume partitions: %u\n",
iloc->partitionReferenceNum, sbi->s_partitions); iloc->partitionReferenceNum, sbi->s_partitions);
return -EIO; return -EIO;
} }
if (iloc->logicalBlockNum >= if (iloc->logicalBlockNum >=
sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) { sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) {
udf_debug("block=%d, partition=%d out of range\n", udf_debug("block=%u, partition=%u out of range\n",
iloc->logicalBlockNum, iloc->partitionReferenceNum); iloc->logicalBlockNum, iloc->partitionReferenceNum);
return -EIO; return -EIO;
} }
...@@ -1304,13 +1304,13 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) ...@@ -1304,13 +1304,13 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
*/ */
bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident); bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident);
if (!bh) { if (!bh) {
udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); udf_err(inode->i_sb, "(ino %lu) failed !bh\n", inode->i_ino);
return -EIO; return -EIO;
} }
if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE &&
ident != TAG_IDENT_USE) { ident != TAG_IDENT_USE) {
udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", udf_err(inode->i_sb, "(ino %lu) failed ident=%u\n",
inode->i_ino, ident); inode->i_ino, ident);
goto out; goto out;
} }
...@@ -1346,7 +1346,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) ...@@ -1346,7 +1346,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
} }
brelse(ibh); brelse(ibh);
} else if (fe->icbTag.strategyType != cpu_to_le16(4)) { } else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
udf_err(inode->i_sb, "unsupported strategy type: %d\n", udf_err(inode->i_sb, "unsupported strategy type: %u\n",
le16_to_cpu(fe->icbTag.strategyType)); le16_to_cpu(fe->icbTag.strategyType));
goto out; goto out;
} }
...@@ -1547,7 +1547,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) ...@@ -1547,7 +1547,7 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
udf_debug("METADATA BITMAP FILE-----\n"); udf_debug("METADATA BITMAP FILE-----\n");
break; break;
default: default:
udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", udf_err(inode->i_sb, "(ino %lu) failed unknown file type=%u\n",
inode->i_ino, fe->icbTag.fileType); inode->i_ino, fe->icbTag.fileType);
goto out; goto out;
} }
...@@ -1852,7 +1852,7 @@ struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino, ...@@ -1852,7 +1852,7 @@ struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
return inode; return inode;
} }
int udf_setup_indirect_aext(struct inode *inode, int block, int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
struct extent_position *epos) struct extent_position *epos)
{ {
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -1994,7 +1994,7 @@ int udf_add_aext(struct inode *inode, struct extent_position *epos, ...@@ -1994,7 +1994,7 @@ int udf_add_aext(struct inode *inode, struct extent_position *epos,
if (epos->offset + (2 * adsize) > sb->s_blocksize) { if (epos->offset + (2 * adsize) > sb->s_blocksize) {
int err; int err;
int new_block; udf_pblk_t new_block;
new_block = udf_new_block(sb, NULL, new_block = udf_new_block(sb, NULL,
epos->block.partitionReferenceNum, epos->block.partitionReferenceNum,
...@@ -2076,7 +2076,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, ...@@ -2076,7 +2076,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) == while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
(EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
int block; udf_pblk_t block;
if (++indirections > UDF_MAX_INDIR_EXTS) { if (++indirections > UDF_MAX_INDIR_EXTS) {
udf_err(inode->i_sb, udf_err(inode->i_sb,
...@@ -2091,7 +2091,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos, ...@@ -2091,7 +2091,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0); block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0);
epos->bh = udf_tread(inode->i_sb, block); epos->bh = udf_tread(inode->i_sb, block);
if (!epos->bh) { if (!epos->bh) {
udf_debug("reading block %d failed!\n", block); udf_debug("reading block %u failed!\n", block);
return -1; return -1;
} }
} }
...@@ -2146,7 +2146,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos, ...@@ -2146,7 +2146,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos,
*elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK; *elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK;
break; break;
default: default:
udf_debug("alloc_type = %d unsupported\n", iinfo->i_alloc_type); udf_debug("alloc_type = %u unsupported\n", iinfo->i_alloc_type);
return -1; return -1;
} }
...@@ -2289,13 +2289,13 @@ int8_t inode_bmap(struct inode *inode, sector_t block, ...@@ -2289,13 +2289,13 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
return etype; return etype;
} }
long udf_block_map(struct inode *inode, sector_t block) udf_pblk_t udf_block_map(struct inode *inode, sector_t block)
{ {
struct kernel_lb_addr eloc; struct kernel_lb_addr eloc;
uint32_t elen; uint32_t elen;
sector_t offset; sector_t offset;
struct extent_position epos = {}; struct extent_position epos = {};
int ret; udf_pblk_t ret;
down_read(&UDF_I(inode)->i_data_sem); down_read(&UDF_I(inode)->i_data_sem);
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "udf_i.h" #include "udf_i.h"
#include "udf_sb.h" #include "udf_sb.h"
struct buffer_head *udf_tgetblk(struct super_block *sb, int block) struct buffer_head *udf_tgetblk(struct super_block *sb, udf_pblk_t block)
{ {
if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV)) if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
return sb_getblk(sb, udf_fixed_to_variable(block)); return sb_getblk(sb, udf_fixed_to_variable(block));
...@@ -36,7 +36,7 @@ struct buffer_head *udf_tgetblk(struct super_block *sb, int block) ...@@ -36,7 +36,7 @@ struct buffer_head *udf_tgetblk(struct super_block *sb, int block)
return sb_getblk(sb, block); return sb_getblk(sb, block);
} }
struct buffer_head *udf_tread(struct super_block *sb, int block) struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block)
{ {
if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV)) if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
return sb_bread(sb, udf_fixed_to_variable(block)); return sb_bread(sb, udf_fixed_to_variable(block));
...@@ -209,7 +209,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, ...@@ -209,7 +209,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
bh = udf_tread(sb, block); bh = udf_tread(sb, block);
if (!bh) { if (!bh) {
udf_err(sb, "read failed, block=%u, location=%d\n", udf_err(sb, "read failed, block=%u, location=%u\n",
block, location); block, location);
return NULL; return NULL;
} }
...@@ -247,7 +247,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block, ...@@ -247,7 +247,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
le16_to_cpu(tag_p->descCRCLength))) le16_to_cpu(tag_p->descCRCLength)))
return bh; return bh;
udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block, udf_debug("Crc failure block %u: crc = %u, crclen = %u\n", block,
le16_to_cpu(tag_p->descCRC), le16_to_cpu(tag_p->descCRC),
le16_to_cpu(tag_p->descCRCLength)); le16_to_cpu(tag_p->descCRCLength));
error_out: error_out:
......
...@@ -164,7 +164,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir, ...@@ -164,7 +164,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
{ {
struct fileIdentDesc *fi = NULL; struct fileIdentDesc *fi = NULL;
loff_t f_pos; loff_t f_pos;
int block, flen; udf_pblk_t block;
int flen;
unsigned char *fname = NULL, *copy_name = NULL; unsigned char *fname = NULL, *copy_name = NULL;
unsigned char *nameptr; unsigned char *nameptr;
uint8_t lfi; uint8_t lfi;
...@@ -352,7 +353,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, ...@@ -352,7 +353,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
int nfidlen; int nfidlen;
uint8_t lfi; uint8_t lfi;
uint16_t liu; uint16_t liu;
int block; udf_pblk_t block;
struct kernel_lb_addr eloc; struct kernel_lb_addr eloc;
uint32_t elen = 0; uint32_t elen = 0;
sector_t offset; sector_t offset;
...@@ -749,7 +750,7 @@ static int empty_dir(struct inode *dir) ...@@ -749,7 +750,7 @@ static int empty_dir(struct inode *dir)
struct udf_fileident_bh fibh; struct udf_fileident_bh fibh;
loff_t f_pos; loff_t f_pos;
loff_t size = udf_ext0_offset(dir) + dir->i_size; loff_t size = udf_ext0_offset(dir) + dir->i_size;
int block; udf_pblk_t block;
struct kernel_lb_addr eloc; struct kernel_lb_addr eloc;
uint32_t elen; uint32_t elen;
sector_t offset; sector_t offset;
...@@ -839,7 +840,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -839,7 +840,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
if (retval) if (retval)
goto end_rmdir; goto end_rmdir;
if (inode->i_nlink != 2) if (inode->i_nlink != 2)
udf_warn(inode->i_sb, "empty directory has nlink != 2 (%d)\n", udf_warn(inode->i_sb, "empty directory has nlink != 2 (%u)\n",
inode->i_nlink); inode->i_nlink);
clear_nlink(inode); clear_nlink(inode);
inode->i_size = 0; inode->i_size = 0;
...@@ -881,7 +882,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) ...@@ -881,7 +882,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
goto end_unlink; goto end_unlink;
if (!inode->i_nlink) { if (!inode->i_nlink) {
udf_debug("Deleting nonexistent file (%lu), %d\n", udf_debug("Deleting nonexistent file (%lu), %u\n",
inode->i_ino, inode->i_nlink); inode->i_ino, inode->i_nlink);
set_nlink(inode, 1); set_nlink(inode, 1);
} }
...@@ -913,7 +914,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, ...@@ -913,7 +914,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
int eoffset, elen = 0; int eoffset, elen = 0;
uint8_t *ea; uint8_t *ea;
int err; int err;
int block; udf_pblk_t block;
unsigned char *name = NULL; unsigned char *name = NULL;
int namelen; int namelen;
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
......
...@@ -32,7 +32,7 @@ uint32_t udf_get_pblock(struct super_block *sb, uint32_t block, ...@@ -32,7 +32,7 @@ uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
struct udf_sb_info *sbi = UDF_SB(sb); struct udf_sb_info *sbi = UDF_SB(sb);
struct udf_part_map *map; struct udf_part_map *map;
if (partition >= sbi->s_partitions) { if (partition >= sbi->s_partitions) {
udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n", udf_debug("block=%u, partition=%u, offset=%u: invalid partition\n",
block, partition, offset); block, partition, offset);
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
...@@ -59,7 +59,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, ...@@ -59,7 +59,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
vdata = &map->s_type_specific.s_virtual; vdata = &map->s_type_specific.s_virtual;
if (block > vdata->s_num_entries) { if (block > vdata->s_num_entries) {
udf_debug("Trying to access block beyond end of VAT (%d max %d)\n", udf_debug("Trying to access block beyond end of VAT (%u max %u)\n",
block, vdata->s_num_entries); block, vdata->s_num_entries);
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
...@@ -83,7 +83,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block, ...@@ -83,7 +83,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
bh = sb_bread(sb, loc); bh = sb_bread(sb, loc);
if (!bh) { if (!bh) {
udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%d,%d) VAT: %d[%d]\n", udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%u,%u) VAT: %u[%u]\n",
sb, block, partition, loc, index); sb, block, partition, loc, index);
return 0xFFFFFFFF; return 0xFFFFFFFF;
} }
......
...@@ -366,7 +366,7 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root) ...@@ -366,7 +366,7 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
if (sbi->s_dmode != UDF_INVALID_MODE) if (sbi->s_dmode != UDF_INVALID_MODE)
seq_printf(seq, ",dmode=%ho", sbi->s_dmode); seq_printf(seq, ",dmode=%ho", sbi->s_dmode);
if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET))
seq_printf(seq, ",session=%u", sbi->s_session); seq_printf(seq, ",session=%d", sbi->s_session);
if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET))
seq_printf(seq, ",lastblock=%u", sbi->s_last_block); seq_printf(seq, ",lastblock=%u", sbi->s_last_block);
if (sbi->s_anchor != 0) if (sbi->s_anchor != 0)
...@@ -703,9 +703,9 @@ static loff_t udf_check_vsd(struct super_block *sb) ...@@ -703,9 +703,9 @@ static loff_t udf_check_vsd(struct super_block *sb)
else else
sectorsize = sb->s_blocksize; sectorsize = sb->s_blocksize;
sector += (sbi->s_session << sb->s_blocksize_bits); sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits);
udf_debug("Starting at sector %u (%ld byte sectors)\n", udf_debug("Starting at sector %u (%lu byte sectors)\n",
(unsigned int)(sector >> sb->s_blocksize_bits), (unsigned int)(sector >> sb->s_blocksize_bits),
sb->s_blocksize); sb->s_blocksize);
/* Process the sequence (if applicable). The hard limit on the sector /* Process the sequence (if applicable). The hard limit on the sector
...@@ -868,7 +868,7 @@ static int udf_find_fileset(struct super_block *sb, ...@@ -868,7 +868,7 @@ static int udf_find_fileset(struct super_block *sb,
if ((fileset->logicalBlockNum != 0xFFFFFFFF || if ((fileset->logicalBlockNum != 0xFFFFFFFF ||
fileset->partitionReferenceNum != 0xFFFF) && bh) { fileset->partitionReferenceNum != 0xFFFF) && bh) {
udf_debug("Fileset at block=%d, partition=%d\n", udf_debug("Fileset at block=%u, partition=%u\n",
fileset->logicalBlockNum, fileset->logicalBlockNum,
fileset->partitionReferenceNum); fileset->partitionReferenceNum);
...@@ -981,14 +981,14 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, ...@@ -981,14 +981,14 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
mdata->s_phys_partition_ref = type1_index; mdata->s_phys_partition_ref = type1_index;
/* metadata address */ /* metadata address */
udf_debug("Metadata file location: block = %d part = %d\n", udf_debug("Metadata file location: block = %u part = %u\n",
mdata->s_meta_file_loc, mdata->s_phys_partition_ref); mdata->s_meta_file_loc, mdata->s_phys_partition_ref);
fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc,
mdata->s_phys_partition_ref); mdata->s_phys_partition_ref);
if (IS_ERR(fe)) { if (IS_ERR(fe)) {
/* mirror file entry */ /* mirror file entry */
udf_debug("Mirror metadata file location: block = %d part = %d\n", udf_debug("Mirror metadata file location: block = %u part = %u\n",
mdata->s_mirror_file_loc, mdata->s_phys_partition_ref); mdata->s_mirror_file_loc, mdata->s_phys_partition_ref);
fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc,
...@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition, ...@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
addr.logicalBlockNum = mdata->s_bitmap_file_loc; addr.logicalBlockNum = mdata->s_bitmap_file_loc;
addr.partitionReferenceNum = mdata->s_phys_partition_ref; addr.partitionReferenceNum = mdata->s_phys_partition_ref;
udf_debug("Bitmap file location: block = %d part = %d\n", udf_debug("Bitmap file location: block = %u part = %u\n",
addr.logicalBlockNum, addr.partitionReferenceNum); addr.logicalBlockNum, addr.partitionReferenceNum);
fe = udf_iget_special(sb, &addr); fe = udf_iget_special(sb, &addr);
...@@ -1042,7 +1042,7 @@ static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh, ...@@ -1042,7 +1042,7 @@ static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh,
UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum); UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum);
udf_debug("Rootdir at block=%d, partition=%d\n", udf_debug("Rootdir at block=%u, partition=%u\n",
root->logicalBlockNum, root->partitionReferenceNum); root->logicalBlockNum, root->partitionReferenceNum);
} }
...@@ -1097,7 +1097,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1097,7 +1097,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE)) if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE))
map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE;
udf_debug("Partition (%d type %x) starts at physical %d, block length %d\n", udf_debug("Partition (%d type %x) starts at physical %u, block length %u\n",
p_index, map->s_partition_type, p_index, map->s_partition_type,
map->s_partition_root, map->s_partition_len); map->s_partition_root, map->s_partition_len);
...@@ -1122,7 +1122,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1122,7 +1122,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
} }
map->s_uspace.s_table = inode; map->s_uspace.s_table = inode;
map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE;
udf_debug("unallocSpaceTable (part %d) @ %ld\n", udf_debug("unallocSpaceTable (part %d) @ %lu\n",
p_index, map->s_uspace.s_table->i_ino); p_index, map->s_uspace.s_table->i_ino);
} }
...@@ -1134,7 +1134,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1134,7 +1134,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
bitmap->s_extPosition = le32_to_cpu( bitmap->s_extPosition = le32_to_cpu(
phd->unallocSpaceBitmap.extPosition); phd->unallocSpaceBitmap.extPosition);
map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
udf_debug("unallocSpaceBitmap (part %d) @ %d\n", udf_debug("unallocSpaceBitmap (part %d) @ %u\n",
p_index, bitmap->s_extPosition); p_index, bitmap->s_extPosition);
} }
...@@ -1157,7 +1157,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1157,7 +1157,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
} }
map->s_fspace.s_table = inode; map->s_fspace.s_table = inode;
map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE;
udf_debug("freedSpaceTable (part %d) @ %ld\n", udf_debug("freedSpaceTable (part %d) @ %lu\n",
p_index, map->s_fspace.s_table->i_ino); p_index, map->s_fspace.s_table->i_ino);
} }
...@@ -1169,7 +1169,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1169,7 +1169,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
bitmap->s_extPosition = le32_to_cpu( bitmap->s_extPosition = le32_to_cpu(
phd->freedSpaceBitmap.extPosition); phd->freedSpaceBitmap.extPosition);
map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
udf_debug("freedSpaceBitmap (part %d) @ %d\n", udf_debug("freedSpaceBitmap (part %d) @ %u\n",
p_index, bitmap->s_extPosition); p_index, bitmap->s_extPosition);
} }
return 0; return 0;
...@@ -1282,7 +1282,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) ...@@ -1282,7 +1282,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
/* First scan for TYPE1 and SPARABLE partitions */ /* First scan for TYPE1 and SPARABLE partitions */
for (i = 0; i < sbi->s_partitions; i++) { for (i = 0; i < sbi->s_partitions; i++) {
map = &sbi->s_partmaps[i]; map = &sbi->s_partmaps[i];
udf_debug("Searching map: (%d == %d)\n", udf_debug("Searching map: (%u == %u)\n",
map->s_partition_num, partitionNumber); map->s_partition_num, partitionNumber);
if (map->s_partition_num == partitionNumber && if (map->s_partition_num == partitionNumber &&
(map->s_partition_type == UDF_TYPE1_MAP15 || (map->s_partition_type == UDF_TYPE1_MAP15 ||
...@@ -1291,7 +1291,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block) ...@@ -1291,7 +1291,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
} }
if (i >= sbi->s_partitions) { if (i >= sbi->s_partitions) {
udf_debug("Partition (%d) not found in partition map\n", udf_debug("Partition (%u) not found in partition map\n",
partitionNumber); partitionNumber);
ret = 0; ret = 0;
goto out_bh; goto out_bh;
...@@ -1483,7 +1483,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, ...@@ -1483,7 +1483,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
struct metadataPartitionMap *mdm = struct metadataPartitionMap *mdm =
(struct metadataPartitionMap *) (struct metadataPartitionMap *)
&(lvd->partitionMaps[offset]); &(lvd->partitionMaps[offset]);
udf_debug("Parsing Logical vol part %d type %d id=%s\n", udf_debug("Parsing Logical vol part %d type %u id=%s\n",
i, type, UDF_ID_METADATA); i, type, UDF_ID_METADATA);
map->s_partition_type = UDF_METADATA_MAP25; map->s_partition_type = UDF_METADATA_MAP25;
...@@ -1505,17 +1505,17 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, ...@@ -1505,17 +1505,17 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
udf_debug("Metadata Ident suffix=0x%x\n", udf_debug("Metadata Ident suffix=0x%x\n",
le16_to_cpu(*(__le16 *) le16_to_cpu(*(__le16 *)
mdm->partIdent.identSuffix)); mdm->partIdent.identSuffix));
udf_debug("Metadata part num=%d\n", udf_debug("Metadata part num=%u\n",
le16_to_cpu(mdm->partitionNum)); le16_to_cpu(mdm->partitionNum));
udf_debug("Metadata part alloc unit size=%d\n", udf_debug("Metadata part alloc unit size=%u\n",
le32_to_cpu(mdm->allocUnitSize)); le32_to_cpu(mdm->allocUnitSize));
udf_debug("Metadata file loc=%d\n", udf_debug("Metadata file loc=%u\n",
le32_to_cpu(mdm->metadataFileLoc)); le32_to_cpu(mdm->metadataFileLoc));
udf_debug("Mirror file loc=%d\n", udf_debug("Mirror file loc=%u\n",
le32_to_cpu(mdm->metadataMirrorFileLoc)); le32_to_cpu(mdm->metadataMirrorFileLoc));
udf_debug("Bitmap file loc=%d\n", udf_debug("Bitmap file loc=%u\n",
le32_to_cpu(mdm->metadataBitmapFileLoc)); le32_to_cpu(mdm->metadataBitmapFileLoc));
udf_debug("Flags: %d %d\n", udf_debug("Flags: %d %u\n",
mdata->s_flags, mdm->flags); mdata->s_flags, mdm->flags);
} else { } else {
udf_debug("Unknown ident: %s\n", udf_debug("Unknown ident: %s\n",
...@@ -1525,7 +1525,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, ...@@ -1525,7 +1525,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum); map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum);
map->s_partition_num = le16_to_cpu(upm2->partitionNum); map->s_partition_num = le16_to_cpu(upm2->partitionNum);
} }
udf_debug("Partition (%d:%d) type %d on volume %d\n", udf_debug("Partition (%d:%u) type %u on volume %u\n",
i, map->s_partition_num, type, map->s_volumeseqnum); i, map->s_partition_num, type, map->s_volumeseqnum);
} }
...@@ -1533,7 +1533,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, ...@@ -1533,7 +1533,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]); struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]);
*fileset = lelb_to_cpu(la->extLocation); *fileset = lelb_to_cpu(la->extLocation);
udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n", udf_debug("FileSet found in LogicalVolDesc at block=%u, partition=%u\n",
fileset->logicalBlockNum, fileset->logicalBlockNum,
fileset->partitionReferenceNum); fileset->partitionReferenceNum);
} }
...@@ -2159,7 +2159,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2159,7 +2159,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
ret = udf_load_vrs(sb, &uopt, silent, &fileset); ret = udf_load_vrs(sb, &uopt, silent, &fileset);
if (ret < 0) { if (ret < 0) {
if (!silent && ret != -EACCES) { if (!silent && ret != -EACCES) {
pr_notice("Scanning with blocksize %d failed\n", pr_notice("Scanning with blocksize %u failed\n",
uopt.blocksize); uopt.blocksize);
} }
brelse(sbi->s_lvid_bh); brelse(sbi->s_lvid_bh);
...@@ -2184,7 +2184,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2184,7 +2184,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
goto error_out; goto error_out;
} }
udf_debug("Lastblock=%d\n", sbi->s_last_block); udf_debug("Lastblock=%u\n", sbi->s_last_block);
if (sbi->s_lvid_bh) { if (sbi->s_lvid_bh) {
struct logicalVolIntegrityDescImpUse *lvidiu = struct logicalVolIntegrityDescImpUse *lvidiu =
...@@ -2255,7 +2255,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -2255,7 +2255,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
/* perhaps it's not extensible enough, but for now ... */ /* perhaps it's not extensible enough, but for now ... */
inode = udf_iget(sb, &rootdir); inode = udf_iget(sb, &rootdir);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", udf_err(sb, "Error in udf_iget, block=%u, partition=%u\n",
rootdir.logicalBlockNum, rootdir.partitionReferenceNum); rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
ret = PTR_ERR(inode); ret = PTR_ERR(inode);
goto error_out; goto error_out;
...@@ -2389,7 +2389,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, ...@@ -2389,7 +2389,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb,
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
unsigned int accum = 0; unsigned int accum = 0;
int index; int index;
int block = 0, newblock; udf_pblk_t block = 0, newblock;
struct kernel_lb_addr loc; struct kernel_lb_addr loc;
uint32_t bytes; uint32_t bytes;
uint8_t *ptr; uint8_t *ptr;
......
...@@ -48,7 +48,7 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos, ...@@ -48,7 +48,7 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
if (elen != nelen) { if (elen != nelen) {
udf_write_aext(inode, epos, &neloc, nelen, 0); udf_write_aext(inode, epos, &neloc, nelen, 0);
if (last_block - first_block > 0) { if (last_block > first_block) {
if (etype == (EXT_RECORDED_ALLOCATED >> 30)) if (etype == (EXT_RECORDED_ALLOCATED >> 30))
mark_inode_dirty(inode); mark_inode_dirty(inode);
......
...@@ -73,6 +73,8 @@ static inline size_t udf_ext0_offset(struct inode *inode) ...@@ -73,6 +73,8 @@ static inline size_t udf_ext0_offset(struct inode *inode)
/* computes tag checksum */ /* computes tag checksum */
u8 udf_tag_checksum(const struct tag *t); u8 udf_tag_checksum(const struct tag *t);
typedef uint32_t udf_pblk_t;
struct dentry; struct dentry;
struct inode; struct inode;
struct task_struct; struct task_struct;
...@@ -144,15 +146,17 @@ static inline struct inode *udf_iget(struct super_block *sb, ...@@ -144,15 +146,17 @@ static inline struct inode *udf_iget(struct super_block *sb,
return __udf_iget(sb, ino, false); return __udf_iget(sb, ino, false);
} }
extern int udf_expand_file_adinicb(struct inode *); extern int udf_expand_file_adinicb(struct inode *);
extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); extern struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
extern struct buffer_head *udf_bread(struct inode *, int, int, int *); udf_pblk_t *block, int *err);
extern struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
int create, int *err);
extern int udf_setsize(struct inode *, loff_t); extern int udf_setsize(struct inode *, loff_t);
extern void udf_evict_inode(struct inode *); extern void udf_evict_inode(struct inode *);
extern int udf_write_inode(struct inode *, struct writeback_control *wbc); extern int udf_write_inode(struct inode *, struct writeback_control *wbc);
extern long udf_block_map(struct inode *, sector_t); extern udf_pblk_t udf_block_map(struct inode *inode, sector_t block);
extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *,
struct kernel_lb_addr *, uint32_t *, sector_t *); struct kernel_lb_addr *, uint32_t *, sector_t *);
extern int udf_setup_indirect_aext(struct inode *inode, int block, extern int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
struct extent_position *epos); struct extent_position *epos);
extern int __udf_add_aext(struct inode *inode, struct extent_position *epos, extern int __udf_add_aext(struct inode *inode, struct extent_position *epos,
struct kernel_lb_addr *eloc, uint32_t elen, int inc); struct kernel_lb_addr *eloc, uint32_t elen, int inc);
...@@ -168,8 +172,9 @@ extern int8_t udf_current_aext(struct inode *, struct extent_position *, ...@@ -168,8 +172,9 @@ extern int8_t udf_current_aext(struct inode *, struct extent_position *,
struct kernel_lb_addr *, uint32_t *, int); struct kernel_lb_addr *, uint32_t *, int);
/* misc.c */ /* misc.c */
extern struct buffer_head *udf_tgetblk(struct super_block *, int); extern struct buffer_head *udf_tgetblk(struct super_block *sb,
extern struct buffer_head *udf_tread(struct super_block *, int); udf_pblk_t block);
extern struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block);
extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t,
uint32_t, uint8_t); uint32_t, uint8_t);
extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t,
...@@ -228,8 +233,8 @@ extern void udf_free_blocks(struct super_block *, struct inode *, ...@@ -228,8 +233,8 @@ extern void udf_free_blocks(struct super_block *, struct inode *,
struct kernel_lb_addr *, uint32_t, uint32_t); struct kernel_lb_addr *, uint32_t, uint32_t);
extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t,
uint32_t, uint32_t); uint32_t, uint32_t);
extern int udf_new_block(struct super_block *, struct inode *, uint16_t, extern udf_pblk_t udf_new_block(struct super_block *sb, struct inode *inode,
uint32_t, int *); uint16_t partition, uint32_t goal, int *err);
/* directory.c */ /* directory.c */
extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *, extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *,
......
...@@ -200,7 +200,7 @@ static int udf_name_from_CS0(uint8_t *str_o, int str_max_len, ...@@ -200,7 +200,7 @@ static int udf_name_from_CS0(uint8_t *str_o, int str_max_len,
cmp_id = ocu[0]; cmp_id = ocu[0];
if (cmp_id != 8 && cmp_id != 16) { if (cmp_id != 8 && cmp_id != 16) {
memset(str_o, 0, str_max_len); memset(str_o, 0, str_max_len);
pr_err("unknown compression code (%d)\n", cmp_id); pr_err("unknown compression code (%u)\n", cmp_id);
return -EINVAL; return -EINVAL;
} }
u_ch = cmp_id >> 3; u_ch = cmp_id >> 3;
......
...@@ -356,6 +356,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm, ...@@ -356,6 +356,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
extern void __audit_log_capset(const struct cred *new, const struct cred *old); extern void __audit_log_capset(const struct cred *new, const struct cred *old);
extern void __audit_mmap_fd(int fd, int flags); extern void __audit_mmap_fd(int fd, int flags);
extern void __audit_log_kern_module(char *name); extern void __audit_log_kern_module(char *name);
extern void __audit_fanotify(unsigned int response);
static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp) static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
{ {
...@@ -452,6 +453,12 @@ static inline void audit_log_kern_module(char *name) ...@@ -452,6 +453,12 @@ static inline void audit_log_kern_module(char *name)
__audit_log_kern_module(name); __audit_log_kern_module(name);
} }
static inline void audit_fanotify(unsigned int response)
{
if (!audit_dummy_context())
__audit_fanotify(response);
}
extern int audit_n_rules; extern int audit_n_rules;
extern int audit_signals; extern int audit_signals;
#else /* CONFIG_AUDITSYSCALL */ #else /* CONFIG_AUDITSYSCALL */
...@@ -568,6 +575,9 @@ static inline void audit_log_kern_module(char *name) ...@@ -568,6 +575,9 @@ static inline void audit_log_kern_module(char *name)
{ {
} }
static inline void audit_fanotify(unsigned int response)
{ }
static inline void audit_ptrace(struct task_struct *t) static inline void audit_ptrace(struct task_struct *t)
{ } { }
#define audit_n_rules 0 #define audit_n_rules 0
......
...@@ -190,6 +190,7 @@ struct fsnotify_group { ...@@ -190,6 +190,7 @@ struct fsnotify_group {
int f_flags; int f_flags;
unsigned int max_marks; unsigned int max_marks;
struct user_struct *user; struct user_struct *user;
bool audit;
} fanotify_data; } fanotify_data;
#endif /* CONFIG_FANOTIFY */ #endif /* CONFIG_FANOTIFY */
}; };
......
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
#define AUDIT_FEATURE_CHANGE 1328 /* audit log listing feature changes */ #define AUDIT_FEATURE_CHANGE 1328 /* audit log listing feature changes */
#define AUDIT_REPLACE 1329 /* Replace auditd if this packet unanswerd */ #define AUDIT_REPLACE 1329 /* Replace auditd if this packet unanswerd */
#define AUDIT_KERN_MODULE 1330 /* Kernel Module events */ #define AUDIT_KERN_MODULE 1330 /* Kernel Module events */
#define AUDIT_FANOTIFY 1331 /* Fanotify access decision */
#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define FAN_UNLIMITED_QUEUE 0x00000010 #define FAN_UNLIMITED_QUEUE 0x00000010
#define FAN_UNLIMITED_MARKS 0x00000020 #define FAN_UNLIMITED_MARKS 0x00000020
#define FAN_ENABLE_AUDIT 0x00000040
#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \ #define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\ FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
...@@ -99,6 +100,8 @@ struct fanotify_response { ...@@ -99,6 +100,8 @@ struct fanotify_response {
/* Legit userspace responses to a _PERM event */ /* Legit userspace responses to a _PERM event */
#define FAN_ALLOW 0x01 #define FAN_ALLOW 0x01
#define FAN_DENY 0x02 #define FAN_DENY 0x02
#define FAN_AUDIT 0x10 /* Bit mask to create audit record for result */
/* No fd set in event */ /* No fd set in event */
#define FAN_NOFD -1 #define FAN_NOFD -1
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#define ISODCL(from, to) (to - from + 1) #define ISODCL(from, to) (to - from + 1)
struct iso_volume_descriptor { struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */ __u8 type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)]; char id[ISODCL(2,6)];
char version[ISODCL(7,7)]; __u8 version[ISODCL(7,7)];
char data[ISODCL(8,2048)]; __u8 data[ISODCL(8,2048)];
}; };
/* volume descriptor types */ /* volume descriptor types */
...@@ -26,24 +26,24 @@ struct iso_volume_descriptor { ...@@ -26,24 +26,24 @@ struct iso_volume_descriptor {
#define ISO_STANDARD_ID "CD001" #define ISO_STANDARD_ID "CD001"
struct iso_primary_descriptor { struct iso_primary_descriptor {
char type [ISODCL ( 1, 1)]; /* 711 */ __u8 type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)]; char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */ __u8 version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)]; __u8 unused1 [ISODCL ( 8, 8)];
char system_id [ISODCL ( 9, 40)]; /* achars */ char system_id [ISODCL ( 9, 40)]; /* achars */
char volume_id [ISODCL ( 41, 72)]; /* dchars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */
char unused2 [ISODCL ( 73, 80)]; __u8 unused2 [ISODCL ( 73, 80)];
char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */
char unused3 [ISODCL ( 89, 120)]; __u8 unused3 [ISODCL ( 89, 120)];
char volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */
char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */
char logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */
char path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */
char type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */
char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
char type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */
char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */
char volume_set_id [ISODCL (191, 318)]; /* dchars */ char volume_set_id [ISODCL (191, 318)]; /* dchars */
char publisher_id [ISODCL (319, 446)]; /* achars */ char publisher_id [ISODCL (319, 446)]; /* achars */
char preparer_id [ISODCL (447, 574)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */
...@@ -51,36 +51,36 @@ struct iso_primary_descriptor { ...@@ -51,36 +51,36 @@ struct iso_primary_descriptor {
char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
char file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */
char unused4 [ISODCL (883, 883)]; __u8 unused4 [ISODCL (883, 883)];
char application_data [ISODCL (884, 1395)]; __u8 application_data [ISODCL (884, 1395)];
char unused5 [ISODCL (1396, 2048)]; __u8 unused5 [ISODCL (1396, 2048)];
}; };
/* Almost the same as the primary descriptor but two fields are specified */ /* Almost the same as the primary descriptor but two fields are specified */
struct iso_supplementary_descriptor { struct iso_supplementary_descriptor {
char type [ISODCL ( 1, 1)]; /* 711 */ __u8 type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)]; char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */ __u8 version [ISODCL ( 7, 7)]; /* 711 */
char flags [ISODCL ( 8, 8)]; /* 853 */ __u8 flags [ISODCL ( 8, 8)]; /* 853 */
char system_id [ISODCL ( 9, 40)]; /* achars */ char system_id [ISODCL ( 9, 40)]; /* achars */
char volume_id [ISODCL ( 41, 72)]; /* dchars */ char volume_id [ISODCL ( 41, 72)]; /* dchars */
char unused2 [ISODCL ( 73, 80)]; __u8 unused2 [ISODCL ( 73, 80)];
char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ __u8 volume_space_size [ISODCL ( 81, 88)]; /* 733 */
char escape [ISODCL ( 89, 120)]; /* 856 */ __u8 escape [ISODCL ( 89, 120)]; /* 856 */
char volume_set_size [ISODCL (121, 124)]; /* 723 */ __u8 volume_set_size [ISODCL (121, 124)]; /* 723 */
char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ __u8 volume_sequence_number [ISODCL (125, 128)]; /* 723 */
char logical_block_size [ISODCL (129, 132)]; /* 723 */ __u8 logical_block_size [ISODCL (129, 132)]; /* 723 */
char path_table_size [ISODCL (133, 140)]; /* 733 */ __u8 path_table_size [ISODCL (133, 140)]; /* 733 */
char type_l_path_table [ISODCL (141, 144)]; /* 731 */ __u8 type_l_path_table [ISODCL (141, 144)]; /* 731 */
char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ __u8 opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
char type_m_path_table [ISODCL (149, 152)]; /* 732 */ __u8 type_m_path_table [ISODCL (149, 152)]; /* 732 */
char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ __u8 opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ __u8 root_directory_record [ISODCL (157, 190)]; /* 9.1 */
char volume_set_id [ISODCL (191, 318)]; /* dchars */ char volume_set_id [ISODCL (191, 318)]; /* dchars */
char publisher_id [ISODCL (319, 446)]; /* achars */ char publisher_id [ISODCL (319, 446)]; /* achars */
char preparer_id [ISODCL (447, 574)]; /* achars */ char preparer_id [ISODCL (447, 574)]; /* achars */
...@@ -88,54 +88,54 @@ struct iso_supplementary_descriptor { ...@@ -88,54 +88,54 @@ struct iso_supplementary_descriptor {
char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ __u8 creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ __u8 modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ __u8 expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ __u8 effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
char file_structure_version [ISODCL (882, 882)]; /* 711 */ __u8 file_structure_version [ISODCL (882, 882)]; /* 711 */
char unused4 [ISODCL (883, 883)]; __u8 unused4 [ISODCL (883, 883)];
char application_data [ISODCL (884, 1395)]; __u8 application_data [ISODCL (884, 1395)];
char unused5 [ISODCL (1396, 2048)]; __u8 unused5 [ISODCL (1396, 2048)];
}; };
#define HS_STANDARD_ID "CDROM" #define HS_STANDARD_ID "CDROM"
struct hs_volume_descriptor { struct hs_volume_descriptor {
char foo [ISODCL ( 1, 8)]; /* 733 */ __u8 foo [ISODCL ( 1, 8)]; /* 733 */
char type [ISODCL ( 9, 9)]; /* 711 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */
char id [ISODCL ( 10, 14)]; char id [ISODCL ( 10, 14)];
char version [ISODCL ( 15, 15)]; /* 711 */ __u8 version [ISODCL ( 15, 15)]; /* 711 */
char data[ISODCL(16,2048)]; __u8 data[ISODCL(16,2048)];
}; };
struct hs_primary_descriptor { struct hs_primary_descriptor {
char foo [ISODCL ( 1, 8)]; /* 733 */ __u8 foo [ISODCL ( 1, 8)]; /* 733 */
char type [ISODCL ( 9, 9)]; /* 711 */ __u8 type [ISODCL ( 9, 9)]; /* 711 */
char id [ISODCL ( 10, 14)]; __u8 id [ISODCL ( 10, 14)];
char version [ISODCL ( 15, 15)]; /* 711 */ __u8 version [ISODCL ( 15, 15)]; /* 711 */
char unused1 [ISODCL ( 16, 16)]; /* 711 */ __u8 unused1 [ISODCL ( 16, 16)]; /* 711 */
char system_id [ISODCL ( 17, 48)]; /* achars */ char system_id [ISODCL ( 17, 48)]; /* achars */
char volume_id [ISODCL ( 49, 80)]; /* dchars */ char volume_id [ISODCL ( 49, 80)]; /* dchars */
char unused2 [ISODCL ( 81, 88)]; /* 733 */ __u8 unused2 [ISODCL ( 81, 88)]; /* 733 */
char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ __u8 volume_space_size [ISODCL ( 89, 96)]; /* 733 */
char unused3 [ISODCL ( 97, 128)]; /* 733 */ __u8 unused3 [ISODCL ( 97, 128)]; /* 733 */
char volume_set_size [ISODCL (129, 132)]; /* 723 */ __u8 volume_set_size [ISODCL (129, 132)]; /* 723 */
char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ __u8 volume_sequence_number [ISODCL (133, 136)]; /* 723 */
char logical_block_size [ISODCL (137, 140)]; /* 723 */ __u8 logical_block_size [ISODCL (137, 140)]; /* 723 */
char path_table_size [ISODCL (141, 148)]; /* 733 */ __u8 path_table_size [ISODCL (141, 148)]; /* 733 */
char type_l_path_table [ISODCL (149, 152)]; /* 731 */ __u8 type_l_path_table [ISODCL (149, 152)]; /* 731 */
char unused4 [ISODCL (153, 180)]; /* 733 */ __u8 unused4 [ISODCL (153, 180)]; /* 733 */
char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ __u8 root_directory_record [ISODCL (181, 214)]; /* 9.1 */
}; };
/* We use this to help us look up the parent inode numbers. */ /* We use this to help us look up the parent inode numbers. */
struct iso_path_table{ struct iso_path_table{
unsigned char name_len[2]; /* 721 */ __u8 name_len[2]; /* 721 */
char extent[4]; /* 731 */ __u8 extent[4]; /* 731 */
char parent[2]; /* 721 */ __u8 parent[2]; /* 721 */
char name[0]; char name[0];
} __attribute__((packed)); } __attribute__((packed));
...@@ -143,16 +143,16 @@ struct iso_path_table{ ...@@ -143,16 +143,16 @@ struct iso_path_table{
there is an extra reserved byte after the flags */ there is an extra reserved byte after the flags */
struct iso_directory_record { struct iso_directory_record {
char length [ISODCL (1, 1)]; /* 711 */ __u8 length [ISODCL (1, 1)]; /* 711 */
char ext_attr_length [ISODCL (2, 2)]; /* 711 */ __u8 ext_attr_length [ISODCL (2, 2)]; /* 711 */
char extent [ISODCL (3, 10)]; /* 733 */ __u8 extent [ISODCL (3, 10)]; /* 733 */
char size [ISODCL (11, 18)]; /* 733 */ __u8 size [ISODCL (11, 18)]; /* 733 */
char date [ISODCL (19, 25)]; /* 7 by 711 */ __u8 date [ISODCL (19, 25)]; /* 7 by 711 */
char flags [ISODCL (26, 26)]; __u8 flags [ISODCL (26, 26)];
char file_unit_size [ISODCL (27, 27)]; /* 711 */ __u8 file_unit_size [ISODCL (27, 27)]; /* 711 */
char interleave [ISODCL (28, 28)]; /* 711 */ __u8 interleave [ISODCL (28, 28)]; /* 711 */
char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ __u8 volume_sequence_number [ISODCL (29, 32)]; /* 723 */
unsigned char name_len [ISODCL (33, 33)]; /* 711 */ __u8 name_len [ISODCL (33, 33)]; /* 711 */
char name [0]; char name [0];
} __attribute__((packed)); } __attribute__((packed));
......
...@@ -2390,6 +2390,12 @@ void __audit_log_kern_module(char *name) ...@@ -2390,6 +2390,12 @@ void __audit_log_kern_module(char *name)
context->type = AUDIT_KERN_MODULE; context->type = AUDIT_KERN_MODULE;
} }
void __audit_fanotify(unsigned int response)
{
audit_log(current->audit_context, GFP_KERNEL,
AUDIT_FANOTIFY, "resp=%u", response);
}
static void audit_log_task(struct audit_buffer *ab) static void audit_log_task(struct audit_buffer *ab)
{ {
kuid_t auid, uid; kuid_t auid, uid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment