Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/ext2fs/ext2_extattr.c
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | ext2_extattr_inode_list(struct inode *ip, int attrnamespace, | ||||
} | } | ||||
struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | ||||
((char *)bp->b_data + | ((char *)bp->b_data + | ||||
EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | ||||
/* Check attributes magic value */ | /* Check attributes magic value */ | ||||
header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | ||||
E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); | E2FS_REV0_INODE_SIZE + le16toh(dinode->e2di_extra_isize)); | ||||
if (header->h_magic != EXTATTR_MAGIC) { | if (header->h_magic != EXTATTR_MAGIC) { | ||||
brelse(bp); | brelse(bp); | ||||
return (0); | return (0); | ||||
} | } | ||||
error = ext2_extattr_check(EXT2_IFIRST(header), | error = ext2_extattr_check(EXT2_IFIRST(header), | ||||
(char *)dinode + EXT2_INODE_SIZE(fs)); | (char *)dinode + EXT2_INODE_SIZE(fs)); | ||||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | ext2_extattr_inode_get(struct inode *ip, int attrnamespace, | ||||
} | } | ||||
struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | ||||
((char *)bp->b_data + | ((char *)bp->b_data + | ||||
EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | ||||
/* Check attributes magic value */ | /* Check attributes magic value */ | ||||
header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | ||||
E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); | E2FS_REV0_INODE_SIZE + le16toh(dinode->e2di_extra_isize)); | ||||
if (header->h_magic != EXTATTR_MAGIC) { | if (header->h_magic != EXTATTR_MAGIC) { | ||||
brelse(bp); | brelse(bp); | ||||
return (ENOATTR); | return (ENOATTR); | ||||
} | } | ||||
error = ext2_extattr_check(EXT2_IFIRST(header), | error = ext2_extattr_check(EXT2_IFIRST(header), | ||||
(char *)dinode + EXT2_INODE_SIZE(fs)); | (char *)dinode + EXT2_INODE_SIZE(fs)); | ||||
▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | ext2_extattr_inode_delete(struct inode *ip, int attrnamespace, const char *name) | ||||
} | } | ||||
struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | ||||
((char *)bp->b_data + | ((char *)bp->b_data + | ||||
EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | ||||
/* Check attributes magic value */ | /* Check attributes magic value */ | ||||
header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | ||||
E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); | E2FS_REV0_INODE_SIZE + le16toh(dinode->e2di_extra_isize)); | ||||
if (header->h_magic != EXTATTR_MAGIC) { | if (header->h_magic != EXTATTR_MAGIC) { | ||||
brelse(bp); | brelse(bp); | ||||
return (ENOATTR); | return (ENOATTR); | ||||
} | } | ||||
error = ext2_extattr_check(EXT2_IFIRST(header), | error = ext2_extattr_check(EXT2_IFIRST(header), | ||||
(char *)dinode + EXT2_INODE_SIZE(fs)); | (char *)dinode + EXT2_INODE_SIZE(fs)); | ||||
▲ Show 20 Lines • Show All 346 Lines • ▼ Show 20 Lines | ext2_extattr_inode_set(struct inode *ip, int attrnamespace, | ||||
} | } | ||||
struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | struct ext2fs_dinode *dinode = (struct ext2fs_dinode *) | ||||
((char *)bp->b_data + | ((char *)bp->b_data + | ||||
EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)); | ||||
/* Check attributes magic value */ | /* Check attributes magic value */ | ||||
header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | header = (struct ext2fs_extattr_dinode_header *)((char *)dinode + | ||||
E2FS_REV0_INODE_SIZE + dinode->e2di_extra_isize); | E2FS_REV0_INODE_SIZE + le16toh(dinode->e2di_extra_isize)); | ||||
if (header->h_magic != EXTATTR_MAGIC) { | if (header->h_magic != EXTATTR_MAGIC) { | ||||
brelse(bp); | brelse(bp); | ||||
return (ENOSPC); | return (ENOSPC); | ||||
} | } | ||||
error = ext2_extattr_check(EXT2_IFIRST(header), (char *)dinode + | error = ext2_extattr_check(EXT2_IFIRST(header), (char *)dinode + | ||||
EXT2_INODE_SIZE(fs)); | EXT2_INODE_SIZE(fs)); | ||||
Show All 18 Lines | for (entry = EXT2_IFIRST(header); !EXT2_IS_LAST_ENTRY(entry); | ||||
} | } | ||||
if (strlen(name) == name_len && | if (strlen(name) == name_len && | ||||
0 == strncmp(attr_name, name, name_len)) | 0 == strncmp(attr_name, name, name_len)) | ||||
break; | break; | ||||
} | } | ||||
max_size = EXT2_INODE_SIZE(fs) - E2FS_REV0_INODE_SIZE - | max_size = EXT2_INODE_SIZE(fs) - E2FS_REV0_INODE_SIZE - | ||||
dinode->e2di_extra_isize; | le16toh(dinode->e2di_extra_isize); | ||||
if (!EXT2_IS_LAST_ENTRY(entry)) { | if (!EXT2_IS_LAST_ENTRY(entry)) { | ||||
size = ext2_extattr_get_size(EXT2_IFIRST(header), entry, | size = ext2_extattr_get_size(EXT2_IFIRST(header), entry, | ||||
sizeof(struct ext2fs_extattr_dinode_header), | sizeof(struct ext2fs_extattr_dinode_header), | ||||
entry->e_name_len, uio->uio_resid); | entry->e_name_len, uio->uio_resid); | ||||
if (size > max_size) { | if (size > max_size) { | ||||
brelse(bp); | brelse(bp); | ||||
return (ENOSPC); | return (ENOSPC); | ||||
▲ Show 20 Lines • Show All 284 Lines • Show Last 20 Lines |